fpmhelp.inc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. {
  2. $Id$
  3. This file is part of the ffff
  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. PHelpFileListBox = ^THelpFileListBox;
  36. THelpFileListBox = object(TListBox)
  37. function GetText(Item: Integer; MaxLen: Integer): String; virtual;
  38. end;
  39. PHelpFilesDialog = ^THelpFilesDialog;
  40. THelpFilesDialog = object(TCenterDialog)
  41. constructor Init;
  42. procedure HandleEvent(var Event: TEvent); virtual;
  43. destructor Done; virtual;
  44. private
  45. LB: PHelpFileListBox;
  46. C : PUnsortedStringCollection;
  47. end;
  48. function THelpFileListBox.GetText(Item: Integer; MaxLen: Integer): String;
  49. var S: string;
  50. P: integer;
  51. begin
  52. S:=inherited GetText(Item,MaxLen);
  53. P:=Pos('|',S);
  54. if P>0 then S:=copy(S,P+1,255)+' - '+copy(S,1,P-1);
  55. GetText:=copy(S,1,MaxLen);
  56. end;
  57. constructor THelpFilesDialog.Init;
  58. var R,R2: TRect;
  59. SB: PScrollBar;
  60. I: integer;
  61. begin
  62. R.Assign(0,0,50,15);
  63. inherited Init(R, 'Install Help Files');
  64. New(C, Init(20,10));
  65. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.X:=37;
  66. R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
  67. New(SB, Init(R2)); Insert(SB);
  68. New(LB, Init(R, 1, SB));
  69. for I:=0 to HelpFiles^.Count-1 do
  70. begin
  71. C^.Insert(NewStr(HelpFiles^.At(I)^));
  72. end;
  73. LB^.NewList(C);
  74. Insert(LB);
  75. R2.Copy(R); Dec(R2.A.Y); R2.B.Y:=R2.A.Y+1;
  76. Insert(New(PLabel, Init(R2, '~H~elp files', LB)));
  77. GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.A.X:=38; R.B.Y:=R.A.Y+2;
  78. Insert(New(PButton, Init(R, 'O~K~', cmOK, bfDefault)));
  79. R.Move(0,2);
  80. Insert(New(PButton, Init(R, '~N~ew', cmAddItem, bfNormal)));
  81. R.Move(0,2);
  82. Insert(New(PButton, Init(R, '~D~elete', cmDeleteItem, bfNormal)));
  83. R.Move(0,2);
  84. Insert(New(PButton, Init(R, 'Cancel', cmCancel, bfNormal)));
  85. LB^.Select;
  86. end;
  87. procedure THelpFilesDialog.HandleEvent(var Event: TEvent);
  88. var I: integer;
  89. D: PFileDialog;
  90. FileName: string;
  91. Re: word;
  92. S: string;
  93. begin
  94. case Event.What of
  95. evKeyDown :
  96. case Event.KeyCode of
  97. kbIns :
  98. begin
  99. Message(@Self,evCommand,cmAddItem,nil);
  100. ClearEvent(Event);
  101. end;
  102. kbDel :
  103. begin
  104. Message(@Self,evCommand,cmDeleteItem,nil);
  105. ClearEvent(Event);
  106. end;
  107. end;
  108. evCommand :
  109. case Event.Command of
  110. cmAddItem :
  111. begin
  112. S:='';
  113. New(D, Init(HelpFileExts,'Install a help file','~H~elp file name',fdOpenButton,0));
  114. Re:=Desktop^.ExecView(D);
  115. if Re<>cmCancel then
  116. begin
  117. D^.GetFileName(FileName);
  118. if UpcaseStr(copy(ExtOf(FileName),1,4))='.HTM' then
  119. Re:=InputBox('Topic title','Title',S,40);
  120. end;
  121. if Re<>cmCancel then
  122. begin
  123. if S<>'' then FileName:=FileName+'|'+S;
  124. LB^.List^.Insert(NewStr(FileName));
  125. LB^.SetRange(LB^.List^.Count);
  126. ReDraw;
  127. end;
  128. Dispose(D, Done);
  129. ClearEvent(Event);
  130. end;
  131. cmDeleteItem :
  132. if LB^.Range>0 then
  133. begin
  134. LB^.List^.AtFree(LB^.Focused);
  135. LB^.SetRange(LB^.List^.Count);
  136. ReDraw;
  137. ClearEvent(Event);
  138. end;
  139. cmOK :
  140. begin
  141. HelpFiles^.FreeAll;
  142. for I:=0 to LB^.List^.Count-1 do
  143. HelpFiles^.Insert(NewStr(C^.At(I)^));
  144. end;
  145. end;
  146. end;
  147. inherited HandleEvent(Event);
  148. end;
  149. destructor THelpFilesDialog.Done;
  150. begin
  151. if C<>nil then begin C^.DeleteAll; Dispose(C, Done); end;
  152. inherited Done;
  153. end;
  154. procedure TIDEApp.HelpFiles;
  155. begin
  156. if Desktop^.ExecView(New(PHelpFilesDialog, Init))=cmOK then
  157. begin
  158. DoneHelpSystem;
  159. Message(Application,evBroadcast,cmHelpFilesChanged,nil);
  160. InitHelpSystem;
  161. end;
  162. end;
  163. procedure TIDEApp.About;
  164. begin
  165. ExecuteDialog(New(PFPAboutDialog, Init), nil);
  166. end;
  167. {
  168. $Log$
  169. Revision 1.7 1999-05-22 13:44:31 peter
  170. * fixed couple of bugs
  171. Revision 1.6 1999/03/01 15:41:56 peter
  172. + Added dummy entries for functions not yet implemented
  173. * MenuBar didn't update itself automatically on command-set changes
  174. * Fixed Debugging/Profiling options dialog
  175. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  176. set
  177. * efBackSpaceUnindents works correctly
  178. + 'Messages' window implemented
  179. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  180. + Added TP message-filter support (for ex. you can call GREP thru
  181. GREP2MSG and view the result in the messages window - just like in TP)
  182. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  183. so topic search didn't work...
  184. * In FPHELP.PAS there were still context-variables defined as word instead
  185. of THelpCtx
  186. * StdStatusKeys() was missing from the statusdef for help windows
  187. + Topic-title for index-table can be specified when adding a HTML-files
  188. Revision 1.5 1999/02/22 02:15:16 peter
  189. + default extension for save in the editor
  190. + Separate Text to Find for the grep dialog
  191. * fixed redir crash with tp7
  192. Revision 1.4 1999/01/21 11:54:18 peter
  193. + tools menu
  194. + speedsearch in symbolbrowser
  195. * working run command
  196. Revision 1.3 1999/01/12 14:29:34 peter
  197. + Implemented still missing 'switch' entries in Options menu
  198. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  199. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  200. ASCII chars and inserted directly in the text.
  201. + Added symbol browser
  202. * splitted fp.pas to fpide.pas
  203. Revision 1.2 1998/12/28 15:47:48 peter
  204. + Added user screen support, display & window
  205. + Implemented Editor,Mouse Options dialog
  206. + Added location of .INI and .CFG file
  207. + Option (INI) file managment implemented (see bottom of Options Menu)
  208. + Switches updated
  209. + Run program
  210. Revision 1.2 1998/12/22 10:39:47 peter
  211. + options are now written/read
  212. + find and replace routines
  213. }