]> git.lyx.org Git - features.git/commitdiff
more changes...read the Changelog
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 17 Jul 2000 18:27:53 +0000 (18:27 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 17 Jul 2000 18:27:53 +0000 (18:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@891 a592a061-630c-0410-9148-cb99ea01b6c8

27 files changed:
ChangeLog
src/Makefile.am
src/Sectioning.C [new file with mode: 0644]
src/Sectioning.h [new file with mode: 0644]
src/counters.C [new file with mode: 0644]
src/counters.h [new file with mode: 0644]
src/insets/Makefile.am
src/insets/inset.C
src/insets/insetcaption.C [new file with mode: 0644]
src/insets/insetcaption.h [new file with mode: 0644]
src/insets/insetcollapsable.C
src/insets/insetfloat.C
src/insets/insetfootlike.C
src/insets/insetinfo.C
src/insets/insetinfo.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetsection.C [new file with mode: 0644]
src/insets/insetsection.h [new file with mode: 0644]
src/insets/lyxinset.h
src/layout.h
src/lyxparagraph.h
src/lyxtext.h
src/mathed/formula.C
src/mathed/formula.h
src/paragraph.C
src/text2.C

index 17cb7d9423ac43a143ba64653b60da4b10dc57d9..491d8990d63f07bdf90623c84ee6da885225c94a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * lib/Makefile.am (listerrors): build-listerrors is in ${srcdir},
index 59b6fef0b2209689cdc1d2bca618429cd70bf7cd..6324609fb364a36b9b1f69f6928eaa857a83f70a 100644 (file)
@@ -63,6 +63,8 @@ lyx_SOURCES = \
        PaperLayout.C \
        ParagraphExtra.C \
        PrinterParams.h \
+       Sectioning.h \
+       Sectioning.C \
        Spacing.C \
        Spacing.h \
        TableLayout.C \
@@ -97,6 +99,8 @@ lyx_SOURCES = \
        combox.h \
        commandtags.h \
        config.h.in \
+       counters.C \
+       counters.h \
        credits.C \
        credits.h \
        credits_form.C \
diff --git a/src/Sectioning.C b/src/Sectioning.C
new file mode 100644 (file)
index 0000000..f14bb3b
--- /dev/null
@@ -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;
+}
diff --git a/src/Sectioning.h b/src/Sectioning.h
new file mode 100644 (file)
index 0000000..ca1dd13
--- /dev/null
@@ -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
diff --git a/src/counters.C b/src/counters.C
new file mode 100644 (file)
index 0000000..2a72bf9
--- /dev/null
@@ -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();
+}
diff --git a/src/counters.h b/src/counters.h
new file mode 100644 (file)
index 0000000..19014cc
--- /dev/null
@@ -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
index dcfca79d1c3f1238887d8da4dabe846d166da830..0449bcb4d746c045ed305adf212786e166b96456 100644 (file)
@@ -21,6 +21,8 @@ libinsets_la_SOURCES = \
        insetbib.h \
        insetbutton.C \
        insetbutton.h \
+       insetcaption.C \
+       insetcaption.h \
        insetcite.C \
        insetcite.h \
        insetcollapsable.C \
@@ -69,6 +71,8 @@ libinsets_la_SOURCES = \
        insetquotes.h \
        insetref.C \
        insetref.h \
+       insetsection.h \
+       insetsection.C \
        insetspecialchar.C \
        insetspecialchar.h \
        insettabular.C \
index 37abd2a4dd6b13d102f10175572292dbf691b552..333c1a6b2c6dd91db3bba031e1f99187c78efe8e 100644 (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);
 }
 
 
diff --git a/src/insets/insetcaption.C b/src/insets/insetcaption.C
new file mode 100644 (file)
index 0000000..8d89efa
--- /dev/null
@@ -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"
diff --git a/src/insets/insetcaption.h b/src/insets/insetcaption.h
new file mode 100644 (file)
index 0000000..328c7aa
--- /dev/null
@@ -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
index 8e3b78f304169d9a040179e3e068dd6f809d80ad..1f6f9a0a5ea69b5cd79f86b2b2acaceba2bdd6cc 100644 (file)
@@ -29,6 +29,7 @@ class LyXText;
 
 using std::ostream;
 using std::endl;
