parent
0a6d53d7bd
commit
faf5a8aaa5
|
|
@ -1,5 +1,50 @@
|
|||
type teditorform = class(TVCform) //编辑器主窗口
|
||||
uses utslvclauxiliary,tslvcl,UTslSynMemo,UtslCodeEditor;
|
||||
const c_e_ansi = "ANSI";
|
||||
const c_e_utf8 = "UTF8";
|
||||
const c_e_utf8bom = "UTF8 BOM";
|
||||
const c_e_ucs2big = "UCS2-big";
|
||||
const c_e_ucs2little = "UCS2-little";
|
||||
const c_e_separator = "----";
|
||||
const c_e_to_ansi = "转为ANSI";
|
||||
const c_e_to_utf8 = "转为UTF8";
|
||||
const c_e_to_utf8bom = "转为UTF8 BOM";
|
||||
const c_e_to_ucs2big = "转为UCS2-big";
|
||||
const c_e_to_ucs2little="转为UCS2-little";
|
||||
const c_m_cmd_config="命令行配置";
|
||||
const c_m_debuger = "调试器";
|
||||
const c_m_tsl_dir = "tsl函数目录";
|
||||
const c_m_exec = "执行";
|
||||
const c_m_exec_debug = "调试运行";
|
||||
const c_m_remote_debug = "远程调试";
|
||||
const c_m_remote_debug_wait="远程调试(waitattach)";
|
||||
const c_m_compile="编译当前脚本";
|
||||
const c_m_window = "窗口";
|
||||
const c_m_logwindow = "日志窗口..";
|
||||
const c_m_dir = "目录";
|
||||
const c_m_encode = "编码";
|
||||
const c_m_open = "打开";
|
||||
const c_m_new = "新建";
|
||||
const c_m_open_other="其他窗口打开";
|
||||
const c_m_open_history = "打开历史";
|
||||
const c_m_lang_config = "语言设置";
|
||||
const c_m_tsl_style_config="tsl代码格式设置";
|
||||
const c_m_tsl_block = "tsl代码块设置";
|
||||
const c_m_config = "设置";
|
||||
const c_m_block_mgr = "代码块管理";
|
||||
const c_m_exec_config= "tsl执行设置";
|
||||
const c_m_file = "文件";
|
||||
const c_m_edit_color = "编辑器颜色";
|
||||
const c_m_tab_config = "tab设置:";
|
||||
const c_m_blank = "空格";
|
||||
const c_m_close_min = "关闭时最小化";
|
||||
const c_m_lang = "语言";
|
||||
const c_m_run = "运行";
|
||||
const c_m_editor = "编辑器";
|
||||
const c_m_exer = "当前执行程序";
|
||||
const c_m_help = "帮助";
|
||||
const c_m_tsl_help = "tsl语言帮助";
|
||||
const c_m_about = "关于";
|
||||
function WMACTIVATE(o,e):WM_ACTIVATE;override; //激活
|
||||
begin
|
||||
inherited;
|
||||
|
|
@ -78,15 +123,15 @@ type teditorform = class(TVCform) //
|
|||
m := new TMainMenu(self);
|
||||
//////////////////////////////////////////////
|
||||
FmTool := new TMenu(self);
|
||||
FmTool.Caption := "窗口";
|
||||
FmTool.Caption := c_m_window;
|
||||
fmglobsearch := new TMenu(self);
|
||||
fmglobsearch.caption := "日志窗口..";
|
||||
fmglobsearch.caption := c_m_logwindow;
|
||||
fmglobsearch.OnClick := function(o,e)
|
||||
begin
|
||||
FEDter.SwitchLogWnd();
|
||||
end
|
||||
fmglobdir := new TMenu(self);
|
||||
fmglobdir.caption := "目录";
|
||||
fmglobdir.caption := c_m_dir;
|
||||
fmglobdir.onclick := function(o,e)
|
||||
begin
|
||||
v := not(Fdirview.Visible);
|
||||
|
|
@ -97,16 +142,16 @@ type teditorform = class(TVCform) //
|
|||
|
||||
///////////////////////////////////////////////////////
|
||||
FEnCodeMenu := new TMenu(self);
|
||||
FEnCodeMenu.Caption := "编码";
|
||||
FEnCodeMenu.Caption := c_m_encode;
|
||||
FCodeMenus := array();
|
||||
for i,v in array("ANSI","UTF8","UTF8 BOM","UCS2-big","UCS2-little","----","转为ANSI","转为UTF8","转为UTF8 BOM","转为UCS2-big","转为UCS2-little") do
|
||||
for i,v in array(c_e_ansi,c_e_utf8,c_e_utf8bom,c_e_ucs2big,c_e_ucs2little,c_e_separator,c_e_to_ansi,c_e_to_utf8,c_e_to_utf8bom,c_e_to_ucs2big,c_e_to_ucs2little) do
|
||||
begin
|
||||
it := new TMenu(self);
|
||||
it.Caption := v;
|
||||
FCodeMenus[i] := it;
|
||||
if v="----" then it.TSeparator := true;
|
||||
if v=c_e_separator then it.TSeparator := true;
|
||||
else
|
||||
if v in array("UCS2-big","UCS2-little","UTF8 BOM") then
|
||||
if v in array(c_e_ucs2big,c_e_ucs2little,c_e_utf8bom) then
|
||||
begin
|
||||
it.Enabled := false;
|
||||
end else
|
||||
|
|
@ -119,7 +164,7 @@ type teditorform = class(TVCform) //
|
|||
Fmopen := new TMenu(self);
|
||||
newaction := new TAction(self);
|
||||
NewAction.ShortCut := "ctrl+O";
|
||||
NewAction.caption := "打开";
|
||||
NewAction.caption := c_m_open;
|
||||
NewAction.onexecute := function(o,e)
|
||||
begin
|
||||
return FEdter.OpenAfile();
|
||||
|
|
@ -130,39 +175,39 @@ type teditorform = class(TVCform) //
|
|||
Fmnew:= new TMenu(self);
|
||||
newaction := new TAction(self);
|
||||
NewAction.ShortCut := "ctrl+N";
|
||||
NewAction.caption := "新建";
|
||||
NewAction.caption := c_m_new;
|
||||
NewAction.onexecute := function(o,e)
|
||||
begin
|
||||
return FEdter.CreateAfile();
|
||||
end
|
||||
Fmnew.action := NewAction;
|
||||
FOpenOther := new TMenu(self);
|
||||
FOpenOther.Caption := "其他窗口打开";
|
||||
FOpenOther.Caption := c_m_open_other;
|
||||
FOpenOther.OnClick := thisfunction(OpenInOtherWnd) ;
|
||||
FOpenHistoryMenu := new TMenu(self);
|
||||
FOpenHistoryMenu.caption := "打开历史";
|
||||
FOpenHistoryMenu.caption := c_m_open_history;
|
||||
FOpenHistoryMenu.OnClick := function(o,e)begin
|
||||
FEdter.ShowHistoryWnd();
|
||||
end
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
FTslLangMenu := new tmenu(self);
|
||||
FTslLangMenu.Caption := "语言设置";
|
||||
FTslLangMenu.Caption := c_m_lang_config;
|
||||
|
||||
FTslFormatMenu := new tmenu(self);
|
||||
FTslFormatMenu.Caption := "tsl代码格式设置";
|
||||
FTslFormatMenu.Caption := c_m_tsl_style_config;
|
||||
FTslFormatMenu.OnClick := function(o,e)begin
|
||||
FFormatInfoWnd.show();
|
||||
end
|
||||
FCodeBlockMenu := new TMenu(self);
|
||||
FCodeBlockMenu.caption := "tsl代码块设置";
|
||||
FCodeBlockMenu.caption := c_m_tsl_block;
|
||||
FCodeBlockMenu.OnClick := function(o,e)begin
|
||||
fBlockManager.ShowModal();
|
||||
|
||||
end
|
||||
|
||||
FMenuSet := new TMenu(self);
|
||||
FMenuSet.caption := "设置";
|
||||
FMenuSet.caption := c_m_config;
|
||||
fmtslexepath := new TMenu(self);
|
||||
if 1=importfile(ftstream(),"",Fexefilepath,tslexefile) then
|
||||
begin
|
||||
|
|
@ -186,7 +231,7 @@ type teditorform = class(TVCform) //
|
|||
end
|
||||
fBlockManager := new TBlockManager(self);
|
||||
fBlockManager.WsDlgModalFrame := true;
|
||||
fBlockManager.caption := "代码块管理";
|
||||
fBlockManager.caption := c_m_block_mgr;
|
||||
fBlockManager.minmaxbox := false;
|
||||
fBlockManager.Visible := false;
|
||||
fBlockManager.Parent := self;
|
||||
|
|
@ -213,9 +258,9 @@ type teditorform = class(TVCform) //
|
|||
end
|
||||
/////////////////////////////////////////
|
||||
////////////////////////////////////////////////
|
||||
fmtslexepath.caption :="tsl执行设置";
|
||||
fmtslexepath.caption :=c_m_exec_config;
|
||||
fmfile := new TMenu(self);
|
||||
fmfile.caption := "文件";
|
||||
fmfile.caption := c_m_file;
|
||||
fmfile.parent := m;
|
||||
FMenuSet.parent := m;
|
||||
Fmopen.parent := fmfile;
|
||||
|
|
@ -232,15 +277,15 @@ type teditorform = class(TVCform) //
|
|||
end
|
||||
FMTabContain :=new TMenu(self);
|
||||
fmshowhltediter :=new TMenu(self);
|
||||
fmshowhltediter.caption := "编辑器颜色";
|
||||
fmshowhltediter.caption := c_m_edit_color;
|
||||
FMTabs := array();
|
||||
FMTabContain.Caption := "tab设置:";
|
||||
FMTabContain.Caption := c_m_tab_config;
|
||||
for i:= 0 to 6 do
|
||||
begin
|
||||
tm := new TMenu(self);
|
||||
if i=0 then tm.Caption := "\\t";
|
||||
else
|
||||
tm.Caption := inttostr(i)+"空格";
|
||||
tm.Caption := inttostr(i)+c_m_blank;
|
||||
if tbwidth=i then tm.Checked := true;
|
||||
tm.Onclick := thisfunction(TabWidthClick);
|
||||
FMTabs[i] := tm;
|
||||
|
|
@ -269,7 +314,7 @@ type teditorform = class(TVCform) //
|
|||
end
|
||||
|
||||
FCloseMenu := new tmenu(self);
|
||||
FCloseMenu.Caption:="关闭时最小化";
|
||||
FCloseMenu.Caption:=c_m_close_min;
|
||||
//FCloseMenu.Checked := true;
|
||||
FCloseMenu.parent := FMenuSet;
|
||||
FCloseMenu.OnClick := function(o,e)
|
||||
|
|
@ -296,7 +341,7 @@ type teditorform = class(TVCform) //
|
|||
|
||||
//语言按钮
|
||||
FSynMenu := New TMenu(self);
|
||||
FSynMenu.Caption := "语言";
|
||||
FSynMenu.Caption := c_m_lang;
|
||||
FSynMenus := array();
|
||||
for i,v in FEdter.GetSynTypeNames() do
|
||||
begin
|
||||
|
|
@ -309,30 +354,30 @@ type teditorform = class(TVCform) //
|
|||
FSynMenu.Parent := m;
|
||||
|
||||
FRunMenu := new TMenu(self);
|
||||
FRunMenu.caption := "运行";
|
||||
FRunMenu.caption := c_m_run;
|
||||
FExeaction := new TAction(self);
|
||||
FExeaction.caption := "执行";
|
||||
FExeaction.caption := c_m_exec;
|
||||
FExeaction.ShortCut := "F9";
|
||||
FExeaction.onexecute := function(o,e)
|
||||
begin
|
||||
FEdter.ExecutePageItem(FEdter.GetCurrentItem());
|
||||
end
|
||||
for i,v in array("命令行配置","调试器","tsl函数目录","执行","调试运行","远程调试","远程调试(waitattach)","编译当前脚本") do
|
||||
for i,v in array(c_m_cmd_config,c_m_debuger,c_m_tsl_dir,c_m_exec,c_m_exec_debug,c_m_remote_debug,c_m_remote_debug_wait,c_m_compile) do
|
||||
begin
|
||||
it := new TMenu(self);
|
||||
if v = "执行" then
|
||||
if v = c_m_exec then
|
||||
begin
|
||||
it.Action := FExeaction;
|
||||
end
|
||||
if v="调试器" then
|
||||
if v=c_m_debuger then
|
||||
begin
|
||||
it.caption := v;
|
||||
ite := new TMenu(self);
|
||||
ite.caption := "编辑器";
|
||||
ite.caption := c_m_editor;
|
||||
ite.Checked := true;
|
||||
ite.Parent := it;
|
||||
itb := new TMenu(self);
|
||||
itb.caption := "当前执行程序";
|
||||
itb.caption := c_m_exer;
|
||||
itb.Parent := it;
|
||||
itb._tag := ite;
|
||||
ite._tag := itb;
|
||||
|
|
@ -356,9 +401,9 @@ type teditorform = class(TVCform) //
|
|||
FEdter.Parent := self;
|
||||
//////////////////////////////////////////////////
|
||||
FHelpMenu := new TMenu(self);
|
||||
FHelpMenu.Caption := "帮助";
|
||||
FHelpMenu.Caption := c_m_help;
|
||||
FHelpMenus := array();
|
||||
for i,v in array("tsl语言帮助","关于") do
|
||||
for i,v in array(c_m_tsl_help,c_m_about) do
|
||||
begin
|
||||
vi := new TMenu(self);
|
||||
vi.Caption := v;
|
||||
|
|
@ -494,13 +539,13 @@ type teditorform = class(TVCform) //
|
|||
function HelpClick(o,e);
|
||||
begin
|
||||
case o.Caption of
|
||||
"tsl语言帮助":
|
||||
c_m_tsl_help:
|
||||
begin
|
||||
return FEdter.ShowTslLangChm();
|
||||
end
|
||||
"关于":
|
||||
c_m_about:
|
||||
begin
|
||||
return messageboxa(static editerinfo(),"关于",0,self.Handle);
|
||||
return messageboxa(static editerinfo(),c_m_about,0,self.Handle);
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -671,27 +716,27 @@ type teditorform = class(TVCform) //
|
|||
function clickRun(o,e);
|
||||
begin
|
||||
case o.caption of
|
||||
"编译当前脚本":
|
||||
c_m_compile:
|
||||
begin
|
||||
FEdter.buildpageitem(FEdter.GetCurrentItem());
|
||||
end
|
||||
"命令行配置":
|
||||
c_m_cmd_config:
|
||||
begin
|
||||
FEdter.ShowExeEditer();
|
||||
end
|
||||
"调试运行":
|
||||
c_m_exec_debug:
|
||||
begin
|
||||
FEdter.DebugPageItem(FEdter.GetCurrentItem());
|
||||
end
|
||||
"远程调试":
|
||||
c_m_remote_debug:
|
||||
begin
|
||||
FEdter.Debugremote(0);
|
||||
end
|
||||
"远程调试(waitattach)":
|
||||
c_m_remote_debug_wait:
|
||||
begin
|
||||
FEdter.Debugremote(1);
|
||||
end
|
||||
"tsl函数目录":
|
||||
c_m_tsl_dir:
|
||||
begin
|
||||
SearDirMenuClick(o,e);
|
||||
end
|
||||
|
|
@ -711,31 +756,31 @@ type teditorform = class(TVCform) //
|
|||
if not it then return ;
|
||||
if o.Checked then return ;
|
||||
case o.Caption of
|
||||
"ANSI":
|
||||
c_e_ansi:
|
||||
begin
|
||||
it.CurrentcodeIsAnsi();
|
||||
end
|
||||
"UTF8":
|
||||
c_e_utf8:
|
||||
begin
|
||||
it.CurrentCodeIsUtf8();
|
||||
end
|
||||
"转为UCS2-big":
|
||||
c_e_to_ucs2big:
|
||||
begin
|
||||
it.ToUnicode_big();
|
||||
end
|
||||
"转为UCS2-little":
|
||||
c_e_to_ucs2little:
|
||||
begin
|
||||
it.ToUniocode_little();
|
||||
end
|
||||
"转为ANSI":
|
||||
c_e_to_ansi:
|
||||
begin
|
||||
it.ToANSI();
|
||||
end
|
||||
"转为UTF8":
|
||||
c_e_to_utf8:
|
||||
begin
|
||||
it.ToUtF8();
|
||||
end
|
||||
"转为UTF8 BOM":
|
||||
c_e_to_utf8bom:
|
||||
begin
|
||||
it.ToUtF8BOM();
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue