]> git.lyx.org Git - features.git/commitdiff
More unicode, this time some focus on layouts and textclasses
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 20 Oct 2006 22:17:16 +0000 (22:17 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 20 Oct 2006 22:17:16 +0000 (22:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15421 a592a061-630c-0410-9148-cb99ea01b6c8

src/buffer_funcs.C
src/lyxlayout.C
src/lyxlayout.h
src/lyxtextclass.C
src/lyxtextclass.h
src/paragraph_pimpl.C
src/rowpainter.C
src/sgml.C
src/text2.C

index 0e94ff2b629e062497bc84233a3e941788dfec09..8291f4b41aff8f69ac2b2ff834e634493a560ee4 100644 (file)
@@ -375,8 +375,7 @@ void setLabel(Buffer const & buf, ParIterator & it)
 
        if (layout->margintype == MARGIN_MANUAL) {
                if (par.params().labelWidthString().empty())
-                       // FIXME UNICODE
-                       par.setLabelWidthString(lyx::from_ascii(layout->labelstring()));
+                       par.setLabelWidthString(layout->labelstring());
        } else {
                par.setLabelWidthString(docstring());
        }
@@ -386,8 +385,7 @@ void setLabel(Buffer const & buf, ParIterator & it)
                if (layout->toclevel <= buf.params().secnumdepth
                    && (layout->latextype != LATEX_ENVIRONMENT
                        || isFirstInSequence(it.pit(), it.plist()))) {
-                       // FIXME UNICODE
-                       counters.step(lyx::from_ascii(layout->counter));
+                       counters.step(layout->counter);
                        docstring label = expandLabel(buf, layout,
                                                      par.params().appendix());
                        par.params().labelString(label);
@@ -469,7 +467,8 @@ void setLabel(Buffer const & buf, ParIterator & it)
                int number = counters.value(lyx::from_ascii("bibitem"));
                if (par.bibitem())
                        par.bibitem()->setCounter(number);
-               par.params().labelString(buf.B_(layout->labelstring()));
+               // FIXME UNICODE
+               par.params().labelString(buf.B_(lyx::to_ascii(layout->labelstring())));
                // In biblio should't be following counters but...
        } else if (layout->labeltype == LABEL_SENSITIVE) {
                // Search for the first float or wrap inset in the iterator
@@ -495,14 +494,16 @@ void setLabel(Buffer const & buf, ParIterator & it)
                        s = bformat(_("%1$s #:"), buf.B_(fl.name()));
                } else {
                        // par->SetLayout(0);
-                       s = buf.B_(layout->labelstring());
+                       // FIXME UNICODE
+                       s = buf.B_(lyx::to_ascii(layout->labelstring()));
                }
 
                par.params().labelString(s);
        } else if (layout->labeltype == LABEL_NO_LABEL)
                par.params().labelString(docstring());
        else
-               par.params().labelString(buf.B_(layout->labelstring()));
+               // FIXME UNICODE
+               par.params().labelString(buf.B_(lyx::to_ascii(layout->labelstring())));
 }
 
 } // anon namespace
