X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiGraphics.cpp;h=b48c2fd06f0c2231cc1d088a744e711538d37165;hb=ba76bf5eb85db5a10839fccee3430d906d3f7b70;hp=a263d8f07c26413d945bb3c7c6d56f0e0f7a031f;hpb=c610af7ccd720be6d837418fd783a52650d3f8c9;p=lyx.git diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index a263d8f07c..b48c2fd06f 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -16,7 +16,7 @@ #include "GuiGraphics.h" -#include "debug.h" +#include "support/debug.h" #include "LengthCombo.h" #include "Length.h" #include "LyXRC.h" @@ -24,7 +24,7 @@ #include "Validator.h" #include "FuncRequest.h" -#include "gettext.h" +#include "support/gettext.h" #include "graphics/GraphicsCache.h" #include "graphics/GraphicsCacheItem.h" @@ -36,7 +36,6 @@ #include "support/FileFilterList.h" #include "support/filetools.h" #include "support/lstrings.h" -#include "support/lyxlib.h" #include "support/os.h" #include "support/Package.h" #include "support/types.h" @@ -44,7 +43,6 @@ #include #include -#include #include #include #include @@ -54,31 +52,12 @@ #include #include -#ifndef CXX_GLOBAL_CSTD -using std::floor; -#endif -using std::find; -using std::vector; -using std::string; -using std::transform; -using std::make_pair; -using std::pair; -using std::vector; +using namespace std; +using namespace lyx::support; namespace lyx { namespace frontend { -using support::addName; -using support::FileFilterList; -using support::FileName; -using support::float_equal; -using support::makeAbsPath; -using support::os::internal_path; -using support::package; -using support::readBB_from_PSFile; -using support::token; - - //FIXME setAutoTextCB should really take an argument, as indicated, that //determines what text is to be written for "auto". But making //that work involves more extensive revisions than we now want @@ -126,18 +105,17 @@ getSecond(vector const & pr) return tmp; } -/// The (tranlated) GUI std::string and it's LaTeX equivalent. -typedef std::pair RotationOriginPair; +/// The (tranlated) GUI string and it's LaTeX equivalent. +typedef pair RotationOriginPair; /// -std::vector getRotationOriginData(); +vector getRotationOriginData(); GuiGraphics::GuiGraphics(GuiView & lv) - : GuiDialog(lv, "graphics") + : GuiDialog(lv, "graphics", qt_("Graphics")) { setupUi(this); - setViewTitle(_("Graphics")); - + //main buttons connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); @@ -147,6 +125,8 @@ GuiGraphics::GuiGraphics(GuiView & lv) //graphics pane connect(filename, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); + connect(embedCB, SIGNAL(toggled(bool)), + this, SLOT(change_adaptor())); connect(WidthCB, SIGNAL( clicked()), this, SLOT(change_adaptor())); connect(HeightCB, SIGNAL( clicked()), @@ -287,19 +267,11 @@ void GuiGraphics::change_bb() } -void GuiGraphics::closeEvent(QCloseEvent * e) -{ - slotClose(); - GuiDialog::closeEvent(e); -} - - void GuiGraphics::on_browsePB_clicked() { docstring const str = browse(qstring_to_ucs4(filename->text())); if (!str.empty()) { filename->setText(toqstr(str)); - embedCB->setCheckState(Qt::Unchecked); changed(); } } @@ -320,6 +292,7 @@ void GuiGraphics::on_editPB_clicked() void GuiGraphics::on_filename_textChanged(const QString & filename) { editPB->setDisabled(filename.isEmpty()); + EmbeddedFile file = EmbeddedFile(fromqstr(filename), bufferFilepath()); } @@ -469,7 +442,7 @@ void GuiGraphics::updateContents() string const name = igp.filename.outputFilename(bufferFilepath()); filename->setText(toqstr(name)); - embedCB->setCheckState(igp.filename.embedded() ? Qt::Checked : Qt::Unchecked); + embedCB->setCheckState(igp.filename.embedded() ? Qt::Checked : Qt::Unchecked); // set the bounding box values if (igp.bb.empty()) { @@ -614,8 +587,7 @@ void GuiGraphics::applyView() { InsetGraphicsParams & igp = params_; - igp.filename.set(internal_path(fromqstr(filename->text())), - bufferFilepath()); + igp.filename.set(fromqstr(filename->text()), bufferFilepath()); igp.filename.setEmbed(embedCB->checkState() == Qt::Checked); // the bb section @@ -692,7 +664,7 @@ void GuiGraphics::applyView() igp.rotateAngle = fromqstr(angle->text()); double rotAngle = convert(igp.rotateAngle); - if (std::abs(rotAngle) > 360.0) { + if (abs(rotAngle) > 360.0) { rotAngle -= 360.0 * floor(rotAngle / 360.0); igp.rotateAngle = convert(rotAngle); } @@ -807,7 +779,7 @@ string const GuiGraphics::readBB(string const & file) bool GuiGraphics::isFilenameValid(string const & fname) const { // It may be that the filename is relative. - return makeAbsPath(fname, bufferFilepath()).isFileReadable(); + return makeAbsPath(fname, bufferFilepath()).isReadableFile(); }