]> git.lyx.org Git - features.git/commitdiff
mathed compilation fix
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 7 Nov 2001 10:25:05 +0000 (10:25 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 7 Nov 2001 10:25:05 +0000 (10:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2971 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/buffer.C
src/buffer.h
src/bufferparams.C
src/bufferparams.h
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormDocument.h
src/mathed/ChangeLog
src/mathed/math_inset.C

index b8ea763ca7ef3f8d6f5a7198450ca13ba21a1099..3a26ccc8bf1d6a98c02472b01927c84471e1825c 100644 (file)
@@ -1,3 +1,9 @@
+2001-11-06  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * buffer.C (setPaperStuff): removed from here...
+
+       * bufferparams.C (setPaperStuff): ... and moved there.  
+
 2001-11-03  John Levon  <moz@compsoc.man.ac.uk>
 
        * minibuffer.h:
index 114cb02e3212a7a9efec0fa1e8b8b6a24e191d49..49f15e40f195b8f712b4956dfc3859fba0791f65 100644 (file)
@@ -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)
 {
index a5acfada54c0306518aed693dfd3d2aea39a0ea7..59beaa1ac8344a2b8632f4deb76a5b9833d6bcb2 100644 (file)
@@ -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
index 958800c69ec873d923ddb8a339e1603339fff646..9143c03fc3a20a9545f6ad96ef7c8659f4e6f08c 100644 (file)
@@ -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);
index 1d0adc1fd6b6580f6412c58ad6e07f0b6adfcec0..aeed3a1572df767b4e0c6a568f280455be63a493 100644 (file)
@@ -110,6 +110,9 @@ public:
        ///
        void writeFile(std::ostream &) const;
 
+       ///
+       void setPaperStuff();
+
        ///
        void useClassDefaults();
 
index 897293828797ae82630d35931e14b42d201f80db..04a516bb1121eb84329874faa5e05ee9b6220d8e 100644 (file)
@@ -610,10 +610,9 @@ void FormDocument::ComboInputCB(int, void * v, Combox * combox)
 }
 
 
-bool FormDocument::class_apply()
+bool FormDocument::class_apply(BufferParams &params)
 {
        bool redo = false;
-       BufferParams &params = 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 &params = 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);
 }
 
 
index 51c15d5844a186329476d4291d307be6d9dd1e76..a27d9f659cff84cfc232fedb190738fa7813c285 100644 (file)
@@ -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();
        ///
index c19f1761db6a919b06c880ac241f643938a035f1..ffc322269bf8be51de41248ae25368fb012b4ddf 100644 (file)
@@ -1,8 +1,11 @@
+2001-11-07  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * math_inset.C: compilation fix
 
 2001-11-07  André Pönitz  <poenitz@gmx.net>
 
        * 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  <a.leeming@ic.ac.uk>
 
index a1245c40547737fb19171f38c642341cbd5d38a5..d0b2655b55bfa7594c3efd6613a7504d5d02838e 100644 (file)
@@ -19,8 +19,9 @@
 #pragma implementation
 #endif
 
-#include <sstream>
+#include <config.h>
 
+#include "Lsstream.h"
 #include "math_inset.h"
 #include "math_scriptinset.h"
 #include "debug.h"