@@ -594,8 +595,9 @@ docstring expandLabel(Buffer const & buf,
 {
        LyXTextClass const & tclass = buf.params().getLyXTextClass();
 
-       docstring fmt = buf.B_(appendix ? layout->labelstring_appendix()
-                                 : layout->labelstring());
+       // FIXME UNICODE
+       docstring fmt = buf.B_(lyx::to_ascii(appendix ? layout->labelstring_appendix()
+                                            : layout->labelstring()));
 
        // handle 'inherited level parts' in 'fmt',
        // i.e. the stuff between '@' in   '@Section@.\arabic{subsection}'
index f0a0e339105435683bbb5165f87b65f96d8afd03..2400a1c1d7ad52e62465f01af4627b55bd484466 100644 (file)
@@ -448,22 +448,22 @@ bool LyXLayout::read(LyXLex & lexrc, LyXTextClass const & tclass)
 
                case LT_LABELSTRING:    // label string definition
                        if (lexrc.next())
-                               labelstring_ = trim(lexrc.getString());
+                               labelstring_ = lyx::from_ascii(trim(lexrc.getString()));
                        break;
 
                case LT_ENDLABELSTRING: // endlabel string definition
                        if (lexrc.next())
-                               endlabelstring_ = trim(lexrc.getString());
+                               endlabelstring_ = lyx::from_ascii(trim(lexrc.getString()));
                        break;
 
                case LT_LABELSTRING_APPENDIX: // label string appendix definition
                        if (lexrc.next())
-                               labelstring_appendix_ = trim(lexrc.getString());
+                               labelstring_appendix_ = lyx::from_ascii(trim(lexrc.getString()));
                        break;
 
                case LT_LABELCOUNTER: // name of counter to use
                        if (lexrc.next())
-                               counter = trim(lexrc.getString());
+                               counter = lyx::from_ascii(trim(lexrc.getString()));
                        break;
 
                case LT_FREE_SPACING:   // Allow for free spacing.
index 88907d7aa0a13995b9ceb6a7ecf51104215a1765..324bd3c028efbaac59eb7cb6023f803ef3294bea 100644 (file)
@@ -17,6 +17,7 @@
 #include "lyxfont.h"
 #include "layout.h"
 #include "Spacing.h"
+#include "support/docstring.h"
 
 #include <string>
 
@@ -55,9 +56,9 @@ public:
        ///
        std::string const & latexname() const { return latexname_; }
        ///
-       std::string const & labelstring() const { return labelstring_; }
+       lyx::docstring const & labelstring() const { return labelstring_; }
        ///
-       std::string const & endlabelstring() const { return endlabelstring_; }
+       lyx::docstring const & endlabelstring() const { return endlabelstring_; }
        ///
        std::string const & preamble() const { return preamble_; }
        ///
@@ -69,7 +70,7 @@ public:
        ///
        std::string const & itemtag() const { return itemtag_; }
        ///
-       std::string const & labelstring_appendix() const {
+       lyx::docstring const & labelstring_appendix() const {
                return labelstring_appendix_;
        }
        /** Default font for this layout/environment.
@@ -185,7 +186,7 @@ public:
        /// Does this layout allow for an optional parameter?
        int optionalargs;
        /// Which counter to step
-       std::string counter;
+       lyx::docstring counter;
        /// Depth of XML command
        int commanddepth;
 
@@ -208,11 +209,11 @@ private:
        /// LaTeX name for environment
        std::string latexname_;
        /// Label string. "Abstract", "Reference", "Caption"...
-       std::string labelstring_;
+       lyx::docstring labelstring_;
        ///
-       std::string endlabelstring_;
+       lyx::docstring endlabelstring_;
        /// Label string inside appendix. "Appendix", ...
-       std::string labelstring_appendix_;
+       lyx::docstring labelstring_appendix_;
        /// LaTeX parameter for environment
        std::string latexparam_;
        /// Internal tag to use (e.g., <title></title> for sect header)
index f82a8fd3d2b388d2cba4a120035e793b71b845e0..51b50ecd15e1288b52f45ac5761bd1c205c1dce6 100644 (file)
@@ -804,8 +804,8 @@ void LyXTextClass::readCounter(LyXLex & lexrc)
 
        lexrc.pushTable(counterTags, CT_END);
 
-       string name;
-       string within;
+       docstring name;
+       docstring within;
 
        bool getout = false;
        while (!getout && lexrc.isOK()) {
@@ -819,12 +819,12 @@ void LyXTextClass::readCounter(LyXLex & lexrc)
                switch (static_cast<CounterTags>(le)) {
                case CT_NAME:
                        lexrc.next();
-                       name = lexrc.getString();
+                       name = lyx::from_ascii(lexrc.getString());
                        break;
                case CT_WITHIN:
                        lexrc.next();
-                       within = lexrc.getString();
-                       if (within == "none")
+                       within = lyx::from_ascii(lexrc.getString());
+                       if (within == lyx::from_ascii("none"))
                                within.erase();
                        break;
                case CT_END:
@@ -835,12 +835,10 @@ void LyXTextClass::readCounter(LyXLex & lexrc)
 
        // Here if have a full counter if getout == true
        if (getout) {
-               // FIXME UNICODE
                if (within.empty()) {
-                       ctrs_->newCounter(lyx::from_ascii(name));
+                       ctrs_->newCounter(name);
                } else {
-                       ctrs_->newCounter(lyx::from_ascii(name),
-                                         lyx::from_ascii(within));
+                       ctrs_->newCounter(name, within);
                }
        }
 
index 8dacb47c0a7725a9fc7a0d69063947d05644a32d..4341223078cff7a0e7a9bd8db6cb7fffda278580 100644 (file)
@@ -84,7 +84,7 @@ public:
        LyXLayout_ptr const & operator[](std::string const & vname) const;
 
        /// Sees to that the textclass structure has been loaded
-       bool load(std::string const & path=std::string()) const;
+       bool load(std::string const & path = std::string()) const;
        /// Has this layout file been loaded yet?
        bool loaded() const { return loaded_; }
 
index 4993e540bccb3a7740031c1f404a783923637131..cea2b47fd71cd02e4e6015a5c4479c4e3ed17f50 100644 (file)
@@ -322,7 +322,7 @@ void Paragraph::Pimpl::erase(pos_type pos)
 }
 
 
-bool Paragraph::Pimpl::erase(pos_type pos, bool trackChanges)
+bool Paragraph::Pimpl::erase(pos_type pos, bool /*trackChanges*/)
 {
        // FIXME: change tracking (MG)
        BOOST_ASSERT(pos <= size());
index 7c78a4e1e520973a229c68fa018d96080e413ec2..779f5a6ee1af4d27cb92add43854060519353bb4 100644 (file)
@@ -630,8 +630,7 @@ void RowPainter::paintLast()
        case END_LABEL_STATIC: {
                LyXFont font = getLabelFont();
                FontMetrics const & fm = theFontMetrics(font);
-               // FIXME UNICODE
-               docstring const & str = lyx::from_utf8(par_.layout()->endlabelstring());
+               docstring const & str = par_.layout()->endlabelstring();
                double const x = is_rtl ?
                        x_ - fm.width(str)
                        : - text_.rightMargin(par_) - row_.width();
index 23d4904fad457dee9601a1cc98229119ba4595b7..05977ab4ecd3d153d5fc96be4dd9a8ccf552349c 100644 (file)
@@ -229,9 +229,9 @@ void sgml::openTag(Buffer const & buf, odocstream & os, OutputParams const & run
                if (param.find('#') != string::npos) {
                        // FIXME UNICODE
                        if(!style->counter.empty())
-                               counters.step(lyx::from_ascii(style->counter));
+                               counters.step(style->counter);
                        else
-                               counters.step(lyx::from_ascii(style->latexname()));
+                               counters.step(lyx::from_ascii(name));
                        int i = counters.value(lyx::from_ascii(name));
                        attribute = subst(param, "#", convert<string>(i));
                } else {
index 4149adfa3552bbfb2b1893773a22ce6de8b8bdb3..10cd34d5a1e2422d0a04c385827c6d994ed8395c 100644 (file)
@@ -354,8 +354,7 @@ void LyXText::setLayout(pit_type start, pit_type end, string const & layout)
        for (pit_type pit = start; pit != end; ++pit) {
                pars_[pit].applyLayout(lyxlayout);
                if (lyxlayout->margintype == MARGIN_MANUAL)
-                       // FIXME UNICODE
-                       pars_[pit].setLabelWidthString(lyx::from_ascii(lyxlayout->labelstring()));
+                       pars_[pit].setLabelWidthString(lyxlayout->labelstring());
        }
 }