设计器

优化细节
This commit is contained in:
JianjunLiu 2022-11-17 10:57:12 +08:00
parent 35e7ed4ea5
commit 9d8d0ac2dc
5 changed files with 81 additions and 44 deletions

View File

@ -1087,6 +1087,7 @@ type TPageEditerItem=class(TPageItem)
FGetInfoText := ""; FGetInfoText := "";
FLastVersion := ""; FLastVersion := "";
FEditer := new TFTSLScriptMemo(AOwner); FEditer := new TFTSLScriptMemo(AOwner);
FEditer.Align := FEditer.alClient;
FEditer.Visible := false; FEditer.Visible := false;
FEditer._Tag := self; FEditer._Tag := self;
end end
@ -1539,7 +1540,7 @@ type TPageEditer=class(TPage) //
it := Currentitem; it := Currentitem;
if it then if it then
begin begin
it.FEditer.SetBoundsRect(self.ClientRect); it.FEditer.SetBoundsRect(getediterrect());
it.FEditer.Visible := true; it.FEditer.Visible := true;
it.FEditer.SetFocus(); it.FEditer.SetFocus();
end end
@ -1564,11 +1565,16 @@ type TPageEditer=class(TPage) //
it := CurrentItem; it := CurrentItem;
if it then if it then
begin begin
it.FEditer.SetBoundsRect(self.ClientRect); it.FEditer.SetBoundsRect(getediterrect(trc));
end end
end end
property PageItemOnRClick read FPageItemOnRClick write FPageItemOnRClick; property PageItemOnRClick read FPageItemOnRClick write FPageItemOnRClick;
private private
function getediterrect();
begin
rc := ClientRect;
return rc;
end
FPageItemOnRClick; FPageItemOnRClick;
end end
type TTslChmHelp=class type TTslChmHelp=class
@ -1604,10 +1610,6 @@ type TTslChmHelp=class
FChmName; FChmName;
end end
type TEditer=class(TCustomcontrol) //관윅묏야으,榴檄으,渴놔,꿴冷 type TEditer=class(TCustomcontrol) //관윅묏야으,榴檄으,渴놔,꿴冷
function Create(AOwner);override; function Create(AOwner);override;
begin begin
@ -1630,7 +1632,7 @@ type TEditer=class(TCustomcontrol) //
fcoolbar := new tcoolbar(self); fcoolbar := new tcoolbar(self);
ftoolbara.Align := alNone; ftoolbara.Align := alNone;
ftoolbarb.Align := alNone; ftoolbarb.Align := alNone;
ftoolbara.Width := 400; ftoolbara.Width := 430;
ftoolbarb.Width := 250; ftoolbarb.Width := 250;
fcoolbar.autosize := true; fcoolbar.autosize := true;
FInfoShowWnd := new TEditerAuxiliary(self); FInfoShowWnd := new TEditerAuxiliary(self);
@ -1730,8 +1732,8 @@ type TEditer=class(TCustomcontrol) //
//////////// ////////////
FPageEditer.PageItemOnRClick := thisfunction(PageItemOnRClick); FPageEditer.PageItemOnRClick := thisfunction(PageItemOnRClick);
FImages := new TControlImageList(self); FImages := new TControlImageList(self);
FImages.Width := 22; FImages.Width := 24;
FImages.Height := 22; FImages.Height := 24;
bmp := new TBitmap(); bmp := new TBitmap();
imgs := GetEditIcons(); imgs := GetEditIcons();
id := 0; id := 0;

View File

@ -26,6 +26,9 @@ type TFTSLScriptcustomMemo=class(TSYNmemoNorm)
//134 //134
//font := array("facename":"Courier New"); //font := array("facename":"Courier New");
autogutterwidth := true; autogutterwidth := true;
ongutterclick := function()begin
SwitchMarkLine(CaretY-1);
end
end end
function DoCaretPosChanged();override; function DoCaretPosChanged();override;
begin begin

View File

