From a06ee66a8106cab83bba34bed6e55e751bbf69d1 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Fri, 19 Aug 2022 17:52:35 +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 优化细节 --- designer/tslvcldesigner.tsf | 2 +- funcext/tvclib/tslvcl.tsf | 2 +- funcext/tvclib/twincontrol.tsf | 4 +-- funcext/tvclib/ugtkinterface.tsf | 14 +++++++++- funcext/tvclib/utslmemo.tsf | 48 +++++++++++++++++++++++++++++--- funcext/tvclib/utslvclgdi.tsf | 2 +- 6 files changed, 61 insertions(+), 11 deletions(-) diff --git a/designer/tslvcldesigner.tsf b/designer/tslvcldesigner.tsf index 1518205..8833aff 100644 --- a/designer/tslvcldesigner.tsf +++ b/designer/tslvcldesigner.tsf @@ -6492,7 +6492,7 @@ type TtextEditor = class(tpanel) public itemData; memo; - function DoControlAlign(); + function DoControlAlign();override; begin if btn1 and btn2 and memo then begin diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index fa6a51c..7c07695 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -1771,7 +1771,7 @@ type tmemo = class(TSynMemoNorm) return array("name","font","color","parentcolor","parentfont", "popupmenu","visible","anchors","align", "height","width","left","top", - "text","readonly", + "text","readonly","selectbkcolor","guttercolor","currentlinecolor","guttercharcnt", "tabspace","onmousewheel","onmousemove","onpopupmenu", "onmousedown","onmouseup","onsetfocus","onkillfocus", "onkeyup","onkeydown","onkeypress", diff --git a/funcext/tvclib/twincontrol.tsf b/funcext/tvclib/twincontrol.tsf index 1e3790b..951755b 100644 --- a/funcext/tvclib/twincontrol.tsf +++ b/funcext/tvclib/twincontrol.tsf @@ -751,8 +751,6 @@ type TWinControl = class(tcontrol) return ; {$endif} _wapi.GetWindowRect(hwnd,rec); - rect := array(0,0,0,0); - _wapi.GetClientRect(self.Handle,rect); region := new TRGNRECT(); region.Rect := rec; if e.wparam =1 then @@ -1233,7 +1231,7 @@ type TWinControl = class(tcontrol) end end else begin -{$ifdef gdipaint} +{$ifdef gdipaint3} ctls := Controls; if not ctls then return; // e.skip := false; if ctls.Count<1 then return; // e.skip := false ; diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index 324f812..3efde30 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -1051,7 +1051,7 @@ type tsgtkapi = class(tgtkapis) end function ReleaseDC(hwd :pointer;hdc:pointer):integer; begin - + DeleteDC(hdc); end function SelectClipRgn(hdc :pointer;gdiobj:pointer); begin @@ -1379,6 +1379,18 @@ type tsgtkapi = class(tgtkapis) begin return 0; end + function GetDC(hwd); + begin + if hwd<0 or hwd>0 then + begin + hwcr := g_object_get_data(h,"gtk_clientwideget"); + if hwcr>0 or hwcr<0 then return gdk_cairo_create(gtk_widget_get_window(hwcr)); + end else + if hwd=0 then + begin + return 1; + end + end function SaveDC(hdc :pointer):integer; begin if not(hdc>0 or hdc<0) then return ; diff --git a/funcext/tvclib/utslmemo.tsf b/funcext/tvclib/utslmemo.tsf index f6ecac3..27fbafd 100644 --- a/funcext/tvclib/utslmemo.tsf +++ b/funcext/tvclib/utslmemo.tsf @@ -634,6 +634,9 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) @explan(˵Ã÷) ´ø¹ö¶¯ÌõµÄ±à¼­¿Ø¼þ %% **} private + fselectbkcolor;//rgb(192,192,192); + fcurrentLineColor;//rgb(232,232,255); + fguttercolor; Fecruningto; //µ÷ÊÔÔËÐе½ FLineInterval; FSetPostioned; @@ -766,7 +769,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) function PaintGutter(rcDraw,nL1,nL2); begin dc := Canvas; - dc.brush.Color := rgb(228,228,228); + dc.brush.Color :=FGutterColor ;//rgb(228,228,228); rc := rcDraw; rc[2]-= 6; dc.FillRect(rc); @@ -828,14 +831,14 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) r[3]:= r[1]+fTextHeight; if i+1=fCaretY then begin - cvs.Brush.Color := rgb(232,232,255); + cvs.Brush.Color := fcurrentLineColor;//rgb(232,232,255); cvs.FillRect(r); end if bb then begin if i >= bb[0]-1 and i <= ee[0]-1 then begin - cvs.Brush.Color := rgb(192,192,192); + cvs.Brush.Color := fselectbkcolor;//rgb(192,192,192); src := r; if FSelectionMode=smLine then begin @@ -997,9 +1000,12 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) function Create(AOwner);override; begin inherited; + FGutterColor := rgb(228,228,228); + fcurrentLineColor := rgb(232,232,255); + fselectbkcolor := rgb(192,192,192); FReadOnly := false; FLineInterval := 4; - FGutterCharCount := 7; + FGutterCharCount := 4; FSelectionMode := smNormal; FGutter := new TMemoGutter(self); FGutter.Width := 1+Font.Width * FGutterCharCount; @@ -1545,6 +1551,9 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) property GutterWidth read GetGutterWidth; property LineInterval read FLineInterval write SetLineInterval; property GutterCharCnt:integer read FGutterCharCount write SetGutterCharCnt; + property currentLineColor:color read fcurrentLineColor write setcurrentLineColor; + property guttercolor:color read fguttercolor write setguttercolor; + property selectbkcolor:color read fselectbkcolor write setselectbkcolor; {** @param(ReadOnly)(bool) ÊÇ·ñÖ»¶Á%% @param(Text)(string) Îı¾%% @@ -1658,6 +1667,37 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) return array(cy,cx+(ci?(0):1)); end private + + function setcurrentLineColor(c); + begin + if ifnumber(c) and c<>fcurrentLineColor then + begin + fcurrentLineColor := c; + r := carety; + InvalidateLines(r,r); + end + end + function setguttercolor(c); + begin + if ifnumber(c) and c<>fguttercolor then + begin + fguttercolor := c; + InvalidateRect(nil,false); + end + end + function setselectbkcolor(c); + begin + if ifnumber(c) and c<>fselectbkcolor then + begin + fselectbkcolor := c; + b1 := BlockBegin; + b2 := BlockEnd; + if b1<>b2 then + begin + InvalidateRect(nil,false); + end + end + end function setreadolny(n); begin nv := n?true:false; diff --git a/funcext/tvclib/utslvclgdi.tsf b/funcext/tvclib/utslvclgdi.tsf index f886377..6cbb9bc 100644 --- a/funcext/tvclib/utslvclgdi.tsf +++ b/funcext/tvclib/utslvclgdi.tsf @@ -3006,7 +3006,7 @@ end function getdrawablebitmap(w,h,bmp); begin {$ifdef linux} - return 0; + return 0; {$endif} if w>1 and h>1 then begin