more changes...read the Changelog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@891 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-07-17 18:27:53 +00:00
parent 97ea08be8a
commit 0b1b6dfa4e
27 changed files with 571 additions and 64 deletions

View File

@ -1,3 +1,53 @@
2000-07-17 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/mathed/formula.h (ConvertFont): constify
* src/mathed/formula.C (Read): add warning if \end_inset is not
found on expected place.
* src/insets/lyxinset.h (ConvertFont): consify
* src/insets/insetquotes.C (ConvertFont): constify
* src/insets/insetquotes.h: ditto
* src/insets/insetinfo.h: add labelfont
* src/insets/insetinfo.C (InsetInfo): set the labelfont
(ascent): use labelfont
(descent): likewise
(width): likewise
(draw): likewise
(Write): make .lyx file a bit nicer
* src/insets/insetfloat.C (Write): simplify somewhat...
(Read): add warning if arg is not found
* src/insets/insetcollapsable.C: add using std::max
(Read): move string token and add warning in arg is not found
(draw): use std::max to get the right ty
(getMaxWidth): simplify by using std::max
* src/insets/insetsection.h: new file
* src/insets/insetsection.C: new file
* src/insets/insetcaption.h: new file
* src/insets/insetcaption.C: new file
* src/insets/inset.C (ConvertFont): constify signature
* src/insets/Makefile.am (libinsets_la_SOURCES): add
insetcaption.[Ch] and insetsection.[Ch]
* src/layout.h: remove LABEL_FIRST_COUNTER from enum, change all
uses to use LABEL_COUNTER_CHAPTER instead.
* src/text2.C (SetCounter): here
* src/counters.h: new file
* src/counters.C: new file
* src/Sectioning.h: new file
* src/Sectioning.C: new file
* src/Makefile.am (lyx_SOURCES): add Sectioning.[hC] and counters.[Ch]
2000-07-17 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2000-07-17 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/Makefile.am (listerrors): build-listerrors is in ${srcdir}, * lib/Makefile.am (listerrors): build-listerrors is in ${srcdir},

View File

@ -63,6 +63,8 @@ lyx_SOURCES = \
PaperLayout.C \ PaperLayout.C \
ParagraphExtra.C \ ParagraphExtra.C \
PrinterParams.h \ PrinterParams.h \
Sectioning.h \
Sectioning.C \
Spacing.C \ Spacing.C \
Spacing.h \ Spacing.h \
TableLayout.C \ TableLayout.C \
@ -97,6 +99,8 @@ lyx_SOURCES = \
combox.h \ combox.h \
commandtags.h \ commandtags.h \
config.h.in \ config.h.in \
counters.C \
counters.h \
credits.C \ credits.C \
credits.h \ credits.h \
credits_form.C \ credits_form.C \

52
src/Sectioning.C Normal file
View File

@ -0,0 +1,52 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "Sectioning.h"
string const & Section::name() const
{
return name_;
}
int Section::level() const
{
return level_;
}
string const & Section::indent() const
{
return indent_;
}
string const & Section::beforeskip() const
{
return beforeskip_;
}
string const & Section::afterskip() const
{
return afterskip_;
}
LyXFont const & Section::style() const
{
return style_;
}
bool Section::display() const
{
// If afterskip is negative it is a display section.
if (!afterskip_.empty() && afterskip_[0] == '-')
return false;
return true;
}

58
src/Sectioning.h Normal file
View File

@ -0,0 +1,58 @@
// -*- C++ -*-
#ifndef SECTIONING_H
#define SECTIONING_H
#ifdef __GNUG__
#pragma interface
#endif
#include <map>
#include "LString.h"
#include "lyxfont.h"
///
class Section {
public:
///
string const & name() const;
///
int level() const;
///
string const & indent() const;
///
string const & beforeskip() const;
///
string const & afterskip() const;
///
LyXFont const & style() const;
///
bool display() const;
private:
///
string name_;
///
int level_;
///
string indent_;
///
string beforeskip_;
///
string afterskip_;
///
LyXFont style_;
};
///
class SectioningList {
public:
private:
///
typedef std::map<string, Section> List_;
///
List_ list_;
};
#endif

140
src/counters.C Normal file
View File

