Fl_Help_Dialog.fl 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0108
  3. header_name {../FL/Fl_Help_Dialog.H}
  4. code_name {.cxx}
  5. comment {//
  6. // "$Id: Fl_Help_Dialog.fl 8864 2011-07-19 04:49:30Z greg.ercolano $"
  7. //
  8. // Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
  9. //
  10. // Copyright 1998-2010 by Bill Spitzak and others.
  11. //
  12. // This library is free software. Distribution and use rights are outlined in
  13. // the file "COPYING" which should have been included with this file. If this
  14. // file is missing or damaged, see the license at:
  15. //
  16. // http://www.fltk.org/COPYING.php
  17. //
  18. // Please report all bugs and problems on the following page:
  19. //
  20. // http://www.fltk.org/str.php
  21. //
  22. } {in_source in_header
  23. }
  24. decl {\#include "flstring.h"} {}
  25. decl {\#include <FL/fl_ask.H>} {}
  26. class FL_EXPORT Fl_Help_Dialog {open
  27. } {
  28. decl {int index_;} {}
  29. decl {int max_;} {}
  30. decl {int line_[100];} {}
  31. decl {char file_[100][256];} {}
  32. decl {int find_pos_;} {}
  33. Function {Fl_Help_Dialog()} {open
  34. } {
  35. Fl_Window window_ {
  36. label {Help Dialog} open
  37. private xywh {398 64 530 385} type Double resizable size_range {260 150 0 0} visible
  38. } {
  39. Fl_Group {} {open selected
  40. xywh {10 10 511 25}
  41. } {
  42. Fl_Button back_ {
  43. label {@<-}
  44. callback {if (index_ > 0)
  45. index_ --;
  46. if (index_ == 0)
  47. back_->deactivate();
  48. forward_->activate();
  49. int l = line_[index_];
  50. if (strcmp(view_->filename(), file_[index_]) != 0)
  51. view_->load(file_[index_]);
  52. view_->topline(l);}
  53. private tooltip {Show the previous help page.} xywh {10 10 25 25} shortcut 0xff51 labelcolor 2
  54. }
  55. Fl_Button forward_ {
  56. label {@->}
  57. callback {if (index_ < max_)
  58. index_ ++;
  59. if (index_ >= max_)
  60. forward_->deactivate();
  61. back_->activate();
  62. int l = view_->topline();
  63. if (strcmp(view_->filename(), file_[index_]) != 0)
  64. view_->load(file_[index_]);
  65. view_->topline(l);}
  66. private tooltip {Show the next help page.} xywh {45 10 25 25} shortcut 0xff53 labelcolor 2
  67. }
  68. Fl_Button smaller_ {
  69. label F
  70. callback {if (view_->textsize() > 8)
  71. view_->textsize(view_->textsize() - 2);
  72. if (view_->textsize() <= 8)
  73. smaller_->deactivate();
  74. larger_->activate();}
  75. private tooltip {Make the help text smaller.} xywh {80 10 25 25} labelfont 1 labelsize 10
  76. }
  77. Fl_Button larger_ {
  78. label F
  79. callback {if (view_->textsize() < 18)
  80. view_->textsize(view_->textsize() + 2);
  81. if (view_->textsize() >= 18)
  82. larger_->deactivate();
  83. smaller_->activate();}
  84. private tooltip {Make the help text larger.} xywh {115 10 25 25} labelfont 1 labelsize 16
  85. }
  86. Fl_Group {} {open
  87. xywh {350 10 171 25} box DOWN_BOX color 7
  88. } {
  89. Fl_Input find_ {
  90. label {@search}
  91. callback {find_pos_ = view_->find(find_->value(), find_pos_);}
  92. private tooltip {find text in document} xywh {375 12 143 21} box FLAT_BOX labelsize 13 when 10 textfont 4
  93. }
  94. }
  95. Fl_Box {} {
  96. xywh {150 10 190 25} resizable
  97. }
  98. }
  99. Fl_Help_View view_ {
  100. callback {if (view_->filename())
  101. {
  102. if (view_->changed())
  103. {
  104. index_ ++;
  105. if (index_ >= 100)
  106. {
  107. memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
  108. memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
  109. index_ -= 10;
  110. }
  111. max_ = index_;
  112. strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
  113. line_[index_] = view_->topline();
  114. if (index_ > 0)
  115. back_->activate();
  116. else
  117. back_->deactivate();
  118. forward_->deactivate();
  119. window_->label(view_->title());
  120. }
  121. else // if ! view_->changed()
  122. {
  123. strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
  124. line_[index_] = view_->topline();
  125. }
  126. } else { // if ! view_->filename()
  127. index_ = 0; // hitting an internal page will disable the back/fwd buffer
  128. file_[index_][0] = 0; // unnamed internal page
  129. line_[index_] = view_->topline();
  130. back_->deactivate();
  131. forward_->deactivate();
  132. }}
  133. private xywh {10 45 510 330} box DOWN_BOX resizable
  134. }
  135. }
  136. code {back_->deactivate();
  137. forward_->deactivate();
  138. index_ = -1;
  139. max_ = 0;
  140. find_pos_ = 0;
  141. fl_register_images();} {}
  142. }
  143. Function {~Fl_Help_Dialog()} {} {
  144. code {delete window_;} {}
  145. }
  146. Function {h()} {return_type int
  147. } {
  148. code {return (window_->h());} {}
  149. }
  150. Function {hide()} {return_type void
  151. } {
  152. code {window_->hide();} {}
  153. }
  154. Function {load(const char *f)} {return_type void
  155. } {
  156. code {view_->set_changed();
  157. view_->load(f);
  158. window_->label(view_->title());} {}
  159. }
  160. Function {position(int xx, int yy)} {return_type void
  161. } {
  162. code {window_->position(xx, yy);} {}
  163. }
  164. Function {resize(int xx, int yy, int ww, int hh)} {return_type void
  165. } {
  166. code {window_->resize(xx, yy, ww, hh);} {}
  167. }
  168. Function {show()} {return_type void
  169. } {
  170. code {window_->show();} {}
  171. }
  172. Function {show(int argc, char **argv)} {return_type void
  173. } {
  174. code {window_->show(argc, argv);} {}
  175. }
  176. Function {textsize(Fl_Fontsize s)} {return_type void
  177. } {
  178. code {view_->textsize(s);
  179. if (s <= 8)
  180. smaller_->deactivate();
  181. else
  182. smaller_->activate();
  183. if (s >= 18)
  184. larger_->deactivate();
  185. else
  186. larger_->activate();} {}
  187. }
  188. Function {textsize()} {return_type Fl_Fontsize
  189. } {
  190. code {return (view_->textsize());} {}
  191. }
  192. Function {topline(const char *n)} {return_type void
  193. } {
  194. code {view_->topline(n);} {}
  195. }
  196. Function {topline(int n)} {return_type void
  197. } {
  198. code {view_->topline(n);} {}
  199. }
  200. Function {value(const char *f)} {return_type void
  201. } {
  202. code {view_->set_changed();
  203. view_->value(f);
  204. window_->label(view_->title());} {}
  205. }
  206. Function {value() const} {return_type {const char *}
  207. } {
  208. code {return view_->value();} {}
  209. }
  210. Function {visible()} {return_type int
  211. } {
  212. code {return (window_->visible());} {}
  213. }
  214. Function {w()} {return_type int
  215. } {
  216. code {return (window_->w());} {}
  217. }
  218. Function {x()} {return_type int
  219. } {
  220. code {return (window_->x());} {}
  221. }
  222. Function {y()} {return_type int
  223. } {
  224. code {return (window_->y());} {}
  225. }
  226. }
  227. comment {
  228. //
  229. // End of "$Id: Fl_Help_Dialog.fl 8864 2011-07-19 04:49:30Z greg.ercolano $".
  230. //} {in_source in_header
  231. }