From 54ef7e59f1c1d9998a9d8912ec6613728ef220e4 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Sat, 17 Sep 2022 16:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 编辑器设计器采用coolbar --- designer/tslvcldesigner.tsf | 14 +++++++-- designer/utslcodeeditor.tsf | 62 ++++++++++++++++++++++++++++++------- designer/utslvcldebuger.tsf | 54 +++++++++++++++++++++++++++++--- 3 files changed, 111 insertions(+), 19 deletions(-) diff --git a/designer/tslvcldesigner.tsf b/designer/tslvcldesigner.tsf index 975b6f1..febaa02 100644 --- a/designer/tslvcldesigner.tsf +++ b/designer/tslvcldesigner.tsf @@ -881,9 +881,9 @@ type TVclDesigner = class(tvcform) end mx := 0; for i,v in clc do mx := max(mx,v); - height := (integer(mx*32/twidth)+1)*32+60+30+24+5; + height := (integer(mx*32/twidth)+1)*32+60+30{+24}+5; end else - height := 90+32+24+5; + height := 90+32{+24}+5; end function TreeNode2tfmsub(lib,node,itemnames);//tmfÎļþ×Ö·û´® @@ -1870,7 +1870,7 @@ type TVclDesigner = class(tvcform) end; end } tlbar := FProjectManager.FTslEditer.gettoolbar(); - savebtn := array( tlbar.getbtnbyindex(1),tlbar.getbtnbyindex(2)); + savebtn := FProjectManager.FTslEditer.gettoolbarbtn(); for i,v in savebtn do //´¦Àíһϱ£´æ¹¤³Ì begin v._tag := array(thisfunction(saveCurrentForm),v.onclick); @@ -1882,7 +1882,13 @@ type TVclDesigner = class(tvcform) end end end + tlbar.Align := alLeft; + tlbar.width :=440; tlbar.parent := self; + tlbar.arrange :="0;1"; + sp1 := new tsplitter(self); + sp1.Align := alLeft; + sp1.parent := self; FToolBars := new TDesignertoolbars(self); FToolBars.parent := self; FToolBars.Imagelist := FImageList; @@ -1890,6 +1896,7 @@ type TVclDesigner = class(tvcform) FToolBars.Font.height := 18; addtoolbuttons(); + FToolBars.Align := alClient; //************²Ëµ¥****************************** createmainmenubyarray(mainmenus(),FMenu0,self); Mainmenu := FMenu0; @@ -1907,6 +1914,7 @@ type TVclDesigner = class(tvcform) FProjectFileOpener := new TOpenFileADlg(self); FProjectFileOpener.filter := array("tvcl¹¤³Ì":"*.tpj"); FProjectFileOpener.parent := self; + FProjectManager.FTslEditer.setdbugruncall(thisfunction(debugproject)); //ÉèÖõ÷ÊԻص÷ end property VariableSelecter read FVariableSelecter; diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 1da30f3..bdc381e 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -1640,8 +1640,16 @@ type TEditer=class(TCustomcontrol) // FCurrentItemCode := array(); FGoBackA := new TMyarrayB(); FGoBackB := new TMyarrayB(); - FToolbar := new TToolBar(self); //¹¤¾ßÀ¸ + //FToolbar := new TToolBar(self); //¹¤¾ßÀ¸ + ftoolbara := new TToolBar(self); //¹¤¾ßÀ¸ + ftoolbarb := new TToolBar(self); //¹¤¾ßÀ¸ FStatus := new TStatusBar(self); //״̬À¸ + fcoolbar := new tcoolbar(self); + ftoolbara.Align := alNone; + ftoolbarb.Align := alNone; + ftoolbara.Width := 400; + ftoolbarb.Width := 250; + fcoolbar.autosize := true; FInfoShowWnd := new TEditerAuxiliary(self); FPageEditer := new TPageEditer(self); //FPageEditer.CloseBtn := true; @@ -1752,7 +1760,8 @@ type TEditer=class(TCustomcontrol) // FToolbtns[i]:= bt; if v=0 then begin - bt.stylesep := true; + //bt.stylesep := true; + continue; end else begin bmp.Readvcon(HexFormatStrToTsl(v)); @@ -1762,17 +1771,25 @@ type TEditer=class(TCustomcontrol) // bt.imageid := id; id++; end - BT.parent := FToolbar; + if i in array("Ìí¼Ó/ɾ³ý¶ÏµãF5","ÔÝÍ£","¼ÌÐø","½øÈë","Ìø³ö","µ¥²½","ÏÂÒ»ÐÐ(F8)","ÖÕÖ¹","ˢзûºÅ±í","ˢе±Ç°·ûºÅ")then begin dbgbtns[i]:= bt; - end + bt.Parent := ftoolbarb; + end else + begin + BT.parent := ftoolbara;//FToolbar; + end end FImages.DrawBimpFirst := true; Fdbgbtns := dbgbtns; FTslDebug.addbtns(dbgbtns); - FToolbar.ImageList := FImages; + //FToolbar.ImageList := FImages; + ftoolbara.ImageList := FImages; + ftoolbarb.ImageList := FImages; + ftoolbara.Parent := fcoolbar; + ftoolbarb.Parent := fcoolbar; FInfoShowWnd.Visible := false; //FInfoShowWnd.WsSysMenu := true; FInfoShowWnd.WSsizebox := true; @@ -1789,7 +1806,9 @@ type TEditer=class(TCustomcontrol) // ///////////////////////////////////////// //FInfoShowWnd.Caption := "ÐÅÏ¢:"; ////¹¹Ôì½Úµã//////////////////////////////////////////////////// - FToolBar.Parent := self; + //FToolBar.Parent := self; + fcoolbar.arrange := "0,1"; + fcoolbar.Parent := self; FStatus.Parent := self; FInfoShowWnd.Parent := self; FPageEditer.Parent := self; @@ -1994,6 +2013,10 @@ type TEditer=class(TCustomcontrol) // o.SetStatusText("¹¦ÄÜ¿ª·¢ÖÐ...."); EndFind(); end + function setdbugruncall(drc); + begin + FTslDebug.runbtncall := drc; + end function DebugPageItem(it,h); begin if not it then return; @@ -2126,7 +2149,11 @@ type TEditer=class(TCustomcontrol) // end function gettoolbar(); begin - return FToolbar; + return fcoolbar;//FToolbar; + end + function gettoolbarbtn(); + begin + return array(ftoolbara.getbtnbyindex(1),ftoolbara.getbtnbyindex(2)); end function ShowLogWnd(flg); begin @@ -2943,15 +2970,20 @@ type TEditer=class(TCustomcontrol) // if not(FPageEditer and FPageEditer.parent=self)then return; rr := ClientRect; r := rr; - if FToolbar.Parent = self then + if fcoolbar.Parent = self then begin htoolbar := true; end if htoolbar then begin - th := FToolbar.CalcHeightFixWidth(rr[2]-rr[0]); - r[3]:= r[0]+th; - FToolBar.SetBoundsRect(r); + //th := FToolbar.CalcHeightFixWidth(rr[2]-rr[0]); + //r[3]:= r[0]+th; + //FToolBar.SetBoundsRect(r); + + fcoolbar.DoControlAlign(); + + r[3]:= r[0]+fcoolbar.Height; + fcoolbar.SetBoundsRect(r); end r := rr; r[1]:= r[3]-FStatus.Height; @@ -2959,7 +2991,7 @@ type TEditer=class(TCustomcontrol) // rr := rr; if htoolbar then begin - rr[1]:= FToolbar.Height+1; + rr[1]:= fcoolbar.Height+1; end rr[3]:= rr[3]-FStatus.Height-1; {if ffolderdlg and ffolderdlg.Visible then @@ -3373,6 +3405,9 @@ type TEditer=class(TCustomcontrol) // FSynHCS := nil; FCurrentItemCode := array(); FPageEditer := nil; + fcoolbar := nil; + ftoolbara := nil; + ftoolbarb := nil; FToolbar := nil; FStatus := nil; FInfoShowWnd := nil; @@ -3871,6 +3906,9 @@ type TEditer=class(TCustomcontrol) // FGoBackB; // := new TMyarrayB(); FRebackFlag; FPageEditer; + fcoolbar; + ftoolbara; + ftoolbarb; FToolbar; FStatus; FInfoShowWnd; diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index b4da36c..350a24e 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -261,6 +261,7 @@ type tagCOMPOSITIONFORM=class(tslcstructureobj) end type TTslDebuga=class(TCustomControl) private //³ÉÔ±±äÁ¿ + frunbtncall; //Frundirect; FRuningfile; //Ö´Ðнű¾ÎļþÃû FRuningItem; //Ö´ÐеÄpageitem @@ -426,6 +427,7 @@ type TTslDebuga=class(TCustomControl) end end public + property runbtncall read frunbtncall write frunbtncall; function addbtns(btns); //Ìí¼Ó²Ëµ¥ begin FBtns := btns; @@ -433,6 +435,7 @@ type TTslDebuga=class(TCustomControl) begin v.onClick := thisfunction(Dbgtooldo); if v.Caption="Ìí¼Ó/ɾ³ý¶ÏµãF5" then continue; + if v.Caption="¼ÌÐø" then continue; v.Visible := false; end end @@ -527,7 +530,8 @@ type TTslDebuga=class(TCustomControl) //if flg then return ; if FConnectchannel then begin - return MessageboxA("ÕýÔÚµ÷ÊÔÖÐ...","Ìáʾ",0,self.Handle); + //return MessageboxA("ÕýÔÚµ÷ÊÔÖÐ...","Ìáʾ",0,self.Handle); + return debugrunredo(); end end if not fdbgselwnd then @@ -554,14 +558,33 @@ type TTslDebuga=class(TCustomControl) fdbgselwnd.show(); return; end + function debugrunredo(); + begin + if FBtns["ÖÕÖ¹"].Visible then + begin + Dbgtooldo(new ttempclass("¼ÌÐø"),nil); + end else + begin + Dbgtooldo(new ttempclass("ÔÝÍ£"),nil); + end + end function Debuglocal(item); //µ÷ÊԽű¾ begin {$ifdef linux} //return MessageboxA("linuxĿǰ²»Ö§³Öµ÷ÊÔ","Ìáʾ",0,self.Handle); {$endif} if not item then return 0; - if FConnectchannel then return MessageboxA("ÕýÔÚµ÷ÊÔÖÐ","Ìáʾ",0,self.Handle); - if FRemoteWait then return MessageboxA("Ô¶³Ìµ÷ÊԵȴýÖÐ...","Ìáʾ",0,self.Handle); + if FConnectchannel then + begin + + //return MessageboxA("ÕýÔÚµ÷ÊÔÖÐ","Ìáʾ",0,self.Handle); + return debugrunredo(); + end + if FRemoteWait then + begin + //return MessageboxA("Ô¶³Ìµ÷ÊԵȴýÖÐ...","Ìáʾ",0,self.Handle); + return debugrunredo(); + end FDebugtype := "local"; if checkconnected()then disconnectserver(); //¶Ï¿ªÁ¬½Ó FAttchedid := 0; @@ -676,6 +699,14 @@ type TTslDebuga=class(TCustomControl) dbwnd.addwnds(FStackList,FVaraiblesList,FCommandtext,FShowText); ExecuteCommand("clearall"); getdefaultdbger(); + frunbtncall := function(o,e)begin + + ow := owner; + if ow then + begin + ow.DebugPageItem(ow.GetCurrentItem()); + end + end end function addbreak(item,idx,n); //Ìí¼Ó¶Ïµã begin @@ -761,6 +792,12 @@ type TTslDebuga=class(TCustomControl) end "¼ÌÐø": begin + if not(FConnectchannel or FRemoteWait) then + begin + + //return MessageboxA("ÕýÔÚµ÷ÊÔÖÐ","Ìáʾ",0,self.Handle); + return CallMessgeFunction(frunbtncall,nil,nil); + end toolbtnState("¼ÌÐø"); if FCurrentgotoitem and FCurrentgotoitem.FEditer then FCurrentgotoitem.FEditer.ExecuteCommand("ecruningto",nil); ExecuteCommand("dbgrun"); @@ -1170,6 +1207,7 @@ type TTslDebuga=class(TCustomControl) FBtns := nil; g_tsldbgcallback_handle := nil; fdbgselwnd := nil; + frunbtncall := nil; end //property rundirect read Frundirect write Frundirect; private @@ -1432,7 +1470,7 @@ type TTslDebuga=class(TCustomControl) "¼ÌÐø": begin //ÔËÐÐ - FBtns["¼ÌÐø"].Visible := false; + //FBtns["¼ÌÐø"].Visible := false; FBtns["½øÈë"].Visible := false; FBtns["Ìø³ö"].Visible := false; FBtns["ÏÂÒ»ÐÐ(F8)"].Visible := false; @@ -1461,6 +1499,7 @@ type TTslDebuga=class(TCustomControl) for i,v in FBtns do begin if v.Caption="Ìí¼Ó/ɾ³ý¶ÏµãF5" then continue; + if v.Caption="¼ÌÐø" then continue; v.Visible := false; end //FToolbar.Visible := false; @@ -1770,6 +1809,13 @@ type TTslDebuga=class(TCustomControl) FShowText; fimgelist; end +type ttempclass = class() + function create(c); + begin + Caption := c; + end + caption; +end type tdbgselwnd=class(tdcreateform) uses tslvcl; label1:tlabel;