设计器

active
This commit is contained in:
JianjunLiu 2022-12-19 10:00:57 +08:00
parent 1a1052169d
commit 05ae594b93
8 changed files with 101 additions and 47 deletions

View File

@ -645,12 +645,16 @@ type TVclDesigner = class(tvcform)
par := FCurrentNode.Component.Cwnd;
r := FComponentCreater.ComponentCreater(FCurrentNode,FCurrentNode.Component.Cwnd);
if not r then exit;
npar := par;
while not(npar.WsPopUp) do
begin
npar := par.parent;
end
FProjectManager.hiddeneditor(npar.BoundsRect);//此处隐藏编辑器
//////////////////////////////////////////
//npar := par;
//while not(npar.WsPopUp) do
//begin
// npar := par.parent;
//end
//FProjectManager.hiddeneditor(npar.BoundsRect);//´Ë´¦Òþ²Ø±à¼­Æ÷
////////////////////////////////////////////////
global g_script_can_set_not_focus;
g_script_can_set_not_focus := true;
r.CreateName();
FVariableSelecter.additem(r);
BindCwndMessage(r.Cwnd);
@ -677,6 +681,7 @@ type TVclDesigner = class(tvcform)
FCurrentNode := nil;
FTree.PopupMenu := nil;
//echo "\r\n Ìí¼Ó¿Ø¼þ";
g_script_can_set_not_focus := false;
return r;
end
function setcomponentfocus(cwnd,fk); //ÉèÖûñµÃÑ¡ÖÐ
@ -1003,8 +1008,9 @@ type TVclDesigner = class(tvcform)
wd := cp.Cwnd;
if wd.visible then
begin
wd.visible := false;
wd.visible := true;
//wd.visible := false;
//wd.visible := true;
_wapi.SetActiveWindow(wd.Handle);
end
end
end

View File

@ -699,7 +699,7 @@ type TProjectView = class(TVCForm) //
FTslEditer.Show(SW_SHOWNOACTIVATE); //
_wapi.bringWindowToTop(FTslEditer.Handle);
end
function hiddeneditor(rc);
function hiddeneditor(rc);//Òþ²Ø
begin
if FTslEditer.visible then
begin

View File

@ -1073,6 +1073,12 @@ type TFTSLScriptMemo = class(TFTSLScriptcustomMemo)
begin
inherited;
end
function SetFocus();
begin
global g_script_can_set_not_focus;
if g_script_can_set_not_focus then return ;
if HandleAllocated() then _wapi.SetFocus(self.Handle);
end
end
type TPageEditerItem=class(TPageItem)
FPageOrderId; //序号有调用者使用

View File

@ -306,7 +306,9 @@ type TDComponent = class()
end
function cutclick(o,e);virtual; //剪切节点
begin
deleteorcut(o,1);
global g_script_can_set_not_focus := true;
deleteorcut(o,1);
g_script_can_set_not_focus := false;
end
function pasteclick(o,e);virtual; //粘贴节点
begin
@ -319,7 +321,9 @@ type TDComponent = class()
end
function deleteclick(o,e);virtual; //控件删除操作
begin
global g_script_can_set_not_focus := true;
deleteorcut(o,0);
g_script_can_set_not_focus := false;
end
function GetDeleteNames(nd,ns,wds);
begin

View File

