diff --git a/src/ChangeLog b/src/ChangeLog index d2f1ac8b71..1799fb9944 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2005-07-16 José Matos + + * buffer.C: + * converter.C: + * lyxrc.C: + * paper.h: + * bufferparams.[Ch] (setPaperStuff): remove setPaperStuff and use a + single papersize variable. + 2005-07-16 Jean-Marc Lasgouttes * text3.C (dispatch): honor boundary when checking if a cursor diff --git a/src/buffer.C b/src/buffer.C index 76e9de907a..89593a0b2b 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -684,7 +684,6 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type const pit) //lyxerr << "removing " << MacroTable::localMacros().size() // << " temporary macro entries" << endl; //MacroTable::localMacros().clear(); - params().setPaperStuff(); pimpl_->file_fully_loaded = true; return true; diff --git a/src/bufferparams.C b/src/bufferparams.C index b09857e5f7..a5bd2f88e6 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -125,22 +125,22 @@ QuotesTimesTranslator const & quotestimestranslator() // Paper size -typedef Translator PaperSizeTranslator; +typedef Translator PaperSizeTranslator; PaperSizeTranslator const init_papersizetranslator() { - PaperSizeTranslator translator(string_papersize[0], VM_PAPER_DEFAULT); - translator.addPair(string_papersize[1], VM_PAPER_CUSTOM); - translator.addPair(string_papersize[2], VM_PAPER_USLETTER); - translator.addPair(string_papersize[3], VM_PAPER_USLEGAL); - translator.addPair(string_papersize[4], VM_PAPER_USEXECUTIVE); - translator.addPair(string_papersize[5], VM_PAPER_A3); - translator.addPair(string_papersize[6], VM_PAPER_A4); - translator.addPair(string_papersize[7], VM_PAPER_A5); - translator.addPair(string_papersize[8], VM_PAPER_B3); - translator.addPair(string_papersize[9], VM_PAPER_B4); - translator.addPair(string_papersize[10], VM_PAPER_B5); + PaperSizeTranslator translator(string_papersize[0], PAPER_DEFAULT); + translator.addPair(string_papersize[1], PAPER_CUSTOM); + translator.addPair(string_papersize[2], PAPER_USLETTER); + translator.addPair(string_papersize[3], PAPER_USLEGAL); + translator.addPair(string_papersize[4], PAPER_USEXECUTIVE); + translator.addPair(string_papersize[5], PAPER_A3); + translator.addPair(string_papersize[6], PAPER_A4); + translator.addPair(string_papersize[7], PAPER_A5); + translator.addPair(string_papersize[8], PAPER_B3); + translator.addPair(string_papersize[9], PAPER_B4); + translator.addPair(string_papersize[10], PAPER_B5); return translator; } @@ -333,7 +333,6 @@ BufferParams::BufferParams() /* PaperLayout */ papersize = PAPER_DEFAULT; - papersize2 = VM_PAPER_DEFAULT; /* DEFAULT */ paperpackage = PACKAGE_NONE; orientation = ORIENTATION_PORTRAIT; use_geometry = false; @@ -490,7 +489,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) } else if (token == "\\papersize") { string ppsize; lex >> ppsize; - papersize2 = papersizetranslator().find(ppsize); + papersize = papersizetranslator().find(ppsize); } else if (token == "\\paperpackage") { string ppackage; lex >> ppackage; @@ -639,7 +638,7 @@ void BufferParams::writeFile(ostream & os) const spacing().writeFile(os); - os << "\\papersize " << string_papersize[papersize2] + os << "\\papersize " << string_papersize[papersize] << "\n\\paperpackage " << string_paperpackages[paperpackage] << "\n\\use_geometry " << convert(use_geometry) << "\n\\use_amsmath " << use_amsmath @@ -741,32 +740,37 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features, clsoptions << fontsize << "pt,"; } + // custom, A3, B3 and B4 paper sizes need geometry + bool nonstandard_papersize = (papersize == PAPER_B3) || + (papersize == PAPER_B4) || + (papersize == PAPER_A3) || + (papersize == PAPER_CUSTOM); - if (!use_geometry && - (paperpackage == PACKAGE_NONE)) { + if (!use_geometry && (paperpackage == PACKAGE_NONE)) { switch (papersize) { - case PAPER_A3PAPER: - clsoptions << "a3paper,"; - break; - case PAPER_A4PAPER: + case PAPER_A4: clsoptions << "a4paper,"; break; case PAPER_USLETTER: clsoptions << "letterpaper,"; break; - case PAPER_A5PAPER: + case PAPER_A5: clsoptions << "a5paper,"; break; - case PAPER_B5PAPER: + case PAPER_B5: clsoptions << "b5paper,"; break; - case PAPER_EXECUTIVEPAPER: + case PAPER_USEXECUTIVE: clsoptions << "executivepaper,"; break; - case PAPER_LEGALPAPER: + case PAPER_USLEGAL: clsoptions << "legalpaper,"; break; case PAPER_DEFAULT: + case PAPER_A3: + case PAPER_B3: + case PAPER_B4: + case PAPER_CUSTOM: break; } } @@ -882,14 +886,15 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features, break; } } - if (use_geometry) { + + if (use_geometry || nonstandard_papersize) { os << "\\usepackage{geometry}\n"; texrow.newline(); os << "\\geometry{verbose"; if (orientation == ORIENTATION_LANDSCAPE) os << ",landscape"; - switch (papersize2) { - case VM_PAPER_CUSTOM: + switch (papersize) { + case PAPER_CUSTOM: if (!paperwidth.empty()) os << ",paperwidth=" << paperwidth; @@ -897,58 +902,62 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features, os << ",paperheight=" << paperheight; break; - case VM_PAPER_USLETTER: + case PAPER_USLETTER: os << ",letterpaper"; break; - case VM_PAPER_USLEGAL: + case PAPER_USLEGAL: os << ",legalpaper"; break; - case VM_PAPER_USEXECUTIVE: + case PAPER_USEXECUTIVE: os << ",executivepaper"; break; - case VM_PAPER_A3: + case PAPER_A3: os << ",a3paper"; break; - case VM_PAPER_A4: + case PAPER_A4: os << ",a4paper"; break; - case VM_PAPER_A5: + case PAPER_A5: os << ",a5paper"; break; - case VM_PAPER_B3: + case PAPER_B3: os << ",b3paper"; break; - case VM_PAPER_B4: + case PAPER_B4: os << ",b4paper"; break; - case VM_PAPER_B5: + case PAPER_B5: os << ",b5paper"; break; default: - // default papersize ie VM_PAPER_DEFAULT + // default papersize ie PAPER_DEFAULT switch (lyxrc.default_papersize) { case PAPER_DEFAULT: // keep compiler happy case PAPER_USLETTER: os << ",letterpaper"; break; - case PAPER_LEGALPAPER: + case PAPER_USLEGAL: os << ",legalpaper"; break; - case PAPER_EXECUTIVEPAPER: + case PAPER_USEXECUTIVE: os << ",executivepaper"; break; - case PAPER_A3PAPER: + case PAPER_A3: os << ",a3paper"; break; - case PAPER_A4PAPER: + case PAPER_A4: os << ",a4paper"; break; - case PAPER_A5PAPER: + case PAPER_A5: os << ",a5paper"; break; - case PAPER_B5PAPER: + case PAPER_B5: os << ",b5paper"; break; + case PAPER_B3: + case PAPER_B4: + case PAPER_CUSTOM: + break; } } if (!topmargin.empty()) @@ -1124,33 +1133,6 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features, } -void BufferParams::setPaperStuff() -{ - papersize = PAPER_DEFAULT; - char const c1 = paperpackage; - if (c1 == PACKAGE_NONE) { - char const c2 = papersize2; - if (c2 == VM_PAPER_USLETTER) - papersize = PAPER_USLETTER; - else if (c2 == VM_PAPER_USLEGAL) - papersize = PAPER_LEGALPAPER; - else if (c2 == VM_PAPER_USEXECUTIVE) - papersize = PAPER_EXECUTIVEPAPER; - else if (c2 == VM_PAPER_A3) - papersize = PAPER_A3PAPER; - else if (c2 == VM_PAPER_A4) - papersize = PAPER_A4PAPER; - else if (c2 == VM_PAPER_A5) - papersize = PAPER_A5PAPER; - else if ((c2 == VM_PAPER_B3) || (c2 == VM_PAPER_B4) || - (c2 == VM_PAPER_B5)) - papersize = PAPER_B5PAPER; - } else if ((c1 == PACKAGE_A4) || (c1 == PACKAGE_A4WIDE) || - (c1 == PACKAGE_WIDEMARGINSA4)) - papersize = PAPER_A4PAPER; -} - - void BufferParams::useClassDefaults() { LyXTextClass const & tclass = textclasslist[textclass]; @@ -1273,17 +1255,17 @@ string const BufferParams::paperSizeName() const real_papersize = lyxrc.default_papersize; switch (real_papersize) { - case PAPER_A3PAPER: + case PAPER_A3: return "a3"; - case PAPER_A4PAPER: + case PAPER_A4: return "a4"; - case PAPER_A5PAPER: + case PAPER_A5: return "a5"; - case PAPER_B5PAPER: + case PAPER_B5: return "b5"; - case PAPER_EXECUTIVEPAPER: + case PAPER_USEXECUTIVE: return "foolscap"; - case PAPER_LEGALPAPER: + case PAPER_USLEGAL: return "legal"; case PAPER_USLETTER: default: @@ -1297,7 +1279,7 @@ string const BufferParams::dvips_options() const string result; if (use_geometry - && papersize2 == VM_PAPER_CUSTOM + && papersize == PAPER_CUSTOM && !lyxrc.print_paper_dimension_flag.empty() && !paperwidth.empty() && !paperheight.empty()) { @@ -1317,7 +1299,7 @@ string const BufferParams::dvips_options() const } } if (orientation == ORIENTATION_LANDSCAPE && - papersize2 != VM_PAPER_CUSTOM) + papersize != PAPER_CUSTOM) result += ' ' + lyxrc.print_landscape_flag; return result; } diff --git a/src/bufferparams.h b/src/bufferparams.h index d95abdff3e..86302c5583 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -88,9 +88,6 @@ public: */ bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const; - /// - void setPaperStuff(); - /// void useClassDefaults(); @@ -119,15 +116,13 @@ public: LyXTextClass const & getLyXTextClass() const; /* this are for the PaperLayout */ - /// the general papersize (papersize2 or paperpackage + /// the papersize PAPER_SIZE papersize; - /// the selected Geometry papersize - VMARGIN_PAPER_TYPE papersize2; /// a special paperpackage .sty-file PAPER_PACKAGES paperpackage; /// PAPER_ORIENTATION orientation; - /// + /// use custom margins bool use_geometry; /// std::string paperwidth; diff --git a/src/converter.C b/src/converter.C index c8f47c4785..4dec5fa2b3 100644 --- a/src/converter.C +++ b/src/converter.C @@ -77,7 +77,7 @@ string const dvipdfm_options(BufferParams const & bp) { string result; - if (bp.papersize2 != VM_PAPER_CUSTOM) { + if (bp.papersize != PAPER_CUSTOM) { string const paper_size = bp.paperSizeName(); if (paper_size != "b5" && paper_size != "foolscap") result = "-p "+ paper_size; diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 204eeebf87..667e86aafc 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2005-07-16 José Matos + + * ControlTabular.C (set): use a single papersize variable. + 2005-07-05 Jürgen Spitzmüller * ControlChanges.C (getChangeDate): use localized date (from diff --git a/src/frontends/controllers/ControlTabular.C b/src/frontends/controllers/ControlTabular.C index aaac6a3704..afbd485c50 100644 --- a/src/frontends/controllers/ControlTabular.C +++ b/src/frontends/controllers/ControlTabular.C @@ -79,7 +79,7 @@ void ControlTabular::set(LyXTabular::Feature f, string const & arg) bool ControlTabular::useMetricUnits() const { - return lyxrc.default_papersize > PAPER_EXECUTIVEPAPER; + return lyxrc.default_papersize > PAPER_USEXECUTIVE; } diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index a134b62d5f..fb067cd76d 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,9 @@ +2005-07-16 José Matos + + * ghelpers.C: + * GDocument.C: remove setPaperStuff and use a + single papersize variable. + 2005-07-15 José Matos * .cvsignore: add pch.h.gch and pch.h.gch.dep. diff --git a/src/frontends/gtk/GDocument.C b/src/frontends/gtk/GDocument.C index 6d5416c174..06c2d5d715 100644 --- a/src/frontends/gtk/GDocument.C +++ b/src/frontends/gtk/GDocument.C @@ -322,7 +322,7 @@ void GDocument::update() // *** End "Document" Page *** // *** Begin "Page" Page *** - int const psize = params.papersize2; + int const psize = params.papersize; pagesizecombo_.set_active(psize); setWidgetsFromLength( @@ -477,7 +477,7 @@ void GDocument::apply() // *** End "Document" Page *** // *** Begin "Page" Page *** - params.papersize2 = VMARGIN_PAPER_TYPE( + params.papersize = PAPER_SIZE( pagesizecombo_.get_active_row_number()); params.paperwidth = getLengthFromWidgets( @@ -516,8 +516,6 @@ void GDocument::apply() } params.paperpackage = PAPER_PACKAGES(margin); - params.setPaperStuff(); - params.topmargin = getLengthFromWidgets( *(mtopspin_->get_adjustment()), mtopunitcombo_); @@ -667,7 +665,7 @@ void GDocument::populateMargins() papersize = 0; bool const a4size = (papersize == 6 || papersize == 0 - && lyxrc.default_papersize == PAPER_A4PAPER); + && lyxrc.default_papersize == PAPER_A4); if (a4size && portraitradio_->get_active()) { marginscombo_.append_text(_("Small margins")); marginscombo_.append_text(_("Very small margins")); diff --git a/src/frontends/gtk/ghelpers.C b/src/frontends/gtk/ghelpers.C index 11cb9a3fa8..ca51df29b5 100644 --- a/src/frontends/gtk/ghelpers.C +++ b/src/frontends/gtk/ghelpers.C @@ -124,12 +124,12 @@ string const getDefaultUnit() switch (lyxrc.default_papersize) { case PAPER_DEFAULT: return "cm"; case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: return "in"; break; - case PAPER_A3PAPER: - case PAPER_A4PAPER: - case PAPER_A5PAPER: - case PAPER_B5PAPER: return "cm"; break; + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: return "in"; break; + case PAPER_A3: + case PAPER_A4: + case PAPER_A5: + case PAPER_B5: return "cm"; break; } // shut up compiler return "cm"; diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 5ff147fe94..30a5955fcf 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,11 @@ +2005-07-16 José Matos + + * QDocumentDialog.C: + * QExternal.C: + * QGraphics.C: + * QDocument.C: remove setPaperStuff and use a + single papersize variable. + 2005-07-16 Jean-Marc Lasgouttes * qfont_loader.C (addToFontPath): remove. diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index 7d1e75f4fc..7fa61f8689 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -362,7 +362,7 @@ void QDocument::apply() params.float_placement = dialog_->floatModule->get(); // paper - params.papersize2 = VMARGIN_PAPER_TYPE( + params.papersize = PAPER_SIZE( dialog_->pageLayoutModule->papersizeCO->currentItem()); // custom, A3, B3 and B4 paper sizes need geometry @@ -396,10 +396,6 @@ void QDocument::apply() } params.paperpackage = PAPER_PACKAGES(margin); - // set params.papersize from params.papersize2 - // and params.paperpackage - params.setPaperStuff(); - MarginsModuleBase const * m(dialog_->marginsModule); params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit); @@ -453,17 +449,21 @@ void QDocument::update_contents() case PAPER_DEFAULT: break; case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: defaultUnit = LyXLength::IN; break; - case PAPER_A3PAPER: - case PAPER_A4PAPER: - case PAPER_A5PAPER: - case PAPER_B5PAPER: + case PAPER_A3: + case PAPER_A4: + case PAPER_A5: + case PAPER_B3: + case PAPER_B4: + case PAPER_B5: defaultUnit = LyXLength::CM; break; + case PAPER_CUSTOM: + break; } // preamble @@ -628,7 +628,7 @@ void QDocument::update_contents() dialog_->floatModule->set(params.float_placement); // paper - int const psize = params.papersize2; + int const psize = params.papersize; dialog_->pageLayoutModule->papersizeCO->setCurrentItem(psize); dialog_->setMargins(psize); dialog_->setCustomPapersize(psize); diff --git a/src/frontends/qt2/QDocumentDialog.C b/src/frontends/qt2/QDocumentDialog.C index cf9216db43..b787008f45 100644 --- a/src/frontends/qt2/QDocumentDialog.C +++ b/src/frontends/qt2/QDocumentDialog.C @@ -273,7 +273,7 @@ void QDocumentDialog::setMargins(int papersize) marginsModule->marginCO->insertItem(qt_("Default")); marginsModule->marginCO->insertItem(qt_("Custom")); bool a4size = (papersize == 6 || papersize == 0 - && lyxrc.default_papersize == PAPER_A4PAPER); + && lyxrc.default_papersize == PAPER_A4); if (a4size && pageLayoutModule->portraitRB->isChecked()) { marginsModule->marginCO->insertItem(qt_("Small margins")); marginsModule->marginCO->insertItem(qt_("Very small margins")); diff --git a/src/frontends/qt2/QExternal.C b/src/frontends/qt2/QExternal.C index 829d76612f..ec342dab5b 100644 --- a/src/frontends/qt2/QExternal.C +++ b/src/frontends/qt2/QExternal.C @@ -60,8 +60,8 @@ LyXLength::UNIT defaultUnit() LyXLength::UNIT default_unit = LyXLength::CM; switch (lyxrc.default_papersize) { case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: default_unit = LyXLength::IN; break; default: diff --git a/src/frontends/qt2/QGraphics.C b/src/frontends/qt2/QGraphics.C index 10c182fcaf..0efb4f76b3 100644 --- a/src/frontends/qt2/QGraphics.C +++ b/src/frontends/qt2/QGraphics.C @@ -159,15 +159,15 @@ void QGraphics::update_contents() case PAPER_DEFAULT: break; case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: unitDefault = LyXLength::IN; break; - case PAPER_A3PAPER: - case PAPER_A4PAPER: - case PAPER_A5PAPER: - case PAPER_B5PAPER: + case PAPER_A3: + case PAPER_A4: + case PAPER_A5: + case PAPER_B5: unitDefault = LyXLength::CM; break; } diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 95a9293683..503fb3e49d 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,12 @@ +2005-07-16 José Matos + + * FormParagraphs.C: + * FormVSpace.C: + * FormsExternal.C: + * FormGraphics.C: + * FormDocument.C: remove setPaperStuff and use a + single papersize variable. + 2005-07-16 Lars Gullik Bjønnes * FormPreferences.h: remove a reLyX reference diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 033d12d7eb..b43d5cd7eb 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -522,7 +522,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) // Default unit choice is cm if metric, inches if US paper. // If papersize is default, check the lyxrc-settings int const paperchoice = fl_get_choice(paper_->choice_papersize); - bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER) + bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE) || paperchoice == 2 || paperchoice > 5; string const default_unit = metric ? "cm" : "in"; if (getString(class_->input_skip).empty()) @@ -592,7 +592,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) // Default unit choice is cm if metric, inches if US paper. // If papersize is default, use the lyxrc-settings - bool const metric = (defsize && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER) + bool const metric = (defsize && lyxrc.default_papersize > PAPER_USEXECUTIVE) || paperchoice == 2 || paperchoice > 5; string const default_unit = metric ? "cm" : "in"; if (getString(paper_->input_custom_width).empty()) @@ -674,7 +674,7 @@ ButtonPolicy::SMInput FormDocument::input(FL_OBJECT * ob, long) // either default papersize (preferences) or document // papersize has to be A4 bool const enable = ( fl_get_choice(paper_->choice_papersize) == 1 - && lyxrc.default_papersize == PAPER_A4PAPER ) + && lyxrc.default_papersize == PAPER_A4) || fl_get_choice(paper_->choice_papersize) == 7; if (!enable) fl_set_choice(paper_->choice_paperpackage, @@ -917,14 +917,11 @@ bool FormDocument::class_apply(BufferParams ¶ms) void FormDocument::paper_apply(BufferParams & params) { - params.papersize2 = VMARGIN_PAPER_TYPE(fl_get_choice(paper_->choice_papersize) - 1); + params.papersize = PAPER_SIZE(fl_get_choice(paper_->choice_papersize) - 1); params.paperpackage = PAPER_PACKAGES(fl_get_choice(paper_->choice_paperpackage) - 1); - // set params.papersize from params.papersize2 and params.paperpackage - params.setPaperStuff(); - params.use_geometry = fl_get_button(paper_->check_use_geometry); if (fl_get_button(paper_->radio_landscape)) @@ -1128,7 +1125,7 @@ void FormDocument::class_update(BufferParams const & params) bool const length_input = pos == 4; if (length_input) { int const paperchoice = fl_get_choice(paper_->choice_papersize); - bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER) + bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE) || paperchoice == 2 || paperchoice > 5; string const default_unit = metric ? "cm" : "in"; string const length = params.getDefSkip().asLyXCommand(); @@ -1233,7 +1230,7 @@ void FormDocument::paper_update(BufferParams const & params) if (!paper_.get()) return; - fl_set_choice(paper_->choice_papersize, params.papersize2 + 1); + fl_set_choice(paper_->choice_papersize, params.papersize + 1); fl_set_choice(paper_->choice_paperpackage, params.paperpackage + 1); fl_set_button(paper_->check_use_geometry, params.use_geometry); @@ -1254,11 +1251,11 @@ void FormDocument::paper_update(BufferParams const & params) //either default papersize (preferences) //or document papersize has to be A4 (paperchoice == 7 - || paperchoice == 1 && lyxrc.default_papersize == PAPER_A4PAPER) + || paperchoice == 1 && lyxrc.default_papersize == PAPER_A4) && fl_get_button(paper_->radio_portrait)); // Default unit choice is cm if metric, inches if US paper. - bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_EXECUTIVEPAPER) + bool const metric = (paperchoice == 1 && lyxrc.default_papersize > PAPER_USEXECUTIVE) || paperchoice == 2 || paperchoice > 5; string const default_unit = metric ? "cm" : "in"; updateWidgetsFromLengthString(paper_->input_custom_width, diff --git a/src/frontends/xforms/FormExternal.C b/src/frontends/xforms/FormExternal.C index 5d15458775..5331fac729 100644 --- a/src/frontends/xforms/FormExternal.C +++ b/src/frontends/xforms/FormExternal.C @@ -59,8 +59,8 @@ LyXLength::UNIT defaultUnit() LyXLength::UNIT default_unit = LyXLength::CM; switch (lyxrc.default_papersize) { case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: default_unit = LyXLength::IN; break; default: diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index a72e52d05c..225aeadaa8 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -288,12 +288,12 @@ void FormGraphics::build() switch (lyxrc.default_papersize) { case PAPER_DEFAULT: break; case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: defaultUnit = "in"; break; - case PAPER_A3PAPER: - case PAPER_A4PAPER: - case PAPER_A5PAPER: - case PAPER_B5PAPER: defaultUnit = "cm"; break; + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: defaultUnit = "in"; break; + case PAPER_A3: + case PAPER_A4: + case PAPER_A5: + case PAPER_B5: defaultUnit = "cm"; break; } } diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index c60199b87c..6b5c8f0ea7 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -111,14 +111,14 @@ void FormParagraph::build() switch (lyxrc.default_papersize) { case PAPER_DEFAULT: case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: defaultUnit = "in"; break; - case PAPER_A3PAPER: - case PAPER_A4PAPER: - case PAPER_A5PAPER: - case PAPER_B5PAPER: + case PAPER_A3: + case PAPER_A4: + case PAPER_A5: + case PAPER_B5: defaultUnit = "cm"; break; } diff --git a/src/frontends/xforms/FormVSpace.C b/src/frontends/xforms/FormVSpace.C index c86fd59452..86bb263251 100644 --- a/src/frontends/xforms/FormVSpace.C +++ b/src/frontends/xforms/FormVSpace.C @@ -216,14 +216,14 @@ void FormVSpace::build() switch (lyxrc.default_papersize) { case PAPER_DEFAULT: case PAPER_USLETTER: - case PAPER_LEGALPAPER: - case PAPER_EXECUTIVEPAPER: + case PAPER_USLEGAL: + case PAPER_USEXECUTIVE: defaultUnit = "in"; break; - case PAPER_A3PAPER: - case PAPER_A4PAPER: - case PAPER_A5PAPER: - case PAPER_B5PAPER: + case PAPER_A3: + case PAPER_A4: + case PAPER_A5: + case PAPER_B5: defaultUnit = "cm"; break; } diff --git a/src/lyxrc.C b/src/lyxrc.C index 7f1561fac1..38ea5f23a4 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -570,22 +570,22 @@ int LyXRC::read(LyXLex & lexrc) PAPER_USLETTER; else if (size == "legal") default_papersize = - PAPER_LEGALPAPER; + PAPER_USLEGAL; else if (size == "executive") default_papersize = - PAPER_EXECUTIVEPAPER; + PAPER_USEXECUTIVE; else if (size == "a3") default_papersize = - PAPER_A3PAPER; + PAPER_A3; else if (size == "a4") default_papersize = - PAPER_A4PAPER; + PAPER_A4; else if (size == "a5") default_papersize = - PAPER_A5PAPER; + PAPER_A5; else if (size == "b5") default_papersize = - PAPER_B5PAPER; + PAPER_B5; } break; @@ -1299,17 +1299,17 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const switch (default_papersize) { case PAPER_USLETTER: os << "usletter"; break; - case PAPER_LEGALPAPER: + case PAPER_USLEGAL: os << "legal"; break; - case PAPER_EXECUTIVEPAPER: + case PAPER_USEXECUTIVE: os << "executive"; break; - case PAPER_A3PAPER: + case PAPER_A3: os << "a3"; break; - case PAPER_A4PAPER: + case PAPER_A4: os << "a4"; break; - case PAPER_A5PAPER: + case PAPER_A5: os << "a5"; break; - case PAPER_B5PAPER: + case PAPER_B5: os << "b5"; break; case PAPER_DEFAULT: break; } diff --git a/src/paper.h b/src/paper.h index 03a771d160..85b35e3195 100644 --- a/src/paper.h +++ b/src/paper.h @@ -15,26 +15,6 @@ #ifndef PAPER_H #define PAPER_H -/// -enum PAPER_SIZE { - /// - PAPER_DEFAULT, - /// - PAPER_USLETTER, - /// - PAPER_LEGALPAPER, - /// - PAPER_EXECUTIVEPAPER, - /// - PAPER_A3PAPER, - /// - PAPER_A4PAPER, - /// - PAPER_A5PAPER, - /// - PAPER_B5PAPER -}; - /// enum PAPER_PACKAGES { /// @@ -48,29 +28,29 @@ enum PAPER_PACKAGES { }; /// -enum VMARGIN_PAPER_TYPE { +enum PAPER_SIZE { /// - VM_PAPER_DEFAULT, + PAPER_DEFAULT, /// - VM_PAPER_CUSTOM, + PAPER_CUSTOM, /// - VM_PAPER_USLETTER, + PAPER_USLETTER, /// - VM_PAPER_USLEGAL, + PAPER_USLEGAL, /// - VM_PAPER_USEXECUTIVE, + PAPER_USEXECUTIVE, /// - VM_PAPER_A3, + PAPER_A3, /// - VM_PAPER_A4, + PAPER_A4, /// - VM_PAPER_A5, + PAPER_A5, /// - VM_PAPER_B3, + PAPER_B3, /// - VM_PAPER_B4, + PAPER_B4, /// - VM_PAPER_B5 + PAPER_B5 }; ///