diff --git a/debugger/frames/debugger_eventlog_options.lfm b/debugger/frames/debugger_eventlog_options.lfm index b00074c373..95e506e342 100644 --- a/debugger/frames/debugger_eventlog_options.lfm +++ b/debugger/frames/debugger_eventlog_options.lfm @@ -13,41 +13,86 @@ inherited DebuggerEventLogOptionsFrame: TDebuggerEventLogOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 104 + Height = 168 Top = 0 - Width = 534 - Align = alTop + Width = 168 Caption = 'General' - ClientHeight = 89 - ClientWidth = 530 + ClientHeight = 150 + ClientWidth = 164 TabOrder = 0 object chkClearLogOnRun: TCheckBox - Left = 0 - Height = 22 - Top = 0 - Width = 107 + AnchorSideLeft.Control = gbGeneral + AnchorSideTop.Control = gbGeneral + Left = 6 + Height = 19 + Top = 6 + Width = 105 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 Caption = 'Clear log on run' Checked = True State = cbChecked TabOrder = 0 end object chkLimitLinecount: TCheckBox - Left = 0 - Height = 22 - Top = 24 - Width = 116 + AnchorSideLeft.Control = gbGeneral + AnchorSideTop.Control = chkClearLogOnRun + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 19 + Top = 25 + Width = 114 + BorderSpacing.Left = 6 Caption = 'Limit linecount to' TabOrder = 1 end object seLimitLinecount: TSpinEdit - Left = 42 + AnchorSideLeft.Control = chkLimitLinecount + AnchorSideTop.Control = chkLimitLinecount + AnchorSideTop.Side = asrBottom + Left = 26 Height = 23 - Top = 49 + Top = 44 Width = 82 + BorderSpacing.Left = 20 TabOrder = 2 end end object gbMessages: TGroupBox[1] + AnchorSideLeft.Control = gbGeneral + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = gbGeneral + AnchorSideBottom.Side = asrBottom + Left = 168 + Height = 168 + Top = 0 + Width = 366 + Anchors = [akTop, akLeft, akRight, akBottom] + Caption = 'Messages' + ClientHeight = 150 + ClientWidth = 362 + TabOrder = 1 + object cbMessages: TCheckListBox + AnchorSideLeft.Control = gbMessages + AnchorSideTop.Control = gbMessages + AnchorSideRight.Control = gbMessages + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = gbMessages + AnchorSideBottom.Side = asrBottom + Left = 6 + Height = 138 + Top = 6 + Width = 350 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Around = 6 + ItemHeight = 0 + TabOrder = 0 + end + end + object gbColors: TGroupBox[2] AnchorSideLeft.Control = Owner AnchorSideTop.Control = gbGeneral AnchorSideTop.Side = asrBottom @@ -56,78 +101,11 @@ inherited DebuggerEventLogOptionsFrame: TDebuggerEventLogOptionsFrame AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 0 - Height = 219 - Top = 110 + Height = 161 + Top = 168 Width = 534 - Align = alClient - BorderSpacing.Top = 6 - Caption = 'Messages' - ClientHeight = 204 - ClientWidth = 530 - TabOrder = 1 - object chkMessagesBreakpoint: TCheckBox - Left = 4 - Height = 22 - Top = 5 - Width = 81 - Caption = 'Breakpoint' - TabOrder = 0 - end - object chkMessagesProcess: TCheckBox - Left = 4 - Height = 22 - Top = 29 - Width = 65 - Caption = 'Process' - Checked = True - State = cbChecked - TabOrder = 1 - end - object chkMessagesThread: TCheckBox - Left = 4 - Height = 22 - Top = 53 - Width = 61 - Caption = 'Thread' - Checked = True - State = cbChecked - TabOrder = 2 - end - object chkMessagesModule: TCheckBox - Left = 4 - Height = 22 - Top = 77 - Width = 63 - Caption = 'Module' - TabOrder = 3 - end - object chkMessagesOutput: TCheckBox - Left = 4 - Height = 22 - Top = 101 - Width = 61 - Caption = 'Output' - Enabled = False - TabOrder = 4 - end - object chkMessagesDebugger: TCheckBox - Left = 4 - Height = 22 - Top = 149 - Width = 78 - Caption = 'Debugger' - Checked = True - State = cbChecked - TabOrder = 5 - end - object chkMessagesWindow: TCheckBox - Left = 4 - Height = 22 - Top = 125 - Width = 66 - Caption = 'Window' - Enabled = False - TabOrder = 6 - end + Anchors = [akTop, akLeft, akRight, akBottom] + Caption = 'Colors' + TabOrder = 2 end end diff --git a/debugger/frames/debugger_eventlog_options.pas b/debugger/frames/debugger_eventlog_options.pas index 7a932b7b22..9dbe8fcb32 100644 --- a/debugger/frames/debugger_eventlog_options.pas +++ b/debugger/frames/debugger_eventlog_options.pas @@ -25,28 +25,31 @@ unit debugger_eventlog_options; interface uses - Classes, SysUtils, FileUtil, Forms, StdCtrls, Spin, + Classes, SysUtils, FileUtil, Forms, StdCtrls, Spin, CheckLst, LazarusIDEStrConsts, IDEOptionsIntf, EnvironmentOpts; type - + TEventLogEvent = ( + eeBreakpoint, + eeProcess, + eeThread, + eeModule, + eeOutput, + eeWindow, + eeDebugger + ); { TDebuggerEventLogOptionsFrame } TDebuggerEventLogOptionsFrame = class(TAbstractIDEOptionsEditor) - chkMessagesWindow: TCheckBox; + cbMessages: TCheckListBox; chkClearLogOnRun: TCheckBox; chkLimitLinecount: TCheckBox; - chkMessagesBreakpoint: TCheckBox; - chkMessagesModule: TCheckBox; - chkMessagesOutput: TCheckBox; - chkMessagesProcess: TCheckBox; - chkMessagesThread: TCheckBox; - chkMessagesDebugger: TCheckBox; gbGeneral: TGroupBox; gbMessages: TGroupBox; + gbColors: TGroupBox; seLimitLinecount: TSpinEdit; private - { private declarations } + class function GetEventStr(AEvent: TEventLogEvent): String; public function GetTitle: String; override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; @@ -56,63 +59,93 @@ type end; implementation + {$R *.lfm} { TDebuggerEventLogOptionsFrame } +class function TDebuggerEventLogOptionsFrame.GetEventStr(AEvent: TEventLogEvent): String; +begin + case AEvent of + eeBreakpoint: Result := lisDebugOptionsFrmBreakpoint; + eeProcess: Result := lisDebugOptionsFrmProcess; + eeThread: Result := lisDebugOptionsFrmThread; + eeModule: Result := lisDebugOptionsFrmModule; + eeOutput: Result := lisDebugOptionsFrmOutput; + eeWindow: Result := lisDebugOptionsFrmWindow; + eeDebugger: Result := lisDebugOptionsFrmDebugger; + else + Result := '???'; + end; +end; + function TDebuggerEventLogOptionsFrame.GetTitle: String; begin Result := lisDebugOptionsFrmEventLog; end; procedure TDebuggerEventLogOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog); +var + Event: TEventLogEvent; begin + // general gbGeneral.Caption := lisMenuInsertGeneral; chkClearLogOnRun.Caption := lisDebugOptionsFrmClearLogOnRun; chkLimitLinecount.Caption := lisDebugOptionsFrmLimitLinecountTo; + + // messages gbMessages.Caption := lisMenuViewMessages; - chkMessagesBreakpoint.Caption := lisDebugOptionsFrmBreakpoint; - chkMessagesProcess.Caption := lisDebugOptionsFrmProcess; - chkMessagesThread.Caption := lisDebugOptionsFrmThread; - chkMessagesModule.Caption := lisDebugOptionsFrmModule; - chkMessagesOutput.Caption := lisDebugOptionsFrmOutput; - chkMessagesWindow.Caption := lisDebugOptionsFrmWindow; - chkMessagesDebugger.Caption := lisDebugOptionsFrmDebugger; + for Event := Low(TEventLogEvent) to High(TEventLogEvent) do + cbMessages.Items.Add(GetEventStr(Event)); + + // colors + gbColors.Caption := dlgEnvColors; + // TODO: colors end; -procedure TDebuggerEventLogOptionsFrame.ReadSettings( - AOptions: TAbstractIDEOptions); +procedure TDebuggerEventLogOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); + + procedure SetChecked(AEvent: TEventLogEvent; AChecked: Boolean); inline; + begin + cbMessages.Checked[Ord(AEvent)] := AChecked; + end; + begin with AOptions as TEnvironmentOptions do begin chkClearLogOnRun.Checked := DebuggerEventLogClearOnRun; chkLimitLinecount.Checked := DebuggerEventLogCheckLineLimit; seLimitLinecount.Value := DebuggerEventLogLineLimit; - chkMessagesBreakpoint.Checked := DebuggerEventLogShowBreakpoint; - chkMessagesProcess.Checked := DebuggerEventLogShowProcess; - chkMessagesThread.Checked := DebuggerEventLogShowThread; - chkMessagesModule.Checked := DebuggerEventLogShowModule; - chkMessagesOutput.Checked := DebuggerEventLogShowOutput; - chkMessagesWindow.Checked := DebuggerEventLogShowWindow; - chkMessagesDebugger.Checked := DebuggerEventLogShowDebugger; + SetChecked(eeBreakpoint, DebuggerEventLogShowBreakpoint); + SetChecked(eeProcess, DebuggerEventLogShowProcess); + SetChecked(eeThread, DebuggerEventLogShowThread); + SetChecked(eeModule, DebuggerEventLogShowModule); + SetChecked(eeOutput, DebuggerEventLogShowOutput); + SetChecked(eeWindow, DebuggerEventLogShowWindow); + SetChecked(eeDebugger, DebuggerEventLogShowDebugger); end; end; -procedure TDebuggerEventLogOptionsFrame.WriteSettings( - AOptions: TAbstractIDEOptions); +procedure TDebuggerEventLogOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); + + function GetChecked(AEvent: TEventLogEvent): Boolean; inline; + begin + Result := cbMessages.Checked[Ord(AEvent)]; + end; + begin with AOptions as TEnvironmentOptions do begin DebuggerEventLogClearOnRun := chkClearLogOnRun.Checked; DebuggerEventLogCheckLineLimit := chkLimitLinecount.Checked; DebuggerEventLogLineLimit := seLimitLinecount.Value; - DebuggerEventLogShowBreakpoint := chkMessagesBreakpoint.Checked; - DebuggerEventLogShowProcess := chkMessagesProcess.Checked; - DebuggerEventLogShowThread := chkMessagesThread.Checked; - DebuggerEventLogShowModule := chkMessagesModule.Checked; - DebuggerEventLogShowOutput := chkMessagesOutput.Checked; - DebuggerEventLogShowWindow := chkMessagesWindow.Checked; - DebuggerEventLogShowDebugger := chkMessagesDebugger.Checked; + DebuggerEventLogShowBreakpoint := GetChecked(eeBreakpoint); + DebuggerEventLogShowProcess := GetChecked(eeProcess); + DebuggerEventLogShowThread := GetChecked(eeThread); + DebuggerEventLogShowModule := GetChecked(eeModule); + DebuggerEventLogShowOutput := GetChecked(eeOutput); + DebuggerEventLogShowWindow := GetChecked(eeWindow); + DebuggerEventLogShowDebugger := GetChecked(eeDebugger); end; end;