mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:56:00 +02: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
|
||||
ecIdePSyncroEdSelStart = ecFirstPlugin + 90;
|
||||
|
||||
const
|
||||
// Mouse command offsets
|
||||
emcOffsetToggleBreakPoint = 0;
|
||||
emcOffsetToggleBreakPointEnabled = 1;
|
||||
|
||||
var
|
||||
emcToggleBreakPoint,
|
||||
emcToggleBreakPointEnabled : integer;
|
||||
|
||||
const
|
||||
emcIdeMouseCommandsCount = 2;
|
||||
|
||||
type
|
||||
TIDECommand = class;
|
||||
@ -855,6 +866,14 @@ function IDECommandToIdent(Cmd: longint; var Ident: string): boolean;
|
||||
function IDECommandToIdent(Cmd: longint): string;
|
||||
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
|
||||
|
||||
function IDEShortCut(Key1: word; Shift1: TShiftState;
|
||||
@ -2352,5 +2371,44 @@ begin
|
||||
Proc(IDEEditorCommandStrs[I].Name);
|
||||
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.
|
||||
|
||||
|
@ -285,6 +285,7 @@ type
|
||||
|
||||
function DoDeleteBreakPoint(const AFilename: string;
|
||||
ALine: integer): TModalResult; override;
|
||||
function DoDeleteBreakPoint(ABrkPoint: TIDEBreakPoint): TModalResult;
|
||||
function DoDeleteBreakPointAtMark(const ASourceMarkObj: TObject): TModalResult; override;
|
||||
|
||||
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override;
|
||||
@ -3160,7 +3161,12 @@ begin
|
||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||
exit(mrCancel);
|
||||
|
||||
ABrkPoint := FBreakPoints.Add(AFilename, ALine, AnUpdating);
|
||||
LockCommandProcessing;
|
||||
try
|
||||
ABrkPoint := FBreakPoints.Add(AFilename, ALine, AnUpdating);
|
||||
finally
|
||||
UnLockCommandProcessing;
|
||||
end;
|
||||
Result := mrOK;
|
||||
end;
|
||||
|
||||
@ -3172,8 +3178,12 @@ begin
|
||||
if WarnIfNoDebugger and not DoSetBreakkPointWarnIfNoDebugger then
|
||||
exit(mrCancel);
|
||||
|
||||
ABrkPoint := FBreakPoints.Add(AnAddr, AnUpdating);
|
||||
Result := mrOK;
|
||||
LockCommandProcessing;
|
||||
try
|
||||
ABrkPoint := FBreakPoints.Add(AnAddr, AnUpdating);
|
||||
finally
|
||||
UnLockCommandProcessing;
|
||||
end; Result := mrOK;
|
||||
end;
|
||||
|
||||
function TDebugManager.DoDeleteBreakPoint(const AFilename: string;
|
||||
@ -3193,6 +3203,19 @@ begin
|
||||
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
|
||||
): TModalResult;
|
||||
var
|
||||
@ -3216,9 +3239,7 @@ begin
|
||||
DebugLn('TDebugManager.DoDeleteBreakPointAtMark B ',OldBreakPoint.ClassName,
|
||||
' ',OldBreakPoint.Source,' ',IntToStr(OldBreakPoint.Line));
|
||||
{$endif}
|
||||
ReleaseRefAndNil(OldBreakPoint);
|
||||
Project1.Modified:=true;
|
||||
Result := mrOK;
|
||||
Result := DoDeleteBreakPoint(OldBreakPoint);
|
||||
finally
|
||||
UnLockCommandProcessing;
|
||||
end;
|
||||
|
@ -984,6 +984,7 @@ type
|
||||
procedure Assign(Src: TEditorMouseOptions); reintroduce;
|
||||
function IsPresetEqualToMouseActions: 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 SaveToXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||
procedure ImportFromXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||
@ -3701,7 +3702,8 @@ begin
|
||||
end;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@ -4237,42 +4239,50 @@ begin
|
||||
FCustomSavedActions := Result;
|
||||
end;
|
||||
|
||||
procedure TEditorMouseOptions.LoadFromXmlMouseAct(aXMLConfig: TRttiXMLConfig;
|
||||
Path: String; MActions: TSynEditMouseActions; AShowError: Boolean);
|
||||
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);
|
||||
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);
|
||||
finally
|
||||
MActions.DecAssertLock;
|
||||
end;
|
||||
MActions.AssertNoConflict(MAct);
|
||||
except
|
||||
MActions.Delete(MActions.Count-1);
|
||||
if AShowError then
|
||||
IDEMessageDialog(dlgMouseOptErrorDup, dlgMouseOptErrorDupText + LineEnding
|
||||
+ Path + 'M' + IntToStr(i) + LineEnding + MAct.DisplayName,
|
||||
mtError, [mbOk]);
|
||||
end;
|
||||
end;
|
||||
Mact.Free;
|
||||
|
||||
end;
|
||||
|
||||
procedure TEditorMouseOptions.LoadFromXml(aXMLConfig: TRttiXMLConfig; aPath: String;
|
||||
aOldPath: String; FileVersion: Integer);
|
||||
|
||||
Procedure LoadMouseAct(Path: String; MActions: TSynEditMouseActions);
|
||||
var
|
||||
c, i: Integer;
|
||||
MAct: TSynEditMouseActionKeyCmdHelper;
|
||||
//ErrShown: Boolean;
|
||||
begin
|
||||
//ErrShown := False;
|
||||
MActions.Clear;
|
||||
MAct := TSynEditMouseActionKeyCmdHelper.Create(nil);
|
||||
|
||||
c := aXMLConfig.GetValue(Path + 'Count', 0);
|
||||
for i := 0 to c - 1 do begin
|
||||
try
|
||||
MActions.IncAssertLock;
|
||||
try
|
||||
// If the object would ever be extended, old configs will not have all properties.
|
||||
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);
|
||||
//if not ErrShown then
|
||||
// IDEMessageDialog(dlgMouseOptErrorDup, dlgMouseOptErrorDupText, mtError, [mbOk]);
|
||||
//ErrShown := True;
|
||||
end;
|
||||
end;
|
||||
MAct.Free;
|
||||
end;
|
||||
|
||||
var
|
||||
AltColumnMode: Boolean;
|
||||
TextDoubleSelLine: Boolean;
|
||||
@ -4324,17 +4334,17 @@ begin
|
||||
|
||||
if CustomSavedActions then begin
|
||||
// Load
|
||||
LoadMouseAct(aPath + 'Main/', MainActions);
|
||||
LoadMouseAct(aPath + 'MainText/', TextActions);
|
||||
LoadMouseAct(aPath + 'MainSelection/', SelActions);
|
||||
LoadMouseAct(aPath + 'Gutter/', GutterActions);
|
||||
LoadMouseAct(aPath + 'GutterFold/', GutterActionsFold);
|
||||
LoadMouseAct(aPath + 'GutterFoldExp/', GutterActionsFoldExp);
|
||||
LoadMouseAct(aPath + 'GutterFoldCol/', GutterActionsFoldCol);
|
||||
LoadMouseAct(aPath + 'GutterLineNum/', GutterActionsLines);
|
||||
LoadMouseAct(aPath + 'GutterLineChange/', GutterActionsChanges);
|
||||
LoadMouseAct(aPath + 'GutterOverView/', GutterActionsOverView);
|
||||
LoadMouseAct(aPath + 'GutterOverViewMarks/', GutterActionsOverViewMarks);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Main/', MainActions);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainText/', TextActions);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainSelection/', SelActions);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Gutter/', GutterActions);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFold/', GutterActionsFold);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldExp/', GutterActionsFoldExp);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldCol/', GutterActionsFoldCol);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineNum/', GutterActionsLines);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineChange/', GutterActionsChanges);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverView/', GutterActionsOverView);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverViewMarks/', GutterActionsOverViewMarks);
|
||||
|
||||
if Version < 1 then begin
|
||||
try
|
||||
@ -4411,48 +4421,18 @@ begin
|
||||
end;
|
||||
|
||||
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
|
||||
LoadMouseAct(aPath + 'Main/', MainActions);
|
||||
LoadMouseAct(aPath + 'MainText/', TextActions);
|
||||
LoadMouseAct(aPath + 'MainSel/', SelActions);
|
||||
LoadMouseAct(aPath + 'Gutter/', GutterActions);
|
||||
LoadMouseAct(aPath + 'GutterFold/', GutterActionsFold);
|
||||
LoadMouseAct(aPath + 'GutterFoldExp/', GutterActionsFoldExp);
|
||||
LoadMouseAct(aPath + 'GutterFoldCol/', GutterActionsFoldCol);
|
||||
LoadMouseAct(aPath + 'GutterLineNum/', GutterActionsLines);
|
||||
LoadMouseAct(aPath + 'GutterLineChange/', GutterActionsChanges);
|
||||
LoadMouseAct(aPath + 'GutterOverView/', GutterActionsOverView);
|
||||
LoadMouseAct(aPath + 'GutterOverViewMarks/',GutterActionsOverViewMarks);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Main/', MainActions, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainText/', TextActions, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'MainSel/', SelActions, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'Gutter/', GutterActions, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFold/', GutterActionsFold, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldExp/', GutterActionsFoldExp, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterFoldCol/', GutterActionsFoldCol, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineNum/', GutterActionsLines, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterLineChange/', GutterActionsChanges, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverView/', GutterActionsOverView, True);
|
||||
LoadFromXmlMouseAct(aXMLConfig, aPath + 'GutterOverViewMarks/',GutterActionsOverViewMarks, True);
|
||||
end;
|
||||
|
||||
procedure TEditorMouseOptions.ExportToXml(aXMLConfig: TRttiXMLConfig; aPath: String);
|
||||
|
@ -38,7 +38,8 @@ uses
|
||||
// LazUtils
|
||||
Laz2_XMLCfg, FileUtil,
|
||||
// SynEdit
|
||||
SynEditKeyCmds, SynPluginTemplateEdit, SynPluginSyncroEdit, SynPluginMultiCaret,
|
||||
SynEditKeyCmds, SynPluginTemplateEdit, SynPluginSyncroEdit,
|
||||
SynPluginMultiCaret, SynEditMouseCmds,
|
||||
// IdeIntf
|
||||
IDECommands,
|
||||
// IDE
|
||||
@ -227,6 +228,8 @@ type
|
||||
function IDEShortCutEmpty(const Key: TIDEShortCut): boolean;
|
||||
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
|
||||
function EditorCommandToDescriptionString(cmd: word): String;
|
||||
function EditorMouseCommandToDescriptionString(cmd: TSynEditorMouseCommand): String;
|
||||
function EditorMouseCommandToConfigString(cmd: TSynEditorMouseCommand): String;
|
||||
|
||||
function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
|
||||
|
||||
@ -955,6 +958,22 @@ begin
|
||||
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;
|
||||
Brackets: Char): String;
|
||||
function AddBrakets(S: String): String;
|
||||
@ -4417,6 +4436,13 @@ initialization
|
||||
CustomKeySchemas := TStringList.Create;
|
||||
CustomKeySchemas.OwnsObjects := true;
|
||||
|
||||
emcIdeMouseCommandOffset := AllocatePluginMouseRange(emcIdeMouseCommandsCount);
|
||||
RegisterMouseCmdIdentProcs(@IdentToIDEMouseCommand,
|
||||
@IDEMouseCommandToIdent);
|
||||
RegisterExtraGetEditorMouseCommandValues(@GetIdeMouseCommandValues);
|
||||
RegisterMouseCmdNameAndOptProcs(@EditorMouseCommandToDescriptionString,
|
||||
@EditorMouseCommandToConfigString);
|
||||
|
||||
finalization
|
||||
CustomKeySchemas.Free;
|
||||
|
||||
|
@ -102,6 +102,8 @@ var
|
||||
begin
|
||||
i:=0;
|
||||
if IdentToSynMouseCmd(S, i) then begin
|
||||
if i = emcOnMainGutterClick then // Now emcToggleBreakPoint;
|
||||
exit;
|
||||
s2 := MouseCommandName(i);
|
||||
if s2 = '' then s2 := s;
|
||||
ActionBox.Items.AddObject(s2, TObject(ptrint(i)));
|
||||
|
@ -296,6 +296,8 @@ type
|
||||
procedure EditorActivateSyncro(Sender: TObject);
|
||||
procedure EditorDeactivateSyncro(Sender: TObject);
|
||||
procedure EditorChangeUpdating({%H-}ASender: TObject; AnUpdating: Boolean);
|
||||
procedure ToggleBreakpoint(ALine: Integer);
|
||||
procedure ToggleBreakpointEnabled(ALine: Integer);
|
||||
function EditorHandleMouseAction(AnAction: TSynEditMouseAction;
|
||||
var {%H-}AnInfo: TSynEditMouseActionInfo): Boolean;
|
||||
function GetCodeBuffer: TCodeBuffer;
|
||||
@ -345,8 +347,6 @@ type
|
||||
|
||||
procedure FocusEditor;// called by TSourceNotebook when the Notebook page
|
||||
// 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;
|
||||
var Special: boolean; Markup: TSynSelectedColor);
|
||||
function RefreshEditorSettings: Boolean;
|
||||
@ -4913,54 +4913,6 @@ begin
|
||||
ShowHelpOrErrorForSourcePosition(Filename,FEditor.LogicalCaretXY);
|
||||
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;
|
||||
var Special: boolean; Markup: TSynSelectedColor);
|
||||
var
|
||||
@ -5323,7 +5275,6 @@ Begin
|
||||
OnProcessUserCommand := @ProcessUserCommand;
|
||||
OnCommandProcessed := @UserCommandProcessed;
|
||||
OnReplaceText := @OnReplace;
|
||||
OnGutterClick := @Self.OnGutterClick;
|
||||
OnSpecialLineMarkup := @OnEditorSpecialLineColor;
|
||||
OnMouseMove := @EditorMouseMoved;
|
||||
OnMouseWheel := @EditorMouseWheel;
|
||||
@ -5841,24 +5792,77 @@ begin
|
||||
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;
|
||||
var AnInfo: TSynEditMouseActionInfo): Boolean;
|
||||
begin
|
||||
Result := AnAction.Command = emcContextMenu;
|
||||
if not Result then exit;
|
||||
Result := True;
|
||||
|
||||
case AnAction.Option2 of
|
||||
1: FMouseActionPopUpMenu := SourceNotebook.DbgPopUpMenu;
|
||||
2: FMouseActionPopUpMenu := SourceNotebook.TabPopUpMenu;
|
||||
else
|
||||
FMouseActionPopUpMenu := PopupMenu;
|
||||
if AnAction.Command = emcContextMenu then begin
|
||||
case AnAction.Option2 of
|
||||
1: FMouseActionPopUpMenu := SourceNotebook.DbgPopUpMenu;
|
||||
2: FMouseActionPopUpMenu := SourceNotebook.TabPopUpMenu;
|
||||
else FMouseActionPopUpMenu := PopupMenu;
|
||||
end;
|
||||
|
||||
if (not FInEditorChangedUpdating) and (FMouseActionPopUpMenu <> nil) then begin
|
||||
FMouseActionPopUpMenu.PopupComponent := FEditor;
|
||||
FMouseActionPopUpMenu.PopUp;
|
||||
FMouseActionPopUpMenu := nil;
|
||||
end;
|
||||
|
||||
exit;
|
||||
end;
|
||||
|
||||
if (not FInEditorChangedUpdating) and (FMouseActionPopUpMenu <> nil) then begin
|
||||
FMouseActionPopUpMenu.PopupComponent := FEditor;
|
||||
FMouseActionPopUpMenu.PopUp;
|
||||
FMouseActionPopUpMenu := nil;
|
||||
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;
|
||||
|
||||
procedure TSourceEditor.EditorMouseMoved(Sender: TObject; Shift: TShiftState;
|
||||
@ -6560,7 +6564,6 @@ begin
|
||||
OnProcessUserCommand := nil;
|
||||
OnCommandProcessed := nil;
|
||||
OnReplaceText := nil;
|
||||
OnGutterClick := nil;
|
||||
OnSpecialLineMarkup := nil;
|
||||
OnMouseMove := nil;
|
||||
OnMouseWheel := nil;
|
||||
@ -8521,19 +8524,11 @@ end;
|
||||
procedure TSourceNotebook.ToggleBreakpointClicked(Sender: TObject);
|
||||
var
|
||||
ASrcEdit: TSourceEditor;
|
||||
Line: LongInt;
|
||||
BreakPtMark: TSourceMark;
|
||||
begin
|
||||
// create or delete breakpoint
|
||||
ASrcEdit:=GetActiveSE;
|
||||
if ASrcEdit=nil then exit;
|
||||
// create or delete breakpoint
|
||||
// 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);
|
||||
ASrcEdit.ToggleBreakpoint(ASrcEdit.EditorComponent.CaretY);
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.ToggleBreakpointEnabledClicked(Sender: TObject);
|
||||
@ -8545,22 +8540,7 @@ var
|
||||
begin
|
||||
ASrcEdit:=GetActiveSE;
|
||||
if ASrcEdit=nil then exit;
|
||||
// create or delete breakpoint
|
||||
// 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;
|
||||
ASrcEdit.ToggleBreakpointEnabled(ASrcEdit.EditorComponent.CaretY);
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.CompleteCodeMenuItemClick(Sender: TObject);
|
||||
|
Loading…
Reference in New Issue
Block a user