#include "GuiGraphics.h"
-#include "debug.h"
+#include "support/debug.h"
#include "LengthCombo.h"
#include "Length.h"
#include "LyXRC.h"
#include "Validator.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "graphics/GraphicsCache.h"
#include "graphics/GraphicsCacheItem.h"
#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"
#include <boost/bind.hpp>
#include <QCheckBox>
-#include <QCloseEvent>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <cmath>
#include <utility>
-#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
return tmp;
}
-/// The (tranlated) GUI std::string and it's LaTeX equivalent.
-typedef std::pair<docstring, std::string> RotationOriginPair;
+/// The (tranlated) GUI string and it's LaTeX equivalent.
+typedef pair<docstring, string> RotationOriginPair;
///
-std::vector<RotationOriginPair> getRotationOriginData();
+vector<RotationOriginPair> getRotationOriginData();
-GuiGraphics::GuiGraphics(LyXView & lv)
- : GuiDialog(lv, "graphics")
+GuiGraphics::GuiGraphics(GuiView & lv)
+ : 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()));
//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()),
}
-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();
}
}
void GuiGraphics::on_filename_textChanged(const QString & filename)
{
editPB->setDisabled(filename.isEmpty());
+ EmbeddedFile file = EmbeddedFile(fromqstr(filename), bufferFilepath());
}
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()) {
{
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
igp.rotateAngle = fromqstr(angle->text());
double rotAngle = convert<double>(igp.rotateAngle);
- if (std::abs(rotAngle) > 360.0) {
+ if (abs(rotAngle) > 360.0) {
rotAngle -= 360.0 * floor(rotAngle / 360.0);
igp.rotateAngle = convert<string>(rotAngle);
}
void GuiGraphics::getBB()
{
string const fn = fromqstr(filename->text());
- if (!fn.empty()) {
- string const bb = readBB(fn);
- if (!bb.empty()) {
- lbX->setText(toqstr(token(bb, ' ', 0)));
- lbY->setText(toqstr(token(bb, ' ', 1)));
- rtX->setText(toqstr(token(bb, ' ', 2)));
- rtY->setText(toqstr(token(bb, ' ', 3)));
- // the default units for the bb values when reading
- // it from the file
- lbXunit->setCurrentIndex(0);
- lbYunit->setCurrentIndex(0);
- rtXunit->setCurrentIndex(0);
- rtYunit->setCurrentIndex(0);
- }
- bbChanged = false;
- }
+ if (fn.empty())
+ return;
+ string const bb = readBB(fn);
+ bbChanged = false;
+ if (bb.empty())
+ return;
+ lbX->setText(toqstr(token(bb, ' ', 0)));
+ lbY->setText(toqstr(token(bb, ' ', 1)));
+ rtX->setText(toqstr(token(bb, ' ', 2)));
+ rtY->setText(toqstr(token(bb, ' ', 3)));
+ // the default units for the bb values when reading
+ // it from the file
+ lbXunit->setCurrentIndex(0);
+ lbYunit->setCurrentIndex(0);
+ rtXunit->setCurrentIndex(0);
+ rtYunit->setCurrentIndex(0);
}
graphics::Image const * image = gc.item(abs_file)->image();
if (image) {
- width = image->getWidth();
- height = image->getHeight();
+ width = image->width();
+ height = image->height();
}
}
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();
}
}
-Dialog * createGuiGraphics(LyXView & lv) { return new GuiGraphics(lv); }
+Dialog * createGuiGraphics(GuiView & lv) { return new GuiGraphics(lv); }
} // namespace frontend