]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Dialogs.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / Dialogs.C
index b8b0cc80f4e63bd6b15ba4f3bebb6dd853efab10..7f535e59313011b8fa67ea98497af5719183dfd1 100644 (file)
-/* This file is part of
- * ======================================================
+/**
+ * \file xforms/Dialogs.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Angus Leeming
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ======================================================
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "Dialogs.h"
 
-#include "xformsBC.h"
+#include "Tooltips.h"
 
-#include "ControlBibitem.h"
+#include "ControlAboutlyx.h"
 #include "ControlBibtex.h"
-#include "ControlCharacter.h"
+#include "ControlBox.h"
+#include "ControlBranch.h"
+#include "ControlChanges.h"
 #include "ControlCitation.h"
-#include "ControlCopyright.h"
-#include "ControlCredits.h"
-#include "ControlError.h"
+#include "ControlErrorList.h"
+#include "ControlERT.h"
+#include "ControlExternal.h"
+#include "ControlFloat.h"
+#include "ControlGraphics.h"
 #include "ControlInclude.h"
 #include "ControlLog.h"
-#include "ControlUrl.h"
+#include "ControlMath.h"
+#include "ControlNote.h"
+#include "ControlParagraph.h"
+#include "ControlPrint.h"
 #include "ControlRef.h"
-#include "ControlVCLog.h"
-
-#include "GUI.h"
-
-#include "combox.h"       // needed for clean destruction of boost::scoped_ptr
-#include "form_bibitem.h"
-#include "form_bibtex.h"
-#include "form_browser.h"
-#include "form_character.h"
-#include "form_citation.h"
-#include "form_copyright.h"
-#include "form_credits.h"
-#include "form_error.h"
-#include "form_include.h"
-#include "form_ref.h"
-#include "form_url.h"
+#include "ControlSearch.h"
+#include "ControlSendto.h"
+#include "ControlShowFile.h"
+#include "ControlTabular.h"
+#include "ControlTabularCreate.h"
+#include "ControlToc.h"
+#include "ControlVSpace.h"
+#include "ControlWrap.h"
 
+#include "FormAboutlyx.h"
 #include "FormBibitem.h"
 #include "FormBibtex.h"
+#include "FormBox.h"
+#include "FormBranch.h"
+#include "FormChanges.h"
 #include "FormCharacter.h"
 #include "FormCitation.h"
-#include "FormCopyright.h"
-#include "FormCredits.h"
-#include "FormError.h"
+#include "FormErrorList.h"
+#include "FormERT.h"
+#include "FormExternal.h"
+#include "FormFloat.h"
+#include "FormGraphics.h"
 #include "FormInclude.h"
 #include "FormLog.h"
-#include "FormRef.h"
-#include "FormUrl.h"
-#include "FormVCLog.h"
-
-#include "FormDocument.h"
-#include "FormExternal.h" 
-#include "FormGraphics.h"
-#include "FormIndex.h"
 #include "FormMathsPanel.h"
+#include "FormMathsBitmap.h"
+#include "FormMathsDelim.h"
+#include "FormMathsMatrix.h"
+#include "FormMathsSpace.h"
+#include "FormMathsStyle.h"
+#include "FormNote.h"
 #include "FormParagraph.h"
-#include "FormPreamble.h"
-#include "FormPreferences.h"
 #include "FormPrint.h"
-#include "FormSearch.h"
-#include "FormSplash.h"
+#include "FormRef.h"
 #include "FormTabular.h"
+#include "FormTexinfo.h"
+#include "FormSearch.h"
+#include "FormSendto.h"
+#include "FormShowFile.h"
 #include "FormTabularCreate.h"
+#include "FormText.h"
 #include "FormToc.h"
-#include "FormMinipage.h"
+#include "FormUrl.h"
+#include "FormVSpace.h"
+#include "FormWrap.h"
+
+#ifdef HAVE_LIBAIKSAURUS
+#include "ControlThesaurus.h"
+#include "FormThesaurus.h"
+#endif
+
+#include "xformsBC.h"
+#include "ButtonController.h"
+
+#include "arrows.xbm"
+#include "bop.xbm"
+#include "brel.xbm"
+#include "deco.xbm"
+#include "dots.xbm"
+#include "greek.xbm"
+#include "misc.xbm"
+#include "varsz.xbm"
+
+#include "ams_misc.xbm"
+#include "ams_arrows.xbm"
+#include "ams_rel.xbm"
+#include "ams_nrel.xbm"
+#include "ams_ops.xbm"
+
 
-// Signal enabling all visible popups to be redrawn if so desired.
-// E.g., when the GUI colours have been remapped.
-SigC::Signal0<void> Dialogs::redrawGUI;
+using std::string;
 
-Dialogs::Dialogs(LyXView * lv)
+
+namespace {
+
+FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
+                                  char const * const * data, int size)
 {
-       splash_.reset(new FormSplash(lv, this));
-
-       add(new GUIBibitem<FormBibitem, xformsBC>(*lv, *this));
-       add(new GUIBibtex<FormBibtex, xformsBC>(*lv, *this));
-       add(new GUICharacter<FormCharacter, xformsBC>(*lv, *this));
-       add(new GUICitation<FormCitation, xformsBC>(*lv, *this));
-       add(new GUICopyright<FormCopyright, xformsBC>(*lv, *this));
-       add(new GUICredits<FormCredits, xformsBC>(*lv, *this));
-       add(new GUIError<FormError, xformsBC>(*lv, *this));
-       add(new GUIInclude<FormInclude, xformsBC>(*lv, *this));
-       add(new GUILog<FormLog, xformsBC>(*lv, *this));
-       add(new GUIRef<FormRef, xformsBC>(*lv, *this));
-       add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
-       add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
-
-       add(new FormDocument(lv, this));
-       add(new FormExternal(lv, this));
-       add(new FormGraphics(lv, this));
-       add(new FormIndex(lv, this));
-       add(new FormMathsPanel(lv, this));
-       add(new FormParagraph(lv, this));
-       add(new FormPreamble(lv, this));
-       add(new FormPreferences(lv, this));
-       add(new FormPrint(lv, this));
-       add(new FormSearch(lv, this));
-       add(new FormSplash(lv, this));
-       add(new FormTabular(lv, this));
-       add(new FormTabularCreate(lv, this));
-       add(new FormToc(lv, this));
-       add(new FormMinipage(lv, this));
-       
-       // reduce the number of connections needed in
-       // dialogs by a simple connection here.
-       hideAll.connect(hideBufferDependent.slot());
+       char const * const * const end = data + size;
+       return new FormMathsBitmap(parent, title, std::vector<string>(data, end));
 }
 
-/*****************************************************************************
-
-Q.  WHY does Dialogs::Dialogs pass `this' to dialog constructors?
-
-A.  To avoid a segfault.
-    The dialog constructors need to connect to their
-    respective showSomeDialog signal(*) but in order to do
-    that they need to get the address of the Dialogs instance
-    from LyXView::getDialogs().  However, since the Dialogs
-    instance is still being constructed at that time
-    LyXView::getDialogs() will *not* return the correct
-    address because it hasn't finished being constructed.
-    A Catch-22 situation (or is that the chicken and the egg...).
-    So to get around the problem we pass the address of
-    the newly created Dialogs instance using `this'.
-
-(*) -- I'm using signals exclusively to guarantee that the gui code
-       remains hidden from the rest of the system.  In fact the only 
-       header related to dialogs that anything in the non-gui-specific
-       code gets to see is Dialogs.h!  Even Dialogs.h doesn't know what a 
-       FormCopyright class looks like or that its even going to be used!
-
-       No other gui dialog headers are seen outside of the gui-specific
-       directories!  This ensures that the gui is completely separate from
-       the rest of LyX.  All this through the use of a few simple signals.
-       BUT, the price is that during construction we need to connect the
-       implementations show() method to the showSomeDialog signal and this
-       requires that we have an instance of Dialogs and the problem mentioned
-       above.
-
-       Almost all other dialogs should be able to operate using the same style
-       of signalling used for Copyright.  Exceptions should be handled
-       by adding a specific show or update signal.  For example, spellchecker
-       needs to set the next suspect word and its options/replacements so we
-       need a:
-                 Signal0<void> updateSpellChecker;
-
-       Since we would have to have a
-                 Signal0<void> showSpellChecker;
-
-       in order to just see the spellchecker and let the user push the [Start]
-       button then the updateSpellChecker signal will make the SpellChecker
-       dialog get the new word and replacements list from LyX.  If you really,
-       really wanted to you could define a signal that would pass the new
-       word and replacements:
-                 Signal2<void, string, vector<string> > updateSpellChecker;
-
-       (or something similar) but, why bother when the spellchecker can get
-       it anyway with a LyXFunc call or two.  Besides if someone extends
-       what a dialog does then they also have to change code in the rest of 
-       LyX to pass more parameters or get the extra info via a function 
-       call anyway.  Thus reducing the independence of the two code bases.
-
-       We don't need a separate update signal for each dialog because most of 
-       them will be changed only when the buffer is changed (either by closing
-       the current open buffer or switching to another buffer in the current
-       LyXView -- different BufferView same LyXView or same BufferView same
-       LyXView).
-
-       So we minimise signals but maximise independence and programming 
-       simplicity, understandability and maintainability.  It's also
-       extremely easy to add support for Qt or gtk-- because they use
-       signals already. Guis that use callbacks, like xforms, must have their
-       code wrapped up like that in the form_copyright.[Ch] which is awkward
-       but will at least allow multiple instances of the same dialog.
-
-       Signals will also be a great help in controlling the splashscreen --
-       once signalled to hide it can disconnect from the signal and remove
-       itself from memory.
-
-       LyXFuncs will be used for requesting/setting LyX internal info.  This
-       will ensure that scripts or LyXServer-connected applications can all
-       have access to the same calls as the internal user-interface.
-
-******************************************************************************/
+
+char const * const dialognames[] = {
+"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
+"citation", "error", "errorlist" , "ert", "external", "file", "findreplace",
+"float", "graphics", "include", "index", "label", "log", "mathpanel",
+"mathaccents", "matharrows", "mathoperators", "mathrelations",
+"mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
+"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations",
+"mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
+"note", "paragraph", "print", "ref", "sendto", "tabular", "tabularcreate",
+
+#ifdef HAVE_LIBAIKSAURUS
+"thesaurus",
+#endif
+
+"texinfo", "toc", "url", "vspace", "wrap" };
+
+char const * const * const end_dialognames =
+       dialognames + (sizeof(dialognames) / sizeof(char *));
+
+struct cmpCStr {
+       cmpCStr(char const * name) : name_(name) {}
+       bool operator()(char const * other) {
+               return strcmp(other, name_) == 0;
+       }
+private:
+       char const * name_;
+};
+
+} // namespace anon
+
+
+bool Dialogs::isValidName(string const & name) const
+{
+       return std::find_if(dialognames, end_dialognames,
+                           cmpCStr(name.c_str())) != end_dialognames;
+}
+
+
+Dialog * Dialogs::build(string const & name)
+{
+       if (!isValidName(name))
+               return 0;
+
+       Dialog * dialog = new Dialog(lyxview_, name);
+       dialog->bc().view(new xformsBC(dialog->bc()));
+
+       if (name == "aboutlyx") {
+               dialog->setController(new ControlAboutlyx(*dialog));
+               dialog->setView(new FormAboutlyx(*dialog));
+               dialog->bc().bp(new OkCancelPolicy);
+       } else if (name == "bibitem") {
+               dialog->setController(new ControlCommand(*dialog, name));
+               dialog->setView(new FormBibitem(*dialog));
+               dialog->bc().bp(new OkCancelReadOnlyPolicy);
+       } else if (name == "bibtex") {
+               dialog->setController(new ControlBibtex(*dialog));
+               dialog->setView(new FormBibtex(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "box") {
+               dialog->setController(new ControlBox(*dialog));
+               dialog->setView(new FormBox(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "branch") {
+               dialog->setController(new ControlBranch(*dialog));
+               dialog->setView(new FormBranch(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "character") {
+               dialog->setController(new ControlCharacter(*dialog));
+               dialog->setView(new FormCharacter(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "changes") {
+               dialog->setController(new ControlChanges(*dialog));
+               dialog->setView(new FormChanges(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "citation") {
+               dialog->setController(new ControlCitation(*dialog));
+               dialog->setView(new FormCitation(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "errorlist") {
+               dialog->setController(new ControlErrorList(*dialog));
+               dialog->setView(new FormErrorList(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "ert") {
+               dialog->setController(new ControlERT(*dialog));
+               dialog->setView(new FormERT(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "external") {
+               dialog->setController(new ControlExternal(*dialog));
+               dialog->setView(new FormExternal(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "file") {
+               dialog->setController(new ControlShowFile(*dialog));
+               dialog->setView(new FormShowFile(*dialog));
+               dialog->bc().bp(new OkCancelPolicy);
+       } else if (name == "findreplace") {
+               dialog->setController(new ControlSearch(*dialog));
+               dialog->setView(new FormSearch(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "float") {
+               dialog->setController(new ControlFloat(*dialog));
+               dialog->setView(new FormFloat(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "graphics") {
+               dialog->setController(new ControlGraphics(*dialog));
+               dialog->setView(new FormGraphics(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "include") {
+               dialog->setController(new ControlInclude(*dialog));
+               dialog->setView(new FormInclude(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "index") {
+               dialog->setController(new ControlCommand(*dialog, name));
+               dialog->setView(new FormText(*dialog,
+                                            _("Index"), _("Keyword:|#K")));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "label") {
+               dialog->setController(new ControlCommand(*dialog, name));
+               dialog->setView(new FormText(*dialog,
+                                            _("Label"), _("Label:|#L")));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "log") {
+               dialog->setController(new ControlLog(*dialog));
+               dialog->setView(new FormLog(*dialog));
+               dialog->bc().bp(new OkCancelPolicy);
+
+       } else if (name == "mathpanel") {
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(new FormMathsPanel(*dialog));
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathaccents") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Maths Decorations & Accents"),
+                                        latex_deco, nr_latex_deco);
+               bitmap->addBitmap(
+                       BitmapStore(12, 3, 4, deco1_width, deco1_height, deco1_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(10, 4, 3, deco2_width, deco2_height, deco2_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "matharrows") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Arrows"), latex_arrow, nr_latex_arrow);
+               bitmap->addBitmap(
+                       BitmapStore(20, 5, 4, arrow_width,  arrow_height,  arrow_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(7,  2, 4, larrow_width, larrow_height, larrow_bits, false));
+               bitmap->addBitmap(
+                       BitmapStore(4,  2, 2, darrow_width,  darrow_height, darrow_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathoperators") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Binary Ops"),
+                                        latex_bop, nr_latex_bop);
+               bitmap->addBitmap(
+                       BitmapStore(31, 4, 8, bop_width, bop_height, bop_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathrelations") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Binary Relations"),
+                                        latex_brel, nr_latex_brel);
+               bitmap->addBitmap(
+                       BitmapStore(35, 4, 9, brel_width, brel_height, brel_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathgreek") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Greek"),
+                                        latex_greek, nr_latex_greek);
+               bitmap->addBitmap(
+                       BitmapStore(11, 6, 2, Greek_width, Greek_height, Greek_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(28, 7, 4, greek_width, greek_height, greek_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathmisc") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Misc"),
+                                        latex_misc, nr_latex_misc);
+               bitmap->addBitmap(
+                       BitmapStore(29, 5, 6, misc_width, misc_height, misc_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(5, 5, 1, misc4_width, misc4_height, misc4_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(6, 3, 2, misc2_width, misc2_height, misc2_bits, false));
+               bitmap->addBitmap(
+                       BitmapStore(4, 2, 2, misc3_width, misc3_height, misc3_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathdots") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Dots"),
+                                        latex_dots, nr_latex_dots);
+               bitmap->addBitmap(
+                       BitmapStore(4, 4, 1, dots_width, dots_height, dots_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathbigoperators") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("Big Operators"),
+                                        latex_varsz, nr_latex_varsz);
+               bitmap->addBitmap(
+                       BitmapStore(14, 3, 5, varsz_width, varsz_height, varsz_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathamsmisc") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("AMS Misc"),
+                                        latex_ams_misc, nr_latex_ams_misc);
+               bitmap->addBitmap(
+                       BitmapStore(9, 5, 2, ams1_width, ams1_height, ams1_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(26, 3, 9, ams7_width, ams7_height, ams7_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathamsarrows") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("AMS Arrows"),
+                                        latex_ams_arrows, nr_latex_ams_arrows);
+               bitmap->addBitmap(
+                       BitmapStore(32, 3, 11, ams2_width, ams2_height, ams2_bits, true));
+               bitmap->addBitmap(
+                       BitmapStore(6, 3, 2, ams3_width, ams3_height, ams3_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathamsrelations") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("AMS Relations"),
+                                        latex_ams_rel, nr_latex_ams_rel);
+               bitmap->addBitmap(
+                       BitmapStore(66, 6, 11, ams_rel_width, ams_rel_height, ams_rel_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathamsnegatedrelations") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("AMS Negated Rel"),
+                                        latex_ams_nrel, nr_latex_ams_nrel);
+               bitmap->addBitmap(
+                       BitmapStore(51, 6, 9, ams_nrel_width, ams_nrel_height, ams_nrel_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathamsoperators") {
+               FormMathsBitmap * bitmap =
+                       createFormBitmap(*dialog, _("AMS Operators"),
+                                        latex_ams_ops, nr_latex_ams_ops);
+               bitmap->addBitmap(
+                       BitmapStore(23, 3, 8, ams_ops_width, ams_ops_height, ams_ops_bits, true));
+
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(bitmap);
+               dialog->bc().bp(new IgnorantPolicy);
+
+       } else if (name == "mathdelimiter") {
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(new FormMathsDelim(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "mathmatrix") {
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(new FormMathsMatrix(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "mathspace") {
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(new FormMathsSpace(*dialog));
+               dialog->bc().bp(new IgnorantPolicy);
+       } else if (name == "mathstyle") {
+               dialog->setController(new ControlMath(*dialog));
+               dialog->setView(new FormMathsStyle(*dialog));
+               dialog->bc().bp(new IgnorantPolicy);
+       } else if (name == "note") {
+               dialog->setController(new ControlNote(*dialog));
+               dialog->setView(new FormNote(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "paragraph") {
+               dialog->setController(new ControlParagraph(*dialog));
+               dialog->setView(new FormParagraph(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "print") {
+               dialog->setController(new ControlPrint(*dialog));
+               dialog->setView(new FormPrint(*dialog));
+               dialog->bc().bp(new OkApplyCancelPolicy);
+       } else if (name == "ref") {
+               dialog->setController(new ControlRef(*dialog));
+               dialog->setView(new FormRef(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "sendto") {
+               dialog->setController(new ControlSendto(*dialog));
+               dialog->setView(new FormSendto(*dialog));
+               dialog->bc().bp(new OkApplyCancelPolicy);
+       } else if (name == "tabular") {
+               dialog->setController(new ControlTabular(*dialog));
+               dialog->setView(new FormTabular(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "tabularcreate") {
+               dialog->setController(new ControlTabularCreate(*dialog));
+               dialog->setView(new FormTabularCreate(*dialog));
+               dialog->bc().bp(new IgnorantPolicy);
+       } else if (name == "texinfo") {
+               dialog->setController(new ControlTexinfo(*dialog));
+               dialog->setView(new FormTexinfo(*dialog));
+               dialog->bc().bp(new OkCancelPolicy);
+#ifdef HAVE_LIBAIKSAURUS
+       } else if (name == "thesaurus") {
+               dialog->setController(new ControlThesaurus(*dialog));
+               dialog->setView(new FormThesaurus(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+#endif
+       } else if (name == "toc") {
+               dialog->setController(new ControlToc(*dialog));
+               dialog->setView(new FormToc(*dialog));
+               dialog->bc().bp(new OkCancelPolicy);
+       } else if (name == "url") {
+               dialog->setController(new ControlCommand(*dialog, name));
+               dialog->setView(new FormUrl(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } else if (name == "vspace") {
+               dialog->setController(new ControlVSpace(*dialog));
+               dialog->setView(new FormVSpace(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "wrap") {
+               dialog->setController(new ControlWrap(*dialog));
+               dialog->setView(new FormWrap(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       }
+
+       return dialog;
+}
+
+
+void Dialogs::toggleTooltips()
+{
+       Tooltips::toggleEnabled();
+}
+
+
+/// Are the tooltips on or off?
+bool Dialogs::tooltipsEnabled()
+{
+       return Tooltips::enabled();
+}