@ -0,0 +1,140 @@
#include <config.h>
#include "counters.h"
#include "debug.h"
#ifdef SIGC_CXX_NAMESPACES
using SigC::Connection;
using SigC::slot;
#endif
using std::endl;
Counter::Counter()
{
reset();
}
void Counter::set(int v)
{
value_ = v;
}
void Counter::addto(int v)
{
value_ += v;
}
int Counter::value() const
{
return value_;
}
void Counter::step()
{
++value_;
onstep.emit();
}
void Counter::reset()
{
value_ = 0;
}
Counters::~Counters()
{
// We need this since we store the Counter's as pointers in
// the counterList.
for (CounterList::iterator it = counterList.begin();
it != counterList.end();
++it)
delete (*it).second;
}
void Counters::newCounter(string const & newc)
{
// First check if newc already exist
CounterList::const_iterator cit = counterList.find(newc);
// if alrady exist give warning and return
if (cit != counterList.end()) {
lyxerr << "The new counter already exist." << endl;
return;
}
counterList[newc] = new Counter;
}
void Counters::newCounter(string const & newc, string const & oldc)
{
// First check if newc already exist
CounterList::const_iterator cit = counterList.find(newc);
// if already existant give warning and return
if (cit != counterList.end()) {
lyxerr << "The new counter already exist." << endl;
return;
}
// then check if oldc exist
CounterList::iterator it = counterList.find(oldc);
// if not give warning and return
if (it == counterList.end()) {
lyxerr << "The old counter does not exist." << endl;
return;
}
Counter * tmp = new Counter;
(*it).second->onstep.connect(slot(tmp,
&Counter::reset));
counterList[newc] = tmp;
}
void Counters::set(string const & ctr, int val)
{
CounterList::iterator it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "Counter does not exist." << endl;
return;
}
(*it).second->set(val);
}
void Counters::addto(string const & ctr, int val)
{
CounterList::iterator it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "Counter does not exist." << endl;
return;
}
(*it).second->addto(val);
}
int Counters::value(string const & ctr) const
{
CounterList::const_iterator cit = counterList.find(ctr);
if (cit == counterList.end()) {
lyxerr << "Counter does not exist." << endl;
return 0;
}
return (*cit).second->value();
}
void Counters::step(string const & ctr)
{
CounterList::iterator it = counterList.find(ctr);
if (it == counterList.end()) {
lyxerr << "Counter does not exist." << endl;
return;
}
(*it).second->step();
}

66
src/counters.h Normal file
View File

@ -0,0 +1,66 @@
// -*- C++ -*-
#ifndef COUNTERS_H
#define COUTNERS_H
#include <map>
#include <sigc++/signal_system.h>
#include "LString.h"
#ifdef SIGC_CXX_NAMESPACES
using SigC::Object;
using SigC::Signal0;
#endif
///
class Counter : public Object {
public:
///
Counter();
///
void set(int v);
///
void addto(int v);
///
int value() const;
///
void step();
///
void reset();
///
Signal0<void> onstep;
private:
///
int value_;
};
/** This is a class of (La)TeX type counters. The counters is in a text
Style and can be reset by signals emitted from a single counter.
*/
class Counters {
public:
///
~Counters();
///
void newCounter(string const & newc);
///
void newCounter(string const & newc, string const & oldc);
///
void set(string const & ctr, int val);
///
void addto(string const & ctr, int val);
///
int value(string const & ctr) const;
///
void step(string const & ctr);
// string refstep(string const & cou);
private:
///
typedef std::map<string, Counter*> CounterList;
///
CounterList counterList;
};
#endif

View File

@ -21,6 +21,8 @@ libinsets_la_SOURCES = \
insetbib.h \ insetbib.h \
insetbutton.C \ insetbutton.C \
insetbutton.h \ insetbutton.h \
insetcaption.C \
insetcaption.h \
insetcite.C \ insetcite.C \
insetcite.h \ insetcite.h \
insetcollapsable.C \ insetcollapsable.C \
@ -69,6 +71,8 @@ libinsets_la_SOURCES = \
insetquotes.h \ insetquotes.h \
insetref.C \ insetref.C \
insetref.h \ insetref.h \
insetsection.h \
insetsection.C \
insetspecialchar.C \ insetspecialchar.C \
insetspecialchar.h \ insetspecialchar.h \
insettabular.C \ insettabular.C \

View File

