优化编辑器的自动大小功能
This commit is contained in:
parent
0ff9cbf615
commit
9a87a6286b
|
|
@ -80,7 +80,7 @@ type TPage=class(TCustomControl) //
|
|||
FLines := 0;
|
||||
FItemIndex :=-1;
|
||||
FWill_Drag := true;
|
||||
font := array("height":16,"width":8,"escapement":0,"orientation":0,"weight":400,"italic":0,"underline":0,"strikeout":0,
|
||||
font := array("height":24,"width":12,"escapement":0,"orientation":0,"weight":400,"italic":0,"underline":0,"strikeout":0,
|
||||
"charset":0,"outprecision":0,"clipprecision":0,"quality":1,"pitchandfamily":1,"facename":"Courier New","color":0);
|
||||
end
|
||||
function GetPageRect(); //获得标签区域
|
||||
|
|
@ -1097,6 +1097,7 @@ type TFTSLScriptMemo = class(TFTSLScriptcustomMemo)
|
|||
function create(AOwner);
|
||||
begin
|
||||
inherited;
|
||||
font := array("width":12,"height":24);
|
||||
{global g_editer_font_size;
|
||||
if g_editer_font_size and ifarray(g_editer_font_size) then
|
||||
begin
|
||||
|
|
@ -1788,8 +1789,8 @@ type TEditer=class(TCustomcontrol) //
|
|||
FStatus := new TStatusBar(self); //状态栏
|
||||
fcoolbar := new tcoolbar(self);
|
||||
fcoolbar.ParentFont := false;
|
||||
//ftoolbara.Align := alNone;
|
||||
//ftoolbarb.Align := alNone;
|
||||
ftoolbara.Align := alNone;
|
||||
ftoolbarb.Align := alNone;
|
||||
//ftoolbara.Width := 430;
|
||||
//ftoolbarb.Width := 250;
|
||||
fcoolbar.autosize := true;
|
||||
|
|
@ -1883,7 +1884,7 @@ type TEditer=class(TCustomcontrol) //
|
|||
FGotoLineWnd := new TGoToLineWnd(self); //共同
|
||||
FListPages := new TListPages(self); //tab 跳转页面
|
||||
FEchoWnd := new TEditerEchoWnd(self);
|
||||
FEchoWnd.font := array("height":16,"width":8,"escapement":0,"orientation":0,"weight":400,"italic":0,"underline":0,"strikeout":0,
|
||||
FEchoWnd.font := array("height":24,"width":12,"escapement":0,"orientation":0,"weight":400,"italic":0,"underline":0,"strikeout":0,
|
||||
"charset":0,"outprecision":0,"clipprecision":0,"quality":1,"pitchandfamily":1,"facename":"Courier New","color":0);
|
||||
FTslDebug := new TTslDebug(self);
|
||||
FFindListWnd := new TFindListWnd(self);
|
||||
|
|
@ -2444,6 +2445,10 @@ type TEditer=class(TCustomcontrol) //
|
|||
begin
|
||||
return fcoolbar;//FToolbar;
|
||||
end
|
||||
function gettoolbarimglist();
|
||||
begin
|
||||
return ftoolbara.ImageList;
|
||||
end
|
||||
function gettoolbarbtn(idxs);
|
||||
begin
|
||||
if ifarray(idxs) then
|
||||
|
|
|
|||
|
|
@ -1447,7 +1447,8 @@ type TVclDesigner = class(tvcform)
|
|||
rect := _wapi.GetScreenRect();
|
||||
twidth := (rect[2]-50);
|
||||
width := twidth;
|
||||
calcheight(twidth);
|
||||
height := 200;
|
||||
//calcheight(twidth);
|
||||
caption := "TVCL界面设计器";
|
||||
FProjectsManager := new TProjectManagerForm(self);
|
||||
ico := new tbitmap();
|
||||
|
|
@ -1540,20 +1541,21 @@ type TVclDesigner = class(tvcform)
|
|||
end
|
||||
end
|
||||
tlbar.Align := alLeft;
|
||||
tlbar.width :=450;
|
||||
tlbar.width :=650;
|
||||
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 := fdimagelist;
|
||||
FToolBars.Font.width := 9;
|
||||
FToolBars.Font.height := 18;
|
||||
|
||||
FToolBars.Imagelist := fdimagelist;
|
||||
FToolBars.Font.width := 10;
|
||||
FToolBars.Font.height := 20;
|
||||
FToolBars.linkimagelist := FProjectManager.FTslEditer.gettoolbarimglist();
|
||||
addtoolbuttons();
|
||||
FToolBars.Align := alClient;
|
||||
FToolBars.parent := self;
|
||||
//************菜单******************************
|
||||
createmainmenubyarray(mainmenus(),FMenu0,self);
|
||||
Mainmenu := FMenu0;
|
||||
|
|
@ -1568,6 +1570,7 @@ type TVclDesigner = class(tvcform)
|
|||
FProjectManager.FTslEditer.setdbugruncall(thisfunction(debugproject)); //设置调试回调
|
||||
FProjectManager.newmenu.parent := ffilemenu;//
|
||||
FProjectManager.goformmenu.parent := fviewmenu;//
|
||||
//OnChange
|
||||
//fnewmenu
|
||||
end
|
||||
property VariableSelecter read FVariableSelecter; //当前控件树的变量对象
|
||||
|
|
@ -2025,56 +2028,38 @@ type TDesigImageList = class(TControlImageList)
|
|||
end
|
||||
type TDesignertoolbars = class(TPageControl) //设计器控件按钮
|
||||
private
|
||||
[weakref]FToolbars;
|
||||
[weakref]FToolsheets;
|
||||
[weakref]ftoolbars;
|
||||
FLabels ;
|
||||
fimg;
|
||||
|
||||
[weakref]fimg;
|
||||
[weakref]flinkimagelist;
|
||||
function SetImageList(im);
|
||||
begin
|
||||
fimg := im;
|
||||
end
|
||||
function SetlinkeImageList(img);
|
||||
begin
|
||||
flinkimagelist := img;
|
||||
if flinkimagelist then
|
||||
begin
|
||||
flinkimagelist.onchange := thisfunction(changedimg);
|
||||
end
|
||||
end
|
||||
public
|
||||
Flabelcharlen;
|
||||
function changedimg(o,e);
|
||||
begin
|
||||
if fimg then fimg.imgsize := o.imgsize;
|
||||
end
|
||||
function Create(AOwner);override;
|
||||
begin
|
||||
inherited;
|
||||
ftbs := array();
|
||||
align := alClient;
|
||||
FToolbars := array();
|
||||
Flabelcharlen := 0;
|
||||
end
|
||||
Procedure Notification(AComponent,Operation);virtual;
|
||||
begin
|
||||
if Operation=opRemove then
|
||||
begin
|
||||
if AComponent=fimg then
|
||||
begin
|
||||
fimg := nil;
|
||||
end else
|
||||
begin
|
||||
for i,v in FToolbars do
|
||||
begin
|
||||
if v=AComponent then
|
||||
begin
|
||||
idx := i;
|
||||
end
|
||||
end
|
||||
if idx then
|
||||
begin
|
||||
reindex(FToolbars,array(idx:nil));
|
||||
end
|
||||
end
|
||||
end
|
||||
FToolsheets := array();
|
||||
ftoolbars := array();
|
||||
inherited;
|
||||
end
|
||||
function CrossCursor(f);
|
||||
begin
|
||||
for i,v in FToolbars do
|
||||
begin
|
||||
if f then
|
||||
v.Cursor := OCR_CROSS;
|
||||
else v.Cursor := OCR_NORMAL;
|
||||
end
|
||||
ParentFont := false;
|
||||
|
||||
align := alClient;
|
||||
|
||||
end
|
||||
function addbtn(btn,t); //加入按钮
|
||||
begin
|
||||
|
|
@ -2082,31 +2067,52 @@ type TDesignertoolbars = class(TPageControl) //
|
|||
begin
|
||||
t := "常用";
|
||||
end
|
||||
tb := FToolbars[t];
|
||||
if not tb then
|
||||
st := FToolsheets[t];
|
||||
if not st then
|
||||
begin
|
||||
st := new TTabSheet(self);
|
||||
st.caption := t;
|
||||
tb := new ttoolbar(self);
|
||||
tb.align := alClient;
|
||||
st.caption := t;
|
||||
if t<>"隐藏" then
|
||||
begin
|
||||
st.parent := self;
|
||||
tb.parent := st;
|
||||
Flabelcharlen+= length(t)+2;
|
||||
end
|
||||
tb.imagelist := fimg;
|
||||
FToolbars[t] := tb;
|
||||
end
|
||||
FToolsheets[t] := st;
|
||||
end
|
||||
ftbs[btn._tag.dclassname()] := btn;
|
||||
btn.parent := tb;
|
||||
sb := ftoolbars[t];
|
||||
if not sb then sb := array();
|
||||
flg := true;
|
||||
for i,sbi in sb do
|
||||
begin
|
||||
if sbi.ExecuteCommand("getbtncount")<20 then
|
||||
begin
|
||||
flg := false;
|
||||
break;
|
||||
end
|
||||
end
|
||||
if flg then
|
||||
begin
|
||||
sbi := new ttoolbar(self);
|
||||
sbi.align := alTop;//alClient;
|
||||
sbi.autosize := true;
|
||||
sbi.parent := st;
|
||||
sbi.imagelist := fimg;
|
||||
sb[length(sb)] := sbi;
|
||||
ftoolbars[t] := sb;
|
||||
end
|
||||
btn.parent := sbi;
|
||||
ftbs[btn._tag.dclassname()] := btn;
|
||||
end
|
||||
function delbtn(n);
|
||||
begin
|
||||
btn := ftbs[n];
|
||||
if btn then btn.Recycling();
|
||||
if btn then
|
||||
begin
|
||||
btn.Recycling();
|
||||
deleteindex(ftbs,n);
|
||||
end
|
||||
end
|
||||
property ImageList write SetImageList;
|
||||
property linkimagelist write SetlinkeImageList;
|
||||
private
|
||||
[weakref]ftbs;
|
||||
|
||||
|
|
@ -2138,7 +2144,7 @@ type TViewBitmap = class(TvcForm)
|
|||
else
|
||||
FBmp.StretchDraw(self.canvas,array(650,100,650+200,100+300));
|
||||
end
|
||||
end
|
||||
end
|
||||
function GetBimpOpenBmp();
|
||||
begin
|
||||
return getbitmapviewerbitmapinfo();
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -179,6 +179,7 @@ type tcustomcoolbar=class(tcustomcontrol)
|
|||
begin
|
||||
inherited;
|
||||
doControlALign();
|
||||
InvalidateRect(nil,false);
|
||||
end
|
||||
function doControlALign();override;//µ÷ÕûλÖÃ
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -5207,7 +5207,7 @@ type TcustomToolBar=class(TCustomControl)
|
|||
inherited;
|
||||
end
|
||||
function GetPreferredSize(w,h);override;
|
||||
begin
|
||||
begin
|
||||
ft := Font;
|
||||
if not ft then return ;
|
||||
ftw := ft.Width;
|
||||
|
|
@ -5216,21 +5216,42 @@ type TcustomToolBar=class(TCustomControl)
|
|||
crec := ClientRect;
|
||||
dw := (brec[2]-brec[0])-(crec[2]-crec[0]);
|
||||
dh := (brec[3]-brec[1])-(crec[3]-crec[1]);
|
||||
al := Align;
|
||||
if fmainmenu then
|
||||
begin
|
||||
w := 0;
|
||||
w := 0;
|
||||
ct := 0;
|
||||
for i:= 0 to fmenubtns.length()-1 do
|
||||
begin
|
||||
mu := getbtnitem(i);
|
||||
if mu.Visible then
|
||||
begin
|
||||
s := mu.Caption;
|
||||
w +=length(s)*ftw+15;
|
||||
case al of
|
||||
alLeft,alRight:
|
||||
begin
|
||||
w := max(w,length(s)*ftw+15);
|
||||
ct++;
|
||||
end else
|
||||
begin
|
||||
w +=length(s)*ftw+15;
|
||||
end
|
||||
|
||||
end ;
|
||||
end
|
||||
end
|
||||
w +=dw+2;
|
||||
w := max(100,w);
|
||||
h := fth+2+dh;
|
||||
w := max(80,w);
|
||||
case al of
|
||||
alLeft,alRight:
|
||||
begin
|
||||
h := (max(1,ct)*(fth+2));
|
||||
end else
|
||||
begin
|
||||
h := fth+2+dh;
|
||||
end
|
||||
end;
|
||||
|
||||
return ;
|
||||
end else
|
||||
begin
|
||||
|
|
@ -5248,8 +5269,19 @@ type TcustomToolBar=class(TCustomControl)
|
|||
bi := FButtons[i];
|
||||
ct +=bi.Visible;
|
||||
end
|
||||
w := max(ct,1)*(imgw+1);
|
||||
h := imgh;
|
||||
case al of
|
||||
alLeft,alRight:
|
||||
begin
|
||||
w := imgh;
|
||||
h :=max(ct,1)*(imgw+1);
|
||||
end else
|
||||
begin
|
||||
w := max(ct,1)*(imgw+1);
|
||||
h := imgh;
|
||||
|
||||
end
|
||||
end ;
|
||||
|
||||
w+=dw;
|
||||
h+=dh;
|
||||
return ;
|
||||
|
|
@ -5316,7 +5348,7 @@ type TcustomToolBar=class(TCustomControl)
|
|||
end
|
||||
function DoCNALIGN(o,e);override;
|
||||
begin
|
||||
case Align of
|
||||
{case Align of
|
||||
alTop,alBottom:
|
||||
begin
|
||||
bs := UnAlignBounds;
|
||||
|
|
@ -5333,7 +5365,7 @@ type TcustomToolBar=class(TCustomControl)
|
|||
bs[2]+= dh;
|
||||
FUnAlignBounds := bs;
|
||||
end
|
||||
end
|
||||
end}
|
||||
inherited;
|
||||
end
|
||||
function DoTimerShowTip(); //¶¨Ê±Æ÷
|
||||
|
|
@ -5704,6 +5736,10 @@ type TcustomToolBar=class(TCustomControl)
|
|||
InvalidateRect(nil,false);
|
||||
return 0;
|
||||
end
|
||||
"getbtncount":
|
||||
begin
|
||||
return getbtncount();
|
||||
end
|
||||
end ;
|
||||
return inherited;
|
||||
end
|
||||
|
|
|
|||
BIN
tsleditor.exe
BIN
tsleditor.exe
Binary file not shown.
BIN
tslvcltool.exe
BIN
tslvcltool.exe
Binary file not shown.
Loading…
Reference in New Issue