]> git.lyx.org Git - features.git/commitdiff
fix linking of tex2lyx by moving code out of Counters class
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 9 Sep 2005 14:52:55 +0000 (14:52 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 9 Sep 2005 14:52:55 +0000 (14:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10433 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/buffer_funcs.C
src/counters.C
src/counters.h

index f54846e231837b3a1df7d763b0a84edd1cda3e10..65e6370a5ccfd896120f0a837d2ba191431e5361 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-09  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * buffer_funcs.C (setCounter): put the code to compute enum label
+       here (where it belongs).
+
+       * counters.C (enumLabel): move code to buffer_funcs.C.
+
 2005-09-07  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * outputparams.[Ch]: store local_font instead of local_language
index 38a39a79c8b0bf19c93d6da4d253eefa77da4d80..ef0b89ebfead166edefca3b003e35d1a9334ceda 100644 (file)
@@ -438,7 +438,27 @@ void setCounter(Buffer const & buf, ParIterator & it)
 
                counters.step(enumcounter);
 
-               par.params().labelString(counters.enumLabel(enumcounter, buf));
+               string format;
+
+               switch (par.itemdepth) {
+               case 0:
+                       format = N_("\\arabic{enumi}.");
+                       break;
+               case 1:
+                       format = N_("(\\alph{enumii})");
+                       break;
+               case 2:
+                       format = N_("\\roman{enumiii}.");
+                       break;
+               case 3:
+                       format = N_("\\Alph{enumiv}.");
+                       break;
+               default:
+                       // not a valid enumdepth...
+                       break;
+               }
+
+               par.params().labelString(counters.counterLabel(buf.B_(format)));
        } else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
                counters.step("bibitem");
                int number = counters.value("bibitem");
index 29df4ed5df0cecdcca2470e79867bfac156d2740..2ef261a3d99924e7720af960eeca8e3d230ac28d 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "counters.h"
 #include "debug.h"
-#include "gettext.h"
 
 #include "support/lstrings.h"
 #include "support/convert.h"
@@ -314,24 +313,3 @@ string Counters::counterLabel(string const & format)
        //lyxerr << "counterLabel: " << format  << " -> "       << label << endl;
        return label;
 }
-
-
-string Counters::enumLabel(string const & ctr, Buffer const & buf)
-{
-       string format;
-
-       if (ctr == "enumi") {
-               format = N_("\\arabic{enumi}.");
-       }
-       else if (ctr == "enumii") {
-               format = N_("(\\alph{enumii})");
-       }
-       else if (ctr == "enumiii") { 
-               format = N_("\\roman{enumiii}.");
-       }
-       else if (ctr == "enumiv") {
-               format = N_("\\Alph{enumiv}.");
-       }
-               
-       return counterLabel(buf.B_(format));
-}
index 4aee7f93aeef550a3badd498df352ad7196cd5f8..df9a0a6149b00255e3867142478684fc314a2609 100644 (file)
@@ -18,8 +18,6 @@
 #include <map>
 #include <string>
 
-#include "buffer.h"
-
 /// This represents a single counter.
 class Counter {
 public:
@@ -78,8 +76,6 @@ public:
        /// A complete expanded label, like 2.1.4 for a subsubsection
        /// according to the given format
        std::string counterLabel(std::string const & format);
-       /// A complete label, like 1.a for enumerations
-       std::string enumLabel(std::string const & ctr, Buffer const & buf);
 private:
        /// A counter label's single item, 1 for subsection number in
        /// the 2.1.4 subsubsection number label.