X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FinsetgraphicsParams.C;h=c0cdd5fae8826669aa6d68d3e2c1ae08c78acc69;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=875b332223e37ec35126b36b2029058bd7bfc16e;hpb=83ffa28e7717a120eeda917bc9d83b335815fcde;p=lyx.git diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index 875b332223..c0cdd5fae8 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -14,6 +14,7 @@ #include "insetgraphicsParams.h" #include "debug.h" +#include "lyx_main.h" // for use_gui #include "lyxlex.h" #include "lyxrc.h" @@ -25,18 +26,17 @@ #include "support/lstrings.h" #include "support/translator.h" -using lyx::support::float_equal; -using lyx::support::readBB_from_PSFile; -using lyx::support::token; + +namespace lyx { + +using support::float_equal; +using support::readBB_from_PSFile; +using support::token; using std::string; using std::ostream; -namespace lyx { -extern bool use_gui; -} - InsetGraphicsParams::InsetGraphicsParams() { init(); @@ -67,7 +67,7 @@ void InsetGraphicsParams::init() { filename.erase(); lyxscale = 100; // lyx scaling in percentage - display = lyx::graphics::DefaultDisplay; // display mode; see preferences + display = graphics::DefaultDisplay; // display mode; see preferences scale = string(); // output scaling in percentage width = LyXLength(); height = LyXLength(); @@ -154,8 +154,8 @@ void InsetGraphicsParams::Write(ostream & os, string const & bufpath) const } if (lyxscale != 100) os << "\tlyxscale " << lyxscale << '\n'; - if (display != lyx::graphics::DefaultDisplay) - os << "\tdisplay " << lyx::graphics::displayTranslator().find(display) << '\n'; + if (display != graphics::DefaultDisplay) + os << "\tdisplay " << graphics::displayTranslator().find(display) << '\n'; if (!scale.empty() && !float_equal(convert(scale), 0.0, 0.05)) { if (!float_equal(convert(scale), 100.0, 0.05)) os << "\tscale " << scale << '\n'; @@ -203,7 +203,7 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token, string const } else if (token == "display") { lex.next(); string const type = lex.getString(); - display = lyx::graphics::displayTranslator().find(type); + display = graphics::displayTranslator().find(type); } else if (token == "scale") { lex.next(); scale = lex.getString(); @@ -263,10 +263,10 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token, string const } -lyx::graphics::Params InsetGraphicsParams::as_grfxParams() const +graphics::Params InsetGraphicsParams::as_grfxParams() const { - lyx::graphics::Params pars; - pars.filename = filename.absFilename(); + graphics::Params pars; + pars.filename = filename; pars.scale = lyxscale; pars.angle = convert(rotateAngle); @@ -274,7 +274,7 @@ lyx::graphics::Params InsetGraphicsParams::as_grfxParams() const pars.bb = bb; // Get the original Bounding Box from the file - string const tmp = readBB_from_PSFile(filename.absFilename()); + string const tmp = readBB_from_PSFile(filename); lyxerr[Debug::GRAPHICS] << "BB_from_File: " << tmp << std::endl; if (!tmp.empty()) { #ifdef WITH_WARNINGS @@ -317,16 +317,19 @@ lyx::graphics::Params InsetGraphicsParams::as_grfxParams() const } } - if (display == lyx::graphics::DefaultDisplay) { + if (display == graphics::DefaultDisplay) { pars.display = lyxrc.display_graphics; } else { pars.display = display; } // Override the above if we're not using a gui - if (!lyx::use_gui) { - pars.display = lyx::graphics::NoDisplay; + if (!use_gui) { + pars.display = graphics::NoDisplay; } return pars; } + + +} // namespace lyx