mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Small fixes + hfill display/draw bug (seen with minipages!).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2487 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d5eb253d6a
commit
57920ce17b
@ -1,5 +1,7 @@
|
||||
2001-08-10 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* text.C (prepareToPrint): fixed hfill-width in draw!
|
||||
|
||||
* BufferView2.C (selectLastWord): save the selection cursor as this
|
||||
now is cleared in the function LyXText::clearSelection!
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
2001-08-10 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettabular.C (selectNextWordInt): use the front using edit call.
|
||||
|
||||
* insetcollapsable.C (getMaxWidth): rename inset to in to not have
|
||||
the parameter overwrite class variable inset.
|
||||
|
||||
* inset.C (getMaxWidth): fix the setting of the minwidth = 10.
|
||||
|
||||
* insettext.C (saveLyXTextState): check for invalid cursor-par.
|
||||
(reinitLyXText): remove wrong_cursor bool as not needed anymore!
|
||||
|
||||
|
@ -324,15 +324,12 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
||||
if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0)
|
||||
w -= (2 * TEXT_TO_INSET_OFFSET) + 5;
|
||||
if (topx_set) {
|
||||
if ((w - top_x) < 10) {
|
||||
w = 10; // minimum I require!!!
|
||||
} else {
|
||||
w -= top_x;
|
||||
if (owner()) {
|
||||
w += owner()->x();
|
||||
}
|
||||
w -= top_x;
|
||||
if (owner()) {
|
||||
w += owner()->x();
|
||||
}
|
||||
} else if (w < 10) {
|
||||
}
|
||||
if (w < 10) {
|
||||
w = 10;
|
||||
}
|
||||
return w;
|
||||
|
@ -377,10 +377,10 @@ int InsetCollapsable::latex(Buffer const * buf, ostream & os,
|
||||
|
||||
|
||||
int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||
UpdatableInset const * inset) const
|
||||
UpdatableInset const * in) const
|
||||
{
|
||||
#if 0
|
||||
int const w = UpdatableInset::getMaxWidth(bv, inset);
|
||||
int const w = UpdatableInset::getMaxWidth(bv, in);
|
||||
|
||||
if (w < 0) {
|
||||
// What does a negative max width signify? (Lgb)
|
||||
@ -390,7 +390,7 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||
// should be at least 30 pixels !!!
|
||||
return max(30, w - width_collapsed());
|
||||
#else
|
||||
return UpdatableInset::getMaxWidth(bv, inset);
|
||||
return UpdatableInset::getMaxWidth(bv, in);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -341,8 +341,9 @@ int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
|
||||
if (!width_.empty()) {
|
||||
int ww1 = VSpace(width_).inPixels(bv);
|
||||
int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
|
||||
if (ww2 > 0 && ww2 < ww1)
|
||||
if (ww2 > 0 && ww2 < ww1) {
|
||||
return ww2;
|
||||
}
|
||||
return ww1;
|
||||
}
|
||||
// this should not happen!
|
||||
|
@ -2524,7 +2524,7 @@ string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
|
||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||
UpdatableInset * inset =
|
||||
static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
|
||||
inset->edit(bv, 0, 0, 0);
|
||||
inset->edit(bv);
|
||||
return selectNextWordInt(bv, value);
|
||||
}
|
||||
|
||||
|
86
src/text.C
86
src/text.C
@ -138,7 +138,7 @@ int LyXText::singleWidth(BufferView * bview, Paragraph * par,
|
||||
|
||||
|
||||
int LyXText::singleWidth(BufferView * bview, Paragraph * par,
|
||||
Paragraph::size_type pos, char c) const
|
||||
Paragraph::size_type pos, char c) const
|
||||
{
|
||||
LyXFont const font = getFont(bview->buffer(), par, pos);
|
||||
|
||||
@ -1134,7 +1134,7 @@ int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const
|
||||
// returns true, if a expansion is needed.
|
||||
// Rules are given by LaTeX
|
||||
bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr,
|
||||
Paragraph::size_type pos) const
|
||||
Paragraph::size_type pos) const
|
||||
{
|
||||
// by the way, is it a hfill?
|
||||
if (!row_ptr->par()->isHfill(pos))
|
||||
@ -1991,11 +1991,11 @@ void LyXText::charInserted()
|
||||
|
||||
|
||||
void LyXText::prepareToPrint(BufferView * bview,
|
||||
Row * row, float & x,
|
||||
float & fill_separator,
|
||||
float & fill_hfill,
|
||||
float & fill_label_hfill,
|
||||
bool bidi) const
|
||||
Row * row, float & x,
|
||||
float & fill_separator,
|
||||
float & fill_hfill,
|
||||
float & fill_label_hfill,
|
||||
bool bidi) const
|
||||
{
|
||||
float nlh;
|
||||
float ns;
|
||||
@ -2030,45 +2030,49 @@ void LyXText::prepareToPrint(BufferView * bview,
|
||||
// are there any hfills in the row?
|
||||
float const nh = numberOfHfills(bview->buffer(), row);
|
||||
|
||||
if (nh)
|
||||
fill_hfill = w / nh;
|
||||
else {
|
||||
if (nh) {
|
||||
if (w > 0)
|
||||
fill_hfill = w / nh;
|
||||
} else {
|
||||
// is it block, flushleft or flushright?
|
||||
// set x how you need it
|
||||
int align;
|
||||
if (row->par()->params().align() == LYX_ALIGN_LAYOUT)
|
||||
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()).align;
|
||||
else
|
||||
align = row->par()->params().align();
|
||||
|
||||
// center displayed insets
|
||||
Inset * inset;
|
||||
if (row->par()->getChar(row->pos()) == Paragraph::META_INSET
|
||||
&& (inset=row->par()->getInset(row->pos()))
|
||||
&& (inset->display())) // || (inset->scroll() < 0)))
|
||||
align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
|
||||
? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
|
||||
|
||||
switch (align) {
|
||||
int align;
|
||||
if (row->par()->params().align() == LYX_ALIGN_LAYOUT) {
|
||||
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()).align;
|
||||
} else {
|
||||
align = row->par()->params().align();
|
||||
}
|
||||
|
||||
// center displayed insets
|
||||
Inset * inset;
|
||||
if (row->par()->getChar(row->pos()) == Paragraph::META_INSET
|
||||
&& (inset=row->par()->getInset(row->pos()))
|
||||
&& (inset->display())) // || (inset->scroll() < 0)))
|
||||
align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
|
||||
? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
|
||||
|
||||
switch (align) {
|
||||
case LYX_ALIGN_BLOCK:
|
||||
ns = numberOfSeparators(bview->buffer(), row);
|
||||
if (ns && row->next() && row->next()->par() == row->par() &&
|
||||
!(row->next()->par()->isNewline(row->next()->pos() - 1))
|
||||
&& !(row->next()->par()->getChar(row->next()->pos()) == Paragraph::META_INSET
|
||||
&& row->next()->par()->getInset(row->next()->pos())
|
||||
&& row->next()->par()->getInset(row->next()->pos())->display())
|
||||
)
|
||||
fill_separator = w / ns;
|
||||
else if (is_rtl)
|
||||
x += w;
|
||||
break;
|
||||
ns = numberOfSeparators(bview->buffer(), row);
|
||||
if (ns && row->next() && row->next()->par() == row->par() &&
|
||||
!(row->next()->par()->isNewline(row->next()->pos() - 1))
|
||||
&& !(row->next()->par()->getChar(row->next()->pos()) == Paragraph::META_INSET
|
||||
&& row->next()->par()->getInset(row->next()->pos())
|
||||
&& row->next()->par()->getInset(row->next()->pos())->display())
|
||||
)
|
||||
{
|
||||
fill_separator = w / ns;
|
||||
} else if (is_rtl) {
|
||||
x += w;
|
||||
}
|
||||
break;
|
||||
case LYX_ALIGN_RIGHT:
|
||||
x += w;
|
||||
break;
|
||||
x += w;
|
||||
break;
|
||||
case LYX_ALIGN_CENTER:
|
||||
x += w / 2;
|
||||
break;
|
||||
}
|
||||
x += w / 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bidi)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user