mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 01:28:16 +02:00
Replace "enable dwarf" dialog with TTaskDialog
This commit is contained in:
parent
9526343e18
commit
1368ee6560
@ -4205,6 +4205,20 @@ resourcestring
|
||||
lisEnableOptionDwarf2 = 'Enable Dwarf 2 (-gw)';
|
||||
lisEnableOptionDwarf2Sets = 'Enable Dwarf 2 with sets';
|
||||
lisEnableOptionDwarf3 = 'Enable Dwarf 3 (-gw3)';
|
||||
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_Caption = 'Running your application with debugger';
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_Title = 'Choose Debug Information format';
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_TextExplain = '"%s" can only run your application'
|
||||
+ ' when it was compiled with a suitable Debug Information enabled.';
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_NoDebugBtn_Caption = 'Run with no debugger';
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_Footer = 'This choice can be later changed'
|
||||
+ ' in Project Options / Compiler Options / Debugging window.';
|
||||
// non-Windows LCL does not implement
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_NoDebugBtn_Hint =
|
||||
'If you continue running without Debug Info selected - the debugger'
|
||||
+ ' would not be enabled, and this question would reappear next'
|
||||
+ ' time you run your application.';
|
||||
|
||||
lisCleanUpUnitPath = 'Clean up unit path?';
|
||||
lisTheDirectoryIsNoLongerNeededInTheUnitPathRemoveIt =
|
||||
'The directory "%s" is no longer needed in the unit path.%sRemove it?';
|
||||
|
72
ide/main.pp
72
ide/main.pp
@ -168,6 +168,7 @@ type
|
||||
|
||||
TMainIDE = class(TMainIDEBase)
|
||||
private
|
||||
dlgFpDebugNeedsDwarf: dialogs.TTaskDialog; // LCLTaskDialog has a record type with the same name
|
||||
// event handlers
|
||||
procedure MainIDEFormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||
procedure MainIDEFormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
@ -189,6 +190,8 @@ type
|
||||
var Result: TStartNewInstanceResult; var outSourceWindowHandle: HWND);
|
||||
procedure LazInstancesGetOpenedProjectFileName(var outProjectFileName: string);
|
||||
procedure OnHintWatchValidityChanged(Sender: TObject);
|
||||
procedure DlgDebugInfoHelpRequested(Sender: TObject; AModalResult: TModalResult; var ACanClose: Boolean);
|
||||
|
||||
public
|
||||
// file menu
|
||||
procedure mnuNewUnitClicked(Sender: TObject);
|
||||
@ -7238,7 +7241,8 @@ var
|
||||
DebugClass: TDebuggerClass;
|
||||
ARunMode: TRunParamsOptionsMode;
|
||||
ReqOpts: TDebugCompilerRequirements;
|
||||
Handled: Boolean;
|
||||
Handled, SkipDebuggerThisTime: Boolean;
|
||||
dlgResult: TModalResult;
|
||||
begin
|
||||
if ToolStatus <> itNone
|
||||
then begin
|
||||
@ -7274,6 +7278,7 @@ begin
|
||||
end;
|
||||
|
||||
DebugClass:=DebugBoss.DebuggerClass;
|
||||
SkipDebuggerThisTime := False;
|
||||
|
||||
if DebugClass <> nil then begin
|
||||
ReqOpts := DebugBoss.RequiredCompilerOpts(Project1.CompilerOptions.TargetCPU, Project1.CompilerOptions.TargetOS);
|
||||
@ -7308,22 +7313,76 @@ begin
|
||||
and (not (Project1.CompilerOptions.DebugInfoType in [dsDwarf2, dsDwarf2Set, dsDwarf3])) then
|
||||
begin
|
||||
// this debugger does ONLY support external debug symbols
|
||||
|
||||
if nil = dlgFpDebugNeedsDwarf then begin
|
||||
dlgFpDebugNeedsDwarf := TTaskDialog.Create(Self);
|
||||
|
||||
dlgFpDebugNeedsDwarf.Flags := [tfAllowDialogCancellation];
|
||||
dlgFpDebugNeedsDwarf.Caption := lisTheProjectDoesNotUseDwarf_TaskDlg_Caption;
|
||||
dlgFpDebugNeedsDwarf.Title := lisTheProjectDoesNotUseDwarf_TaskDlg_Title;
|
||||
dlgFpDebugNeedsDwarf.Text := Format(
|
||||
lisTheProjectDoesNotUseDwarf_TaskDlg_TextExplain, [DebugClass.Caption]);
|
||||
dlgFpDebugNeedsDwarf.FooterText := lisTheProjectDoesNotUseDwarf_TaskDlg_Footer;
|
||||
dlgFpDebugNeedsDwarf.FooterIcon := tdiInformation;
|
||||
dlgFpDebugNeedsDwarf.MainIcon := tdiWarning;
|
||||
|
||||
with dlgFpDebugNeedsDwarf.RadioButtons.Add do begin
|
||||
ModalResult := 1;
|
||||
Default := True;
|
||||
Caption := lisEnableOptionDwarf2Sets;
|
||||
end;
|
||||
with dlgFpDebugNeedsDwarf.RadioButtons.Add do begin
|
||||
ModalResult := 12;
|
||||
Caption := lisEnableOptionDwarf2;
|
||||
end;
|
||||
with dlgFpDebugNeedsDwarf.RadioButtons.Add do begin
|
||||
ModalResult := 13;
|
||||
Caption := lisEnableOptionDwarf3;
|
||||
end;
|
||||
|
||||
with dlgFpDebugNeedsDwarf.Buttons.Add do begin
|
||||
ModalResult := 500;
|
||||
Caption := lisHelp;
|
||||
end;
|
||||
with dlgFpDebugNeedsDwarf.Buttons.Add do begin
|
||||
ModalResult := 400;
|
||||
Caption := lisTheProjectDoesNotUseDwarf_TaskDlg_NoDebugBtn_Caption;
|
||||
end;
|
||||
|
||||
dlgFpDebugNeedsDwarf.OnButtonClicked := @DlgDebugInfoHelpRequested;
|
||||
end;
|
||||
(*
|
||||
case IDEQuestionDialog(lisEnableOptionDwarf,
|
||||
Format(lisTheProjectDoesNotUseDwarf, [DebugClass.Caption]),
|
||||
mtConfirmation, [1 {mrOk}, lisEnableOptionDwarf2Sets,
|
||||
12, lisEnableOptionDwarf2,
|
||||
13, lisEnableOptionDwarf3,
|
||||
mrCancel])
|
||||
*)
|
||||
if not dlgFpDebugNeedsDwarf.Execute() then
|
||||
exit;
|
||||
dlgResult := dlgFpDebugNeedsDwarf.ModalResult;
|
||||
if (dlgResult = mrOK) and (nil <> dlgFpDebugNeedsDwarf.RadioButton) then
|
||||
dlgResult := dlgFpDebugNeedsDwarf.RadioButton.ModalResult;
|
||||
case dlgResult
|
||||
of
|
||||
1: Project1.CompilerOptions.DebugInfoType := dsDwarf2Set;
|
||||
12: Project1.CompilerOptions.DebugInfoType := dsDwarf2;
|
||||
13: Project1.CompilerOptions.DebugInfoType := dsDwarf3;
|
||||
400: SkipDebuggerThisTime := True;
|
||||
else
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if SkipDebuggerThisTime then begin
|
||||
Result := DoRunProjectWithoutDebug;
|
||||
if Result = mrOK then
|
||||
Result := mrCancel;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// Build project first
|
||||
if ConsoleVerbosity>0 then
|
||||
debugln('Hint: (lazarus) [TMainIDE.DoInitProjectRun] Check build ...');
|
||||
@ -7358,6 +7417,17 @@ begin
|
||||
ToolStatus := itDebugger;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DlgDebugInfoHelpRequested(Sender: TObject;
|
||||
AModalResult: TModalResult; var ACanClose: Boolean);
|
||||
begin
|
||||
// pevent HELP pushbutton from closing the dialog, others should close
|
||||
if AModalResult = 500 then begin
|
||||
ACanClose := False;
|
||||
ShowHelpOrError('https://wiki.lazarus.freepascal.org/DWARF',
|
||||
'Help for debug info selection','text/html');
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoRunProject: TModalResult;
|
||||
var
|
||||
Handled: Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user