@ -434,29 +434,29 @@ end
function geteditcommetbmpinfo(); function geteditcommetbmpinfo();
begin begin
return "0502000000060400000074797065000203000000696D670006040000006461746 return "0502000000060400000074797065000203000000696D670006040000006461746
100021201000089504E470D0A1A0A0000000D4948445200000020000000200806 10002E000000089504E470D0A1A0A0000000D4948445200000018000000180806
000000737A7AF4000000017352474200AECE1CE90000000467414D410000B18F0 000000E0773DF8000000017352474200AECE1CE90000000467414D410000B18F0
BFC6105000000097048597300000EC300000EC301C76FA864000000A749444154 BFC6105000000097048597300000EC300000EC301C76FA8640000007549444154
5847ED94410A80201045BB9377F20A6EBD9757F03A82BB8909021333B56F1AF8E 484BDD91810AC0200844FD73FD73C7A0C1C5AE6491B2EDC14122F8D0C493F9994
0D3A2181F8CFD8D06B30496C09C02CE39B2D642C333532405A4942484808667A6 044B604A91564F02E013B070BD255AADA5E1C368C05E9AAB36966ADDAC34DB05B
985360F80ABEE41F02C6986387FC445324105E26B444D125D45A6725C26FEF02E 42052309F667418602F61FD89F05A93F51EA2747C3AF0DA3207D15C086B1208F0
F81538287A7DEC781F740578170058C52EA32ACFB0A42BCF7D9C3DFF228C0F0A1 42BD40AD8BA2B416A05197C5DE07E00DBBA3D2C5C7DBE710000000049454E44AE
437FC39ECC2910F70022F01EA80DBC076AD3DC03A834F7406F96C012182C40B40 42608200";
319335F36295E4B140000000049454E44AE42608200";
end end
function getedituncommetbmpinfo(); function getedituncommetbmpinfo();
begin begin
return "0502000000060400000074797065000203000000696D670006040000006461746 return "0502000000060400000074797065000203000000696D670006040000006461746
100022001000089504E470D0A1A0A0000000D4948445200000020000000200806 100025801000089504E470D0A1A0A0000000D4948445200000018000000180806
000000737A7AF4000000017352474200AECE1CE90000000467414D410000B18F0 000000E0773DF8000000017352474200AECE1CE90000000467414D410000B18F0
BFC6105000000097048597300000EC300000EC301C76FA864000000B549444154 BFC6105000000097048597300000EC300000EC301C76FA864000000ED49444154
5847ED95C109C5200C40FF4E4EE15D07D0832B787142F1EC0C2EE03925FC2A9F9 484BDD953B0A8430144567B51696767636765676762EC0156821042C04B1B6D24
2160A7EE3C10739546DF220113FC0CC16D8026B0AD45A21A5343430270529E09C 2100B17203677484C243209F8990C8C076E212F794793105F30CC8304F33CA3EB
0321C4D0C09C146B0AB0B76026EB0B78EF2184707E8DE751008BB721C23EFE035 3A344D732B7DDF635916DE5512144501CBB2BE92344D79574950D7351CC7514E3
2A094024AA95EDC180331C63E5039E7F3E497B6FE14AF86504AD98BDF45039353 813D775D9CB0A1EB4C9572184A0AA2AFEF4C92D411445DBDAEBD809A669521E3D
FBD778750DD905B0055AEBFEB3B5766E0B1A6C43F80BEB359CC19A02EC8F11FB7 1119B9791886C8B20C6559A26D5B3E626513D0CF141374F17D9F8D4D924459175
3CC2EC0DE82996C812DC02C0070005765629339C9EFE60000000049454E44AE42 19EA23382388E957511ED313DBA44C330C0F33CD6CCB66DE479BE8DA13D642E6F
608200"; B22CA119C79157F65C1650A8240802B6C93A6E098EF03B81F1CBCEF8756DFC876
38A7F17006F3815FF63AEDCF5A00000000049454E44AE42608200";
end end
function GetSaveFileBitmapInfo(); function GetSaveFileBitmapInfo();
begin begin

View File

