]> git.lyx.org Git - features.git/blob - src/frontends/gtk/Dialogs.C
gtk include 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 _GLIBCPP_CONCEPT_CHECKS
15 #undef _GLIBCPP_CONCEPT_CHECKS
16 #endif
17
18 #include "Dialogs.h"
19 #include "Dialog.h"
20
21 #include "Tooltips.h"
22
23 #include "ControlAboutlyx.h"
24 #include "ControlBibtex.h"
25 #include "ControlBox.h"
26 #include "ControlBranch.h"
27 #include "ControlChanges.h"
28 #include "ControlCharacter.h"
29 #include "ControlCitation.h"
30 #include "ControlCommand.h"
31 #include "ControlDocument.h"
32 #include "ControlErrorList.h"
33 #include "ControlERT.h"
34 #include "ControlExternal.h"
35 #include "ControlFloat.h"
36 #include "ControlGraphics.h"
37 #include "ControlInclude.h"
38 #include "ControlLog.h"
39 #include "ControlMath.h"
40 #include "ControlNote.h"
41 #include "ControlParagraph.h"
42 #include "ControlPreamble.h"
43 #include "ControlPrefs.h"
44 #include "ControlPrint.h"
45 #include "ControlRef.h"
46 #include "ControlSearch.h"
47 #include "ControlSendto.h"
48 #include "ControlShowFile.h"
49 #include "ControlSpellchecker.h"
50 #include "ControlTabular.h"
51 #include "ControlTabularCreate.h"
52 #include "ControlTexinfo.h"
53 #include "ControlToc.h"
54 #include "ControlVSpace.h"
55 #include "ControlWrap.h"
56
57 #include "GAboutlyx.h"
58 #include "GText.h"
59 #include "GMathDelim.h"
60 #include "FormBibitem.h"
61 #include "FormBibtex.h"
62 #include "GBox.h"
63 #include "FormBranch.h"
64 #include "GChanges.h"
65 #include "GCharacter.h"
66 #include "FormCitation.h"
67 #include "FormDocument.h"
68 #include "GErrorList.h"
69 #include "GERT.h"
70 #include "FormExternal.h"
71 #include "GFloat.h"
72 #include "GGraphics.h"
73 #include "GInclude.h"
74 #include "GLog.h"
75 #include "GMathPanel.h"
76 #include "FormMathsBitmap.h"
77 #include "GMathsMatrix.h"
78 #include "FormMathsSpace.h"
79 #include "FormMathsStyle.h"
80 #include "GNote.h"
81 #include "GParagraph.h"
82 #include "FormPreamble.h"
83 #include "FormPreferences.h"
84 #include "GPrint.h"
85 #include "FormRef.h"
86 #include "GSearch.h"
87 #include "GSendto.h"
88 #include "FormTabular.h"
89 #include "GTexinfo.h"
90 #include "GShowFile.h"
91 #include "GSpellchecker.h"
92 #include "GTableCreate.h"
93 #include "GToc.h"
94 #include "GUrl.h"
95 #include "GVSpace.h"
96 #include "FormWrap.h"
97
98 #ifdef HAVE_LIBAIKSAURUS
99 #include "ControlThesaurus.h"
100 #include "FormThesaurus.h"
101 #endif
102
103 #include "xformsBC.h"
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         dialog->bc().view(new xformsBC(dialog->bc()));
183
184         if (name == "aboutlyx") {
185                 dialog->bc().view(new GBC(dialog->bc()));
186                 dialog->setController(new ControlAboutlyx(*dialog));
187                 dialog->setView(new GAboutlyx(*dialog));
188                 dialog->bc().bp(new OkCancelPolicy);
189         } else if (name == "bibitem") {
190                 dialog->setController(new ControlCommand(*dialog, name));
191                 dialog->setView(new FormBibitem(*dialog));
192                 dialog->bc().bp(new OkCancelReadOnlyPolicy);
193         } else if (name == "bibtex") {
194                 dialog->setController(new ControlBibtex(*dialog));
195                 dialog->setView(new FormBibtex(*dialog));
196                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
197         } else if (name == "box") {
198                 dialog->bc().view(new GBC(dialog->bc()));
199                 dialog->setController(new ControlBox(*dialog));
200                 dialog->setView(new GBox(*dialog));
201                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
202         } else if (name == "changes") {
203                 dialog->bc().view(new GBC(dialog->bc()));
204                 dialog->setController(new ControlChanges(*dialog));
205                 dialog->setView(new GChanges(*dialog));
206                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
207         } else if (name == "character") {
208                 dialog->bc().view(new GBC(dialog->bc()));
209                 dialog->setController(new ControlCharacter(*dialog));
210                 dialog->setView(new GCharacter(*dialog));
211                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
212         } else if (name == "citation") {
213                 dialog->setController(new ControlCitation(*dialog));
214                 dialog->setView(new FormCitation(*dialog));
215                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
216         } else if (name == "document") {
217                 dialog->setController(new ControlDocument(*dialog));
218                 dialog->setView(new FormDocument(*dialog));
219                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
220         } else if (name == "errorlist") {
221                 dialog->bc().view(new GBC(dialog->bc()));
222                 dialog->setController(new ControlErrorList(*dialog));
223                 dialog->setView(new GErrorList(*dialog));
224                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
225         } else if (name == "ert") {
226                 dialog->bc().view(new GBC(dialog->bc()));
227                 dialog->setController(new ControlERT(*dialog));
228                 dialog->setView(new GERT(*dialog));
229                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
230         } else if (name == "external") {
231                 dialog->setController(new ControlExternal(*dialog));
232                 dialog->setView(new FormExternal(*dialog));
233                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
234         } else if (name == "file") {
235                 dialog->bc().view(new GBC(dialog->bc()));
236                 dialog->setController(new ControlShowFile(*dialog));
237                 dialog->setView(new GShowFile(*dialog));
238                 dialog->bc().bp(new OkCancelPolicy);
239         } else if (name == "findreplace") {
240                 dialog->bc().view(new GBC(dialog->bc()));
241                 dialog->setController(new ControlSearch(*dialog));
242                 dialog->setView(new GSearch(*dialog));
243                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
244         } else if (name == "float") {
245                 dialog->bc().view(new GBC(dialog->bc()));
246                 dialog->setController(new ControlFloat(*dialog));
247                 dialog->setView(new GFloat(*dialog));
248                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
249         } else if (name == "graphics") {
250                 dialog->bc().view(new GBC(dialog->bc()));
251                 dialog->setController(new ControlGraphics(*dialog));
252                 dialog->setView(new GGraphics(*dialog));
253                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
254         } else if (name == "include") {
255                 dialog->bc().view(new GBC(dialog->bc()));
256                 dialog->setController(new ControlInclude(*dialog));
257                 dialog->setView(new GInclude(*dialog));
258                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
259         } else if (name == "index") {
260                 dialog->bc().view(new GBC(dialog->bc()));
261                 dialog->setController(new ControlCommand(*dialog, name));
262                 dialog->setView(new GText(*dialog,
263                                           _("Index"), _("Keyword:|#K")));
264                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
265         } else if (name == "label") {
266                 dialog->bc().view(new GBC(dialog->bc()));
267                 dialog->setController(new ControlCommand(*dialog, name));
268                 dialog->setView(new GText(*dialog,
269                                           _("Label"), _("Label:|#L")));
270                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
271         } else if (name == "log") {
272                 dialog->bc().view(new GBC(dialog->bc()));
273                 dialog->setController(new ControlLog(*dialog));
274                 dialog->setView(new GLog(*dialog));
275                 dialog->bc().bp(new OkCancelPolicy);
276
277         } else if (name == "mathpanel") {
278                 dialog->bc().view(new GBC(dialog->bc()));
279                 dialog->setController(new ControlMath(*dialog));
280                 dialog->setView(new GMathPanel(*dialog));
281                 dialog->bc().bp(new IgnorantPolicy);
282
283         } else if (name == "mathaccents") {
284                 FormMathsBitmap * bitmap =
285                         createFormBitmap(*dialog, _("Maths Decorations & Accents"),
286                                          latex_deco, nr_latex_deco);
287                 bitmap->addBitmap(
288                         BitmapStore(12, 3, 4, deco1_width, deco1_height, deco1_bits, true));
289                 bitmap->addBitmap(
290                         BitmapStore(10, 4, 3, deco2_width, deco2_height, deco2_bits, true));
291
292                 dialog->setController(new ControlMath(*dialog));
293                 dialog->setView(bitmap);
294                 dialog->bc().bp(new IgnorantPolicy);
295
296         } else if (name == "matharrows") {
297                 FormMathsBitmap * bitmap =
298                         createFormBitmap(*dialog, _("Arrows"), latex_arrow, nr_latex_arrow);
299                 bitmap->addBitmap(
300                         BitmapStore(20, 5, 4, arrow_width,  arrow_height,  arrow_bits, true));
301                 bitmap->addBitmap(
302                         BitmapStore(7,  2, 4, larrow_width, larrow_height, larrow_bits, false));
303                 bitmap->addBitmap(
304                         BitmapStore(4,  2, 2, darrow_width,  darrow_height, darrow_bits, true));
305
306                 dialog->setController(new ControlMath(*dialog));
307                 dialog->setView(bitmap);
308                 dialog->bc().bp(new IgnorantPolicy);
309
310         } else if (name == "mathoperators") {
311                 FormMathsBitmap * bitmap =
312                         createFormBitmap(*dialog, _("Binary Ops"),
313                                          latex_bop, nr_latex_bop);
314                 bitmap->addBitmap(
315                         BitmapStore(31, 4, 8, bop_width, bop_height, bop_bits, true));
316
317                 dialog->setController(new ControlMath(*dialog));
318                 dialog->setView(bitmap);
319                 dialog->bc().bp(new IgnorantPolicy);
320
321         } else if (name == "mathrelations") {
322                 FormMathsBitmap * bitmap =
323                         createFormBitmap(*dialog, _("Binary Relations"),
324                                          latex_brel, nr_latex_brel);
325                 bitmap->addBitmap(
326                         BitmapStore(35, 4, 9, brel_width, brel_height, brel_bits, true));
327
328                 dialog->setController(new ControlMath(*dialog));
329                 dialog->setView(bitmap);
330                 dialog->bc().bp(new IgnorantPolicy);
331
332         } else if (name == "mathgreek") {
333                 FormMathsBitmap * bitmap =
334                         createFormBitmap(*dialog, _("Greek"),
335                                          latex_greek, nr_latex_greek);
336                 bitmap->addBitmap(
337                         BitmapStore(11, 6, 2, Greek_width, Greek_height, Greek_bits, true));
338                 bitmap->addBitmap(
339                         BitmapStore(28, 7, 4, greek_width, greek_height, greek_bits, true));
340
341                 dialog->setController(new ControlMath(*dialog));
342                 dialog->setView(bitmap);
343                 dialog->bc().bp(new IgnorantPolicy);
344
345         } else if (name == "mathmisc") {
346                 FormMathsBitmap * bitmap =
347                         createFormBitmap(*dialog, _("Misc"),
348                                          latex_misc, nr_latex_misc);
349                 bitmap->addBitmap(
350                         BitmapStore(29, 5, 6, misc_width, misc_height, misc_bits, true));
351                 bitmap->addBitmap(
352                         BitmapStore(5, 5, 1, misc4_width, misc4_height, misc4_bits, true));
353                 bitmap->addBitmap(
354                         BitmapStore(6, 3, 2, misc2_width, misc2_height, misc2_bits, false));
355                 bitmap->addBitmap(
356                         BitmapStore(4, 2, 2, misc3_width, misc3_height, misc3_bits, true));
357
358                 dialog->setController(new ControlMath(*dialog));
359                 dialog->setView(bitmap);
360                 dialog->bc().bp(new IgnorantPolicy);
361
362         } else if (name == "mathdots") {
363                 FormMathsBitmap * bitmap =
364                         createFormBitmap(*dialog, _("Dots"),
365                                          latex_dots, nr_latex_dots);
366                 bitmap->addBitmap(
367                         BitmapStore(4, 4, 1, dots_width, dots_height, dots_bits, true));
368
369                 dialog->setController(new ControlMath(*dialog));
370                 dialog->setView(bitmap);
371                 dialog->bc().bp(new IgnorantPolicy);
372
373         } else if (name == "mathbigoperators") {
374                 FormMathsBitmap * bitmap =
375                         createFormBitmap(*dialog, _("Big Operators"),
376                                          latex_varsz, nr_latex_varsz);
377                 bitmap->addBitmap(
378                         BitmapStore(14, 3, 5, varsz_width, varsz_height, varsz_bits, true));
379
380                 dialog->setController(new ControlMath(*dialog));
381                 dialog->setView(bitmap);
382                 dialog->bc().bp(new IgnorantPolicy);
383
384         } else if (name == "mathamsmisc") {
385                 FormMathsBitmap * bitmap =
386                         createFormBitmap(*dialog, _("AMS Misc"),
387                                          latex_ams_misc, nr_latex_ams_misc);
388                 bitmap->addBitmap(
389                         BitmapStore(9, 5, 2, ams1_width, ams1_height, ams1_bits, true));
390                 bitmap->addBitmap(
391                         BitmapStore(26, 3, 9, ams7_width, ams7_height, ams7_bits, true));
392
393                 dialog->setController(new ControlMath(*dialog));
394                 dialog->setView(bitmap);
395                 dialog->bc().bp(new IgnorantPolicy);
396
397         } else if (name == "mathamsarrows") {
398                 FormMathsBitmap * bitmap =
399                         createFormBitmap(*dialog, _("AMS Arrows"),
400                                          latex_ams_arrows, nr_latex_ams_arrows);
401                 bitmap->addBitmap(
402                         BitmapStore(32, 3, 11, ams2_width, ams2_height, ams2_bits, true));
403                 bitmap->addBitmap(
404                         BitmapStore(6, 3, 2, ams3_width, ams3_height, ams3_bits, true));
405
406                 dialog->setController(new ControlMath(*dialog));
407                 dialog->setView(bitmap);
408                 dialog->bc().bp(new IgnorantPolicy);
409
410         } else if (name == "mathamsrelations") {
411                 FormMathsBitmap * bitmap =
412                         createFormBitmap(*dialog, _("AMS Relations"),
413                                          latex_ams_rel, nr_latex_ams_rel);
414                 bitmap->addBitmap(
415                         BitmapStore(66, 6, 11, ams_rel_width, ams_rel_height, ams_rel_bits, true));
416
417                 dialog->setController(new ControlMath(*dialog));
418                 dialog->setView(bitmap);
419                 dialog->bc().bp(new IgnorantPolicy);
420
421         } else if (name == "mathamsnegatedrelations") {
422                 FormMathsBitmap * bitmap =
423                         createFormBitmap(*dialog, _("AMS Negated Rel"),
424                                          latex_ams_nrel, nr_latex_ams_nrel);
425                 bitmap->addBitmap(
426                         BitmapStore(51, 6, 9, ams_nrel_width, ams_nrel_height, ams_nrel_bits, true));
427
428                 dialog->setController(new ControlMath(*dialog));
429                 dialog->setView(bitmap);
430                 dialog->bc().bp(new IgnorantPolicy);
431
432         } else if (name == "mathamsoperators") {
433                 FormMathsBitmap * bitmap =
434                         createFormBitmap(*dialog, _("AMS Operators"),
435                                          latex_ams_ops, nr_latex_ams_ops);
436                 bitmap->addBitmap(
437                         BitmapStore(23, 3, 8, ams_ops_width, ams_ops_height, ams_ops_bits, true));
438
439                 dialog->setController(new ControlMath(*dialog));
440                 dialog->setView(bitmap);
441                 dialog->bc().bp(new IgnorantPolicy);
442
443         } else if (name == "mathdelimiter") {
444                 dialog->bc().view(new GBC(dialog->bc()));
445                 dialog->setController(new ControlMath(*dialog));
446                 dialog->setView(new GMathDelim(*dialog));
447                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
448         } else if (name == "mathmatrix") {
449                 dialog->bc().view(new GBC(dialog->bc()));
450                 dialog->setController(new ControlMath(*dialog));
451                 dialog->setView(new GMathsMatrix(*dialog));
452                 dialog->bc().bp(new OkCancelReadOnlyPolicy);
453         } else if (name == "mathspace") {
454                 dialog->setController(new ControlMath(*dialog));
455                 dialog->setView(new FormMathsSpace(*dialog));
456                 dialog->bc().bp(new IgnorantPolicy);
457         } else if (name == "mathstyle") {
458                 dialog->setController(new ControlMath(*dialog));
459                 dialog->setView(new FormMathsStyle(*dialog));
460                 dialog->bc().bp(new IgnorantPolicy);
461         } else if (name == "note") {
462                 dialog->bc().view(new GBC(dialog->bc()));
463                 dialog->setController(new ControlNote(*dialog));
464                 dialog->setView(new GNote(*dialog));
465                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
466         } else if (name == "branch") {
467                 dialog->setController(new ControlBranch(*dialog));
468                 dialog->setView(new FormBranch(*dialog));
469                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
470         } else if (name == "paragraph") {
471                 dialog->bc().view(new GBC(dialog->bc()));
472                 dialog->setController(new ControlParagraph(*dialog));
473                 dialog->setView(new GParagraph(*dialog));
474                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
475         } else if (name == "preamble") {
476                 dialog->setController(new ControlPreamble(*dialog));
477                 dialog->setView(new FormPreamble(*dialog));
478                 dialog->bc().bp(new OkApplyCancelPolicy);
479         } else if (name == "prefs") {
480                 dialog->setController(new ControlPrefs(*dialog));
481                 dialog->setView(new FormPreferences(*dialog));
482                 dialog->bc().bp(new PreferencesPolicy);
483         } else if (name == "print") {
484                 dialog->bc().view(new GBC(dialog->bc()));
485                 dialog->setController(new ControlPrint(*dialog));
486                 dialog->setView(new GPrint(*dialog));
487                 dialog->bc().bp(new OkCancelPolicy);
488         } else if (name == "ref") {
489                 dialog->setController(new ControlRef(*dialog));
490                 dialog->setView(new FormRef(*dialog));
491                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
492         } else if (name == "sendto") {
493                 dialog->bc().view(new GBC(dialog->bc()));
494                 dialog->setController(new ControlSendto(*dialog));
495                 dialog->setView(new GSendto(*dialog));
496                 dialog->bc().bp(new OkApplyCancelPolicy);
497         } else if (name == "spellchecker") {
498                 dialog->bc().view(new GBC(dialog->bc()));
499                 dialog->setController(new ControlSpellchecker(*dialog));
500                 dialog->setView(new GSpellchecker(*dialog));
501                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
502         } else if (name == "tabular") {
503                 dialog->setController(new ControlTabular(*dialog));
504                 dialog->setView(new FormTabular(*dialog));
505                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
506         } else if (name == "tabularcreate") {
507                 dialog->bc().view(new GBC(dialog->bc()));
508                 dialog->setController(new ControlTabularCreate(*dialog));
509                 dialog->setView(new GTableCreate(*dialog));
510                 dialog->bc().bp(new IgnorantPolicy);
511         } else if (name == "texinfo") {
512                 dialog->bc().view(new GBC(dialog->bc()));
513                 dialog->setController(new ControlTexinfo(*dialog));
514                 dialog->setView(new GTexinfo(*dialog));
515                 dialog->bc().bp(new OkCancelPolicy);
516 #ifdef HAVE_LIBAIKSAURUS
517         } else if (name == "thesaurus") {
518                 dialog->setController(new ControlThesaurus(*dialog));
519                 dialog->setView(new FormThesaurus(*dialog));
520                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
521 #endif
522         } else if (name == "toc") {
523                 dialog->bc().view(new GBC(dialog->bc()));
524                 dialog->setController(new ControlToc(*dialog));
525                 dialog->setView(new GToc(*dialog));
526                 dialog->bc().bp(new OkCancelPolicy);
527         } else if (name == "url") {
528                 dialog->bc().view(new GBC(dialog->bc()));
529                 dialog->setController(new ControlCommand(*dialog, name));
530                 dialog->setView(new GUrl(*dialog));
531                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
532         } else if (name == "vspace") {
533                 dialog->bc().view(new GBC(dialog->bc()));
534                 dialog->setController(new ControlVSpace(*dialog));
535                 dialog->setView(new GVSpace(*dialog));
536                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
537         } else if (name == "wrap") {
538                 dialog->setController(new ControlWrap(*dialog));
539                 dialog->setView(new FormWrap(*dialog));
540                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
541         }
542
543         return dialog;
544 }
545
546
547 void Dialogs::toggleTooltips()
548 {
549         Tooltips::toggleEnabled();
550 }
551
552
553 /// Are the tooltips on or off?
554 bool Dialogs::tooltipsEnabled()
555 {
556         return Tooltips::enabled();
557 }