More unicode, this time some focus on layouts and textclasses

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15421 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2006-10-20 22:17:16 +00:00
parent 8ee23bd35a
commit 862f639695
9 changed files with 36 additions and 37 deletions

View 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}'

View 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.

View 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)

View 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);
}
}

View 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_; }

View 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());

View 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();

View 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 {

View 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());
}
}