From 4693fd70c66c8c549ef90b257ed8ff6cba65b125 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Fri, 25 Nov 2022 15:23:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化gtk滚动条优化gtk滚动条 --- designer/tslvcldesigner.tsf | 46 +++++++++++++++++++++++++++++++- designer/udesignerproject.tsf | 32 ++++++++++++++++++++++ funcext/tvclib/tslvcl.tsf | 6 ++--- funcext/tvclib/ugtkinterface.tsf | 46 ++++++++++++++++++-------------- funcext/tvclib/utslvclstdctl.tsf | 4 +-- 5 files changed, 108 insertions(+), 26 deletions(-) diff --git a/designer/tslvcldesigner.tsf b/designer/tslvcldesigner.tsf index 46924b5..829b975 100644 --- a/designer/tslvcldesigner.tsf +++ b/designer/tslvcldesigner.tsf @@ -14,6 +14,7 @@ type TVclDesigner = class(tvcform) @explan(˵) ؼ %% **} private + Foh ; fcwindowinfo; //ǰļ fwindowinfos; //ļڵ洢 fcutcopyinfo;//ƵϢ @@ -384,9 +385,52 @@ type TVclDesigner = class(tvcform) FProjectsManager.CreateTpjFomFile(f); end end + + function WMSYSCOMMAND(o,e);override; + begin + case e.wparam of + SC_MAXIMIZE: + begin + Foh := o.height; + _send_(WM_USER,123,123,1); + return ; + end + SC_MINIMIZE: + begin + e.skip := true; + return ; + end + SC_DEFAULT: + begin + end + SC_ZOOM: + begin + end + SC_MOUSEMENU: + begin + end + SC_RESTORE: + begin + end + end; + + return ; + return inherited; + end function db(o,e): WM_NCLBUTTONDBLCLK;virtual;//󻯴 begin - e.skip := true; + //e.skip := true; + Foh := o.height; + _send_(WM_USER,123,123,1); + end + function WMUSER(o,e):WM_USER;override; + begin + if e.wparam = 123 and e.lparam=123 then + begin + if o.height>Foh then + o.height := Foh; + + end end function openclassfile(); //򿪱༭ begin diff --git a/designer/udesignerproject.tsf b/designer/udesignerproject.tsf index d59acdf..fe6e3bc 100644 --- a/designer/udesignerproject.tsf +++ b/designer/udesignerproject.tsf @@ -1714,6 +1714,38 @@ BD141CA912494F502D48D224F45050274A21E03806FF2C7CA7516022D7D000000 end _send_(WM_SETICON,1,FIco.handle,1); end + {Foh ; + function WMSYSCOMMAND(o,e);override; + begin + if e.wparam=SC_MAXIMIZE then + begin + Foh := o.height; + _send_(WM_USER,123,123,1); + return ; + end else + if e.wparam=SC_RESTORE then + begin + end + return inherited; + end + function db(o,e): WM_NCLBUTTONDBLCLK;virtual;//󻯴 + begin + Foh := o.height; + _send_(WM_USER,123,123,1); + end + function WMUSER(o,e):WM_USER;override; + begin + if e.wparam = 123 and e.lparam=123 then + begin + if o.height>foh then + begin + h := o.height; + w := o.width; + l :=left; + o.SetBoundsRect(array(l,140,w+l,h)); + end + end + end } function Create(AOwner);override; begin inherited; diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index 1c5f193..8fc7ee1 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -215,10 +215,10 @@ type tapplication=class(tcomponent) **} initialize(); {$ifdef linuxgtk} - //idledata :=(new tcbytearray(4))._getptr_(); - //id := tsl_gtk_idle_interface(idledata);//_wapi.tsl_gtk_idle_interface(idledata); //idle + idledata :=(new tcbytearray(4))._getptr_(); + id := tsl_gtk_idle_interface(idledata);//_wapi.tsl_gtk_idle_interface(idledata); //idle _wapi.gtk_main(); - //_Wapi.g_idle_remove_by_data(idledata); //ɾidle + _Wapi.g_idle_remove_by_data(idledata); //ɾidle return 1; {$endif} if not FMessageObj then FMessageObj := new TTagMSG(); diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index d47bf4a..0115d30 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -6189,7 +6189,8 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object) end dosetchange := false; ////ƶ ֮ǰ page change - if (rgchanged or pgchanged) and ((gsi.nmax-gsi.npage)<=0) {and osi.npos>0} then //ԭ + //////////////ʱ/////////////////// + (* if (rgchanged or pgchanged) and ((gsi.nmax-gsi.npage)<=0) {and osi.npos>0} then //ԭ begin w := makelong(_const.SB_TOP,0); //osi.ntrackpos := 0; @@ -6203,7 +6204,8 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object) CallTslVclProc(_const.WM_VSCROLL,w,0,1); end //dosetchange := true; - end + end *) + ////////////////////////////////////// if msk .& _const.SIF_TRACKPOS then begin @@ -6641,12 +6643,9 @@ type tGtkMessageQueue=class // function Add(h,m,l,w,obj); begin lock(); - FData[FLen]:= array(h,m,l,w,obj); - if FCurrent=FLen then - begin - createidle(); - end + FData[FLen]:= array(h,m,l,w,obj); FLen++; + //createidle(); unlock(); end function Feach(); @@ -6695,18 +6694,27 @@ type tGtkMessageQueue=class // idx++; end end + property idleworked write fidleworked; private + fidleworked; + FData; + FCurrent; + FLen; + FLock; + FMainContext; + function createidle(); + begin + if fidleworked then return ; + idledata :=(new tcbytearray(4))._getptr_(); + id := tsl_gtk_idle_interface(idledata); + fidleworked := true; + end function Clean(); begin FData := array(); FLen := 0; FCurrent :=0; end - FData; - FCurrent; - FLen; - FLock; - FMainContext; function lock() begin return; @@ -6838,11 +6846,7 @@ begin _wapi.cairo_destroy(cr); _wapi.gtk_object_set_data(cr); end -function createidle(); -begin - idledata :=(new tcbytearray(4))._getptr_(); - id := tsl_gtk_idle_interface(idledata); -end + function _gtkidledo_(); //ص begin d := FeachMessageFromGtkMessageQueue(); @@ -6875,8 +6879,7 @@ begin AddMessageToGtkMessageQueue(h,d[1],h,d[3],true); end return 1; - end - + end return 1; //r end else @@ -6892,7 +6895,10 @@ begin //sleep(10);//Ϣһ end unit(uvclthreadworker).RunThreadWorkerHost(); - return r; + GLobal G_GTK_MESSAGE_QUEUE_A; + if r=0 then sleep(1); + //G_GTK_MESSAGE_QUEUE_A.idleworked := r; + return true; end procedure tslprocessmessages()begin end; function InitGtkWindowClass(); //ʼ diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index 4d8e4f5..06e417d 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -6770,8 +6770,8 @@ function uinit(); begin {$ifdef linux} class(tUIglobalData).uisetdata("G_T_TTIMER_",class(TCustomTimer)); - o := new TSLUIBASE(); - o._wapi.SetTimer(nil,10000,100,getwinprocptr(2)); + //o := new TSLUIBASE(); + //o._wapi.SetTimer(nil,10000,200,getwinprocptr(2)); {$endif} end initialization