编辑器

优化
This commit is contained in:
JianjunLiu 2023-04-24 15:46:19 +08:00
parent a60b46689f
commit e4aa4fe0cf
2 changed files with 40 additions and 37 deletions

View File

@ -5935,7 +5935,7 @@ type TFindWnd=class(TPage)
if it then
begin
s1 := it.SelText;
if s1 and length(s1)<20 and not(pos("\n",s1))then
if s1 and not(pos("\n",s1))then //length(s1)<20 and È¡Ïû³¤¶ÈÏÞÖÆ
begin
s := s1;
end else

View File

@ -2585,26 +2585,28 @@ type tsgtkapi = class(tgtkapis)
//cairo_fill(hcr);
cairo_destroy(hcr); //?
end
private
g_gtk_caret_cache_timer;
function docarettime(p:pointer):integer;cdecl;
begin
global g_current_get_focus_widget;
h := g_current_get_focus_widget;
if not h then return 1;
if not g_object_get_data(h,"caretshow") then return 1;
GetCaretPos(xy);
drawcaret(h,xy,-1);
return 1;
end
public
function CreateCaret(hWnd :pointer;hBitmap:pointer;nWidth:integer;nHeight:integer):integer;
begin
if not(hwnd>0 or hwnd<0) then return 0;
global g_gtk_caret_cache_timer; //»º´æ
if not g_gtk_caret_cache_timer then
begin
ctm := class(tUIglobalData).uigetdata("G_T_TTIMER_");
if not ctm then return 0;
g_gtk_caret_cache_timer := createobject(ctm,nil);
g_gtk_caret_cache_timer.Interval := 500;//680;
g_gtk_caret_cache_timer.Ontimer := function(o,e)
begin
global g_current_get_focus_widget;
h := g_current_get_focus_widget;
if not h then return ;
if not g_object_get_data(h,"caretshow") then return ;
GetCaretPos(xy);
drawcaret(h,xy,-1);
end
g_gtk_caret_cache_timer.start();
Fscrolltimedo := makeinstance(thisfunction(docarettime));
g_gtk_caret_cache_timer:= new ttmstruct(nil);
rt := g_timeout_add(500,Fscrolltimedo,g_gtk_caret_cache_timer._getptr_() );
g_gtk_caret_cache_timer._setvalue_(0,rt);
end
h := g_object_get_data(hwnd,"gtk_window_caret"); //»ñµÃcaret
if not h then
@ -5955,19 +5957,6 @@ type tenterouterlist = class
begin
FLock := false;
end
function MouseIsMoved();
begin
if FLock then return ;
id := FList[FIndex];
if not id then return ;
ps := array(0,0);
_wapi.GetCursorPos(ps);
if FCpos = ps then return ;
FCpos := ps;
if Mousehittest then call(Mousehittest,self,id);
if Mousemovecall then call(Mousemovecall,self,id);
end
function feach();
begin
return FList[FIndex];
@ -5991,19 +5980,32 @@ type tenterouterlist = class
end
end
end
function MouseIsMoved(ptr:pointer):integer;cdecl;
begin
if FTimer._getvalue_(0)=0 then return 0;
if FLock then return 1;
id := FList[FIndex];
if not id then return 1;
ps := array(0,0);
_wapi.GetCursorPos(ps);
if FCpos = ps then return 1;
FCpos := ps;
if Mousehittest then call(Mousehittest,self,id);
if Mousemovecall then call(Mousemovecall,self,id);
return 1;
end
function create(api);
begin
ctm := class(tUIglobalData).uigetdata("G_T_TTIMER_");
if not ctm then return ;
_wapi := api;
FCpos := array(0,0);
_wapi.GetCursorPos(FCpos);
FList := array();
FIndex := -1;
FTimer := createobject(ctm,nil);
FTimer.interval := 30; //30ºÁÃë
FTimer.Ontimer := thisfunction(MouseIsMoved);
FTimer.start();
Fscrolltimedo := makeinstance(thisfunction(MouseIsMoved));
FTimer:= new ttmstruct(nil);
rt := _wapi.g_timeout_add(30,Fscrolltimedo,FTimer._getptr_() ); //30ºÁÃë
FTimer._setvalue_(0,rt);
end
function destroy();
begin
@ -6011,8 +6013,9 @@ type tenterouterlist = class
FList := array();
if FTimer then
begin
FTimer.stop();
FTimer := nil;
FTimer._setvalue_(0,0);
//FTimer.stop();
//FTimer := nil;
end
end
Mousemovecall;