From 99b12faae498a9a09c91691cd45d42e6bb9e6dfb Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 6 May 2008 15:18:50 +0000 Subject: [PATCH] Fix 4603 for GuiGraphics. I guess most GuiDialog based dialog need fixing... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24643 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiGraphics.cpp | 10 ++++---- src/frontends/qt4/GuiGraphics.h | 40 ++++++++++++++----------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index d9c93bc852..e2740bab35 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -28,7 +28,7 @@ #include "graphics/GraphicsCacheItem.h" #include "graphics/GraphicsImage.h" -#include "insets/InsetGraphicsParams.h" +#include "insets/InsetGraphics.h" #include "support/convert.h" #include "support/debug.h" @@ -82,8 +82,7 @@ namespace frontend { //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 -//to make, since "auto" also appears in updateContents() (see -//GuiGraphics.cpp). +//to make, since "auto" also appears in paramsToDialog(). //The right way to do this, I think, would be to define a class //checkedLengthSet (and a partnering labeledLengthSete) that encapsulated //the checkbox, line edit, and length combo together, and then made e.g. @@ -427,7 +426,7 @@ static int itemNumber(const vector & v, string const & s) } -void GuiGraphics::updateContents() +void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp) { static char const * const bb_units[] = { "bp", "cm", "mm", "in" }; size_t const bb_size = sizeof(bb_units) / sizeof(bb_units[0]); @@ -445,8 +444,6 @@ void GuiGraphics::updateContents() rtYunit->addItem(toqstr(*it)); } - InsetGraphicsParams & igp = params_; - // set the right default unit Length::UNIT unitDefault = Length::CM; switch (lyxrc.default_papersize) { @@ -719,6 +716,7 @@ bool GuiGraphics::isValid() bool GuiGraphics::initialiseParams(string const & data) { InsetGraphics::string2params(data, buffer(), params_); + paramsToDialog(params_); return true; } diff --git a/src/frontends/qt4/GuiGraphics.h b/src/frontends/qt4/GuiGraphics.h index 3e767bb38a..14c2376466 100644 --- a/src/frontends/qt4/GuiGraphics.h +++ b/src/frontends/qt4/GuiGraphics.h @@ -18,8 +18,9 @@ #include "GuiDialog.h" #include "ui_GraphicsUi.h" +#include "insets/InsetGraphicsParams.h" + #include "support/docstring.h" -#include "insets/InsetGraphics.h" #include @@ -27,9 +28,6 @@ class QString; namespace lyx { -class InsetGraphics; -class InsetGraphicsParams; - namespace frontend { class GuiGraphics : public GuiDialog, public Ui::GraphicsUi @@ -53,34 +51,32 @@ private Q_SLOTS: private: /// bool isValid(); - /// Apply changes + /// Dialog inherited methods + //@{ void applyView(); - /// update - void updateContents(); + void updateContents() {} + bool initialiseParams(std::string const & data); + void clearParams(); + void dispatchParams(); + bool isBufferDependent() const { return true; } + //@} + + /// + void paramsToDialog(InsetGraphicsParams const & params); + /// get bounding box from file void getBB(); - - /// Store the LaTeX names for the rotation origins. - std::vector origin_ltx; - /// - bool initialiseParams(std::string const & data); - /// clean-up on hide. - void clearParams(); - /// clean-up on hide. - void dispatchParams(); - /// - bool isBufferDependent() const { return true; } - /// Browse for a file QString browse(QString const &) const; /// Read the Bounding Box from a eps or ps-file std::string readBoundingBox(std::string const & file); - /// Control the bb - bool bbChanged; /// test if file exist bool isFileNameValid(std::string const & fname) const; -private: + /// Control the bb + bool bbChanged; + /// Store the LaTeX names for the rotation origins. + std::vector origin_ltx; /// InsetGraphicsParams params_; };