forked from liujianjun/tslediter
界面库
整理代码
This commit is contained in:
+43
-75
@@ -4,7 +4,8 @@ unit UtslCodeEditor;
|
||||
20220520 分离调试器代码
|
||||
}
|
||||
interface
|
||||
uses utslvcldesignerresource,cstructurelib,utslvclauxiliary,utslvclmemstruct,utslvclgdi,tslvcl,UTslmemo,UTslSynMemo,utslvclsyntaxparser,utslvcldebuger;
|
||||
uses utslvcldesignerresource,cstructurelib,utslvclauxiliary,utslvclmemstruct,utslvclgdi,
|
||||
tslvcl,UTslmemo,UTslSynMemo,utslvclsyntaxparser,utslvcldebuger;
|
||||
{
|
||||
1. page标签
|
||||
TPagees; TPageItem
|
||||
@@ -16,7 +17,7 @@ TPagees; TPageItem
|
||||
|
||||
}
|
||||
function gettslexe();
|
||||
type TPageItem=class //标签项
|
||||
type TPageItem=class() //标签项
|
||||
function Create(AOwner);
|
||||
begin
|
||||
FCaption := "";
|
||||
@@ -29,11 +30,11 @@ type TPageItem=class //
|
||||
Tag := nil;
|
||||
end
|
||||
published
|
||||
property Caption read FCaption write SetCaption;
|
||||
property BitmapA read FBitmapA write SetBitmapA;
|
||||
property BitmapB read FBitmapB write SetBitmapB;
|
||||
tag;
|
||||
Rect;
|
||||
property Caption read FCaption write SetCaption; //标题
|
||||
property BitmapA read FBitmapA write SetBitmapA; //前面的图标
|
||||
property BitmapB read FBitmapB write SetBitmapB; //后面的关闭图标
|
||||
tag; //绑定变量
|
||||
Rect; //区域
|
||||
protected
|
||||
function SetCaption(s);
|
||||
begin
|
||||
@@ -105,7 +106,7 @@ type TPage=class(TCustomControl) //
|
||||
begin
|
||||
return new TPageItem(self);
|
||||
end
|
||||
function itemcaptionchenged(it);
|
||||
function itemcaptionchenged(it); //标签等改变
|
||||
begin
|
||||
if GetItemIndex(it)>= 0 then
|
||||
begin
|
||||
@@ -113,15 +114,15 @@ type TPage=class(TCustomControl) //
|
||||
InValidateRect(nil,false);
|
||||
end
|
||||
end
|
||||
function ItemBitmapAChenged(it);
|
||||
function ItemBitmapAChenged(it); //保存改变
|
||||
begin
|
||||
if GetItemIndex(it)>= 0 then InValidateRect(it.Rect,false);
|
||||
end
|
||||
function ItemBitmapBChenged(it);
|
||||
function ItemBitmapBChenged(it); //关闭改变
|
||||
begin
|
||||
if GetItemIndex(it)>= 0 then InValidateRect(it.Rect,false);
|
||||
end
|
||||
function FontChanged();override;
|
||||
function FontChanged();override;//字体改变
|
||||
begin
|
||||
FLineHeight := font.Height+6;
|
||||
DoControlAlign();
|
||||
@@ -139,7 +140,7 @@ type TPage=class(TCustomControl) //
|
||||
DoControlAlign();
|
||||
inherited;
|
||||
end
|
||||
function GetClientRect();override;
|
||||
function GetClientRect();override; //获得新的区域
|
||||
begin
|
||||
r := inherited;
|
||||
FPageRect := R;
|
||||
@@ -147,7 +148,7 @@ type TPage=class(TCustomControl) //
|
||||
FPageRect[3]:= r[1];
|
||||
return r;
|
||||
end
|
||||
function Paint();override;
|
||||
function Paint();override; //绘制
|
||||
begin
|
||||
dc := Canvas;
|
||||
ps := PAINTSTRUCT().rcPaint;
|
||||
@@ -162,7 +163,7 @@ type TPage=class(TCustomControl) //
|
||||
if not rc then continue;
|
||||
if Intersectrect(it.Rect,ps)then
|
||||
begin
|
||||
if FItemIndex=i then
|
||||
if FItemIndex=i then //选中
|
||||
begin
|
||||
//dc.Brush.Color := rgb(244,205,205);
|
||||
dc.Brush.Color := 0xFa901E;
|
||||
@@ -204,7 +205,7 @@ type TPage=class(TCustomControl) //
|
||||
//dc.Stretchdraw(rc,FBmpClose);
|
||||
end
|
||||
end
|
||||
function SetSel(it);
|
||||
function SetSel(it); //选中
|
||||
begin
|
||||
idx := GetItemIndex(it);
|
||||
if idx >= 0 and idx <> FItemIndex then
|
||||
@@ -212,7 +213,7 @@ type TPage=class(TCustomControl) //
|
||||
ItemIndex := idx;
|
||||
end
|
||||
end
|
||||
function CloseAllItem(it);
|
||||
function CloseAllItem(it); //关闭
|
||||
begin
|
||||
FItemINdex :=-1;
|
||||
FCurrentITem := nil;
|
||||
@@ -236,7 +237,7 @@ type TPage=class(TCustomControl) //
|
||||
DoControlAlign();
|
||||
InValidateRect(nil,false);
|
||||
end
|
||||
function DeleteItemByIndex(idx);virtual;
|
||||
function DeleteItemByIndex(idx);virtual;//删除序号
|
||||
begin
|
||||
if idx >= 0 and idx<FPageItems.length()then
|
||||
begin
|
||||
@@ -296,7 +297,7 @@ type TPage=class(TCustomControl) //
|
||||
_wapi.clipcursor(0);
|
||||
end
|
||||
end
|
||||
function MouseUp(o,e);override;
|
||||
function MouseUp(o,e);override; //鼠标放开
|
||||
begin
|
||||
if e.button=mbLeft then
|
||||
begin
|
||||
@@ -339,7 +340,7 @@ type TPage=class(TCustomControl) //
|
||||
end
|
||||
return inherited;
|
||||
end
|
||||
function MouseDown(o,e);override;
|
||||
function MouseDown(o,e);override; //按下
|
||||
begin
|
||||
if e.button=mbMiddle then
|
||||
begin
|
||||
@@ -407,13 +408,13 @@ type TPage=class(TCustomControl) //
|
||||
//if 3=PosInCurrentItemSection(e.pos) then FCurrentITem.Caption := datetimetostr(now());
|
||||
end
|
||||
FCanDraged; //修正提示导致修改后提示导致drage 体验问题
|
||||
function PostInCloseRect(ps);
|
||||
function PostInCloseRect(ps); //是否点击关闭
|
||||
begin
|
||||
rc := ClientRect;
|
||||
rc := array(rc[2]-25,1,rc[2]-1,19);
|
||||
return PointInRect(ps,rc);
|
||||
end
|
||||
function GetItemIndexByPos(xy);
|
||||
function GetItemIndexByPos(xy); //根据位置获得点击的item
|
||||
begin
|
||||
for i := 0 to FPageItems.Length()-1 do
|
||||
begin
|
||||
@@ -421,7 +422,7 @@ type TPage=class(TCustomControl) //
|
||||
end
|
||||
return -1;
|
||||
end
|
||||
function posinitembmpb(xy);
|
||||
function posinitembmpb(xy); //点击图标位置
|
||||
begin
|
||||
for i := 0 to FPageItems.Length()-1 do
|
||||
begin
|
||||
@@ -436,7 +437,7 @@ type TPage=class(TCustomControl) //
|
||||
end
|
||||
return -1;
|
||||
end
|
||||
Function GetItemIndex(it);
|
||||
Function GetItemIndex(it); //获得序号
|
||||
begin
|
||||
for i := 0 to FPageItems.length()-1 do
|
||||
begin
|
||||
@@ -458,16 +459,16 @@ type TPage=class(TCustomControl) //
|
||||
fOnbmpbclick := nil;
|
||||
inherited;
|
||||
end
|
||||
property CurrentItem read FCurrentItem;
|
||||
property OnSelChanged read FOnSelChanged write FOnSelChanged;
|
||||
property OnSelChanging read FOnSelChanging write FOnSelChanging;
|
||||
property OnCloseClick read FOnCloseClick write FOnCloseClick;
|
||||
property CurrentItem read FCurrentItem; //当前的页面
|
||||
property OnSelChanged read FOnSelChanged write FOnSelChanged; //选择已经改变
|
||||
property OnSelChanging read FOnSelChanging write FOnSelChanging; //选择正在改变
|
||||
property OnCloseClick read FOnCloseClick write FOnCloseClick; //关闭
|
||||
property Onbmpbclick read FOnbmpbclick write fOnbmpbclick;
|
||||
property MultiLine read FMultiLine write SetMultiLine;
|
||||
property CloseBtn read FCloseBtn write SetCloseBtn;
|
||||
property Lines read FLines;
|
||||
property PageItems read FPageItems;
|
||||
property pageitemcount read getpageitemcount;
|
||||
property CloseBtn read FCloseBtn write SetCloseBtn; //是否有关闭按钮
|
||||
property Lines read FLines; //多少行
|
||||
property PageItems read FPageItems; //页面集合对象
|
||||
property pageitemcount read getpageitemcount; //页面数量
|
||||
property ItemIndex read FItemIndex write SetItemIndex;
|
||||
protected
|
||||
function CallSelChanged();virtual;
|
||||
@@ -483,7 +484,7 @@ type TPage=class(TCustomControl) //
|
||||
CallDatafunction(FOnSelchanging,self(true),e);
|
||||
return e.skip;
|
||||
end
|
||||
function CalcPageItemRect();
|
||||
function CalcPageItemRect(); //计算位置
|
||||
begin
|
||||
li := 0;
|
||||
cw := Font.Width;
|
||||
@@ -624,7 +625,7 @@ type TEditerAuxiliary=class(TPage) //
|
||||
FIgnoreSize := true;
|
||||
Ftimer.Enabled := true;
|
||||
end
|
||||
function BdownTimeOut(o,e);
|
||||
function BdownTimeOut(o,e); //定时器处理
|
||||
begin
|
||||
if(_wapi.GetAsyncKeyState(VK_LBUTTON).& 0xFF00)>0 then
|
||||
begin
|
||||
@@ -636,20 +637,6 @@ type TEditerAuxiliary=class(TPage) //
|
||||
if p then p.DoControlAlign();
|
||||
end
|
||||
end
|
||||
{function MouseDown(o,e);override;
|
||||
begin
|
||||
if CloseBtn then
|
||||
begin
|
||||
rc := ClientRect;
|
||||
rc := rc := array(rc[2]-25,1,rc[2]-1,19);
|
||||
if PointInRect(e.pos,rc) then
|
||||
begin
|
||||
callDatafunction(FOnCloseClick,o,e);
|
||||
end
|
||||
end
|
||||
inherited;
|
||||
end }
|
||||
//property OnCloseClick read FOnCloseClick write FOnCloseClick;
|
||||
function DoControlAlign();override;
|
||||
begin
|
||||
if FIgnoreSize then
|
||||
@@ -666,7 +653,7 @@ type TEditerAuxiliary=class(TPage) //
|
||||
if CurrentItem then wnd := CurrentItem.Tag;
|
||||
if wnd then wnd.SetBoundsRect(Rc);
|
||||
end
|
||||
function ShowPopUp();
|
||||
function ShowPopUp();//弹出
|
||||
begin
|
||||
if not WSpOPUp then
|
||||
begin
|
||||
@@ -675,7 +662,7 @@ type TEditerAuxiliary=class(TPage) //
|
||||
end
|
||||
if not Visible then Visible := true;
|
||||
end
|
||||
function MouseDown(o,e);override;
|
||||
function MouseDown(o,e);override;//点击处理
|
||||
begin
|
||||
if e.shiftdouble()and e.button()=mbLeft then
|
||||
begin
|
||||
@@ -706,7 +693,6 @@ type TEditerAuxiliary=class(TPage) //
|
||||
FFileFindWnd := nil;
|
||||
FOnCloseClick := nil;
|
||||
inherited;
|
||||
//FOnCloseClick := nil;
|
||||
end
|
||||
function ShowByTag(tg); //显示
|
||||
begin
|
||||
@@ -735,10 +721,10 @@ type TEditerAuxiliary=class(TPage) //
|
||||
it.tag.Visible := true;
|
||||
caption := it.Tag.Caption;
|
||||
end else
|
||||
it.tag.Visible := false;
|
||||
it.tag.Visible := false;
|
||||
end
|
||||
end
|
||||
function AddWnd(wnd);
|
||||
function AddWnd(wnd); //加入窗口
|
||||
begin
|
||||
if wnd is class(TWincontrol)then
|
||||
begin
|
||||
@@ -771,7 +757,7 @@ type TEditerAuxiliary=class(TPage) //
|
||||
end
|
||||
type TExecuteEditer=class(TCustomControl) //执行编辑器
|
||||
Protected
|
||||
Type TExecuteMemoComp=class(TSynCompletion)
|
||||
Type TExecuteMemoComp=class(TSynCompletion) //自动完成对象
|
||||
function Create(AOwner);
|
||||
begin
|
||||
inherited;
|
||||
@@ -794,7 +780,7 @@ type TExecuteEditer=class(TCustomControl) //ִ
|
||||
SetCompData(d);
|
||||
end
|
||||
end
|
||||
type TListBoxb=class(TListBOx)
|
||||
type TListBoxb=class(TListbox)//选择下拉
|
||||
function Create(AOwner);
|
||||
begin
|
||||
inherited;
|
||||
@@ -803,14 +789,14 @@ type TExecuteEditer=class(TCustomControl) //ִ
|
||||
begin
|
||||
return ifobj(it);
|
||||
end
|
||||
function GetItemText(i);override;
|
||||
function GetItemText(i);override;//获得标签
|
||||
begin
|
||||
it := GetItem(i);
|
||||
if it then return it.FCaption;
|
||||
return "";
|
||||
end
|
||||
function InsureItemVisible(idx); //移动当前的格子
|
||||
begin
|
||||
begin
|
||||
rc := GetIdxRect(idx);
|
||||
c := ClientRect;
|
||||
if rc[1]<c[1]then
|
||||
@@ -822,15 +808,6 @@ type TExecuteEditer=class(TCustomControl) //ִ
|
||||
SetYpos(1+GetYPos()+(rc[3]-c[3]+1)/GetYScrollDelta());
|
||||
end
|
||||
end
|
||||
function GetItemIndex();virtual;
|
||||
begin
|
||||
return inherited;
|
||||
end
|
||||
function SetItemIndex(idx);virtual;
|
||||
begin
|
||||
inherited;
|
||||
FListBox.InsureItemVisible(idx);
|
||||
end
|
||||
end
|
||||
type TComboBoxb=class(TCombobox)
|
||||
function Create(AOwner);
|
||||
@@ -4588,8 +4565,6 @@ type TFindListWnd=class(TListBox) //
|
||||
if not ifstring(r)then return "";
|
||||
return r;
|
||||
end
|
||||
Published
|
||||
private
|
||||
end
|
||||
type TFindWnd=class(TPage)
|
||||
type TFindBtn=class(TBtn)
|
||||
@@ -5007,7 +4982,7 @@ type TGoToLineWnd=class(TVCForm) //
|
||||
begin
|
||||
show();
|
||||
FEdit.SetFocus();
|
||||
FEdit.Text := "";
|
||||
FEdit.ExecuteCommand("ecselall");
|
||||
end
|
||||
private
|
||||
function GotoTextInteger();
|
||||
@@ -5019,21 +4994,14 @@ type TGoToLineWnd=class(TVCForm) //
|
||||
it := Owner.GetCurrentItem();
|
||||
Visible := false;
|
||||
Owner.OpenAndGotoFileByName(it.ScriptPath,id);
|
||||
//it.SetFocus();
|
||||
//return ;
|
||||
it := Owner.GetCurrentEditer();
|
||||
if not it then return;
|
||||
//it.ExecuteCommand(it.ecGotoXY,array(id,1));
|
||||
//Visible := false;
|
||||
it.SetFocus();
|
||||
end
|
||||
end
|
||||
FEdit;
|
||||
FBtn;
|
||||
end
|
||||
|
||||
|
||||
|
||||
function filenameIsTheSame(p1,p2);
|
||||
begin
|
||||
if not(ifstring(p1)and ifstring(p2))then return 0;
|
||||
|
||||
Reference in New Issue
Block a user