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