@ -58,9 +58,9 @@ void Inset::Edit(BufferView *, int, int, unsigned int)
} }
LyXFont Inset::ConvertFont(LyXFont font) LyXFont Inset::ConvertFont(LyXFont const & font) const
{ {
return font; return LyXFont(font);
} }

17
src/insets/insetcaption.C Normal file
View File

@ -0,0 +1,17 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "insetcaption.h"

30
src/insets/insetcaption.h Normal file
View File

@ -0,0 +1,30 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
*======================================================
*/
#ifndef INSETCAPTION_H
#define INSETCAPTION_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insettext.h"
/** A caption inset
*/
class InsetCaption : public InsetText {
public:
protected:
private:
};
#endif

View File

@ -29,6 +29,7 @@ class LyXText;
using std::ostream; using std::ostream;
using std::endl; using std::endl;
using std::max;
InsetCollapsable::InsetCollapsable() InsetCollapsable::InsetCollapsable()
: UpdatableInset() : UpdatableInset()
@ -81,14 +82,15 @@ void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex) void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
{ {
string token;
if (lex.IsOK()) { if (lex.IsOK()) {
lex.next(); lex.next();
token = lex.GetString(); string token = lex.GetString();
if (token == "collapsed") { if (token == "collapsed") {
lex.next(); lex.next();
collapsed = lex.GetBool(); collapsed = lex.GetBool();
} else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl;
} }
} }
inset->Read(buf, lex); inset->Read(buf, lex);
@ -176,18 +178,16 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
if (!cleared && ((inset->need_update == InsetText::FULL) || if (!cleared && ((inset->need_update == InsetText::FULL) ||
(inset->need_update == InsetText::INIT) || (inset->need_update == InsetText::INIT) ||
(top_x!=int(x)) || (top_baseline!=baseline))) { (top_x!=int(x)) || (top_baseline!=baseline))) {
int w = owner()? width(bv, f) : pain.paperWidth(); int w = owner() ? width(bv, f) : pain.paperWidth();
int h = ascent(bv,f) + descent(bv, f); int h = ascent(bv, f) + descent(bv, f);
int tx = (needFullRow() && !owner())? 0:int(x); int tx = (needFullRow() && !owner()) ? 0 : int(x);
int ty = baseline - ascent(bv,f); int ty = max(0, baseline - ascent(bv, f));
if (ty < 0)
ty = 0;
if ((ty + h) > pain.paperHeight()) if ((ty + h) > pain.paperHeight())
h = pain.paperHeight(); h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth()) if ((top_x + w) > pain.paperWidth())
w = pain.paperWidth(); w = pain.paperWidth();
pain.fillRectangle(tx, ty-1, w, h+2); pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true; cleared = true;
} }
@ -293,13 +293,11 @@ int InsetCollapsable::getMaxWidth(Painter & pain,
int w = UpdatableInset::getMaxWidth(pain,inset); int w = UpdatableInset::getMaxWidth(pain,inset);
if (w < 0) { if (w < 0) {
// What does a negative max width signify? (Lgb)
return w; return w;
} }
w -= widthCollapsed;
// should be at least 30 pixels !!! // should be at least 30 pixels !!!
if (w < 30) return max(30, w - widthCollapsed);
w = 30;
return w; // - top_x - widthCollapsed;
} }

View File

@ -99,12 +99,15 @@ InsetFloat::InsetFloat(string const & type)
void InsetFloat::Write(Buffer const * buf, ostream & os) const void InsetFloat::Write(Buffer const * buf, ostream & os) const
{ {
os << getInsetName() os << getInsetName()
<< " " << floatType << " " << floatType << '\n';
<< "\nplacement ";
if (floatPlacement.empty()) if (floatPlacement.empty()) {
os << floatList.getType(floatType).placement << "\n"; os << "placement "
else << floatList.getType(floatType).placement << "\n";
os << floatPlacement << "\n"; } else {
os << "placement " << floatPlacement << "\n";
}
InsetCollapsable::Write(buf, os); InsetCollapsable::Write(buf, os);
} }
@ -117,6 +120,9 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
if (token == "placement") { if (token == "placement") {
lex.next(); lex.next();
floatPlacement = lex.GetString(); floatPlacement = lex.GetString();
} else {
lyxerr << "InsetFloat::Read: Missing placement!"
<< endl;
} }
} }
InsetCollapsable::Read(buf, lex); InsetCollapsable::Read(buf, lex);

View File

