From e4aa4fe0cf85c83d85d762b10d73a2c7e8335ffd Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Mon, 24 Apr 2023 15:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浼樺寲 --- designer/utslcodeeditor.tsf | 2 +- funcext/tvclib/ugtkinterface.tsf | 75 +++++++++++++++++--------------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 993e5f2..a30a667 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -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 diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index a3c9b65..0c4dc58 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -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;