]> 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 6eed624908014cf96ec23e128a34966239f8470a..2a5d851adbce362143026f36358cd4cc85045f1c 100644 (file)
@@ -5,23 +5,22 @@
  *
  * \author Angus Leeming
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "Dialogs.h"
-#include "Dialog.h"
 
 #include "Tooltips.h"
 
 #include "ControlAboutlyx.h"
 #include "ControlBibtex.h"
+#include "ControlBox.h"
+#include "ControlBranch.h"
 #include "ControlChanges.h"
-#include "ControlCharacter.h"
 #include "ControlCitation.h"
-#include "ControlCommand.h"
-#include "ControlError.h"
+#include "ControlDocument.h"
 #include "ControlErrorList.h"
 #include "ControlERT.h"
 #include "ControlExternal.h"
 #include "ControlInclude.h"
 #include "ControlLog.h"
 #include "ControlMath.h"
-#include "ControlMinipage.h"
+#include "ControlNote.h"
 #include "ControlParagraph.h"
+#include "ControlPreamble.h"
+#include "ControlPrefs.h"
+#include "ControlPrint.h"
 #include "ControlRef.h"
+#include "ControlSearch.h"
+#include "ControlSendto.h"
 #include "ControlShowFile.h"
+#include "ControlSpellchecker.h"
 #include "ControlTabular.h"
 #include "ControlTabularCreate.h"
 #include "ControlToc.h"
-#include "ControlVCLog.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 "FormError.h"
+#include "FormDocument.h"
 #include "FormErrorList.h"
 #include "FormERT.h"
 #include "FormExternal.h"
 #include "FormMathsMatrix.h"
 #include "FormMathsSpace.h"
 #include "FormMathsStyle.h"
-#include "FormMinipage.h"
+#include "FormNote.h"
 #include "FormParagraph.h"
+#include "FormPreamble.h"
+#include "FormPreferences.h"
+#include "FormPrint.h"
 #include "FormRef.h"
 #include "FormTabular.h"
+#include "FormTexinfo.h"
+#include "FormSearch.h"
+#include "FormSendto.h"
 #include "FormShowFile.h"
+#include "FormSpellchecker.h"
 #include "FormTabularCreate.h"
 #include "FormText.h"
 #include "FormToc.h"
 #include "FormUrl.h"
-#include "FormVCLog.h"
+#include "FormVSpace.h"
 #include "FormWrap.h"
 
 #ifdef HAVE_LIBAIKSAURUS
 #include "ams_nrel.xbm"
 #include "ams_ops.xbm"
 
-#include <vector>
+#include <boost/assert.hpp>
+
+
+using std::string;
+using namespace lyx::frontend;
 
 
 namespace {
@@ -108,20 +126,22 @@ FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
 }
 
 
-char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
-"character", "citation", "error", "errorlist" , "ert", "external", "file",
-"float", "graphics", "include", "index", "label", "log", "mathpanel",
-"mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek",
-"mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
-"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators",
-"mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
-"minipage", "paragraph", "ref", "tabular", "tabularcreate",
+char const * const dialognames[] = {
+"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
+"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", "preamble", "prefs", "print", "ref", "sendto",
+"spellchecker", "tabular", "tabularcreate", "texinfo",
 
 #ifdef HAVE_LIBAIKSAURUS
 "thesaurus",
 #endif
 
-"toc", "url", "vclog", "wrap" };
+"toc", "url", "vspace", "wrap" };
 
 char const * const * const end_dialognames =
        dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -145,15 +165,14 @@ 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 == "about") {
+       if (name == "aboutlyx") {
                dialog->setController(new ControlAboutlyx(*dialog));
                dialog->setView(new FormAboutlyx(*dialog));
                dialog->bc().bp(new OkCancelPolicy);
@@ -165,22 +184,30 @@ Dialog * Dialogs::build(string const & name)
                dialog->setController(new ControlBibtex(*dialog));
                dialog->setView(new FormBibtex(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
-       } else if (name == "character") {
-               dialog->setController(new ControlCharacter(*dialog));
-               dialog->setView(new FormCharacter(*dialog));
+       } 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 == "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));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
-       } else if (name == "error") {
-               dialog->setController(new ControlError(*dialog));
-               dialog->setView(new FormError(*dialog));
-               dialog->bc().bp(new OkCancelPolicy);
+       } else if (name == "document") {
+               dialog->setController(new ControlDocument(*dialog));
+               dialog->setView(new FormDocument(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "errorlist") {
                dialog->setController(new ControlErrorList(*dialog));
                dialog->setView(new FormErrorList(*dialog));
@@ -197,6 +224,10 @@ Dialog * Dialogs::build(string const & name)
                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));
@@ -405,18 +436,38 @@ Dialog * Dialogs::build(string const & name)
                dialog->setController(new ControlMath(*dialog));
                dialog->setView(new FormMathsStyle(*dialog));
                dialog->bc().bp(new IgnorantPolicy);
-       } else if (name == "minipage") {
-               dialog->setController(new ControlMinipage(*dialog));
-               dialog->setView(new FormMinipage(*dialog));
-               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+       } 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 == "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 PreferencesPolicy);
+       } 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 == "spellchecker") {
+               dialog->setController(new ControlSpellchecker(*dialog));
+               dialog->setView(new FormSpellchecker(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "tabular") {
                dialog->setController(new ControlTabular(*dialog));
                dialog->setView(new FormTabular(*dialog));
@@ -425,6 +476,10 @@ Dialog * Dialogs::build(string const & name)
                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));
@@ -439,10 +494,10 @@ Dialog * Dialogs::build(string const & name)
                dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new FormUrl(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
-       } else if (name == "vclog") {
-               dialog->setController(new ControlVCLog(*dialog));
-               dialog->setView(new FormVCLog(*dialog));
-               dialog->bc().bp(new OkCancelPolicy);
+       } 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));