summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-04-19 12:18:42 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-04-19 12:18:42 +0100
commit7c05425017f7a3722765a204d98856d53f90f096 (patch)
tree78cba5fe73e38a84a37dedca1324a779e72fc47a
parentebcf54bd786aa0194bef218a80ca3ed8c99b5dc0 (diff)
downloadfpGUI-7c05425017f7a3722765a204d98856d53f90f096.tar.xz
debug server: added a "expanded view" for the selected message.
This means we can view multi-line items much easier.
-rw-r--r--examples/apps/debugserver/frm_main.pas91
-rw-r--r--examples/apps/debugserver/images.inc54
-rw-r--r--examples/apps/debugserver/images/extended_view.bmpbin0 -> 822 bytes
3 files changed, 140 insertions, 5 deletions
diff --git a/examples/apps/debugserver/frm_main.pas b/examples/apps/debugserver/frm_main.pas
index 499bc48f..12584f41 100644
--- a/examples/apps/debugserver/frm_main.pas
+++ b/examples/apps/debugserver/frm_main.pas
@@ -79,6 +79,7 @@ uses
,fpg_menu
,fpg_basegrid
,fpg_grid
+ ,fpg_memo
,simpleipc
,dbugmsg
;
@@ -98,6 +99,8 @@ type
btnPause: TfpgButton;
btnStart: TfpgButton;
btnClear: TfpgButton;
+ btnExpandView: TfpgButton;
+ Bevel3: TfpgBevel;
{@VFD_HEAD_END: MainForm}
miPause: TfpgMenuItem;
FIPCSrv: TSimpleIPCServer;
@@ -105,6 +108,7 @@ type
FAddAtBottom: Boolean;
FDiscarded: Integer;
FShowOnMessage: Boolean;
+ FMemo: TfpgMemo;
procedure StartServer;
procedure StopServer;
procedure CheckMessages(Sender: TObject);
@@ -115,12 +119,15 @@ type
procedure miPauseClicked(Sender: TObject);
procedure miFileQuit(Sender: TObject);
procedure miEditCopy(Sender: TObject);
+ procedure btnExpandViewClicked(Sender: TObject);
procedure miHelpAboutFPGui(Sender: TObject);
procedure miHelpProductInformation(Sender: TObject);
procedure btnClearClicked(Sender: TObject);
procedure btnPauseClicked(Sender: TObject);
procedure btnStartClicked(Sender: TObject);
procedure GridDrawCell(Sender: TObject; const ARow, ACol: Integer; const ARect: TfpgRect; const AFlags: TfpgGridDrawState; var ADefaultDrawing: boolean);
+ procedure GridRowChanged(Sender: TObject; ARow: Integer);
+ procedure GridClicked(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -191,6 +198,22 @@ begin
end;
end;
+procedure TMainForm.GridRowChanged(Sender: TObject; ARow: Integer);
+begin
+ if not btnExpandView.Down then
+ Exit;
+ FMemo.Text := grdMessages.Cells[2, ARow];
+// FMemo.Text := grdMessages.Cells[2, grdMessages.FocusRow];
+end;
+
+procedure TMainForm.GridClicked(Sender: TObject);
+begin
+ if not btnExpandView.Down then
+ Exit;
+ if (grdMessages.RowCount > 0) and (grdMessages.FocusRow <> -1) then
+ FMemo.Text := grdMessages.Cells[2, grdMessages.FocusRow];
+end;
+
procedure TMainForm.StartServer;
begin
FIPCSrv := TSimpleIPCServer.Create(nil);
@@ -279,6 +302,31 @@ begin
fpgClipboard.Text := grdMessages.Cells[2, grdMessages.FocusRow];
end;
+procedure TMainForm.btnExpandViewClicked(Sender: TObject);
+const
+ cSpacing = 4;
+begin
+ if btnExpandView.Down then
+ begin
+ FMemo := CreateMemo(self, grdMessages.Right + cSpacing, grdMessages.Top, 200, grdMessages.Height);
+ FMemo.UpdateWindowPosition;
+ grdMessages.Anchors := grdMessages.Anchors - [anRight];
+ Width := Width + FMemo.Width + (2 * cSpacing);
+ UpdateWindowPosition;
+ grdMessages.Anchors := grdMessages.Anchors + [anRight];
+ GridClicked(nil); // update memo contents
+ end
+ else
+ begin
+ grdMessages.Anchors := grdMessages.Anchors - [anRight];
+ Width := Width - FMemo.Width - (2 * cSpacing);
+ FMemo.Visible := False;
+ UpdateWindowPosition;
+ grdMessages.Anchors := grdMessages.Anchors + [anRight];
+ FreeAndNil(FMemo);
+ end;
+end;
+
procedure TMainForm.miHelpAboutFPGui(Sender: TObject);
begin
TfpgMessageDialog.AboutFPGui;
@@ -301,6 +349,7 @@ begin
fpgImages.AddMaskedBMP('dbs.stop', @DBS_stop, sizeof(DBS_stop), 0, 0);
fpgImages.AddMaskedBMP('dbs.pause', @DBS_pause, sizeof(DBS_pause), 0, 0);
fpgImages.AddMaskedBMP('dbs.run', @DBS_run, sizeof(DBS_run), 0, 0);
+ fpgImages.AddMaskedBMP('dbs.extended_view', @DBS_extended_view, sizeof(DBS_extended_view), 0, 0);
fpgImages.AddMaskedBMP('dbs.state.info', @DBS_state_info, sizeof(DBS_state_info), 0, 0);
fpgImages.AddMaskedBMP('dbs.state.warning', @DBS_state_warning, sizeof(DBS_state_warning), 0, 0);
@@ -340,8 +389,8 @@ begin
SetPosition(0, 21, 486, 30);
Anchors := [anLeft,anRight,anTop];
Hint := '';
- Style := bsLowered;
Shape := bsBottomLine;
+ Style := bsLowered;
end;
grdMessages := TfpgStringGrid.Create(self);
@@ -350,6 +399,7 @@ begin
Name := 'grdMessages';
SetPosition(4, 55, 478, 254);
Anchors := [anLeft,anRight,anTop,anBottom];
+ BackgroundColor := TfpgColor($80000002);
AddColumn('Type', 50, taLeftJustify);
AddColumn('Time', 75, taCenter);
AddColumn('Message', 330, taLeftJustify);
@@ -362,6 +412,8 @@ begin
TabOrder := 2;
Options := [go_SmoothScroll];
OnDrawCell := @GridDrawCell;
+// OnRowChange := @GridRowChanged;
+ OnClick := @GridClicked;
end;
mnuFile := TfpgPopupMenu.Create(self);
@@ -379,9 +431,9 @@ begin
begin
Name := 'mnuEdit';
SetPosition(260, 126, 120, 24);
-// AddMenuItem('Cut', '', nil).Enabled := False;
+ // AddMenuItem('Cut', '', nil).Enabled := False;
AddMenuItem('Copy selected message to clipboard', rsKeyCtrl+'C', @miEditCopy);
-// AddMenuItem('Paste', '', nil).Enabled := False;
+ // AddMenuItem('Paste', '', nil).Enabled := False;
AddMenuItem('-', '', nil);
AddMenuItem('Preferences...', '', nil).Enabled := False;
end;
@@ -418,8 +470,8 @@ begin
Name := 'Bevel2';
SetPosition(34, 2, 8, 25);
Hint := '';
- Style := bsLowered;
Shape := bsLeftLine;
+ Style := bsLowered;
end;
btnPause := TfpgButton.Create(Bevel1);
@@ -447,6 +499,7 @@ begin
Name := 'btnStart';
SetPosition(67, 2, 24, 24);
Text := '';
+ Enabled := False;
Flat := True;
FontDesc := '#Label1';
Hint := 'start server';
@@ -456,7 +509,6 @@ begin
TabOrder := 2;
Focusable := False;
OnClick := @btnStartClicked;
- Enabled := False;
end;
btnClear := TfpgButton.Create(Bevel1);
@@ -476,6 +528,35 @@ begin
OnClick :=@btnClearClicked;
end;
+ btnExpandView := TfpgButton.Create(Bevel1);
+ with btnExpandView do
+ begin
+ Name := 'btnExpandView';
+ SetPosition(128, 2, 24, 24);
+ Text := '';
+ AllowAllUp := True;
+ Flat := True;
+ FontDesc := '#Label1';
+ GroupIndex := 2;
+ Hint := 'Toggle expanded view';
+ ImageMargin := -1;
+ ImageName := 'dbs.extended_view';
+ ImageSpacing := 0;
+ TabOrder := 6;
+ Focusable := False;
+ OnClick := @btnExpandViewClicked;
+ end;
+
+ Bevel3 := TfpgBevel.Create(Bevel1);
+ with Bevel3 do
+ begin
+ Name := 'Bevel3';
+ SetPosition(120, 2, 8, 24);
+ Hint := '';
+ Shape := bsLeftLine;
+ Style := bsLowered;
+ end;
+
{@VFD_BODY_END: MainForm}
{%endregion}
diff --git a/examples/apps/debugserver/images.inc b/examples/apps/debugserver/images.inc
index 166155c9..ce33402d 100644
--- a/examples/apps/debugserver/images.inc
+++ b/examples/apps/debugserver/images.inc
@@ -206,3 +206,57 @@ Const
255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
255, 0,255,255, 0,255);
+
+
+const
+ DBS_extended_view: array[0..821] of byte = (
+ 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0,
+ 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101,
+ 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,
+ 101, 52,164,101, 52,164,101, 52,164,101, 52,255, 0,255,255, 0,255,
+ 164,101, 52,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,164,101, 52,215,166,125,215,166,125,215,
+ 166,125,215,166,125,164,101, 52,255, 0,255,255, 0,255,164,101, 52,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,164,101, 52,215,166,125,215,166,125,215,166,125,215,
+ 166,125,164,101, 52,255, 0,255,255, 0,255,164,101, 52,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,164,101, 52,215,166,125,215,166,125,215,166,125,215,166,125,164,
+ 101, 52,255, 0,255,255, 0,255,164,101, 52,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,164,101,
+ 52,215,166,125,215,166,125,215,166,125,215,166,125,164,101, 52,255,
+ 0,255,255, 0,255,164,101, 52,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,164,101, 52,215,166,
+ 125,215,166,125,215,166,125,215,166,125,164,101, 52,255, 0,255,255,
+ 0,255,164,101, 52,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,164,101, 52,215,166,125,215,166,
+ 125,215,166,125,215,166,125,164,101, 52,255, 0,255,255, 0,255,164,
+ 101, 52,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,164,101, 52,215,166,125,215,166,125,215,166,
+ 125,215,166,125,164,101, 52,255, 0,255,255, 0,255,164,101, 52,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 255,255,255,164,101, 52,215,166,125,215,166,125,215,166,125,215,166,
+ 125,164,101, 52,255, 0,255,255, 0,255,164,101, 52,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 164,101, 52,215,166,125,215,166,125,215,166,125,215,166,125,164,101,
+ 52,255, 0,255,255, 0,255,164,101, 52,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,164,101, 52,
+ 215,166,125,215,166,125,215,166,125,215,166,125,164,101, 52,255, 0,
+ 255,255, 0,255,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,
+ 101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,
+ 164,101, 52,164,101, 52,164,101, 52,164,101, 52,255, 0,255,255, 0,
+ 255,164,101, 52,200,208,212,164,101, 52,164,101, 52,164,101, 52,164,
+ 101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,200,208,212,
+ 164,101, 52,200,208,212,164,101, 52,255, 0,255,255, 0,255,164,101,
+ 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,
+ 101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,
+ 164,101, 52,164,101, 52,255, 0,255,255, 0,255,255, 0,255,255, 0,
+ 255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255,
+ 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,
+ 255, 0,255,255, 0,255);
+
diff --git a/examples/apps/debugserver/images/extended_view.bmp b/examples/apps/debugserver/images/extended_view.bmp
new file mode 100644
index 00000000..d137c6c4
--- /dev/null
+++ b/examples/apps/debugserver/images/extended_view.bmp
Binary files differ