]> git.lyx.org Git - features.git/blob - src/frontends/gtk/Dialogs.C
add GTK wrap dialog
[features.git] / src / frontends / gtk / Dialogs.C
1 /**
2 // * \file xforms/Dialogs.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
16 #endif
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
19 #endif
20
21 #include "Dialogs.h"
22 #include "Dialog.h"
23
24 #include "ControlAboutlyx.h"
25 #include "ControlBibtex.h"
26 #include "ControlBox.h"
27 #include "ControlBranch.h"
28 #include "ControlChanges.h"
29 #include "ControlCharacter.h"
30 #include "ControlCitation.h"
31 #include "ControlCommand.h"
32 #include "ControlDocument.h"
33 #include "ControlErrorList.h"
34 #include "ControlERT.h"
35 #include "ControlExternal.h"
36 #include "ControlFloat.h"
37 #include "ControlGraphics.h"
38 #include "ControlInclude.h"
39 #include "ControlLog.h"
40 #include "ControlMath.h"
41 #include "ControlNote.h"
42 #include "ControlParagraph.h"
43 #include "ControlPreamble.h"
44 #include "ControlPrefs.h"
45 #include "ControlPrint.h"
46 #include "ControlRef.h"
47 #include "ControlSearch.h"
48 #include "ControlSendto.h"
49 #include "ControlShowFile.h"
50 #include "ControlSpellchecker.h"
51 #include "ControlTabular.h"
52 #include "ControlTabularCreate.h"
53 #include "ControlTexinfo.h"
54 #include "ControlToc.h"
55 #include "ControlVSpace.h"
56 #include "ControlWrap.h"
57
58 #include "GAboutlyx.h"
59 #include "GText.h"
60 #include "GMathDelim.h"
61 #include "GBibItem.h"
62 //#include "FormBibtex.h"
63 #include "GBox.h"
64 #include "GBranch.h"
65 #include "GChanges.h"
66 #include "GCharacter.h"
67 #include "GCitation.h"
68 #include "GDocument.h"
69 #include "GErrorList.h"
70 #include "GERT.h"
71 //#include "FormExternal.h"
72 #include "GFloat.h"
73 #include "GGraphics.h"
74 #include "GInclude.h"
75 #include "GLog.h"
76 #include "GMathPanel.h"
77 //#include "FormMathsBitmap.h"
78 #include "GMathsMatrix.h"
79 //#include "FormMathsSpace.h"
80 //#include "FormMathsStyle.h"
81 #include "GNote.h"
82 #include "GParagraph.h"
83 //#include "FormPreamble.h"
84 //#include "FormPreferences.h"
85 #include "GPrint.h"
86 #include "GRef.h"
87 #include "GSearch.h"
88 #include "GSendto.h"
89 #include "GTabular.h"
90 #include "GTexinfo.h"
91 #include "GShowFile.h"
92 #include "GSpellchecker.h"
93 #include "GTableCreate.h"
94 #include "GToc.h"
95 #include "GUrl.h"
96 #include "GVSpace.h"
97 #include "GWrap.h"
98
99 #ifdef HAVE_LIBAIKSAURUS
100 #include "ControlThesaurus.h"
101 #include "GThesaurus.h"
102 #endif
103
104 #include "ButtonController.h"
105
106 #include "arrows.xbm"
107 #include "bop.xbm"
108 #include "brel.xbm"
109 #include "deco.xbm"
110 #include "dots.xbm"
111 #include "greek.xbm"
112 #include "misc.xbm"
113 #include "varsz.xbm"
114
115 #include "ams_misc.xbm"
116 #include "ams_arrows.xbm"
117 #include "ams_rel.xbm"
118 #include "ams_nrel.xbm"
119 #include "ams_ops.xbm"
120
121 #include <boost/assert.hpp>
122 #include <vector>
123
124 using std::string;
125
126 using namespace lyx::frontend;
127
128 namespace {
129
130 //FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
131 //                                 char const * const * data, int size)
132 //{
133 //      char const * const * const end = data + size;
134 //      return new FormMathsBitmap(parent, title, std::vector<string>(data, end));
135 //}
136
137
138 char const * const dialognames[] = {
139 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
140 "citation", "document", "errorlist" , "ert", "external", "file",
141 "findreplace", "float", "graphics", "include", "index", "label", "log",
142 "mathpanel", "mathaccents", "matharrows", "mathoperators", "mathrelations",
143 "mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
144 "mathamsarrows", "mathamsrelations", "mathamsnegatedrelations",
145 "mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
146 "note", "paragraph", "preamble", "prefs", "print", "ref", "sendto",
147 "spellchecker", "tabular", "tabularcreate", "texinfo",
148
149 #ifdef HAVE_LIBAIKSAURUS
150 "thesaurus",
151 #endif
152
153 "toc", "url", "vspace", "wrap" };
154
155 char const * const * const end_dialognames =
156         dialognames + (sizeof(dialognames) / sizeof(char *));
157
158 struct cmpCStr {
159         cmpCStr(char const * name) : name_(name) {}
160         bool operator()(char const * other) {
161                 return strcmp(other, name_) == 0;
162         }
163 private:
164         char const * name_;
165 };
166
167 } // namespace anon
168
169
170 bool Dialogs::isValidName(string const & name) const
171 {
172         return std::find_if(dialognames, end_dialognames,
173                             cmpCStr(name.c_str())) != end_dialognames;
174 }
175
176
177 Dialogs::DialogPtr Dialogs::build(string const & name)
178 {
179         BOOST_ASSERT(isValidName(name));
180
181         DialogPtr dialog(new Dialog(lyxview_, name));
182
183         if (name == "aboutlyx") {
184                 dialog->bc().view(new GBC(dialog->bc()));
185                 dialog->setController(new ControlAboutlyx(*dialog));
186                 dialog->setView(new GAboutlyx(*dialog));
187                 dialog->bc().bp(new OkCancelPolicy);
188         } else if (name == "bibitem") {
189                 dialog->bc().view(new GBC(dialog->bc()));
190                 dialog->setController(new ControlCommand(*dialog, name));
191                 dialog->setView(new GBibItem(*dialog));
192                 dialog->bc().bp(new OkCancelReadOnlyPolicy);
193         } else if (name == "bibtex") {
194 //              dialog->bc().view(new xformsBC(dialog->bc()));
195                 dialog->setController(new ControlBibtex(*dialog));
196 //              dialog->setView(new FormBibtex(*dialog));
197                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
198         } else if (name == "box") {
199                 dialog->bc().view(new GBC(dialog->bc()));
200                 dialog->setController(new ControlBox(*dialog));
201                 dialog->setView(new GBox(*dialog));
202                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
203         } else if (name == "changes") {
204                 dialog->bc().view(new GBC(dialog->bc()));
205                 dialog->setController(new ControlChanges(*dialog));
206                 dialog->setView(new GChanges(*dialog));
207                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
208         } else if (name == "character") {
209                 dialog->bc().view(new GBC(dialog->bc()));
210                 dialog->setController(new ControlCharacter(*dialog));
211                 dialog->setView(new GCharacter(*dialog));
212                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
213         } else if (name == "citation") {
214                 dialog->bc().view(new GBC(dialog->bc()));
215                 dialog->setController(new ControlCitation(*dialog));
216                 dialog->setView(new GCitation(*dialog));
217                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
218         } else if (name == "document") {
219                 dialog->bc().view(new GBC(dialog->bc()));
220                 dialog->setController(new ControlDocument(*dialog));
221                 dialog->setView(new GDocument(*dialog));
222                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
223         } else if (name == "errorlist") {
224                 dialog->bc().view(new GBC(dialog->bc()));
225                 dialog->setController(new ControlErrorList(*dialog));
226                 dialog->setView(new GErrorList(*dialog));
227                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
228         } else if (name == "ert") {
229                 dialog->bc().view(new GBC(dialog->bc()));
230                 dialog->setController(new ControlERT(*dialog));
231                 dialog->setView(new GERT(*dialog));
232                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
233         } else if (name == "external") {
234 //              dialog->bc().view(new xformsBC(dialog->bc()));
235                 dialog->setController(new ControlExternal(*dialog));
236 //              dialog->setView(new FormExternal(*dialog));
237                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
238         } else if (name == "file") {
239                 dialog->bc().view(new GBC(dialog->bc()));
240                 dialog->setController(new ControlShowFile(*dialog));
241                 dialog->setView(new GShowFile(*dialog));
242                 dialog->bc().bp(new OkCancelPolicy);
243         } else if (name == "findreplace") {
244                 dialog->bc().view(new GBC(dialog->bc()));
245                 dialog->setController(new ControlSearch(*dialog));
246                 dialog->setView(new GSearch(*dialog));
247                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
248         } else if (name == "float") {
249                 dialog->bc().view(new GBC(dialog->bc()));
250                 dialog->setController(new ControlFloat(*dialog));
251                 dialog->setView(new GFloat(*dialog));
252                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
253         } else if (name == "graphics") {
254                 dialog->bc().view(new GBC(dialog->bc()));
255                 dialog->setController(new ControlGraphics(*dialog));
256                 dialog->setView(new GGraphics(*dialog));
257                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
258         } else if (name == "include") {
259                 dialog->bc().view(new GBC(dialog->bc()));
260                 dialog->setController(new ControlInclude(*dialog));
261                 dialog->setView(new GInclude(*dialog));
262                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
263         } else if (name == "index") {
264                 dialog->bc().view(new GBC(dialog->bc()));
265                 dialog->setController(new ControlCommand(*dialog, name));
266                 dialog->setView(new GText(*dialog,
267                                           _("Index Entry"), _("Keyword:|#K")));
268                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
269         } else if (name == "label") {
270                 dialog->bc().view(new GBC(dialog->bc()));
271                 dialog->setController(new ControlCommand(*dialog, name));
272                 dialog->setView(new GText(*dialog,
273                                           _("Label"), _("Label:|#L")));
274                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
275         } else if (name == "log") {
276                 dialog->bc().view(new GBC(dialog->bc()));
277                 dialog->setController(new ControlLog(*dialog));
278                 dialog->setView(new GLog(*dialog));
279                 dialog->bc().bp(new OkCancelPolicy);
280
281         } else if (name == "mathpanel") {
282                 dialog->bc().view(new GBC(dialog->bc()));
283                 dialog->setController(new ControlMath(*dialog));
284                 dialog->setView(new GMathPanel(*dialog));
285                 dialog->bc().bp(new IgnorantPolicy);
286
287         } else if (name == "mathaccents") {
288 //              FormMathsBitmap * bitmap =
289 //                      createFormBitmap(*dialog, _("Maths Decorations & Accents"),
290 //                                       latex_deco, nr_latex_deco);
291 //              bitmap->addBitmap(
292 //                      BitmapStore(12, 3, 4, deco1_width, deco1_height, deco1_bits, true));
293 //              bitmap->addBitmap(
294 //                      BitmapStore(10, 4, 3, deco2_width, deco2_height, deco2_bits, true));
295
296 //              dialog->bc().view(new xformsBC(dialog->bc()));
297                 dialog->setController(new ControlMath(*dialog));
298 //              dialog->setView(bitmap);
299                 dialog->bc().bp(new IgnorantPolicy);
300
301         } else if (name == "matharrows") {
302 //              FormMathsBitmap * bitmap =
303 //                      createFormBitmap(*dialog, _("Arrows"), latex_arrow, nr_latex_arrow);
304 //              bitmap->addBitmap(
305 //                      BitmapStore(20, 5, 4, arrow_width,  arrow_height,  arrow_bits, true));
306 //              bitmap->addBitmap(
307 //                      BitmapStore(7,  2, 4, larrow_width, larrow_height, larrow_bits, false));
308 //              bitmap->addBitmap(
309 //                      BitmapStore(4,  2, 2, darrow_width,  darrow_height, darrow_bits, true));
310
311 //              dialog->bc().view(new xformsBC(dialog->bc()));
312                 dialog->setController(new ControlMath(*dialog));
313 //              dialog->setView(bitmap);
314                 dialog->bc().bp(new IgnorantPolicy);
315
316         } else if (name == "mathoperators") {
317 //              FormMathsBitmap * bitmap =
318 //                      createFormBitmap(*dialog, _("Binary Ops"),
319 //                                       latex_bop, nr_latex_bop);
320 //              bitmap->addBitmap(
321 //                      BitmapStore(31, 4, 8, bop_width, bop_height, bop_bits, true));
322
323 //              dialog->bc().view(new xformsBC(dialog->bc()));
324                 dialog->setController(new ControlMath(*dialog));
325 //              dialog->setView(bitmap);
326                 dialog->bc().bp(new IgnorantPolicy);
327
328         } else if (name == "mathrelations") {
329 //              FormMathsBitmap * bitmap =
330 //                      createFormBitmap(*dialog, _("Binary Relations"),
331 //                                       latex_brel, nr_latex_brel);
332 //              bitmap->addBitmap(
333 //                      BitmapStore(35, 4, 9, brel_width, brel_height, brel_bits, true));
334
335 //              dialog->bc().view(new xformsBC(dialog->bc()));
336                 dialog->setController(new ControlMath(*dialog));
337 //              dialog->setView(bitmap);
338                 dialog->bc().bp(new IgnorantPolicy);
339
340         } else if (name == "mathgreek") {
341 //              FormMathsBitmap * bitmap =
342 //                      createFormBitmap(*dialog, _("Greek"),
343 //                                       latex_greek, nr_latex_greek);
344 //              bitmap->addBitmap(
345 //                      BitmapStore(11, 6, 2, Greek_width, Greek_height, Greek_bits, true));
346 //              bitmap->addBitmap(
347 //                      BitmapStore(28, 7, 4, greek_width, greek_height, greek_bits, true));
348
349 //              dialog->bc().view(new xformsBC(dialog->bc()));
350                 dialog->setController(new ControlMath(*dialog));
351 //              dialog->setView(bitmap);
352                 dialog->bc().bp(new IgnorantPolicy);
353
354         } else if (name == "mathmisc") {
355 //              FormMathsBitmap * bitmap =
356 //                      createFormBitmap(*dialog, _("Misc"),
357 //                                       latex_misc, nr_latex_misc);
358 //              bitmap->addBitmap(
359 //                      BitmapStore(29, 5, 6, misc_width, misc_height, misc_bits, true));
360 //              bitmap->addBitmap(
361 //                      BitmapStore(5, 5, 1, misc4_width, misc4_height, misc4_bits, true));
362 //              bitmap->addBitmap(
363 //                      BitmapStore(6, 3, 2, misc2_width, misc2_height, misc2_bits, false));
364 //              bitmap->addBitmap(
365 //                      BitmapStore(4, 2, 2, misc3_width, misc3_height, misc3_bits, true));
366
367 //              dialog->bc().view(new xformsBC(dialog->bc()));
368                 dialog->setController(new ControlMath(*dialog));
369 //              dialog->setView(bitmap);
370                 dialog->bc().bp(new IgnorantPolicy);
371
372         } else if (name == "mathdots") {
373 //              FormMathsBitmap * bitmap =
374 //                      createFormBitmap(*dialog, _("Dots"),
375 //                                       latex_dots, nr_latex_dots);
376 //              bitmap->addBitmap(
377 //                      BitmapStore(4, 4, 1, dots_width, dots_height, dots_bits, true));
378
379 //              dialog->bc().view(new xformsBC(dialog->bc()));
380                 dialog->setController(new ControlMath(*dialog));
381 //              dialog->setView(bitmap);
382                 dialog->bc().bp(new IgnorantPolicy);
383
384         } else if (name == "mathbigoperators") {
385 //              FormMathsBitmap * bitmap =
386 //                      createFormBitmap(*dialog, _("Big Operators"),
387 //                                       latex_varsz, nr_latex_varsz);
388 //              bitmap->addBitmap(
389 //                      BitmapStore(14, 3, 5, varsz_width, varsz_height, varsz_bits, true));
390
391 //              dialog->bc().view(new xformsBC(dialog->bc()));
392                 dialog->setController(new ControlMath(*dialog));
393 //              dialog->setView(bitmap);
394                 dialog->bc().bp(new IgnorantPolicy);
395
396         } else if (name == "mathamsmisc") {
397 //              FormMathsBitmap * bitmap =
398 //                      createFormBitmap(*dialog, _("AMS Misc"),
399 //                                       latex_ams_misc, nr_latex_ams_misc);
400 //              bitmap->addBitmap(
401 //                      BitmapStore(9, 5, 2, ams1_width, ams1_height, ams1_bits, true));
402 //              bitmap->addBitmap(
403 //                      BitmapStore(26, 3, 9, ams7_width, ams7_height, ams7_bits, true));
404
405 //              dialog->bc().view(new xformsBC(dialog->bc()));
406                 dialog->setController(new ControlMath(*dialog));
407 //              dialog->setView(bitmap);
408                 dialog->bc().bp(new IgnorantPolicy);
409
410         } else if (name == "mathamsarrows") {
411 //              FormMathsBitmap * bitmap =
412 //                      createFormBitmap(*dialog, _("AMS Arrows"),
413 //                                       latex_ams_arrows, nr_latex_ams_arrows);
414 //              bitmap->addBitmap(
415 //                      BitmapStore(32, 3, 11, ams2_width, ams2_height, ams2_bits, true));
416 //              bitmap->addBitmap(
417 //                      BitmapStore(6, 3, 2, ams3_width, ams3_height, ams3_bits, true));
418
419 //              dialog->bc().view(new xformsBC(dialog->bc()));
420                 dialog->setController(new ControlMath(*dialog));
421 //              dialog->setView(bitmap);
422                 dialog->bc().bp(new IgnorantPolicy);
423
424         } else if (name == "mathamsrelations") {
425 //              FormMathsBitmap * bitmap =
426 //                      createFormBitmap(*dialog, _("AMS Relations"),
427 //                                       latex_ams_rel, nr_latex_ams_rel);
428 //              bitmap->addBitmap(
429 //                      BitmapStore(66, 6, 11, ams_rel_width, ams_rel_height, ams_rel_bits, true));
430
431 //              dialog->bc().view(new xformsBC(dialog->bc()));
432                 dialog->setController(new ControlMath(*dialog));
433 //              dialog->setView(bitmap);
434                 dialog->bc().bp(new IgnorantPolicy);
435
436         } else if (name == "mathamsnegatedrelations") {
437 //              FormMathsBitmap * bitmap =
438 //                      createFormBitmap(*dialog, _("AMS Negated Rel"),
439 //                                       latex_ams_nrel, nr_latex_ams_nrel);
440 //              bitmap->addBitmap(
441 //                      BitmapStore(51, 6, 9, ams_nrel_width, ams_nrel_height, ams_nrel_bits, true));
442
443 //              dialog->bc().view(new xformsBC(dialog->bc()));
444                 dialog->setController(new ControlMath(*dialog));
445 //              dialog->setView(bitmap);
446                 dialog->bc().bp(new IgnorantPolicy);
447
448         } else if (name == "mathamsoperators") {
449 //              FormMathsBitmap * bitmap =
450 //                      createFormBitmap(*dialog, _("AMS Operators"),
451 //                                       latex_ams_ops, nr_latex_ams_ops);
452 //              bitmap->addBitmap(
453 //                      BitmapStore(23, 3, 8, ams_ops_width, ams_ops_height, ams_ops_bits, true));
454
455 //              dialog->bc().view(new xformsBC(dialog->bc()));
456                 dialog->setController(new ControlMath(*dialog));
457 //              dialog->setView(bitmap);
458                 dialog->bc().bp(new IgnorantPolicy);
459
460         } else if (name == "mathdelimiter") {
461                 dialog->bc().view(new GBC(dialog->bc()));
462                 dialog->setController(new ControlMath(*dialog));
463                 dialog->setView(new GMathDelim(*dialog));
464                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
465         } else if (name == "mathmatrix") {
466                 dialog->bc().view(new GBC(dialog->bc()));
467                 dialog->setController(new ControlMath(*dialog));
468                 dialog->setView(new GMathsMatrix(*dialog));
469                 dialog->bc().bp(new OkCancelReadOnlyPolicy);
470         } else if (name == "mathspace") {
471 //              dialog->bc().view(new xformsBC(dialog->bc()));
472                 dialog->setController(new ControlMath(*dialog));
473 //              dialog->setView(new FormMathsSpace(*dialog));
474                 dialog->bc().bp(new IgnorantPolicy);
475         } else if (name == "mathstyle") {
476 //              dialog->bc().view(new xformsBC(dialog->bc()));
477                 dialog->setController(new ControlMath(*dialog));
478 //              dialog->setView(new FormMathsStyle(*dialog));
479                 dialog->bc().bp(new IgnorantPolicy);
480         } else if (name == "note") {
481                 dialog->bc().view(new GBC(dialog->bc()));
482                 dialog->setController(new ControlNote(*dialog));
483                 dialog->setView(new GNote(*dialog));
484                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
485         } else if (name == "branch") {
486                 dialog->bc().view(new GBC(dialog->bc()));
487                 dialog->setController(new ControlBranch(*dialog));
488                 dialog->setView(new GBranch(*dialog));
489                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
490         } else if (name == "paragraph") {
491                 dialog->bc().view(new GBC(dialog->bc()));
492                 dialog->setController(new ControlParagraph(*dialog));
493                 dialog->setView(new GParagraph(*dialog));
494                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
495         } else if (name == "preamble") {
496 //              dialog->bc().view(new xformsBC(dialog->bc()));
497                 dialog->setController(new ControlPreamble(*dialog));
498 //              dialog->setView(new FormPreamble(*dialog));
499                 dialog->bc().bp(new OkApplyCancelPolicy);
500         } else if (name == "prefs") {
501 //              dialog->bc().view(new xformsBC(dialog->bc()));
502                 dialog->setController(new ControlPrefs(*dialog));
503 //              dialog->setView(new FormPreferences(*dialog));
504                 dialog->bc().bp(new PreferencesPolicy);
505         } else if (name == "print") {
506                 dialog->bc().view(new GBC(dialog->bc()));
507                 dialog->setController(new ControlPrint(*dialog));
508                 dialog->setView(new GPrint(*dialog));
509                 dialog->bc().bp(new OkCancelPolicy);
510         } else if (name == "ref") {
511                 dialog->bc().view(new GBC(dialog->bc()));
512                 dialog->setController(new ControlRef(*dialog));
513                 dialog->setView(new GRef(*dialog));
514                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
515         } else if (name == "sendto") {
516                 dialog->bc().view(new GBC(dialog->bc()));
517                 dialog->setController(new ControlSendto(*dialog));
518                 dialog->setView(new GSendto(*dialog));
519                 dialog->bc().bp(new OkApplyCancelPolicy);
520         } else if (name == "spellchecker") {
521                 dialog->bc().view(new GBC(dialog->bc()));
522                 dialog->setController(new ControlSpellchecker(*dialog));
523                 dialog->setView(new GSpellchecker(*dialog));
524                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
525         } else if (name == "tabular") {
526                 dialog->bc().view(new GBC(dialog->bc()));
527                 dialog->setController(new ControlTabular(*dialog));
528                 dialog->setView(new GTabular(*dialog));
529                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
530         } else if (name == "tabularcreate") {
531                 dialog->bc().view(new GBC(dialog->bc()));
532                 dialog->setController(new ControlTabularCreate(*dialog));
533                 dialog->setView(new GTableCreate(*dialog));
534                 dialog->bc().bp(new IgnorantPolicy);
535         } else if (name == "texinfo") {
536                 dialog->bc().view(new GBC(dialog->bc()));
537                 dialog->setController(new ControlTexinfo(*dialog));
538                 dialog->setView(new GTexinfo(*dialog));
539                 dialog->bc().bp(new OkCancelPolicy);
540 #ifdef HAVE_LIBAIKSAURUS
541         } else if (name == "thesaurus") {
542                 dialog->bc().view(new GBC(dialog->bc()));
543                 dialog->setController(new ControlThesaurus(*dialog));
544                 dialog->setView(new GThesaurus(*dialog));
545                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
546 #endif
547         } else if (name == "toc") {
548                 dialog->bc().view(new GBC(dialog->bc()));
549                 dialog->setController(new ControlToc(*dialog));
550                 dialog->setView(new GToc(*dialog));
551                 dialog->bc().bp(new OkCancelPolicy);
552         } else if (name == "url") {
553                 dialog->bc().view(new GBC(dialog->bc()));
554                 dialog->setController(new ControlCommand(*dialog, name));
555                 dialog->setView(new GUrl(*dialog));
556                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
557         } else if (name == "vspace") {
558                 dialog->bc().view(new GBC(dialog->bc()));
559                 dialog->setController(new ControlVSpace(*dialog));
560                 dialog->setView(new GVSpace(*dialog));
561                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
562         } else if (name == "wrap") {
563                 dialog->bc().view(new GBC(dialog->bc()));
564                 dialog->setController(new ControlWrap(*dialog));
565                 dialog->setView(new GWrap(*dialog));
566                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
567         }
568
569         return dialog;
570 }
571
572
573 void Dialogs::toggleTooltips()
574 {
575         // Turning off tooltips is not necessary and will
576         // not be implemented by me - jcs
577 //      Tooltips::toggleEnabled();
578 }
579
580
581 /// Are the tooltips on or off?
582 bool Dialogs::tooltipsEnabled()
583 {
584 //      return Tooltips::enabled();
585 }