#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")
+ : GuiDialog(lv, "include", qt_("Child Document")),
+ params_(insetCode("include"))
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
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())));
// 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();
- docstring const & name = browse(qstring_to_ucs4(filenameED->text()), type);
- if (!name.empty())
- filenameED->setText(toqstr(name));
+ QString name = browse(filenameED->text(), type);
+ if (!name.isEmpty())
+ filenameED->setText(name);
- return browseRelFile(in_name, docpath, title, filters, false,
- _("Documents|#o#O"), from_utf8(lyxrc.document_path));
+ return browseRelToParent(in_name, docpath, title, filters, false,
+ qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
- 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, 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));