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
This commit is contained in:
Abdelrazak Younes 2008-05-06 15:18:50 +00:00
parent c14295fbe3
commit 99b12faae4
2 changed files with 22 additions and 28 deletions

View File

@ -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<string> & 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;
}

View File

@ -18,8 +18,9 @@
#include "GuiDialog.h"
#include "ui_GraphicsUi.h"
#include "insets/InsetGraphicsParams.h"
#include "support/docstring.h"
#include "insets/InsetGraphics.h"
#include <vector>
@ -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<std::string> 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<std::string> origin_ltx;
///
InsetGraphicsParams params_;
};