From 0a4bd3064d09a0637f85e21fe5718c314a3a5910 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 18 Jan 2017 19:55:40 +0100 Subject: [PATCH] main menu, files, add close all + close all the others --- src/ce_main.lfm | 20 ++++++++++++++++++++ src/ce_main.pas | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/ce_main.lfm b/src/ce_main.lfm index 756f982f..e48e575a 100644 --- a/src/ce_main.lfm +++ b/src/ce_main.lfm @@ -1709,6 +1709,12 @@ object CEMainForm: TCEMainForm ADFFB0B0AEEA000000000000000000000000FFFFFF00FFFFFF00 } end + object MenuItem107: TMenuItem + Action = actFileCloseAll + end + object MenuItem106: TMenuItem + Action = actFileCloseAllOthers + end object MenuItem6: TMenuItem Caption = '-' end @@ -5235,6 +5241,20 @@ object CEMainForm: TCEMainForm ImageIndex = 35 OnExecute = actFileMetricsHalsteadExecute end + object actFileCloseAllOthers: TAction + Category = 'File' + Caption = 'Close all the others files' + ImageIndex = 27 + OnExecute = actFileCloseAllOthersExecute + OnUpdate = updateDocumentBasedAction + end + object actFileCloseAll: TAction + Category = 'File' + Caption = 'Close all the files' + ImageIndex = 27 + OnExecute = actFileCloseAllExecute + OnUpdate = updateDocumentBasedAction + end end object imgList: TImageList left = 64 diff --git a/src/ce_main.pas b/src/ce_main.pas index 9081e169..98e1b104 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -103,6 +103,8 @@ type actFileRunDubOut: TAction; actFileNewDubScript: TAction; actFileMetricsHalstead: TAction; + actFileCloseAllOthers: TAction; + actFileCloseAll: TAction; actProjGroupCompileCustomSync: TAction; actProjGroupClose: TAction; actProjGroupCompileSync: TAction; @@ -151,6 +153,8 @@ type MenuItem103: TMenuItem; MenuItem104: TMenuItem; MenuItem105: TMenuItem; + MenuItem106: TMenuItem; + MenuItem107: TMenuItem; MenuItem77: TMenuItem; mnuOpts: TMenuItem; mnuItemMruGroup: TMenuItem; @@ -254,6 +258,8 @@ type MenuItem7: TMenuItem; MenuItem8: TMenuItem; MenuItem9: TMenuItem; + procedure actFileCloseAllExecute(Sender: TObject); + procedure actFileCloseAllOthersExecute(Sender: TObject); procedure actFileCompileExecute(Sender: TObject); procedure actFileDscannerExecute(Sender: TObject); procedure actFileMetricsHalsteadExecute(Sender: TObject); @@ -2818,6 +2824,33 @@ begin compileRunnable(false); end; +procedure TCEMainForm.actFileCloseAllOthersExecute(Sender: TObject); +var + i: integer; + d: TCESynMemo; + c: TCESynMemo; +begin + if fDoc.isNil then + exit; + c := fDoc; + for i := fMultidoc.documentCount-1 downto 0 do + begin + d := fMultidoc.document[i]; + if not d.Equals(c) then + fMultidoc.closeDocument(d); + end; +end; + +procedure TCEMainForm.actFileCloseAllExecute(Sender: TObject); +var + i: integer; +begin + if fDoc.isNil then + exit; + for i := fMultidoc.documentCount-1 downto 0 do + fMultidoc.closeDocument(i); +end; + procedure TCEMainForm.actFileDscannerExecute(Sender: TObject); var lst: TStringList;