debugger: add popup menu for event log

git-svn-id: trunk@30680 -
This commit is contained in:
paul 2011-05-11 08:37:38 +00:00
parent 0fb8976945
commit 4ce0dd4aeb
2 changed files with 101 additions and 1 deletions

View File

@ -6,6 +6,7 @@ inherited DbgEventsForm: TDbgEventsForm
BorderStyle = bsSizeToolWin
ClientHeight = 208
ClientWidth = 577
PopupMenu = PopupMenu1
object tvFilteredEvents: TTreeView[0]
Left = 0
Height = 208
@ -265,5 +266,40 @@ inherited DbgEventsForm: TDbgEventsForm
OnUpdate = EditCopy1Update
ShortCut = 16451
end
object actClear: TAction
Caption = 'actClear'
OnExecute = actClearExecute
end
object actSave: TAction
Caption = 'actSave'
OnExecute = actSaveExecute
end
object actAddComment: TAction
Caption = 'actAddComment'
OnExecute = actAddCommentExecute
end
object actOptions: TAction
Caption = 'actOptions'
OnExecute = actOptionsExecute
end
end
object PopupMenu1: TPopupMenu[3]
left = 65
top = 39
object MenuItem1: TMenuItem
Action = actClear
end
object MenuItem2: TMenuItem
Action = actSave
end
object MenuItem3: TMenuItem
Action = actAddComment
end
object MenuItem4: TMenuItem
Caption = '-'
end
object MenuItem5: TMenuItem
Action = actOptions
end
end
end

View File

@ -34,16 +34,32 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, ExtCtrls, ComCtrls, ActnList,
StdActns, ClipBrd, Debugger, DebuggerDlg, LazarusIDEStrConsts, EnvironmentOpts;
StdActns, ClipBrd, Menus, Dialogs, FileUtil, Debugger, DebuggerDlg,
LazarusIDEStrConsts, EnvironmentOpts, InputHistory, IDEOptionsIntf,
IDEImagesIntf, LazIDEIntf, debugger_eventlog_options;
type
{ TDbgEventsForm }
TDbgEventsForm = class(TDebuggerDlg)
actClear: TAction;
actAddComment: TAction;
actOptions: TAction;
actSave: TAction;
ActionList1: TActionList;
EditCopy1: TEditCopy;
imlMain: TImageList;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
PopupMenu1: TPopupMenu;
tvFilteredEvents: TTreeView;
procedure actAddCommentExecute(Sender: TObject);
procedure actClearExecute(Sender: TObject);
procedure actOptionsExecute(Sender: TObject);
procedure actSaveExecute(Sender: TObject);
procedure EditCopy1Execute(Sender: TObject);
procedure EditCopy1Update(Sender: TObject);
procedure tvFilteredEventsAdvancedCustomDrawItem(Sender: TCustomTreeView;
@ -111,6 +127,48 @@ begin
Clipboard.Close;
end;
procedure TDbgEventsForm.actClearExecute(Sender: TObject);
begin
Clear;
end;
procedure TDbgEventsForm.actOptionsExecute(Sender: TObject);
begin
LazarusIDE.DoOpenIDEOptions(TDebuggerEventLogOptionsFrame);
end;
procedure TDbgEventsForm.actAddCommentExecute(Sender: TObject);
var
S: String;
begin
S := '';
if InputQuery(lisMenuViewDebugEvents, lisEventsLogAddComment, S) then
AddEvent(ecDebugger, etDefault, S);
end;
procedure TDbgEventsForm.actSaveExecute(Sender: TObject);
var
SaveDialog: TSaveDialog;
AFilename: String;
begin
SaveDialog := TSaveDialog.Create(nil);
try
InputHistories.ApplyFileDialogSettings(SaveDialog);
SaveDialog.Title := lisMVSaveMessagesToFileTxt;
SaveDialog.Options := SaveDialog.Options + [ofPathMustExist];
if SaveDialog.Execute then
begin
AFilename := CleanAndExpandFilename(SaveDialog.Filename);
if ExtractFileExt(AFilename) = '' then
AFilename := AFilename + '.txt';
FEvents.SaveToFile(AFilename);
end;
InputHistories.StoreFileDialogSettings(SaveDialog);
finally
SaveDialog.Free;
end;
end;
procedure TDbgEventsForm.EditCopy1Update(Sender: TObject);
begin
EditCopy1.Enabled := Assigned(tvFilteredEvents.Selected);
@ -205,7 +263,13 @@ constructor TDbgEventsForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Caption := lisMenuViewDebugEvents;
actClear.Caption := lisEventLogClear;
actSave.Caption := lisEventLogSaveToFile;
actAddComment.Caption := lisEventsLogAddComment;
actOptions.Caption := lisEventLogOptions;
FEvents := TStringList.Create;
PopupMenu1.Images := IDEImages.Images_16;
actOptions.ImageIndex := IDEImages.LoadImage(16, 'menu_environment_options');
end;
destructor TDbgEventsForm.Destroy;