@ -3,7 +3,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright 1998 The LyX Team. * Copyright 2000 The LyX Team.
* *
* ====================================================== * ======================================================
*/ */

View File

@ -35,13 +35,19 @@ extern BufferView * current_view;
InsetInfo::InsetInfo() InsetInfo::InsetInfo()
: form(0) : form(0), labelfont(LyXFont::ALL_SANE)
{} {
labelfont.decSize().decSize()
.setColor(LColor::note).setLatex(LyXFont::OFF);
}
InsetInfo::InsetInfo(string const & str) InsetInfo::InsetInfo(string const & str)
: contents(str), form(0) : contents(str), form(0), labelfont(LyXFont::ALL_SANE)
{} {
labelfont.decSize().decSize()
.setColor(LColor::note).setLatex(LyXFont::OFF);
}
InsetInfo::~InsetInfo() InsetInfo::~InsetInfo()
@ -54,52 +60,53 @@ InsetInfo::~InsetInfo()
} }
int InsetInfo::ascent(BufferView *, LyXFont const & font) const int InsetInfo::ascent(BufferView *, LyXFont const &) const
{ {
return lyxfont::maxAscent(font) + 1; return lyxfont::maxAscent(labelfont) + 1;
} }
int InsetInfo::descent(BufferView *, LyXFont const & font) const int InsetInfo::descent(BufferView *, LyXFont const &) const
{ {
return lyxfont::maxDescent(font) + 1; return lyxfont::maxDescent(labelfont) + 1;
} }
int InsetInfo::width(BufferView *, LyXFont const & font) const int InsetInfo::width(BufferView *, LyXFont const &) const
{ {
return 6 + lyxfont::width(_("Note"), font); return 6 + lyxfont::width(_("Note"), labelfont);
} }
void InsetInfo::draw(BufferView * bv, LyXFont const & f, void InsetInfo::draw(BufferView * bv, LyXFont const &,
int baseline, float & x, bool) const int baseline, float & x, bool) const
{ {
Painter & pain = bv->painter(); Painter & pain = bv->painter();
#if 0
LyXFont font(f); LyXFont font(f);
/* Info-insets are never LaTeX, so just correct the font */ // Info-insets are never LaTeX, so just correct the font
font.setLatex(LyXFont::OFF).setColor(LColor::note); font.setLatex(LyXFont::OFF).setColor(LColor::note);
#endif
// Draw as "Note" in a yellow box // Draw as "Note" in a yellow box
x += 1; x += 1;
pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1, pain.fillRectangle(int(x), baseline - ascent(bv, labelfont),
width(bv, font) - 2, width(bv, labelfont) - 2,
ascent(bv, font) + descent(bv, font) - 2, ascent(bv, labelfont) + descent(bv, labelfont) - 2,
LColor::notebg); LColor::notebg);
pain.rectangle(int(x), baseline - ascent(bv, font) + 1, pain.rectangle(int(x), baseline - ascent(bv, labelfont),
width(bv, font) - 2, width(bv, labelfont) - 2,
ascent(bv, font) + descent(bv, font) - 2, ascent(bv, labelfont) + descent(bv, labelfont) - 2,
LColor::noteframe); LColor::noteframe);
pain.text(int(x + 2), baseline, _("Note"), font); pain.text(int(x + 2), baseline, _("Note"), labelfont);
x += width(bv, font) - 1; x += width(bv, labelfont) - 1;
} }
void InsetInfo::Write(Buffer const *, ostream & os) const void InsetInfo::Write(Buffer const *, ostream & os) const
{ {
os << "Info " << contents; os << "Info\n" << contents;
} }

View File

@ -77,5 +77,7 @@ private:
FL_FORM * form; FL_FORM * form;
/// ///
FL_OBJECT * strobj; FL_OBJECT * strobj;
///
LyXFont labelfont;
}; };
#endif #endif

View File

