]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Dialogs.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / Dialogs.C
index 202af2b8b796cd0714de637059f7413099133228..2a5d851adbce362143026f36358cd4cc85045f1c 100644 (file)
@@ -31,6 +31,7 @@
 #include "ControlMath.h"
 #include "ControlNote.h"
 #include "ControlParagraph.h"
+#include "ControlPreamble.h"
 #include "ControlPrefs.h"
 #include "ControlPrint.h"
 #include "ControlRef.h"
@@ -68,6 +69,7 @@
 #include "FormMathsStyle.h"
 #include "FormNote.h"
 #include "FormParagraph.h"
+#include "FormPreamble.h"
 #include "FormPreferences.h"
 #include "FormPrint.h"
 #include "FormRef.h"
 #include "ams_nrel.xbm"
 #include "ams_ops.xbm"
 
+#include <boost/assert.hpp>
+
 
 using std::string;
+using namespace lyx::frontend;
 
 
 namespace {
@@ -123,14 +128,14 @@ FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
 
 char const * const dialognames[] = {
 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
-"citation", "document", "error", "errorlist" , "ert", "external", "file",
+"citation", "document", "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", "prefs", "print", "ref", "sendto", "spellchecker",
-"tabular", "tabularcreate", "texinfo",
+"note", "paragraph", "preamble", "prefs", "print", "ref", "sendto",
+"spellchecker", "tabular", "tabularcreate", "texinfo",
 
 #ifdef HAVE_LIBAIKSAURUS
 "thesaurus",
@@ -160,12 +165,11 @@ bool Dialogs::isValidName(string const & name) const
 }
 
 
-Dialog * Dialogs::build(string const & name)
+Dialogs::DialogPtr Dialogs::build(string const & name)
 {
-       if (!isValidName(name))
-               return 0;
+       BOOST_ASSERT(isValidName(name));
 
-       Dialog * dialog = new Dialog(lyxview_, name);
+       DialogPtr dialog(new Dialog(lyxview_, name));
        dialog->bc().view(new xformsBC(dialog->bc()));
 
        if (name == "aboutlyx") {
@@ -188,14 +192,14 @@ Dialog * Dialogs::build(string const & name)
                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 == "character") {
+               dialog->setController(new ControlCharacter(*dialog));
+               dialog->setView(new FormCharacter(*dialog));
+               dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
        } else if (name == "citation") {
                dialog->setController(new ControlCitation(*dialog));
                dialog->setView(new FormCitation(*dialog));
@@ -440,10 +444,14 @@ Dialog * Dialogs::build(string const & name)
                dialog->setController(new ControlParagraph(*dialog));
                dialog->setView(new FormParagraph(*dialog));
                dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+       } else if (name == "preamble") {
+               dialog->setController(new ControlPreamble(*dialog));
+               dialog->setView(new FormPreamble(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "prefs") {
                dialog->setController(new ControlPrefs(*dialog));
                dialog->setView(new FormPreferences(*dialog));
-               dialog->bc().bp(new OkApplyCancelPolicy);
+               dialog->bc().bp(new PreferencesPolicy);
        } else if (name == "print") {
                dialog->setController(new ControlPrint(*dialog));
                dialog->setView(new FormPrint(*dialog));