added new editor shortcut to activate synchro edit

+ options, handling of new shortcuts from a version to another
This commit is contained in:
Basile Burg 2015-12-06 05:40:32 +01:00
parent 5695baa946
commit 9cfad0014e
2 changed files with 48 additions and 0 deletions

View File

@ -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}

View File

@ -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 --------------------------------------------------------------------}