some ert fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2346 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-07-25 19:45:21 +00:00
parent 29e407f03b
commit 57a2087d37
7 changed files with 43 additions and 39 deletions

View File

@ -17,7 +17,6 @@
#include "BufferView.h"
#include "BufferView_pimpl.h"
#include "lyxtext.h"
#include "WorkArea.h"
#include "lyxscreen.h"

View File

@ -27,7 +27,6 @@ class LyXText;
class TeXErrors;
class Buffer;
class LyXScreen;
class WorkArea;
class Language;
class Painter;
class UpdatableInset;

View File

@ -1,3 +1,9 @@
2001-07-25 Lars Gullik Bjřnnes <larsbj@birdstep.com>
* BufferView.h: don't forward declare WorkArea
* BufferView.C: don't include WorkArea.h
2001-07-25 André Pönitz <poenitz@gmx.net>
* commandtags.h:

View File

@ -1,5 +1,11 @@
2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettext.C (read): handle old latex end_inset
* insetert.C (setButtonLabel): new method
(init): use it, to set the dynamic label correctly
(read): use it
* Makefile.am (EXTRA_DIST): add files that is not part or the
binary here.

View File

@ -27,19 +27,12 @@ using std::ostream;
void InsetERT::init()
{
#if 0
setLabel(_("666"), true);
#else
setLabel(_("666"));
#endif
setButtonLabel();
labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize();
labelfont.decSize();
#ifndef NO_LATEX
labelfont.setLatex(LyXFont::ON);
#else
labelfont.setColor(LColor::latex);
#endif
setInsetName("ERT");
}
@ -50,14 +43,6 @@ InsetERT::InsetERT() : InsetCollapsable()
}
#if 0
InsetERT::InsetERT(InsetERT const & in, bool same_id)
: InsetCollapsable(in, same_id)
{
}
#endif
InsetERT::InsetERT(string const & contents, bool collapsed)
: InsetCollapsable(collapsed)
{
@ -79,11 +64,8 @@ InsetERT::InsetERT(string const & contents, bool collapsed)
void InsetERT::read(Buffer const * buf, LyXLex & lex)
{
InsetCollapsable::read(buf, lex);
if (collapsed_) {
setLabel(get_new_label());
} else {
setLabel(_("666"));
}
setButtonLabel();
}
@ -120,14 +102,11 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
{
InsetCollapsable::edit(bv, x, y, button);
#ifndef NO_LATEX
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
#else
LyXFont font(LyXFont::ALL_INHERIT);
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
font.setColor(LColor::latex);
#endif
inset.setFont(bv, font);
}
@ -212,14 +191,9 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
{
#ifndef NO_LATEX
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
#else
LyXFont font(LyXFont::ALL_INHERIT);
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
font.setColor(LColor::latex);
#endif
inset.setFont(bv, font);
}
break;
@ -236,18 +210,31 @@ string const InsetERT::get_new_label() const
string la;
Paragraph::size_type const max_length = 15;
int const n = std::min(max_length, inset.paragraph()->size());
int const p_siz = inset.paragraph()->size();
int const n = std::min(max_length, p_siz);
int i = 0;
int j = 0;
for(; i < n && j < inset.paragraph()->size(); ++j) {
for(; i < n && j < p_siz; ++j) {
if (inset.paragraph()->isInset(j))
continue;
la += inset.paragraph()->getChar(j);
++i;
}
if ((i > 0) && (j < inset.paragraph()->size()))
if (i > 0 && j < p_siz) {
la += "...";
if (la.empty())
}
if (la.empty()) {
la = _("666");
}
return la;
}
void InsetERT::setButtonLabel()
{
if (collapsed_) {
setLabel(get_new_label());
} else {
setLabel(_("666"));
}
}

View File

@ -68,6 +68,8 @@ private:
void init();
///
string const get_new_label() const;
///
void setButtonLabel();
};
#endif

View File

@ -237,8 +237,13 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
token = lex.GetString();
if (token.empty())
continue;
if (token == "\\end_inset")
if (token == "\\end_inset") {
#ifdef NO_LATEX
const_cast<Buffer*>(buf)->insertErtContents(par, pos, font, false);
#endif
break;
}
if (const_cast<Buffer*>(buf)->
parseSingleLyXformat2Token(lex, par, return_par,
token, pos, depth, font)) {