mathed compilation fix

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2971 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-11-07 10:25:05 +00:00
parent 0f23028f4b
commit f73a9f37f4
9 changed files with 143 additions and 86 deletions

View 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:

View 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)
{

View 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

View 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);

View File

@ -110,6 +110,9 @@ public:
///
void writeFile(std::ostream &) const;
///
void setPaperStuff();
///
void useClassDefaults();

View 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);
}

View 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();
///

View 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>

View 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"