]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetgraphicsParams.C
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / insetgraphicsParams.C
index ad012fd9fe73d4fe8442592b7aa47ca3fb2cb4a8..1b8963802b99885e520ed91a2da988e00bcd9975 100644 (file)
@@ -11,9 +11,6 @@
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "insetgraphicsParams.h"
 
 #include "lyxrc.h"
 #include "debug.h"
 #include "lyxlex.h"
+#include "frontends/lyx_gui.h"
 
 using std::ostream;
 
+
 InsetGraphicsParams::InsetGraphicsParams()
 {
        init();
 }
 
+
 InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
 {
        // I decided to skip the initialization since the copy will overwrite
@@ -43,6 +43,7 @@ InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
        copy(igp);
 }
 
+
 InsetGraphicsParams &
 InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
 {
@@ -53,6 +54,7 @@ InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
        return *this;
 }
 
+
 void InsetGraphicsParams::init()
 {
        filename.erase();
@@ -75,6 +77,7 @@ void InsetGraphicsParams::init()
        special.erase();                // additional userdefined stuff
 }
 
+
 void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
 {
        filename = igp.filename;
@@ -97,6 +100,7 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
        special = igp.special;
 }
 
+
 bool operator==(InsetGraphicsParams const & left,
                InsetGraphicsParams const & right)
 {
@@ -125,12 +129,14 @@ bool operator==(InsetGraphicsParams const & left,
        return false;
 }
 
+
 bool operator!=(InsetGraphicsParams const & left,
                InsetGraphicsParams const & right)
 {
        return  !(left == right);
 }
 
+
 void InsetGraphicsParams::Write(ostream & os) const
 {
        // Do not write the default values
@@ -210,7 +216,7 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
                bb.erase();
                for (int i = 0; i < 4; ++i) {
                        if (i != 0)
-                               bb += " ";
+                               bb += ' ';
                        lex.next();
                        bb += lex.getString();
                }
@@ -225,8 +231,10 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token)
        } else if (token == "subcaption") {
                subcaption = true;
        } else if (token == "subcaptionText") {
-               lex.next();
-               subcaptionText = lex.getString();
+               lex.eatLine();
+               string sub = lex.getString();
+               // strip surrounding " "
+               subcaptionText = sub.substr(1, sub.length() - 2);
        } else if (token == "special") {
                lex.eatLine();
                special = lex.getString();
@@ -266,22 +274,22 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
                        unsigned int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
                        unsigned int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
 
-                       // new pars.bb values must be >= zero 
+                       // new pars.bb values must be >= zero
                        if  (pars.bb.xl > bb_orig_xl)
                                pars.bb.xl -= bb_orig_xl;
                        else
                                pars.bb.xl = 0;
-                       
+
                        if (pars.bb.xr > bb_orig_xl)
                                pars.bb.xr -= bb_orig_xl;
                        else
                                pars.bb.xr = 0;
-                               
+
                        if (pars.bb.yb > bb_orig_yb)
                                pars.bb.yb -= bb_orig_yb;
                        else
                                pars.bb.yb = 0;
-                               
+
                        if (pars.bb.yt > bb_orig_yb)
                                pars.bb.yt -= bb_orig_yb;
                        else
@@ -299,15 +307,15 @@ grfx::Params InsetGraphicsParams::as_grfxParams(string const & filepath) const
                        pars.bb.yt = 0;
                }
        }
-       
+
        if (display == grfx::DefaultDisplay) {
                pars.display = lyxrc.display_graphics;
        } else {
                pars.display = display;
        }
-       
+
        // Override the above if we're not using a gui
-       if (!lyxrc.use_gui) {
+       if (!lyx_gui::use_gui) {
                pars.display = grfx::NoDisplay;
        }