1521 lines
45 KiB
Plaintext
1521 lines
45 KiB
Plaintext
type TEditerForm = class(TVCform) //编辑器主窗口
|
|
uses utslvclauxiliary,tslvcl,UTslSynMemo,UtslCodeEditor;
|
|
function WMACTIVATE(o,e):WM_ACTIVATE;override; //激活
|
|
begin
|
|
inherited;
|
|
if e.wparam then
|
|
begin
|
|
return _send_(WM_USER,50,60,1);
|
|
end
|
|
//inherited;
|
|
end
|
|
function WMUSER(o,e):WM_USER;override;
|
|
begin
|
|
if e.wparam=50 and e.lparam=60 then
|
|
begin
|
|
it := FEdter.GetCurrentItem();
|
|
if it and it.FEditer then
|
|
begin
|
|
it.FEditer.SetFocus();
|
|
end
|
|
return ;
|
|
end
|
|
inherited;
|
|
end
|
|
function editerinfo();
|
|
begin
|
|
s := "tsl语言本地编辑器\r\n版本:1.0.0\r\n日期:2022-07-19";
|
|
f := tslfilename()+".about";
|
|
if fileexists("",f) then
|
|
begin
|
|
size := filesize("",f);
|
|
if readFile(rwraw(),"",f,0,size,data) then
|
|
begin
|
|
return data;
|
|
end
|
|
end
|
|
return s;
|
|
end
|
|
function Create(AOwner);override;
|
|
begin
|
|
inherited ;
|
|
GLobal G_OpenHostory;
|
|
//////////////////目录/////////////////////
|
|
{$ifdef linux}
|
|
home := sysgetenv("HOME");
|
|
if home then basepath := home+"/.vcl/";
|
|
else
|
|
basepath := ".vcl/";
|
|
|
|
{$else}
|
|
basepath := TS_GetUserProfileHome();
|
|
{$endif}
|
|
sp := ioFileseparator();
|
|
FCache := basepath+"editer"+sp+"cmpCaches";
|
|
FPathDirPath := basepath+"editer"+sp+"paths.tsm";
|
|
Fexefilepath := basepath+"editer"+sp+"tslfile.tsm";
|
|
FOpendpaths := basepath+"editer"+sp+"openedpaths.tsm";
|
|
FTabWidthpath := basepath+"editer"+sp+"tabwidpath.tsm";
|
|
FexefileCmds := basepath+"editer"+sp+"cmds.tsm";
|
|
FHistoryPath := basepath+"editer"+sp+"HistoryPath.tsm";
|
|
FCodeblockPath := basepath+"editer"+sp+"BlockManager.tsm";
|
|
FFindhistroypath := basepath+"editer"+sp+"findhistory.tsm";
|
|
FFormatpath := basepath+"editer"+sp+"tslformat.tsm";
|
|
Fhighlightpath := basepath+"editer"+sp+"highlight.tsm";
|
|
Fremotepath := basepath+"editer"+sp;
|
|
CreateDirWithFileName(basepath+"editer"+sp+"1.txt");
|
|
CreateDirWithFileName(basepath+"editer"+sp+"cmpCaches"+sp+"1.txt");
|
|
//TBlockManager
|
|
//echo "\r\n",FCache;
|
|
////////////////////////////////////////
|
|
rc:=_wapi.GetScreenRect();
|
|
SetBoundsRect(RC);
|
|
caption := "tsl代码编辑器";
|
|
m := new TMainMenu(self);
|
|
//////////////////////////////////////////////
|
|
FmTool := new TMenu(self);
|
|
FmTool.Caption := "窗口";
|
|
fmglobsearch := new TMenu(self);
|
|
fmglobsearch.caption := "日志窗口..";
|
|
fmglobsearch.OnClick := function(o,e)
|
|
begin
|
|
FEDter.SwitchLogWnd();
|
|
end
|
|
///////////////////////////////////////////////////////
|
|
FEnCodeMenu := new TMenu(self);
|
|
FEnCodeMenu.Caption := "编码";
|
|
FCodeMenus := array();
|
|
for i,v in array("ANSI","UTF8","UTF8 BOM","UCS2-big","UCS2-little","----","转为ANSI","转为UTF8","转为UTF8 BOM","转为UCS2-big","转为UCS2-little") do
|
|
begin
|
|
it := new TMenu(self);
|
|
it.Caption := v;
|
|
FCodeMenus[i] := it;
|
|
if v="----" then it.TSeparator := true;
|
|
else
|
|
if v in array("UCS2-big","UCS2-little","UTF8 BOM") then
|
|
begin
|
|
it.Enabled := false;
|
|
end else
|
|
begin
|
|
it.OnClick := thisfunction(ClickEnCodeMenu);
|
|
end
|
|
it.Parent := FEnCodeMenu;
|
|
end
|
|
///////////////////////////////////////////////////////////////
|
|
Fmopen := new TMenu(self);
|
|
newaction := new TAction(self);
|
|
NewAction.ShortCut := "ctrl+O";
|
|
NewAction.caption := "打开";
|
|
NewAction.onexecute := function(o,e)
|
|
begin
|
|
return FEdter.OpenAfile();
|
|
end;
|
|
Fmopen.action := newaction;
|
|
|
|
|
|
Fmnew:= new TMenu(self);
|
|
newaction := new TAction(self);
|
|
NewAction.ShortCut := "ctrl+N";
|
|
NewAction.caption := "新建";
|
|
NewAction.onexecute := function(o,e)
|
|
begin
|
|
return FEdter.CreateAfile();
|
|
end
|
|
Fmnew.action := NewAction;
|
|
FOpenOther := new TMenu(self);
|
|
FOpenOther.Caption := "其他窗口打开";
|
|
FOpenOther.OnClick := thisfunction(OpenInOtherWnd) ;
|
|
FOpenHistoryMenu := new TMenu(self);
|
|
FOpenHistoryMenu.caption := "打开历史";
|
|
FOpenHistoryMenu.OnClick := function(o,e)begin
|
|
FEdter.ShowHistoryWnd();
|
|
end
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
FTslLangMenu := new tmenu(self);
|
|
FTslLangMenu.Caption := "语言设置";
|
|
|
|
FTslFormatMenu := new tmenu(self);
|
|
FTslFormatMenu.Caption := "tsl代码格式设置";
|
|
FTslFormatMenu.OnClick := function(o,e)begin
|
|
FFormatInfoWnd.show();
|
|
end
|
|
FCodeBlockMenu := new TMenu(self);
|
|
FCodeBlockMenu.caption := "tsl代码块设置";
|
|
FCodeBlockMenu.OnClick := function(o,e)begin
|
|
fBlockManager.ShowModal();
|
|
|
|
end
|
|
|
|
FMenuSet := new TMenu(self);
|
|
FMenuSet.caption := "设置";
|
|
fmtslexepath := new TMenu(self);
|
|
if 1=importfile(ftstream(),"",Fexefilepath,tslexefile) then
|
|
begin
|
|
end else
|
|
begin
|
|
sexe := SysExecName();
|
|
if ifstring(sexe) and sexe then
|
|
begin
|
|
for i:= length(sexe) downto 3 do
|
|
begin
|
|
if sexe[i]=sp then
|
|
begin
|
|
if sp="/" then sexe := sexe[1:i]+"TSL";
|
|
else
|
|
sexe := sexe[1:i]+"tsl.exe";
|
|
break;
|
|
end
|
|
end
|
|
tslexefile := sexe;
|
|
end
|
|
end
|
|
fBlockManager := new TBlockManager(self);
|
|
fBlockManager.WsDlgModalFrame := true;
|
|
fBlockManager.caption := "代码块管理";
|
|
fBlockManager.minmaxbox := false;
|
|
fBlockManager.Visible := false;
|
|
fBlockManager.Parent := self;
|
|
fBlockManager.SaveClick := function(o,e)begin
|
|
d := fBlockManager.GetData();
|
|
Exportfile(ftstream(),"",FCodeblockPath,d);
|
|
fBlockManager.EndModal();
|
|
class(TTSLCompletion).FCodeBlocks := d;
|
|
end
|
|
|
|
if 1= importfile(ftstream(),"",FCodeblockPath,d) and d and ifarray(d) then
|
|
begin
|
|
fBlockManager.SetData(d);
|
|
class(TTSLCompletion).FCodeBlocks := d;
|
|
end else
|
|
begin
|
|
try
|
|
d := GetTslCompletionCodeBlocks();
|
|
fBlockManager.SetData(d);
|
|
class(TTSLCompletion).FCodeBlocks := d;
|
|
except
|
|
|
|
end
|
|
end
|
|
/////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
fmtslexepath.caption :="tsl执行设置";
|
|
fmfile := new TMenu(self);
|
|
fmfile.caption := "文件";
|
|
fmfile.parent := m;
|
|
FMenuSet.parent := m;
|
|
Fmopen.parent := fmfile;
|
|
Fmnew.parent := fmfile;
|
|
FOpenOther.Parent := fmfile;
|
|
FOpenHistoryMenu.Parent := fmfile;
|
|
FTslLangMenu.Parent := FMenuSet;
|
|
FCodeBlockMenu.Parent := FTslLangMenu;
|
|
FTslFormatMenu.Parent := FTslLangMenu;
|
|
tbwidth := 4;
|
|
if importfile(ftstream(),"",FTabWidthpath,d)=1 and ( d>0 ) then
|
|
begin
|
|
tbwidth := d;
|
|
end
|
|
FMTabContain :=new TMenu(self);
|
|
fmshowhltediter :=new TMenu(self);
|
|
fmshowhltediter.caption := "编辑器颜色";
|
|
FMTabs := array();
|
|
FMTabContain.Caption := "tab设置:";
|
|
for i:= 0 to 6 do
|
|
begin
|
|
tm := new TMenu(self);
|
|
if i=0 then tm.Caption := "\\t";
|
|
else
|
|
tm.Caption := inttostr(i)+"空格";
|
|
if tbwidth=i then tm.Checked := true;
|
|
tm.Onclick := thisfunction(TabWidthClick);
|
|
FMTabs[i] := tm;
|
|
tm.Parent := FMTabContain;
|
|
end
|
|
FMTabContain.parent := FMenuSet;
|
|
fmshowhltediter.Parent := FMenuSet;
|
|
fmshowhltediter.OnClick := function(o,e)begin
|
|
FEdter.showhltcolor();
|
|
end
|
|
mainmenu := m;
|
|
FmTool.parent := m;
|
|
FEnCodeMenu.parent := m;
|
|
|
|
fmglobsearch.parent := FmTool;
|
|
FSearchDir := new TSearchDir(self);
|
|
FSearchDir.onsaveclick := function(o,e)begin
|
|
return o.EndModal(1);
|
|
end
|
|
FSearchDir.parent := self;
|
|
fmtslexepath.parent := FTslLangMenu;
|
|
fmtslexepath.OnClick := function(o,e)begin
|
|
//FEdter.FExecuteEditer.ShowModal();
|
|
FEdter.ShowExeEditer();
|
|
end
|
|
|
|
FCloseMenu := new tmenu(self);
|
|
FCloseMenu.Caption:="关闭时最小化";
|
|
//FCloseMenu.Checked := true;
|
|
FCloseMenu.parent := FMenuSet;
|
|
FCloseMenu.OnClick := function(o,e)
|
|
begin
|
|
FCloseMenu.Checked := not(FCloseMenu.Checked);
|
|
end
|
|
FEdter := New TEditer(self);
|
|
FEdter.Visible := false;
|
|
|
|
//语言按钮
|
|
FSynMenu := New TMenu(self);
|
|
FSynMenu.Caption := "语言";
|
|
FSynMenus := array();
|
|
for i,v in FEdter.GetSynTypeNames() do
|
|
begin
|
|
it := new TMenu(self);
|
|
it.Caption := v;
|
|
FSynMenus[i] := it;
|
|
it.OnClick := thisfunction(ClickSynMenu);
|
|
it.Parent := FSynMenu;
|
|
end
|
|
FSynMenu.Parent := m;
|
|
|
|
FRunMenu := new TMenu(self);
|
|
FRunMenu.caption := "运行";
|
|
FExeaction := new TAction(self);
|
|
FExeaction.caption := "执行";
|
|
FExeaction.ShortCut := "F9";
|
|
FExeaction.onexecute := function(o,e)
|
|
begin
|
|
FEdter.ExecutePageItem(FEdter.GetCurrentItem());
|
|
end
|
|
for i,v in array("命令行配置","tsl函数目录","执行","调试运行","远程调试","远程调试(waitattach)") do
|
|
begin
|
|
it := new TMenu(self);
|
|
if v = "执行" then
|
|
begin
|
|
it.Action := FExeaction;
|
|
end else
|
|
begin
|
|
it.caption := v;
|
|
it.OnClick := thisfunction(clickRun);
|
|
end
|
|
it.Parent := FRunMenu;
|
|
end
|
|
FRunMenu.Parent := m;
|
|
|
|
FEdter.Parent := self;
|
|
//////////////////////////////////////////////////
|
|
FHelpMenu := new TMenu(self);
|
|
FHelpMenu.Caption := "帮助";
|
|
FHelpMenus := array();
|
|
for i,v in array("tsl语言帮助","关于") do
|
|
begin
|
|
vi := new TMenu(self);
|
|
vi.Caption := v;
|
|
vi.OnClick := thisfunction(HelpClick);
|
|
vi.Parent := FHelpMenu;
|
|
end
|
|
FHelpMenu.parent := m;
|
|
/////////////////////////////////
|
|
FEdter.TslCacheDir := FCache;
|
|
FEdter.TabWidth :=tbwidth;
|
|
FEdter.OnPageItemSelChanged := thisfunction(PageItemSelChanged);
|
|
FEdter.OnPageEditerChanged := thisfunction(PageEditerChanged);
|
|
FEdter.TslExe := tslexefile;
|
|
FEdter.align := alClient;
|
|
FEdter.FHistoryDir:= Fremotepath;
|
|
if importfile(ftstream(),"",FPathDirPath,dirs)=1 then
|
|
begin
|
|
FEdter.TslSearchDir := formatsearchdir(dirs);
|
|
end else
|
|
begin
|
|
fn := SysExecName();
|
|
fio := ioFileseparator();
|
|
for i:= length(fn) downto 1 do
|
|
begin
|
|
if fn[i]=fio then
|
|
begin
|
|
dirs := array(
|
|
fn[1:i]+"funcext"
|
|
);
|
|
break;
|
|
end
|
|
end
|
|
FEdter.TslSearchDir := dirs;
|
|
end
|
|
if ifarray(dirs) and dirs then FDirs := dirs;
|
|
if G_OpenHostory then
|
|
begin
|
|
if 1= importfile(ftstream(),"",FOpendpaths,opinfo) then
|
|
begin
|
|
if ifarray(opinfo) then
|
|
begin
|
|
for i,v in opinfo["pages"] do
|
|
begin
|
|
it := FEdter.OpenAndGoLineByName(v["filename"],v["r"]);
|
|
if it then
|
|
begin
|
|
ls := it.FEditer.Lines;
|
|
for j,vj in v["f2"] do
|
|
begin
|
|
if vj and ls[j]then ls[j].FMarked := true;
|
|
end
|
|
if v["isnewfile"] then it.fisnewfile := true;
|
|
end
|
|
end
|
|
if ifarray(opinfo["currentpage"]) then
|
|
begin
|
|
it := FEdter.OpenAndGotoFileByName( opinfo["currentpage"][0],opinfo["currentpage"][1]);
|
|
//if it then it.FEditer.SetFocus();
|
|
end
|
|
end
|
|
end
|
|
if 1= importfile(ftstream(),"",FHistoryPath,hist) then
|
|
begin
|
|
FEdter.SetHistoryFiles(hist);
|
|
end
|
|
if 1 = importfile(ftstream(),"",FFindhistroypath,fds) then
|
|
begin
|
|
FEdter.SetFindHistroy(fds);
|
|
end
|
|
if 1 = importfile(ftstream(),"",Fhighlightpath,fds) then
|
|
begin
|
|
FEdter.hltcolor := fds;
|
|
end
|
|
|
|
end
|
|
if 1=Importfile(ftstream(),"",FexefileCmds,cmds) then
|
|
begin
|
|
//echo "getok\r\n";
|
|
FEdter.FExecuteEditer.SetData(cmds);
|
|
end else
|
|
begin
|
|
FEdter.FExecuteEditer.SetData(array(
|
|
//"items":(("caption":"tsl","exe":format('"%s" "%s" -libpath "%s"',tslexefile,"$(FULL_CURRENT_PATH)","$(CURRENT_DIRECTORY)"+sp+";"))),
|
|
"items":(("caption":"tsl","exe":format('"%s" "%s" -libpath "%s"',"$(TSL_EXE)","$(FULL_CURRENT_PATH)","$(SEARCH_PATH)"))),
|
|
"itemindex":0
|
|
));
|
|
end
|
|
|
|
onclose := thisfunction(closemain);
|
|
FFileopen := new TOpenFileADlg(self);
|
|
FFileopen.Filter := array("执行文件":"*.exe");
|
|
FFileopen.parent := self;
|
|
formIcon := GetIcon();
|
|
FEdter.Visible := true;
|
|
|
|
FFormatInfoWnd := NEW tformatinfownd(self);
|
|
FFormatInfoWnd.Visible := false;
|
|
FFormatInfoWnd.WsDlgModalFrame := true;
|
|
FFormatInfoWnd.Parent := self;
|
|
FFormatInfoWnd.onclose := function(o,e)begin
|
|
e.skip := true;
|
|
o.Visible := false;
|
|
//o.EndModal();
|
|
|
|
end
|
|
FFormatInfoWnd.OnOkClicked := function(o,e)begin
|
|
//o.EndModal();
|
|
//o.show();
|
|
o.Visible := false;
|
|
d := o.GetData();
|
|
FEdter.SetCodeFormatInfo(d);
|
|
Exportfile(ftstream(),"",FFormatpath,d);
|
|
end
|
|
if 1=Importfile(ftstream(),"",FFormatpath,FMTDATA) then
|
|
begin
|
|
//echo "getok\r\n";
|
|
if ifarray(FMTDATA) then FEdter.SetCodeFormatInfo(FMTDATA);
|
|
FFormatInfoWnd.setdata(FMTDATA);
|
|
end
|
|
|
|
end
|
|
function HelpClick(o,e);
|
|
begin
|
|
case o.Caption of
|
|
"tsl语言帮助":
|
|
begin
|
|
return FEdter.ShowTslLangChm();
|
|
end
|
|
"关于":
|
|
begin
|
|
return messageboxa(static editerinfo(),"关于",0,self.Handle);
|
|
end
|
|
|
|
end
|
|
end
|
|
function PageItemSelChanged(o,it)
|
|
begin
|
|
if it then
|
|
begin
|
|
if it.fisnewfile then self.Caption := (it.FEditer.ChangedFlag?"*":"")+ " new ";
|
|
else
|
|
self.Caption := (it.FEditer.ChangedFlag?"*":"")+ it.OrigScriptPath;
|
|
end else
|
|
caption := "-tsl编辑器";
|
|
ModifyEnCodeMenu(it);
|
|
ModifySynMenu(it);
|
|
end
|
|
function PageEditerChanged(it,flg)
|
|
begin
|
|
cit := FEdter.GetCurrentItem();
|
|
if it=cit then
|
|
begin
|
|
if it.fisnewfile then self.Caption := (flg?"*":"")+ " new "//o.Caption;//it.ScriptPath+" -tsl编辑器";
|
|
else
|
|
self.Caption := (flg?"*":"")+ it.OrigScriptPath;//o.Caption;//it.ScriptPath+" -tsl编辑器";
|
|
ModifyEnCodeMenu(it);
|
|
end
|
|
else caption := "-tsl 编辑器";
|
|
end
|
|
function OpenInOtherWnd(o,e)
|
|
begin
|
|
it := FEdter.GetCurrentItem();
|
|
if not it then return ;
|
|
nph := it.OrigScriptPath;
|
|
it.FEditer.ReadOnly := True;
|
|
it := nil;
|
|
_wapi.WinExec(format('"%s" -f "%s" -h 0 -i 1',SysExecName(),nph),true);
|
|
end
|
|
Function SearDirMenuClick(o,e);
|
|
begin
|
|
FSearchDir.SetData(FDirs);
|
|
if FSearchDir.ShowModal() then
|
|
begin
|
|
ndirs :=FSearchDir.GetData();
|
|
if ndirs <> FDirs then
|
|
begin
|
|
FDirs := ndirs;
|
|
dd := array();
|
|
FEdter.TslSearchDir := formatsearchdir(FDirs);
|
|
Exportfile(ftstream(),"",FPathDirPath,ndirs);
|
|
end
|
|
end
|
|
end
|
|
function TabWidthClick(o,e);
|
|
begin
|
|
if o.Checked then return ;
|
|
for i,v in FMTabs do
|
|
begin
|
|
if v=o then
|
|
begin
|
|
v.Checked := true;
|
|
FEdter.TabWidth := i;
|
|
exportfile(ftstream(),"",FTabWidthpath,i);
|
|
end
|
|
else v.Checked := false;
|
|
end
|
|
|
|
end
|
|
function CloseAllPageItems();
|
|
begin
|
|
Cit := FEdter.GetCurrentItem();
|
|
its := FEdter.GetAllPageItems();
|
|
for i:= 0 to its.Length()-1 do
|
|
begin
|
|
it := its[i];
|
|
if it.FEditer.ChangedFlag then
|
|
begin
|
|
r := MessageBoxA("存在未保存的文件,是否保存!","提示",3,self) ;
|
|
if r = IDYES then
|
|
begin
|
|
FEdter.SaveAllPageItems();
|
|
break;
|
|
end else
|
|
if r = IDCANCEL then
|
|
begin
|
|
return ;
|
|
end
|
|
else
|
|
begin
|
|
|
|
end
|
|
break;
|
|
end
|
|
end
|
|
FEdter.CloseAllPageItems(Cit);
|
|
end
|
|
function closemain(o,e);
|
|
begin
|
|
if FCloseMenu.CHecked then
|
|
begin
|
|
e.skip := true;
|
|
show(SW_SHOWMINNOACTIVE);
|
|
return ;
|
|
end
|
|
fd := MessageBoxA('是否关闭编辑器','关闭',MB_YESNO,o);
|
|
if fd<>IDYES then return e.skip := true;
|
|
its := FEdter.GetAllPageItems();
|
|
for i:= 0 to its.Length()-1 do
|
|
begin
|
|
it := its[i];
|
|
if it.FEditer.ChangedFlag then
|
|
begin
|
|
r := MessageBoxA("存在未保存的文件,是否保存!","提示",3,self) ;
|
|
if r = IDYES then
|
|
begin
|
|
FEdter.SaveAllPageItems();
|
|
break;
|
|
end else
|
|
if r = IDCANCEL then
|
|
begin
|
|
e.skip := true;
|
|
return ;
|
|
end
|
|
else
|
|
begin
|
|
|
|
end
|
|
break;
|
|
end
|
|
end
|
|
|
|
d := FEdter.FExecuteEditer.GetData();
|
|
if d and ifarray(d) then
|
|
begin
|
|
exportfile(ftstream(),"",FexefileCmds,d);
|
|
end
|
|
d := FEdter.GetHistoryFiles();
|
|
if ifarray(d) and d then
|
|
begin
|
|
Exportfile(ftstream(),"",FHistoryPath,d);
|
|
end
|
|
d := FEdter.GetFindHistory();
|
|
if ifarray(d) and d then
|
|
begin
|
|
Exportfile(ftstream(),"",FFindhistroypath,d);
|
|
end
|
|
d := FEdter.hltcolor;
|
|
if ifarray(d) and d then
|
|
begin
|
|
Exportfile(ftstream(),"",Fhighlightpath,d);
|
|
end
|
|
global g_dotsavehistory;
|
|
if g_dotsavehistory then return ;
|
|
d := FEdter.GetAllPagesInfo();
|
|
if not ifarray(d) then d := array();
|
|
exportfile(ftstream(),"",FOpendpaths,d);
|
|
FEdter.CloseAllPageItems();
|
|
end
|
|
function clickRun(o,e);
|
|
begin
|
|
case o.caption of
|
|
"命令行配置":
|
|
begin
|
|
FEdter.ShowExeEditer();
|
|
end
|
|
"调试运行":
|
|
begin
|
|
FEdter.DebugPageItem(FEdter.GetCurrentItem());
|
|
end
|
|
"远程调试":
|
|
begin
|
|
FEdter.Debugremote(0);
|
|
end
|
|
"远程调试(waitattach)":
|
|
begin
|
|
FEdter.Debugremote(1);
|
|
end
|
|
"tsl函数目录":
|
|
begin
|
|
SearDirMenuClick(o,e);
|
|
end
|
|
end
|
|
end
|
|
function ClickSynMenu(o,e);
|
|
begin
|
|
it := FEdter.GetCurrentItem();
|
|
if not it then return ;
|
|
if o.Checked then return ;
|
|
FEdter.SetPageItemSyn(it,o.caption);
|
|
ModifySynMenu(it);
|
|
end
|
|
function ClickEnCodeMenu(o,e);
|
|
begin
|
|
it := FEdter.GetCurrentItem();
|
|
if not it then return ;
|
|
if o.Checked then return ;
|
|
case o.Caption of
|
|
"ANSI":
|
|
begin
|
|
it.CurrentcodeIsAnsi();
|
|
end
|
|
"UTF8":
|
|
begin
|
|
it.CurrentCodeIsUtf8();
|
|
end
|
|
"转为UCS2-big":
|
|
begin
|
|
it.ToUnicode_big();
|
|
end
|
|
"转为UCS2-little":
|
|
begin
|
|
it.ToUniocode_little();
|
|
end
|
|
"转为ANSI":
|
|
begin
|
|
it.ToANSI();
|
|
end
|
|
"转为UTF8":
|
|
begin
|
|
it.ToUtF8();
|
|
end
|
|
"转为UTF8 BOM":
|
|
begin
|
|
it.ToUtF8BOM();
|
|
end
|
|
end;
|
|
ModifyEnCodeMenu(it);
|
|
end
|
|
function OpenAndGotoFileByName(f,line);
|
|
begin
|
|
if f and ifstring(f) then
|
|
FEdter.OpenAndGotoFileByName(f,line);
|
|
end
|
|
function ModifyEnCodeMenu(it);
|
|
begin
|
|
if not it then return ;
|
|
bm := it.EnCode;
|
|
for i,v in FCodeMenus do
|
|
begin
|
|
if i>5 then break;
|
|
if v.Caption = bm then
|
|
begin
|
|
v.Checked := true;
|
|
end else
|
|
v.Checked := false;
|
|
end
|
|
end
|
|
function ModifySynMenu(it);
|
|
begin
|
|
if not it then return ;
|
|
bm := it.FSynType;
|
|
for i,v in FSynMenus do
|
|
begin
|
|
if v.Caption = bm then
|
|
begin
|
|
v.Checked := true;
|
|
end else
|
|
v.Checked := false;
|
|
end
|
|
end
|
|
private
|
|
function formatsearchdir(d);
|
|
begin
|
|
for i,v in d do
|
|
begin
|
|
if not ifarray(v) then return d;
|
|
if v["s"] then return v["d"];
|
|
end
|
|
return array();
|
|
end
|
|
protected
|
|
type TSerlogerSimpleWnd=class(tdcreateform)
|
|
uses tslvcl;
|
|
label1:tlabel;
|
|
furl:tedit;
|
|
label2:tlabel;
|
|
fport:tedit;
|
|
label3:tlabel;
|
|
fusr:tedit;
|
|
label4:tlabel;
|
|
fpwd:tpassword;
|
|
|
|
flogout:tbtn;
|
|
flogin:tbtn;
|
|
cancel_clk;
|
|
save_clk;
|
|
function Create(AOwner);override; //构造
|
|
begin
|
|
inherited;
|
|
Loader.LoadFromTfmScript(self,getinfo());
|
|
flogout.OnClick := function(o,e)begin
|
|
calldatafunction(cancel_clk,self,e);
|
|
end
|
|
flogin.OnClick := function(o,e)begin
|
|
calldatafunction(save_clk,self,e);
|
|
end
|
|
end
|
|
function setdata(d);
|
|
begin
|
|
if not ifarray(d) then return ;
|
|
furl.text := d["addr"];
|
|
fport.text := d["port"];
|
|
fusr.text := d["usr"];
|
|
fpwd.text := d["pwd"];
|
|
end
|
|
function getdata();
|
|
begin
|
|
r := array();
|
|
r["addr"] := furl.text;
|
|
r["port"] := fport.text;
|
|
r["usr"] := fusr.text;
|
|
r["pwd"] := fpwd.text;
|
|
return r;
|
|
end
|
|
function tserlogersimplewnd1_close(o;e);virtual;
|
|
begin
|
|
Visible := false;
|
|
e.skip := true;
|
|
|
|
end
|
|
function Recycling();override; //回收变量
|
|
begin
|
|
inherited;
|
|
ci := self.classinfo(); //将成员变量赋值为nil避免循环引用
|
|
for i,v in ci["members"] do
|
|
begin
|
|
if v["static"]then continue;
|
|
invoke(self,v["name"],nil);
|
|
end
|
|
end
|
|
private
|
|
function getinfo();
|
|
begin
|
|
return %%
|
|
object tserlogersimplewnd1:tserlogersimplewnd
|
|
caption="远程连接信息"
|
|
color=0xFFFFFF
|
|
height=211
|
|
minmaxbox=false
|
|
onclose=tserlogersimplewnd1_close
|
|
width=422
|
|
wsdlgmodalframe=true
|
|
wssizebox=true
|
|
object label1:tlabel
|
|
left=4
|
|
top=3
|
|
width=80
|
|
height=25
|
|
caption="服务器地址"
|
|
end
|
|
object furl:tedit
|
|
height=25
|
|
left=88
|
|
tabstop=true
|
|
top=3
|
|
width=204
|
|
end
|
|
object label2:tlabel
|
|
left=296
|
|
top=3
|
|
width=34
|
|
height=25
|
|
caption="端口"
|
|
end
|
|
object fport:tedit
|
|
height=25
|
|
left=333
|
|
tabstop=true
|
|
top=3
|
|
width=62
|
|
end
|
|
object label3:tlabel
|
|
left=2
|
|
top=38
|
|
width=80
|
|
height=25
|
|
caption=" 用户名"
|
|
end
|
|
object fusr:tedit
|
|
height=25
|
|
left=88
|
|
tabstop=true
|
|
top=38
|
|
width=244
|
|
end
|
|
object label4:tlabel
|
|
left=2
|
|
top=72
|
|
width=80
|
|
height=25
|
|
caption=" 密 码"
|
|
end
|
|
object fpwd:tpassword
|
|
height=25
|
|
left=88
|
|
tabstop=true
|
|
top=72
|
|
width=245
|
|
end
|
|
object flogout:tbtn
|
|
anchors=[akright akbottom]
|
|
caption="取消"
|
|
height=23
|
|
left=149
|
|
tabstop=true
|
|
top=130
|
|
width=74
|
|
end
|
|
object flogin:tbtn
|
|
anchors=[akright akbottom]
|
|
caption="保存"
|
|
height=23
|
|
left=259
|
|
tabstop=true
|
|
top=130
|
|
width=74
|
|
end
|
|
end
|
|
%%;
|
|
end
|
|
end
|
|
|
|
type TFormatInfoWnd=class(tvcform)
|
|
uses tslvcl;
|
|
label1:tlabel;
|
|
label2:tlabel;
|
|
label3:tlabel;
|
|
label4:tlabel;
|
|
label5:tlabel;
|
|
faligncmt:tcombobox;
|
|
fcharct:tcombobox;
|
|
farraytype:tcombobox;
|
|
fsyncheck:tcheckbtn;
|
|
fselectcheck:tcheckbtn;
|
|
btn1:tbtn;
|
|
function Create(AOwner);override;//构造
|
|
begin
|
|
inherited;
|
|
Loader.LoadFromTfmScript(self,GetWndInfo());
|
|
//WSSizebox := true;
|
|
end
|
|
function DoOKClick(o;e);virtual;
|
|
begin
|
|
calldatafunction(FOnOkClick,self,e);
|
|
end
|
|
function tformatinfownd1_close(o;e);virtual;
|
|
begin
|
|
e.skip := true;
|
|
o.Visible := false;
|
|
end
|
|
function DoControlAlign();override;//对齐子控件
|
|
begin
|
|
end
|
|
function Recycling();override;//回收变量
|
|
begin
|
|
inherited;
|
|
ci := self.classinfo();
|
|
//将成员变量赋值为nil避免循环引用
|
|
for i,v in ci["members"]do
|
|
begin
|
|
invoke(self,v["name"],nil);
|
|
end
|
|
end
|
|
function GetData();
|
|
begin
|
|
r := array();
|
|
r["cmt"]:= faligncmt.Checked;
|
|
r["arraytype"]:= array("普通":1,"默认":0,"宽松":3)[farraytype.getCurrentItemText()];
|
|
r["syn"]:= fsyncheck.checked;
|
|
r["sel"]:= fselectcheck.checked;
|
|
return r;
|
|
end
|
|
function SetData(d);
|
|
begin
|
|
//"50" "80" "100" "130"
|
|
// "50" "100" "130" "150" "200" "250" "300"
|
|
//"默认" "普通" "宽松"
|
|
if ifarray(d) then
|
|
begin
|
|
faligncmt.Checked := (d["cmt"]=1);
|
|
farraytype.ItemIndex := (array(0:0,1:1,3:2))[d["arraytype"]];
|
|
fsyncheck.Checked := d["syn"];
|
|
fselectcheck.Checked := d["sel"];
|
|
end
|
|
end
|
|
property OnOkClicked read FOnOkClick write FOnOkClick;
|
|
private
|
|
FOnOkClick;
|
|
function GetWndInfo();
|
|
begin
|
|
return %% object tformatinfownd1:tformatinfownd
|
|
caption="tsl代码格式化参数"
|
|
height=240
|
|
left=497
|
|
minmaxbox=false
|
|
onclose=tformatinfownd1_close
|
|
top=295
|
|
width=280
|
|
wssizebox=false
|
|
object label1:tlabel
|
|
left=16
|
|
top=19
|
|
width=92
|
|
height=25
|
|
caption="多行注释对齐"
|
|
end
|
|
object label3:tlabel
|
|
left=16
|
|
top=67
|
|
width=80
|
|
height=25
|
|
caption="array格式化"
|
|
end
|
|
object label4:tlabel
|
|
left=13
|
|
top=112
|
|
width=80
|
|
height=21
|
|
caption="语法检查"
|
|
end
|
|
object label5:tlabel
|
|
left=13
|
|
top=138
|
|
width=114
|
|
height=25
|
|
caption="格式化选择区域"
|
|
end
|
|
object faligncmt:tcheckbtn
|
|
height=22
|
|
left=113
|
|
top=19
|
|
width=22
|
|
caption =""
|
|
end
|
|
object farraytype:tcombobox
|
|
height=23
|
|
itemindex=1
|
|
items=["默认" "普通" "宽松" ]
|
|
left=103
|
|
top=67
|
|
width=143
|
|
end
|
|
object fsyncheck:tcheckbtn
|
|
caption=""
|
|
checked=true
|
|
height=22
|
|
left=124
|
|
top=109
|
|
width=22
|
|
end
|
|
object fselectcheck:tcheckbtn
|
|
caption=""
|
|
height=20
|
|
left=135
|
|
top=141
|
|
width=21
|
|
end
|
|
object btn1:tbtn
|
|
caption="确定"
|
|
height=31
|
|
left=154
|
|
onclick=dookclick
|
|
top=166
|
|
width=82
|
|
end
|
|
end%%;
|
|
end
|
|
end
|
|
type TBlockEditer = class(TPanel)
|
|
uses TSLVCL,UtslCodeEditor;
|
|
function Create(AOwner);override;
|
|
begin
|
|
inherited;
|
|
caption := "代码块编辑...";
|
|
FLabels := array();
|
|
for i,v in array("前缀","标题","值","附加值") do
|
|
begin
|
|
li := new TLabel(self);
|
|
li.caption := v;
|
|
FLabels[i] := li;
|
|
li.parent := self;
|
|
end
|
|
FEditers := array();
|
|
for i:= 0 to 1 do
|
|
begin
|
|
FEditers[i] := new TEdit(self);
|
|
FEditers[i].parent := self;
|
|
end
|
|
FChecked := new tcheckbtn(self);
|
|
FChecked.parent := self;
|
|
FBtn := new tbtn(self);
|
|
FBtn.caption := "确定";
|
|
FBtn.parent := self;
|
|
FCoder := new TFTSLScriptMemo(self);
|
|
FCoder.Completion := new unit(UTslSynMemo).TTSLCompletion(self);
|
|
FCoder.HighLighter := new unit(UTslSynMemo).TTslSynHighLighter(self);
|
|
FBtn.onclick := function(o,e)begin
|
|
|
|
calldatafunction(FBtnClick,self,e);
|
|
end
|
|
FCoder.parent := self;
|
|
end
|
|
function Recycling();override;
|
|
begin
|
|
inherited;
|
|
FChecked := nil;
|
|
FEditers:= nil;
|
|
FLabels := nil;
|
|
FBtn := nil;
|
|
FCoder := nil;
|
|
FBtnClick := nil;
|
|
end
|
|
function DoControlAlign();override;
|
|
begin
|
|
if FLabels and FEditers and FBtn and FCoder and FChecked then
|
|
begin
|
|
r := ClientRect;
|
|
lr := array(5,10,45,35);
|
|
FChecked.SetBoundsRect(array(52,10,72,30));
|
|
for i,v in FLabels do
|
|
begin
|
|
v.SetBoundsRect(lr);
|
|
lr[1]+=25;
|
|
lr[3]+=25;
|
|
end
|
|
w := r[2]-r[0];
|
|
lr := array(52,10+25,w-48,35+25);
|
|
for i,v in FEditers do
|
|
begin
|
|
v.SetBoundsRect(lr);
|
|
lr[1]+=25;
|
|
lr[3]+=25;
|
|
end
|
|
lr[3] := r[3]-35;
|
|
|
|
FCoder.SetBoundsRect(lr);
|
|
lr := array(lr[2]-100,lr[3]+5,lr[2],r[3]-5);
|
|
FBtn.SetBoundsRect(lr);
|
|
end
|
|
end
|
|
function GetData();
|
|
begin
|
|
return array(FChecked.checked,FEditers[0].text,FEditers[1].text,FCoder.text);
|
|
end
|
|
function SetData(d);
|
|
begin
|
|
if ifarray(d) then
|
|
begin
|
|
FCoder.ClearAll();
|
|
FCoder.PrepareCompletion();
|
|
FChecked.checked := d[0];
|
|
FEditers[0].text := d[1];
|
|
FEditers[1].text := d[2];
|
|
FCoder.text := d[3];
|
|
|
|
end
|
|
end
|
|
property BtnClick read FBtnClick write FBtnClick;
|
|
|
|
private
|
|
FBtnClick;
|
|
FChecked;
|
|
FEditers;
|
|
FLabels;
|
|
FBtn;
|
|
FCoder;
|
|
end
|
|
type TBlockManager=class(TVCForm)
|
|
uses TSLVCL;
|
|
function Create(AOwner);override;
|
|
begin
|
|
inherited;
|
|
Fbtns := array();
|
|
for i,v in array("保存","添加","删除")do
|
|
begin
|
|
bi := new tbtn(self);
|
|
bi.caption := v;
|
|
bi.onclick := thisfunction(btnlick);
|
|
Fbtns[i] := bi;
|
|
bi.parent := self;
|
|
end
|
|
FList := new TListView(self);
|
|
FList.Columns := array(("text":"前缀","width":40),("text":"名称","width":130),("text":"值","width":200),("text":"扩展","width":430));
|
|
FList.ColumnAsBool(0);
|
|
{
|
|
r := array();
|
|
r[0] := array("caption":"try..except","value":"try","valueext":"\r\nexcept\r\nend;");
|
|
r[1] := array("caption":"循环块","value":"for","valueext":"for i= to do\r\nbegin\r\nend","prefix":true);
|
|
r[2] := array("caption":"窗口类","value":"vclform","valueext":"type =class(tvcform)\r\n function create(AOwner);\r\n begin\r\n inherited;\r\n end\r\nend","prefix":true);
|
|
r[3] := array("caption":"窗口启动程序","value":"vclscript","valueext":"uses tslvcl;\r\napp := Initalizeapplication();\r\napp.createform(class(),fm);\r\nfm.show();\r\napp.run();","prefix":true);
|
|
SetData(r);
|
|
}
|
|
FList.parent := self;
|
|
FEditer := new TBlockEditer(self);
|
|
FEditer.SetBoundsRect(array(left+30,top+30,left+width-20,top+height-20));
|
|
FEditer.Visible := false;
|
|
FEditer.WsPopUp := true;
|
|
FEditer.WSsysMenu := true;
|
|
FEditer.parent := self;
|
|
FEditer.OnClose := function(o,e)begin
|
|
o.EndModal();
|
|
end
|
|
FEditer.BtnClick := function(o,e)begin
|
|
if FEditer.caption = "添加代码块..." then
|
|
begin
|
|
FList.appendItem(FEditer.GetData());
|
|
end else
|
|
begin
|
|
FList.SetItem(FList.SelectedId, FEditer.GetData());
|
|
end
|
|
FEditer.EndModal();
|
|
end
|
|
FList.OnDblClick :=function(o,e)begin
|
|
FEditer.caption := "修改代码块...";
|
|
FEditer.SetData(FList.SelectedValue);
|
|
FEditer.showmodal();
|
|
end
|
|
|
|
end
|
|
|
|
function DoControlAlign();override;
|
|
begin
|
|
if FList and FBtns then
|
|
begin
|
|
R := ClientRect;
|
|
R1 := R;
|
|
R1[3]-=30;
|
|
FList.SetBoundsRect(R1);
|
|
rc := R;
|
|
RC[1] := R[3]-28;
|
|
RC[3] := R[3]-2;
|
|
for i,v in Fbtns do
|
|
begin
|
|
rc1 := RC;
|
|
rc1[0] := R[2]-(I+1)*130;
|
|
rc1[2] := RC1[0]+95;
|
|
V.SetBoundsRect(rc1);
|
|
end
|
|
end
|
|
|
|
end
|
|
function btnlick(o,e);
|
|
begin
|
|
case o.caption of
|
|
"删除": FList.deleteselect();
|
|
"添加":
|
|
begin
|
|
FEditer.caption := "添加代码块...";
|
|
FEditer.SetData(array(0,"","",""));
|
|
FEditer.showmodal();
|
|
end
|
|
"保存":
|
|
begin
|
|
//echo tostn(FList.ListValues);
|
|
calldatafunction(FSaveClick,self,e);
|
|
end
|
|
|
|
end
|
|
end
|
|
function GetData();
|
|
begin
|
|
d := FList.ListValues;
|
|
r := array();
|
|
ri := 0;
|
|
for i,v in d do
|
|
begin
|
|
if v[1] and v[2] and v[3] then r[ri++] := array("prefix":v[0],"caption":v[1],"value":v[2],"valueext":v[3]);
|
|
end
|
|
r union2= array();
|
|
|
|
return r;
|
|
end
|
|
function SetData(d);
|
|
begin
|
|
FList.DeleteAllItems();
|
|
r := array();
|
|
idx := 0;
|
|
for i ,vv in d do
|
|
begin
|
|
if not ifarray(vv) then continue;
|
|
cp := vv["caption"];
|
|
if not(cp and ifstring(cp)) then continue;
|
|
v := vv["value"];
|
|
if not(v and ifstring(v)) then continue;
|
|
ve := vv["valueext"];
|
|
if not(ve and ifstring(ve)) then continue;
|
|
r[idx++] := array(vv["prefix"],cp,v,ve);
|
|
|
|
end
|
|
FList.appendItems(r);
|
|
end
|
|
property SaveClick read FSaveClick write FSaveClick;
|
|
function Recycling();override;
|
|
begin
|
|
inherited;
|
|
FSaveClick := FEditer := Fbtns := FList := nil;
|
|
end
|
|
private
|
|
FSaveClick;
|
|
FEditer;
|
|
Fbtns ;
|
|
FList;
|
|
end
|
|
type tsearchdir = class(TCustomControl)
|
|
uses tslvcl;
|
|
function Create(AOwner);override;
|
|
begin
|
|
inherited;
|
|
caption := "函数搜索目录:左侧为别名,右侧为-libpath目录....";
|
|
WsDlgModalFrame := true;
|
|
//WSSizebox := true;
|
|
visible := false;
|
|
wsPopUp := true;
|
|
WsSysMenu := true;
|
|
Fidx := -1;
|
|
FFolder := new TFolderChooseADlg(self);
|
|
FFolder.parent := self;
|
|
rc:=_wapi.GetScreenRect();
|
|
l:=(rc[2]-rc[0])/2-400;
|
|
t:=(rc[3]-rc[1])/2-300;
|
|
SetBoundsRect(array(l,t,545+l,310+t));
|
|
FLists := array();
|
|
FBtns := array();
|
|
for i,v in array(array(2,28,120,230),array(148,2,500,230)) do
|
|
begin
|
|
ls := new TListBox(self);
|
|
ls.SetBoundsRect(v);
|
|
ls.parent := self;
|
|
ls.Border := true;
|
|
FLists[i] := ls;
|
|
end
|
|
btrecs := array(
|
|
array(124,3,144,25),
|
|
array(124,206,144,230),
|
|
array(502,3,528,25),
|
|
array(502,206,528,230),
|
|
array(400,240,500,265)
|
|
);
|
|
btcolor := array(0x00c800,0x0000c8,0x00c800,0x0000c8,0);
|
|
btcolor := array();
|
|
for i,v in array("+","-","+","-","确定") do
|
|
begin
|
|
bt := new tbtn(self);
|
|
bt.caption := v;
|
|
bt.SetBoundsRect(btrecs[i]);
|
|
bt.parent := self;
|
|
bt.onclick := thisfunction(btnclick);
|
|
ci := btcolor[i];
|
|
if ci>0 then
|
|
bt.Color := ci;
|
|
FBtns[i] := bt;
|
|
end
|
|
/////////////////////////////////
|
|
FEdit := new tedit(self);
|
|
FEdit.SetBoundsRect(array(2,2,120,26));
|
|
FEdit.parent := self;
|
|
FEdit.onkeyup := thisfunction(editkeyup);
|
|
FEdit.placeholder := "查找or添加";
|
|
clean();
|
|
onclose := function(o,e)begin
|
|
e.skip := true;
|
|
o.endmodal(0);
|
|
end ;
|
|
end
|
|
function editkeyup(o,e);
|
|
begin
|
|
if e.CharCode = 13 then
|
|
begin
|
|
s := FEdit.text;
|
|
if not s then return ;
|
|
its := FLists[0].items;
|
|
for i,v in its do
|
|
begin
|
|
if s = v then
|
|
begin
|
|
FLists[0].setCurrentSelection(i);
|
|
return ;
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
function btnclick(o,e); //点击处理
|
|
begin
|
|
for i,v in FBtns do
|
|
begin
|
|
if v<>o then continue;
|
|
list0 := FLists[0];
|
|
list1 := FLists[1];
|
|
case i of
|
|
0: //添加
|
|
begin
|
|
S := FEdit.text;
|
|
if not s then return ;
|
|
|
|
its := list0.items;
|
|
if not(s in its) then
|
|
begin
|
|
List0.appenditem(s);
|
|
Farraya.push(array());
|
|
end
|
|
FEdit.text := "";
|
|
end
|
|
1:
|
|
begin
|
|
Farraya.splice(Fidx,1);
|
|
Fidx := -1;
|
|
FLists[1].items := array();
|
|
FLists[0].DeleteSelectedItems();
|
|
end
|
|
2: //删除
|
|
begin
|
|
if Fidx<0 then return ;
|
|
if FFolder.OpenDlg() then
|
|
begin
|
|
s := FFolder.Folder;
|
|
its := list1.items;
|
|
if not(s in its) then
|
|
begin
|
|
its union= array(s);
|
|
Farraya.splice(Fidx,1,its);
|
|
list1.appenditem(s);
|
|
end
|
|
end
|
|
end
|
|
3:
|
|
begin
|
|
if Fidx<0 then return ;
|
|
FLists[1].DeleteSelectedItems();
|
|
its := FLists[1].items;
|
|
Farraya.splice(Fidx,1,its);
|
|
end
|
|
4:
|
|
begin
|
|
calldatafunction(FOnsaveclick,self(true));
|
|
//echo tostn(GetData());
|
|
end
|
|
|
|
|
|
end ;
|
|
end
|
|
end
|
|
function listselchanged(o,e);
|
|
begin
|
|
if o = FLists[0] then
|
|
begin
|
|
Fidx := o.getCurrentSelection;
|
|
its := Farraya[Fidx];
|
|
FLists[1].items := its;
|
|
end
|
|
|
|
end
|
|
function GetData(); //获得数据
|
|
begin
|
|
r := array();
|
|
its := FLists[0].items;
|
|
for i,v in its do
|
|
begin
|
|
r[i,"n"] := v;
|
|
r[i,"d"] := Farraya[i];
|
|
if i=Fidx then r[i,"s"] := 1;
|
|
end
|
|
return r;
|
|
end
|
|
function SetData(d); //设置数据
|
|
begin
|
|
clean();
|
|
list0 := FLists[0];
|
|
formatdata(d);
|
|
for i,v in d do
|
|
begin
|
|
if ifarray(v) then
|
|
begin
|
|
list0.appenditem(v["n"]);
|
|
Farraya.push(v["d"]);
|
|
if v["s"] then list0.setCurrentSelection(i);
|
|
end
|
|
end
|
|
end
|
|
function clean();//清空
|
|
begin
|
|
Fidx := -1;
|
|
FEdit.text := "";
|
|
Farraya := new TMyArrayB();
|
|
for i,v in FLists do
|
|
begin
|
|
v.onSelectionChange := nil;
|
|
v.items := array();
|
|
v.onSelectionChange := thisfunction(listselchanged);
|
|
end
|
|
end
|
|
function Recycling();override;
|
|
begin
|
|
inherited;
|
|
FOnsaveclick := nil;
|
|
Farraya := nil;
|
|
FFolder := nil;
|
|
FLists := nil;
|
|
FBtns := nil;
|
|
end
|
|
property onsaveclick read FOnsaveclick write FOnsaveclick;
|
|
private
|
|
function formatdata(d);
|
|
begin
|
|
r := array();
|
|
for i,v in d do
|
|
begin
|
|
if not ifstring(v) then
|
|
begin
|
|
return ;
|
|
end
|
|
end
|
|
r := array((
|
|
"n":"default",
|
|
"d":d,
|
|
"s":1
|
|
)) ;
|
|
d := r;
|
|
end
|
|
FOnsaveclick;
|
|
Fidx;
|
|
FFolder;
|
|
Farraya;
|
|
FEdit;
|
|
FLists;
|
|
FBtns;
|
|
end
|
|
private
|
|
function GetIcon();
|
|
begin
|
|
r := "0502000000060400000074797065000203000000696D670006040000006461746
|
|
10002EA01000089504E470D0A1A0A0000000D4948445200000018000000180806
|
|
000000E0773DF8000000017352474200AECE1CE90000000467414D410000B18F0
|
|
BFC6105000000097048597300000EC300000EC301C76FA8640000017F49444154
|
|
484BCD944B4B02611885FB412DDBB4ED37740369D1C6F69110B5A89FD0A6562DA
|
|
4B21BB8C8F2921214840B4992C0109112BA58511048C55C4FF3CEF78DCE37CD94
|
|
CE2478E0C070E6F53CCEFBE90CA0C7EA23C0ED31101D049AF73CE84C22E0709C9
|
|
558BE5CE5370C95D658D628F0C0D0E9AC389F5FE637DA1201F661F2E70B2BC94C
|
|
3353665D9F2F02F59C384FB943DE80648865DBC3626ED92ADB1AFA99D9E40DB0D
|
|
6432BF132894A7D01F64718E42FD39C2F801FF727C06D2D969DB35D03E827FA9B
|
|
A8D03EEFEB09E8435E769B75A80FCE80DE416EFF01B2F329CE22BCA8ADFF03D0A
|
|
11B52A217D05215F39A147C45F4AAB84901AF1FD0725548A39BA6B57CDDAC0C06
|
|
488C016FD7D0AF1A90E78E208776A0A52B26400EC7CD4AFF806CD8D8C71754631
|
|
DD244ACF5CD95F934D4833294BD9259E91F505C815E7A845E7E823C136F01A4A9
|
|
5DE8C5075E1804504B403BA94159C840BF7B87341983B29485FEDCE4654C22A04
|
|
BD141CA912494F502D48D224F45050274A21E03806FF2C7CA7516022D7D000000
|
|
0049454E44AE42608200";
|
|
ico := new TIcon();
|
|
ico.ReadVcon(HexFormatStrToTsl(r));
|
|
return ico;
|
|
end
|
|
private
|
|
FLoger;
|
|
FFormatInfoWnd;
|
|
fBlockManager;
|
|
FCodeMenus;
|
|
FCloseMenu;
|
|
FSynMenus;
|
|
FCPB;
|
|
FMTabs;
|
|
FOpendpaths;
|
|
FTabWidthpath;
|
|
FFileopen;
|
|
FexefileCmds;
|
|
FCodeblockPath;
|
|
FHistoryPath;
|
|
FFindhistroypath;
|
|
FFormatpath;
|
|
Fremotepath;
|
|
Fhighlightpath;
|
|
FEdter;
|
|
FSearchDir;
|
|
FCache;
|
|
FPathDirPath;
|
|
FDirs;
|
|
Fexefilepath;
|
|
/////////////////actions
|
|
FExeaction;
|
|
|
|
end
|