]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Dialogs.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / Dialogs.C
index 128fc08a19ddaeddcac6de4897ca98422b3bf4ca..7d03a3433e18e51391dd6c6f5aea0a02c669e2c4 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file qt2/Dialogs.C
+ * \file qt4/Dialogs.C
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
@@ -18,7 +18,6 @@
 #include "ControlBranch.h"
 #include "ControlChanges.h"
 #include "ControlCharacter.h"
-#include "ControlCitation.h"
 #include "ControlDocument.h"
 #include "ControlErrorList.h"
 #include "ControlERT.h"
@@ -27,6 +26,7 @@
 #include "ControlGraphics.h"
 #include "ControlInclude.h"
 #include "ControlLog.h"
+#include "ControlViewSource.h"
 #include "ControlMath.h"
 #include "ControlNote.h"
 #include "ControlParagraph.h"
@@ -39,7 +39,6 @@
 #include "ControlSpellchecker.h"
 #include "ControlTabular.h"
 #include "ControlTabularCreate.h"
-#include "ControlToc.h"
 #include "ControlVSpace.h"
 #include "ControlWrap.h"
 
 #include "QERT.h"
 #include "QExternal.h"
 #include "QFloat.h"
-// Here would be an appropriate point to lecture on the evils
-// of the Qt headers, those most fucked up of disgusting ratholes.
-// But I won't.
-#undef signals
 #include "QGraphics.h"
 #include "QInclude.h"
 #include "QIndex.h"
 #include "QLog.h"
+#include "QViewSource.h"
 #include "QMath.h"
 #include "QNote.h"
 #include "QParagraph.h"
@@ -81,7 +77,8 @@
 #include "QTabularCreate.h"
 #include "QTexinfo.h"
 #include "QToc.h"
-#include "q3url.h"
+#include "QTocDialog.h"
+#include "UrlView.h"
 #include "QVSpace.h"
 #include "QWrap.h"
 
@@ -91,7 +88,6 @@
 #endif
 
 #include "qt_helpers.h"
-#include "QURL.h"
 
 #include <boost/assert.hpp>
 
@@ -104,8 +100,8 @@ namespace {
 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", "mathdelimiter", "mathmatrix", "note", "paragraph", "preamble",
+"findreplace", "float", "graphics", "include", "index", "label", "log", "view-source",
+"mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph",
 "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
 
 #ifdef HAVE_LIBAIKSAURUS
@@ -178,25 +174,10 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
                dialog->setController(ci);
                dialog->setView(new QCitationDialog(*dialog, ci));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
-       } else if (name == "document" || name == "preamble") {
-
-               // This nastiness will exist only as long as xforms
-               // has a separate preamble dialog.
-
-               string const other = (name == "document") ?
-                       "preamble" : "document";
-
-               std::map<string, DialogPtr>::iterator it =
-                       dialogs_.find(other);
-
-               if (it != dialogs_.end())
-                       dialog = it->second;
-               else {
-                       dialog->setController(new ControlDocument(*dialog));
-                       dialog->setView(new QDocument(*dialog));
-                       dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
-               }
-
+       } else if (name == "document") {
+               dialog->setController(new ControlDocument(*dialog));
+               dialog->setView(new QDocument(*dialog));
+               dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "errorlist") {
                dialog->setController(new ControlErrorList(*dialog));
                dialog->setView(new QErrorList(*dialog));
@@ -232,19 +213,23 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
        } else if (name == "index") {
                dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new QIndex(*dialog,
-                                          _("Index Entry"),
+                                          lyx::to_utf8(_("Index Entry")),
                                           qt_("&Keyword:")));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "label") {
                dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new QIndex(*dialog,
-                                          _("Label"),
+                                          lyx::to_utf8(_("Label")),
                                           qt_("&Label:")));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "log") {
                dialog->setController(new ControlLog(*dialog));
                dialog->setView(new QLog(*dialog));
                dialog->bc().bp(new OkCancelPolicy);
+       } else if (name == "view-source") {
+               dialog->setController(new ControlViewSource(*dialog));
+               dialog->setView(new QViewSource(*dialog));
+               dialog->bc().bp(new OkCancelPolicy);
        } else if (name == "mathpanel") {
                dialog->setController(new ControlMath(*dialog));
                dialog->setView(new QMath(*dialog));
@@ -274,7 +259,8 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
                dialog->setView(new QPrint(*dialog));
                dialog->bc().bp(new OkApplyCancelPolicy);
        } else if (name == "ref") {
-               dialog->setController(new ControlRef(*dialog));
+               // full qualification because qt4 has also a ControlRef type
+               dialog->setController(new lyx::frontend::ControlRef(*dialog));
                dialog->setView(new QRef(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "sendto") {
@@ -304,12 +290,13 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
                dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
 #endif
        } else if (name == "toc") {
-               dialog->setController(new ControlToc(*dialog));
-               dialog->setView(new QToc(*dialog));
+               QToc * qtoc = new QToc(*dialog);
+               dialog->setController(qtoc);
+               dialog->setView(new QTocDialog(*dialog, qtoc));
                dialog->bc().bp(new OkCancelPolicy);
        } else if (name == "url") {
                dialog->setController(new ControlCommand(*dialog, name));
-               dialog->setView(new QURL(*dialog));
+               dialog->setView(new UrlView(*dialog));
                dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
        } else if (name == "vspace") {
                dialog->setController(new ControlVSpace(*dialog));