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