]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/Dialogs.C
Change glob() API to accept a dir parameter.
[lyx.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 "FormInclude.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->setController(new ControlInclude(*dialog));
256                 dialog->setView(new FormInclude(*dialog));
257                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
258         } else if (name == "index") {
259                 dialog->bc().view(new GBC(dialog->bc()));
260                 dialog->setController(new ControlCommand(*dialog, name));
261                 dialog->setView(new GText(*dialog,
262                                           _("Index"), _("Keyword:|#K")));
263                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
264         } else if (name == "label") {
265                 dialog->bc().view(new GBC(dialog->bc()));
266                 dialog->setController(new ControlCommand(*dialog, name));
267                 dialog->setView(new GText(*dialog,
268                                           _("Label"), _("Label:|#L")));
269                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
270         } else if (name == "log") {
271                 dialog->bc().view(new GBC(dialog->bc()));
272                 dialog->setController(new ControlLog(*dialog));
273                 dialog->setView(new GLog(*dialog));
274                 dialog->bc().bp(new OkCancelPolicy);
275
276         } else if (name == "mathpanel") {
277                 dialog->bc().view(new GBC(dialog->bc()));
278                 dialog->setController(new ControlMath(*dialog));
279                 dialog->setView(new GMathPanel(*dialog));
280                 dialog->bc().bp(new IgnorantPolicy);
281
282         } else if (name == "mathaccents") {
283                 FormMathsBitmap * bitmap =
284                         createFormBitmap(*dialog, _("Maths Decorations & Accents"),
285                                          latex_deco, nr_latex_deco);
286                 bitmap->addBitmap(
287                         BitmapStore(12, 3, 4, deco1_width, deco1_height, deco1_bits, true));
288                 bitmap->addBitmap(
289                         BitmapStore(10, 4, 3, deco2_width, deco2_height, deco2_bits, true));
290
291                 dialog->setController(new ControlMath(*dialog));
292                 dialog->setView(bitmap);
293                 dialog->bc().bp(new IgnorantPolicy);
294
295         } else if (name == "matharrows") {
296                 FormMathsBitmap * bitmap =
297                         createFormBitmap(*dialog, _("Arrows"), latex_arrow, nr_latex_arrow);
298                 bitmap->addBitmap(
299                         BitmapStore(20, 5, 4, arrow_width,  arrow_height,  arrow_bits, true));
300                 bitmap->addBitmap(
301                         BitmapStore(7,  2, 4, larrow_width, larrow_height, larrow_bits, false));
302                 bitmap->addBitmap(
303                         BitmapStore(4,  2, 2, darrow_width,  darrow_height, darrow_bits, true));
304
305                 dialog->setController(new ControlMath(*dialog));
306                 dialog->setView(bitmap);
307                 dialog->bc().bp(new IgnorantPolicy);
308
309         } else if (name == "mathoperators") {
310                 FormMathsBitmap * bitmap =
311                         createFormBitmap(*dialog, _("Binary Ops"),
312                                          latex_bop, nr_latex_bop);
313                 bitmap->addBitmap(
314                         BitmapStore(31, 4, 8, bop_width, bop_height, bop_bits, true));
315
316                 dialog->setController(new ControlMath(*dialog));
317                 dialog->setView(bitmap);
318                 dialog->bc().bp(new IgnorantPolicy);
319
320         } else if (name == "mathrelations") {
321                 FormMathsBitmap * bitmap =
322                         createFormBitmap(*dialog, _("Binary Relations"),
323                                          latex_brel, nr_latex_brel);
324                 bitmap->addBitmap(
325                         BitmapStore(35, 4, 9, brel_width, brel_height, brel_bits, true));
326
327                 dialog->setController(new ControlMath(*dialog));
328                 dialog->setView(bitmap);
329                 dialog->bc().bp(new IgnorantPolicy);
330
331         } else if (name == "mathgreek") {
332                 FormMathsBitmap * bitmap =
333                         createFormBitmap(*dialog, _("Greek"),
334                                          latex_greek, nr_latex_greek);
335                 bitmap->addBitmap(
336                         BitmapStore(11, 6, 2, Greek_width, Greek_height, Greek_bits, true));
337                 bitmap->addBitmap(
338                         BitmapStore(28, 7, 4, greek_width, greek_height, greek_bits, true));
339
340                 dialog->setController(new ControlMath(*dialog));
341                 dialog->setView(bitmap);
342                 dialog->bc().bp(new IgnorantPolicy);
343
344         } else if (name == "mathmisc") {
345                 FormMathsBitmap * bitmap =
346                         createFormBitmap(*dialog, _("Misc"),
347                                          latex_misc, nr_latex_misc);
348                 bitmap->addBitmap(
349                         BitmapStore(29, 5, 6, misc_width, misc_height, misc_bits, true));
350                 bitmap->addBitmap(
351                         BitmapStore(5, 5, 1, misc4_width, misc4_height, misc4_bits, true));
352                 bitmap->addBitmap(
353                         BitmapStore(6, 3, 2, misc2_width, misc2_height, misc2_bits, false));
354                 bitmap->addBitmap(
355                         BitmapStore(4, 2, 2, misc3_width, misc3_height, misc3_bits, true));
356
357                 dialog->setController(new ControlMath(*dialog));
358                 dialog->setView(bitmap);
359                 dialog->bc().bp(new IgnorantPolicy);
360
361         } else if (name == "mathdots") {
362                 FormMathsBitmap * bitmap =
363                         createFormBitmap(*dialog, _("Dots"),
364                                          latex_dots, nr_latex_dots);
365                 bitmap->addBitmap(
366                         BitmapStore(4, 4, 1, dots_width, dots_height, dots_bits, true));
367
368                 dialog->setController(new ControlMath(*dialog));
369                 dialog->setView(bitmap);
370                 dialog->bc().bp(new IgnorantPolicy);
371
372         } else if (name == "mathbigoperators") {
373                 FormMathsBitmap * bitmap =
374                         createFormBitmap(*dialog, _("Big Operators"),
375                                          latex_varsz, nr_latex_varsz);
376                 bitmap->addBitmap(
377                         BitmapStore(14, 3, 5, varsz_width, varsz_height, varsz_bits, true));
378
379                 dialog->setController(new ControlMath(*dialog));
380                 dialog->setView(bitmap);
381                 dialog->bc().bp(new IgnorantPolicy);
382
383         } else if (name == "mathamsmisc") {
384                 FormMathsBitmap * bitmap =
385                         createFormBitmap(*dialog, _("AMS Misc"),
386                                          latex_ams_misc, nr_latex_ams_misc);
387                 bitmap->addBitmap(
388                         BitmapStore(9, 5, 2, ams1_width, ams1_height, ams1_bits, true));
389                 bitmap->addBitmap(
390                         BitmapStore(26, 3, 9, ams7_width, ams7_height, ams7_bits, true));
391
392                 dialog->setController(new ControlMath(*dialog));
393                 dialog->setView(bitmap);
394                 dialog->bc().bp(new IgnorantPolicy);
395
396         } else if (name == "mathamsarrows") {
397                 FormMathsBitmap * bitmap =
398                         createFormBitmap(*dialog, _("AMS Arrows"),
399                                          latex_ams_arrows, nr_latex_ams_arrows);
400                 bitmap->addBitmap(
401                         BitmapStore(32, 3, 11, ams2_width, ams2_height, ams2_bits, true));
402                 bitmap->addBitmap(
403                         BitmapStore(6, 3, 2, ams3_width, ams3_height, ams3_bits, true));
404
405                 dialog->setController(new ControlMath(*dialog));
406                 dialog->setView(bitmap);
407                 dialog->bc().bp(new IgnorantPolicy);
408
409         } else if (name == "mathamsrelations") {
410                 FormMathsBitmap * bitmap =
411                         createFormBitmap(*dialog, _("AMS Relations"),
412                                          latex_ams_rel, nr_latex_ams_rel);
413                 bitmap->addBitmap(
414                         BitmapStore(66, 6, 11, ams_rel_width, ams_rel_height, ams_rel_bits, true));
415
416                 dialog->setController(new ControlMath(*dialog));
417                 dialog->setView(bitmap);
418                 dialog->bc().bp(new IgnorantPolicy);
419
420         } else if (name == "mathamsnegatedrelations") {
421                 FormMathsBitmap * bitmap =
422                         createFormBitmap(*dialog, _("AMS Negated Rel"),
423                                          latex_ams_nrel, nr_latex_ams_nrel);
424                 bitmap->addBitmap(
425                         BitmapStore(51, 6, 9, ams_nrel_width, ams_nrel_height, ams_nrel_bits, true));
426
427                 dialog->setController(new ControlMath(*dialog));
428                 dialog->setView(bitmap);
429                 dialog->bc().bp(new IgnorantPolicy);
430
431         } else if (name == "mathamsoperators") {
432                 FormMathsBitmap * bitmap =
433                         createFormBitmap(*dialog, _("AMS Operators"),
434                                          latex_ams_ops, nr_latex_ams_ops);
435                 bitmap->addBitmap(
436                         BitmapStore(23, 3, 8, ams_ops_width, ams_ops_height, ams_ops_bits, true));
437
438                 dialog->setController(new ControlMath(*dialog));
439                 dialog->setView(bitmap);
440                 dialog->bc().bp(new IgnorantPolicy);
441
442         } else if (name == "mathdelimiter") {
443                 dialog->bc().view(new GBC(dialog->bc()));
444                 dialog->setController(new ControlMath(*dialog));
445                 dialog->setView(new GMathDelim(*dialog));
446                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
447         } else if (name == "mathmatrix") {
448                 dialog->bc().view(new GBC(dialog->bc()));
449                 dialog->setController(new ControlMath(*dialog));
450                 dialog->setView(new GMathsMatrix(*dialog));
451                 dialog->bc().bp(new OkCancelReadOnlyPolicy);
452         } else if (name == "mathspace") {
453                 dialog->setController(new ControlMath(*dialog));
454                 dialog->setView(new FormMathsSpace(*dialog));
455                 dialog->bc().bp(new IgnorantPolicy);
456         } else if (name == "mathstyle") {
457                 dialog->setController(new ControlMath(*dialog));
458                 dialog->setView(new FormMathsStyle(*dialog));
459                 dialog->bc().bp(new IgnorantPolicy);
460         } else if (name == "note") {
461                 dialog->bc().view(new GBC(dialog->bc()));
462                 dialog->setController(new ControlNote(*dialog));
463                 dialog->setView(new GNote(*dialog));
464                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
465         } else if (name == "branch") {
466                 dialog->setController(new ControlBranch(*dialog));
467                 dialog->setView(new FormBranch(*dialog));
468                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
469         } else if (name == "paragraph") {
470                 dialog->bc().view(new GBC(dialog->bc()));
471                 dialog->setController(new ControlParagraph(*dialog));
472                 dialog->setView(new GParagraph(*dialog));
473                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
474         } else if (name == "preamble") {
475                 dialog->setController(new ControlPreamble(*dialog));
476                 dialog->setView(new FormPreamble(*dialog));
477                 dialog->bc().bp(new OkApplyCancelPolicy);
478         } else if (name == "prefs") {
479                 dialog->setController(new ControlPrefs(*dialog));
480                 dialog->setView(new FormPreferences(*dialog));
481                 dialog->bc().bp(new PreferencesPolicy);
482         } else if (name == "print") {
483                 dialog->bc().view(new GBC(dialog->bc()));
484                 dialog->setController(new ControlPrint(*dialog));
485                 dialog->setView(new GPrint(*dialog));
486                 dialog->bc().bp(new OkCancelPolicy);
487         } else if (name == "ref") {
488                 dialog->setController(new ControlRef(*dialog));
489                 dialog->setView(new FormRef(*dialog));
490                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
491         } else if (name == "sendto") {
492                 dialog->bc().view(new GBC(dialog->bc()));
493                 dialog->setController(new ControlSendto(*dialog));
494                 dialog->setView(new GSendto(*dialog));
495                 dialog->bc().bp(new OkApplyCancelPolicy);
496         } else if (name == "spellchecker") {
497                 dialog->bc().view(new GBC(dialog->bc()));
498                 dialog->setController(new ControlSpellchecker(*dialog));
499                 dialog->setView(new GSpellchecker(*dialog));
500                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
501         } else if (name == "tabular") {
502                 dialog->setController(new ControlTabular(*dialog));
503                 dialog->setView(new FormTabular(*dialog));
504                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
505         } else if (name == "tabularcreate") {
506                 dialog->bc().view(new GBC(dialog->bc()));
507                 dialog->setController(new ControlTabularCreate(*dialog));
508                 dialog->setView(new GTableCreate(*dialog));
509                 dialog->bc().bp(new IgnorantPolicy);
510         } else if (name == "texinfo") {
511                 dialog->bc().view(new GBC(dialog->bc()));
512                 dialog->setController(new ControlTexinfo(*dialog));
513                 dialog->setView(new GTexinfo(*dialog));
514                 dialog->bc().bp(new OkCancelPolicy);
515 #ifdef HAVE_LIBAIKSAURUS
516         } else if (name == "thesaurus") {
517                 dialog->setController(new ControlThesaurus(*dialog));
518                 dialog->setView(new FormThesaurus(*dialog));
519                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
520 #endif
521         } else if (name == "toc") {
522                 dialog->bc().view(new GBC(dialog->bc()));
523                 dialog->setController(new ControlToc(*dialog));
524                 dialog->setView(new GToc(*dialog));
525                 dialog->bc().bp(new OkCancelPolicy);
526         } else if (name == "url") {
527                 dialog->bc().view(new GBC(dialog->bc()));
528                 dialog->setController(new ControlCommand(*dialog, name));
529                 dialog->setView(new GUrl(*dialog));
530                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
531         } else if (name == "vspace") {
532                 dialog->bc().view(new GBC(dialog->bc()));
533                 dialog->setController(new ControlVSpace(*dialog));
534                 dialog->setView(new GVSpace(*dialog));
535                 dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
536         } else if (name == "wrap") {
537                 dialog->setController(new ControlWrap(*dialog));
538                 dialog->setView(new FormWrap(*dialog));
539                 dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
540         }
541
542         return dialog;
543 }
544
545
546 void Dialogs::toggleTooltips()
547 {
548         Tooltips::toggleEnabled();
549 }
550
551
552 /// Are the tooltips on or off?
553 bool Dialogs::tooltipsEnabled()
554 {
555         return Tooltips::enabled();
556 }