diff --git a/.gitattributes b/.gitattributes index a5ea2b43dc..59b48df63d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1596,6 +1596,9 @@ debugger/debugoptionsfrm.pas svneol=native#text/pascal debugger/evaluatedlg.lfm svneol=native#text/plain debugger/evaluatedlg.lrs svneol=native#text/pascal debugger/evaluatedlg.pp svneol=native#text/pascal +debugger/frames/options_debugger_general.lfm svneol=native#text/plain +debugger/frames/options_debugger_general.lrs svneol=native#text/pascal +debugger/frames/options_debugger_general.pas svneol=native#text/pascal debugger/gdbdebugger.pp svneol=native#text/pascal debugger/gdbmidebugger.pp svneol=native#text/pascal debugger/gdbtypeinfo.pp svneol=native#text/pascal diff --git a/debugger/frames/options_debugger_general.lfm b/debugger/frames/options_debugger_general.lfm new file mode 100644 index 0000000000..c2943fda0a --- /dev/null +++ b/debugger/frames/options_debugger_general.lfm @@ -0,0 +1,196 @@ +inherited DebuggerGeneralOptionsFrame: TDebuggerGeneralOptionsFrame + Height = 427 + Width = 519 + ClientHeight = 427 + ClientWidth = 519 + Visible = False + DesignLeft = 110 + DesignTop = 145 + object gbDebuggerType: TGroupBox[0] + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 78 + Top = 0 + Width = 519 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight] + AutoSize = True + Caption = 'Debugger type and path' + ClientHeight = 60 + ClientWidth = 515 + Ctl3D = False + ParentCtl3D = False + TabOrder = 0 + object cmdOpenDebuggerPath: TSpeedButton + AnchorSideTop.Control = cmbDebuggerPath + AnchorSideRight.Control = gbDebuggerType + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = cmbDebuggerPath + AnchorSideBottom.Side = asrBottom + Left = 486 + Height = 21 + Top = 33 + Width = 23 + HelpContext = 0 + Anchors = [akTop, akRight, akBottom] + BorderSpacing.Right = 6 + Caption = '...' + Color = clBtnFace + NumGlyphs = 0 + end + object cmbDebuggerType: TComboBox + AnchorSideLeft.Control = gbDebuggerType + AnchorSideTop.Control = gbDebuggerType + AnchorSideRight.Control = gbDebuggerType + AnchorSideRight.Side = asrBottom + Left = 6 + Height = 21 + Top = 6 + Width = 503 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight] + AutoComplete = False + BorderSpacing.Around = 6 + Ctl3D = False + ItemHeight = 13 + ItemWidth = 0 + OnEditingDone = cmbDebuggerTypeEditingDone + OnSelect = cmbDebuggerTypeEditingDone + ParentCtl3D = False + TabOrder = 0 + end + object cmbDebuggerPath: TComboBox + AnchorSideLeft.Control = gbDebuggerType + AnchorSideTop.Control = cmbDebuggerType + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 21 + Top = 33 + Width = 474 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight] + AutoComplete = False + BorderSpacing.Around = 6 + Ctl3D = False + ItemHeight = 13 + ItemWidth = 0 + ParentCtl3D = False + TabOrder = 1 + end + end + object gbAdditionalSearchPath: TGroupBox[1] + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = gbDebuggerType + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 51 + Top = 84 + Width = 519 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight] + AutoSize = True + BorderSpacing.Top = 6 + Caption = 'Additional search path' + ClientHeight = 33 + ClientWidth = 515 + Ctl3D = False + ParentCtl3D = False + TabOrder = 1 + object cmdOpenAdditionalPath: TSpeedButton + AnchorSideTop.Control = txtAdditionalPath + AnchorSideRight.Control = gbAdditionalSearchPath + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = txtAdditionalPath + AnchorSideBottom.Side = asrBottom + Left = 486 + Height = 21 + Top = 6 + Width = 23 + HelpContext = 0 + Anchors = [akTop, akRight, akBottom] + BorderSpacing.Right = 6 + Caption = '...' + Color = clBtnFace + NumGlyphs = 0 + end + object txtAdditionalPath: TEdit + AnchorSideLeft.Control = gbAdditionalSearchPath + AnchorSideTop.Control = gbAdditionalSearchPath + Left = 6 + Height = 21 + Top = 6 + Width = 474 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + TabOrder = 0 + end + end + object gcbDebuggerGeneralOptions: TCheckGroup[2] + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = gbAdditionalSearchPath + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 56 + Top = 141 + Width = 519 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight] + AutoFill = True + BorderSpacing.Top = 6 + Caption = 'Debugger general options' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + Ctl3D = False + TabOrder = 2 + end + object gbDebuggerSpecific: TGroupBox[3] + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = gcbDebuggerGeneralOptions + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 0 + Height = 224 + Top = 203 + Width = 519 + HelpContext = 0 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Top = 6 + Caption = 'Debugger specific options (depends on type of debugger)' + ClientHeight = 206 + ClientWidth = 515 + Ctl3D = False + ParentCtl3D = False + TabOrder = 3 + object pnlDebugSpecific: TPanel + Left = 6 + Height = 194 + Top = 6 + Width = 503 + HelpContext = 0 + Align = alClient + BorderSpacing.Around = 6 + BevelOuter = bvNone + BorderWidth = 4 + FullRepaint = False + TabOrder = 0 + TabStop = True + end + end +end diff --git a/debugger/frames/options_debugger_general.lrs b/debugger/frames/options_debugger_general.lrs new file mode 100644 index 0000000000..040598b440 --- /dev/null +++ b/debugger/frames/options_debugger_general.lrs @@ -0,0 +1,75 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TDebuggerGeneralOptionsFrame','FORMDATA',[ + 'TPF0'#241#28'TDebuggerGeneralOptionsFrame'#27'DebuggerGeneralOptionsFrame'#6 + +'Height'#3#171#1#5'Width'#3#7#2#12'ClientHeight'#3#171#1#11'ClientWidth'#3#7 + +#2#7'Visible'#8#10'DesignLeft'#2'n'#9'DesignTop'#3#145#0#0#242#2#0#9'TGroupB' + +'ox'#14'gbDebuggerType'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideT' + +'op.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSide' + +'Right.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2'N'#3'Top'#2#0#5'Width'#3 + +#7#2#11'HelpContext'#2#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'Aut' + +'oSize'#9#7'Caption'#6#22'Debugger type and path'#12'ClientHeight'#2'<'#11'C' + +'lientWidth'#3#3#2#5'Ctl3D'#8#11'ParentCtl3D'#8#8'TabOrder'#2#0#0#12'TSpeedB' + +'utton'#19'cmdOpenDebuggerPath'#21'AnchorSideTop.Control'#7#15'cmbDebuggerPa' + +'th'#23'AnchorSideRight.Control'#7#14'gbDebuggerType'#20'AnchorSideRight.Sid' + +'e'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#15'cmbDebuggerPath'#21'Anc' + +'horSideBottom.Side'#7#9'asrBottom'#4'Left'#3#230#1#6'Height'#2#21#3'Top'#2 + +'!'#5'Width'#2#23#11'HelpContext'#2#0#7'Anchors'#11#5'akTop'#7'akRight'#8'ak' + +'Bottom'#0#19'BorderSpacing.Right'#2#6#7'Caption'#6#3'...'#5'Color'#7#9'clBt' + +'nFace'#9'NumGlyphs'#2#0#0#0#9'TComboBox'#15'cmbDebuggerType'#22'AnchorSideL' + +'eft.Control'#7#14'gbDebuggerType'#21'AnchorSideTop.Control'#7#14'gbDebugger' + +'Type'#23'AnchorSideRight.Control'#7#14'gbDebuggerType'#20'AnchorSideRight.S' + +'ide'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#21#3'Top'#2#6#5'Width'#3#247#1 + +#11'HelpContext'#2#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#12'AutoCo' + +'mplete'#8#20'BorderSpacing.Around'#2#6#5'Ctl3D'#8#10'ItemHeight'#2#13#9'Ite' + +'mWidth'#2#0#13'OnEditingDone'#7#26'cmbDebuggerTypeEditingDone'#8'OnSelect'#7 + +#26'cmbDebuggerTypeEditingDone'#11'ParentCtl3D'#8#8'TabOrder'#2#0#0#0#9'TCom' + +'boBox'#15'cmbDebuggerPath'#22'AnchorSideLeft.Control'#7#14'gbDebuggerType' + +#21'AnchorSideTop.Control'#7#15'cmbDebuggerType'#18'AnchorSideTop.Side'#7#9 + +'asrBottom'#4'Left'#2#6#6'Height'#2#21#3'Top'#2'!'#5'Width'#3#218#1#11'HelpC' + +'ontext'#2#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#12'AutoComplete'#8 + +#20'BorderSpacing.Around'#2#6#5'Ctl3D'#8#10'ItemHeight'#2#13#9'ItemWidth'#2#0 + +#11'ParentCtl3D'#8#8'TabOrder'#2#1#0#0#0#242#2#1#9'TGroupBox'#22'gbAdditiona' + +'lSearchPath'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control' + +#7#14'gbDebuggerType'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRig' + +'ht.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6 + +'Height'#2'3'#3'Top'#2'T'#5'Width'#3#7#2#11'HelpContext'#2#0#7'Anchors'#11#5 + +'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#6#7'Cap' + +'tion'#6#22'Additional search path'#12'ClientHeight'#2'!'#11'ClientWidth'#3#3 + +#2#5'Ctl3D'#8#11'ParentCtl3D'#8#8'TabOrder'#2#1#0#12'TSpeedButton'#21'cmdOpe' + +'nAdditionalPath'#21'AnchorSideTop.Control'#7#17'txtAdditionalPath'#23'Ancho' + +'rSideRight.Control'#7#22'gbAdditionalSearchPath'#20'AnchorSideRight.Side'#7 + +#9'asrBottom'#24'AnchorSideBottom.Control'#7#17'txtAdditionalPath'#21'Anchor' + +'SideBottom.Side'#7#9'asrBottom'#4'Left'#3#230#1#6'Height'#2#21#3'Top'#2#6#5 + +'Width'#2#23#11'HelpContext'#2#0#7'Anchors'#11#5'akTop'#7'akRight'#8'akBotto' + +'m'#0#19'BorderSpacing.Right'#2#6#7'Caption'#6#3'...'#5'Color'#7#9'clBtnFace' + +#9'NumGlyphs'#2#0#0#0#5'TEdit'#17'txtAdditionalPath'#22'AnchorSideLeft.Contr' + +'ol'#7#22'gbAdditionalSearchPath'#21'AnchorSideTop.Control'#7#22'gbAdditiona' + +'lSearchPath'#4'Left'#2#6#6'Height'#2#21#3'Top'#2#6#5'Width'#3#218#1#11'Help' + +'Context'#2#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#20'BorderSpacing' + +'.Around'#2#6#8'TabOrder'#2#0#0#0#0#242#2#2#11'TCheckGroup'#25'gcbDebuggerGe' + +'neralOptions'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Contro' + +'l'#7#22'gbAdditionalSearchPath'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'An' + +'chorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4 + +'Left'#2#0#6'Height'#2'8'#3'Top'#3#141#0#5'Width'#3#7#2#11'HelpContext'#2#0#7 + +'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoFill'#9#17'BorderSpacing.' + +'Top'#2#6#7'Caption'#6#24'Debugger general options'#28'ChildSizing.LeftRight' + +'Spacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHor' + +'izontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24 + +'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChi' + +'lds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Lay' + +'out'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1 + +#5'Ctl3D'#8#8'TabOrder'#2#2#0#0#242#2#3#9'TGroupBox'#18'gbDebuggerSpecific' + +#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#25'gcbDeb' + +'uggerGeneralOptions'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRig' + +'ht.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSid' + +'eBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left' + +#2#0#6'Height'#3#224#0#3'Top'#3#203#0#5'Width'#3#7#2#11'HelpContext'#2#0#7'A' + ,'nchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top' + +#2#6#7'Caption'#6'7Debugger specific options (depends on type of debugger)' + +#12'ClientHeight'#3#206#0#11'ClientWidth'#3#3#2#5'Ctl3D'#8#11'ParentCtl3D'#8 + +#8'TabOrder'#2#3#0#6'TPanel'#16'pnlDebugSpecific'#4'Left'#2#6#6'Height'#3#194 + +#0#3'Top'#2#6#5'Width'#3#247#1#11'HelpContext'#2#0#5'Align'#7#8'alClient'#20 + +'BorderSpacing.Around'#2#6#10'BevelOuter'#7#6'bvNone'#11'BorderWidth'#2#4#11 + +'FullRepaint'#8#8'TabOrder'#2#0#7'TabStop'#9#0#0#0#0 +]); diff --git a/debugger/frames/options_debugger_general.pas b/debugger/frames/options_debugger_general.pas new file mode 100644 index 0000000000..df6c9e621a --- /dev/null +++ b/debugger/frames/options_debugger_general.pas @@ -0,0 +1,320 @@ +{ + *************************************************************************** + * * + * 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 . You can also * + * obtain it by writing to the Free Software Foundation, * + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************** +} +unit options_debugger_general; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, TypInfo, FileUtil, LResources, Forms, Controls, StdCtrls, + ExtCtrls, Buttons, Dialogs, LCLProc, + PropEdits, ObjectInspector, + LazarusIDEStrConsts, IDEOptionsIntf, PathEditorDlg, InputHistory, IDEProcs, + EnvironmentOpts, BaseDebugManager, Debugger; + +type + + { TDebuggerGeneralOptionsFrame } + + TDebuggerGeneralOptionsFrame = class(TAbstractIDEOptionsEditor) + cmbDebuggerPath: TComboBox; + cmbDebuggerType: TComboBox; + cmdOpenAdditionalPath: TSpeedButton; + cmdOpenDebuggerPath: TSpeedButton; + gbAdditionalSearchPath: TGroupBox; + gbDebuggerSpecific: TGroupBox; + gbDebuggerType: TGroupBox; + gcbDebuggerGeneralOptions: TCheckGroup; + pnlDebugSpecific: TPanel; + txtAdditionalPath: TEdit; + procedure cmbDebuggerTypeEditingDone(Sender: TObject); + procedure cmdOpenAdditionalPathClick(Sender: TObject); + procedure cmdOpenDebuggerPathClick(Sender: TObject); + private + PropertyGrid: TOIPropertyGrid; + FCurDebuggerClass: TDebuggerClass; // currently shown debugger class + FPropertyEditorHook: TPropertyEditorHook; + FOldDebuggerPathAndParams: string; + procedure FetchDebuggerClass; + procedure FetchDebuggerGeneralOptions; + procedure FetchDebuggerSpecificOptions; + function GetDebuggerClass: TDebuggerClass; + procedure SetDebuggerClass(const AClass: TDebuggerClass); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function Check: Boolean; override; + function GetTitle: String; override; + procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; + procedure ReadSettings(AOptions: TAbstractIDEOptions); override; + procedure WriteSettings(AOptions: TAbstractIDEOptions); override; + class function SupportedOptionsClass: TAbstractIDEOptionsClass; override; + end; + +implementation + +{ TDebuggerGeneralOptionsFrame } + +procedure TDebuggerGeneralOptionsFrame.cmbDebuggerTypeEditingDone( + Sender: TObject); +begin + SetDebuggerClass(GetDebuggerClass); +end; + +procedure TDebuggerGeneralOptionsFrame.cmdOpenAdditionalPathClick( + Sender: TObject); +begin + PathEditorDialog.Path:=txtAdditionalPath.Text; + PathEditorDialog.Templates:=SetDirSeparators( + '$(LazarusDir)/include/$(TargetOS)' + +';$(FPCSrcDir)/rtl/inc/' + +';$(FPCSrcDir)/rtl/$(SrcOS)' + +';$(FPCSrcDir)/rtl/$(TargetOS)' + ); + if PathEditorDialog.ShowModal=mrOk then + txtAdditionalPath.Text:=PathEditorDialog.Path; +end; + +procedure TDebuggerGeneralOptionsFrame.cmdOpenDebuggerPathClick(Sender: TObject); +var + OpenDialog: TOpenDialog; + AFilename: string; +begin + OpenDialog:=TOpenDialog.Create(nil); + try + InputHistories.ApplyFileDialogSettings(OpenDialog); + OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist]; + OpenDialog.Title:=lisChooseDebuggerPath; + + if OpenDialog.Execute then begin + AFilename:=CleanAndExpandFilename(OpenDialog.Filename); + SetComboBoxText(cmbDebuggerPath,AFilename); + CheckExecutable(FOldDebuggerPathAndParams,cmbDebuggerPath.Text, + lisEnvOptDlgInvalidDebuggerFilename, + lisEnvOptDlgInvalidDebuggerFilenameMsg); + end; + InputHistories.StoreFileDialogSettings(OpenDialog); + finally + OpenDialog.Free; + end; +end; + +procedure TDebuggerGeneralOptionsFrame.FetchDebuggerClass; +var + n: PtrInt; + DbgClass, CurClass: TDebuggerClass; + List: TStringList; +begin + List := TStringList.Create; + List.Sorted := True; + + CurClass := nil; + for n := 0 to DebugBoss.DebuggerCount - 1 do + begin + DbgClass := DebugBoss.Debuggers[n]; + List.AddObject(DbgClass.Caption, TObject(n)); + if (FCurDebuggerClass = nil) + and (CompareText(DbgClass.ClassName, EnvironmentOptions.DebuggerClass) = 0) + then CurClass := DbgClass; + end; + + cmbDebuggerType.Items.Assign(List); + FreeAndNil(List); + + SetDebuggerClass(CurClass); + if FCurDebuggerClass = nil + then SetComboBoxText(cmbDebuggerType, '(none)') + else SetComboBoxText(cmbDebuggerType, FCurDebuggerClass.Caption); + + txtAdditionalPath.Text:=EnvironmentOptions.DebuggerSearchPath; +end; + +procedure TDebuggerGeneralOptionsFrame.FetchDebuggerGeneralOptions; +begin + // IMPORTANT if more items are added the indexes must be updated here! + gcbDebuggerGeneralOptions.Checked[0] := EnvironmentOptions.DebuggerShowStopMessage; +end; + +procedure TDebuggerGeneralOptionsFrame.FetchDebuggerSpecificOptions; +var + S: String; + i: Integer; + Filename: string; + NewFilename: string; +begin + with cmbDebuggerPath.Items do begin + BeginUpdate; + Assign(EnvironmentOptions.DebuggerFileHistory); + if (Count = 0) + and (FCurDebuggerClass <> nil) + then begin + S := FCurDebuggerClass.ExePaths; + while S <> '' do + begin + Add(GetPart([], [';'], S)); + if S <> '' then System.Delete(S, 1, 1); + end; + end; + EndUpdate; + end; + + Filename:=cmbDebuggerPath.Text; + if Filename='' then begin + for i:=0 to cmbDebuggerPath.Items.Count-1 do begin + NewFilename:=cmbDebuggerPath.Items[i]; + if FileExistsCached(NewFilename) then begin + Filename:=NewFilename; + break; + end; + NewFilename:=FindDefaultExecutablePath(ExtractFileName(Filename)); + if NewFilename<>'' then begin + Filename:=NewFilename; + break; + end; + end; + end; + SetComboBoxText(cmbDebuggerPath,Filename,20); + + PropertyGrid.Selection.Clear; + if FCurDebuggerClass<>nil then begin + PropertyGrid.Selection.Add(FCurDebuggerClass.GetProperties); + end; + PropertyGrid.BuildPropertyList; +end; + +function TDebuggerGeneralOptionsFrame.GetDebuggerClass: TDebuggerClass; +var + idx: PtrInt; +begin + Result := nil; + + idx := cmbDebuggerType.ItemIndex; + if idx = -1 then Exit; + idx := PtrInt(cmbDebuggerType.Items.Objects[idx]); + + if idx = -1 then Exit; + Result := DebugBoss.Debuggers[idx]; +end; + +procedure TDebuggerGeneralOptionsFrame.SetDebuggerClass( + const AClass: TDebuggerClass); +begin + if FCurDebuggerClass = AClass then Exit; + FCurDebuggerClass := AClass; + FetchDebuggerSpecificOptions; +end; + +constructor TDebuggerGeneralOptionsFrame.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + // create the PropertyEditorHook (the interface to the properties) + FPropertyEditorHook:=TPropertyEditorHook.Create; + // create the PropertyGrid + PropertyGrid:=TOIPropertyGrid.CreateWithParams(Self,FPropertyEditorHook + ,[tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat, tkSet{, tkMethod} + , tkSString, tkLString, tkAString, tkWString, tkVariant + {, tkArray, tkRecord, tkInterface}, tkClass, tkObject, tkWChar, tkBool + , tkInt64, tkQWord], + 0); + with PropertyGrid do + begin + Name:='PropertyGrid'; + // Use panel for border + Parent := pnlDebugSpecific; //gbDebuggerSpecific; + Visible := True; + Align := alClient; + Layout := oilVertical; + RowSpacing := 4; + end; +end; + +destructor TDebuggerGeneralOptionsFrame.Destroy; +begin + FreeAndNil(FPropertyEditorHook); + inherited Destroy; +end; + +function TDebuggerGeneralOptionsFrame.Check: Boolean; +begin + Result := false; + + if assigned(FCurDebuggerClass) and FCurDebuggerClass.HasExePath and + not CheckExecutable(FOldDebuggerPathAndParams,cmbDebuggerPath.Text, + lisEnvOptDlgInvalidDebuggerFilename, + lisEnvOptDlgInvalidDebuggerFilenameMsg) + then exit; + + Result := true; +end; + +function TDebuggerGeneralOptionsFrame.GetTitle: String; +begin + Result := lisMenuInsertGeneral; +end; + +procedure TDebuggerGeneralOptionsFrame.Setup( + ADialog: TAbstractOptionsEditorDialog); +begin + gbDebuggerType.Caption := dlgDebugType; + gbAdditionalSearchPath.Caption := lisDebugOptionsFrmAdditionalSearchPath; + gcbDebuggerGeneralOptions.Caption := lisDebugOptionsFrmDebuggerGeneralOptions; + gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmShowMessageOnStop); + gbDebuggerSpecific.Caption := lisDebugOptionsFrmDebuggerSpecific; +end; + +procedure TDebuggerGeneralOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); +begin + with AOptions as TEnvironmentOptions do + begin + FOldDebuggerPathAndParams := DebuggerFilename; + cmbDebuggerPath.Text := FOldDebuggerPathAndParams; + FetchDebuggerClass; + FetchDebuggerGeneralOptions; + end; +end; + +procedure TDebuggerGeneralOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); +begin + with AOptions as TEnvironmentOptions do + begin + DebuggerFilename := cmbDebuggerPath.Text; + DebuggerFileHistory.Assign(cmbDebuggerPath.Items); + DebuggerSearchPath := TrimSearchPath(txtAdditionalPath.Text,''); + // IMPORTANT if more items are added the indexes must be updated here! + DebuggerShowStopMessage := gcbDebuggerGeneralOptions.Checked[0]; + + if FCurDebuggerClass = nil + then DebuggerClass := '' + else DebuggerClass := FCurDebuggerClass.ClassName; + end; +end; + +class function TDebuggerGeneralOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass; +begin + Result := TEnvironmentOptions; +end; + +initialization + {$I options_debugger_general.lrs} + RegisterIDEOptionsEditor(GroupDebugger, TDebuggerGeneralOptionsFrame, DbgOptionsGeneral); +end. + diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi index 0ebda0d66b..53e2a2e1a1 100644 --- a/ide/lazarus.lpi +++ b/ide/lazarus.lpi @@ -41,7 +41,7 @@ - + @@ -232,6 +232,15 @@ + + + + + + + + + diff --git a/ide/main.pp b/ide/main.pp index 650a9e8454..f287aaea2b 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -134,7 +134,8 @@ uses options_editor_general_misc, options_codetools_general, options_codetools_codecreation, options_codetools_wordpolicy, options_codetools_linesplitting, - options_codetools_space, options_codetools_identifiercompletion; + options_codetools_space, options_codetools_identifiercompletion, + options_debugger_general; type TIDEProjectItem =