More fixes to InsetERT (hopefully the last ones for now).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3673 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-03-06 10:17:29 +00:00
parent 26f07a39bc
commit dfcfccfc36
5 changed files with 31 additions and 5 deletions

View File

@ -9,6 +9,7 @@ src/converter.C
src/CutAndPaste.C
src/debug.C
src/exporter.C
src/ext_l10n.h
src/FontLoader.C
src/frontends/controllers/biblio.C
src/frontends/controllers/ButtonController.h

View File

@ -1,3 +1,8 @@
2002-03-06 Juergen Vigna <jug@sad.it>
* text.C (prepareToPrint): leave ERT inset left aligned
(leftMargin): don't indent paragraphs inside ERT insets
2002-03-06 Lars Gullik Bjønnes <larsbj@birdstep.com>
* paragraph.C (breakParagraph): dont call clear do the work manually

View File

@ -1,3 +1,8 @@
2002-03-06 Juergen Vigna <jug@sad.it>
* insetert.C (status): pay attention the bv can be 0 here!
(getMaxWidth): add the default leftMargin
2002-03-06 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetert.C (getMaxWidth): make w unsigned int.

View File

@ -623,6 +623,7 @@ void InsetERT::set_latex_font(BufferView * /* bv */)
}
// attention this function can be called with bv == 0
void InsetERT::status(BufferView * bv, ERTStatus const st) const
{
if (st != status_) {
@ -630,7 +631,8 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
need_update = FULL;
switch (st) {
case Inlined:
inset.setUpdateStatus(bv, InsetText::INIT);
if (bv)
inset.setUpdateStatus(bv, InsetText::INIT);
break;
case Open:
collapsed_ = false;
@ -693,11 +695,15 @@ void InsetERT::getDrawFont(LyXFont & font) const
int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
{
unsigned int w = InsetCollapsable::getMaxWidth(bv, in);
int w = InsetCollapsable::getMaxWidth(bv, in);
if (status_ != Inlined || w < 0)
return w;
LyXText * text = inset.getLyXText(bv);
if (text->width < w && !text->firstRow()->next())
int rw = text->firstRow()->width();
if (!rw)
rw = w;
rw += 40;
if (!text->firstRow()->next() && rw < w)
return -1;
return w;
}

View File

@ -834,8 +834,10 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
&& ! row->par()->isFirstInSequence()))
&& align == LYX_ALIGN_BLOCK
&& !row->par()->params().noindent()
// in tabulars paragraphs are never indented!
&& (!row->par()->inInset() || row->par()->inInset()->owner()->lyxCode() != Inset::TABULAR_CODE)
// in tabulars and ert paragraphs are never indented!
&& (!row->par()->inInset() || !row->par()->inInset()->owner() ||
(row->par()->inInset()->owner()->lyxCode() != Inset::TABULAR_CODE &&
row->par()->inInset()->owner()->lyxCode() != Inset::ERT_CODE))
&& (row->par()->layout() != tclass.defaultLayoutName() ||
bview->buffer()->params.paragraph_separation ==
BufferParams::PARSEP_INDENT)) {
@ -2116,6 +2118,13 @@ void LyXText::prepareToPrint(BufferView * bview,
&& (inset->display())) // || (inset->scroll() < 0)))
align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
// ERT insets should always be LEFT ALIGNED on screen
inset = row->par()->inInset();
if (inset && inset->owner() &&
inset->owner()->lyxCode() == Inset::ERT_CODE)
{
align = LYX_ALIGN_LEFT;
}
switch (align) {
case LYX_ALIGN_BLOCK: