#include "GuiExternal.h"
-#include "frontend_helpers.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Length.h"
#include "LyXRC.h"
#include "qt_helpers.h"
#include "Validator.h"
-#include <QCloseEvent>
#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QTabWidget>
#include <QTextBrowser>
-using std::advance;
-using std::vector;
-using std::string;
-
+using namespace std;
+using namespace lyx::support;
namespace lyx {
namespace frontend {
-using support::FileFilterList;
-using support::FileName;
-using support::float_equal;
-using support::isStrDbl;
-using support::makeAbsPath;
-using support::readBB_from_PSFile;
-using support::token;
-using support::trim;
-using support::os::internal_path;
-
using namespace external;
namespace {
} // namespace anon
-GuiExternal::GuiExternal(LyXView & lv)
- : GuiDialog(lv, "external"), bbChanged_(false)
+GuiExternal::GuiExternal(GuiView & lv)
+ : GuiDialog(lv, "external", qt_("External Material")), bbChanged_(false)
{
setupUi(this);
- setViewTitle(_("External Material"));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
this, SLOT(change_adaptor()));
connect(browsePB, SIGNAL(clicked()),
this, SLOT(browseClicked()));
+ connect(embedCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
connect(editPB, SIGNAL(clicked()),
this, SLOT(editClicked()));
connect(externalCO, SIGNAL(activated(QString)),
bc().addCheckedLineEdit(ytED, rtLA);
bc().addCheckedLineEdit(fileED, fileLA);
- std::vector<string> templates = getTemplates();
+ vector<string> templates = getTemplates();
- for (std::vector<string>::const_iterator cit = templates.begin();
+ for (vector<string>::const_iterator cit = templates.begin();
cit != templates.end(); ++cit) {
externalCO->addItem(qt_(*cit));
}
}
-void GuiExternal::closeEvent(QCloseEvent * e)
-{
- slotClose();
- e->accept();
-}
-
-
void GuiExternal::editClicked()
{
editExternal();
void GuiExternal::extraChanged(const QString& text)
{
- std::string const format = fromqstr(extraFormatCO->currentText());
+ string const format = fromqstr(extraFormatCO->currentText());
extra_[format] = text;
changed();
}
external::ResizeData const & data)
{
bool using_scale = data.usingScale();
- std::string scale = data.scale;
+ string scale = data.scale;
if (data.no_resize()) {
// Everything is zero, so default to this!
using_scale = true;
string const name =
params_.filename.outputFilename(bufferFilepath());
fileED->setText(toqstr(name));
+ embedCB->setCheckState(params_.filename.embedded() ? Qt::Checked : Qt::Unchecked);
externalCO->setCurrentIndex(getTemplateNumber(params_.templatename()));
updateTemplate();
void GuiExternal::applyView()
{
- params_.filename.set(internal_path(fromqstr(fileED->text())),
- bufferFilepath());
+ params_.filename.set(fromqstr(fileED->text()), bufferFilepath());
+ params_.filename.setEmbed(embedCB->checkState() == Qt::Checked);
params_.settemplate(getTemplate(externalCO->currentIndex()).lyxName);
{
docstring const title = _("Select external file");
- docstring const bufpath = lyx::from_utf8(bufferFilepath());
+ docstring const bufpath = from_utf8(bufferFilepath());
FileFilterList const filter =
- FileFilterList(lyx::from_utf8(getTemplateFilters(lyx::to_utf8(template_name))));
+ FileFilterList(from_utf8(getTemplateFilters(to_utf8(template_name))));
- std::pair<docstring, docstring> dir1(_("Documents|#o#O"),
- lyx::from_utf8(lyxrc.document_path));
+ docstring const label1 = _("Documents|#o#O");
+ docstring const dir1 = from_utf8(lyxrc.document_path);
- return browseRelFile(input, bufpath, title, filter, false, dir1);
+ return browseRelFile(input, bufpath, title, filter, false, label1, dir1);
}
graphics::Image const * image = gc.item(abs_file)->image();
if (image) {
- width = image->getWidth();
- height = image->getHeight();
+ width = image->width();
+ height = image->height();
}
}
}
-Dialog * createGuiExternal(LyXView & lv) { return new GuiExternal(lv); }
+Dialog * createGuiExternal(GuiView & lv) { return new GuiExternal(lv); }
} // namespace frontend