@ -190,7 +190,7 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const
//LyXFont InsetQuotes::ConvertFont(LyXFont font) //LyXFont InsetQuotes::ConvertFont(LyXFont font)
// I really belive this should be // I really belive this should be
LyXFont InsetQuotes::ConvertFont(LyXFont const & f) LyXFont InsetQuotes::ConvertFont(LyXFont const & f) const
{ {
LyXFont font(f); LyXFont font(f);
// quotes-insets cannot be latex of any kind // quotes-insets cannot be latex of any kind

View File

@ -80,7 +80,7 @@ public:
/// ///
void draw(BufferView *, LyXFont const &, int, float &, bool) const; void draw(BufferView *, LyXFont const &, int, float &, bool) const;
/// ///
LyXFont ConvertFont(LyXFont const & font); LyXFont ConvertFont(LyXFont const & font) const;
//LyXFont ConvertFont(LyXFont font); //LyXFont ConvertFont(LyXFont font);
/// ///
void Write(Buffer const *, std::ostream &) const; void Write(Buffer const *, std::ostream &) const;
@ -119,3 +119,4 @@ private:
string DispString() const; string DispString() const;
}; };
#endif #endif

17
src/insets/insetsection.C Normal file
View File

@ -0,0 +1,17 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "insetsection.h"

33
src/insets/insetsection.h Normal file
View File

@ -0,0 +1,33 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
*======================================================
*/
#ifndef INSETSECTION_H
#define INSETSECTION_H
#ifdef __GNUG__
#pragma interface
#endif
#include "LString.h"
#include "insettext.h"
/** A colapsable text inset
*/
class InsetSection : public InsetText {
public:
protected:
private:
string type_;
};
#endif

View File

@ -130,7 +130,7 @@ public:
virtual void update(BufferView *, LyXFont const &, bool = false) virtual void update(BufferView *, LyXFont const &, bool = false)
{} {}
/// ///
virtual LyXFont ConvertFont(LyXFont font); virtual LyXFont ConvertFont(LyXFont const & font) const;
/// what appears in the minibuffer when opening /// what appears in the minibuffer when opening
virtual const char * EditMessage() const; virtual const char * EditMessage() const;
/// ///

View File

@ -140,9 +140,7 @@ enum LYX_LABEL_TYPES {
/// ///
LABEL_COUNTER_ENUMIII, LABEL_COUNTER_ENUMIII,
/// ///
LABEL_COUNTER_ENUMIV, LABEL_COUNTER_ENUMIV
///
LABEL_FIRST_COUNTER = LABEL_COUNTER_CHAPTER
}; };
enum LYX_END_LABEL_TYPES { enum LYX_END_LABEL_TYPES {

View File

@ -271,6 +271,7 @@ public:
bool noindent; bool noindent;
private: private:
///
block<int, 10> counter_; block<int, 10> counter_;
public: public:
/// ///

View File

@ -70,9 +70,6 @@ public:
/// ///
InsetText * inset_owner; InsetText * inset_owner;
///
// void owner(BufferView *);
/// ///
LyXFont GetFont(Buffer const *, LyXParagraph * par, LyXFont GetFont(Buffer const *, LyXParagraph * par,
LyXParagraph::size_type pos) const; LyXParagraph::size_type pos) const;
@ -270,7 +267,8 @@ public:
/// ///
void SetCursorFromCoordinates(BufferView *, int x, long y) const; void SetCursorFromCoordinates(BufferView *, int x, long y) const;
void SetCursorFromCoordinates(BufferView *, LyXCursor &, int x, long y) const; void SetCursorFromCoordinates(BufferView *, LyXCursor &,
int x, long y) const;
/// ///
void CursorUp(BufferView *) const; void CursorUp(BufferView *) const;
/// ///
@ -501,8 +499,6 @@ public:
/// ///
int workWidth(BufferView *) const; int workWidth(BufferView *) const;
/// ///
// Buffer * buffer() const;
///
void ComputeBidiTables(Buffer const *, Row * row) const; void ComputeBidiTables(Buffer const *, Row * row) const;
/// Maps positions in the visual string to positions in logical string. /// Maps positions in the visual string to positions in logical string.

View File

@ -370,11 +370,14 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
label = mathed_label; label = mathed_label;
mathed_label = 0; mathed_label = 0;
} }
// reading of end_inset in the inset!!! // reading of end_inset in the inset!!!
while (lex.IsOK()) { while (lex.IsOK()) {
lex.nextToken(); lex.nextToken();
if (lex.GetString() == "\\end_inset") if (lex.GetString() == "\\end_inset")
break; break;
lyxerr << "InsetFormula::Read: Garbage before \\end_inset,"
" or missing \\end_inset!" << endl;
} }
#ifdef DEBUG #ifdef DEBUG

View File

