2001-08-10 Juergen Vigna <jug@sad.it>
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!
* BufferView2.C (selectLastWord): save the selection cursor as this
now is cleared in the function LyXText::clearSelection!
2001-08-10 Juergen Vigna <jug@sad.it>
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!
* insettext.C (saveLyXTextState): check for invalid cursor-par.
(reinitLyXText): remove wrong_cursor bool as not needed anymore!
if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0)
w -= (2 * TEXT_TO_INSET_OFFSET) + 5;
if (topx_set) {
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();
int InsetCollapsable::getMaxWidth(BufferView * bv,
int InsetCollapsable::getMaxWidth(BufferView * bv,
- UpdatableInset const * inset) const
+ UpdatableInset const * in) const
- 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)
if (w < 0) {
// What does a negative max width signify? (Lgb)
// should be at least 30 pixels !!!
return max(30, w - width_collapsed());
#else
// should be at least 30 pixels !!!
return max(30, w - width_collapsed());
#else
- return UpdatableInset::getMaxWidth(bv, inset);
+ return UpdatableInset::getMaxWidth(bv, in);
if (!width_.empty()) {
int ww1 = VSpace(width_).inPixels(bv);
int ww2 = InsetCollapsable::getMaxWidth(bv, 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 ww1;
}
// this should not happen!
return ww1;
}
// this should not happen!
// otherwise we have to lock the next inset and ask for it's selecttion
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
// 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);
return selectNextWordInt(bv, value);
}
return selectNextWordInt(bv, value);
}
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);
{
LyXFont const font = getFont(bview->buffer(), par, pos);
// returns true, if a expansion is needed.
// Rules are given by LaTeX
bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr,
// 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))
{
// by the way, is it a hfill?
if (!row_ptr->par()->isHfill(pos))
void LyXText::prepareToPrint(BufferView * bview,
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
// are there any hfills in the row?
float const nh = numberOfHfills(bview->buffer(), row);
// 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
// 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) {
- 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;
- x += w / 2;
- break;
- }
+ x += w / 2;
+ break;
+ }