1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
}
unit debugger_general_options;
{$mode objfpc}{$H+}
interface
uses
SysUtils,
// LCL
Controls, StdCtrls, ExtCtrls, Dialogs, Menus,
// LazUtils
FileUtil, LazFileUtils,
// IdeIntf
IDEOptionsIntf, IDEOptEditorIntf,
// IdeConfig
SearchPathProcs, EnvironmentOpts, IDEProcs,
// IdeDebugger
BaseDebugManager, IdeDebuggerOpts, EnvDebuggerOptions,
// IDE
LazarusIDEStrConsts, PathEditorDlg;
type
{ TDebuggerGeneralOptionsFrame }
TDebuggerGeneralOptionsFrame = class(TAbstractIDEOptionsEditor)
cmdOpenAdditionalPath: TButton;
gbAdditionalSearchPath: TGroupBox;
gcbDebuggerGeneralOptions: TCheckGroup;
gcbDebuggerDialogSettings: TCheckGroup;
txtAdditionalPath: TEdit;
procedure cmdOpenAdditionalPathClick(Sender: TObject);
private
fOldDebuggerSearchPath: string;
procedure FetchDebuggerGeneralOptions;
public
function Check: Boolean; override;
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
procedure RestoreSettings({%H-}AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
implementation
{$R *.lfm}
{ TDebuggerGeneralOptionsFrame }
procedure TDebuggerGeneralOptionsFrame.cmdOpenAdditionalPathClick(
Sender: TObject);
begin
PathEditorDialog.Path:=txtAdditionalPath.Text;
PathEditorDialog.Templates:=GetForcedPathDelims(
'$(LazarusDir)/include/$(TargetOS)'
+';$(FPCSrcDir)/rtl/inc/'
+';$(FPCSrcDir)/rtl/$(SrcOS)'
+';$(FPCSrcDir)/rtl/$(TargetOS)'
);
if PathEditorDialog.ShowModal=mrOk then
txtAdditionalPath.Text:=PathEditorDialog.Path;
end;
procedure TDebuggerGeneralOptionsFrame.FetchDebuggerGeneralOptions;
begin
with EnvironmentDebugOpts do
begin
// IMPORTANT if more items are added the indexes must be updated here!
gcbDebuggerGeneralOptions.Checked[0] := DebuggerResetAfterRun;
gcbDebuggerGeneralOptions.Checked[1] := DebuggerAutoCloseAsm;
gcbDebuggerGeneralOptions.Checked[2] := DebuggerAutoSetInstanceFromClass;
gcbDebuggerGeneralOptions.Checked[3] := DebuggerAllowFunctionCalls;
gcbDebuggerGeneralOptions.Checked[4] := DebuggerOptions.AlwaysBringDbgDialogsToFront;
gcbDebuggerDialogSettings.Checked[0] := DebuggerShowStopMessage;
gcbDebuggerDialogSettings.Checked[1] := DebuggerShowExitCodeMessage;
gcbDebuggerDialogSettings.Checked[2] := ConfirmDeleteAllWatches;
gcbDebuggerDialogSettings.Checked[3] := ConfirmDeleteAllBreakPoints;
gcbDebuggerDialogSettings.Checked[4] := ConfirmDeleteFileBreakPoints;
gcbDebuggerDialogSettings.Checked[5] := ConfirmDeleteAllHistory;
end;
txtAdditionalPath.Text:=EnvironmentOptions.GetParsedDebuggerSearchPath;
end;
function TDebuggerGeneralOptionsFrame.Check: Boolean;
begin
Result := true;
end;
function TDebuggerGeneralOptionsFrame.GetTitle: String;
begin
Result := lisGeneral;
end;
procedure TDebuggerGeneralOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
gbAdditionalSearchPath.Caption := lisDebugOptionsFrmAdditionalSearchPath;
gcbDebuggerGeneralOptions.Caption := lisDebugOptionsFrmDebuggerGeneralOptions;
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmResetDebuggerOnEachRun); // 0 reset dbg after each run
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmAutoCloseAsm); // 1 auto close asm
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmAutoInstanceClass); // 2 auto set class-from-instance
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmAllowFunctionCalls); // 3 allow function calls
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmDialogsToFront); // 4 bring dialogs to front
gcbDebuggerDialogSettings.Caption := lisDebugOptionsFrmDebuggerDialogSettings;
gcbDebuggerDialogSettings.Items.Add(lisDebugOptionsFrmShowMessageOnStop); // 0 Message on stop
gcbDebuggerDialogSettings.Items.Add(lisDebugOptionsFrmShowExitCodeOnStop); // 1 Exit-code on stop
gcbDebuggerDialogSettings.Items.Add(lisDebugDialogConfirmDelWatches); // Confirm delete watches
gcbDebuggerDialogSettings.Items.Add(lisDebugDialogConfirmDelBreaks); // Confirm delete breakpoints
gcbDebuggerDialogSettings.Items.Add(lisDebugDialogConfirmDelBreaksFile); // Confirm delete breakpoints in same file
gcbDebuggerDialogSettings.Items.Add(lisDebugDialogConfirmDelHistory); // Confirm delete history
end;
procedure TDebuggerGeneralOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin
with EnvironmentOptions do
begin
fOldDebuggerSearchPath := DebuggerSearchPath;
FetchDebuggerGeneralOptions;
end;
end;
procedure TDebuggerGeneralOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
EnvironmentOptions.DebuggerSearchPath := TrimSearchPath(txtAdditionalPath.Text,'');
with EnvironmentDebugOpts do
begin
// IMPORTANT if more items are added the indexes must be updated here!
DebuggerResetAfterRun := gcbDebuggerGeneralOptions.Checked[0];
DebuggerAutoCloseAsm := gcbDebuggerGeneralOptions.Checked[1];
DebuggerAutoSetInstanceFromClass := gcbDebuggerGeneralOptions.Checked[2];
DebuggerAllowFunctionCalls := gcbDebuggerGeneralOptions.Checked[3];
DebuggerOptions.AlwaysBringDbgDialogsToFront := gcbDebuggerGeneralOptions.Checked[4];
DebuggerShowStopMessage := gcbDebuggerDialogSettings.Checked[0];
DebuggerShowExitCodeMessage := gcbDebuggerDialogSettings.Checked[1];
ConfirmDeleteAllWatches := gcbDebuggerDialogSettings.Checked[2];
ConfirmDeleteAllBreakPoints := gcbDebuggerDialogSettings.Checked[3];
ConfirmDeleteFileBreakPoints := gcbDebuggerDialogSettings.Checked[4];
ConfirmDeleteAllHistory := gcbDebuggerDialogSettings.Checked[5];
end;
end;
procedure TDebuggerGeneralOptionsFrame.RestoreSettings(
AOptions: TAbstractIDEOptions);
begin
with EnvironmentOptions do begin
DebuggerSearchPath := fOldDebuggerSearchPath;
end;
end;
class function TDebuggerGeneralOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TDebuggerOptions;
end;
initialization
RegisterIDEOptionsEditor(GroupDebugger, TDebuggerGeneralOptionsFrame, DbgOptionsGeneral);
end.
|