编辑器
优化断点调试窗口切换
This commit is contained in:
+53
-13
@@ -366,6 +366,8 @@ type TTslDebuga=class(TCustomControl)
|
||||
Fdbgsybs;
|
||||
Fdbgstack;
|
||||
fdefaultdbger; //编辑器的调试器
|
||||
fpopediterhandle;
|
||||
fcurrentgroundwindow;
|
||||
type tdbgwnd=class(TPanel)
|
||||
uses tslvcl;
|
||||
function Create(AOwner);
|
||||
@@ -812,6 +814,7 @@ type TTslDebuga=class(TCustomControl)
|
||||
//font := ms[1];
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
function addbreak(item,idx,n); //添加断点
|
||||
begin
|
||||
@@ -835,6 +838,29 @@ type TTslDebuga=class(TCustomControl)
|
||||
end
|
||||
end
|
||||
function GetWindowHandleByPID(dwProcessID,api) //通过进程ID获取窗口句柄
|
||||
begin
|
||||
h := api.GetTopWindow(0);
|
||||
while(h) do
|
||||
begin
|
||||
pid := 0;
|
||||
dwTheardId := api.GetWindowThreadProcessId(h,pid);
|
||||
|
||||
if(dwTheardId <> 0) and (pid=dwProcessID) then
|
||||
begin
|
||||
cni := 100;
|
||||
cn := "";setlength(cn,cni);
|
||||
cno := api.GetClassNameA(h,cn,cni);
|
||||
if cno >1 then
|
||||
begin
|
||||
cn := cn[1:cni];
|
||||
if pos("tsui_application",cn) then return h;
|
||||
end
|
||||
end
|
||||
h := api.GetNextWindow(h,2);
|
||||
end
|
||||
return 0;
|
||||
end
|
||||
{function GetWindowHandleByPID2(dwProcessID,api) //通过进程ID获取窗口句柄
|
||||
begin
|
||||
h := api.GetTopWindow(0);
|
||||
while(h) do
|
||||
@@ -853,7 +879,7 @@ type TTslDebuga=class(TCustomControl)
|
||||
h := api.GetNextWindow(h,2);
|
||||
end
|
||||
return 0;
|
||||
end
|
||||
end}
|
||||
function dbgtooldorun(o,e);
|
||||
begin
|
||||
if not(FConnectchannel or FRemoteWait) then
|
||||
@@ -866,16 +892,13 @@ type TTslDebuga=class(TCustomControl)
|
||||
ExecuteCommand("dbgrun");
|
||||
{$ifdef linux}
|
||||
{$else}
|
||||
if not Fdebugedwhandle then
|
||||
Fdebugedwhandle := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi);
|
||||
if Fdebugedwhandle then
|
||||
begin
|
||||
//echo "\r\nSetForegroundWindow===>",Fdebugedwhandle;
|
||||
//_wapi.ShowWindow(Fdebugedwhandle,SW_SHOW);
|
||||
_wapi.SetForegroundWindow(Fdebugedwhandle);
|
||||
//_wapi.PostMessageA(Fdebugedwhandle,WM_ACTIVATEAPP,1,systhreadid());
|
||||
//_wapi.SetActiveWindow(Fdebugedwhandle);
|
||||
//_wapi.SendMessageA(Fdebugedwhandle,WM_ACTIVATEAPP,true,systhreadid());
|
||||
//if not Fdebugedwhandle then
|
||||
// Fdebugedwhandle := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi);
|
||||
fcurrentgroundwindow := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi);
|
||||
fdoforegroundflag := true;
|
||||
if fcurrentgroundwindow then
|
||||
begin
|
||||
_wapi.SetForegroundWindow(fcurrentgroundwindow);
|
||||
end
|
||||
{$endif}
|
||||
end
|
||||
@@ -999,7 +1022,7 @@ type TTslDebuga=class(TCustomControl)
|
||||
end
|
||||
"DebugInfo": //调试信息
|
||||
begin
|
||||
if "dbgdetach"=remotewaitinit(d)then return;
|
||||
if "dbgdetach"=remotewaitinit(d)then return;
|
||||
stk := magicgetarray(d,array("result","CmdData","CallStack")); //深度
|
||||
if fremotedbugstart then
|
||||
begin
|
||||
@@ -1054,7 +1077,7 @@ type TTslDebuga=class(TCustomControl)
|
||||
FCurrentgotoitem.FEditer.ExecuteCommand("ecruningto",stk[0,"LINE"]-1);
|
||||
end
|
||||
end
|
||||
_wapi.SetForegroundWindow(self.Handle); //移动到前端 SetForegroundWindow BringWindowToTop
|
||||
_wapi.ForegroundWindow(geteditorhandle());
|
||||
return;
|
||||
end
|
||||
"detached":
|
||||
@@ -1350,6 +1373,23 @@ type TTslDebuga=class(TCustomControl)
|
||||
end
|
||||
//property rundirect read Frundirect write Frundirect;
|
||||
private
|
||||
function geteditorhandle();
|
||||
begin
|
||||
if not fpopediterhandle then
|
||||
begin
|
||||
o := Owner;
|
||||
while o do
|
||||
begin
|
||||
if o.WSpOPUp then
|
||||
begin
|
||||
fpopediterhandle := o.Handle;
|
||||
break;
|
||||
end
|
||||
o :=o.parent;
|
||||
end
|
||||
end
|
||||
return fpopediterhandle;
|
||||
end
|
||||
function getgtkdisplay(); //去掉try
|
||||
begin
|
||||
dsp := Sysgetenv("DISPLAY");
|
||||
|
||||
Reference in New Issue
Block a user