X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FinsetgraphicsParams.C;h=0218ac1ddcdc6a1e2108181490417cf49713dab2;hb=487f6eb3b43746460d090f643cd1e39f2d93a74b;hp=ef72e27307d5acf5f51b783aa6f298db5eb02b21;hpb=39b3fd44b958bff1250a943f5685e23f1b9e41fb;p=lyx.git diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index ef72e27307..0218ac1ddc 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -1,10 +1,9 @@ -// -*- C++ -*- /* This file is part of * ================================================= * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich. - * Copyright 1995-2000 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * This file Copyright 2000 Baruch Even * ================================================= */ @@ -22,25 +21,28 @@ #include "support/LAssert.h" +namespace { + /// This variable keeps a tab on whether the translator was set with the /// translations. -static bool translatorsSet = false; +bool translatorsSet = false; /// This is the translator between the Resize enum and corresponding lyx /// file strings. -static Translator < InsetGraphicsParams::Resize, string > +Translator< InsetGraphicsParams::Resize, string > resizeTranslator(InsetGraphicsParams::DEFAULT_SIZE, "default"); /// This is the translator between the Origin enum and corresponding lyx /// file strings. -static Translator < InsetGraphicsParams::Origin, string > +Translator< InsetGraphicsParams::Origin, string > originTranslator(InsetGraphicsParams::DEFAULT, "default"); /// This is the translator between the Display enum and corresponding lyx /// file strings. -static Translator < InsetGraphicsParams::DisplayType, string > +Translator< InsetGraphicsParams::DisplayType, string > displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome"); +} // namespace anon InsetGraphicsParams::InsetGraphicsParams() @@ -143,34 +145,34 @@ void InsetGraphicsParams::testInvariant() const // Filename might be empty (when the dialog is first created). // Assert(!filename.empty()); - Assert(display == COLOR || + lyx::Assert(display == COLOR || display == MONOCHROME || display == GRAYSCALE || display == NONE ); - Assert(widthResize == DEFAULT_SIZE || + lyx::Assert(widthResize == DEFAULT_SIZE || widthResize == CM || widthResize == INCH || widthResize == PERCENT_PAGE || widthResize == PERCENT_COLUMN ); - Assert(heightResize == DEFAULT_SIZE || + lyx::Assert(heightResize == DEFAULT_SIZE || heightResize == CM || heightResize == INCH || heightResize == PERCENT_PAGE ); - Assert(widthSize >= 0.0); - Assert(heightSize >= 0.0); + lyx::Assert(widthSize >= 0.0); + lyx::Assert(heightSize >= 0.0); // Angle is in degrees and ranges -360 < angle < 360 // The reason for this is that in latex there is a meaning for the // different angles and they are not necessarliy interchangeable, // it depends on the rotation origin. - Assert(rotateAngle < 360); - Assert(rotateAngle > -360); + lyx::Assert(rotateAngle < 360); + lyx::Assert(rotateAngle > -360); } @@ -195,8 +197,15 @@ bool operator==(InsetGraphicsParams const & left, return false; } +bool operator!=(InsetGraphicsParams const & left, + InsetGraphicsParams const & right) +{ + return !(left == right); +} + + +namespace { -static void writeResize(ostream & os, string const & key, InsetGraphicsParams::Resize resize, double size) { @@ -206,13 +215,16 @@ void writeResize(ostream & os, string const & key, os << ' ' << key << ' ' << size << '\n'; } -static void writeOrigin(ostream & os, +void writeOrigin(ostream & os, InsetGraphicsParams::Origin origin) { os << " rotateOrigin " << originTranslator.find(origin); os << '\n'; } +} // namespace anon + + void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const { // If there is no filename, write nothing for it. @@ -245,7 +257,8 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const } -static +namespace { + void readResize(InsetGraphicsParams * igp, bool height, string const & token) { @@ -260,12 +273,15 @@ void readResize(InsetGraphicsParams * igp, bool height, } -static void readOrigin(InsetGraphicsParams * igp, string const & token) -{ // TODO: complete this function. +{ + // TODO: complete this function. igp->rotateOrigin = originTranslator.find(token); } +} // namespace anon + + bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex, string const& token) {