From: Jean-Marc Lasgouttes Date: Wed, 7 Nov 2001 10:25:05 +0000 (+0000) Subject: mathed compilation fix X-Git-Tag: 1.6.10~20394 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f73a9f37f4a7ce429f345546eb21f1a5adb96f29;p=features.git mathed compilation fix git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2971 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index b8ea763ca7..3a26ccc8bf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-11-06 Jean-Marc Lasgouttes + + * buffer.C (setPaperStuff): removed from here... + + * bufferparams.C (setPaperStuff): ... and moved there. + 2001-11-03 John Levon * minibuffer.h: diff --git a/src/buffer.C b/src/buffer.C index 114cb02e32..49f15e40f1 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1553,7 +1553,7 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par) } } bool the_end = readLyXformat2(lex, par); - setPaperStuff(); + params.setPaperStuff(); // the_end was added in 213 if (file_format < 213) the_end = true; @@ -3475,33 +3475,6 @@ void Buffer::validate(LaTeXFeatures & features) const } -void Buffer::setPaperStuff() -{ - params.papersize = BufferParams::PAPER_DEFAULT; - char const c1 = params.paperpackage; - if (c1 == BufferParams::PACKAGE_NONE) { - char const c2 = params.papersize2; - if (c2 == BufferParams::VM_PAPER_USLETTER) - params.papersize = BufferParams::PAPER_USLETTER; - else if (c2 == BufferParams::VM_PAPER_USLEGAL) - params.papersize = BufferParams::PAPER_LEGALPAPER; - else if (c2 == BufferParams::VM_PAPER_USEXECUTIVE) - params.papersize = BufferParams::PAPER_EXECUTIVEPAPER; - else if (c2 == BufferParams::VM_PAPER_A3) - params.papersize = BufferParams::PAPER_A3PAPER; - else if (c2 == BufferParams::VM_PAPER_A4) - params.papersize = BufferParams::PAPER_A4PAPER; - else if (c2 == BufferParams::VM_PAPER_A5) - params.papersize = BufferParams::PAPER_A5PAPER; - else if ((c2 == BufferParams::VM_PAPER_B3) || (c2 == BufferParams::VM_PAPER_B4) || - (c2 == BufferParams::VM_PAPER_B5)) - params.papersize = BufferParams::PAPER_B5PAPER; - } else if ((c1 == BufferParams::PACKAGE_A4) || (c1 == BufferParams::PACKAGE_A4WIDE) || - (c1 == BufferParams::PACKAGE_WIDEMARGINSA4)) - params.papersize = BufferParams::PAPER_A4PAPER; -} - - // This function should be in Buffer because it's a buffer's property (ale) string const Buffer::getIncludeonlyList(char delim) { diff --git a/src/buffer.h b/src/buffer.h index a5acfada54..59beaa1ac8 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -248,9 +248,6 @@ public: /// returns \c true if the buffer contains a Wed document bool isLiterate() const; - /// - void setPaperStuff(); - /** Validate a buffer for LaTeX. This validates the buffer, and returns a struct for use by #makeLaTeX# and others. Its main use is to figure out what diff --git a/src/bufferparams.C b/src/bufferparams.C index 958800c69e..9143c03fc3 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -177,6 +177,33 @@ void BufferParams::writeFile(ostream & os) const } +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(textclass); diff --git a/src/bufferparams.h b/src/bufferparams.h index 1d0adc1fd6..aeed3a1572 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -110,6 +110,9 @@ public: /// void writeFile(std::ostream &) const; + /// + void setPaperStuff(); + /// void useClassDefaults(); diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 8972938287..04a516bb11 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -610,10 +610,9 @@ void FormDocument::ComboInputCB(int, void * v, Combox * combox) } -bool FormDocument::class_apply() +bool FormDocument::class_apply(BufferParams ¶ms) { bool redo = false; - BufferParams ¶ms = lv_->buffer()->params; // If default skip is a "Length" but there's no text in the // input field, reset the kind to "Medskip", which is the default. @@ -625,38 +624,8 @@ bool FormDocument::class_apply() params.fontsize = fl_get_choice_text(class_->choice_doc_fontsize); params.pagestyle = fl_get_choice_text(class_->choice_doc_pagestyle); - unsigned int const new_class = combo_doc_class->get() - 1; + params.textclass = combo_doc_class->get() - 1; - if (params.textclass != new_class) { - // try to load new_class - if (textclasslist.Load(new_class)) { - // successfully loaded - redo = true; - setMinibuffer(lv_, _("Converting document to new document class...")); - int ret = CutAndPaste::SwitchLayoutsBetweenClasses( - params.textclass, new_class, - lv_->buffer()->paragraph); - if (ret) { - string s; - if (ret==1) { - s = _("One paragraph couldn't be converted"); - } else { - s += tostr(ret); - s += _(" paragraphs couldn't be converted"); - } - WriteAlert(_("Conversion Errors!"),s, - _("into chosen document class")); - } - - params.textclass = new_class; - } else { - // problem changing class -- warn user and retain old style - WriteAlert(_("Conversion Errors!"), - _("Errors loading new document class."), - _("Reverting to original document class.")); - combo_doc_class->select(int(params.textclass) + 1); - } - } BufferParams::PARSEP tmpsep = params.paragraph_separation; if (fl_get_button(class_->radio_doc_indent)) params.paragraph_separation = BufferParams::PARSEP_INDENT; @@ -731,17 +700,57 @@ bool FormDocument::class_apply() } -void FormDocument::paper_apply() +bool FormDocument::class_apply() { - BufferParams & params = lv_->buffer()->params; + BufferParams ¶ms = lv_->buffer()->params; + + unsigned int const old_class = params.textclass; + + bool redo = class_apply(params); + if (params.textclass != old_class) { + // try to load new_class + if (textclasslist.Load(params.textclass)) { + // successfully loaded + redo = true; + setMinibuffer(lv_, _("Converting document to new document class...")); + int ret = CutAndPaste::SwitchLayoutsBetweenClasses( + old_class, params.textclass, + lv_->buffer()->paragraph); + if (ret) { + string s; + if (ret==1) { + s = _("One paragraph couldn't be converted"); + } else { + s += tostr(ret); + s += _(" paragraphs couldn't be converted"); + } + WriteAlert(_("Conversion Errors!"),s, + _("into chosen document class")); + } + + } else { + // problem changing class -- warn user and retain old style + WriteAlert(_("Conversion Errors!"), + _("Errors loading new document class."), + _("Reverting to original document class.")); + combo_doc_class->select(int(old_class) + 1); + } + } + + return redo; +} + + +void FormDocument::paper_apply(BufferParams & params) +{ params.papersize2 = char(fl_get_choice(paper_->choice_papersize)-1); params.paperpackage = char(fl_get_choice(paper_->choice_paperpackage)-1); // set params.papersize from params.papersize2 and params.paperpackage - lv_->buffer()->setPaperStuff(); + params.setPaperStuff(); params.use_geometry = fl_get_button(paper_->check_use_geometry); @@ -788,9 +797,14 @@ void FormDocument::paper_apply() } -bool FormDocument::language_apply() +void FormDocument::paper_apply() +{ + paper_apply(lv_->buffer()->params); +} + + +bool FormDocument::language_apply(BufferParams & params) { - BufferParams & params = lv_->buffer()->params; InsetQuotes::quote_language lga = InsetQuotes::EnglishQ; bool redo = false; @@ -820,19 +834,11 @@ bool FormDocument::language_apply() else params.quotes_times = InsetQuotes::DoubleQ; - Language const * old_language = params.language; Language const * new_language = languages.getLanguage(combo_language->getline()); if (!new_language) new_language = default_language; - if (old_language != new_language - && old_language->RightToLeft() == new_language->RightToLeft() - && !lv_->buffer()->isMultiLingual()) - lv_->buffer()->changeLanguage(old_language, new_language); - if (old_language != new_language) { - redo = true; - } params.language = new_language; params.inputenc = fl_get_choice_text(language_->choice_inputenc); @@ -840,9 +846,27 @@ bool FormDocument::language_apply() } -bool FormDocument::options_apply() +bool FormDocument::language_apply() { BufferParams & params = lv_->buffer()->params; + Language const * old_language = params.language; + + bool redo = language_apply(params); + + if (old_language != params.language + && old_language->RightToLeft() == params.language->RightToLeft() + && !lv_->buffer()->isMultiLingual()) + lv_->buffer()->changeLanguage(old_language, params.language); + if (old_language != params.language) { + redo = true; + } + + return redo; +} + + +bool FormDocument::options_apply(BufferParams & params) +{ bool redo = false; params.graphicsDriver = @@ -866,16 +890,28 @@ bool FormDocument::options_apply() } -void FormDocument::bullets_apply() +bool FormDocument::options_apply() +{ + return options_apply(lv_->buffer()->params); +} + + +void FormDocument::bullets_apply(BufferParams & params) { /* update the bullet settings */ - BufferParams & param = lv_->buffer()->params; + BufferParams & params_doc = lv_->buffer()->params; // a little bit of loop unrolling - param.user_defined_bullets[0] = param.temp_bullets[0]; - param.user_defined_bullets[1] = param.temp_bullets[1]; - param.user_defined_bullets[2] = param.temp_bullets[2]; - param.user_defined_bullets[3] = param.temp_bullets[3]; + params.user_defined_bullets[0] = params_doc.temp_bullets[0]; + params.user_defined_bullets[1] = params_doc.temp_bullets[1]; + params.user_defined_bullets[2] = params_doc.temp_bullets[2]; + params.user_defined_bullets[3] = params_doc.temp_bullets[3]; +} + + +void FormDocument::bullets_apply() +{ + bullets_apply(lv_->buffer()->params); } diff --git a/src/frontends/xforms/FormDocument.h b/src/frontends/xforms/FormDocument.h index 51c15d5844..a27d9f659c 100644 --- a/src/frontends/xforms/FormDocument.h +++ b/src/frontends/xforms/FormDocument.h @@ -124,6 +124,17 @@ private: /// void bullets_update(BufferParams const &); + /// + void paper_apply(BufferParams &); + /// + bool class_apply(BufferParams &); + /// + bool language_apply(BufferParams &); + /// + bool options_apply(BufferParams &); + /// + void bullets_apply(BufferParams &); + /// void paper_apply(); /// diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index c19f1761db..ffc322269b 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,8 +1,11 @@ +2001-11-07 Jean-Marc Lasgouttes + + * math_inset.C: compilation fix 2001-11-07 André Pönitz * math_*inset.[Ch]: - array.[Ch]: start native C++ support for Octave, Maple and MathML + * array.[Ch]: start native C++ support for Octave, Maple and MathML 2001-10-31 Angus Leeming diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index a1245c4054..d0b2655b55 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -19,8 +19,9 @@ #pragma implementation #endif -#include +#include +#include "Lsstream.h" #include "math_inset.h" #include "math_scriptinset.h" #include "debug.h"