+using std::max;
 
 InsetCollapsable::InsetCollapsable()
        : UpdatableInset()
@@ -81,14 +82,15 @@ void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
 
 void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
 {
-    string token;
-
     if (lex.IsOK()) {
        lex.next();
-        token = lex.GetString();
+        string token = lex.GetString();
        if (token == "collapsed") {
            lex.next();
            collapsed = lex.GetBool();
+       } else {
+               lyxerr << "InsetCollapsable::Read: Missing collapsed!"
+                      << endl;
        }
     }
     inset->Read(buf, lex);
@@ -176,18 +178,16 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
     if (!cleared && ((inset->need_update == InsetText::FULL) ||
                     (inset->need_update == InsetText::INIT) ||
                     (top_x!=int(x)) || (top_baseline!=baseline))) {
-       int w =  owner()? width(bv, f) : pain.paperWidth();
-       int h = ascent(bv,f) + descent(bv, f);
-       int tx = (needFullRow() && !owner())? 0:int(x);
-       int ty = baseline - ascent(bv,f);
+       int w =  owner() ? width(bv, f) : pain.paperWidth();
+       int h = ascent(bv, f) + descent(bv, f);
+       int tx = (needFullRow() && !owner()) ? 0 : int(x);
+       int ty = max(0, baseline - ascent(bv, f));
        
-       if (ty < 0)
-           ty = 0;
        if ((ty + h) > pain.paperHeight())
            h = pain.paperHeight();
        if ((top_x + w) > pain.paperWidth())
            w = pain.paperWidth();
-       pain.fillRectangle(tx, ty-1, w, h+2);
+       pain.fillRectangle(tx, ty - 1, w, h + 2);
        cleared = true;
     }
 
@@ -293,13 +293,11 @@ int InsetCollapsable::getMaxWidth(Painter & pain,
     int w = UpdatableInset::getMaxWidth(pain,inset);
 
     if (w < 0) {
+       // What does a negative max width signify? (Lgb)
        return w;
     }
-    w -= widthCollapsed;
     // should be at least 30 pixels !!!
-    if (w < 30)
-       w = 30;
-    return w; // - top_x - widthCollapsed;
+    return max(30, w - widthCollapsed);
 }
 
 
index e0809a3b374a40530852d730b3d892ffebf17cff..55eccaa7bc926254f991808fe2b19cccbea15853 100644 (file)
@@ -99,12 +99,15 @@ InsetFloat::InsetFloat(string const & type)
 void InsetFloat::Write(Buffer const * buf, ostream & os) const
 {
        os << getInsetName()
-          << " " << floatType
-          << "\nplacement ";
-       if (floatPlacement.empty())
-               os << floatList.getType(floatType).placement << "\n";
-       else
-               os << floatPlacement << "\n";
+          << " " << floatType << '\n';
+
+       if (floatPlacement.empty()) {
+               os << "placement "
+                  << floatList.getType(floatType).placement << "\n";
+       } else {
+               os << "placement " << floatPlacement << "\n";
+       }
+       
        InsetCollapsable::Write(buf, os);
 }
 
@@ -117,6 +120,9 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
                if (token == "placement") {
                        lex.next();
                        floatPlacement = lex.GetString();
+               } else {
+                       lyxerr << "InsetFloat::Read: Missing placement!"
+                              << endl;
                }
        }
        InsetCollapsable::Read(buf, lex);
index 527dc644c64dd4feb00109ce8d1586aad680cd99..20b28ad568c6d2243827fc20d78893a8dde3e92d 100644 (file)
@@ -3,7 +3,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *          Copyright 1998 The LyX Team.
+ *          Copyright 2000 The LyX Team.
  *
  * ======================================================
  */
index 1f4e68e7b4627756f56270a15a659ffdddfd7f72..445bb65c0f8d18307399bd8186a6c190fcebace3 100644 (file)
@@ -35,13 +35,19 @@ extern BufferView * current_view;
 
 
 InsetInfo::InsetInfo()
