编辑器

优化
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 if it then
begin begin
s1 := it.SelText; 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 begin
s := s1; s := s1;
end else end else

View File

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