编辑器

修正namespace导致变慢的问题
This commit is contained in:
JianjunLiu 2023-04-18 16:10:47 +08:00
parent 97fbfda3ac
commit 1c0fe31233
4 changed files with 99 additions and 46 deletions

View File

@ -3955,6 +3955,7 @@ type TEditer=class(TCustomcontrol) //
begin begin
for i,v in fs do for i,v in fs do
begin begin
if not FIsFinding then break;
ri := matchword(i,d); ri := matchword(i,d);
if ri then if ri then
begin begin

View File

@ -1795,7 +1795,6 @@ type TTsfFileParser = class() //
end end
"parserstring": "parserstring":
begin begin
mtic;
r := parserstring(o,d); r := parserstring(o,d);
return r; return r;
end end
@ -1863,7 +1862,7 @@ type TTsfFileParser = class() //
function parserstring(o,d); function parserstring(o,d);
begin begin
rti := 0; rti := 0;
rt := array(); rt := array();
m := d["minus"]; m := d["minus"];
if ifstring(m) then m := lowercase(m); if ifstring(m) then m := lowercase(m);
filechanged(m); filechanged(m);
@ -2147,7 +2146,7 @@ type TTsfFileParser = class() //
begin begin
return ReadParseredFile((n+".tsf"),true); return ReadParseredFile((n+".tsf"),true);
end end
end end
function parserafile(dir,v); function parserafile(dir,v);
begin begin
fn := lowercase( v["FileName"]); fn := lowercase( v["FileName"]);
@ -2242,11 +2241,8 @@ type TTsfFileParser = class() //
if FCacheDir then if FCacheDir then
begin begin
fn := FCacheDir+fiofs+"lasttime"+fiofs+ModifyFname(n)+".t"; fn := FCacheDir+fiofs+"lasttime"+fiofs+ModifyFname(n)+".t";
if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then if importfile(ftstream(),"",fn,d)=1 then
begin begin
nns := d["nspace"];
nn := d["name"];
FNsCaches[nn][nns] := 1;
return d; return d;
end end
end end
@ -2254,22 +2250,36 @@ type TTsfFileParser = class() //
function ReadParseredFile(n,g); //¶ÁÈ¡½âÎöµÄÎļþ function ReadParseredFile(n,g); //¶ÁÈ¡½âÎöµÄÎļþ
begin begin
if FCacheDir then if FCacheDir then
begin begin
ln := lowercase(n);
if not ifarray(FFilePaths) then FFilePaths := array(); if not ifarray(FFilePaths) then FFilePaths := array();
if not(FFileNames[lowercase(n)]) then return ; if not(FFileNames[ln]) then return ;
if not ifarray(FCacheS ) then FCacheS := array(); if not ifarray(FCacheS ) then FCacheS := array();
d := FCacheS[lowercase(n)]; fp := FCacheS[ln,"fullpath"];
if d then if fp then
begin begin
FFilePaths[lowercase(n)] := d["fullpath"]; FFilePaths[ln] := fp;
if g then return d; nns := FCacheS[ln,"nspace"];
if nns then
begin
nn := FCacheS[ln,"name"];
FNsCaches[nn][nns] := 1;
end
if g then return FCacheS[ln];
return 1; return 1;
end end
fn := FCacheDir+fiofs+ModifyFname(n)+".p"; fn := FCacheDir+fiofs+ModifyFname(n)+".p";
if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then
begin begin
FCacheS[lowercase(n)] := d;//new tparserdobject(d); FCacheS[ln] := d;//new tparserdobject(d);
FFilePaths[lowercase(n)] := d["fullpath"]; FFilePaths[ln] := d["fullpath"];
nns := d["nspace"];
if nns then
begin
nn := d["name"];
FNsCaches[nn][nns] := 1;
end
if g then return d; if g then return d;
return 1; return 1;
end end

View File

@ -26,7 +26,7 @@ type tcustomscrollcontrol = class(TCustomControl)
function SetWhileStep(v); function SetWhileStep(v);
begin begin
if not v>=1 then return ; if not(v>=1) then return ;
nv := integer(v); nv := integer(v);
if FWhileStep=nv then return ; if FWhileStep=nv then return ;
FWhileStep := nv; FWhileStep := nv;
@ -333,16 +333,18 @@ type tcustomscrollcontrol = class(TCustomControl)
_wapi.GetScrollInfo(hwnd,SB_VERT,FSI._getptr_); _wapi.GetScrollInfo(hwnd,SB_VERT,FSI._getptr_);
// 保存当前滑块位置,迟些进行比较 // 保存当前滑块位置,迟些进行比较
yPos := FSI.nPos; yPos := FSI.nPos;
dd := 0; dd := 0;
if e.delta<0 and FSI.nMax>yPos then edelta := e.delta;
ew := abs(round(edelta/120));
if edelta<0 and FSI.nMax>yPos then
begin begin
//dd++; //dd++;
dd += FWhileStep; dd += FWhileStep*ew;
end end
if e.delta>0 and FSI.nMin<yPos then if edelta>0 and FSI.nMin<yPos then
begin begin
//dd--; //dd--;
dd -= FWhileStep; dd -= FWhileStep*ew;
end end
if not dd then return; if not dd then return;
FSI.fMask := SIF_POS; FSI.fMask := SIF_POS;

View File

