frmabout.pp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2003 by the Free Pascal development team
  5. About form for debug server
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$mode objfpc}
  13. {$h+}
  14. unit frmabout;
  15. interface
  16. uses fpgtk,gtk,classes,sysutils;
  17. Type
  18. TAboutForm = Class (TFPGtkWindow)
  19. FAboutText : TFPGtkLabel;
  20. FSeparator : TFPGtkHSeparator;
  21. FVBox : TFPgtkVBox;
  22. FOK,
  23. FCancel : TFPGtkButton;
  24. FButtonBox: TFPgtkHBox;
  25. Constructor Create;
  26. Procedure CreateWindow;
  27. Function GetListen : String;
  28. end;
  29. Implementation
  30. uses msgintf;
  31. Resourcestring
  32. SAbout1 = 'Free Pascal debug server.';
  33. SAbout2 = '(c) 2003, Michael Van Canneyt';
  34. SAbout3 = 'Server listening on : %s';
  35. SUnixSocket = 'Unix socket "%s"';
  36. SInetPort = 'TCP/IP port %d';
  37. SUnknown = 'Unknown';
  38. SOK = 'OK';
  39. SCancel = 'Cancel';
  40. Constructor TAboutForm.Create;
  41. begin
  42. Inherited Create(GTK_WINDOW_DIALOG);
  43. CreateWindow;
  44. end;
  45. Function TAboutForm.GetListen : String;
  46. begin
  47. Case debugconnection of
  48. dcUnix : Result:=Format(SUnixSocket,[DebugSocket]);
  49. dcInet : Result:=Format(SInetPort,[DebugPort]);
  50. else
  51. Result:=SUnknown;
  52. end;
  53. end;
  54. Procedure TAboutForm.CreateWindow;
  55. Var
  56. S : String;
  57. begin
  58. FVBox:=TFPGtkVBox.Create;
  59. FVBox.Spacing:=4;
  60. FVBox.Border:=8;
  61. Add(FVBox);
  62. // About text
  63. S:=SAbout1+LineEnding+SAbout2;
  64. S:=S+LineEnding+Format(SABout3,[GetListen]);
  65. FAboutText:=TFPgtkLabel.Create(S);
  66. // button area
  67. FOK:=TFpGtkButton.CreateWithLabel(SOK);
  68. FOK.ConnectClicked(@CloseWithResult,IntToPointer(drOK));
  69. FCancel:=TFPgtkButton.CreateWithLabel(SCancel);
  70. FCancel.ConnectCLicked(@CloseWithResult,IntToPointer(drCancel));
  71. FSeparator:=TFPgtkHSeparator.Create;
  72. FButtonBox:=TfpGtkHBox.Create;
  73. FButtonBox.Spacing:=4;
  74. FButtonBox.PackEnd(FOK,false,false,4);
  75. FButtonBox.PackEnd(FCancel,false,false,4);
  76. // Add to window
  77. FVBox.PackStart(FAboutText,True,True,0);
  78. FVBox.PackStart(FSeparator,False,False,4);
  79. FVBox.PackStart(FButtonBox,false,false,0);
  80. end;
  81. end.
  82. {
  83. $Log$
  84. Revision 1.1 2003-01-02 14:36:25 michael
  85. + Initial implementation
  86. }