From 9cfad0014e684000f7498b3b4cb637c329e5192d Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 6 Dec 2015 05:40:32 +0100 Subject: [PATCH] added new editor shortcut to activate synchro edit + options, handling of new shortcuts from a version to another --- src/ce_editoroptions.pas | 46 ++++++++++++++++++++++++++++++++++++++++ src/ce_synmemo.pas | 2 ++ 2 files changed, 48 insertions(+) diff --git a/src/ce_editoroptions.pas b/src/ce_editoroptions.pas index f0fd9fe8..067262a6 100644 --- a/src/ce_editoroptions.pas +++ b/src/ce_editoroptions.pas @@ -333,10 +333,56 @@ begin end; procedure TCEEditorOptions.afterLoad; +var + ed: TSynEdit; + shc: TCEPersistentShortcut; + i,j: integer; + exists: boolean; begin inherited; D2Syn.Assign(fD2Syn); TxtSyn.Assign(fTxtSyn); + // + ed := TSynEdit.Create(nil); + try + SetDefaultCoeditKeystrokes(ed); + // new version with more shortcuts + for i:= 0 to ed.Keystrokes.Count-1 do + begin + exists := false; + for j := 0 to fShortcuts.count-1 do + begin + if TCEPersistentShortcut(fShortCuts.Items[j]).actionName <> + EditorCommandToCodeString(ed.Keystrokes.Items[i].Command) then + continue; + exists := true; + break; + end; + if exists then + continue; + shc := TCEPersistentShortcut(fShortCuts.Add); + shc.actionName := EditorCommandToCodeString(ed.Keystrokes.Items[i].Command); + shc.shortcut := ed.Keystrokes.Items[i].ShortCut; + end; + // new version wih less shortcuts + for j := fShortcuts.count-1 downto 0 do + begin + exists := false; + for i:= 0 to ed.Keystrokes.Count-1 do + begin + if TCEPersistentShortcut(fShortCuts.Items[j]).actionName <> + EditorCommandToCodeString(ed.Keystrokes.Items[i].Command) then + continue; + exists := true; + break; + end; + if exists then + continue; + fShortCuts.Delete(j); + end; + finally + ed.free; + end; end; {$ENDREGION} diff --git a/src/ce_synmemo.pas b/src/ce_synmemo.pas index 635a89ae..c4023dcc 100644 --- a/src/ce_synmemo.pas +++ b/src/ce_synmemo.pas @@ -975,6 +975,8 @@ begin AddKey(ecColSelLineEnd, VK_END, [ssAlt, ssShift], 0, []); AddKey(ecColSelEditorTop, VK_HOME, [ssAlt, ssShift,ssCtrl], 0, []); AddKey(ecColSelEditorBottom, VK_END, [ssAlt, ssShift,ssCtrl], 0, []); + AddKey(ecSynPSyncroEdStart, ord('E'), [ssCtrl], 0, []); + AddKey(ecSynPSyncroEdEscape, ord('E'), [ssCtrl, ssShift], 0, []); end; end; {$ENDREGION --------------------------------------------------------------------}