X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetert.C;h=15e936c5d201310f9aa7f5b120d24ff2615ae09a;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=ce96f9ded78787c60d2ac38db1e1e2f29e2ff694;hpb=023fb5433c3028ec87042d9f2a7d2d4ed4d70eee;p=lyx.git diff --git a/src/insets/insetert.C b/src/insets/insetert.C index ce96f9ded7..15e936c5d2 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -32,13 +32,13 @@ #include "paragraph.h" #include "frontends/Alert.h" -#include "frontends/LyXView.h" #include -using lyx::docstring; -using lyx::pos_type; -using lyx::support::token; + +namespace lyx { + +using support::token; using std::endl; using std::min; @@ -62,7 +62,7 @@ void InsetERT::init() text_.current_font.setLanguage(latex_language); text_.real_current_font.setLanguage(latex_language); - setInsetName("ERT"); + setInsetName(from_ascii("ERT")); } @@ -144,7 +144,7 @@ docstring const InsetERT::editMessage() const } -int InsetERT::latex(Buffer const &, ostream & os, +int InsetERT::latex(Buffer const &, odocstream & os, OutputParams const &) const { ParagraphList::const_iterator par = paragraphs().begin(); @@ -155,10 +155,10 @@ int InsetERT::latex(Buffer const &, ostream & os, pos_type siz = par->size(); for (pos_type i = 0; i < siz; ++i) { // ignore all struck out text - if (isDeletedText(*par, i)) + if (par->isDeleted(i)) continue; - os << par->getChar(i); + os.put(par->getChar(i)); } ++par; if (par != end) { @@ -171,14 +171,14 @@ int InsetERT::latex(Buffer const &, ostream & os, } -int InsetERT::plaintext(Buffer const &, ostream &, +int InsetERT::plaintext(Buffer const &, odocstream &, OutputParams const & /*runparams*/) const { return 0; } -int InsetERT::docbook(Buffer const &, ostream & os, +int InsetERT::docbook(Buffer const &, odocstream & os, OutputParams const &) const { ParagraphList::const_iterator par = paragraphs().begin(); @@ -188,7 +188,7 @@ int InsetERT::docbook(Buffer const &, ostream & os, while (par != end) { pos_type siz = par->size(); for (pos_type i = 0; i < siz; ++i) - os << par->getChar(i); + os.put(par->getChar(i)); ++par; if (par != end) { os << "\n"; @@ -213,7 +213,7 @@ void InsetERT::doDispatch(LCursor & cur, FuncRequest & cmd) } case LFUN_INSET_MODIFY: { InsetCollapsable::CollapseStatus st; - InsetERTMailer::string2params(lyx::to_utf8(cmd.argument()), st); + InsetERTMailer::string2params(to_utf8(cmd.argument()), st); setStatus(cur, st); break; } @@ -322,6 +322,8 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd, case LFUN_BIBITEM_INSERT: case LFUN_LINE_INSERT: case LFUN_PAGEBREAK_INSERT: + case LFUN_CLEARPAGE_INSERT: + case LFUN_CLEARDOUBLEPAGE_INSERT: case LFUN_LANGUAGE: case LFUN_LAYOUT: case LFUN_LAYOUT_PARAGRAPH: @@ -352,6 +354,8 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd, case LFUN_INSET_INSERT: case LFUN_PARAGRAPH_PARAMS_APPLY: case LFUN_PARAGRAPH_UPDATE: + case LFUN_NOMENCL_INSERT: + case LFUN_NOMENCL_PRINT: case LFUN_NOACTION: status.enabled(false); return true; @@ -368,7 +372,7 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd, // solution, we consider only the first action of the sequence case LFUN_COMMAND_SEQUENCE: { // argument contains ';'-terminated commands - string const firstcmd = token(lyx::to_utf8(cmd.argument()), ';', 0); + string const firstcmd = token(to_utf8(cmd.argument()), ';', 0); FuncRequest func(lyxaction.lookupFunc(firstcmd)); func.origin = cmd.origin; return getStatus(cur, func, status); @@ -383,7 +387,7 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd, void InsetERT::setButtonLabel() { // FIXME UNICODE - setLabel(isOpen() ? lyx::to_utf8(_("ERT")) : getNewLabel(lyx::to_utf8(_("ERT")))); + setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT"))); } @@ -393,14 +397,16 @@ bool InsetERT::insetAllowed(InsetBase::Code /* code */) const } -void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const +bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const { LyXFont tmpfont = mi.base.font; getDrawFont(mi.base.font); mi.base.font.realize(tmpfont); InsetCollapsable::metrics(mi, dim); mi.base.font = tmpfont; + bool const changed = dim_ != dim; dim_ = dim; + return changed; } @@ -472,3 +478,6 @@ InsetERTMailer::params2string(InsetCollapsable::CollapseStatus status) data << name_ << ' ' << status; return data.str(); } + + +} // namespace lyx