1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
|
{
This file is part of the Free Pascal run time library.
Copyright (c) 2003 by the Free Pascal development team
Main form of GTK debugserver
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program 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.
**********************************************************************}
{$mode objfpc}
{$h+}
unit frmmain;
Interface
uses
fpgtk,fpgtkext,glib,gtk,gdk,debugserverintf,sysutils,msgintf,classes,inifiles;
Type
TClientCList = Class(TFPGtkScrollClist)
Protected
FTabLabel : TFPgtkLabel;
FClient : TClient;
Public
Constructor Create (AClient : TClient);
Property Client : TClient Read FClient Write FClient;
Property TabLabel : TFPgtkLabel Read FTabLabel Write FTabLabel;
end;
TMainForm = Class (TFPGtkWindow)
Private
// 'real' Variables
FCreating,
FPaused,
FInsertNew,
FCloseOnDisconnect,
FLoadSinglePage,
FSinglePage : Boolean;
FIdleHandle : gint;
FMsgImages : Array[-1..3] of PgdkPixmap;
FMsgMasks : Array[-1..3] of Pgdkbitmap;
// Widgets
FVBox : TFPGtkVBox;
FMainMenu : TFpGtkMenuBar;
FFile, // File menu
FFileClear,
FFileSave,
FFileExit,
FFileClose,
FOptions,
FHelp, // Help menu
FHelpAbout : TFPGtkMenuItem;
FOptionsInsertNew,
FOptionsSinglePage,
FOptionsCloseOnDisconnect,
FFilePause : TFPGtkCheckMenuItem;
FConnectImage,
FDisconnectImage,
FInfoImage,
FWarningImage,
FErrorImage,
FClearImage,
FSaveImage,
FCloseImage,
FPauseImage,
FRunImage,
FRunButtonImage : TFPGtkPixmap;
FMainToolbar : TFPGtkToolbar;
FToolbarFrame : TFPGtkFrame;
FPages : TfpGTKNotebook;
FList : TClientCList;
FRunButton : TFPgtkButton;
FRunImages : Array[Boolean] of PgdkPixmap;
FRunMasks : Array[Boolean] of Pgdkbitmap;
Public
// General
Constructor Create;
Procedure CreateWindow;
Procedure LoadSettings;
Procedure SaveSettings;
Function SettingsFilename : String;
Procedure SetupDebugServer;
Procedure ShutdownDebugServer;
// List/Client management
Procedure SaveToFile(C : TClientCList; FN : String);
Function NewList(Client : TClient) : TClientCList;
Function GetList(Client : TClient) : TClientClist;
Procedure HaveData(Handle : Gint);
Procedure AddEventToList(Event : TDebugEvent);
Function CheckForNewClient : TClient;
Function CurrentList : TClientCList;
Function GetClientPageIndex(Client : TClient) : Integer;
Procedure ConnectionClosed(C : TCLient);
Procedure SetRunButtonBitmaps;
Function GetFileName(ATitle : String) : String;
Procedure DialogSetFilename(Sender : TFPGtkWindow;Data : Pointer; Action : Integer;Initiator : TFPGtkObject);
// User callbacks
Procedure FileClearClick(Sender : TFPGtkObject; Data : Pointer);
Procedure FileSaveClick(Sender : TFPGtkObject; Data : Pointer);
Procedure FileCopyClick(Sender : TFPGtkObject; Data : Pointer);
Procedure FilePauseClick(Sender : TFPGtkObject; Data : Pointer);
Procedure FileCloseClick(Sender : TFPGtkObject; Data : Pointer);
Procedure FileExitClick(Sender : TFPGtkObject; Data : Pointer);
Procedure OptionsClick(Sender : TFPGtkObject; Data : Pointer);
Procedure HelpAboutClick(Sender : TFPGtkObject; Data : Pointer);
Function OnDeleteEvent(Sender:TFPgtkWidget; Event:PGdkEvent; data:pointer): boolean;
end;
Implementation
uses frmabout,bitmapdata;
ResourceString
SCaption = 'FPC Debug server';
SMenuFile = '_File';
SMenuFileClear = 'Clea_r';
SMenuFileSave = '_Save';
SMenuFileCopy = '_Copy';
SMenuFilePause = '_Pause';
SMenuFileClose = 'C_lose';
SMenuFileExit = 'E_xit';
SMenuOptions = '_Options';
SMenuOptionsInsertNew = '_New messages first';
SMenuOptionsSinglePage = '_All clients on 1 page';
SMenuOptionsCloseOnDisconnect = '_Close client on disconnect';
SMenuHelp = '_Help';
SMenuHelpAbout = '_About';
SHintFileClear = 'Clear current list';
SHintFileSave = 'Save current list to disk';
SHintFilePause = 'Discard new messages';
SHintFileClose = 'Close current list';
SNewClient = 'New client';
SMessageFrom = '[%s] : %s';
SSaveFileTitle = 'Save list to file:';
SNeedsRestart = 'Restart debugserver for this option to take effect.';
Const
SKeyParameters = 'Parameters';
SKeySinglePage = 'SinglePage';
SKeyCloseOnDisconnect = 'CloseOnDisconnect';
SkeyInsertNew = 'InsertNewMessages';
SConfigFile = 'debugserver.cnf';
DefaultSinglePage = True;
DefaultCloseOnConnect = False;
DefaultInsertNew = True;
Const
DefaultTooltips = True;
DefaultToolBarStyle = GTK_TOOLBAR_ICONS;
DefaultToolbarRelief = GTK_RELIEF_NONE;
{ ---------------------------------------------------------------------
TClientCList
---------------------------------------------------------------------}
Constructor TClientCList.Create(Aclient : TClient);
begin
Inherited Create(3);
FClient:=AClient;
Clist.ShowTitles;
CList.PassiveTitles;
Clist.ColumnTitle[0]:='*';
Clist.ColumnTitle[1]:='Time';
Clist.ColumnTitle[2]:='Message';
CLIST.SetColumnWidth(0,20);
CList.SetColumnResizeable(0,False);
CLIST.SetColumnWidth(1,120);
end;
{ ---------------------------------------------------------------------
MainForm - General
---------------------------------------------------------------------}
// Cludge to go around TFPgtkBin.Child not being public...
Type
TMyBin = Class(TFPgtkBin)
Public
Property Child;
end;
Procedure TMainForm.CreateWindow;
Var
V : TFPGtkHBox;
FAccelGroup: Integer;
begin
{ File Menu }
Title:=SCaption;
FAccelGroup:=AccelGroupNew;
FFileClear := NewMenuItem(SMenuFileClear ,'','',MakeAccelKeyDef(Self,FaccelGroup,GDK_L,[amcontrol]),@FileClearClick,Nil);
FFileSave := NewMenuItem(SMenuFileSave ,'','',MakeAccelKeyDef(Self,FaccelGroup,GDK_S,[amcontrol]),@FileSaveClick,Nil);
FFilePause := NewCheckMenuItem(SMenuFilePause ,'','',MakeAccelKeyDef(Self,FaccelGroup,GDK_P,[amcontrol]),@FilePauseClick,Nil);
If Not FSinglePage then
FFileClose := NewMenuItem(SMenuFileClose ,'','',MakeAccelKeyDef(Self,FaccelGroup,GDK_W,[amcontrol]),@FileCloseClick,Nil);
FFileExit := NewMenuItem(SMenuFileExit ,'','',MakeAccelKeyDef(Self,FaccelGroup,GDK_Q,[amcontrol]),@FileExitClick,Nil);
If FSinglePage then
FFile := NewSubMenu(SMenuFile,'','',[FFileClear,FFileSave,FFilePause,NewLine,FFileExit])
else
FFile := NewSubMenu(SMenuFile,'','',[FFileClear,FFileSave,FFilePause,FFileClose,NewLine,FFileExit]);
{ Options menu }
FOptionsInsertNew := NewCheckMenuItem(SMenuOptionsInsertNew,'','', @OptionsClick,@FInsertNew);
FOptionsInsertNew.Active:=FInsertNew;
FOptionsSinglePage := NewCheckMenuItem(SMenuOptionsSinglePage,'','', @OptionsClick,@FLoadSinglePage);
FOptionsSinglePage.Active:=FSinglePage;
FOptionsCloseOnDisconnect := NewCheckMenuItem(SMenuOptionsCloseOnDisconnect,'','', @OptionsClick,@FCloseOnDisconnect);
FOptionsCloseOnDisconnect.active:=FCloseOnDisconnect;
FOptions := NewSubMenu(SMenuOptions,'','',[FOptionsInsertNew,FOptionsSinglePage,FOptionsCloseOnDisconnect]);
{ Help Menu }
FHelpAbout:=NewMenuItem(SMenuHelpAbout ,'','',@HelpAboutClick,Nil);
FHelp := NewSubMenu(SMenuHelp,'','',[FHelpAbout]);
{ Menu bar }
FMainMenu:=NewMenuBar([FFile,FOptions,FHelp]);
{ Toolbar images }
FClearImage:=PixmapFromFile('clear');
FPauseImage:=PixmapFromFile('pause');
FRunImage:=PixmapFromFile('run');
FCloseImage:=PixMapFromFile('close');
FSaveImage:=PixmapFromFile('save');
FRunButtonImage:=TFPGtkPixmap.Create;
FRunImages[False]:=FPauseImage.PixMap;
FRunMasks[False]:=FPauseImage.Mask;
FRunImages[True]:=FRunImage.PixMap;
FRunMasks[True]:=FRunImage.Mask;
SetRunButtonBitmaps;
{ Message images }
FConnectImage:=PixMapFromFile('connect');
FDisConnectImage:=PixMapFromFile('disconnect');
FinfoImage:=PixmapFromFile('info');
FWarningImage:=PixmapFromFile('warning');
FErrorImage:=PixmapFromFile('error');
{ Save references for quick lookup}
FMsgImages[-1]:=FDisconnectImage.PixMap;
FMsgImages[0]:=FinfoImage.PixMap;
FMsgImages[1]:=FWarningImage.PixMap;
FMsgImages[2]:=FErrorImage.PixMap;
FMsgImages[3]:=FConnectImage.PixMap;
FMsgMasks[-1]:=FDisconnectImage.Mask;
FMsgMasks[0]:=FinfoImage.Mask;
FMsgMasks[1]:=FWarningImage.Mask;
FMsgMasks[2]:=FErrorImage.Mask;
FMsgMasks[3]:=FConnectImage.Mask;
{ Toolbar }
FMainToolBar:=TFPGtkToolbar.Create;
With FMainToolbar do
begin
Style:=DefaultToolbarStyle;
ButtonRelief:=DefaultToolbarRelief;
EnableTooltips:=DefaultTooltips;
AppendItem(SMenuFileClear,SHintFileClear,'',FClearImage,@FileClearClick,Nil);
AppendItem(SMenuFileSave,SHintFileSave,'',FSaveImage,@FileSaveClick,Nil);
FRunButton:=AppendItem(SMenuFilePause,SHintFilePause,'',FRunButtonImage,@FilePauseClick,Nil) as TFPgtkButton;
AppendItem(SMenuFileClose,SHintFileClose,'',FCloseImage,@FileCloseClick,Nil);
end;
{ place left aligned on frame }
V:=TFPGtkHBox.Create;
V.PackStart(FMainToolbar,False,False,2);
FToolbarFrame:=TFPGtkFrame.Create;
FtoolbarFrame.Add(V);
{ For Pages }
// FPages:=TFPGtkNoteBook.Create;
If FSinglePage then
FList:=NewList(Nil)
else
FPages:=TFPGtkNoteBook.Create;
{ Place on form }
FVBox:=TFPGTKVBox.create;
FVBox.PackStart(FMainMenu,false, true, 0);
FVBox.PackStart(FToolBarFrame,false, true, 0);
If FSinglePage then
FVBox.PackStart(FList,true, true, 0)
else
FVBox.PackStart(FPages,true, true, 0);
Self.add(FVBox);
Setusize(640,480);
ConnectDeleteEvent(@OnDeleteEvent,Nil);
end;
Constructor TMainForm.Create;
begin
Inherited Create(gtk_window_dialog);
LoadSettings;
FSinglePage:=FLoadSinglePage;
FPaused:=False;
FCreating:=True;
Try
CreateWindow;
Finally
FCreating:=False;
end;
SetUpDebugServer;
end;
Procedure TMainForm.SetRunButtonBitmaps;
begin
FRunButtonImage.SetPixMap(FRunImages[FPaused],FRunMasks[FPaused]);
end;
Function TMainForm.SettingsFileName : String;
Var
Home : String;
begin
Home:=GetEnvironmentVariable('HOME');
If (Home<>'') then
Result:=IncludeTrailingBackslash(Home)+'.'+SConfigFile
else
Result:=SConfigFile;
end;
Procedure TMainForm.LoadSettings;
begin
With TIniFile.Create(SettingsFileName) do
Try
FLoadSinglePage:=ReadBool(SKeyParameters,SkeySinglePage,DefaultSinglePage);
FCloseOnDisconnect:=ReadBool(SKeyParameters,SkeyCloseOnDisconnect,DefaultCloseOnConnect);
FInsertNew:=ReadBool(SKeyParameters,SKeyInsertNew,DefaultInsertNew);
finally
Free;
end;
end;
Procedure TMainForm.SaveSettings;
begin
With TIniFile.Create(SettingsFileName) do
Try
WriteBool(SKeyParameters,SkeySinglePage,FLoadSinglePage);
WriteBool(SKeyParameters,SkeyCloseOnDisconnect,FCloseOnDisconnect);
WriteBool(SKeyParameters,SKeyInsertNew,FinsertNew);
UpdateFile;
finally
Free;
end;
end;
{ ---------------------------------------------------------------------
Event handling.
---------------------------------------------------------------------}
// GTK idle callback, to check for new connections during idle time.
function GtkIdle (Data:pointer) : gint; Cdecl;
begin
With (TObject(Data) as TMainForm) do
CheckForNewClient;
end;
// When input appears on one of the handles, we come here through the gtk
// input watch.
Procedure GtkHaveInput (Data : GPointer; Source : gint; Condition : TGDKInputCondition);cdecl;
begin
With (TObject(Data) as TMainForm) do
HaveData(Source);
end;
// Real methods.
Procedure TMainForm.SetupDebugServer;
begin
OpenDebugServer;
FIdleHandle:=gtk_idle_add(@GtkIdle,Self);
CloseObjConnectionCallBack:=@Self.ConnectionClosed;
end;
Procedure TMainForm.ShutdownDebugServer;
begin
CloseObjConnectionCallBack:=Nil;
gtk_idle_remove(FIdleHandle);
CloseDebugServer;
end;
// tell gdk not to watch this handle any more.
// Clean up of the associated page happens in log event.
Procedure TMainForm.ConnectionClosed(C : TCLient);
begin
gdk_input_remove(gint(C.Data));
end;
// We get here when data is present on socket.
Procedure TMainForm.HaveData(Handle : Gint);
Var
Event : TDebugEvent;
begin
ReadMessageEvent(Handle,Event);
AddEventToList(Event);
end;
// Check if a new client has reported ?
Function TMainForm.CheckForNewClient : TClient;
Var
IHandle : gint;
L : TClientCList;
begin
// Writeln('Checking new client');
Result:=CheckNewConnection;
If Result<>Nil then
begin
If Not FSinglePage then
begin
L:=NewList(Result);
FPages.AppendPage(L,L.TabLabel);
FPages.Page:=L;
// Force draw.
Fpages.Draw(Nil);
L.ShowNow;
L.Draw(Nil);
L.Clist.draw(Nil);
end;
IHandle:=gdk_input_add(Result.Handle,GDK_INPUT_READ,@GtkHaveInput,self);
Result.Data:=Pointer(IHandle);
end;
end;
// Add event data to the appropriate list.
Procedure TMainForm.AddEventToList(Event : TDebugEvent);
Const
MsgTypeStrings : Array[-1..3] of String = ('*','?','!','!','.');
Var
T,D,S : String;
L : TClientCList;
TL : TFPgtkWidget;
SL : TStringList;
Index : Integer;
begin
With Event do
begin
T:=MsgTypeStrings[LogCode];
D:=DateTimeToStr(TimeStamp);
If FSinglePage or (logcode<>lctIdentify) then
S:=Format(SMessageFrom,[Client.Peer,Event])
else
S:=Event;
L:=Nil;
If Assigned(Client) then
L:=GetList(Client);
If L=Nil then
Writeln('No list found for event ',s)
else
begin
If (LogCode=lctIdentify) then
If Not FSinglePage then
L.TabLabel.Text:=Event;
If Not FPaused then
begin
If FInsertNew then
begin
Index:=0;
L.CList.Prepend([T,D,S]);
end
else
Index:=L.CList.Append([T,D,S]);
L.Clist.SetPixMap(Index,0,FMsgImages[logCode],FmsgMasks[LogCode]);
end;
If LogCode=lctStop then
begin
L.Client:=Nil; // New clients MAY have the same addresspointer as existing;
If (Not FSinglePage) and FCloseOnDisconnect then
L.Free;
end;
end;
end;
CheckForNewClient;
end;
// Create new list.
Function TMainForm.NewList(Client : TClient) : TClientCList;
begin
Result:=TClientCList.Create(Client);
If Client<>Nil then
Result.TabLabel:=TfpGtkLabel.Create(SNewClient);
end;
// Get page index on which messages for client are shown.
// Only call when FSinglePage is not true
Function TMainForm.GetClientPageIndex(Client : TClient) : Integer;
Var
P : TFPgtkWidget;
begin
With FPages,Children do
begin
Result:=Count-1;
While Result>=0 do
begin
P:=GetChildOnPage(Result);
if Not(P is TClientClist) or
(TClientClist(P).Client<>Client) Then
Dec(Result)
end
end;
end;
// Get list on which messages for client are shown.
// Only call when FSinglePage is not true
Function TMainForm.GetList(Client : TClient) : TClientCList;
Var
I : Integer;
P : TFPgtkWidget;
begin
If FSinglePage then
Result:=FList
else
begin
With FPages,Children do
For I:=0 to Count-1 do
begin
P:=GetChildOnPage(i);
if P is TClientClist then
If TClientClist(P).Client=Client Then
begin
Result:=TClientClist(P);
exit
end;
end;
end;
end;
// Return current list.
Function TMainForm.CurrentList : TClientClist;
begin
If FSinglePage then
Result:=FList
else
Result:=FPages.Page as TClientCList;
end;
// Write list contents to file.
Procedure TMainForm.SaveToFile(C : TClientCList; FN : String);
Var
F : System.text;
I,J : Integer;
S,T : String;
P : PGdkPixmap;
M : PGdkBitmap;
begin
Assign(F,FN);
rewrite(F);
Try
With C.Clist do
For I:=0 To count-1 do
begin
GetPixmap(I,0,P,M);
For J:=-1 to 3 do
If (FMsgImages[J]=P) then
T:=MsgTypes[J];
S:=T+' '+CellText[i,1]+' '+Celltext[I,2];
Writeln(F,S);
end;
finally
System.Close(f);
end;
end;
{ ---------------------------------------------------------------------
Callbacks for user events.
---------------------------------------------------------------------}
Procedure TMainForm.FileClearClick(Sender : TFPGtkObject; Data : Pointer);
Var
L:TClientClist;
begin
L:=CurrentList;
If L<>Nil then
L.Clist.Clear;
end;
Procedure TMainForm.DialogSetFilename(Sender : TFPGtkWindow;Data : Pointer; Action : Integer;Initiator : TFPGtkObject);
type
PString = ^AnsiString;
begin
PString(Data)^:=(Sender as TFPgtkFileSelection).Filename;
end;
Function TMainForm.GetFileName(ATitle : String) : String;
var
FS : TFPgtkFileSelection;
begin
FS := TFPgtkFileSelection.Create (gtk_window_dialog);
Result:='';
with FS do
begin
Title:=ATitle;
OKButton.ConnectClicked (@(CloseWithResult), inttopointer(drOk));
CancelButton.ConnectClicked (@(CloseWindow), nil);
if Not execute (nil, @Result, @DialogSetFilename) = drOk then
Result:='';
end;
end;
Procedure TMainForm.FileSaveClick(Sender : TFPGtkObject; Data : Pointer);
Var
L:TClientClist;
FN : String;
begin
L:=CurrentList;
If L<>Nil then
begin
FN:=GetFileName(SSaveFileTitle);
If (FN<>'') then
SaveToFile(L,Fn);
end;
end;
Procedure TMainForm.FileCopyClick(Sender : TFPGtkObject; Data : Pointer);
// not used for the moment; need to figure out a way to do this.
begin
end;
Procedure TMainForm.FilePauseClick(Sender : TFPGtkObject; Data : Pointer);
begin
If (Sender<>FFilePause) then
With FFilePause do
Active:=Not Active;
FPaused:=FFilePause.Active;
SetRunButtonBitmaps;
end;
Procedure TMainForm.FileCloseClick(Sender : TFPGtkObject; Data : Pointer);
Var
L : TClientCList;
begin
L:=CurrentList;
If (L<>Nil) and (L.Client=Nil) then
L.Free;
end;
Procedure TMainForm.FileExitClick(Sender : TFPGtkObject; Data : Pointer);
begin
ShutdownDebugServer;
Close;
end;
Procedure TMainForm.OptionsClick(Sender : TFPGtkObject; Data : Pointer);
Type
PBoolean = ^boolean;
begin
If not FCreating then
begin
PBoolean(data)^:=Not PBoolean(data)^;
SaveSettings;
If (@FLoadSinglePage=Data) then
ShowMessage(SCaption,SNeedsRestart);
end;
end;
Procedure TMainForm.HelpAboutClick(Sender : TFPGtkObject; Data : Pointer);
begin
With TAboutForm.Create do
Execute(Nil,Nil,Nil);
end;
Function TMainForm.OnDeleteEvent(Sender:TFPgtkWidget; Event:PGdkEvent; data:pointer): boolean;
begin
ShutdownDebugServer;
Result:=True;
end;
end.
|