]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiInclude.cpp
Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
[lyx.git] / src / frontends / qt4 / GuiInclude.cpp
index 3f31f3f000be625436cd23ce8f48f03651fade04..5aaf12a889c02afc43510c17f5bccdeb17334a69 100644 (file)
 
 #include "GuiInclude.h"
 
-#include "frontend_helpers.h"
-
 #include "Buffer.h"
 #include "Format.h"
 #include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
 #include "LyXRC.h"
 
 #include "qt_helpers.h"
@@ -51,7 +49,6 @@ namespace frontend {
 
 using support::FileFilterList;
 using support::FileName;
-using support::isFileReadable;
 using support::makeAbsPath;
 using support::onlyPath;
 using support::os::internal_path;
@@ -60,8 +57,8 @@ using support::getStringFromVector;
 using support::getVectorFromString;
 
 
-GuiInclude::GuiInclude(LyXView & lv)
-       : GuiDialog(lv, "include"), params_("include")
+GuiInclude::GuiInclude(GuiView & lv)
+       : GuiCommand(lv, "include")
 {
        setupUi(this);
        setViewTitle(_("Child Document"));
@@ -232,7 +229,7 @@ void GuiInclude::updateContents()
                typeCO->setCurrentIndex(3);
                listingsGB->setEnabled(true);
                listingsED->setEnabled(true);
-               InsetListingsParams par(params_.getOptions());
+               InsetListingsParams par(to_utf8(params_["lstparams"]));
                // extract caption and label and put them into their respective editboxes
                vector<string> pars = getVectorFromString(par.separatedParams(), "\n");
                for (vector<string>::iterator it = pars.begin();
@@ -278,7 +275,8 @@ void GuiInclude::applyView()
                        par.addParam("caption", "{" + caption + "}");
                if (!label.empty())
                        par.addParam("label", "{" + label + "}");
-               params_.setOptions(par.params());
+               string const listparams = par.params();
+               params_["lstparams"] = from_ascii(listparams);
        } else {
                if (visiblespaceCB->isChecked())
                        params_.setCmdName("verbatiminput*");
@@ -324,25 +322,6 @@ bool GuiInclude::isValid()
 }
 
 
-bool GuiInclude::initialiseParams(string const & data)
-{
-       InsetIncludeMailer::string2params(data, params_);
-       return true;
-}
-
-
-void GuiInclude::clearParams()
-{
-       params_.clear();
-}
-
-
-void GuiInclude::dispatchParams()
-{
-       dispatch(FuncRequest(getLfun(), InsetIncludeMailer::params2string(params_)));
-}
-
-
 docstring GuiInclude::browse(docstring const & in_name, Type in_type) const
 {
        docstring const title = _("Select document to include");
@@ -355,18 +334,14 @@ docstring GuiInclude::browse(docstring const & in_name, Type in_type) const
                filters = FileFilterList(_("LaTeX/LyX Documents (*.tex *.lyx)"));
                break;
        case VERBATIM:
-               break;
        case LISTINGS:
                break;
        }
 
-       pair<docstring, docstring> dir1(_("Documents|#o#O"),
-               from_utf8(lyxrc.document_path));
-
-       docstring const docpath = from_utf8(onlyPath(buffer().fileName()));
+       docstring const docpath = from_utf8(onlyPath(buffer().absFileName()));
 
-       return browseRelFile(in_name, docpath, title,
-                            filters, false, dir1);
+       return browseRelFile(in_name, docpath, title, filters, false, 
+               _("Documents|#o#O"), from_utf8(lyxrc.document_path));
 }
 
 
@@ -378,12 +353,12 @@ void GuiInclude::edit(string const & file)
        else
                // tex file or other text file in verbatim mode
                formats.edit(buffer(), 
-                       FileName(makeAbsPath(file, onlyPath(buffer().fileName()))),
+                       makeAbsPath(file, onlyPath(buffer().absFileName())),
                        "text");
 }
 
 
-Dialog * createGuiInclude(LyXView & lv) { return new GuiInclude(lv); }
+Dialog * createGuiInclude(GuiView & lv) { return new GuiInclude(lv); }
 
 
 } // namespace frontend