-       : form(0)
-{}
+       : form(0), labelfont(LyXFont::ALL_SANE)
+{
+       labelfont.decSize().decSize()
+               .setColor(LColor::note).setLatex(LyXFont::OFF);
+}
 
 
 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()
@@ -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
 {
        Painter & pain = bv->painter();
+#if 0
        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);
-       
+#endif
        // Draw as "Note" in a yellow box
        x += 1;
-       pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
-                          width(bv, font) - 2,
-                          ascent(bv, font) + descent(bv, font) - 2,
+       pain.fillRectangle(int(x), baseline - ascent(bv, labelfont),
+                          width(bv, labelfont) - 2,
+                          ascent(bv, labelfont) + descent(bv, labelfont) - 2,
                           LColor::notebg);
-       pain.rectangle(int(x), baseline - ascent(bv, font) + 1,
-                      width(bv, font) - 2,
-                      ascent(bv, font) + descent(bv, font) - 2,
+       pain.rectangle(int(x), baseline - ascent(bv, labelfont),
+                      width(bv, labelfont) - 2,
+                      ascent(bv, labelfont) + descent(bv, labelfont) - 2,
                       LColor::noteframe);
        
-       pain.text(int(x + 2), baseline, _("Note"), font);
-       x +=  width(bv, font) - 1;
+       pain.text(int(x + 2), baseline, _("Note"), labelfont);
+       x +=  width(bv, labelfont) - 1;
 }
 
 
 void InsetInfo::Write(Buffer const *, ostream & os) const
 {
-       os << "Info " << contents;
+       os << "Info\n" << contents;
 }
 
 
index 8b01e3545558ff3b37074d3c587bc4fa5585dcf8..01894676d6aca67ae8e670419a8c530fb7372d82 100644 (file)
@@ -77,5 +77,7 @@ private:
        FL_FORM * form;
        ///
        FL_OBJECT * strobj;
+       ///
+       LyXFont labelfont;
 };
 #endif
index e8e5bde31a2fb3a9882262c7e8307cb714b7b85e..8c9bd55521a4d10a6af68ee02784e801c3e1819a 100644 (file)
@@ -190,7 +190,7 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const
 
 //LyXFont InsetQuotes::ConvertFont(LyXFont font)
 // I really belive this should be
-LyXFont InsetQuotes::ConvertFont(LyXFont const & f)
+LyXFont InsetQuotes::ConvertFont(LyXFont const & f) const
 {
        LyXFont font(f);
        // quotes-insets cannot be latex of any kind
index de07412d6641ee04e0d797376cb06c025d9241ee..f19a7b77927afe228f7593121185959118c5bd62 100644 (file)
@@ -80,7 +80,7 @@ public:
        ///
        void draw(BufferView *, LyXFont const &, int, float &, bool) const;
        ///
-       LyXFont ConvertFont(LyXFont const & font);
+       LyXFont ConvertFont(LyXFont const & font) const;
        //LyXFont ConvertFont(LyXFont font);
        ///
        void Write(Buffer const *, std::ostream &) const;
@@ -119,3 +119,4 @@ private:
        string DispString() const;
 };
 #endif
+
diff --git a/src/insets/insetsection.C b/src/insets/insetsection.C
new file mode 100644 (file)
index 0000000..27ba035
--- /dev/null
@@ -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"
diff --git a/src/insets/insetsection.h b/src/insets/insetsection.h
new file mode 100644 (file)
index 0000000..2c97a32
--- /dev/null
@@ -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
index ba66d0f74b6e3ad507f4e592fb656ced5dbaf4a8..792756a862f86c5b20c6475ef76ed77d35e7ae25 100644 (file)
@@ -130,7 +130,7 @@ public:
        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
        virtual const char * EditMessage() const;
        ///
