add an action to create a new DUB script, close #81

This commit is contained in:
Basile Burg 2016-07-01 05:15:07 +02:00
parent 7eac3f0305
commit cec04e6b2a
2 changed files with 27 additions and 0 deletions

View File

@ -1551,6 +1551,9 @@ object CEMainForm: TCEMainForm
07FFB47A07FFB47A08FFB57C0AFFB67F0FFFB88114FFBA851B23
}
end
object MenuItem97: TMenuItem
Action = actFileNewDubScript
end
object MenuItem2: TMenuItem
Action = actFileOpen
Bitmap.Data = {
@ -4921,6 +4924,12 @@ object CEMainForm: TCEMainForm
OnExecute = actFileRunDubOutExecute
OnUpdate = updateDocumentBasedAction
end
object actFileNewDubScript: TAction
Category = 'File'
Caption = 'New DUB script'
ImageIndex = 36
OnExecute = actFileNewDubScriptExecute
end
end
object imgList: TImageList
left = 64

View File

@ -50,6 +50,7 @@ type
actFileRunOut: TAction;
actFileRunDub: TAction;
actFileRunDubOut: TAction;
actFileNewDubScript: TAction;
actProjGroupCompile: TAction;
actProjSelUngrouped: TAction;
actProjAddToGroup: TAction;
@ -177,6 +178,7 @@ type
MenuItem94: TMenuItem;
MenuItem95: TMenuItem;
MenuItem96: TMenuItem;
MenuItem97: TMenuItem;
mnuLayout: TMenuItem;
mnuItemMruFile: TMenuItem;
mnuItemMruProj: TMenuItem;
@ -189,6 +191,7 @@ type
MenuItem9: TMenuItem;
procedure actFileCompileExecute(Sender: TObject);
procedure actFileDscannerExecute(Sender: TObject);
procedure actFileNewDubScriptExecute(Sender: TObject);
procedure actFileRunDubExecute(Sender: TObject);
procedure actFileRunDubOutExecute(Sender: TObject);
procedure actFileRunExecute(Sender: TObject);
@ -2462,6 +2465,21 @@ begin
end;
end;
procedure TCEMainForm.actFileNewDubScriptExecute(Sender: TObject);
begin
newFile;
fDoc.Text :=
'/+ dub.sdl:' + LineEnding +
' name "dub_script" +/' + LineEnding +
'module dub_script;' + LineEnding +
LineEnding +
'import std.stdio;' + LineEnding +
LineEnding +
'void main(string[] args)' + LineEnding +
'{' + LineEnding + '}';
fDoc.setFocus;
end;
procedure TCEMainForm.actFileRunDubExecute(Sender: TObject);
begin
dubFile(false);