diff --git a/designer/gettslediterstart.tsf b/designer/gettslediterstart.tsf index d32ce2b..681ed92 100644 --- a/designer/gettslediterstart.tsf +++ b/designer/gettslediterstart.tsf @@ -1,15 +1,15 @@ //启动tsl编辑器 +//20230421 整理代码 uses tslvcl; -deletefuncacheini(); -//mtic ; -ops := ""; +deletefuncacheini(); //清空缓存 +ops := ""; //待打开文件 GLobal G_OpenHostory; -G_OpenHostory := true; //默认打开历史进程 +G_OpenHostory := true; //默认打开历史文件标记 hasinstance := true; //单独进程 isdebug := false; for i:= 0 to sysparamcount() do begin - if ("-DEBUGSERVER" = sysparamstr(i)) then + if ("-DEBUGSERVER" = sysparamstr(i)) then //调试标记 begin isdebug := true; end else @@ -54,7 +54,7 @@ begin if not FileList("",ops) then begin s := ""; - n := 512; + n := 1024;//512; setlength(s,n); GetCurrentDirectoryA(n,s); for i:= 1 to n do @@ -82,18 +82,13 @@ begin end end else begin - global g_dotsavehistory; + global g_dotsavehistory; //是否保存打开的历史记录 g_dotsavehistory := true; end app := initializeapplication(); -//mtic; -//setprofiler(7); app.createform(class(TRunEditerForm),fm); fm.OpenAndGotoFileByName(ops); fm.show(); -//echo mtoc; -//d := Getprofilerinfo(true); -//exportfile(ftstream(),"",format("d:\\tst\\profile\\%ssynprofile.stm",tostn(random())),d); app.run(); type TRunEditerForm = class(TEditerForm) function Create(AOwner);override; @@ -111,9 +106,10 @@ type TRunEditerForm = class(TEditerForm) begin OpenAndGotoFileByName(n); end - //_wapi.ShowWindow(self.Handle, SW_SHOWNORMAL); - PostMessageA(self.Handle,WM_USER,303,10); - end else + _wapi.ShowWindow(self.Handle, SW_SHOWNORMAL);//确保显示 + _Wapi.ForegroundWindow(self.Handle);//PostMessageA(self.Handle,WM_USER,303,10);//放到前端 + + end {else if e.wparam = 303 and e.lparam=10 then begin //Show(SW_SHOWNORMAL); @@ -133,7 +129,7 @@ type TRunEditerForm = class(TEditerForm) end //_wapi.SetForegroundWindow(seLF.Handle); - end + end} inherited; end function CreateParams(p);override; diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 0e96af1..b41beae 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -812,7 +812,8 @@ type TExecuteEditer=class(TCustomControl) //执 return ""; end function InsureItemVisible(idx); //移动当前的格子 - begin + begin + return ;// rc := GetIdxRect(idx); c := ClientRect; if rc[1]=ct or nidx<0 then return ; + { if idx=ct-1 then nidx := 0; - else if idx=-1 then nidx := 1; + else if idx=-1 then nidx := 1;} SetCurrentSelection(nidx); InsureItemVisible(nidx); end diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index 246937c..b9c0a28 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -367,7 +367,6 @@ type TTslDebuga=class(TCustomControl) Fdbgstack; fdefaultdbger; //编辑器的调试器 fpopediterhandle; - fcurrentgroundwindow; type tdbgwnd=class(TPanel) uses tslvcl; function Create(AOwner); @@ -837,16 +836,20 @@ type TTslDebuga=class(TCustomControl) dbgunsetbreak(FConnectchannel,usr,n,idx+1); end end - function GetWindowHandleByPID(dwProcessID,api) //通过进程ID获取窗口句柄 + function GetWindowHandleByPID(pid,api) //通过进程ID获取窗口句柄 begin + {$ifdef linux} + return 0; + {$endif} + dwProcessID := _wapi.GetProcessId(pid); h := api.GetTopWindow(0); while(h) do begin pid := 0; - dwTheardId := api.GetWindowThreadProcessId(h,pid); - + dwTheardId := api.GetWindowThreadProcessId(h,pid); if(dwTheardId <> 0) and (pid=dwProcessID) then begin + //while(api.GetParent(h)<> 0) do h := api.GetParent(h); // 原有的处理方式找到最上层 cni := 100; cn := "";setlength(cn,cni); cno := api.GetClassNameA(h,cn,cni); @@ -860,26 +863,6 @@ type TTslDebuga=class(TCustomControl) end return 0; end - {function GetWindowHandleByPID2(dwProcessID,api) //通过进程ID获取窗口句柄 - begin - h := api.GetTopWindow(0); - while(h) do - begin - pid := 0; - dwTheardId := api.GetWindowThreadProcessId(h,pid); - if(dwTheardId <> 0)then - begin - if(pid=dwProcessID)then - begin - // here h is the handle to the window - while(api.GetParent(h)<> 0) do h := api.GetParent(h); - return h; - end - end - h := api.GetNextWindow(h,2); - end - return 0; - end} function dbgtooldorun(o,e); begin if not(FConnectchannel or FRemoteWait) then @@ -890,17 +873,11 @@ type TTslDebuga=class(TCustomControl) toolbtnState("继续"); if FCurrentgotoitem and FCurrentgotoitem.FEditer then FCurrentgotoitem.FEditer.ExecuteCommand("ecruningto",nil); ExecuteCommand("dbgrun"); - {$ifdef linux} - {$else} - //if not Fdebugedwhandle then - // Fdebugedwhandle := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi); - fcurrentgroundwindow := GetWindowHandleByPID(_wapi.GetProcessId(fdebugproc.Handle),_wapi); - fdoforegroundflag := true; - if fcurrentgroundwindow then + Fdebugedwhandle := GetWindowHandleByPID(fdebugproc.Handle,_wapi); + if Fdebugedwhandle then begin - _wapi.SetForegroundWindow(fcurrentgroundwindow); - end - {$endif} + _wapi.SetForegroundWindow(Fdebugedwhandle); + end end function Dbgtooldo(o,e) begin diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index e01517c..b50616e 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -3541,7 +3541,8 @@ type TcustomListBox=class(TCustomListBoxbase) SelRange(false); FSelBegin := FSelEnd := n; SelRange(true); - SetYpos(n); + //SetYpos(n); + InsureIdxInClient(n); calllistselchengd(); end function getItemSelectedState(n);