index 5aa994442eaa03ebc128f4669a6031cf020ea566..779cfa1624fa3092ee4889cff0c0bd0789041491 100644 (file)
@@ -140,9 +140,7 @@ enum LYX_LABEL_TYPES {
        ///
        LABEL_COUNTER_ENUMIII,
        ///
-       LABEL_COUNTER_ENUMIV,
-       ///
-       LABEL_FIRST_COUNTER = LABEL_COUNTER_CHAPTER
+       LABEL_COUNTER_ENUMIV
 };
 
 enum LYX_END_LABEL_TYPES {
index 4d509179f3895fda1a79e24d3232b0bd314254ac..69793b851692b3c3bedbaf1fb24669871d9e56df 100644 (file)
@@ -271,6 +271,7 @@ public:
         bool noindent;
        
 private:
+       ///
        block<int, 10> counter_;
 public:
        ///
index 09881225959b2f46d52fdfe71c79dc938a0fd4a0..7d14d14a6cc3c081422e5e76420a2e712087ccdc 100644 (file)
@@ -70,9 +70,6 @@ public:
        ///
        InsetText * inset_owner;
 
-       ///
-       //      void owner(BufferView *);
-       
        ///
        LyXFont GetFont(Buffer const *, LyXParagraph * par,
                        LyXParagraph::size_type pos) const;
@@ -270,7 +267,8 @@ public:
 
        ///
        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;
        ///
@@ -501,8 +499,6 @@ public:
        ///
        int workWidth(BufferView *) const;
        ///
-       //      Buffer * buffer() const;
-       ///
        void ComputeBidiTables(Buffer const *, Row * row) const;
 
        /// Maps positions in the visual string to positions in logical string.
index 267a00452c0d5f8ef761cc485d971ae43944e146..b00ea87361acca2673b0fbe664afd1019a37c007 100644 (file)
@@ -370,11 +370,14 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
                label = mathed_label;
                mathed_label = 0;
        }
+       
        // reading of end_inset in the inset!!!
        while (lex.IsOK()) {
                lex.nextToken();
                if (lex.GetString() == "\\end_inset")
                        break;
+               lyxerr << "InsetFormula::Read: Garbage before \\end_inset,"
+                       " or missing \\end_inset!" << endl;
        }
    
 #ifdef DEBUG
index fa9412e33f74095f67ebd40bfbd86d9b72d93237..d8ac350492873304162efe21df0d166382f82d59 100644 (file)
@@ -68,8 +68,9 @@ public:
        ///
        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
+               LyXFont font(f);
                font.setLatex(LyXFont::OFF);
                return font;
        }
index b6c10aca023a5c95568832f2e52887118f70de81..bb5634e54e20c09a60613bc9ad7781fe15194e9c 100644 (file)
@@ -88,6 +88,16 @@ LyXParagraph::LyXParagraph()
        id_ = paragraph_id++;
         bibkey = 0; // ale970302
        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        
     
        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
 }
 
 
index 8fb50ea6e84d4bc389dc22cd7a72619066883f24..45172be79aea4639ddacba70c2245a7ddfd8a1f1 100644 (file)
@@ -1698,9 +1698,9 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
        }
    
        /* 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) {
                        par->incCounter(i);     // increment the counter  
         
@@ -1723,7 +1723,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
                        ostrstream s;
 #endif
                        if (!par->appendix) {
-                               switch (2 * LABEL_FIRST_COUNTER -
+                               switch (2 * LABEL_COUNTER_CHAPTER -
                                        textclass.maxcounter() + i) {
                                case LABEL_COUNTER_CHAPTER:
                                        s << par->getCounter(i);
@@ -1761,11 +1761,14 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
 
                                        break;
                                default:
+                                       // Can this ever be reached? And in the
+                                       // case it is, how can this be correct?
+                                       // (Lgb)
                                        s << par->getCounter(i) << '.';
                                         break;
                                }
                        } else { // appendix
-                               switch (2 * LABEL_FIRST_COUNTER - textclass.maxcounter() + i) {
+                               switch (2 * LABEL_COUNTER_CHAPTER - textclass.maxcounter() + i) {
                                case LABEL_COUNTER_CHAPTER:
                                        if (par->isRightToLeftPar(buf->params))
                                                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
                                        // case it is, how can this be correct?
                                        // (Lgb)
-                                       s << static_cast<unsigned char>(par->getCounter(i)) << '.';
+                                       s << par->getCounter(i) << '.';
                                        
                                        break;
                                }
@@ -1917,7 +1920,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
         
                } 
        } 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);
                int number = par->getCounter(i);
                if (!par->bibkey)