2
0

frmabout.pp 2.3 KB

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