@ -119,13 +119,13 @@ type tsgtkapi = class(tgtkapis)
end
end
gtk_widget_show(hwd);
if f<>0x4 and G_GTK_WINDOW_ACTIVATE<>hwd then
{if f<>0x4 and G_GTK_WINDOW_ACTIVATE<>hwd then
begin
if G_GTK_WINDOW_ACTIVATE then
gtk_addMessageQueue(G_GTK_WINDOW_ACTIVATE,0x6,0,0,0);
G_GTK_WINDOW_ACTIVATE := hwd;
gtk_addMessageQueue(hwd,0x6,1,0,0);
end
end }
end
return true;
end
@ -1153,6 +1153,11 @@ type tsgtkapi = class(tgtkapis)
begin
return DeleteObject(cursor);
end
function SetActiveWindow(h);
begin
hh := gtk_widget_get_toplevel(h);
if hh then gtk_window_present(hh);
end
function CreatePen(FS,w,FC); //gtk Ä£Äâ pen
begin
global gtk_gdi_object_globals;
@ -3219,6 +3224,7 @@ type tgtkapis = class() //gtk
procedure gtk_widget_set_can_focus(w:pointer;cf:integer);cdecl;external 'libgtk-3.so';
function gtk_window_get_focus(w:pointer):pointer;cdecl;external 'libgtk-3.so';
procedure gtk_widget_grab_focus(w:pointer);cdecl;external 'libgtk-3.so';
function gtk_widget_activate(w:pointer):integer;cdecl;external 'libgtk-3.so';
procedure gtk_window_set_focus(window:pointer; focus:pointer);cdecl;external 'libgtk-3.so';
procedure gtk_window_set_type_hint(window:pointer; tp:integer);cdecl;external 'libgtk-3.so';
procedure gtk_widget_set_has_window(widget:pointer;has_window:integer);cdecl;external 'libgtk-3.so';
@ -3513,6 +3519,11 @@ type tgtkapis = class() //gtk
procedure gtk_window_begin_resize_drag(w:pointer;e:integer;btn:integer;x:integer;y:integer;t:integer);cdecl;external 'libgtk-3.so';
function gtk_widget_get_toplevel(w:pointer):pointer;cdecl;external 'libgtk-3.so';
/////////// modal ////////////////////////////////
function gtk_window_is_active(w:pointer):integer;cdecl;external 'libgtk-3.so';
procedure gtk_window_present(w:pointer);cdecl;external 'libgtk-3.so';
function gtk_window_activate_default(w:pointer):integer;cdecl;external 'libgtk-3.so';
function gtk_window_activate_focus(w:pointer):integer;cdecl;external 'libgtk-3.so';
function gtk_window_has_toplevel_focus(w:pointer):integer;cdecl;external 'libgtk-3.so';
procedure gtk_window_set_modal(w:pointer;f:integer);cdecl;external 'libgtk-3.so';
procedure gtk_window_set_transient_for(w:pointer;p:pointer);cdecl;external 'libgtk-3.so';
procedure gtk_window_get_size(wd:pointer;var h:integer;var w:integer);cdecl;external 'libgtk-3.so';
@ -4920,33 +4931,39 @@ type tgtk_ctl_object = class(_gtkeventtype)
GDK_WINDOW_STATE:
begin
obj := new _GdkEventWindowState(c);
msk := obj.new_window_state;
//st := obj.changed_mask;
if msk .& 4 then
st := obj.new_window_state;
if st .& 4 then
begin
return CallTslVclProc(_const.WM_SYSCOMMAND ,_const.SC_MAXIMIZE,0);
end
if msk .& 2 then
if st .& 2 then
begin
return CallTslVclProc(_const.WM_SYSCOMMAND ,_const.SC_MINIMIZE,0);
end
if msk .& (2^4) then
if st .& (2^4) then
begin
//echo "\r\n full screen";
end
if msk .& (2^5) then
if st .& (2^5) then
begin
//echo "\r\n above";
end
if msk .& (2^6) then
if st .& (2^6) then
begin
//echo "\r\n below";
end
if msk .& (2^7) then
if st .& (2^7) then
begin
CallTslVclProc(_const.WM_SETFOCUS ,0,0);
CallTslVclProc(_const.WM_ACTIVATE ,2,0,0);
//CallTslVclProc(_const.WM_SETFOCUS ,0,0);
hwd := handle;
hwd := _wapi.gtk_widget_is_toplevel(hwd)?hwd:_wapi.gtk_widget_get_toplevel(hwd);
if G_GTK_WINDOW_ACTIVATE<>hwd then
begin
if G_GTK_WINDOW_ACTIVATE then
AddMessageToGtkMessageQueue(G_GTK_WINDOW_ACTIVATE,0x6,0,0,0);
end
AddMessageToGtkMessageQueue(hwd,0x6,1,0,0);
//CallTslVclProc(_const.WM_ACTIVATE ,2,0,0);
end
{GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
@ -5005,7 +5022,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
end
end ;
hwd := handle;
{hwd := handle;
hwd := _wapi.gtk_widget_is_toplevel(hwd)?hwd:_wapi.gtk_widget_get_toplevel(hwd);
if G_GTK_WINDOW_ACTIVATE<>hwd then
begin
@ -5013,7 +5030,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
AddMessageToGtkMessageQueue(G_GTK_WINDOW_ACTIVATE,0x6,0,0,0);
G_GTK_WINDOW_ACTIVATE := hwd;
AddMessageToGtkMessageQueue(hwd,0x6,1,0,0);
end
end }
return CanignoreBtnpress();
end
GDK_BUTTON_RELEASE:

View File

@ -2,6 +2,10 @@ unit UTslMemo;
{**
@explan(说明) 文本控件库 %%
**}
{$ifdef linux}
{$define linuxpop}
{$endif}
interface
uses utslvclauxiliary,utslvclgdi,utslvclstdctl;
type TMemoLineItem=class() //编辑字符串行对象
@ -2634,7 +2638,7 @@ type TSynCompletion = class(TSynCompletionList)
function Create(AOwner);override;
begin
inherited;
{$ifdef linux} //处理避免闪烁
{$ifdef linuxpop} //处理避免闪烁
{$else}
WsPopUp := true;
@ -2727,7 +2731,7 @@ type TSynCompletion = class(TSynCompletionList)
dh := GetYscrollDelta();
h := 3+dh*min(self.ItemCount,8);
Memo.GetCaretPos(x,y);
{$ifdef linux}
{$ifdef linuxpop}
xy := array(x,y);//
{$else}
xy := Memo.ClientToscreen(x,y);

View File

@ -858,6 +858,7 @@ type tnumindexarray = Class() //ջģ
**}
private
FData;
fdlength;
public
function Create();virtual;
begin
@ -865,6 +866,7 @@ type tnumindexarray = Class() //ջģ
@explan(说明) 构造函数 %%
**}
FData := array();
fdlength := 0;
end
function Operator[1](idx,v);
begin
@ -886,21 +888,22 @@ type tnumindexarray = Class() //ջģ
@explan(说明) 获得数据长度 %%
@return(integer) 长度 %%
**}
return ::length(FData);
return fdlength;
end
function Push({value1,value2,....});
begin
{**
@explan(说明) 在末尾追加元素,参数个数不定 %%
**}
r := ::length(FData);
r := fdlength;
r1 := r;
for i := 0 to ParamCount-1 do
begin
FData[r]:= Params[i+1];
r++;
end
if r1 <> r then LengthChanged(r1-r);
fdlength := r;
if r1 <> r then LengthChanged(r1-r);
return r;
end
function Pop();
@ -910,10 +913,11 @@ type tnumindexarray = Class() //ջģ
**}
if FData then
begin
id := ::length(FData)-1;
id := fdlength-1;
r := FData[id];
deleteindex(FData,id);
LengthChanged(-1);
fdlength--;
LengthChanged(-1);
return r;
end
return nil;
@ -928,7 +932,8 @@ type tnumindexarray = Class() //ջģ
end
function LastIndexOf(v);
begin
for i := ::length(FData)-1 downto 0 do
len := fdlength;
for i := len-1 downto 0 do
begin
if v=FData[i]then return i;
end
@ -940,17 +945,18 @@ type tnumindexarray = Class() //ջģ
end
function SetValueByIndex(idx,v);virtual;
begin
len := ::length(FData);
if idx<0 then return nil;
len := fdlength;
if not(idx>=0) then return nil;
if idx <= len then
begin
FData[idx]:= v;
end else
begin
for i := len to idx do FData[i]:= nil;
FData[idx]:= v;
return v;
FData[idx]:= v;
end
fdlength := ::length(FData);
return v;
end
function splice({startid,sellength,value1,valfue2,....});
begin
@ -963,7 +969,7 @@ type tnumindexarray = Class() //ջģ
sl := p[1];
sl := ifnil(sl)?inf:sl;
sl := (sl>=0)?sl:0;
len := ::length(FData);
len := fdlength;
st := st<0?0:st;
st := st >= len?(len):st;
et := st+sl;
@ -978,7 +984,8 @@ type tnumindexarray = Class() //ջģ
r1 := FData[0:st-1];
r2 := FData[et:len-1];
FData := r1 union p[2:] union r2;
if len <> ::length(FData)then LengthChanged(::length(FData)-len);
fdlength := ::length(FData);
if len <> fdlength then LengthChanged(fdlength-len);
return r;
end
function shift();
@ -987,11 +994,12 @@ type tnumindexarray = Class() //ջģ
@explan(说明) 弹出头部元素 %%
**}
r := nil;
len := ::length(FData);
len := fdlength;
if len>0 then
begin
deleteindex(FData,0);
LengthChanged(-1);
fdlength--;
LengthChanged(-1);
end
return len<1?(len):(len-1);
end
@ -1004,9 +1012,10 @@ type tnumindexarray = Class() //ջģ
if p then
begin
FData := p union FData;
LengthChanged(1);
fdlength := ::length(FData);
LengthChanged(1);
end
return ::length(FData);
return fdlength;
end
function swap(i,j);
begin
@ -1014,7 +1023,7 @@ type tnumindexarray = Class() //ջģ
@explan(说明) 交换下标中的值 %%
**}
if i=j then return false;
len := ::length(FData);
len := fdlength;
if i >= 0 and i<len and j >= 0 and j<len then
begin
t := FData[i];

View File

@ -6012,7 +6012,7 @@ type tcustomprogressbar=class(TCustomControl)
public
function create(AOwner);override;
begin
inherited;
inherited;
Caption:="prograssbar";
FLeft := 10;
FTop := 10;
@ -6132,7 +6132,11 @@ type tcustomprogressbar=class(TCustomControl)
private //属性处理函数
function setSmooth(n);
begin
Fsmooth := n;
nv := n?true:false;
if nv=Fsmooth then return ;
Fsmooth := nv;
InvalidateRect(nil,false);
end
function setVertical(n);
begin
@ -6175,7 +6179,11 @@ type tcustomprogressbar=class(TCustomControl)
end
function setRangeA(arr);
begin
return setRange(arr[0],arr[1]);
r := setRange(arr[0],arr[1]);
if r then
begin
InvalidateRect(nil,false);
end
end
function setPosition(n);
begin