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