编辑器
优化
This commit is contained in:
@@ -892,6 +892,11 @@ type TPanel=class(TScrollingWinControl) //
|
||||
p.cstyle := CS_HREDRAW .| CS_VREDRAW .| CS_OWNDC .| CS_DBLCLKS;
|
||||
//p.exstyle := 0x101;
|
||||
end
|
||||
function paint();override;
|
||||
begin
|
||||
inherited;
|
||||
drawdesigninggrid();
|
||||
end
|
||||
function publishs();override;
|
||||
begin
|
||||
return array("name","align","anchors","caption","enabled","cursor","font",
|
||||
@@ -1280,10 +1285,11 @@ type TVCForm = class(TScrollingWinControl)
|
||||
if cd is class(TComponent)then return Controls.indexof(cd)<0;
|
||||
return true;
|
||||
end
|
||||
function paint();override;
|
||||
function Paint();override;
|
||||
begin
|
||||
inherited;
|
||||
end
|
||||
drawdesigninggrid();
|
||||
end
|
||||
function WMSYSCOMMAND(o,e):WM_SYSCOMMAND;override;
|
||||
begin
|
||||
{**
|
||||
@@ -1503,6 +1509,11 @@ type TpanelForm=class(tpanel)
|
||||
FWidth := wd;
|
||||
wspopup := true;
|
||||
end
|
||||
function Paint();override;
|
||||
begin
|
||||
inherited;
|
||||
drawdesigninggrid();
|
||||
end
|
||||
function SetDesigning(f,fc);override;
|
||||
begin
|
||||
if f then wspopup := true;
|
||||
@@ -1522,6 +1533,7 @@ type TDCreatePanel=class(TpanelForm)
|
||||
inherited;
|
||||
Loader.LoadFromTfm(self(true));
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
//°´Å¥
|
||||
@@ -2139,8 +2151,8 @@ type tmemo = class(TSynMemoNorm)
|
||||
function publishs();override;
|
||||
begin
|
||||
return array("name","font",
|
||||
"popupmenu","visible",
|
||||
"height","width","anchors","left","top",
|
||||
"popupmenu","visible","anchors","align",
|
||||
"height","width","left","top",
|
||||
"text","readonly",
|
||||
"tabspace","onmousewheel","onmousemove","onpopupmenu",
|
||||
"onmousedown","onmouseup",
|
||||
@@ -3526,7 +3538,7 @@ type TTabSheet = class(TCustomControl)
|
||||
public
|
||||
function paint();override;
|
||||
begin
|
||||
|
||||
drawdesigninggrid();
|
||||
end
|
||||
function DesigningMove();override;
|
||||
begin
|
||||
@@ -4163,6 +4175,11 @@ type TPairSplitterSide=class(TCustomControl)
|
||||
begin
|
||||
return false;
|
||||
end
|
||||
function paint();override;
|
||||
begin
|
||||
inherited;
|
||||
drawdesigninggrid();
|
||||
end
|
||||
function DesigningSizer();override;
|
||||
begin
|
||||
return false;
|
||||
|
||||
@@ -1830,6 +1830,30 @@ end
|
||||
if HandleAllocated()then ControlCreateWnd();
|
||||
end
|
||||
protected
|
||||
function drawdesigninggrid();
|
||||
begin
|
||||
if csDesigning in ComponentState then
|
||||
begin
|
||||
cv := canvas;
|
||||
if not(cv.HandleAllocated()) then return ;
|
||||
rc := ClientRect;
|
||||
dx := 20;
|
||||
dy := 20;
|
||||
x := 0;
|
||||
y := 0;
|
||||
c := 0;
|
||||
while y<rc[3] do
|
||||
begin
|
||||
y+=dx;
|
||||
x := 0;
|
||||
while x<rc[2] do
|
||||
begin
|
||||
x+=dx;
|
||||
cv.SetPixel(array(x,y),c);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ControlCreateWnd();
|
||||
begin
|
||||
for i := 0 to FControls.count-1 do
|
||||
|
||||
@@ -974,6 +974,24 @@ type tsgtkapi = class(tgtkapis)
|
||||
gtk_object_set_data(hdc,"text.color",col);
|
||||
return true;
|
||||
end
|
||||
Function SetPixel(dc,x,y,colr);
|
||||
begin
|
||||
if not dc then return ;
|
||||
if ifnumber(x) and ifnumber(y) then
|
||||
begin
|
||||
pc := colr;
|
||||
MoveToEx(dc,x,y);
|
||||
pc := gtk_object_get_data(dc,"pen.color");
|
||||
pw := gtk_object_get_data(dc,"pen.width");
|
||||
gtk_object_set_data(dc,"pen.color",colr);
|
||||
gtk_object_set_data(dc,"pen.width",2);
|
||||
LineTo(dc,x+1,y+1);
|
||||
gtk_object_set_data(dc,"pen.color",pc);
|
||||
gtk_object_set_data(dc,"pen.width",pc);
|
||||
return 1;
|
||||
end
|
||||
end
|
||||
|
||||
Function FillRect(dc:pointer;rec:array of integer;br:pointer):integer;
|
||||
begin
|
||||
if not dc then return ;
|
||||
@@ -2558,11 +2576,11 @@ type tsgtkapi = class(tgtkapis)
|
||||
begin
|
||||
|
||||
end;
|
||||
function SetForegroundWindow(hwd :pointer):integer;
|
||||
begin
|
||||
end
|
||||
function Shell_NotifyIconA(dwMessage:integer; lpData:pointer):integer;
|
||||
begin
|
||||
end
|
||||
function SetForegroundWindow(hwd :pointer):integer;
|
||||
begin
|
||||
end
|
||||
function BringWindowToTop(hwd :pointer);
|
||||
begin
|
||||
|
||||
@@ -7,6 +7,7 @@ interface
|
||||
uses cstructurelib,utslvclmemstruct,utslvclauxiliary,utslvclbase;
|
||||
|
||||
function GetTextWidthAndHeightWidthFont(s,f,mul);
|
||||
function getdrawablebitmap(w,h,bmp);
|
||||
type TGdi = class(TSLUIBASE)
|
||||
private
|
||||
static GDICache;
|
||||
@@ -2660,11 +2661,14 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||
@return(tcustombitmap|nil) 成功返回位图 %%
|
||||
**}
|
||||
r := nil;
|
||||
{$ifdef linux}
|
||||
return r;
|
||||
{$endif}
|
||||
if not(ifarray(rect)and rect[2]>rect[0]and rect[3]>rect[1])then return r;
|
||||
if not HandleAllocated()then return r;
|
||||
if not FHDC then FHDC := _wapi.CreateCompatibleDC(0);
|
||||
if not FHDC then return r;
|
||||
bthandle := _wapi.CreateCompatibleBitmap(FSHDC2,w,h);
|
||||
bthandle := _wapi.CreateCompatibleBitmap(_wapi.GetDC(0),w,h);
|
||||
if not bthandle then return r;
|
||||
oldb := _wapi.SelectObject(FHDC,bthandle);
|
||||
_wapi.BitBlt(FHDC,0,0,rect[2]-rect[0],rect[3]-rect[1],FHandle,rect[0],rect[1],SRCCOPY);
|
||||
@@ -2679,6 +2683,9 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||
@explan(说明)文本旋转%%
|
||||
@param(trans)(array) array(cos,-sin,sin,cos,x,y)%%
|
||||
**}
|
||||
{$ifdef linux}
|
||||
return r;
|
||||
{$endif}
|
||||
_xformobj._setvalue_("em11",trans[0]);
|
||||
_xformobj._setvalue_("em12",trans[1]);
|
||||
_xformobj._setvalue_("em21",trans[2]);
|
||||
@@ -2996,6 +3003,22 @@ begin
|
||||
cv.handle := cv._wapi.CreateCompatibleDC(0);
|
||||
return cv;
|
||||
end
|
||||
function getdrawablebitmap(w,h,bmp);
|
||||
begin
|
||||
{$ifdef linux}
|
||||
return 0;
|
||||
{$endif}
|
||||
if w>1 and h>1 then
|
||||
begin
|
||||
cv := static GetOneCanvas();
|
||||
api := cv._wapi;
|
||||
bmp := new TcustomBitmap();
|
||||
bhd :=api.CreateCompatibleBitmap(api.GetDC(0),w,h);
|
||||
bmp.handle := bhd;
|
||||
api.SelectObject(cv.handle,bhd);
|
||||
return cv;
|
||||
end
|
||||
end
|
||||
initialization
|
||||
sinitgidplus();
|
||||
class(tcustomimage).sinit();
|
||||
|
||||
@@ -2569,9 +2569,9 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||
end
|
||||
function MouseUp(o,e);override;
|
||||
begin
|
||||
if FIsMouseDown then
|
||||
if FIsMouseDown then //已经按下过
|
||||
begin
|
||||
_wapi.clipcursor(ps);
|
||||
_wapi.clipcursor(ps); //解锁光标
|
||||
FIsMouseDown := false;
|
||||
selchange := 0;
|
||||
case FMultisel of
|
||||
@@ -3552,6 +3552,7 @@ type TcustomToolButton=class(tcomponent)
|
||||
FImageId :=-1; //imageid
|
||||
FEnabled := true; //有效 可以点击
|
||||
FVisible := true; //可见
|
||||
FStylesep := false;
|
||||
end
|
||||
function ExecuteCommand(cmd,d);override;
|
||||
begin
|
||||
@@ -3598,7 +3599,7 @@ type TcustomToolButton=class(tcomponent)
|
||||
end
|
||||
function publishs();override;
|
||||
begin
|
||||
return array("name","caption","enabled","imageid","visible","onclick","popupmenu");
|
||||
return array("name","caption","enabled","stylesep","imageid","visible","onclick","popupmenu");
|
||||
end
|
||||
function Recycling();override;
|
||||
begin
|
||||
@@ -3631,6 +3632,7 @@ type TcustomToolButton=class(tcomponent)
|
||||
property Action:taction read GetAction write SetAction;
|
||||
property ShortCut read getShortCut write SetShortCut;
|
||||
property PopupMenu:tpopupmenu read FPopupMenu write FPopupMenu;
|
||||
property stylesep:bool read FStylesep write setstylesep;
|
||||
{**
|
||||
@param(OnClick)(function[o:TToolButton;e:tuieventbase]) 点击消息 %%
|
||||
@param(Caption)(string) 标题 %%
|
||||
@@ -3639,7 +3641,17 @@ type TcustomToolButton=class(tcomponent)
|
||||
@param(Visible)(bool) 是否可见 %%
|
||||
**}
|
||||
private
|
||||
FStylesep;
|
||||
FShortCut;
|
||||
function setstylesep(v);
|
||||
begin
|
||||
nv := v?true:false;
|
||||
if nv<>FStylesep then
|
||||
begin
|
||||
FStylesep := nv;
|
||||
if FToolbar then FToolbar.BtnChanged();
|
||||
end
|
||||
end
|
||||
function getShortCut();
|
||||
begin
|
||||
return formatshortcut(FShortCut);
|
||||
@@ -3913,6 +3925,10 @@ type TcustomToolBar=class(TCustomControl)
|
||||
**}
|
||||
InsertButton(btn);
|
||||
end
|
||||
function getbtnbyindex(idx);
|
||||
begin
|
||||
return FButtons[idx];
|
||||
end
|
||||
function SetBtnIndex(btn,idx);
|
||||
begin
|
||||
{**
|
||||
@@ -4018,6 +4034,50 @@ type TcustomToolBar=class(TCustomControl)
|
||||
**}
|
||||
EndUpdate();
|
||||
end
|
||||
|
||||
function Paint();override;
|
||||
begin
|
||||
c := canvas;
|
||||
for i := 0 to FButtons.length()-1 do
|
||||
begin
|
||||
bi := FButtons[i];
|
||||
if not(bi.Visible)then continue;
|
||||
ci := FBtnRects[i];
|
||||
if not ifarray(ci)then return;
|
||||
if FMouseDownIdx=i then
|
||||
begin
|
||||
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONCHECK);
|
||||
end else
|
||||
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH);
|
||||
igslist := ImageList;
|
||||
if igslist is class(TCustomImageList)then
|
||||
begin
|
||||
igid := bi.ImageId;
|
||||
if igid >= 0 and igid<igslist.ImageCount then
|
||||
begin
|
||||
if bi.Enabled then igslist.draw(igid,c,ci[0]+2,ci[1]+2,nil);
|
||||
else igslist.draw(igid,c,ci[0]+2,ci[1]+2,ILC_COLOR4);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DoEndUpDate();override; //锁定刷新释放
|
||||
begin
|
||||
if not(IsUpDating())then
|
||||
begin
|
||||
if FWillModifyToolbar then
|
||||
begin
|
||||
FWillModifyToolbar := false;
|
||||
DoControlAlign();
|
||||
if Parent then Parent.DoControlAlign();
|
||||
end
|
||||
end
|
||||
inherited;
|
||||
end
|
||||
function DoControlAlign();override;
|
||||
begin
|
||||
CalcButtonsRect();
|
||||
end
|
||||
function CalcHeightFixWidth(w);
|
||||
begin
|
||||
{**
|
||||
@@ -4105,49 +4165,6 @@ type TcustomToolBar=class(TCustomControl)
|
||||
return((frac(nt)>0)?(integer(nt)+1):(nt)) * (imgw+1)+bw;
|
||||
return(integer(bct/rct)+1) * (imgw+1)+bw;
|
||||
end
|
||||
function Paint();override;
|
||||
begin
|
||||
c := canvas;
|
||||
for i := 0 to FButtons.length()-1 do
|
||||
begin
|
||||
bi := FButtons[i];
|
||||
if not(bi.Visible)then continue;
|
||||
ci := FBtnRects[i];
|
||||
if not ifarray(ci)then return;
|
||||
if FMouseDownIdx=i then
|
||||
begin
|
||||
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONCHECK);
|
||||
end else
|
||||
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH);
|
||||
igslist := ImageList;
|
||||
if igslist is class(TCustomImageList)then
|
||||
begin
|
||||
igid := bi.ImageId;
|
||||
if igid >= 0 and igid<igslist.ImageCount then
|
||||
begin
|
||||
if bi.Enabled then igslist.draw(igid,c,ci[0]+2,ci[1]+2,nil);
|
||||
else igslist.draw(igid,c,ci[0]+2,ci[1]+2,ILC_COLOR4);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function DoEndUpDate();override; //锁定刷新释放
|
||||
begin
|
||||
if not(IsUpDating())then
|
||||
begin
|
||||
if FWillModifyToolbar then
|
||||
begin
|
||||
FWillModifyToolbar := false;
|
||||
DoControlAlign();
|
||||
if Parent then Parent.DoControlAlign();
|
||||
end
|
||||
end
|
||||
inherited;
|
||||
end
|
||||
function DoControlAlign();override;
|
||||
begin
|
||||
CalcButtonsRect();
|
||||
end
|
||||
function IndexOfBtn(btn);
|
||||
begin
|
||||
{**
|
||||
@@ -4221,6 +4238,7 @@ type TcustomToolBar=class(TCustomControl)
|
||||
FTimer.Stop();
|
||||
FTipWnd.Visible := false;
|
||||
end
|
||||
|
||||
function CalcButtonsRect();
|
||||
begin
|
||||
if(IsUpDating())then
|
||||
@@ -4255,19 +4273,29 @@ type TcustomToolBar=class(TCustomControl)
|
||||
begin
|
||||
if rct=0 then
|
||||
begin
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
if bi.stylesep then
|
||||
begin
|
||||
FBtnRects[i]:= array(0,0,0,0);
|
||||
end else
|
||||
begin
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
end
|
||||
y := 0;
|
||||
x += imgw+1;
|
||||
end else
|
||||
begin
|
||||
y := 0;
|
||||
x += imgw+1;
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
if bi.stylesep then FBtnRects[i]:= array(0,0,0,0);
|
||||
else
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
y += imgh+1;
|
||||
rct := 1;
|
||||
end
|
||||
end else
|
||||
begin
|
||||
if bi.stylesep then FBtnRects[i]:= array(0,0,0,0);
|
||||
else
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
y += imgh+1;
|
||||
rct++;
|
||||
@@ -4287,20 +4315,26 @@ type TcustomToolBar=class(TCustomControl)
|
||||
begin
|
||||
if rct=0 then
|
||||
begin
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
if bi.stylesep then FBtnRects[i]:= array(0,0,0,0);
|
||||
else
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
x := 0;
|
||||
y += imgh+1;
|
||||
end else
|
||||
begin
|
||||
x := 0;
|
||||
y += imgh+1;
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
if bi.stylesep then FBtnRects[i]:= array(0,0,0,0);
|
||||
else
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
x += imgw+1;
|
||||
rct := 1;
|
||||
end
|
||||
end else
|
||||
begin
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
if bi.stylesep then FBtnRects[i]:= array(0,0,0,0);
|
||||
else
|
||||
FBtnRects[i]:= array(x,y,x+imgw,y+imgh);
|
||||
x += imgw+1;
|
||||
rct++;
|
||||
end
|
||||
|
||||
@@ -98,7 +98,7 @@ type TCustomThreadworker = class()
|
||||
if not FThreaders then return ;
|
||||
for idx,i in mrows( FThreaders,1) do
|
||||
begin
|
||||
o := FThreaders[i];
|
||||
o := FThreaders[i];
|
||||
if uifeachthreadworkerdata(o.handle,msg,data) then
|
||||
begin
|
||||
case msg of
|
||||
|
||||
@@ -222,8 +222,13 @@ type twindowsapi = class
|
||||
class function IsWindow(hd:pointer):integer;stdcall;external "User32.dll" name "IsWindow";
|
||||
class function IsWindowVisible(hd:pointer):integer;stdcall;external "User32.dll" name "IsWindowVisible";
|
||||
function GetWindow(hd:pointer;cd:integer):pointer;stdcall;external "User32.dll" name "GetWindow";
|
||||
function GetNextWindow(hd:pointer;cd:integer):pointer;stdcall;external "User32.dll" name "GetNextWindow";
|
||||
//function GetNextWindow(hd:pointer;cd:integer):pointer;stdcall;external "User32.dll" name "GetNextWindow";
|
||||
function GetNextWindow(h,cd);
|
||||
begin
|
||||
return GetWindow(h,cd);
|
||||
end
|
||||
function GetTopWindow(hd:pointer):pointer;stdcall;external "User32.dll" name "GetTopWindow";
|
||||
function GetWindowThreadProcessId(hd:pointer;var pid :integer):integer;stdcall;external "User32.dll" name "GetWindowThreadProcessId";
|
||||
function IsChild(hd:pointer;cd:pointer):integer;stdcall;external "User32.dll" name "IsChild";
|
||||
function RegisterClassExA(wc:pointer):short;stdcall;external "User32.dll" name "RegisterClassExA";
|
||||
function EnableWindow(wc:pointer;b:integer):integer;stdcall;external "User32.dll" name "EnableWindow";
|
||||
@@ -320,6 +325,7 @@ type twindowsapi = class
|
||||
function memcpy2(var dst:string;src:pointer;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
|
||||
function fopen(filename:string; mode:string):pointer;cdecl;external "msvcrt.dll" name "fopen";
|
||||
function fclose(f:pointer):integer;cdecl;external "msvcrt.dll" name "fclose";
|
||||
function GetProcessId(h:pointer):integer;stdcall;external "Kernel32.dll" name "GetProcessId";
|
||||
function LockFile(hFile:pointer; dwFileOffsetLow:integer; dwFileOffsetHigh:integer;nNumberOfBytesToLockLow:integer;nNumberOfBytesToLockHigh:integer):integer;stdcall;external "Kernel32.dll" name "LockFile";
|
||||
function UnlockFile(hFile:pointer; dwFileOffsetLow:integer; dwFileOffsetHigh:integer;nNumberOfBytesToLockLow:integer;nNumberOfBytesToLockHigh:integer):integer;stdcall;external "Kernel32.dll" name "UnlockFile";
|
||||
//icon
|
||||
|
||||
Reference in New Issue
Block a user