From c9a3ae3b7e6c96563b43135b1c39a9393240652e Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Thu, 23 Jun 2016 23:11:49 +0200 Subject: [PATCH] add support for the new DUB runnable modules, close #74 --- src/ce_main.lfm | 69 +++++++++++++++++++++++++++++++++++++++++++++++-- src/ce_main.pas | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 2 deletions(-) diff --git a/src/ce_main.lfm b/src/ce_main.lfm index f025c0bc..5500acdc 100644 --- a/src/ce_main.lfm +++ b/src/ce_main.lfm @@ -2224,6 +2224,15 @@ object CEMainForm: TCEMainForm FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 } end + object MenuItem91: TMenuItem + Caption = '-' + end + object MenuItem92: TMenuItem + Action = actFileRunDub + end + object MenuItem94: TMenuItem + Action = actFileRunDubOut + end object MenuItem59: TMenuItem Caption = '-' end @@ -4064,6 +4073,15 @@ object CEMainForm: TCEMainForm FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 } end + object MenuItem95: TMenuItem + Caption = '-' + end + object MenuItem93: TMenuItem + Action = actFileRunDub + end + object MenuItem96: TMenuItem + Action = actFileRunDubOut + end object MenuItem10: TMenuItem Caption = '-' end @@ -4356,6 +4374,7 @@ object CEMainForm: TCEMainForm Images = imgList OnUpdate = ActionsUpdate left = 32 + top = 1 object actEdCopy: TAction Category = 'Edit' Caption = 'Copy' @@ -4744,11 +4763,25 @@ object CEMainForm: TCEMainForm ImageIndex = 21 OnExecute = actProjGroupCompileExecute end + object actFileRunDub: TAction + Category = 'File' + Caption = 'DUB single file package' + ImageIndex = 36 + OnExecute = actFileRunDubExecute + OnUpdate = updateDocumentBasedAction + end + object actFileRunDubOut: TAction + Category = 'File' + Caption = 'DUB single file package outside' + ImageIndex = 36 + OnExecute = actFileRunDubOutExecute + OnUpdate = updateDocumentBasedAction + end end object imgList: TImageList left = 64 Bitmap = { - 4C69240000001000000010000000008F4E00008C4AB000965DFF00935AFF0093 + 4C69250000001000000010000000008F4E00008C4AB000965DFF00935AFF0093 59FF009359FF009359FF009359FF009359FF00945AFF008743FF008945FF008A 49A8FFFFFF00008F4E00008F4F00008E4E00008A47FF66E2D0FF62DDCAFF62DD C8FF62DDC8FF62DDC8FF62DDC8FF62DDC8FF62DDC9FF61E0CAFF62DEC8FF3ABA @@ -5900,7 +5933,39 @@ object CEMainForm: TCEMainForm AD002177AC00000000332270B3FF00000033008A48FF008A4AFF00000033008E 4E00008D4D0000A3620000A16000000000000000000000000000000000000000 0000000000000000000000000033000000000000003300000033000000000000 - 0000000000000000000000000000 + 0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00000000010000000100000001FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000001000000010000 + 0001FFFFFF00FFFFFF00FFFFFF000000002A000000BA000000BA000000B90000 + 00900000001AFFFFFF00FFFFFF00FFFFFF000000004B000000BA000000BA0000 + 00BA000000AD0000003A000000010000003C000000FF000000A20000009A0000 + 00DF000000D70000000CFFFFFF00FFFFFF0000000069000000F40000009A0000 + 0098000000C3000000EE000000120000003C000000FF00000018FFFFFF000000 + 001F000000F900000052FFFFFF0000007F0A0000076E000000E4000000070000 + 00020000002F000000FF000000350000003C000000FF00000018FFFFFF000000 + 0006000000E5000000690000AA420000B47300002E8B000000E50000009D0000 + 00C5000000E3000000DA000000090000003C000000FF00000018FFFFFF000000 + 0005000000E400002A8C0000BEE70000C2CD00002384000000E5000000750000 + 0092000000C4000000E80000000E0000003C000000FF00000018FFFFFF000000 + 0012000000D000000FA80000C8980000CF8500000BA4000000CB00000003FFFF + FF0000000027000000FF000000350000003C000000FF000000A20000009A0000 + 00DD0000009E000000FB000001B6000001B6000000FC00000093000000980000 + 0098000000C9000000E80000000F0000002A000000BA000000BA000000BA0000 + 00910000001A00000046000000AA000000AC0000005E000000A4000000BA0000 + 00BA000000A50000003000000001FFFFFF00000000010000000100000001FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0000000001000000010000 + 0001FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00 } end object ApplicationProperties1: TApplicationProperties diff --git a/src/ce_main.pas b/src/ce_main.pas index 2da88d8c..2e9e59c5 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -48,6 +48,8 @@ type actFileRun: TAction; actFileDscanner: TAction; actFileRunOut: TAction; + actFileRunDub: TAction; + actFileRunDubOut: TAction; actProjGroupCompile: TAction; actProjSelUngrouped: TAction; actProjAddToGroup: TAction; @@ -169,6 +171,12 @@ type MenuItem88: TMenuItem; MenuItem89: TMenuItem; MenuItem90: TMenuItem; + MenuItem91: TMenuItem; + MenuItem92: TMenuItem; + MenuItem93: TMenuItem; + MenuItem94: TMenuItem; + MenuItem95: TMenuItem; + MenuItem96: TMenuItem; mnuLayout: TMenuItem; mnuItemMruFile: TMenuItem; mnuItemMruProj: TMenuItem; @@ -181,6 +189,8 @@ type MenuItem9: TMenuItem; procedure actFileCompileExecute(Sender: TObject); procedure actFileDscannerExecute(Sender: TObject); + procedure actFileRunDubExecute(Sender: TObject); + procedure actFileRunDubOutExecute(Sender: TObject); procedure actFileRunExecute(Sender: TObject); procedure actFileRunOutExecute(Sender: TObject); procedure actFileSaveCopyAsExecute(Sender: TObject); @@ -353,6 +363,7 @@ type procedure executeRunnable(unittest: boolean = false; redirect: boolean = true; const runArgs: string = ''); procedure runFile(outside: boolean); + procedure dubFile(outside: boolean); // file sub routines procedure newFile; @@ -2420,6 +2431,46 @@ begin end; end; +procedure TCEMainForm.actFileRunDubExecute(Sender: TObject); +begin + dubFile(false); +end; + +procedure TCEMainForm.actFileRunDubOutExecute(Sender: TObject); +begin + dubFile(true); +end; + +procedure TCEMainForm.dubFile(outside: boolean); +begin + if fDoc = nil then + exit; + FreeRunnableProc; + fRunProc := TCEProcess.Create(nil); + if fDoc.fileName.fileExists then + fDoc.save + else + fDoc.saveTempFile; + fRunProc.Executable:= exeFullName('dub' + exeExt); + fRunProc.Parameters.Add(fDoc.fileName); + fRunProc.Execute; + if not outside then + begin + fRunProc.Options := [poStderrToOutPut, poUsePipes]; + fRunProc.ShowWindow := swoHIDE; + fRunProc.OnReadData := @asyncprocOutput; + fRunProc.OnTerminate:= @asyncprocTerminate; + getprocInputHandler.addProcess(fRunProc); + end + else + begin + {$IFNDEF WINDOWS} + fRunProc.Options := fRunProc.Options + [poNewConsole]; + {$ENDIF} + end; + fRunProc.execute; +end; + procedure TCEMainForm.runFile(outside: boolean); var fname: string;