From 5966e03425a9f0bdeb2d61573a775f603d75db3a Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 8 Aug 2022 15:07:19 +0200 Subject: [PATCH] add the redoAll action --- CHANGELOG.md | 10 +++++ src/u_editor.lfm | 4 ++ src/u_editor.pas | 8 ++++ src/u_main.lfm | 109 +++++++++++++++++++++++++--------------------- src/u_main.pas | 12 +++++ src/u_synmemo.pas | 15 +++++++ 6 files changed, 108 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22bffc52..fd480e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v3.9.24-dev + +## Enhancements + +- Editor, added the _Redo All_ action. + +## Bugs fixed + +- make projects, DUB was wrongly mentioned when trying to compile while previous build not finished. + # v3.9.23 ## Enhancements diff --git a/src/u_editor.lfm b/src/u_editor.lfm index 530ab851..267a1c10 100644 --- a/src/u_editor.lfm +++ b/src/u_editor.lfm @@ -91,6 +91,10 @@ inherited EditorWidget: TEditorWidget Caption = 'Redo' OnClick = mnuedRedoClick end + object enuItemRedoAll: TMenuItem + Caption = 'Redo all' + OnClick = enuItemRedoAllClick + end object MenuItem11: TMenuItem Caption = '-' end diff --git a/src/u_editor.pas b/src/u_editor.pas index 9d0c2f96..3cb0ad24 100644 --- a/src/u_editor.pas +++ b/src/u_editor.pas @@ -62,6 +62,7 @@ type MenuItem14: TMenuItem; MenuItem15: TMenuItem; MenuItem16: TMenuItem; + enuItemRedoAll: TMenuItem; mnuCurFileCopyName: TMenuItem; mnuCurFileShowInMiniExpl: TMenuItem; mnuCurFileShellOpen: TMenuItem; @@ -112,6 +113,7 @@ type editorStatus: TStatusBar; mnuEditor: TPopupMenu; mnuCurFile: TPopupMenu; + procedure enuItemRedoAllClick(Sender: TObject); procedure FormShortCut(var Msg: TLMKey; var Handled: Boolean); procedure FormShow(Sender: TObject); procedure mnuCurFileCopyNameClick(Sender: TObject); @@ -1090,6 +1092,12 @@ begin end; end; +procedure TEditorWidget.enuItemRedoAllClick(Sender: TObject); +begin + if fDoc.isAssigned then + fDoc.redoAll(); +end; + procedure TEditorWidget.FormShow(Sender: TObject); begin if fDoc.isAssigned then diff --git a/src/u_main.lfm b/src/u_main.lfm index 3772ed59..b5e0fb14 100644 --- a/src/u_main.lfm +++ b/src/u_main.lfm @@ -12,7 +12,6 @@ object MainForm: TMainForm OnDropFiles = FormDropFiles OnResize = FormResize ShowHint = True - LCLVersion = '2.2.0.4' object mainMenu: TMainMenu Top = 1 object MenuItem1: TMenuItem @@ -138,6 +137,9 @@ object MainForm: TMainForm object MenuItem20: TMenuItem Action = actEdRedo end + object MenuItem119: TMenuItem + Action = actEdRedoAll + end object MenuItem21: TMenuItem Caption = '-' end @@ -418,7 +420,7 @@ object MainForm: TMainForm end end object Actions: TActionList - Left = 31 + Left = 32 object actEdCopy: TAction Category = 'Edit' Caption = 'Copy' @@ -455,20 +457,6 @@ object MainForm: TMainForm OnUpdate = updateDocEditBasedAction ShortCut = 24666 end - object actEdMacStartStop: TAction - Category = 'Edit' - Caption = 'Start/stop macro recording' - OnExecute = actEdMacStartStopExecute - OnUpdate = updateDocEditBasedAction - ShortCut = 24658 - end - object actEdMacPlay: TAction - Category = 'Edit' - Caption = 'Play macro' - OnExecute = actEdMacPlayExecute - OnUpdate = updateDocEditBasedAction - ShortCut = 24656 - end object actFileSave: TAction Category = 'File' Caption = 'Save file' @@ -530,20 +518,6 @@ object MainForm: TMainForm OnExecute = actProjSourceExecute OnUpdate = updateProjectBasedAction end - object actEdIndent: TAction - Category = 'Edit' - Caption = 'Indent' - OnExecute = actEdIndentExecute - OnUpdate = updateDocEditBasedAction - ShortCut = 24649 - end - object actEdUnIndent: TAction - Category = 'Edit' - Caption = 'Unindent' - OnExecute = actEdUnIndentExecute - OnUpdate = updateDocEditBasedAction - ShortCut = 24661 - end object actProjOptView: TAction Category = 'Project' Caption = 'View project command line' @@ -583,20 +557,6 @@ object MainForm: TMainForm OnExecute = actProjRunWithArgsExecute OnUpdate = updateProjectBasedAction end - object actEdFind: TAction - Category = 'Edit' - Caption = 'Find...' - OnExecute = actEdFindExecute - OnUpdate = updateDocumentBasedAction - ShortCut = 16454 - end - object actEdFindNext: TAction - Category = 'Edit' - Caption = 'Find next' - OnExecute = actEdFindNextExecute - OnUpdate = updateDocumentBasedAction - ShortCut = 114 - end object actProjOpenContFold: TAction Category = 'Project' Caption = 'View in mini explorer' @@ -819,12 +779,6 @@ object MainForm: TMainForm OnExecute = actFileCloseAllExecute OnUpdate = updateDocumentBasedAction end - object actEdFormat: TAction - Category = 'Edit' - Caption = 'Apply code formatting' - OnExecute = actEdFormatExecute - OnUpdate = updateDocumentBasedAction - end object actProjTest: TAction Category = 'Project' Caption = 'Test project' @@ -862,6 +816,61 @@ object MainForm: TMainForm Caption = 'Check semantics' OnExecute = actProjCheckSemaExecute end + object actEdRedoAll: TAction + Category = 'Edit' + Caption = 'Redo all' + OnExecute = actEdRedoAllExecute + OnUpdate = updateDocEditBasedAction + ShortCut = 49242 + end + object actEdMacStartStop: TAction + Category = 'Edit' + Caption = 'Start/stop macro recording' + OnExecute = actEdMacStartStopExecute + OnUpdate = updateDocEditBasedAction + ShortCut = 24658 + end + object actEdMacPlay: TAction + Category = 'Edit' + Caption = 'Play macro' + OnExecute = actEdMacPlayExecute + OnUpdate = updateDocEditBasedAction + ShortCut = 24656 + end + object actEdIndent: TAction + Category = 'Edit' + Caption = 'Indent' + OnExecute = actEdIndentExecute + OnUpdate = updateDocEditBasedAction + ShortCut = 24649 + end + object actEdUnIndent: TAction + Category = 'Edit' + Caption = 'Unindent' + OnExecute = actEdUnIndentExecute + OnUpdate = updateDocEditBasedAction + ShortCut = 24661 + end + object actEdFind: TAction + Category = 'Edit' + Caption = 'Find...' + OnExecute = actEdFindExecute + OnUpdate = updateDocumentBasedAction + ShortCut = 16454 + end + object actEdFindNext: TAction + Category = 'Edit' + Caption = 'Find next' + OnExecute = actEdFindNextExecute + OnUpdate = updateDocumentBasedAction + ShortCut = 114 + end + object actEdFormat: TAction + Category = 'Edit' + Caption = 'Apply code formatting' + OnExecute = actEdFormatExecute + OnUpdate = updateDocumentBasedAction + end end object ApplicationProperties1: TApplicationProperties OnActivate = ApplicationProperties1Activate diff --git a/src/u_main.pas b/src/u_main.pas index 17fac886..4dd3d271 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -117,6 +117,7 @@ type actFileCloseAll: TAction; actFileNewClip: TAction; actEdFormat: TAction; + actEdRedoAll: TAction; actProjCheckSema: TAction; actProjSetEnv: TAction; actProjGitPull: TAction; @@ -186,6 +187,7 @@ type MenuItem116: TMenuItem; MenuItem117: TMenuItem; MenuItem118: TMenuItem; + MenuItem119: TMenuItem; mnuGitBranch: TMenuItem; mnuItemDubDialog: TMenuItem; mnuItemHelp: TMenuItem; @@ -330,6 +332,7 @@ type procedure actProjSetEnvExecute(Sender: TObject); procedure actProjStopCompExecute(Sender: TObject); procedure actProjTestExecute(Sender: TObject); + procedure actEdRedoAllExecute(Sender: TObject); procedure actSetRunnableSwExecute(Sender: TObject); procedure ApplicationProperties1Activate(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); @@ -1558,6 +1561,7 @@ begin actEdUndo.ImageIndex:= i; i := loadIcon('ARROW_REDO'); actEdRedo.ImageIndex:= i; + actEdRedoAll.ImageIndex:= i; i := loadIcon('FIND'); actEdFind.ImageIndex:= i; actEdFindNext.ImageIndex:= i; @@ -2891,6 +2895,12 @@ begin fDoc.Redo; end; +procedure TMainForm.actEdRedoAllExecute(Sender: TObject); +begin + if fDoc.isAssigned then + fDoc.redoAll(); +end; + procedure TMainForm.actEdMacPlayExecute(Sender: TObject); begin if fDoc.isAssigned then @@ -4084,6 +4094,8 @@ begin fProj.test; end; + + procedure TMainForm.actProjStopCompExecute(Sender: TObject); begin if fProj.isAssigned then diff --git a/src/u_synmemo.pas b/src/u_synmemo.pas index 483e09ea..97f18bfb 100644 --- a/src/u_synmemo.pas +++ b/src/u_synmemo.pas @@ -381,6 +381,7 @@ type procedure replaceUndoableContent(const value: string); procedure setDscannerOptions(dsEnabled: boolean; dsDelay: integer); procedure centerCursor(); + procedure redoAll(); // property IdentifierMatchOptions: TIdentifierMatchOptions read fMatchOpts write setMatchOpts; property Identifier: string read fIdentifier; @@ -481,6 +482,7 @@ const ecRightWordEdge = ecUserFirst + 31; ecSelLeftWordEdge = ecUserFirst + 32; ecSelRightWordEdge = ecUserFirst + 33; + ecRedoAll = ecUserFirst + 34; var D2Syn: TSynD2Syn; // used as model to set the options when no editor exists. TxtSyn: TSynTxtSyn; // used as model to set the options when no editor exists. @@ -1481,6 +1483,7 @@ begin AddKey(ecSelRightWordEdge, 0, [], 0, []); AddKey(ecSmartWordLeft, 0, [], 0, []); AddKey(ecSmartWordRight, 0, [], 0, []); + AddKey(ecRedoAll, 0, [], 0, []); end; end; @@ -1520,6 +1523,7 @@ begin 'ecRightWordEdge': begin Int := ecRightWordEdge; exit(true); end; 'ecSelLeftWordEdge': begin Int := ecSelLeftWordEdge; exit(true); end; 'ecSelRightWordEdge': begin Int := ecSelRightWordEdge; exit(true); end; + 'ecRedoAll': begin Int := ecRedoAll; exit(true); end; else exit(false); end; end; @@ -1560,6 +1564,7 @@ begin ecRightWordEdge: begin Ident := 'ecRightWordEdge'; exit(true); end; ecSelLeftWordEdge: begin Ident := 'ecSelLeftWordEdge'; exit(true); end; ecSelRightWordEdge: begin Ident := 'ecSelRightWordEdge'; exit(true); end; + ecRedoAll: begin Ident := 'ecRedoAll'; exit(true); end; else exit(false); end; end; @@ -1692,6 +1697,8 @@ begin gotoWordEdge(false); ecRightWordEdge, ecSelRightWordEdge: gotoWordEdge(true); + ecRedoAll: + redoAll(); end; if fOverrideColMode and not SelAvail then begin @@ -2673,6 +2680,14 @@ begin end; end; +procedure TDexedMemo.redoAll(); +begin + BeginUpdate(false); + while CanRedo do + Redo; + EndUpdate(); +end; + procedure TDexedMemo.gotoWordEdge(right: boolean); var s: string;