mirror of https://gitlab.com/basile.b/dexed.git
added file action compile file and run outside
like runnable moduled but when redirection of the output is not wanted
This commit is contained in:
parent
ee091c7578
commit
912749c45c
|
@ -494,6 +494,9 @@ object CEMainForm: TCEMainForm
|
||||||
07FFB47A07FFB47A08FFB57C0AFFB67F0FFFB88114FFBA851B23
|
07FFB47A07FFB47A08FFB57C0AFFB67F0FFFB88114FFBA851B23
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
object MenuItem65: TMenuItem
|
||||||
|
Action = actFileCompileAndRunOut
|
||||||
|
end
|
||||||
object MenuItem63: TMenuItem
|
object MenuItem63: TMenuItem
|
||||||
Action = actFileUnittest
|
Action = actFileUnittest
|
||||||
Bitmap.Data = {
|
Bitmap.Data = {
|
||||||
|
@ -1701,6 +1704,9 @@ object CEMainForm: TCEMainForm
|
||||||
07FFB47A07FFB47A08FFB57C0AFFB67F0FFFB88114FFBA851B23
|
07FFB47A07FFB47A08FFB57C0AFFB67F0FFFB88114FFBA851B23
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
object MenuItem66: TMenuItem
|
||||||
|
Action = actFileCompileAndRunOut
|
||||||
|
end
|
||||||
object MenuItem64: TMenuItem
|
object MenuItem64: TMenuItem
|
||||||
Action = actFileUnittest
|
Action = actFileUnittest
|
||||||
Bitmap.Data = {
|
Bitmap.Data = {
|
||||||
|
@ -1990,6 +1996,7 @@ object CEMainForm: TCEMainForm
|
||||||
Images = imgList
|
Images = imgList
|
||||||
OnUpdate = ActionsUpdate
|
OnUpdate = ActionsUpdate
|
||||||
left = 32
|
left = 32
|
||||||
|
top = 1
|
||||||
object actEdCopy: TAction
|
object actEdCopy: TAction
|
||||||
Category = 'Edit'
|
Category = 'Edit'
|
||||||
Caption = 'Copy'
|
Caption = 'Copy'
|
||||||
|
@ -2082,31 +2089,11 @@ object CEMainForm: TCEMainForm
|
||||||
end
|
end
|
||||||
object actFileCompAndRun: TAction
|
object actFileCompAndRun: TAction
|
||||||
Category = 'File'
|
Category = 'File'
|
||||||
Caption = 'Compile and run file'
|
Caption = 'Compile file and run'
|
||||||
ImageIndex = 22
|
ImageIndex = 22
|
||||||
OnExecute = actFileCompAndRunExecute
|
OnExecute = actFileCompAndRunExecute
|
||||||
ShortCut = 16503
|
ShortCut = 16503
|
||||||
end
|
end
|
||||||
object ActFileCompAndRunWithArgs: TAction
|
|
||||||
Category = 'File'
|
|
||||||
Caption = 'Compile and run file...'
|
|
||||||
ImageIndex = 22
|
|
||||||
OnExecute = ActFileCompAndRunWithArgsExecute
|
|
||||||
ShortCut = 24695
|
|
||||||
end
|
|
||||||
object actFileSaveAll: TAction
|
|
||||||
Category = 'File'
|
|
||||||
Caption = 'Save all'
|
|
||||||
ImageIndex = 26
|
|
||||||
OnExecute = actFileSaveAllExecute
|
|
||||||
end
|
|
||||||
object actFileClose: TAction
|
|
||||||
Category = 'File'
|
|
||||||
Caption = 'Close file'
|
|
||||||
ImageIndex = 27
|
|
||||||
OnExecute = actFileCloseExecute
|
|
||||||
ShortCut = 16471
|
|
||||||
end
|
|
||||||
object actProjSave: TAction
|
object actProjSave: TAction
|
||||||
Category = 'Project'
|
Category = 'Project'
|
||||||
Caption = 'Save project'
|
Caption = 'Save project'
|
||||||
|
@ -2178,14 +2165,14 @@ object CEMainForm: TCEMainForm
|
||||||
end
|
end
|
||||||
object actProjCompileAndRun: TAction
|
object actProjCompileAndRun: TAction
|
||||||
Category = 'Project'
|
Category = 'Project'
|
||||||
Caption = 'Compile and run project'
|
Caption = 'Compile project and run'
|
||||||
ImageIndex = 21
|
ImageIndex = 21
|
||||||
OnExecute = actProjCompileAndRunExecute
|
OnExecute = actProjCompileAndRunExecute
|
||||||
ShortCut = 24696
|
ShortCut = 24696
|
||||||
end
|
end
|
||||||
object actProjCompAndRunWithArgs: TAction
|
object actProjCompAndRunWithArgs: TAction
|
||||||
Category = 'Project'
|
Category = 'Project'
|
||||||
Caption = 'Compile and run project...'
|
Caption = 'Compile project and run...'
|
||||||
ImageIndex = 21
|
ImageIndex = 21
|
||||||
OnExecute = actProjCompAndRunWithArgsExecute
|
OnExecute = actProjCompAndRunWithArgsExecute
|
||||||
end
|
end
|
||||||
|
@ -2216,12 +2203,6 @@ object CEMainForm: TCEMainForm
|
||||||
OnExecute = actEdFindNextExecute
|
OnExecute = actEdFindNextExecute
|
||||||
ShortCut = 114
|
ShortCut = 114
|
||||||
end
|
end
|
||||||
object actFileOpenContFold: TAction
|
|
||||||
Category = 'File'
|
|
||||||
Caption = 'View in mini explorer'
|
|
||||||
ImageIndex = 29
|
|
||||||
OnExecute = actFileOpenContFoldExecute
|
|
||||||
end
|
|
||||||
object actProjOpenContFold: TAction
|
object actProjOpenContFold: TAction
|
||||||
Category = 'Project'
|
Category = 'Project'
|
||||||
Caption = 'View in mini explorer'
|
Caption = 'View in mini explorer'
|
||||||
|
@ -2234,6 +2215,38 @@ object CEMainForm: TCEMainForm
|
||||||
ImageIndex = 30
|
ImageIndex = 30
|
||||||
OnExecute = actLayoutSaveExecute
|
OnExecute = actLayoutSaveExecute
|
||||||
end
|
end
|
||||||
|
object actFileCompileAndRunOut: TAction
|
||||||
|
Category = 'File'
|
||||||
|
Caption = 'Compile file and run outside'
|
||||||
|
ImageIndex = 22
|
||||||
|
OnExecute = actFileCompileAndRunOutExecute
|
||||||
|
end
|
||||||
|
object ActFileCompAndRunWithArgs: TAction
|
||||||
|
Category = 'File'
|
||||||
|
Caption = 'Compile file and run...'
|
||||||
|
ImageIndex = 22
|
||||||
|
OnExecute = ActFileCompAndRunWithArgsExecute
|
||||||
|
ShortCut = 24695
|
||||||
|
end
|
||||||
|
object actFileSaveAll: TAction
|
||||||
|
Category = 'File'
|
||||||
|
Caption = 'Save all'
|
||||||
|
ImageIndex = 26
|
||||||
|
OnExecute = actFileSaveAllExecute
|
||||||
|
end
|
||||||
|
object actFileClose: TAction
|
||||||
|
Category = 'File'
|
||||||
|
Caption = 'Close file'
|
||||||
|
ImageIndex = 27
|
||||||
|
OnExecute = actFileCloseExecute
|
||||||
|
ShortCut = 16471
|
||||||
|
end
|
||||||
|
object actFileOpenContFold: TAction
|
||||||
|
Category = 'File'
|
||||||
|
Caption = 'View in mini explorer'
|
||||||
|
ImageIndex = 29
|
||||||
|
OnExecute = actFileOpenContFoldExecute
|
||||||
|
end
|
||||||
object actFileHtmlExport: TAction
|
object actFileHtmlExport: TAction
|
||||||
Category = 'File'
|
Category = 'File'
|
||||||
Caption = 'Export to html...'
|
Caption = 'Export to html...'
|
||||||
|
|
|
@ -18,6 +18,8 @@ type
|
||||||
|
|
||||||
// TODO-cfeature: options
|
// TODO-cfeature: options
|
||||||
|
|
||||||
|
{ TCEMainForm }
|
||||||
|
|
||||||
TCEMainForm = class(TForm, ICEMultiDocObserver, ICESessionOptionsObserver, ICEEditableShortCut)
|
TCEMainForm = class(TForm, ICEMultiDocObserver, ICESessionOptionsObserver, ICEEditableShortCut)
|
||||||
actFileCompAndRun: TAction;
|
actFileCompAndRun: TAction;
|
||||||
actFileSaveAll: TAction;
|
actFileSaveAll: TAction;
|
||||||
|
@ -34,6 +36,7 @@ type
|
||||||
actFileOpenContFold: TAction;
|
actFileOpenContFold: TAction;
|
||||||
actFileHtmlExport: TAction;
|
actFileHtmlExport: TAction;
|
||||||
actFileUnittest: TAction;
|
actFileUnittest: TAction;
|
||||||
|
actFileCompileAndRunOut: TAction;
|
||||||
actLayoutSave: TAction;
|
actLayoutSave: TAction;
|
||||||
actProjOpenContFold: TAction;
|
actProjOpenContFold: TAction;
|
||||||
actProjOptView: TAction;
|
actProjOptView: TAction;
|
||||||
|
@ -120,6 +123,8 @@ type
|
||||||
MenuItem62: TMenuItem;
|
MenuItem62: TMenuItem;
|
||||||
MenuItem63: TMenuItem;
|
MenuItem63: TMenuItem;
|
||||||
MenuItem64: TMenuItem;
|
MenuItem64: TMenuItem;
|
||||||
|
MenuItem65: TMenuItem;
|
||||||
|
MenuItem66: TMenuItem;
|
||||||
mnuLayout: TMenuItem;
|
mnuLayout: TMenuItem;
|
||||||
mnuItemMruFile: TMenuItem;
|
mnuItemMruFile: TMenuItem;
|
||||||
mnuItemMruProj: TMenuItem;
|
mnuItemMruProj: TMenuItem;
|
||||||
|
@ -130,6 +135,7 @@ type
|
||||||
MenuItem7: TMenuItem;
|
MenuItem7: TMenuItem;
|
||||||
MenuItem8: TMenuItem;
|
MenuItem8: TMenuItem;
|
||||||
MenuItem9: TMenuItem;
|
MenuItem9: TMenuItem;
|
||||||
|
procedure actFileCompileAndRunOutExecute(Sender: TObject);
|
||||||
procedure actEdFindExecute(Sender: TObject);
|
procedure actEdFindExecute(Sender: TObject);
|
||||||
procedure actEdFindNextExecute(Sender: TObject);
|
procedure actEdFindNextExecute(Sender: TObject);
|
||||||
procedure actFileAddToProjExecute(Sender: TObject);
|
procedure actFileAddToProjExecute(Sender: TObject);
|
||||||
|
@ -257,7 +263,8 @@ type
|
||||||
// run & exec sub routines
|
// run & exec sub routines
|
||||||
procedure asyncprocOutput(sender: TObject);
|
procedure asyncprocOutput(sender: TObject);
|
||||||
procedure asyncprocTerminate(sender: TObject);
|
procedure asyncprocTerminate(sender: TObject);
|
||||||
procedure compileAndRunFile(unittest: boolean = false; const runArgs: string = '');
|
procedure compileAndRunFile(unittest: boolean = false; redirect: boolean = true;
|
||||||
|
const runArgs: string = '');
|
||||||
|
|
||||||
// file sub routines
|
// file sub routines
|
||||||
procedure newFile;
|
procedure newFile;
|
||||||
|
@ -1276,7 +1283,8 @@ begin
|
||||||
if (inph <> nil) then (inph as ICEProcInputHandler).removeProcess(proc);
|
if (inph <> nil) then (inph as ICEProcInputHandler).removeProcess(proc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.compileAndRunFile(unittest: boolean; const runArgs: string = '');
|
procedure TCEMainForm.compileAndRunFile(unittest: boolean = false; redirect: boolean = true;
|
||||||
|
const runArgs: string = '');
|
||||||
var
|
var
|
||||||
dmdproc: TProcess;
|
dmdproc: TProcess;
|
||||||
fname: string;
|
fname: string;
|
||||||
|
@ -1286,10 +1294,13 @@ begin
|
||||||
if fDoc = nil then exit;
|
if fDoc = nil then exit;
|
||||||
|
|
||||||
fRunProc := TCheckedAsyncProcess.Create(nil);
|
fRunProc := TCheckedAsyncProcess.Create(nil);
|
||||||
|
if redirect then
|
||||||
|
begin
|
||||||
fRunProc.Options := [poStderrToOutPut, poUsePipes];
|
fRunProc.Options := [poStderrToOutPut, poUsePipes];
|
||||||
fRunProc.ShowWindow := swoHIDE;
|
fRunProc.ShowWindow := swoHIDE;
|
||||||
fRunProc.OnReadData := @asyncprocOutput;
|
fRunProc.OnReadData := @asyncprocOutput;
|
||||||
fRunProc.OnTerminate:= @asyncprocTerminate;
|
fRunProc.OnTerminate:= @asyncprocTerminate;
|
||||||
|
end;
|
||||||
|
|
||||||
dmdproc := TProcess.Create(nil);
|
dmdproc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
|
@ -1326,11 +1337,11 @@ begin
|
||||||
begin
|
begin
|
||||||
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
|
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
|
||||||
fDoc, amcEdit, amkInf);
|
fDoc, amcEdit, amkInf);
|
||||||
|
|
||||||
fRunProc.CurrentDirectory := extractFilePath(fRunProc.Executable);
|
fRunProc.CurrentDirectory := extractFilePath(fRunProc.Executable);
|
||||||
if runArgs <> '' then
|
if runArgs <> '' then
|
||||||
fRunProc.Parameters.DelimitedText := symbolExpander.get(runArgs);
|
fRunProc.Parameters.DelimitedText := symbolExpander.get(runArgs);
|
||||||
fRunProc.Executable := fname + exeExt;
|
fRunProc.Executable := fname + exeExt;
|
||||||
|
if redirect then
|
||||||
getprocInputHandler.addProcess(fRunProc);
|
getprocInputHandler.addProcess(fRunProc);
|
||||||
fRunProc.Execute;
|
fRunProc.Execute;
|
||||||
sysutils.DeleteFile(fname + objExt);
|
sysutils.DeleteFile(fname + objExt);
|
||||||
|
@ -1348,13 +1359,19 @@ end;
|
||||||
procedure TCEMainForm.actFileUnittestExecute(Sender: TObject);
|
procedure TCEMainForm.actFileUnittestExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fDoc = nil then exit;
|
if fDoc = nil then exit;
|
||||||
compileAndRunFile(true, '');
|
compileAndRunFile(true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actFileCompAndRunExecute(Sender: TObject);
|
procedure TCEMainForm.actFileCompAndRunExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fDoc = nil then exit;
|
if fDoc = nil then exit;
|
||||||
compileAndRunFile(false, '');
|
compileAndRunFile(false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMainForm.actFileCompileAndRunOutExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if fDoc = nil then exit;
|
||||||
|
compileAndRunFile(false, false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actFileCompAndRunWithArgsExecute(Sender: TObject);
|
procedure TCEMainForm.actFileCompAndRunWithArgsExecute(Sender: TObject);
|
||||||
|
@ -1364,7 +1381,7 @@ begin
|
||||||
if fDoc = nil then exit;
|
if fDoc = nil then exit;
|
||||||
runargs := '';
|
runargs := '';
|
||||||
if InputQuery('Execution arguments', '', runargs) then
|
if InputQuery('Execution arguments', '', runargs) then
|
||||||
compileAndRunFile(false, runargs);
|
compileAndRunFile(false, true, runargs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject);
|
procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject);
|
||||||
|
|
Loading…
Reference in New Issue