#include "support/filetools.h"
#include "insets/InsetListingsParams.h"
#include "insets/InsetInclude.h"
#include "support/filetools.h"
#include "insets/InsetListingsParams.h"
#include "insets/InsetInclude.h"
- : GuiCommand(lv, "include", qt_("Child Document"))
+ : GuiDialog(lv, "include", qt_("Child Document")),
+ params_(insetCode("include"))
this, SLOT(change_adaptor()));
connect(editPB, SIGNAL(clicked()), this, SLOT(edit()));
connect(browsePB, SIGNAL(clicked()), this, SLOT(browse()));
this, SLOT(change_adaptor()));
connect(editPB, SIGNAL(clicked()), this, SLOT(edit()));
connect(browsePB, SIGNAL(clicked()), this, SLOT(browse()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(captionLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(labelLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(listingsED, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(captionLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(labelLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(listingsED, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
- connect(listingsED, SIGNAL(textChanged()), this, SLOT(set_listings_msg()));
+ connect(listingsED, SIGNAL(textChanged()), this, SLOT(setListingsMsg()));
connect(bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
- connect(bypassCB, SIGNAL(clicked()), this, SLOT(set_listings_msg()));
+ connect(bypassCB, SIGNAL(clicked()), this, SLOT(setListingsMsg()));
- if (params != param_cache) {
- param_cache = params;
- msg_cache = InsetListingsParams(params).validate();
- }
- return msg_cache;
+ InsetListingsParams lstparams(params);
+ lstparams.setMinted(buffer().params().use_minted);
+ return lstparams.validate();
if (cmdname != "include" &&
cmdname != "verbatiminput" &&
cmdname != "verbatiminput*" &&
if (cmdname != "include" &&
cmdname != "verbatiminput" &&
cmdname != "verbatiminput*" &&
typeCO->setCurrentIndex(3);
listingsGB->setEnabled(true);
listingsED->setEnabled(true);
typeCO->setCurrentIndex(3);
listingsGB->setEnabled(true);
listingsED->setEnabled(true);
if (cap[0] == '{' && cap[cap.size() - 1] == '}') {
captionLE->setText(toqstr(cap.substr(1, cap.size() - 2)));
*it = "";
if (cap[0] == '{' && cap[cap.size() - 1] == '}') {
captionLE->setText(toqstr(cap.substr(1, cap.size() - 2)));
*it = "";
} else if (prefixIs(*it, "label=")) {
string lbl = it->substr(6);
if (lbl[0] == '{' && lbl[lbl.size()-1] == '}') {
} else if (prefixIs(*it, "label=")) {
string lbl = it->substr(6);
if (lbl[0] == '{' && lbl[lbl.size()-1] == '}') {
string extra = getStringFromVector(pars);
listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
}
string extra = getStringFromVector(pars);
listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
}
}
void GuiInclude::applyView()
{
params_["filename"] = from_utf8(internal_path(fromqstr(filenameED->text())));
}
void GuiInclude::applyView()
{
params_["filename"] = from_utf8(internal_path(fromqstr(filenameED->text())));
- params_["embed"].clear();
- try {
- Buffer & buf = buffer();
- EmbeddedFile file(to_utf8(params_["filename"]), buf.filePath());
- file.setEmbed(embedCB->checkState() == Qt::Checked);
- // move file around if needed, an exception may be raised.
- file.enable(buf.embedded(), &buf, true);
- // if things are OK..., set params_["embed"]
- params_["embed"] = file.embedded() ? from_utf8(file.inzipName()) : docstring();
- } catch (ExceptionMessage const & message) {
- Alert::error(message.title_, message.details_);
- // params_["embed"] will be empty if a file is failed to embed
- }
// the parameter string should have passed validation
InsetListingsParams par(fromqstr(listingsED->toPlainText()));
string caption = fromqstr(captionLE->text());
// the parameter string should have passed validation
InsetListingsParams par(fromqstr(listingsED->toPlainText()));
string caption = fromqstr(captionLE->text());
if (!label.empty())
par.addParam("label", "{" + label + "}");
string const listparams = par.params();
if (!label.empty())
par.addParam("label", "{" + label + "}");
string const listparams = par.params();
QString const title = qt_("Select document to include");
// input TeX, verbatim, or LyX file ?
QString const title = qt_("Select document to include");
// input TeX, verbatim, or LyX file ?
- return browseRelFile(in_name, docpath, title, filters, false,
+ return browseRelToParent(in_name, docpath, title, filters, false,
- string const ext = support::getExtension(file);
- if (ext == "lyx")
- dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN, file));
- else
- // tex file or other text file in verbatim mode
- formats.edit(buffer(),
- makeAbsPath(file, support::onlyPath(buffer().absFileName())),
- "text");
+ InsetCommand::string2params(data, params_);
+ paramsToDialog(params_);
+ return true;
+}
+
+
+void GuiInclude::dispatchParams()
+{
+ std::string const lfun = InsetCommand::params2string(params_);
+ dispatch(FuncRequest(getLfun(), lfun));