@ -4619,7 +4619,14 @@ type tgtk_ctl_object = class(_gtkeventtype)
_wapi.ScreenToClient(id,p); _wapi.ScreenToClient(id,p);
mp := makelong(p[0],p[1]); mp := makelong(p[0],p[1]);
//CallTslVclProc(id,_const.WM_NCHITTEST,0,makelong(p[0],p[1])); //CallTslVclProc(id,_const.WM_NCHITTEST,0,makelong(p[0],p[1]));
AddMessageToGtkMessageQueue(id,_const.WM_MOUSEMOVE,0,mp,0); //echo "\r\n",nfer;
global g_gtk_keytable,g_gtk_buttontable;
wp := 0;
if g_gtk_keytable[0x10] then wp .|= 0x0004;
if g_gtk_keytable[0x11] then wp .|= 0x0008;
wp .|= g_gtk_buttontable[0];
wp .|= g_gtk_buttontable[1];
AddMessageToGtkMessageQueue(id,_const.WM_MOUSEMOVE,wp,mp,0);
end end
function DefaultMessageDo(msg,w,l);virtual; function DefaultMessageDo(msg,w,l);virtual;
begin begin
@ -4863,8 +4870,6 @@ type tgtk_ctl_object = class(_gtkeventtype)
begin begin
mn := GetGtkEventNameOrId(b); // _send_ mn := GetGtkEventNameOrId(b); // _send_
global g_current_get_focus_widget,g_current_loss_focus_widget,g_gtk_buttontable,G_GTK_WINDOW_ACTIVATE, g_gtk_keytable; global g_current_get_focus_widget,g_current_loss_focus_widget,g_gtk_buttontable,G_GTK_WINDOW_ACTIVATE, g_gtk_keytable;
if not ifarray(g_gtk_buttontable) then g_gtk_buttontable := array(0,0);
if not ifarray(g_gtk_keytable) then g_gtk_keytable := array(0x10:0,0x11:0,0x12:0);
if mn = "event" then if mn = "event" then
begin begin
e := new _GdkEventAny(c); e := new _GdkEventAny(c);
@ -4883,7 +4888,6 @@ type tgtk_ctl_object = class(_gtkeventtype)
end end
GDK_BUTTON_PRESS: GDK_BUTTON_PRESS:
begin begin
e := new _GdkEventButton(c); e := new _GdkEventButton(c);
psi := makelong(integer(e.x),integer(e.y)); psi := makelong(integer(e.x),integer(e.y));
//r := array(); //r := array();
@ -4899,7 +4903,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
case e.button of case e.button of
1: 1:
begin begin
wp .|=0x1;
g_gtk_buttontable[0] := _const.MK_LButton; g_gtk_buttontable[0] := _const.MK_LButton;
if FHitwidgetposition in array(10,11,12,15) then if FHitwidgetposition in array(10,11,12,15) then
begin begin
@ -4915,6 +4919,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
_wapi.g_object_get_data(h,"gtk_layout_width"), _wapi.g_object_get_data(h,"gtk_layout_width"),
_wapi.g_object_get_data(h,"gtk_layout_height")) _wapi.g_object_get_data(h,"gtk_layout_height"))
); );
CallTslVclProc(_const.WM_NCLBUTTONDOWN ,wp,psi); CallTslVclProc(_const.WM_NCLBUTTONDOWN ,wp,psi);
end else end else
@ -4924,8 +4929,8 @@ type tgtk_ctl_object = class(_gtkeventtype)
end end
3: 3:
begin begin
wp .|=0x2;
g_gtk_buttontable[1] := _const.MK_RButton; g_gtk_buttontable[1] := _const.MK_RButton;
CallTslVclProc(_const.WM_RBUTTONDOWN ,wp,psi); CallTslVclProc(_const.WM_RBUTTONDOWN ,wp,psi);
end end
end ; end ;
@ -4945,7 +4950,6 @@ type tgtk_ctl_object = class(_gtkeventtype)
begin begin
//t := 1+"1234"; //t := 1+"1234";
e := new _GdkEventButton(c); e := new _GdkEventButton(c);
psi := makelong(integer(e.x),integer(e.y)); psi := makelong(integer(e.x),integer(e.y));
wp := 0; wp := 0;
if ifarray(g_gtk_keytable) then if ifarray(g_gtk_keytable) then
@ -4956,10 +4960,12 @@ type tgtk_ctl_object = class(_gtkeventtype)
case e.button of case e.button of
1: 1:
begin begin
wp .|=0x1;
g_gtk_buttontable[0] := 0; g_gtk_buttontable[0] := 0;
CallTslVclProc(_const.WM_LBUTTONUP ,wp,psi); CallTslVclProc(_const.WM_LBUTTONUP ,wp,psi);
end end
3:begin 3:begin
wp .|=0x2;
g_gtk_buttontable[1] := 0; g_gtk_buttontable[1] := 0;
CallTslVclProc(_const.WM_RBUTTONUP ,wp,psi); CallTslVclProc(_const.WM_RBUTTONUP ,wp,psi);
//if not hasMessageFromGtkMessageQueue(a.handle,_const.LM_CONTEXTMENU ) then //if not hasMessageFromGtkMessageQueue(a.handle,_const.LM_CONTEXTMENU ) then
@ -7120,9 +7126,15 @@ CAIRO_OPERATOR_HSL_COLOR:=27;
CAIRO_OPERATOR_HSL_LUMINOSITY:=28; CAIRO_OPERATOR_HSL_LUMINOSITY:=28;
} }
function gtk_init_check(argc:string;argcv:string):integer;cdecl;external 'libgtk-3.so'; function gtk_init_check(argc:string;argcv:string):integer;cdecl;external 'libgtk-3.so';
initialization function igtk();
global g_w_i_datas,g_w_c_width; begin
global g_w_i_datas,g_w_c_width, g_gtk_buttontable,g_gtk_keytable;
gtk_init_check(nil,nil); gtk_init_check(nil,nil);
g_w_i_datas := array(); g_w_i_datas := array();
g_w_c_width := 35; g_w_c_width := 35;
g_gtk_buttontable := array(0,0);
g_gtk_keytable := array(0x10:0,0x11:0,0x12:0);
end
initialization
igtk();
end. end.

