From 9360861f33a1dbe1026814101d2c17a2c87ae0fd Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 12 Aug 2002 16:41:15 +0000 Subject: [PATCH] * Fix reading of lyxsize_type in 1.2.0 documents. * Document change to format. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4945 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/ChangeLog | 5 +++++ development/FORMAT | 19 +++++++++++++++++++ src/insets/ChangeLog | 4 ++++ src/insets/insetgraphicsParams.C | 32 +++++++++++++++++++++----------- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/development/ChangeLog b/development/ChangeLog index 1e7ae0d90e..4f7cb434c1 100644 --- a/development/ChangeLog +++ b/development/ChangeLog @@ -1,3 +1,8 @@ +2002-08-02 Angus Leeming + + * FORMAT: document the InsetGraphicsParams "size_type" -> "size_kind" + change. + 2002-08-02 Angus Leeming * FORMAT: a new file to document changes in the LyX file format. diff --git a/development/FORMAT b/development/FORMAT index 0688503884..9d4dfe87b8 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -15,3 +15,22 @@ The LyX file now contains: \end_inset Earlier versions of LyX just swallow this extra token silently. + +2002-08-12 Angus Leeming + +The 1.2.0 InsetGraphicsParams "size_type" and "lyxsize_type" have been +renamed as "size_kind" and "lyxsize_kind" respectively. + + \begin_inset Graphics FormatVersion 1 + filename file.eps + display default +- size_kind original ++ size_type original + width 7cm + rotateOrigin center +- lyxsize_kind original ++ lyxsize_type original + lyxwidth 4cm + + \end_inset + diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 928f8e3316..9d399cfcb4 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2002-08-12 Angus Leeming + + * insetgraphicsParams.C: fix reading of lyxsize_type in 1.2.0 documents. + 2002-08-12 Juergen Vigna * insetcollapsable.C (edit): ignore if entered when pressing mouse diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index f1f019845d..3445086b61 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -197,6 +197,22 @@ string const getSizeKindStr(InsetGraphicsParams::sizeKind sK_in) return "original"; } +// compatibility-stuff 1.20->1.3.0 +InsetGraphicsParams::sizeKind getSizeKind(int type) +{ + switch (type) { + case 1: + return InsetGraphicsParams::WH; + + case 2: + return InsetGraphicsParams::SCALE; + + case 0: + default: + return InsetGraphicsParams::DEFAULT_SIZE; + } +} + } //anon @@ -282,17 +298,7 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token) // compatibility-stuff 1.20->1.3.0 } else if (token == "size_type") { lex.next(); - switch (lex.getInteger()) { - case 0: - size_kind = DEFAULT_SIZE; - break; - case 1: - size_kind = WH; - break; - case 2: - size_kind = SCALE; - break; - } + size_kind = getSizeKind(lex.getInteger()); } else if (token == "width") { lex.next(); width = LyXLength(lex.getString()); @@ -315,6 +321,10 @@ bool InsetGraphicsParams::Read(LyXLex & lex, string const & token) } else if (token == "lyxsize_kind") { lex.next(); lyxsize_kind = getSizeKind(lex.getString()); + // compatibility-stuff 1.20->1.3.0 + } else if (token == "lyxsize_type") { + lex.next(); + lyxsize_kind = getSizeKind(lex.getInteger()); } else if (token == "lyxwidth") { lex.next(); lyxwidth = LyXLength(lex.getString()); -- 2.39.5