@ -68,8 +68,9 @@ public:
/// ///
Inset::Code LyxCode() const { return Inset::MATH_CODE; } Inset::Code LyxCode() const { return Inset::MATH_CODE; }
/// ///
LyXFont ConvertFont(LyXFont font) { LyXFont ConvertFont(LyXFont const & f) const {
// We have already discussed what was here // We have already discussed what was here
LyXFont font(f);
font.setLatex(LyXFont::OFF); font.setLatex(LyXFont::OFF);
return font; return font;
} }

View File

@ -88,6 +88,16 @@ LyXParagraph::LyXParagraph()
id_ = paragraph_id++; id_ = paragraph_id++;
bibkey = 0; // ale970302 bibkey = 0; // ale970302
Clear(); Clear();
#if 0
// Insert the main counters
// Should later (asap) be moved to layout files
counters.newCounter("part");
counters.newCounter("section");
counters.newCounter("subsection", "section");
counters.newCounter("subsubsection", "subsection");
counters.newCounter("paragraph", "subsubsection");
counters.newCounter("subparagraph", "paragraph");
#endif
} }
@ -123,6 +133,16 @@ LyXParagraph::LyXParagraph(LyXParagraph * par)
bibkey = 0; // ale970302 bibkey = 0; // ale970302
Clear(); Clear();
#if 0
// Insert the main counters
// Should later (asap) be moved to layout files
counters.newCounter("part");
counters.newCounter("section");
counters.newCounter("subsection", "section");
counters.newCounter("subsubsection", "subsection");
counters.newCounter("paragraph", "subsubsection");
counters.newCounter("subparagraph", "paragraph");
#endif
} }

View File

@ -1698,9 +1698,9 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
} }
/* is it a layout that has an automatic label ? */ /* is it a layout that has an automatic label ? */
if (layout.labeltype >= LABEL_FIRST_COUNTER) { if (layout.labeltype >= LABEL_COUNTER_CHAPTER) {
int i = layout.labeltype - LABEL_FIRST_COUNTER; int i = layout.labeltype - LABEL_COUNTER_CHAPTER;
if (i >= 0 && i<= buf->params.secnumdepth) { if (i >= 0 && i<= buf->params.secnumdepth) {
par->incCounter(i); // increment the counter par->incCounter(i); // increment the counter
@ -1723,7 +1723,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
ostrstream s; ostrstream s;
#endif #endif
if (!par->appendix) { if (!par->appendix) {
switch (2 * LABEL_FIRST_COUNTER - switch (2 * LABEL_COUNTER_CHAPTER -
textclass.maxcounter() + i) { textclass.maxcounter() + i) {
case LABEL_COUNTER_CHAPTER: case LABEL_COUNTER_CHAPTER:
s << par->getCounter(i); s << par->getCounter(i);
@ -1761,11 +1761,14 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
break; break;
default: default:
// Can this ever be reached? And in the
// case it is, how can this be correct?
// (Lgb)
s << par->getCounter(i) << '.'; s << par->getCounter(i) << '.';
break; break;
} }
} else { // appendix } else { // appendix
switch (2 * LABEL_FIRST_COUNTER - textclass.maxcounter() + i) { switch (2 * LABEL_COUNTER_CHAPTER - textclass.maxcounter() + i) {
case LABEL_COUNTER_CHAPTER: case LABEL_COUNTER_CHAPTER:
if (par->isRightToLeftPar(buf->params)) if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i)); s << hebrewCounter(par->getCounter(i));
@ -1836,7 +1839,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
// Can this ever be reached? And in the // Can this ever be reached? And in the
// case it is, how can this be correct? // case it is, how can this be correct?
// (Lgb) // (Lgb)
s << static_cast<unsigned char>(par->getCounter(i)) << '.'; s << par->getCounter(i) << '.';
break; break;
} }
@ -1917,7 +1920,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
} }
} else if (layout.labeltype == LABEL_BIBLIO) {// ale970302 } else if (layout.labeltype == LABEL_BIBLIO) {// ale970302
int i = LABEL_COUNTER_ENUMI - LABEL_FIRST_COUNTER + par->enumdepth; int i = LABEL_COUNTER_ENUMI - LABEL_COUNTER_CHAPTER + par->enumdepth;
par->incCounter(i); par->incCounter(i);
int number = par->getCounter(i); int number = par->getCounter(i);
if (!par->bibkey) if (!par->bibkey)