View File

@ -632,6 +632,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
@explan(说明) 带滚动条的编辑控件 %% @explan(说明) 带滚动条的编辑控件 %%
**} **}
private private
fongutterclick;//µã»÷
ftmemlockv; ftmemlockv;
fundoing; //清空unredo标记 fundoing; //清空unredo标记
fredoing; //清空unredo标记 fredoing; //清空unredo标记
@ -1120,7 +1121,12 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
ComputeAndSelToCaret(e.ypos,e.xpos); ComputeAndSelToCaret(e.ypos,e.xpos);
end else end else
begin begin
ComputeCaret(e.xpos,e.ypos); x := e.xpos;
if fongutterclick and x>2 and x<(GutterWidth-10) then
begin
callgcall := true;
end
ComputeCaret(x,e.ypos);
ClearSelBlock(); ClearSelBlock();
ClipCursor(); ClipCursor();
end end
@ -1135,6 +1141,14 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
finally finally
DecPaintLock(); DecPaintLock();
end ; end ;
if callgcall then
begin
if fongutterclick then
begin
CallMessgeFunction(fongutterclick,o,e);
end
//echo "\r\n callgutter->:",CaretY;
end
end end
function MouseMove(o,e);override;//移动 function MouseMove(o,e);override;//移动
@ -1572,6 +1586,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
property currentLineColor:color read fcurrentLineColor write setcurrentLineColor; property currentLineColor:color read fcurrentLineColor write setcurrentLineColor;
property guttercolor:color read fguttercolor write setguttercolor; //行标颜色 property guttercolor:color read fguttercolor write setguttercolor; //行标颜色
property selectbkcolor:color read fselectbkcolor write setselectbkcolor; //选中的颜色 property selectbkcolor:color read fselectbkcolor write setselectbkcolor; //选中的颜色
property ongutterclick:eventhandler read fongutterclick write fongutterclick;
{** {**
@param(ReadOnly)(bool) 是否只读%% @param(ReadOnly)(bool) 是否只读%%
@param(Text)(string) 文本%% @param(Text)(string) 文本%%
@ -1631,6 +1646,11 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
begin begin
fUndoList.MergeReplaceItem(); // fUndoList.MergeReplaceItem(); //
end end
function Recycling();override;
begin
fongutterclick := nil;
inherited;
end
protected protected
function PrevWordPos(); //处理选择截断 function PrevWordPos(); //处理选择截断
begin begin