fpmhelp.inc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Help menu entries
  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. procedure TIDEApp.HelpContents;
  13. begin
  14. HelpTopic('Help_Contents'{0,hcContents,false});
  15. end;
  16. procedure TIDEApp.HelpHelpIndex;
  17. begin
  18. HelpIndex('');
  19. end;
  20. procedure TIDEApp.HelpTopicSearch;
  21. begin
  22. end;
  23. procedure TIDEApp.HelpPrevTopic;
  24. begin
  25. if HelpWindow=nil then HelpContents else
  26. with HelpWindow^ do
  27. if GetState(sfVisible) then Message(HelpWindow^.HelpView,evCommand,cmPrevTopic,nil)
  28. else begin HelpWindow^.Show; HelpWindow^.MakeFirst; end;
  29. end;
  30. procedure TIDEApp.HelpUsingHelp;
  31. begin
  32. Help(0,hcUsingHelp,false);
  33. end;
  34. type
  35. PHelpFilesDialog = ^THelpFilesDialog;
  36. THelpFilesDialog = object(TCenterDialog)
  37. constructor Init;
  38. procedure HandleEvent(var Event: TEvent); virtual;
  39. destructor Done; virtual;
  40. private
  41. LB: PListBox;
  42. C : PUnsortedStringCollection;
  43. end;
  44. constructor THelpFilesDialog.Init;
  45. var R,R2: TRect;
  46. SB: PScrollBar;
  47. I: integer;
  48. begin
  49. R.Assign(0,0,50,15);
  50. inherited Init(R, 'Install Help Files');
  51. New(C, Init(20,10));
  52. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.X:=37;
  53. R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
  54. New(SB, Init(R2)); Insert(SB);
  55. New(LB, Init(R, 1, SB));
  56. for I:=0 to HelpFiles^.Count-1 do
  57. begin
  58. C^.Insert(NewStr(HelpFiles^.At(I)^));
  59. end;
  60. LB^.NewList(C);
  61. Insert(LB);
  62. R2.Copy(R); Dec(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  63. Insert(New(PLabel, Init(R2, '~H~elp files', LB)));
  64. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.A.X:=38; R.B.Y:=R.A.Y+2;
  65. Insert(New(PButton, Init(R, 'O~K~', cmOK, bfDefault)));
  66. R.Move(0,2);
  67. Insert(New(PButton, Init(R, '~N~ew', cmAddItem, bfNormal)));
  68. R.Move(0,2);
  69. Insert(New(PButton, Init(R, '~D~elete', cmDeleteItem, bfNormal)));
  70. R.Move(0,2);
  71. Insert(New(PButton, Init(R, 'Cancel', cmCancel, bfNormal)));
  72. LB^.Select;
  73. end;
  74. procedure THelpFilesDialog.HandleEvent(var Event: TEvent);
  75. var I: integer;
  76. D: PFileDialog;
  77. FileName: string;
  78. begin
  79. case Event.What of
  80. evKeyDown :
  81. case Event.KeyCode of
  82. kbIns :
  83. begin
  84. Message(@Self,evCommand,cmAddItem,nil);
  85. ClearEvent(Event);
  86. end;
  87. kbDel :
  88. begin
  89. Message(@Self,evCommand,cmDeleteItem,nil);
  90. ClearEvent(Event);
  91. end;
  92. end;
  93. evCommand :
  94. case Event.Command of
  95. cmAddItem :
  96. begin
  97. New(D, Init('*.tph','Install a help file','*.tph',fdOpenButton,0));
  98. if Desktop^.ExecView(D)<>cmCancel then
  99. begin
  100. D^.GetFileName(FileName);
  101. LB^.List^.Insert(NewStr(FileName));
  102. LB^.SetRange(LB^.List^.Count);
  103. ReDraw;
  104. end;
  105. Dispose(D, Done);
  106. ClearEvent(Event);
  107. end;
  108. cmDeleteItem :
  109. if LB^.Range>0 then
  110. begin
  111. LB^.List^.AtFree(LB^.Focused);
  112. LB^.SetRange(LB^.List^.Count);
  113. ReDraw;
  114. ClearEvent(Event);
  115. end;
  116. cmOK :
  117. begin
  118. HelpFiles^.FreeAll;
  119. for I:=0 to LB^.List^.Count-1 do
  120. HelpFiles^.Insert(NewStr(C^.At(I)^));
  121. end;
  122. end;
  123. end;
  124. inherited HandleEvent(Event);
  125. end;
  126. destructor THelpFilesDialog.Done;
  127. begin
  128. if C<>nil then begin C^.DeleteAll; Dispose(C, Done); end;
  129. inherited Done;
  130. end;
  131. procedure TIDEApp.HelpFiles;
  132. begin
  133. if Desktop^.ExecView(New(PHelpFilesDialog, Init))=cmOK then
  134. begin
  135. DoneHelpSystem;
  136. InitHelpSystem;
  137. end;
  138. end;
  139. procedure TIDEApp.About;
  140. var R,R2: TRect;
  141. D: PCenterDialog;
  142. OSStr: string;
  143. begin
  144. OSStr:='';
  145. {$ifdef go32v2}
  146. OSStr:='Dos';
  147. {$endif}
  148. {$ifdef tp}
  149. OSStr:='Dos';
  150. {$endif}
  151. {$ifdef linux}
  152. OSStr:='Linux';
  153. {$endif}
  154. {$ifdef win32}
  155. OSStr:='Win32';
  156. {$endif}
  157. {$ifdef os2}
  158. OSStr:='OS/2';
  159. {$endif}
  160. R.Assign(0,0,46,12);
  161. New(D, Init(R, 'About'));
  162. with D^ do
  163. begin
  164. GetExtent(R); R.Grow(-3,-2);
  165. R2.Copy(R); R2.B.Y:=R2.A.Y+1;
  166. Insert(New(PStaticText, Init(R2, ^C'FreePascal IDE for '+OSStr+' Version '+VersionStr)));
  167. R2.Move(0,1);
  168. Insert(New(PStaticText, Init(R2, ^C'(Compiler Version '+Version_String+')')));
  169. R2.Move(0,2);
  170. Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-99 by')));
  171. R2.Move(0,2);
  172. Insert(New(PStaticText, Init(R2, ^C'B‚rczi G bor')));
  173. R2.Move(0,1);
  174. Insert(New(PStaticText, Init(R2, ^C'and')));
  175. R2.Move(0,1);
  176. Insert(New(PStaticText, Init(R2, ^C'Peter Vreman')));
  177. end;
  178. InsertOK(D);
  179. Desktop^.ExecView(D);
  180. Dispose(D, Done);
  181. end;
  182. {
  183. $Log$
  184. Revision 1.5 1999-02-22 02:15:16 peter
  185. + default extension for save in the editor
  186. + Separate Text to Find for the grep dialog
  187. * fixed redir crash with tp7
  188. Revision 1.4 1999/01/21 11:54:18 peter
  189. + tools menu
  190. + speedsearch in symbolbrowser
  191. * working run command
  192. Revision 1.3 1999/01/12 14:29:34 peter
  193. + Implemented still missing 'switch' entries in Options menu
  194. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  195. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  196. ASCII chars and inserted directly in the text.
  197. + Added symbol browser
  198. * splitted fp.pas to fpide.pas
  199. Revision 1.2 1998/12/28 15:47:48 peter
  200. + Added user screen support, display & window
  201. + Implemented Editor,Mouse Options dialog
  202. + Added location of .INI and .CFG file
  203. + Option (INI) file managment implemented (see bottom of Options Menu)
  204. + Switches updated
  205. + Run program
  206. Revision 1.2 1998/12/22 10:39:47 peter
  207. + options are now written/read
  208. + find and replace routines
  209. }