diff --git a/ANNOUNCE b/ANNOUNCE index 6bd5d793eb..bcd4d48a8b 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Public release of LyX version 1.1.2 +Public release of LyX version 1.1.5cvs =================================== What is LyX? @@ -37,7 +37,7 @@ A very incomplete feature list: - export LaTeX, ASCII, DVI, PostScript, LinuxDoc-SGML, DocBook-SGML - fair support for non-English documents and/or menus - extensive documentation, including a tutorial -- version control using RCS +- version control using RCS (some support for CVS) How stable is LyX? ------------------ @@ -66,28 +66,20 @@ with mirrors at The source code package is available at: - ftp://ftp.lyx.org/pub/lyx/stable/lyx-1.0.4.tar.gz - ftp://ftp.devel.lyx.org/pub/lyx/lyx-1.0.4.tar.gz + ftp://ftp.lyx.org/pub/lyx/stable/lyx-1.1.5.tar.gz + ftp://ftp.devel.lyx.org/pub/lyx/lyx-1.1.5.tar.gz and at the mirrors listed above. -You need to have XForms version 0.81, 0.86 or 0.88 to compile your own +You need to have XForms version 0.88 or newer to compile your own version. Version 0.88 is highly recomended. LyX should also compile with 0.89. -Ready-to-run precompiled binaries for various platforms are available at: - - ftp://ftp.lyx.org/pub/lyx/bin/1.0.4/ - -Binaries for i386-Linux are also available at your local sunsite mirror: - - ftp://sunsite.unc.edu/pub/Linux/apps/editors/lyx-1.0.4-bin.tar.gz - Credits ------- The LyX Team is composed of volunteers from around the world. Many, many -people have helped make the 1.0 release possible, including: +people have helped make the 1.1.x releasees possible, including: Lars Gullik Bjoennes, Alejandro Aguilar Sierra, Asger Alstrup, Jean-Marc Lasgouttes, Juergen Vigna, John P. Weiss, Bernhard Iselborn, diff --git a/ChangeLog b/ChangeLog index d5c3875f17..fcd9f67291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2000-04-19 Lars Gullik Bjønnes + + * ANNOUNCE: + * INSTALL: + * UPGRADING: + * NEWS: updated for prerelease of 1.1.5. Please comment and send + patches for things that should be in or should be changed. + + * src/* [insetfiles]: change "usigned char fragile" to bool + fragile. There was only one point that could that be questioned + and that is commented in formulamacro.C. Grep for "CHECK". + + * src/CutAndPaste.C (getBufferTextClass): unused func, removed. + (DeleteBuffer): take it out of CutAndPaste and make it static. + +2000-04-17 Lars Gullik Bjønnes + + * src/paragraph.C (TeXOnePar): use the new method in Spacing to + output the spacing envir commands. Also the new commands used in + the LaTeX output makes the result better. + + * src/Spacing.C (writeEnvirBegin): new method + (writeEnvirEnd): new method + 2000-04-18 Juergen Vigna * src/CutAndPaste.C: made textclass a static member of the class @@ -29,6 +53,23 @@ \end{array} if fragile (MathParInset::Write): Put \protect before \\ if fragile +2000-04-15 Lars Gullik Bjønnes + + * src/lyx_gui.C (LyXGUI): initialize the LyXColorHandler. The + initialization if the LyXColorHandler must be done after the + connections to the XServer has been established. + + * src/insets/figinset.C (runqueue): change the grabing a bit. Also + get the background pixel from the lyxColorhandler so that the + figures are rendered with the correct background color. + (NextToken): removed functions. + (GetPSSizes): use ifs >> string instead of NextToken. + + * src/Painter.[Ch]: the color cache moved out of this file. + + * src/ColorHandler.[Ch]: new files. Holds the gc cache for color + and lines. + 2000-04-14 Lars Gullik Bjønnes * src/WorkArea.C (work_area_handler): call BufferView::enterView diff --git a/INSTALL b/INSTALL index 263e2b20cc..515c9fcc54 100644 --- a/INSTALL +++ b/INSTALL @@ -34,8 +34,8 @@ You will need to have both an Xforms library and Xpm library to compile LyX. It is imperative that you have the correct versions of these libraries, and their associated header files. -As of LyX version 1.1.1, you will need to have Xforms library and header -version 0.81, 0.86, or 0.88. Version 0.88 is a stable release and the +As of LyX version 1.1.5, you will need to have Xforms library and header +version 0.88 or 0.89. Version 0.88 is a stable release and the recommended version. On some systems, such as linux ELF, there are shared library versions of the Xforms library, which require an installation step to configure the system. @@ -58,11 +58,11 @@ libXpm can be found at: (or similar locations at other sunsites like sunsite.unc.edu) You will also need a recent C++ compiler, where recent means that the -compilers knows a bit about the C++ standard. Compilers that are known +compilers are close to C++ standard conforming. Compilers that are known to compile LyX are gcc 2.8.1 and 2.95.x, the various versions of egcs and Digital C++ version 6.1. Please tell us your experience with other -compilers. It is probably _not_ possible to compile LyX with gcc -2.7.x, but this may change in the future. +compilers. It is _not_ possible to compile LyX with gcc +2.7.x, and this is not likely to change in the future. Note that, contrary to LyX 1.0.x, LyX 1.1.x makes great use of C++ Standard Template Library (STL); this means that gcc users will have diff --git a/NEWS b/NEWS index 110454b375..47fd131905 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,42 @@ +What's new in LyX version 1.1.5? +-------------------------------- + +Lots of internal code rewritten, fixed, changed and added. +We are taking the C++ Standard Library in greater use for each day, +this will in most cases make the code clearer and easier to maintain +and expand. +We are also gearing up for the merge of the gui-indep branch, expect +this (but not the new gui's) in 1.1.6. + +User-visible changes: + +- Right-to-Left support for Hebrew and Arabic, this is a first attempt + only and is likely to improve in future versions. + +- Removed support for XForms older than 0.88. + +- Some commandline options and X resources are not supported anymore + (The color ones, and -mono -fastselection, -reverse) + +- More accurate error reporting from LaTeX runs. + +- Better definition for LyXList style. + +- option \show_banner [true|false] added to .lyxrc commands. + +- A couple of changes to the LyX format, so that files written with + 1.1.5 will not be parsed correctly by older LyX versions if protected + spaces or the new per-paragraph spacing are used. Also the RtL + support is of course not supported in older versions. + +- Per-paragraph spacing, currently only settable wrom the + command-line/window: + paragraph-spacing (default,single,onehalf,double,other) [float] + +- .lyxrc feature: \backupdir_path that tells where the backup files + created by lyx will be stored. + + What's new in LyX version 1.1.4? -------------------------------- diff --git a/UPGRADING b/UPGRADING index 4ef1e0ee70..033d975939 100644 --- a/UPGRADING +++ b/UPGRADING @@ -1,4 +1,4 @@ -How do I upgrade my existing LyX system to version 1.1.2? +How do I upgrade my existing LyX system to version 1.1.5? --------------------------------------------------------- If you upgrade from version 0.12.0 or 1.0.x, you shouldn't have @@ -14,9 +14,9 @@ Document transfer ----------------- In general, you don't need to convert any documents saved with LyX -v0.10, v0.12.0 or v1.0.x to use them with LyX v1.1.2. +v0.10, v0.12.0 or v1.0.x to use them with LyX v1.1.5. -LyX v1.1.2 can read all documents saved with lyx-0.12.0 and later correctly. +LyX v1.1.5 can read all documents saved with lyx-0.12.0 and later correctly. Documents saved with lyx-0.10.x are read correctly up to the old math mode, which is not supported anymore. If you have documents with such math formulas, you convert it using the program COLD, written by Preben @@ -27,5 +27,5 @@ Rhandol. COLD can be found at: or at one of LyX archive mirror sites listed in README. -Documents saved with LyX version 1.1.2 can be read correctly by -LyX v0.12.0 and v1.0.x, except for new features. +Documents saved with LyX version 1.1.5 can be read correctly by +LyX v0.12.0 and v1.0.x, except for new and a couple of changed features. diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 8a8d5dad58..fd308dfb43 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -20,12 +20,26 @@ using std::pair; +// Jürgen, note that this means that you cannot currently have a list +// of selections cut/copied. So IMHO later we should have a +// list/vector/deque that we could store +// struct selection_item { +// LyXParagraph * buf; +// LyXTextClassList::size_type textclass; +// }; +// in and some method of choosing beween them (based on the first few chars +// in the selection probably.) This would be a nice feature and quite +// easy to implement. (Lgb) + static LyXParagraph * buf = 0; static LyXTextClassList::size_type textclass; // for now here this should be in another Cut&Paste Class! -// -void CutAndPaste::DeleteBuffer() +// Jürgen, I moved this out of CutAndPaste since it does not operate on any +// member of the CutAndPaste class and in addition it was private. +// Perhaps it even should take a parameter? (Lgb) +static +void DeleteBuffer() { if (!buf) return; @@ -332,7 +346,7 @@ int CutAndPaste::nrOfParagraphs() const if (!buf) return 0; int n = 1; - LyXParagraph *tmppar = buf; + LyXParagraph * tmppar = buf; while(tmppar->next) { ++n; tmppar = tmppar->next; @@ -381,12 +395,6 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1, } -LyXTextClassList::size_type CutAndPaste::getBufferTextClass() const -{ - return textclass; -} - - bool CutAndPaste::checkPastePossible(LyXParagraph * par, int) const { if (!buf) return false; diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index edc4ae0a36..7e73e5bb67 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -41,12 +41,7 @@ public: LyXTextClassList::size_type class2, LyXParagraph * par); /// - LyXTextClassList::size_type getBufferTextClass() const; - /// bool checkPastePossible(LyXParagraph *, int pos) const; -private: - /// - void DeleteBuffer(); }; #endif diff --git a/src/Spacing.C b/src/Spacing.C index 19f9d1fa65..746ee33f43 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -4,6 +4,7 @@ #ifdef HAVE_SSTREAM #include using std::istringstream; +using std::ostringstream; #else #include #endif @@ -74,3 +75,58 @@ void Spacing::writeFile(ostream & os, bool para) const os << cmd << spacing_string[getSpace()] << " \n"; } } + + +string Spacing::writeEnvirBegin() const +{ + switch(space) { + case Default: break; // do nothing + case Single: + return "\\begin{singlespace}"; + break; + case Onehalf: + return "\\begin{onehalfspace}"; + break; + case Double: + return "\\begin{doublespace}"; + break; + case Other: +#ifdef HAVE_SSTREAM + ostringstream ost; + ost << "\\begin{spacing}{" + << getValue() << "}"; + return ost.str().c_str(); +#else + { + char tmp[512]; + ostrstream ost(tmp, 512); + ost << "\\begin{spacing}{" + << getValue() << "}"; + return ost.str(); + } +#endif + break; + } + return string(); +} + + +string Spacing::writeEnvirEnd() const +{ + switch(space) { + case Default: break; // do nothing + case Single: + return "\\end{singlespace}"; + break; + case Onehalf: + return "\\end{onehalfspace}"; + break; + case Double: + return "\\end{doublespace}"; + break; + case Other: + return "\\end{spacing}"; + break; + } + return string(); +} diff --git a/src/Spacing.h b/src/Spacing.h index 094d7d3d1c..f3e27123f4 100644 --- a/src/Spacing.h +++ b/src/Spacing.h @@ -14,6 +14,8 @@ #include +#include "LString.h" + /// class Spacing { public: @@ -47,6 +49,10 @@ public: /// void writeFile(std::ostream &, bool para = false) const; /// + string writeEnvirBegin() const; + /// + string writeEnvirEnd() const; + /// friend bool operator==(Spacing const & a, Spacing const & b) { if (a.space == b.space && a.getValue() == b.getValue()) return true; diff --git a/src/buffer.C b/src/buffer.C index cd970d7ba5..683b58d361 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1428,11 +1428,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen) #if 1 #ifdef HAVE_SSTREAM std::ostringstream ost; - inset->Latex(ost, -1, free_spc); + inset->Latex(ost, true, free_spc); h += ost.str().length(); #else ostrstream ost; - inset->Latex(ost, -1, free_spc); + inset->Latex(ost, true, free_spc); ost << '\0'; char * tmp = ost.str(); string tstr(tmp); @@ -1445,7 +1445,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) WriteFSAlert(_("Error: Cannot open temporary file:"), fname1); return; } - inset->Latex(fs, -1, free_spc); + inset->Latex(fs, true, free_spc); h += fs.tellp() - 1; ::remove(fname1.c_str()); #endif @@ -1530,7 +1530,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) case LyXParagraph::META_INSET: if ((inset = par->GetInset(i))) { fpos = ofs.tellp(); - inset->Latex(ofs, -1, free_spc); + inset->Latex(ofs, true, free_spc); currlinelen += (ofs.tellp() - fpos); actpos += (ofs.tellp() - fpos) - 1; } @@ -3538,7 +3538,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par) #if 1 #ifdef HAVE_SSTREAM stringstresm ss(ios::in | ios::out); - inset->Latex(ss, -1); + inset->Latex(ss, true); ss.seekp(0); ss.get(c); while (!ss) { @@ -3550,7 +3550,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par) } #else strstream ss; - inset->Latex(ss, -1); + inset->Latex(ss, true); ss.seekp(0); ss.get(c); while (!ss) { @@ -3571,7 +3571,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par) remove(fname1.c_str()); return; } - inset->Latex(fs, -1); + inset->Latex(fs, true); fs.seekp(0); fs.get(c); while(!fs) { diff --git a/src/insets/figinset.C b/src/insets/figinset.C index e0f115debc..9b9d28f0dd 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -1142,7 +1142,7 @@ void InsetFig::Read(LyXLex & lex) int InsetFig::Latex(ostream & os, - signed char /* fragile*/, bool /* fs*/) const + bool /* fragile*/, bool /* fs*/) const { Regenerate(); if (!cmd.empty()) os << cmd << " "; diff --git a/src/insets/figinset.h b/src/insets/figinset.h index f8ee925ab6..ae004dc1de 100644 --- a/src/insets/figinset.h +++ b/src/insets/figinset.h @@ -37,7 +37,7 @@ public: /// void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_space) const; + int Latex(std::ostream &, bool fragile, bool free_space) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index fcc6924715..467f0bb718 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -323,7 +323,7 @@ string InsetBibtex::getScreenLabel() const int InsetBibtex::Latex(ostream & os, - signed char /*fragile*/, bool/*fs*/) const + bool /*fragile*/, bool/*fs*/) const { // this looks like an horrible hack and it is :) The problem // is that owner is not initialized correctly when the bib diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h index 05255d03c2..a478f646f9 100644 --- a/src/insets/insetbib.h +++ b/src/insets/insetbib.h @@ -133,7 +133,7 @@ public: /// void Edit(BufferView *, int x, int y, unsigned int button); /// - int Latex(std::ostream &, signed char, bool) const; + int Latex(std::ostream &, bool fragile, bool freespace) const; /// string getKeys(char delim); /// diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 7d9e7964cb..38eaf42af1 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -197,7 +197,7 @@ void InsetCommand::Read(LyXLex & lex) } -int InsetCommand::Latex(ostream & os, signed char /*fragile*/, bool/*fs*/) const +int InsetCommand::Latex(ostream & os, bool /*fragile*/, bool/*fs*/) const { os << getCommand(); return 0; diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index 55129ea103..59ee7175f8 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -49,7 +49,7 @@ public: void Read(LyXLex & lex); /// virtual int Latex(std::ostream &, - signed char fragile, bool free_spc) const; + bool fragile, bool free_spc) const; /// virtual int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 029e7408d3..cc3acec315 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -105,7 +105,7 @@ void InsetError::Read(LyXLex &) int InsetError::Latex(ostream &, - signed char /*fragile*/, bool /*fs*/) const + bool /*fragile*/, bool /*fs*/) const { return 0; } diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index e6b4dfa380..6f248e1220 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -48,7 +48,7 @@ public: /// void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index fd775a3bad..ed2fb66624 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -52,7 +52,7 @@ char const * InsetFoot::EditMessage() const } -int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const +int InsetFoot::Latex(ostream & os, bool fragile, bool fp) const { if (fragile) os << "\\footnote{"; // was footnotemark but that won't work diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index 43faa6dd4a..a08fa5a01f 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -37,7 +37,7 @@ public: /// Inset::Code LyxCode() const { return Inset::FOOT_CODE; } /// - int Latex(std::ostream &, signed char, bool fp) const; + int Latex(std::ostream &, bool fragile, bool fp) const; /// void Write(std::ostream &) const; /// diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 4196586801..41f7bb668d 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -192,7 +192,7 @@ void InsetGraphics::Read(LyXLex & /*lex*/) int InsetGraphics::Latex(ostream & os, - signed char /*fragile*/, bool/*fs*/) const + bool /*fragile*/, bool/*fs*/) const { // MISSING: We have to decide how to do the order of the options // that is depentant of order, like witdth, height, andlge. Should diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index daf926c079..56ccddef93 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -46,10 +46,10 @@ public: /// void Read(LyXLex & lex); /** returns the number of rows (\n's) of generated tex code. - fragile != 0 means, that the inset should take care about + fragile == true means, that the inset should take care about fragile commands by adding a \protect before. */ - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 28e04889dc..1d28e3347b 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -333,7 +333,7 @@ bool InsetInclude::loadIfNeeded() const int InsetInclude::Latex(ostream & os, - signed char /*fragile*/, bool /*fs*/) const + bool /*fragile*/, bool /*fs*/) const { // Do nothing if no file name has been specified if (contents.empty()) diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index dbe65f6f7d..e713fb8f02 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -58,7 +58,7 @@ public: /// void Read(LyXLex &); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// void Validate(LaTeXFeatures &) const; diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 1047de11a2..656ffee6bf 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -133,7 +133,7 @@ void InsetInfo::Read(LyXLex & lex) int InsetInfo::Latex(ostream &, - signed char /*fragile*/, bool /*free_spc*/) const + bool /*fragile*/, bool /*free_spc*/) const { return 0; } diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index a3948b003b..aaf064f8b9 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -50,7 +50,7 @@ public: /// void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index d48f81b59d..92f871afab 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -47,7 +47,7 @@ string InsetLabel::getLabel(int) const int InsetLabel::Latex(ostream & os, - signed char /*fragile*/, bool /*fs*/) const + bool /*fragile*/, bool /*fs*/) const { os << escape(getCommand()); return 0; diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index 1b0cbb5c35..df4e2b5b09 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -40,7 +40,7 @@ public: /// EDITABLE Editable() const { return NOT_EDITABLE; } /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index 5b09d9a840..cbe3c8e605 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -620,7 +620,7 @@ void InsetLatexAccent::Read(LyXLex & lex) int InsetLatexAccent::Latex(ostream & os, - signed char /*fragile*/, bool/*fs*/) const + bool /*fragile*/, bool/*fs*/) const { os << contents; return 0; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 1c35b131f1..e648a6b85f 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -54,7 +54,7 @@ public: /// void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetparent.C b/src/insets/insetparent.C index 14efd2a5a6..7ed200b7f9 100644 --- a/src/insets/insetparent.C +++ b/src/insets/insetparent.C @@ -52,7 +52,7 @@ void InsetParent::Edit(BufferView * bv, int, int, unsigned int) // LaTeX must just ignore this command int InsetParent::Latex(ostream & os, - signed char fragile, bool free_spc) const + bool fragile, bool free_spc) const { os << "%%#{lyx}"; InsetCommand::Latex(os, fragile, free_spc); diff --git a/src/insets/insetparent.h b/src/insets/insetparent.h index 43527358ca..293ca4df38 100644 --- a/src/insets/insetparent.h +++ b/src/insets/insetparent.h @@ -33,7 +33,7 @@ public: explicit InsetParent(string const & fn, Buffer * owner = 0); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// Inset * Clone() const { return new InsetParent(getContents()); } /// diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 94e4bf94a5..ae5d82a89e 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -224,7 +224,7 @@ void InsetQuotes::Read(LyXLex & lex) } -int InsetQuotes::Latex(ostream & os, signed char /*fragile*/, bool) const +int InsetQuotes::Latex(ostream & os, bool /*fragile*/, bool) const { string doclang = current_view->buffer()->GetLanguage(); diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index a5bd91ee9e..7c89694b2a 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -86,7 +86,7 @@ public: /// void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetref.C b/src/insets/insetref.C index a45c6f7431..bb985a9ed8 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -70,7 +70,7 @@ string InsetRef::getScreenLabel() const int InsetRef::Latex(ostream & os, - signed char /*fragile*/, bool /*fs*/) const + bool /*fragile*/, bool /*fs*/) const { if(getOptions().empty()) os << escape(getCommand()); diff --git a/src/insets/insetref.h b/src/insets/insetref.h index aa0f3dda8d..a1ea4b0db1 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -61,7 +61,7 @@ public: /// void gotoLabel(); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index fa28dcc865..f8705ec512 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -177,7 +177,7 @@ void InsetSpecialChar::Read(LyXLex & lex) } -int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/, +int InsetSpecialChar::Latex(ostream & os, bool /*fragile*/, bool free_space) const { switch (kind) { diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index 400ff7ebf7..a276acd580 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -56,7 +56,7 @@ public: /// Will not be used when lyxf3 void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 4ec94b6721..606c17a99a 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -718,7 +718,7 @@ InsetText::LocalDispatch(BufferView * bv, } -int InsetText::Latex(ostream & os, signed char /*fragile*/, bool) const +int InsetText::Latex(ostream & os, bool /*fragile*/, bool) const { TexRow texrow; int ret = par->SimpleTeXOnePar(os, texrow); diff --git a/src/insets/insettext.h b/src/insets/insettext.h index a95523f834..f3e88c38da 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -78,7 +78,7 @@ public: /// UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &); /// - int Latex(std::ostream &, signed char, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const { return 0; } /// diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 8a99bce763..a8f69ee1eb 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -174,7 +174,7 @@ string InsetUrl::getScreenLabel() const int InsetUrl::Latex(ostream & os, - signed char fragile, bool /*free_spc*/) const + bool fragile, bool /*free_spc*/) const { if (!getOptions().empty()) os << getOptions() + ' '; diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index 98733457c8..b89bcb591e 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -72,7 +72,7 @@ public: /// void gotoLabel(); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index debef0e87c..738ad9be04 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -129,12 +129,12 @@ public: /// virtual void Read(LyXLex & lex) = 0; /** returns the number of rows (\n's) of generated tex code. - fragile != 0 means, that the inset should take care about + fragile == true means, that the inset should take care about fragile commands by adding a \protect before. If the free_spc (freespacing) variable is set, then this inset is in a free-spacing paragraph. */ - virtual int Latex(std::ostream &, signed char fragile, + virtual int Latex(std::ostream &, bool fragile, bool free_spc) const = 0; /// diff --git a/src/lyxfunc.C b/src/lyxfunc.C index f6c3a19ac2..9a2c0783e4 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1117,9 +1117,8 @@ string LyXFunc::Dispatch(int ac, // Pretend we got the name instead. Dispatch(int(LFUN_LAYOUT), - textclasslist.NameOfLayout(owner->view()-> - text->bparams-> - textclass, + textclasslist.NameOfLayout(owner->view() + ->buffer()->params.textclass, sel).c_str()); return string(); } @@ -1132,7 +1131,7 @@ string LyXFunc::Dispatch(int ac, // Derive layout number from given argument (string) // and current buffer's textclass (number). */ LyXTextClassList::ClassList::size_type tclass = - owner->view()->text->bparams->textclass; + owner->view()->buffer()->params.textclass; pair layout = textclasslist.NumberOfLayout(tclass, argument); diff --git a/src/lyxtext.h b/src/lyxtext.h index 01967e686e..5d6d95db98 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -58,7 +58,7 @@ public: ~LyXText(); /// points to Buffer.params - BufferParams * bparams; + //BufferParams * bparams; /// points to Buffer Buffer * buffer; /// diff --git a/src/mathed/formula.C b/src/mathed/formula.C index c60eacff16..a17b6db0e9 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -308,16 +308,16 @@ Inset * InsetFormula::Clone() const void InsetFormula::Write(ostream & os) const { os << "Formula "; - Latex(os, 0, 0); + Latex(os, false, false); } -int InsetFormula::Latex(ostream & os, signed char fragile, bool) const +int InsetFormula::Latex(ostream & os, bool fragile, bool) const { int ret = 0; //#warning Alejandro, the number of lines is not returned in this case // This problem will disapear at 0.13. - if (fragile < 0) + if (fragile) // this is where fragile != 0 was used (Lgb) par->Write(os, fragile); else mathed_write(par, os, &ret, fragile, label.c_str()); diff --git a/src/mathed/formula.h b/src/mathed/formula.h index bc74be909c..3120560209 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -52,7 +52,7 @@ public: /// void Read(LyXLex & lex); /// - int Latex(std::ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 2834d69799..6b8f706a89 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -69,14 +69,18 @@ Inset * InsetFormulaMacro::Clone() const void InsetFormulaMacro::Write(ostream & os) const { os << "FormulaMacro "; - tmacro->WriteDef(os, 0); + tmacro->WriteDef(os, false); } -int InsetFormulaMacro::Latex(ostream & os, signed char /*fragile*/, +int InsetFormulaMacro::Latex(ostream & os, bool /*fragile*/, bool /*free_spacing*/) const { - tmacro->WriteDef(os, 1); + tmacro->WriteDef(os, true); // or false? + // CHECK + // This is the only place where a '1' is used rather that '-1' or '0' + // for value of fragile. What is the reason behind it and does it make + // a difference? (Lgb) return 1; } diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h index 37c95c82fd..6daeb3d9ff 100644 --- a/src/mathed/formulamacro.h +++ b/src/mathed/formulamacro.h @@ -49,7 +49,7 @@ public: /// void Write(std::ostream & os) const; /// - int Latex(std::ostream & os, signed char fragile, bool free_spc) const; + int Latex(std::ostream & os, bool fragile, bool free_spc) const; /// int Linuxdoc(std::ostream &) const; /// diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index c19dce1bb1..c213a4c200 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -231,7 +231,7 @@ class MathedInset { virtual void draw(Painter &, int x, int baseline) = 0; /// Write LaTeX and Lyx code - virtual void Write(std::ostream &, signed char fragile) = 0; + virtual void Write(std::ostream &, bool fragile) = 0; /// Reproduces itself virtual MathedInset * Clone() = 0; @@ -329,7 +329,7 @@ class MathParInset: public MathedInset { virtual void draw(Painter &, int x, int baseline); /// Write LaTeX code - virtual void Write(std::ostream &, signed char fragile); + virtual void Write(std::ostream &, bool fragile); /// virtual void Metrics(); @@ -488,7 +488,7 @@ class MathMatrixInset: public MathParInset { /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// @@ -535,7 +535,7 @@ class MathMatrixInset: public MathParInset { LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * data, MathParInset ** mt); /// -void mathed_write(MathParInset *, std::ostream &, int *, signed char fragile, +void mathed_write(MathParInset *, std::ostream &, int *, bool fragile, char const * label = 0); /// diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 6f969acf76..2352284008 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -46,7 +46,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// @@ -75,7 +75,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// @@ -105,7 +105,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); protected: @@ -124,7 +124,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// inline void Metrics(); /// @@ -147,7 +147,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// @@ -174,7 +174,7 @@ public: /// void draw(Painter &, int x, int baseline); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// @@ -197,7 +197,7 @@ public: /// void draw(Painter &, int x, int baseline); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); @@ -243,7 +243,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); protected: @@ -264,7 +264,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// @@ -297,7 +297,7 @@ bool MathFuncInset::GetLimits() const inline -void MathFuncInset::Write(std::ostream & os, signed char /* fragile */) +void MathFuncInset::Write(std::ostream & os, bool /* fragile */) { os << "\\" << name << ' '; } diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 9042ccea51..a68705933d 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -158,7 +158,7 @@ void MathMacro::SetFocus(int x, int y) } -void MathMacro::Write(ostream & os, signed char fragile) +void MathMacro::Write(ostream & os, bool fragile) { if (tmplate->flags & MMF_Exp) { lyxerr[Debug::MATHED] << "Expand " << tmplate->flags @@ -261,7 +261,7 @@ void MathMacroArgument::Metrics() } -void MathMacroArgument::Write(ostream & os, signed char fragile) +void MathMacroArgument::Write(ostream & os, bool fragile) { if (expnd_mode) { MathParInset::Write(os, fragile); @@ -375,7 +375,7 @@ void MathMacroTemplate::update(MathMacro * macro) } -void MathMacroTemplate::WriteDef(ostream & os, signed char fragile) +void MathMacroTemplate::WriteDef(ostream & os, bool fragile) { os << "\n\\newcommand{\\" << name << "}"; diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index 2952cc79cc..b0f062f7b0 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -51,7 +51,7 @@ public: /// MathedInset * Clone(); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// bool setArgumentIdx(int); /// @@ -118,7 +118,7 @@ public: /// void draw(Painter &, int x, int baseline); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void setNumber(int n) { number = n; } /// Is expanded or not @@ -146,7 +146,7 @@ public: /// void Metrics(); /// - void WriteDef(std::ostream &, signed char fragile); + void WriteDef(std::ostream &, bool fragile); /// useful for special insets void setTCode(MathedTextCodes t) { tcode = t; } /// diff --git a/src/mathed/math_root.C b/src/mathed/math_root.C index 141167ef32..be1853c60f 100644 --- a/src/mathed/math_root.C +++ b/src/mathed/math_root.C @@ -137,7 +137,7 @@ void MathRootInset::SetFocus(int x, int) } -void MathRootInset::Write(ostream & os, signed char fragile) +void MathRootInset::Write(ostream & os, bool fragile) { os << '\\' << name << '['; uroot->Write(os, fragile); diff --git a/src/mathed/math_root.h b/src/mathed/math_root.h index 1a3fcee302..286a50494a 100644 --- a/src/mathed/math_root.h +++ b/src/mathed/math_root.h @@ -40,7 +40,7 @@ class MathRootInset: public MathSqrtInset { /// void draw(Painter &, int x, int baseline); /// - void Write(std::ostream &, signed char fragile); + void Write(std::ostream &, bool fragile); /// void Metrics(); /// diff --git a/src/mathed/math_write.C b/src/mathed/math_write.C index e0ddcb2655..a382f96968 100644 --- a/src/mathed/math_write.C +++ b/src/mathed/math_write.C @@ -45,7 +45,7 @@ char const * math_font_name[] = { void -MathSpaceInset::Write(ostream & os, signed char /* fragile */) +MathSpaceInset::Write(ostream & os, bool /* fragile */) { if (space >= 0 && space < 6) { os << '\\' << latex_mathspace[space] << ' '; @@ -54,13 +54,13 @@ MathSpaceInset::Write(ostream & os, signed char /* fragile */) void -MathDotsInset::Write(ostream & os, signed char /* fragile */) +MathDotsInset::Write(ostream & os, bool /* fragile */) { os << '\\' << name << ' '; } -void MathSqrtInset::Write(ostream & os, signed char fragile) +void MathSqrtInset::Write(ostream & os, bool fragile) { os << '\\' << name << '{'; MathParInset::Write(os, fragile); @@ -68,7 +68,7 @@ void MathSqrtInset::Write(ostream & os, signed char fragile) } -void MathDelimInset::Write(ostream & os, signed char fragile) +void MathDelimInset::Write(ostream & os, bool fragile) { latexkeys * l = (left != '|') ? lm_get_key_by_id(left, LM_TK_SYM): 0; latexkeys * r = (right != '|') ? lm_get_key_by_id(right, LM_TK_SYM): 0; @@ -96,7 +96,7 @@ void MathDelimInset::Write(ostream & os, signed char fragile) } -void MathDecorationInset::Write(ostream & os, signed char fragile) +void MathDecorationInset::Write(ostream & os, bool fragile) { latexkeys * l = lm_get_key_by_id(deco, LM_TK_WIDE); os << '\\' << l->name << '{'; @@ -105,7 +105,7 @@ void MathDecorationInset::Write(ostream & os, signed char fragile) } -void MathAccentInset::Write(ostream & os, signed char fragile) +void MathAccentInset::Write(ostream & os, bool fragile) { latexkeys * l = lm_get_key_by_id(code, LM_TK_ACCENT); os << '\\' << l->name; @@ -139,7 +139,7 @@ void MathAccentInset::Write(ostream & os, signed char fragile) } -void MathBigopInset::Write(ostream & os, signed char /* fragile */) +void MathBigopInset::Write(ostream & os, bool /* fragile */) { bool limp = GetLimits(); @@ -157,7 +157,7 @@ void MathBigopInset::Write(ostream & os, signed char /* fragile */) } -void MathFracInset::Write(ostream & os, signed char fragile) +void MathFracInset::Write(ostream & os, bool fragile) { os << '\\' << name << '{'; MathParInset::Write(os, fragile); @@ -167,7 +167,7 @@ void MathFracInset::Write(ostream & os, signed char fragile) } -void MathParInset::Write(ostream & os, signed char fragile) +void MathParInset::Write(ostream & os, bool fragile) { if (!array) return; int brace = 0; @@ -288,7 +288,7 @@ void MathParInset::Write(ostream & os, signed char fragile) } -void MathMatrixInset::Write(ostream & os, signed char fragile) +void MathMatrixInset::Write(ostream & os, bool fragile) { if (GetType() == LM_OT_MATRIX){ if (fragile) @@ -320,7 +320,7 @@ void MathMatrixInset::Write(ostream & os, signed char fragile) void mathed_write(MathParInset * p, ostream & os, int * newlines, - signed char fragile, char const * label) + bool fragile, char const * label) { number_of_newlines = 0; short mathed_env = p->GetType(); diff --git a/src/paragraph.C b/src/paragraph.C index ee66c6d45f..83f400f8ce 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1980,8 +1980,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow, if (!spacing.isDefault() && (!Previous() || !Previous()->HasSameLayout(this))) { - os << "\\begin{spacing}{" - << spacing.getValue() << "}\n"; + os << spacing.writeEnvirBegin() << "\n"; texrow.newline(); } @@ -2163,7 +2162,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow, if (!spacing.isDefault() && (!par || !par->HasSameLayout(this))) { - os << "\\end{spacing}\n"; + os << spacing.writeEnvirEnd() << "\n"; texrow.newline(); } @@ -3405,7 +3404,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os, #if 1 #ifdef HAVE_SSTREAM stringstream ss(ios::in | ios::out); - inset->Latex(ss, -1); + inset->Latex(ss, true); ss.seekp(0); ss.get(c); while (!ss) { @@ -3417,7 +3416,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os, } #else strstream ss; - inset->Latex(ss, -1); + inset->Latex(ss, true); ss.seekp(0); ss.get(c); while (!ss) { @@ -3438,7 +3437,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os, fname2); return false; } - inset->Latex(fs, -1); + inset->Latex(fs, true); fs.seekp(0); fs.get(c); while (!fs) { diff --git a/src/screen.C b/src/screen.C index 43ea434d39..edaa5e18c0 100644 --- a/src/screen.C +++ b/src/screen.C @@ -21,7 +21,7 @@ #include "lyxrow.h" #include "Painter.h" #include "WorkArea.h" -#include "bufferparams.h" +#include "buffer.h" #include "font.h" using std::max; @@ -190,9 +190,9 @@ void LyXScreen::ShowCursor() if (!cursor_visible) { Cursor_Shape shape = BAR_SHAPE; if (text->real_current_font.language() != - text->bparams->language_info + text->buffer->params.language_info || text->real_current_font.isVisibleRightToLeft() - != text->bparams->language_info->RightToLeft) + != text->buffer->params.language_info->RightToLeft) shape = (text->real_current_font.isVisibleRightToLeft()) ? REVERSED_L_SHAPE : L_SHAPE; ShowManualCursor(text->cursor.x, text->cursor.y, diff --git a/src/text.C b/src/text.C index b584b3faf9..1e2ee06141 100644 --- a/src/text.C +++ b/src/text.C @@ -565,8 +565,9 @@ void LyXText::draw(Row const * row, // exactly the label-width. int LyXText::LeftMargin(Row const * row) const { - LyXLayout const & layout = textclasslist.Style(bparams->textclass, - row->par->GetLayout()); + LyXLayout const & layout = + textclasslist.Style(buffer->params.textclass, + row->par->GetLayout()); string parindent = layout.parindent; @@ -578,10 +579,10 @@ int LyXText::LeftMargin(Row const * row) const int x = LYX_PAPER_MARGIN; x += lyxfont::signedWidth(textclasslist - .TextClass(bparams->textclass) + .TextClass(buffer->params.textclass) .leftmargin(), textclasslist - .TextClass(bparams->textclass) + .TextClass(buffer->params.textclass) .defaultfont()); if (row->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { @@ -601,7 +602,7 @@ int LyXText::LeftMargin(Row const * row) const LyXParagraph * newpar = row->par ->DepthHook(row->par->GetDepth()); if (newpar && - textclasslist.Style(bparams->textclass, + textclasslist.Style(buffer->params.textclass, newpar->GetLayout()) .nextnoindent) parindent.clear(); @@ -617,7 +618,7 @@ int LyXText::LeftMargin(Row const * row) const // check wether it is a sufficent paragraph if (newpar && newpar->footnoteflag == row->par->footnoteflag && textclasslist - .Style(bparams->textclass, + .Style(buffer->params.textclass, newpar->GetLayout()).isEnvironment()) { Row dummyrow; dummyrow.par = newpar; @@ -636,7 +637,7 @@ int LyXText::LeftMargin(Row const * row) const parindent.clear(); else parindent = textclasslist - .Style(bparams->textclass, + .Style(buffer->params.textclass, newpar->GetLayout()).parindent; } @@ -648,7 +649,7 @@ int LyXText::LeftMargin(Row const * row) const if (!layout.leftmargin.empty()) { x += lyxfont::signedWidth(layout.leftmargin, textclasslist - .TextClass(bparams-> + .TextClass(buffer->params. textclass) .defaultfont()); } @@ -670,7 +671,7 @@ int LyXText::LeftMargin(Row const * row) const } break; case MARGIN_STATIC: - x += lyxfont::signedWidth(layout.leftmargin, textclasslist.TextClass(bparams->textclass).defaultfont()) * 4 + x += lyxfont::signedWidth(layout.leftmargin, textclasslist.TextClass(buffer->params.textclass).defaultfont()) * 4 / (row->par->GetDepth() + 4); break; case MARGIN_FIRST_DYNAMIC: @@ -718,7 +719,7 @@ int LyXText::LeftMargin(Row const * row) const x += lyxfont::signedWidth(layout.leftmargin, textclasslist - .TextClass(bparams->textclass) + .TextClass(buffer->params.textclass) .defaultfont()); x += minfill; } @@ -758,19 +759,19 @@ int LyXText::LeftMargin(Row const * row) const && align == LYX_ALIGN_BLOCK && !row->par->noindent && (row->par->layout || - bparams->paragraph_separation == + buffer->params.paragraph_separation == BufferParams::PARSEP_INDENT)) x += lyxfont::signedWidth(parindent, textclasslist - .TextClass(bparams - ->textclass) + .TextClass(buffer->params + .textclass) .defaultfont()); else if (layout.labeltype == LABEL_BIBLIO) { // ale970405 Right width for bibitems x += bibitemMaxWidth(owner_->painter(), textclasslist - .TextClass(bparams - ->textclass) + .TextClass(buffer->params + .textclass) .defaultfont()); } } @@ -781,15 +782,15 @@ int LyXText::LeftMargin(Row const * row) const int LyXText::RightMargin(Row const * row) const { LyXLayout const & layout = - textclasslist.Style(bparams->textclass, + textclasslist.Style(buffer->params.textclass, row->par->GetLayout()); int x = LYX_PAPER_MARGIN + lyxfont::signedWidth(textclasslist - .TextClass(bparams->textclass) + .TextClass(buffer->params.textclass) .rightmargin(), textclasslist - .TextClass(bparams->textclass) + .TextClass(buffer->params.textclass) .defaultfont()); if (row->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { @@ -815,7 +816,7 @@ int LyXText::RightMargin(Row const * row) const // check wether it is a sufficent paragraph if (newpar && newpar->footnoteflag == row->par->footnoteflag - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, newpar->GetLayout()) .isEnvironment()) { Row dummyrow; @@ -832,7 +833,7 @@ int LyXText::RightMargin(Row const * row) const } //lyxerr << "rightmargin: " << layout->rightmargin << endl; - x += lyxfont::signedWidth(layout.rightmargin, textclasslist.TextClass(bparams->textclass).defaultfont()) * 4 + x += lyxfont::signedWidth(layout.rightmargin, textclasslist.TextClass(buffer->params.textclass).defaultfont()) * 4 / (row->par->GetDepth() + 4); return x; } @@ -840,7 +841,7 @@ int LyXText::RightMargin(Row const * row) const int LyXText::LabelEnd (Row const * row) const { - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, row->par->GetLayout()).margintype == MARGIN_MANUAL) { Row tmprow; @@ -935,7 +936,7 @@ LyXText::NextBreakPoint(Row const * row, int width) const LyXParagraph::size_type main_body = BeginningOfMainBody(par); LyXLayout const & layout = - textclasslist.Style(bparams->textclass, par->GetLayout()); + textclasslist.Style(buffer->params.textclass, par->GetLayout()); LyXParagraph::size_type i = pos; if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) { @@ -1053,7 +1054,7 @@ int LyXText::Fill(Row const * row, int paper_width) const /* table stuff -- end*/ // special handling of the right address boxes - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, row->par->GetLayout()).margintype == MARGIN_RIGHT_ADDRESS_BOX) { int tmpfill = row->fill; @@ -1063,7 +1064,7 @@ int LyXText::Fill(Row const * row, int paper_width) const } else w = LeftMargin(row); - LyXLayout const & layout = textclasslist.Style(bparams->textclass, + LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, row->par->GetLayout()); LyXParagraph::size_type main_body = BeginningOfMainBody(row->par); @@ -1213,7 +1214,7 @@ bool LyXText::HfillExpansion(Row const * row_ptr, return true; // in some labels it does not count - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, row_ptr->par->GetLayout()).margintype != MARGIN_MANUAL && pos < BeginningOfMainBody(row_ptr->par)) @@ -1257,7 +1258,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const LyXParagraph * par = row_ptr->par->LastPhysicalPar(); LyXParagraph * firstpar = row_ptr->par->FirstPhysicalPar(); - LyXLayout const & layout = textclasslist.Style(bparams->textclass, + LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, firstpar->GetLayout()); LyXFont font = GetFont(par, par->Last() - 1); @@ -1271,7 +1272,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const if (!row_ptr->par->spacing.isDefault()) { spacing_val = row_ptr->par->spacing.getValue(); } else { - spacing_val = bparams->spacing.getValue(); + spacing_val = buffer->params.spacing.getValue(); } //lyxerr << "spacing_val = " << spacing_val << endl; @@ -1337,17 +1338,17 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const && row_ptr->par == firstpar) { /* some parksips VERY EASY IMPLEMENTATION */ - if (bparams->paragraph_separation == BufferParams::PARSEP_SKIP) { + if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) { if (layout.isParagraph() && firstpar->GetDepth() == 0 && firstpar->Previous()) - maxasc += bparams->getDefSkip().inPixels(owner_); + maxasc += buffer->params.getDefSkip().inPixels(owner_); else if (firstpar->Previous() - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, firstpar->Previous()->GetLayout()).isParagraph() && firstpar->Previous()->GetDepth() == 0) // is it right to use defskip here too? (AS) - maxasc += bparams->getDefSkip().inPixels(owner_); + maxasc += buffer->params.getDefSkip().inPixels(owner_); } /* the paper margins */ @@ -1370,12 +1371,12 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const /* this is special code for the chapter, since the label of this * layout is printed in an extra row */ if (layout.labeltype == LABEL_COUNTER_CHAPTER - && bparams->secnumdepth>= 0) { + && buffer->params.secnumdepth >= 0) { float spacing_val = 1.0; if (!row_ptr->par->spacing.isDefault()) { spacing_val = row_ptr->par->spacing.getValue(); } else { - spacing_val = bparams->spacing.getValue(); + spacing_val = buffer->params.spacing.getValue(); } labeladdon = int(lyxfont::maxDescent(labelfont) * @@ -1396,7 +1397,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const if (!row_ptr->par->spacing.isDefault()) { spacing_val = row_ptr->par->spacing.getValue(); } else { - spacing_val = bparams->spacing.getValue(); + spacing_val = buffer->params.spacing.getValue(); } labeladdon = int( @@ -1427,7 +1428,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const tmptop = layout.topsep; if (row_ptr->previous->par->GetDepth() >= row_ptr->par->GetDepth()) - tmptop-= textclasslist.Style(bparams->textclass, row_ptr->previous->par->GetLayout()).bottomsep; + tmptop-= textclasslist.Style(buffer->params.textclass, row_ptr->previous->par->GetLayout()).bottomsep; if (tmptop > 0) layoutasc = (tmptop * DefaultHeight()); @@ -1441,7 +1442,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const prev = row_ptr->par->DepthHook(row_ptr->par->GetDepth()-1); if (prev) { - maxasc += int(textclasslist.Style(bparams->textclass, + maxasc += int(textclasslist.Style(buffer->params.textclass, prev->GetLayout()).parsep * DefaultHeight()); } else { @@ -1487,12 +1488,12 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const float unusual = 0; if (comparepar->GetDepth() > nextpar->GetDepth()) { - usual = (textclasslist.Style(bparams->textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); + usual = (textclasslist.Style(buffer->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); comparepar = comparepar->DepthHook(nextpar->GetDepth()); if (comparepar->GetLayout()!= nextpar->GetLayout() || nextpar->GetLabelWidthString() != comparepar->GetLabelWidthString()) - unusual = (textclasslist.Style(bparams->textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); + unusual = (textclasslist.Style(buffer->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); if (unusual > usual) layoutdesc = unusual; @@ -1504,7 +1505,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const if (comparepar->GetLayout()!= nextpar->GetLayout() || nextpar->GetLabelWidthString() != comparepar->GetLabelWidthString()) - layoutdesc = int(textclasslist.Style(bparams->textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); + layoutdesc = int(textclasslist.Style(buffer->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); } } } @@ -1654,7 +1655,7 @@ void LyXText::BreakAgainOneRow(Row * row) void LyXText::BreakParagraph(char keep_layout) { - LyXLayout const & layout = textclasslist.Style(bparams->textclass, + LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, cursor.par->GetLayout()); /* table stuff -- begin */ @@ -2548,7 +2549,7 @@ void LyXText::InsertChar(char c) * disable the double-space checking */ bool freeSpacing = - textclasslist.Style(bparams->textclass, + textclasslist.Style(buffer->params.textclass, cursor.row->par->GetLayout()).free_spacing; /* table stuff -- begin*/ @@ -2761,7 +2762,7 @@ void LyXText::InsertChar(char c) RedoHeightOfParagraph(cursor); } else { /* now the special right address boxes */ - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, cursor.par->GetLayout()).margintype == MARGIN_RIGHT_ADDRESS_BOX) { RedoDrawingOfParagraph(cursor); @@ -2812,9 +2813,9 @@ void LyXText::PrepareToPrint(Row * row, float & x, x = LeftMargin(row); /* is there a manual margin with a manual label */ - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, row->par->GetLayout()).margintype == MARGIN_MANUAL - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, row->par->GetLayout()).labeltype == LABEL_MANUAL) { nlh = NumberOfLabelHfills(row) + 1; /* one more since labels @@ -2842,7 +2843,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, * set x how you need it */ int align; if (row->par->FirstPhysicalPar()->align == LYX_ALIGN_LAYOUT) - align = textclasslist.Style(bparams->textclass, row->par->GetLayout()).align; + align = textclasslist.Style(buffer->params.textclass, row->par->GetLayout()).align; else align = row->par->FirstPhysicalPar()->align; @@ -2885,7 +2886,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, if (main_body > 0 && (main_body-1 > last || !row->par->IsLineSeparator(main_body-1))) { - LyXLayout const & layout = textclasslist.Style(bparams->textclass, + LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, row->par->GetLayout()); x += lyxfont::width(layout.labelsep, GetFont(row->par, -2)); @@ -3112,7 +3113,7 @@ char * LyXText::SelectNextWord(float & value) && (cursor.par->IsLetter(cursor.pos)) || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) != 0 - && cursor.par->GetInset(cursor.pos)->Latex(latex, 0, false) == 0 + && cursor.par->GetInset(cursor.pos)->Latex(latex, false, false) == 0 #ifdef HAVE_SSTREAM && latex.str() == "\\-" #else @@ -3160,7 +3161,7 @@ void LyXText::SelectSelectedWord() && (cursor.par->IsLetter(cursor.pos) || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) != 0 - && cursor.par->GetInset(cursor.pos)->Latex(latex, 0, false) == 0 + && cursor.par->GetInset(cursor.pos)->Latex(latex, false, false) == 0 #ifdef HAVE_SSTREAM && latex.str() == "\\-" #else @@ -3266,7 +3267,6 @@ void LyXText::ChangeWordCase(LyXText::TextCase action) LyXParagraph::size_type tmppos = cursor.par->PositionInParFromPos(cursor.pos); while (tmppos < tmppar->size()) { - //unsigned char c = tmppar->text[tmppos]; unsigned char c = tmppar->GetChar(tmppos); if (IsKommaChar(c) || IsLineSeparatorChar(c)) break; @@ -3663,7 +3663,7 @@ void LyXText::Backspace() RedoHeightOfParagraph(cursor); } else { // now the special right address boxes - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, cursor.par->GetLayout()).margintype == MARGIN_RIGHT_ADDRESS_BOX) { RedoDrawingOfParagraph(cursor); } @@ -3789,7 +3789,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) float old_tmpx = tmpx; if (main_body > 0 && pos == main_body-1) { tmpx += fill_label_hfill + - lyxfont::width(textclasslist.Style(bparams->textclass, + lyxfont::width(textclasslist.Style(buffer->params.textclass, row_ptr->par->GetLayout()).labelsep, GetFont(row_ptr->par, -2)); if (row_ptr->par->IsLineSeparator(main_body-1)) @@ -3936,7 +3936,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) } LyXLayout const & layout = - textclasslist.Style(bparams->textclass, + textclasslist.Style(buffer->params.textclass, row_ptr->par->GetLayout()); firstpar = row_ptr->par->FirstPhysicalPar(); @@ -4006,17 +4006,17 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) /* think about the parskip */ /* some parskips VERY EASY IMPLEMENTATION */ - if (bparams->paragraph_separation == BufferParams::PARSEP_SKIP) { + if (buffer->params.paragraph_separation == BufferParams::PARSEP_SKIP) { if (layout.latextype == LATEX_PARAGRAPH && firstpar->GetDepth() == 0 && firstpar->Previous()) - y_top += bparams->getDefSkip().inPixels(owner_); + y_top += buffer->params.getDefSkip().inPixels(owner_); else if (firstpar->Previous() - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, firstpar->Previous()->GetLayout()).latextype == LATEX_PARAGRAPH && firstpar->Previous()->GetDepth() == 0) // is it right to use defskip here, too? (AS) - y_top += bparams->getDefSkip().inPixels(owner_); + y_top += buffer->params.getDefSkip().inPixels(owner_); } if (row_ptr->par->line_top) { /* draw a top line */ @@ -4042,14 +4042,14 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) string tmpstring = row_ptr->par->GetLabelstring(); if (layout.labeltype == LABEL_COUNTER_CHAPTER) { - if (bparams->secnumdepth >= 0){ + if (buffer->params.secnumdepth >= 0) { /* this is special code for the chapter layout. This is printed in * an extra row and has a pagebreak at the top. */ float spacing_val = 1.0; if (!row_ptr->par->spacing.isDefault()) { spacing_val = row_ptr->par->spacing.getValue(); } else { - spacing_val = bparams->spacing.getValue(); + spacing_val = buffer->params.spacing.getValue(); } maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val) @@ -4092,7 +4092,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) if (!row_ptr->par->spacing.isDefault()) { spacing_val = row_ptr->par->spacing.getValue(); } else { - spacing_val = bparams->spacing.getValue(); + spacing_val = buffer->params.spacing.getValue(); } maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val @@ -4510,7 +4510,7 @@ int LyXText::GetColumnNearX(Row * row, int & x) const LyXParagraph::size_type vc = row->pos; LyXParagraph::size_type last = RowLastPrintable(row); LyXParagraph::size_type c = 0; - LyXLayout const & layout = textclasslist.Style(bparams->textclass, + LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, row->par->GetLayout()); /* table stuff -- begin */ if (row->par->table) { @@ -4720,7 +4720,7 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind) || kind == LyXParagraph::WIDE_FIG || kind == LyXParagraph::ALGORITHM) { pair lres = - textclasslist.NumberOfLayout(bparams->textclass, + textclasslist.NumberOfLayout(buffer->params.textclass, "Caption"); LyXTextClass::size_type lay; if (lres.first) { diff --git a/src/text2.C b/src/text2.C index 74175d6c51..c32fd0ba45 100644 --- a/src/text2.C +++ b/src/text2.C @@ -55,7 +55,7 @@ LyXText::LyXText(BufferView * bv, int pw, Buffer * p) currentrow = 0; currentrow_y = 0; paperwidth = pw; - bparams = &p->params; + //bparams = &p->params; buffer = p; number_of_rows = 0; refresh_y = 0; @@ -120,7 +120,8 @@ LyXFont LyXText::GetFont(LyXParagraph * par, LyXParagraph::size_type pos) const { LyXLayout const & layout = - textclasslist.Style(bparams->textclass, par->GetLayout()); + textclasslist.Style(buffer->params.textclass, + par->GetLayout()); char par_depth = par->GetDepth(); // We specialize the 95% common case: @@ -174,13 +175,13 @@ LyXFont LyXText::GetFont(LyXParagraph * par, par = par->DepthHook(par_depth - 1); if (par) { tmpfont.realize(textclasslist. - Style(bparams->textclass, + Style(buffer->params.textclass, par->GetLayout()).font); par_depth = par->GetDepth(); } } - tmpfont.realize(textclasslist.TextClass(bparams->textclass).defaultfont()); + tmpfont.realize(textclasslist.TextClass(buffer->params.textclass).defaultfont()); // Cosmetic improvement: If this is an open footnote, make the font // smaller. @@ -204,8 +205,9 @@ void LyXText::SetCharFont(LyXParagraph * par, font = par->GetInset(pos)->ConvertFont(font); } - LyXLayout const & layout = textclasslist.Style(bparams->textclass, - par->GetLayout()); + LyXLayout const & layout = + textclasslist.Style(buffer->params.textclass, + par->GetLayout()); // Get concrete layout font to reduce against LyXFont layoutfont; @@ -222,12 +224,12 @@ void LyXText::SetCharFont(LyXParagraph * par, tp = tp->DepthHook(tp->GetDepth()-1); if (tp) layoutfont.realize(textclasslist. - Style(bparams->textclass, + Style(buffer->params.textclass, tp->GetLayout()).font); } } - layoutfont.realize(textclasslist.TextClass(bparams->textclass).defaultfont()); + layoutfont.realize(textclasslist.TextClass(buffer->params.textclass).defaultfont()); if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE && par->footnotekind == LyXParagraph::FOOTNOTE) { @@ -448,7 +450,8 @@ void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par) { LyXLayout const & layout = - textclasslist.Style(bparams->textclass, par->GetLayout()); + textclasslist.Style(buffer->params.textclass, + par->GetLayout()); LyXFont layoutfont, tmpfont; for (LyXParagraph::size_type pos = 0; @@ -501,7 +504,7 @@ void LyXText::SetLayout(LyXTextClass::size_type layout) cursor = sel_start_cursor; LyXLayout const & lyxlayout = - textclasslist.Style(bparams->textclass, layout); + textclasslist.Style(buffer->params.textclass, layout); while (cursor.par != sel_end_cursor.par) { if (cursor.par->footnoteflag == @@ -596,7 +599,7 @@ void LyXText::IncDepth() // NOTE: you can't change the depth of a bibliography entry if (cursor.par->footnoteflag == sel_start_cursor.par->footnoteflag - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, cursor.par->GetLayout() ).labeltype != LABEL_BIBLIO) { LyXParagraph * prev = @@ -604,7 +607,7 @@ void LyXText::IncDepth() if (prev && (prev->GetDepth() - cursor.par->GetDepth() > 0 || (prev->GetDepth() == cursor.par->GetDepth() - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, prev->GetLayout()).isEnvironment()))) { cursor.par->FirstPhysicalPar()->depth++; anything_changed = true; @@ -712,7 +715,9 @@ void LyXText::SetFont(LyXFont const & font, bool toggleall) else layoutfont = GetFont(cursor.par, -1); // Update current font - real_current_font.update(font, bparams->language_info, toggleall); + real_current_font.update(font, + buffer->params.language_info, + toggleall); // Reduce to implicit settings current_font = real_current_font; @@ -741,7 +746,9 @@ void LyXText::SetFont(LyXFont const & font, bool toggleall) // an open footnote should behave // like a closed one LyXFont newfont = GetFont(cursor.par, cursor.pos); - newfont.update(font, bparams->language_info, toggleall); + newfont.update(font, + buffer->params.language_info, + toggleall); SetCharFont(cursor.par, cursor.pos, newfont); cursor.pos++; } else { @@ -1099,7 +1106,7 @@ void LyXText::ToggleFree(LyXFont const & font, bool toggleall) LyXParagraph::size_type LyXText::BeginningOfMainBody(LyXParagraph * par) const { - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, par->GetLayout()).labeltype != LABEL_MANUAL) return 0; else @@ -1146,7 +1153,7 @@ void LyXText::MeltFootnoteEnvironment() tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE; /* remember the captions and empty paragraphs */ - if ((textclasslist.Style(bparams->textclass, + if ((textclasslist.Style(buffer->params.textclass, tmppar->GetLayout()) .labeltype == LABEL_SENSITIVE) || !tmppar->Last()) @@ -1260,13 +1267,13 @@ void LyXText::SetParagraph(bool line_top, bool line_bottom, // does the layout allow the new alignment? if (align == LYX_ALIGN_LAYOUT) align = textclasslist - .Style(bparams->textclass, + .Style(buffer->params.textclass, cursor.par->GetLayout()).align; if (align & textclasslist - .Style(bparams->textclass, + .Style(buffer->params.textclass, cursor.par->GetLayout()).alignpossible) { if (align == textclasslist - .Style(bparams->textclass, + .Style(buffer->params.textclass, cursor.par->GetLayout()).align) cursor.par->align = LYX_ALIGN_LAYOUT; else @@ -1403,11 +1410,12 @@ void LyXText::SetCounter(LyXParagraph * par) const // this is only relevant for the beginning of paragraph par = par->FirstPhysicalPar(); - LyXLayout const & layout = textclasslist.Style(bparams->textclass, - par->GetLayout()); + LyXLayout const & layout = + textclasslist.Style(buffer->params.textclass, + par->GetLayout()); LyXTextClass const & textclass = - textclasslist.TextClass(bparams->textclass); + textclasslist.TextClass(buffer->params.textclass); /* copy the prev-counters to this one, unless this is the start of a footnote or of a bibliography or the very first paragraph */ @@ -1415,7 +1423,7 @@ void LyXText::SetCounter(LyXParagraph * par) const && !(par->Previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE && par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE && par->footnotekind == LyXParagraph::FOOTNOTE) - && !(textclasslist.Style(bparams->textclass, + && !(textclasslist.Style(buffer->params.textclass, par->Previous()->GetLayout() ).labeltype != LABEL_BIBLIO && layout.labeltype == LABEL_BIBLIO)) { @@ -1450,7 +1458,7 @@ void LyXText::SetCounter(LyXParagraph * par) const && par->Previous() && par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE && (par->PreviousBeforeFootnote() - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, par->PreviousBeforeFootnote()->GetLayout() ).labeltype >= LABEL_COUNTER_ENUMI)) { // Any itemize or enumerate environment in a marginnote @@ -1472,7 +1480,7 @@ void LyXText::SetCounter(LyXParagraph * par) const */ if (par->Previous() && par->Previous()->GetDepth() < par->GetDepth() - && textclasslist.Style(bparams->textclass, + && textclasslist.Style(buffer->params.textclass, par->Previous()->GetLayout() ).labeltype == LABEL_COUNTER_ENUMI && par->enumdepth < 3 @@ -1516,7 +1524,7 @@ void LyXText::SetCounter(LyXParagraph * par) const if (layout.labeltype >= LABEL_FIRST_COUNTER) { int i = layout.labeltype - LABEL_FIRST_COUNTER; - if (i >= 0 && i<= bparams->secnumdepth) { + if (i >= 0 && i<= buffer->params.secnumdepth) { par->incCounter(i); // increment the counter // Is there a label? Useful for Chapter layout @@ -1805,9 +1813,11 @@ void LyXText::UpdateCounters(Row * row) const /* now check for the headline layouts. remember that they * have a dynamic left margin */ if (!par->IsDummy() - && ( textclasslist.Style(bparams->textclass, par->layout).margintype == MARGIN_DYNAMIC - || textclasslist.Style(bparams->textclass, par->layout).labeltype == LABEL_SENSITIVE) - ){ + && ( textclasslist.Style(buffer->params.textclass, + par->layout).margintype == MARGIN_DYNAMIC + || textclasslist.Style(buffer->params.textclass, + par->layout).labeltype == LABEL_SENSITIVE) + ) { /* Rebreak the paragraph */ RemoveParagraph(row); @@ -1940,7 +1950,7 @@ void LyXText::CutSelection(bool doclear) DeleteSimpleCutBuffer(); // set the textclass - simple_cut_buffer_textclass = bparams->textclass; + simple_cut_buffer_textclass = buffer->params.textclass; #ifdef WITH_WARNINGS #warning Asger: Make cut more intelligent here. @@ -2201,13 +2211,13 @@ void LyXText::CutSelection(bool doclear) endpar = sel_start_cursor.par; cap.cutSelection(sel_start_cursor.par, &endpar, sel_start_cursor.pos, sel_end_cursor.pos, - bparams->textclass, doclear); + buffer->params.textclass, doclear); } else { endpar = sel_end_cursor.par; cap.cutSelection(sel_start_cursor.par, &endpar, sel_start_cursor.pos, sel_end_cursor.pos, - bparams->textclass, doclear); + buffer->params.textclass, doclear); cursor.par = sel_end_cursor.par = endpar; cursor.pos = sel_end_cursor.pos; } @@ -2270,7 +2280,7 @@ void LyXText::CopySelection() DeleteSimpleCutBuffer(); // set the textclass - simple_cut_buffer_textclass = bparams->textclass; + simple_cut_buffer_textclass = buffer->params->textclass; #ifdef FIX_DOUBLE_SPACE // copy behind a space if there is one @@ -2386,7 +2396,7 @@ void LyXText::CopySelection() cap.copySelection(sel_start_cursor.par, sel_end_cursor.par, sel_start_cursor.pos, sel_end_cursor.pos, - bparams->textclass); + buffer->params.textclass); } #endif @@ -2540,7 +2550,7 @@ void LyXText::PasteSelection() // make sure there is no class difference cap.SwitchLayoutsBetweenClasses(simple_cut_buffer_textclass, - bparams->textclass, + buffer->params->textclass, simple_cut_buffer); // make the simple_cut_buffer exactly the same layout than @@ -2676,7 +2686,7 @@ void LyXText::PasteSelection() LyXParagraph *actpar = cursor.par; int endpos = cursor.pos; - cap.pasteSelection(&actpar, &endpar, endpos, bparams->textclass); + cap.pasteSelection(&actpar, &endpar, endpos, buffer->params.textclass); RedoParagraphs(cursor, endpar); @@ -2815,7 +2825,7 @@ void LyXText::InsertStringA(string const & str) SetCursorParUndo(); bool flag = - textclasslist.Style(bparams->textclass, + textclasslist.Style(buffer->params.textclass, cursor.par->GetLayout()).isEnvironment(); // only to be sure, should not be neccessary ClearSelection(); @@ -3076,7 +3086,7 @@ void LyXText::CheckParagraph(LyXParagraph * par, status = LyXText::NEED_MORE_REFRESH; // check the special right address boxes - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, par->GetLayout()).margintype == MARGIN_RIGHT_ADDRESS_BOX) { tmpcursor.par = par; @@ -3250,7 +3260,7 @@ void LyXText::SetCursorIntern(LyXParagraph * par, if (main_body > 0 && pos == main_body-1) { x += fill_label_hfill + lyxfont::width(textclasslist - .Style(bparams->textclass, + .Style(buffer->params.textclass, row->par->GetLayout()) .labelsep, GetFont(row->par, -2)); @@ -3445,7 +3455,7 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const if (selection) return; // We allow all kinds of "mumbo-jumbo" when freespacing. - if (textclasslist.Style(bparams->textclass, + if (textclasslist.Style(buffer->params.textclass, old_cursor.par->GetLayout()).free_spacing) return; @@ -3496,7 +3506,7 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const #endif #if 1 // Do not delete empty paragraphs with keepempty set. - if ((textclasslist.Style(bparams->textclass, + if ((textclasslist.Style(buffer->params.textclass, old_cursor.par->GetLayout())).keepempty) return;