@ -6441,30 +6441,40 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
end end
if ri and rxy then if ri and rxy then
begin begin
//if hasMessageFromGtkMessageQueue(-1,_const.LM_MOUSEWHEEL) then return true; //20230417ÔÝʱÆÁ±Î //if hasMessageFromGtkMessageQueue(-1,_const.LM_MOUSEWHEEL) then return true; //20230417ÔÝʱÆÁ±Î
if hasMessageFromGtkMessageQueue(-1,_const.WM_SIZE) then return true; if hasMessageFromGtkMessageQueue(-1,_const.WM_SIZE) then return true;
if hasMessageFromGtkMessageQueue(-1,_const.WM_MOUSEMOVE) then return true; //if hasMessageFromGtkMessageQueue(-1,_const.WM_MOUSEMOVE) then return true;
WHEEL_DELTA := 120;
FScrollT := now(); FScrollT := now();
dr := (dr=1)?-1:1; dr := (dr=1)?(-WHEEL_DELTA):(WHEEL_DELTA);
whist := feacheasylostMessageFromGtkMessageQueue(ri,_const.LM_MOUSEWHEEL);
xy := makelong(rxy[0],rxy[1]); for ii,iiv in whist do
ctl := 0; begin
global g_gtk_buttontable,g_gtk_keytable; iivw := iiv[2];
if ifarray(g_gtk_buttontable) then lowuperdword(iivw,iivc,iivdir);
begin dr+=iivdir;
ctl .|= g_gtk_buttontable[0]; end
ctl .|= g_gtk_buttontable[1]; if dr=0 then return true;
end
if ifarray(g_gtk_keytable) then xy := makelong(rxy[0],rxy[1]);
begin ctl := 0;
if g_gtk_keytable[0x10] then ctl .|= _const.MK_Shift; global g_gtk_buttontable,g_gtk_keytable;
if g_gtk_keytable[0x11] then ctl .|= _const.MK_Control; if ifarray(g_gtk_buttontable) then
end begin
dr := makelong(ctl,dr); ctl .|= g_gtk_buttontable[0];
//clearMessageFromGtkMessageQueue(ri,_const.LM_MOUSEWHEEL); ctl .|= g_gtk_buttontable[1];
AddMessageToGtkMessageQueue(ri,_const.LM_MOUSEWHEEL,dr,xy,1); end
return true; if ifarray(g_gtk_keytable) then
begin
if g_gtk_keytable[0x10] then ctl .|= _const.MK_Shift;
if g_gtk_keytable[0x11] then ctl .|= _const.MK_Control;
end
dr := makelong(ctl,dr);
//clearMessageFromGtkMessageQueue(ri,_const.LM_MOUSEWHEEL);
AddMessageToGtkMessageQueue(ri,_const.LM_MOUSEWHEEL,dr,xy,1);
return true;
end end
end end
@ -6793,16 +6803,40 @@ type tGtkMessageQueue=class //
begin begin
Clean(); Clean();
end end
///////////////处理一下////////////////
if r and r[1]=0x020a then
begin
end
///////////////////////
unlock(); unlock();
return r; return r;
end end
function feacheasylostmessage(h,m);
begin
r := array();
ri := 0;
idx := FCurrent;
lock();
while idx<FLen do
begin
if FData[idx][0]=h and FData[idx][1]=m then
begin
r[ri++] := FData[idx];
FData[idx][0]:= 0;
end
idx++;
end
unlock();
return r;
end
function cleaneasyLostMessage(h,m); function cleaneasyLostMessage(h,m);
begin begin
idx := FCurrent; idx := FCurrent;
lock(); lock();
while idx<FLen do while idx<FLen do
begin begin
if FData[idx][0]=h and FData[idx][0]=m then if FData[idx][0]=h and FData[idx][1]=m then
begin begin
FData[idx][0]:= 0; FData[idx][0]:= 0;
end end
@ -6815,7 +6849,7 @@ type tGtkMessageQueue=class //
idx := FCurrent; idx := FCurrent;
if idx<FLen then if idx<FLen then
begin begin
if((h=-1)or(FData[idx][0]=h))and FData[idx][0]=m then if((h=-1)or(FData[idx][0]=h))and FData[idx][1]=m then
begin begin
return 1; return 1;
end end
@ -6881,6 +6915,12 @@ begin
GLobal G_GTK_MESSAGE_QUEUE_A; GLobal G_GTK_MESSAGE_QUEUE_A;
if G_GTK_MESSAGE_QUEUE_A then G_GTK_MESSAGE_QUEUE_A.haseasyLostMessage(h,m); if G_GTK_MESSAGE_QUEUE_A then G_GTK_MESSAGE_QUEUE_A.haseasyLostMessage(h,m);
end end
function feacheasylostMessageFromGtkMessageQueue(h,m); //获取容丢失的消息
begin
GLobal G_GTK_MESSAGE_QUEUE_A;
if G_GTK_MESSAGE_QUEUE_A then return G_GTK_MESSAGE_QUEUE_A.feacheasylostmessage(h,m);
end
function clearMessageFromGtkMessageQueue(h,m); //Çå³ýÏûÏ¢ function clearMessageFromGtkMessageQueue(h,m); //Çå³ýÏûÏ¢
begin begin
GLobal G_GTK_MESSAGE_QUEUE_A; GLobal G_GTK_MESSAGE_QUEUE_A;