From e2e63b4b1b06e1950c1c8437637fba5f1cf92814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Tue, 13 Jul 2010 01:06:20 +0000 Subject: [PATCH] support for the ISO C-series paper formats; fileformat change git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34883 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 4 ++ lib/lyx2lyx/lyx_2_0.py | 18 ++++++- src/Buffer.cpp | 2 +- src/BufferParams.cpp | 87 ++++++++++++++++++++++++++++--- src/LyXRC.cpp | 7 +++ src/frontends/qt4/GuiDocument.cpp | 7 +++ src/paper.h | 14 +++++ 7 files changed, 128 insertions(+), 11 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 47a0c33108..824a96c1bf 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,10 @@ The good example would be 2010-01-10 entry. ----------------------- +2010-07-13 Uwe Stöhr + * Format incremented to 395: support for ISO C-series paper format; + new parameter \papersize cxpaper with (x = 0 - 6) + 2010-07-03 Uwe Stöhr * Format incremented to 394: support for makebox; new box parameter \use_makebox diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 169539b9a9..14ffa2ea1f 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1670,6 +1670,18 @@ def revert_pagesizes(document): del document.header[i] +def revert_DIN_C_pagesizes(document): + i = 0 + " Revert DIN C page sizes to default " + i = find_token(document.header, '\\papersize', 0) + if i != -1: + size = document.header[i][11:] + if size == "c0paper" or size == "c1paper" or size == "c2paper" \ + or size == "c3paper" or size == "c4paper" or size == "c5paper" \ + or size == "c6paper": + del document.header[i] + + def convert_html_quotes(document): " Remove quotes around html_latex_start and html_latex_end " @@ -1984,10 +1996,12 @@ convert = [[346, []], [391, []], [392, [convert_beamer_args]], [393, [convert_optarg]], - [394, []] + [394, []], + [395, []] ] -revert = [[393, [revert_makebox]], +revert = [[394, [revert_DIN_C_pagesizes]], + [393, [revert_makebox]], [392, [revert_argument]], [391, [revert_beamer_args]], [390, [revert_align_decimal, revert_IEEEtran]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 5c48720832..2a0ef17fe4 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -126,7 +126,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 394; // uwestoehr: support for \makebox +int const LYX_FORMAT = 395; // uwestoehr: support for ISO C paper size series typedef map DepClean; typedef map > RefCache; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index f2cece0be2..1d4bcd5049 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -74,7 +74,8 @@ static char const * const string_papersize[] = { "default", "custom", "letterpaper", "legalpaper", "executivepaper", "a0paper", "a1paper", "a2paper", "a3paper", "a4paper", "a5paper", "a6paper", "b0paper", "b1paper", "b2paper","b3paper", "b4paper", - "b5paper", "b6paper", "b0j", "b1j", "b2j", "b3j", "b4j", "b5j", + "b5paper", "b6paper", "c0paper", "c1paper", "c2paper", "c3paper", + "c4paper", "c5paper", "c6paper", "b0j", "b1j", "b2j", "b3j", "b4j", "b5j", "b6j", "" }; @@ -173,13 +174,20 @@ static PaperSizeTranslator initPaperSizeTranslator() translator.addPair(string_papersize[16], PAPER_B4); translator.addPair(string_papersize[17], PAPER_B5); translator.addPair(string_papersize[18], PAPER_B6); - translator.addPair(string_papersize[19], PAPER_JISB0); - translator.addPair(string_papersize[20], PAPER_JISB1); - translator.addPair(string_papersize[21], PAPER_JISB2); - translator.addPair(string_papersize[22], PAPER_JISB3); - translator.addPair(string_papersize[23], PAPER_JISB4); - translator.addPair(string_papersize[24], PAPER_JISB5); - translator.addPair(string_papersize[25], PAPER_JISB6); + translator.addPair(string_papersize[19], PAPER_C0); + translator.addPair(string_papersize[20], PAPER_C1); + translator.addPair(string_papersize[21], PAPER_C2); + translator.addPair(string_papersize[22], PAPER_C3); + translator.addPair(string_papersize[23], PAPER_C4); + translator.addPair(string_papersize[24], PAPER_C5); + translator.addPair(string_papersize[25], PAPER_C6); + translator.addPair(string_papersize[26], PAPER_JISB0); + translator.addPair(string_papersize[27], PAPER_JISB1); + translator.addPair(string_papersize[28], PAPER_JISB2); + translator.addPair(string_papersize[29], PAPER_JISB3); + translator.addPair(string_papersize[30], PAPER_JISB4); + translator.addPair(string_papersize[31], PAPER_JISB5); + translator.addPair(string_papersize[32], PAPER_JISB6); return translator; } @@ -1230,6 +1238,13 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, case PAPER_B3: case PAPER_B4: case PAPER_B6: + case PAPER_C0: + case PAPER_C1: + case PAPER_C2: + case PAPER_C3: + case PAPER_C4: + case PAPER_C5: + case PAPER_C6: case PAPER_JISB0: case PAPER_JISB1: case PAPER_JISB2: @@ -1480,6 +1495,27 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, case PAPER_B6: ods << ",b6paper"; break; + case PAPER_C0: + ods << ",c0paper"; + break; + case PAPER_C1: + ods << ",c1paper"; + break; + case PAPER_C2: + ods << ",c2paper"; + break; + case PAPER_C3: + ods << ",c3paper"; + break; + case PAPER_C4: + ods << ",c4paper"; + break; + case PAPER_C5: + ods << ",c5paper"; + break; + case PAPER_C6: + ods << ",c6paper"; + break; case PAPER_JISB0: ods << ",b0j"; break; @@ -1536,6 +1572,13 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, case PAPER_B3: case PAPER_B4: case PAPER_B6: + case PAPER_C0: + case PAPER_C1: + case PAPER_C2: + case PAPER_C3: + case PAPER_C4: + case PAPER_C5: + case PAPER_C6: case PAPER_JISB0: case PAPER_JISB1: case PAPER_JISB2: @@ -2235,6 +2278,34 @@ string BufferParams::paperSizeName(PapersizePurpose purpose) const if (purpose == DVIPS || purpose == DVIPDFM) return string(); return "b6"; + case PAPER_C0: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c0"; + case PAPER_C1: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c1"; + case PAPER_C2: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c2"; + case PAPER_C3: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c3"; + case PAPER_C4: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c4"; + case PAPER_C5: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c5"; + case PAPER_C6: + if (purpose == DVIPS || purpose == DVIPDFM) + return string(); + return "c6"; case PAPER_JISB0: if (purpose == DVIPS || purpose == DVIPDFM) return string(); diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 90d51cb587..4de11cc08f 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -1437,6 +1437,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c case PAPER_B3: case PAPER_B4: case PAPER_B6: + case PAPER_C0: + case PAPER_C1: + case PAPER_C2: + case PAPER_C3: + case PAPER_C4: + case PAPER_C5: + case PAPER_C6: case PAPER_JISB0: case PAPER_JISB1: case PAPER_JISB2: diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index c581211458..45cf01d843 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -779,6 +779,13 @@ GuiDocument::GuiDocument(GuiView & lv) cb->addItem(qt_("B4")); cb->addItem(qt_("B5")); cb->addItem(qt_("B6")); + cb->addItem(qt_("C0")); + cb->addItem(qt_("C1")); + cb->addItem(qt_("C2")); + cb->addItem(qt_("C3")); + cb->addItem(qt_("C4")); + cb->addItem(qt_("C5")); + cb->addItem(qt_("C6")); cb->addItem(qt_("JIS B0")); cb->addItem(qt_("JIS B1")); cb->addItem(qt_("JIS B2")); diff --git a/src/paper.h b/src/paper.h index 1ad2032939..fefad9520e 100644 --- a/src/paper.h +++ b/src/paper.h @@ -62,6 +62,20 @@ enum PAPER_SIZE { /// PAPER_B6, /// + PAPER_C0, + /// + PAPER_C1, + /// + PAPER_C2, + /// + PAPER_C3, + /// + PAPER_C4, + /// + PAPER_C5, + /// + PAPER_C6, + /// PAPER_JISB0, /// PAPER_JISB1,