mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-14 10:29:42 +01:00
IDE: Fix advanced mouse opts for breakpoint toggling / enabling
This commit is contained in:
parent
bee839cc18
commit
320cae4037
@ -459,6 +459,17 @@ const
|
|||||||
// TSynPluginSyncroEdit - selecting
|
// TSynPluginSyncroEdit - selecting
|
||||||
ecIdePSyncroEdSelStart = ecFirstPlugin + 90;
|
ecIdePSyncroEdSelStart = ecFirstPlugin + 90;
|
||||||
|
|
||||||
|
const
|
||||||
|
// Mouse command offsets
|
||||||
|
emcOffsetToggleBreakPoint = 0;
|
||||||
|
emcOffsetToggleBreakPointEnabled = 1;
|
||||||
|
|
||||||
|
var
|
||||||
|
emcToggleBreakPoint,
|
||||||
|
emcToggleBreakPointEnabled : integer;
|
||||||
|
|
||||||
|
const
|
||||||
|
emcIdeMouseCommandsCount = 2;
|
||||||
|
|
||||||
type
|
type
|
||||||
TIDECommand = class;
|
TIDECommand = class;
|
||||||
@ -855,6 +866,14 @@ function IDECommandToIdent(Cmd: longint; var Ident: string): boolean;
|
|||||||
function IDECommandToIdent(Cmd: longint): string;
|
function IDECommandToIdent(Cmd: longint): string;
|
||||||
procedure GetIDEEditorCommandValues(Proc: TGetStrProc);
|
procedure GetIDEEditorCommandValues(Proc: TGetStrProc);
|
||||||
|
|
||||||
|
procedure SetIdeMouseCommandOffset(AStartNum: Integer);
|
||||||
|
function GetIdeMouseCommandOffset: Integer;
|
||||||
|
function IdentToIDEMouseCommand(const Ident: string; var Cmd: longint): boolean;
|
||||||
|
function IDEMouseCommandToIdent(Cmd: longint; var Ident: string): boolean;
|
||||||
|
procedure GetIdeMouseCommandValues(Proc: TGetStrProc);
|
||||||
|
|
||||||
|
property emcIdeMouseCommandOffset: integer read GetIdeMouseCommandOffset write SetIdeMouseCommandOffset;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function IDEShortCut(Key1: word; Shift1: TShiftState;
|
function IDEShortCut(Key1: word; Shift1: TShiftState;
|
||||||
@ -2352,5 +2371,44 @@ begin
|
|||||||
Proc(IDEEditorCommandStrs[I].Name);
|
Proc(IDEEditorCommandStrs[I].Name);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
TheEmcIdeMouseCommandOffset: Integer;
|
||||||
|
IDEEditorMouseCommandStrs: array[0..emcIdeMouseCommandsCount-1] of TIdentMapEntry = (
|
||||||
|
// Initialize with Value = 0 .. emcIdeMouseCommandsCount
|
||||||
|
(Value: emcOffsetToggleBreakPoint; Name: 'emcToggleBreakPoint'),
|
||||||
|
(Value: emcOffsetToggleBreakPointEnabled; Name: 'emcToggleBreakPointEnabled')
|
||||||
|
);
|
||||||
|
|
||||||
|
procedure SetIdeMouseCommandOffset(AStartNum: Integer);
|
||||||
|
begin
|
||||||
|
TheEmcIdeMouseCommandOffset := AStartNum;
|
||||||
|
emcToggleBreakPoint := AStartNum + emcOffsetToggleBreakPoint; // update last
|
||||||
|
emcToggleBreakPointEnabled := AStartNum + emcOffsetToggleBreakPointEnabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetIdeMouseCommandOffset: Integer;
|
||||||
|
begin
|
||||||
|
Result := TheEmcIdeMouseCommandOffset;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function IdentToIDEMouseCommand(const Ident: string; var Cmd: longint): boolean;
|
||||||
|
begin
|
||||||
|
Result := IdentToInt(Ident, Cmd, IDEEditorMouseCommandStrs);
|
||||||
|
Cmd := Cmd + emcIdeMouseCommandOffset;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function IDEMouseCommandToIdent(Cmd: longint; var Ident: string): boolean;
|
||||||
|
begin
|
||||||
|
Result := IntToIdent(Cmd - emcIdeMouseCommandOffset, Ident, IDEEditorMouseCommandStrs);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure GetIdeMouseCommandValues(Proc: TGetStrProc);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i := Low(IDEEditorMouseCommandStrs) to High(IDEEditorMouseCommandStrs) do
|
||||||
|
Proc(IDEEditorMouseCommandStrs[I].Name);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -285,6 +285,7 @@ type
|
|||||||
|
|
||||||
function DoDeleteBreakPoint(const AFilename: string;
|
function DoDeleteBreakPoint(const AFilename: string;
|
||||||
ALine: integer): TModalResult; override;
|
ALine: integer): TModalResult; override;
|
||||||
|
function DoDeleteBreakPoint(ABrkPoint: TIDEBreakPoint): TModalResult;
|
||||||
function DoDeleteBreakPointAtMark(const ASourceMarkObj: TObject): TModalResult; override;
|
function DoDeleteBreakPointAtMark(const ASourceMarkObj: TObject): TModalResult; override;
|
||||||
|
|
||||||
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override;
|
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override;
|
||||||
@ -3160,7 +3161,12 @@ begin
|
|||||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||||
exit(mrCancel);
|
exit(mrCancel);
|
||||||
|
|
||||||
|
LockCommandProcessing;
|
||||||
|
try
|
||||||
ABrkPoint := FBreakPoints.Add(AFilename, ALine, AnUpdating);
|
ABrkPoint := FBreakPoints.Add(AFilename, ALine, AnUpdating);
|
||||||
|
finally
|
||||||
|
UnLockCommandProcessing;
|
||||||
|
end;
|
||||||
Result := mrOK;
|
Result := mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3172,8 +3178,12 @@ begin
|
|||||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||||
exit(mrCancel);
|
exit(mrCancel);
|
||||||
|
|
||||||
|
LockCommandProcessing;
|
||||||
|
try
|
||||||
ABrkPoint := FBreakPoints.Add(AnAddr, AnUpdating);
|
ABrkPoint := FBreakPoints.Add(AnAddr, AnUpdating);
|
||||||
Result := mrOK;
|
finally
|
||||||
|
UnLockCommandProcessing;
|
||||||
|
end; Result := mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
|
function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
|
||||||
@ -3193,6 +3203,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDebugManager.DoDeleteBreakPoint(ABrkPoint: TIDEBreakPoint
|
||||||
|
): TModalResult;
|
||||||
|
begin
|
||||||
|
LockCommandProcessing;
|
||||||
|
try
|
||||||
|
ABrkPoint.ReleaseReference;
|
||||||
|
Project1.Modified:=true;
|
||||||
|
Result := mrOK;
|
||||||
|
finally
|
||||||
|
UnLockCommandProcessing;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TDebugManager.DoDeleteBreakPointAtMark(const ASourceMarkObj: TObject
|
function TDebugManager.DoDeleteBreakPointAtMark(const ASourceMarkObj: TObject
|
||||||
): TModalResult;
|
): TModalResult;
|
||||||
var
|
var
|
||||||
@ -3216,9 +3239,7 @@ begin
|
|||||||
DebugLn('TDebugManager.DoDeleteBreakPointAtMark B ',OldBreakPoint.ClassName,
|
DebugLn('TDebugManager.DoDeleteBreakPointAtMark B ',OldBreakPoint.ClassName,
|
||||||
' ',OldBreakPoint.Source,' ',IntToStr(OldBreakPoint.Line));
|
' ',OldBreakPoint.Source,' ',IntToStr(OldBreakPoint.Line));
|
||||||
{$endif}
|
{$endif}
|
||||||
ReleaseRefAndNil(OldBreakPoint);
|
Result := DoDeleteBreakPoint(OldBreakPoint);
|
||||||
Project1.Modified:=true;
|
|
||||||
Result := mrOK;
|
|
||||||
finally
|
finally
|
||||||
UnLockCommandProcessing;
|
UnLockCommandProcessing;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -984,6 +984,7 @@ type
|
|||||||
procedure Assign(Src: TEditorMouseOptions); reintroduce;
|
procedure Assign(Src: TEditorMouseOptions); reintroduce;
|
||||||
function IsPresetEqualToMouseActions: Boolean;
|
function IsPresetEqualToMouseActions: Boolean;
|
||||||
function CalcCustomSavedActions: Boolean;
|
function CalcCustomSavedActions: Boolean;
|
||||||
|
Procedure LoadFromXmlMouseAct(aXMLConfig: TRttiXMLConfig; Path: String; MActions: TSynEditMouseActions; AShowError: Boolean = False);
|
||||||
procedure LoadFromXml(aXMLConfig: TRttiXMLConfig; aPath: String; aOldPath: String; FileVersion: Integer);
|
procedure LoadFromXml(aXMLConfig: TRttiXMLConfig; aPath: String; aOldPath: String; FileVersion: Integer);
|
||||||
procedure SaveToXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
procedure SaveToXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||||
procedure ImportFromXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
procedure ImportFromXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||||
@ -3701,7 +3702,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
with FGutterActions do begin
|
with FGutterActions do begin
|
||||||
AddCommand(emcOnMainGutterClick, False, mbXLeft, ccAny, CDir, R, [], []); // breakpoint
|
AddCommand(emcToggleBreakPoint, False, mbXLeft, ccSingle, CDir, R, [], [SYNEDIT_LINK_MODIFIER]);
|
||||||
|
AddCommand(emcToggleBreakPointEnabled, False, mbXLeft, ccSingle, CDir, R, [SYNEDIT_LINK_MODIFIER], [SYNEDIT_LINK_MODIFIER]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -4237,27 +4239,31 @@ begin
|
|||||||
FCustomSavedActions := Result;
|
FCustomSavedActions := Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditorMouseOptions.LoadFromXml(aXMLConfig: TRttiXMLConfig; aPath: String;
|
procedure TEditorMouseOptions.LoadFromXmlMouseAct(aXMLConfig: TRttiXMLConfig;
|
||||||
aOldPath: String; FileVersion: Integer);
|
Path: String; MActions: TSynEditMouseActions; AShowError: Boolean);
|
||||||
|
var
|
||||||
Procedure LoadMouseAct(Path: String; MActions: TSynEditMouseActions);
|
i, c: Integer;
|
||||||
var
|
|
||||||
c, i: Integer;
|
|
||||||
MAct: TSynEditMouseActionKeyCmdHelper;
|
MAct: TSynEditMouseActionKeyCmdHelper;
|
||||||
//ErrShown: Boolean;
|
begin
|
||||||
begin
|
|
||||||
//ErrShown := False;
|
|
||||||
MActions.Clear;
|
MActions.Clear;
|
||||||
MAct := TSynEditMouseActionKeyCmdHelper.Create(nil);
|
MAct := TSynEditMouseActionKeyCmdHelper.Create(nil);
|
||||||
|
|
||||||
c := aXMLConfig.GetValue(Path + 'Count', 0);
|
c := aXMLConfig.GetValue(Path + 'Count', 0);
|
||||||
for i := 0 to c - 1 do begin
|
for i := 0 to c - 1 do begin
|
||||||
try
|
try
|
||||||
MActions.IncAssertLock;
|
MActions.IncAssertLock;
|
||||||
try
|
try
|
||||||
// If the object would ever be extended, old configs will not have all properties.
|
|
||||||
Mact.Clear;
|
Mact.Clear;
|
||||||
aXMLConfig.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct);
|
aXMLConfig.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct);
|
||||||
|
if MAct.Command = emcOnMainGutterClick then begin
|
||||||
|
MAct.ShiftMask := MAct.ShiftMask + [SYNEDIT_LINK_MODIFIER];
|
||||||
|
MAct.Shift := MAct.Shift + [SYNEDIT_LINK_MODIFIER];
|
||||||
|
MAct.Command := emcToggleBreakPointEnabled;
|
||||||
|
MActions.Add.Assign(MAct);
|
||||||
|
|
||||||
|
MAct.Shift := MAct.Shift - [SYNEDIT_LINK_MODIFIER];
|
||||||
|
MAct.Command := emcToggleBreakPoint;
|
||||||
|
end;
|
||||||
|
|
||||||
MActions.Add.Assign(MAct);
|
MActions.Add.Assign(MAct);
|
||||||
finally
|
finally
|
||||||
MActions.DecAssertLock;
|
MActions.DecAssertLock;
|
||||||
@ -4265,14 +4271,18 @@ procedure TEditorMouseOptions.LoadFromXml(aXMLConfig: TRttiXMLConfig; aPath: Str
|
|||||||
MActions.AssertNoConflict(MAct);
|
MActions.AssertNoConflict(MAct);
|
||||||
except
|
except
|
||||||
MActions.Delete(MActions.Count-1);
|
MActions.Delete(MActions.Count-1);
|
||||||
//if not ErrShown then
|
if AShowError then
|
||||||
// IDEMessageDialog(dlgMouseOptErrorDup, dlgMouseOptErrorDupText, mtError, [mbOk]);
|
IDEMessageDialog(dlgMouseOptErrorDup, dlgMouseOptErrorDupText + LineEnding
|
||||||
//ErrShown := True;
|
+ Path + 'M' + IntToStr(i) + LineEnding + MAct.DisplayName,
|
||||||
|
mtError, [mbOk]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
MAct.Free;
|
Mact.Free;
|
||||||
end;
|
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorMouseOptions.LoadFromXml(aXMLConfig: TRttiXMLConfig; aPath: String;
|
||||||
|
aOldPath: String; FileVersion: Integer);
|
||||||
var
|
var
|
||||||
AltColumnMode: Boolean;
|
AltColumnMode: Boolean;
|
||||||
TextDoubleSelLine: Boolean;
|
TextDoubleSelLine: Boolean;
|
||||||
@ -4324,17 +4334,17 @@ begin
|
|||||||
|
|
||||||
if CustomSavedActions then begin
|
if CustomSavedActions then begin
|
||||||
// Load
|
// Load
|
||||||
LoadMouseAct(aPath + 'Main/', MainActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Main/', MainActions);
|
||||||
LoadMouseAct(aPath + 'MainText/', TextActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainText/', TextActions);
|
||||||
LoadMouseAct(aPath + 'MainSelection/', SelActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainSelection/', SelActions);
|
||||||
LoadMouseAct(aPath + 'Gutter/', GutterActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Gutter/', GutterActions);
|
||||||
LoadMouseAct(aPath + 'GutterFold/', GutterActionsFold);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFold/', GutterActionsFold);
|
||||||
LoadMouseAct(aPath + 'GutterFoldExp/', GutterActionsFoldExp);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldExp/', GutterActionsFoldExp);
|
||||||
LoadMouseAct(aPath + 'GutterFoldCol/', GutterActionsFoldCol);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldCol/', GutterActionsFoldCol);
|
||||||
LoadMouseAct(aPath + 'GutterLineNum/', GutterActionsLines);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineNum/', GutterActionsLines);
|
||||||
LoadMouseAct(aPath + 'GutterLineChange/', GutterActionsChanges);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineChange/', GutterActionsChanges);
|
||||||
LoadMouseAct(aPath + 'GutterOverView/', GutterActionsOverView);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverView/', GutterActionsOverView);
|
||||||
LoadMouseAct(aPath + 'GutterOverViewMarks/', GutterActionsOverViewMarks);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverViewMarks/', GutterActionsOverViewMarks);
|
||||||
|
|
||||||
if Version < 1 then begin
|
if Version < 1 then begin
|
||||||
try
|
try
|
||||||
@ -4411,48 +4421,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditorMouseOptions.ImportFromXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
procedure TEditorMouseOptions.ImportFromXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||||
|
|
||||||
Procedure LoadMouseAct(Path: String; MActions: TSynEditMouseActions);
|
|
||||||
var
|
|
||||||
i, c: Integer;
|
|
||||||
MAct: TSynEditMouseActionKeyCmdHelper;
|
|
||||||
begin
|
|
||||||
MActions.Clear;
|
|
||||||
MAct := TSynEditMouseActionKeyCmdHelper.Create(nil);
|
|
||||||
c := aXMLConfig.GetValue(Path + 'Count', 0);
|
|
||||||
for i := 0 to c - 1 do begin
|
|
||||||
try
|
|
||||||
MActions.IncAssertLock;
|
|
||||||
try
|
|
||||||
Mact.Clear;
|
|
||||||
aXMLConfig.ReadObject(Path + 'M' + IntToStr(i) + '/', MAct);
|
|
||||||
MActions.Add.Assign(MAct);
|
|
||||||
finally
|
|
||||||
MActions.DecAssertLock;
|
|
||||||
end;
|
|
||||||
MActions.AssertNoConflict(MAct);
|
|
||||||
except
|
|
||||||
MActions.Delete(MActions.Count-1);
|
|
||||||
IDEMessageDialog(dlgMouseOptErrorDup, dlgMouseOptErrorDupText + LineEnding
|
|
||||||
+ Path + 'M' + IntToStr(i) + LineEnding + MAct.DisplayName,
|
|
||||||
mtError, [mbOk]);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
Mact.Free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
LoadMouseAct(aPath + 'Main/', MainActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Main/', MainActions, True);
|
||||||
LoadMouseAct(aPath + 'MainText/', TextActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainText/', TextActions, True);
|
||||||
LoadMouseAct(aPath + 'MainSel/', SelActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainSel/', SelActions, True);
|
||||||
LoadMouseAct(aPath + 'Gutter/', GutterActions);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Gutter/', GutterActions, True);
|
||||||
LoadMouseAct(aPath + 'GutterFold/', GutterActionsFold);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFold/', GutterActionsFold, True);
|
||||||
LoadMouseAct(aPath + 'GutterFoldExp/', GutterActionsFoldExp);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldExp/', GutterActionsFoldExp, True);
|
||||||
LoadMouseAct(aPath + 'GutterFoldCol/', GutterActionsFoldCol);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldCol/', GutterActionsFoldCol, True);
|
||||||
LoadMouseAct(aPath + 'GutterLineNum/', GutterActionsLines);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineNum/', GutterActionsLines, True);
|
||||||
LoadMouseAct(aPath + 'GutterLineChange/', GutterActionsChanges);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineChange/', GutterActionsChanges, True);
|
||||||
LoadMouseAct(aPath + 'GutterOverView/', GutterActionsOverView);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverView/', GutterActionsOverView, True);
|
||||||
LoadMouseAct(aPath + 'GutterOverViewMarks/',GutterActionsOverViewMarks);
|
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverViewMarks/',GutterActionsOverViewMarks, True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditorMouseOptions.ExportToXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
procedure TEditorMouseOptions.ExportToXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||||
|
|||||||
@ -38,7 +38,8 @@ uses
|
|||||||
// LazUtils
|
// LazUtils
|
||||||
Laz2_XMLCfg, FileUtil,
|
Laz2_XMLCfg, FileUtil,
|
||||||
// SynEdit
|
// SynEdit
|
||||||
SynEditKeyCmds, SynPluginTemplateEdit, SynPluginSyncroEdit, SynPluginMultiCaret,
|
SynEditKeyCmds, SynPluginTemplateEdit, SynPluginSyncroEdit,
|
||||||
|
SynPluginMultiCaret, SynEditMouseCmds,
|
||||||
// IdeIntf
|
// IdeIntf
|
||||||
IDECommands,
|
IDECommands,
|
||||||
// IDE
|
// IDE
|
||||||
@ -227,6 +228,8 @@ type
|
|||||||
function IDEShortCutEmpty(const Key: TIDEShortCut): boolean;
|
function IDEShortCutEmpty(const Key: TIDEShortCut): boolean;
|
||||||
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
|
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
|
||||||
function EditorCommandToDescriptionString(cmd: word): String;
|
function EditorCommandToDescriptionString(cmd: word): String;
|
||||||
|
function EditorMouseCommandToDescriptionString(cmd: TSynEditorMouseCommand): String;
|
||||||
|
function EditorMouseCommandToConfigString(cmd: TSynEditorMouseCommand): String;
|
||||||
|
|
||||||
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
|
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
|
||||||
|
|
||||||
@ -955,6 +958,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function EditorMouseCommandToDescriptionString(cmd: TSynEditorMouseCommand
|
||||||
|
): String;
|
||||||
|
begin
|
||||||
|
case cmd - emcIdeMouseCommandOffset of
|
||||||
|
emcOffsetToggleBreakPoint: Result := srkmecToggleBreakPoint;
|
||||||
|
emcOffsetToggleBreakPointEnabled: Result := srkmecToggleBreakPointEnabled;
|
||||||
|
else
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function EditorMouseCommandToConfigString(cmd: TSynEditorMouseCommand): String;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
|
|
||||||
function KeyValuesToCaptionStr(const ShortcutA, ShortcutB: TIDEShortCut;
|
function KeyValuesToCaptionStr(const ShortcutA, ShortcutB: TIDEShortCut;
|
||||||
Brackets: Char): String;
|
Brackets: Char): String;
|
||||||
function AddBrakets(S: String): String;
|
function AddBrakets(S: String): String;
|
||||||
@ -4417,6 +4436,13 @@ initialization
|
|||||||
CustomKeySchemas := TStringList.Create;
|
CustomKeySchemas := TStringList.Create;
|
||||||
CustomKeySchemas.OwnsObjects := true;
|
CustomKeySchemas.OwnsObjects := true;
|
||||||
|
|
||||||
|
emcIdeMouseCommandOffset := AllocatePluginMouseRange(emcIdeMouseCommandsCount);
|
||||||
|
RegisterMouseCmdIdentProcs(@IdentToIDEMouseCommand,
|
||||||
|
@IDEMouseCommandToIdent);
|
||||||
|
RegisterExtraGetEditorMouseCommandValues(@GetIdeMouseCommandValues);
|
||||||
|
RegisterMouseCmdNameAndOptProcs(@EditorMouseCommandToDescriptionString,
|
||||||
|
@EditorMouseCommandToConfigString);
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
CustomKeySchemas.Free;
|
CustomKeySchemas.Free;
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,8 @@ var
|
|||||||
begin
|
begin
|
||||||
i:=0;
|
i:=0;
|
||||||
if IdentToSynMouseCmd(S, i) then begin
|
if IdentToSynMouseCmd(S, i) then begin
|
||||||
|
if i = emcOnMainGutterClick then // Now emcToggleBreakPoint;
|
||||||
|
exit;
|
||||||
s2 := MouseCommandName(i);
|
s2 := MouseCommandName(i);
|
||||||
if s2 = '' then s2 := s;
|
if s2 = '' then s2 := s;
|
||||||
ActionBox.Items.AddObject(s2, TObject(ptrint(i)));
|
ActionBox.Items.AddObject(s2, TObject(ptrint(i)));
|
||||||
|
|||||||
@ -296,6 +296,8 @@ type
|
|||||||
procedure EditorActivateSyncro(Sender: TObject);
|
procedure EditorActivateSyncro(Sender: TObject);
|
||||||
procedure EditorDeactivateSyncro(Sender: TObject);
|
procedure EditorDeactivateSyncro(Sender: TObject);
|
||||||
procedure EditorChangeUpdating({%H-}ASender: TObject; AnUpdating: Boolean);
|
procedure EditorChangeUpdating({%H-}ASender: TObject; AnUpdating: Boolean);
|
||||||
|
procedure ToggleBreakpoint(ALine: Integer);
|
||||||
|
procedure ToggleBreakpointEnabled(ALine: Integer);
|
||||||
function EditorHandleMouseAction(AnAction: TSynEditMouseAction;
|
function EditorHandleMouseAction(AnAction: TSynEditMouseAction;
|
||||||
var {%H-}AnInfo: TSynEditMouseActionInfo): Boolean;
|
var {%H-}AnInfo: TSynEditMouseActionInfo): Boolean;
|
||||||
function GetCodeBuffer: TCodeBuffer;
|
function GetCodeBuffer: TCodeBuffer;
|
||||||
@ -345,8 +347,6 @@ type
|
|||||||
|
|
||||||
procedure FocusEditor;// called by TSourceNotebook when the Notebook page
|
procedure FocusEditor;// called by TSourceNotebook when the Notebook page
|
||||||
// changes so the editor is focused
|
// changes so the editor is focused
|
||||||
procedure OnGutterClick(Sender: TObject; {%H-}X, {%H-}Y, Line: integer;
|
|
||||||
{%H-}Mark: TSynEditMark);
|
|
||||||
procedure OnEditorSpecialLineColor(Sender: TObject; Line: integer;
|
procedure OnEditorSpecialLineColor(Sender: TObject; Line: integer;
|
||||||
var Special: boolean; Markup: TSynSelectedColor);
|
var Special: boolean; Markup: TSynSelectedColor);
|
||||||
function RefreshEditorSettings: Boolean;
|
function RefreshEditorSettings: Boolean;
|
||||||
@ -4913,54 +4913,6 @@ begin
|
|||||||
ShowHelpOrErrorForSourcePosition(Filename,FEditor.LogicalCaretXY);
|
ShowHelpOrErrorForSourcePosition(Filename,FEditor.LogicalCaretXY);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.OnGutterClick(Sender: TObject; X, Y, Line: integer;
|
|
||||||
Mark: TSynEditMark);
|
|
||||||
var
|
|
||||||
Marks: PSourceMark;
|
|
||||||
i, MarkCount: Integer;
|
|
||||||
BreakFound: Boolean;
|
|
||||||
Ctrl: Boolean;
|
|
||||||
ABrkPoint: TIDEBreakPoint;
|
|
||||||
Mrk: TSourceMark;
|
|
||||||
begin
|
|
||||||
// create or delete breakpoint
|
|
||||||
// find breakpoint Mark at line
|
|
||||||
Marks := nil;
|
|
||||||
Ctrl := SYNEDIT_LINK_MODIFIER in GetKeyShiftState;
|
|
||||||
try
|
|
||||||
SourceEditorMarks.GetMarksForLine(Self, Line, Marks, MarkCount);
|
|
||||||
BreakFound := False;
|
|
||||||
for i := 0 to MarkCount - 1 do
|
|
||||||
begin
|
|
||||||
Mrk := Marks[i];
|
|
||||||
if Mrk.IsBreakPoint and
|
|
||||||
(Mrk.Data <> nil) and (Mrk.Data is TIDEBreakPoint)
|
|
||||||
then begin
|
|
||||||
BreakFound := True;
|
|
||||||
if Ctrl then
|
|
||||||
TIDEBreakPoint(Mrk.Data).Enabled := not TIDEBreakPoint(Mrk.Data).Enabled
|
|
||||||
else
|
|
||||||
DebugBoss.DoDeleteBreakPointAtMark(Mrk)
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
FreeMem(Marks);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if not BreakFound then begin
|
|
||||||
DebugBoss.LockCommandProcessing;
|
|
||||||
try
|
|
||||||
DebugBoss.DoCreateBreakPoint(Filename, Line, True, ABrkPoint, True);
|
|
||||||
if Ctrl and (ABrkPoint <> nil)
|
|
||||||
then ABrkPoint.Enabled := False;
|
|
||||||
finally
|
|
||||||
if ABrkPoint <> nil then
|
|
||||||
ABrkPoint.EndUpdate;
|
|
||||||
DebugBoss.UnLockCommandProcessing;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceEditor.OnEditorSpecialLineColor(Sender: TObject; Line: integer;
|
procedure TSourceEditor.OnEditorSpecialLineColor(Sender: TObject; Line: integer;
|
||||||
var Special: boolean; Markup: TSynSelectedColor);
|
var Special: boolean; Markup: TSynSelectedColor);
|
||||||
var
|
var
|
||||||
@ -5323,7 +5275,6 @@ Begin
|
|||||||
OnProcessUserCommand := @ProcessUserCommand;
|
OnProcessUserCommand := @ProcessUserCommand;
|
||||||
OnCommandProcessed := @UserCommandProcessed;
|
OnCommandProcessed := @UserCommandProcessed;
|
||||||
OnReplaceText := @OnReplace;
|
OnReplaceText := @OnReplace;
|
||||||
OnGutterClick := @Self.OnGutterClick;
|
|
||||||
OnSpecialLineMarkup := @OnEditorSpecialLineColor;
|
OnSpecialLineMarkup := @OnEditorSpecialLineColor;
|
||||||
OnMouseMove := @EditorMouseMoved;
|
OnMouseMove := @EditorMouseMoved;
|
||||||
OnMouseWheel := @EditorMouseWheel;
|
OnMouseWheel := @EditorMouseWheel;
|
||||||
@ -5841,17 +5792,55 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditor.ToggleBreakpoint(ALine: Integer);
|
||||||
|
var
|
||||||
|
BreakPtMark: TSourceMark;
|
||||||
|
begin
|
||||||
|
BreakPtMark := SourceEditorMarks.FindBreakPointMark(Self, ALine);
|
||||||
|
if BreakPtMark = nil then
|
||||||
|
DebugBoss.DoCreateBreakPoint(Filename, ALine, True)
|
||||||
|
else
|
||||||
|
DebugBoss.DoDeleteBreakPointAtMark(BreakPtMark);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditor.ToggleBreakpointEnabled(ALine: Integer);
|
||||||
|
var
|
||||||
|
BreakPtMark: TSourceMark;
|
||||||
|
BreakPoint: TIDEBreakPoint;
|
||||||
|
begin
|
||||||
|
BreakPtMark := SourceEditorMarks.FindBreakPointMark(Self, ALine);
|
||||||
|
if BreakPtMark = nil then begin
|
||||||
|
DebugBoss.LockCommandProcessing;
|
||||||
|
try
|
||||||
|
DebugBoss.DoCreateBreakPoint(Filename, ALine, True, BreakPoint, True);
|
||||||
|
if BreakPoint <> nil then begin
|
||||||
|
BreakPoint.Enabled := False;
|
||||||
|
BreakPoint.EndUpdate;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
DebugBoss.UnLockCommandProcessing;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if BreakPtMark.Data <> nil
|
||||||
|
then BreakPoint := TIDEBreakPoint(BreakPtMark.Data)
|
||||||
|
else BreakPoint := DebugBoss.BreakPoints.Find(FileName, ALine);
|
||||||
|
if BreakPoint <> nil then
|
||||||
|
BreakPoint.Enabled := not BreakPoint.Enabled;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSourceEditor.EditorHandleMouseAction(AnAction: TSynEditMouseAction;
|
function TSourceEditor.EditorHandleMouseAction(AnAction: TSynEditMouseAction;
|
||||||
var AnInfo: TSynEditMouseActionInfo): Boolean;
|
var AnInfo: TSynEditMouseActionInfo): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := AnAction.Command = emcContextMenu;
|
Result := True;
|
||||||
if not Result then exit;
|
|
||||||
|
|
||||||
|
if AnAction.Command = emcContextMenu then begin
|
||||||
case AnAction.Option2 of
|
case AnAction.Option2 of
|
||||||
1: FMouseActionPopUpMenu := SourceNotebook.DbgPopUpMenu;
|
1: FMouseActionPopUpMenu := SourceNotebook.DbgPopUpMenu;
|
||||||
2: FMouseActionPopUpMenu := SourceNotebook.TabPopUpMenu;
|
2: FMouseActionPopUpMenu := SourceNotebook.TabPopUpMenu;
|
||||||
else
|
else FMouseActionPopUpMenu := PopupMenu;
|
||||||
FMouseActionPopUpMenu := PopupMenu;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (not FInEditorChangedUpdating) and (FMouseActionPopUpMenu <> nil) then begin
|
if (not FInEditorChangedUpdating) and (FMouseActionPopUpMenu <> nil) then begin
|
||||||
@ -5859,6 +5848,21 @@ begin
|
|||||||
FMouseActionPopUpMenu.PopUp;
|
FMouseActionPopUpMenu.PopUp;
|
||||||
FMouseActionPopUpMenu := nil;
|
FMouseActionPopUpMenu := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if AnAction.Command = emcToggleBreakPoint then begin
|
||||||
|
ToggleBreakpoint(AnInfo.NewCaret.LinePos);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if AnAction.Command = emcToggleBreakPointEnabled then begin
|
||||||
|
ToggleBreakpointEnabled(AnInfo.NewCaret.LinePos);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.EditorMouseMoved(Sender: TObject; Shift: TShiftState;
|
procedure TSourceEditor.EditorMouseMoved(Sender: TObject; Shift: TShiftState;
|
||||||
@ -6560,7 +6564,6 @@ begin
|
|||||||
OnProcessUserCommand := nil;
|
OnProcessUserCommand := nil;
|
||||||
OnCommandProcessed := nil;
|
OnCommandProcessed := nil;
|
||||||
OnReplaceText := nil;
|
OnReplaceText := nil;
|
||||||
OnGutterClick := nil;
|
|
||||||
OnSpecialLineMarkup := nil;
|
OnSpecialLineMarkup := nil;
|
||||||
OnMouseMove := nil;
|
OnMouseMove := nil;
|
||||||
OnMouseWheel := nil;
|
OnMouseWheel := nil;
|
||||||
@ -8521,19 +8524,11 @@ end;
|
|||||||
procedure TSourceNotebook.ToggleBreakpointClicked(Sender: TObject);
|
procedure TSourceNotebook.ToggleBreakpointClicked(Sender: TObject);
|
||||||
var
|
var
|
||||||
ASrcEdit: TSourceEditor;
|
ASrcEdit: TSourceEditor;
|
||||||
Line: LongInt;
|
|
||||||
BreakPtMark: TSourceMark;
|
|
||||||
begin
|
begin
|
||||||
|
// create or delete breakpoint
|
||||||
ASrcEdit:=GetActiveSE;
|
ASrcEdit:=GetActiveSE;
|
||||||
if ASrcEdit=nil then exit;
|
if ASrcEdit=nil then exit;
|
||||||
// create or delete breakpoint
|
ASrcEdit.ToggleBreakpoint(ASrcEdit.EditorComponent.CaretY);
|
||||||
// find breakpoint mark at line
|
|
||||||
Line:=ASrcEdit.EditorComponent.CaretY;
|
|
||||||
BreakPtMark := SourceEditorMarks.FindBreakPointMark(ASrcEdit, Line);
|
|
||||||
if BreakPtMark = nil then
|
|
||||||
DebugBoss.DoCreateBreakPoint(ASrcEdit.Filename,Line,true)
|
|
||||||
else
|
|
||||||
DebugBoss.DoDeleteBreakPointAtMark(BreakPtMark);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.ToggleBreakpointEnabledClicked(Sender: TObject);
|
procedure TSourceNotebook.ToggleBreakpointEnabledClicked(Sender: TObject);
|
||||||
@ -8545,22 +8540,7 @@ var
|
|||||||
begin
|
begin
|
||||||
ASrcEdit:=GetActiveSE;
|
ASrcEdit:=GetActiveSE;
|
||||||
if ASrcEdit=nil then exit;
|
if ASrcEdit=nil then exit;
|
||||||
// create or delete breakpoint
|
ASrcEdit.ToggleBreakpointEnabled(ASrcEdit.EditorComponent.CaretY);
|
||||||
// find breakpoint mark at line
|
|
||||||
Line:=ASrcEdit.EditorComponent.CaretY;
|
|
||||||
BreakPtMark := SourceEditorMarks.FindBreakPointMark(ASrcEdit, Line);
|
|
||||||
if BreakPtMark = nil then begin
|
|
||||||
DebugBoss.DoCreateBreakPoint(ASrcEdit.Filename,Line,true, BreakPoint, True);
|
|
||||||
if BreakPoint <> nil then begin
|
|
||||||
BreakPoint.Enabled := False;
|
|
||||||
BreakPoint.EndUpdate;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
BreakPoint := DebugBoss.BreakPoints.Find(ASrcEdit.FileName, Line);
|
|
||||||
BreakPoint.Enabled := not BreakPoint.Enabled;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.CompleteCodeMenuItemClick(Sender: TObject);
|
procedure TSourceNotebook.CompleteCodeMenuItemClick(Sender: TObject);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user