设计器

优化细节
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
+25 -13
View File
@@ -4619,7 +4619,14 @@ type tgtk_ctl_object = class(_gtkeventtype)
_wapi.ScreenToClient(id,p);
mp := 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
function DefaultMessageDo(msg,w,l);virtual;
begin
@@ -4863,8 +4870,6 @@ type tgtk_ctl_object = class(_gtkeventtype)
begin
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;
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
begin
e := new _GdkEventAny(c);
@@ -4883,7 +4888,6 @@ type tgtk_ctl_object = class(_gtkeventtype)
end
GDK_BUTTON_PRESS:
begin
e := new _GdkEventButton(c);
psi := makelong(integer(e.x),integer(e.y));
//r := array();
@@ -4899,7 +4903,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
case e.button of
1:
begin
wp .|=0x1;
g_gtk_buttontable[0] := _const.MK_LButton;
if FHitwidgetposition in array(10,11,12,15) then
begin
@@ -4914,7 +4918,8 @@ type tgtk_ctl_object = class(_gtkeventtype)
_wapi.g_object_get_data(h,"gtk_layout_y"),
_wapi.g_object_get_data(h,"gtk_layout_width"),
_wapi.g_object_get_data(h,"gtk_layout_height"))
);
);
CallTslVclProc(_const.WM_NCLBUTTONDOWN ,wp,psi);
end else
@@ -4924,8 +4929,8 @@ type tgtk_ctl_object = class(_gtkeventtype)
end
3:
begin
g_gtk_buttontable[1] := _const.MK_RButton;
wp .|=0x2;
g_gtk_buttontable[1] := _const.MK_RButton;
CallTslVclProc(_const.WM_RBUTTONDOWN ,wp,psi);
end
end ;
@@ -4944,22 +4949,23 @@ type tgtk_ctl_object = class(_gtkeventtype)
GDK_BUTTON_RELEASE:
begin
//t := 1+"1234";
e := new _GdkEventButton(c);
e := new _GdkEventButton(c);
psi := makelong(integer(e.x),integer(e.y));
wp := 0;
if ifarray(g_gtk_keytable) then
begin
if g_gtk_keytable[0x10] then wp .|= 0x0004;
if g_gtk_keytable[0x11] then wp .|= 0x0008;
end
end
case e.button of
1:
begin
wp .|=0x1;
g_gtk_buttontable[0] := 0;
CallTslVclProc(_const.WM_LBUTTONUP ,wp,psi);
end
3:begin
wp .|=0x2;
g_gtk_buttontable[1] := 0;
CallTslVclProc(_const.WM_RBUTTONUP ,wp,psi);
//if not hasMessageFromGtkMessageQueue(a.handle,_const.LM_CONTEXTMENU ) then
@@ -7120,9 +7126,15 @@ CAIRO_OPERATOR_HSL_COLOR:=27;
CAIRO_OPERATOR_HSL_LUMINOSITY:=28;
}
function gtk_init_check(argc:string;argcv:string):integer;cdecl;external 'libgtk-3.so';
initialization
global g_w_i_datas,g_w_c_width;
function igtk();
begin
global g_w_i_datas,g_w_c_width, g_gtk_buttontable,g_gtk_keytable;
gtk_init_check(nil,nil);
g_w_i_datas := array();
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.
+21 -1
View File
@@ -632,6 +632,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
@explan(说明) 带滚动条的编辑控件 %%
**}
private
fongutterclick;//点击
ftmemlockv;
fundoing; //清空unredo标记
fredoing; //清空unredo标记
@@ -1120,7 +1121,12 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
ComputeAndSelToCaret(e.ypos,e.xpos);
end else
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();
ClipCursor();
end
@@ -1135,6 +1141,14 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
finally
DecPaintLock();
end ;
if callgcall then
begin
if fongutterclick then
begin
CallMessgeFunction(fongutterclick,o,e);
end
//echo "\r\n callgutter->:",CaretY;
end
end
function MouseMove(o,e);override;//移动
@@ -1572,6 +1586,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
property currentLineColor:color read fcurrentLineColor write setcurrentLineColor;
property guttercolor:color read fguttercolor write setguttercolor; //行标颜色
property selectbkcolor:color read fselectbkcolor write setselectbkcolor; //选中的颜色
property ongutterclick:eventhandler read fongutterclick write fongutterclick;
{**
@param(ReadOnly)(bool) 是否只读%%
@param(Text)(string) 文本%%
@@ -1631,6 +1646,11 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
begin
fUndoList.MergeReplaceItem(); //
end
function Recycling();override;
begin
fongutterclick := nil;
inherited;
end
protected
function PrevWordPos(); //处理选择截断
begin