+2003-08-22 André Pönitz <poenitz@gmx.net>
+
+ * lyxrow.[Ch]: add x_ and *fill_ members
+
+ * lyxtext.h:
+ * text.C:
+ * rowpainter.C:
+ * text2.C: adjust/remove prepareToPrint() calls
+
2003-08-22 André Pönitz <poenitz@gmx.net>
* lyxrow.[Ch]: add end_ member
* text.C (redoParagraph): simplify row breaking logic
+
2003-08-19 André Pönitz <poenitz@gmx.net>
* funcrequest.C: initialize button_ member
Row::Row()
: pos_(0), end_(0), fill_(0), height_(0), width_(0), y_(0),
- ascent_of_text_(0), baseline_(0)
+ ascent_of_text_(0), baseline_(0),
+ x_(0), fill_separator_(0), fill_hfill_(0), fill_label_hfill_(0)
{}
Row::Row(pos_type pos)
: pos_(pos), end_(0), fill_(0), height_(0), width_(0), y_(0),
- ascent_of_text_(0), baseline_(0)
+ ascent_of_text_(0), baseline_(0),
+ x_(0), fill_separator_(0), fill_hfill_(0), fill_label_hfill_(0)
{}
}
+float Row::x() const
+{
+ return x_;
+}
+
+
+void Row::x(float f)
+{
+ x_ = f;
+}
+
+
+float Row::fill_separator() const
+{
+ return fill_separator_;
+}
+
+
+void Row::fill_separator(float f)
+{
+ fill_separator_ = f;
+}
+
+
+float Row::fill_hfill() const
+{
+ return fill_hfill_;
+}
+
+
+void Row::fill_hfill(float f)
+{
+ fill_hfill_ = f;
+}
+
+
+float Row::fill_label_hfill() const
+{
+ return fill_label_hfill_;
+}
+
+
+void Row::fill_label_hfill(float f)
+{
+ fill_label_hfill_ = f;
+}
+
+
bool Row::isParStart() const
{
return !pos();
unsigned int y() const;
/// cache the y position
void y(unsigned int newy);
+ ///
+ float x() const;
+ ///
+ void x(float);
+ ///
+ float fill_separator() const;
+ ///
+ void fill_separator(float);
+ ///
+ float fill_hfill() const;
+ ///
+ void fill_hfill(float);
+ ///
+ float fill_label_hfill() const;
+ ///
+ void fill_label_hfill(float);
/// current debugging only
void dump(const char * = "") const;
private:
unsigned int top_of_text_;
///
unsigned int baseline_;
+ /// offet from left border
+ float x_;
+ ///
+ float fill_separator_;
+ ///
+ float fill_hfill_;
+ ///
+ float fill_label_hfill_;
};
#endif
/** this calculates the specified parameters. needed when setting
* the cursor and when creating a visible row */
- void prepareToPrint(
- ParagraphList::iterator pit,
- RowList::iterator row, double & x,
- double & fill_separator,
- double & fill_hfill,
- double & fill_label_hfill,
- bool bidi = true) const;
+ void prepareToPrint(ParagraphList::iterator pit,
+ RowList::iterator row) const;
private:
///
void RowPainter::paint()
{
- width_ = text_.workWidth();
-
- // FIXME: must be a cleaner way here. Aren't these calculations
- // belonging to row metrics ?
- text_.prepareToPrint(pit_, row_, x_, separator_, hfill_, label_hfill_);
+ width_ = text_.workWidth();
+ x_ = row_->x();
+ separator_ = row_->fill_separator();
+ hfill_ = row_->fill_hfill();
+ label_hfill_ = row_->fill_label_hfill();
// FIXME: what is this fixing ?
if (text_.isInInset() && x_ < 0)
}
char const c = pit->getChar(i);
+ if (i > endPosOfFontSpan) {
+ font = getFont(pit, i);
+ endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
+ }
int thiswidth;
double x = 0;
if (layout->margintype != MARGIN_RIGHT_ADDRESS_BOX) {
+#warning needed?
+#if 0
// this IS needed
rit->width(maxwidth);
double dummy;
prepareToPrint(pit, rit, x, dummy, dummy, dummy, false);
+#endif
}
rit->width(int(maxwidth + x));
if (inset_owner) {
void LyXText::charInserted()
{
- // Here we could call FinishUndo for every 20 characters inserted.
+ // Here we could call finishUndo for every 20 characters inserted.
// This is from my experience how emacs does it. (Lgb)
static unsigned int counter;
if (counter < 20) {
void LyXText::prepareToPrint(ParagraphList::iterator pit,
- RowList::iterator rit, double & x,
- double & fill_separator,
- double & fill_hfill,
- double & fill_label_hfill,
- bool bidi) const
+ RowList::iterator const rit) const
{
double w = rit->fill();
- fill_hfill = 0;
- fill_label_hfill = 0;
- fill_separator = 0;
- fill_label_hfill = 0;
+ double fill_hfill = 0;
+ double fill_label_hfill = 0;
+ double fill_separator = 0;
+ double x = 0;
bool const is_rtl =
pit->isRightToLeftPar(bv()->buffer()->params);
break;
}
}
- if (!bidi)
- return;
computeBidiTables(pit, bv()->buffer(), rit);
if (is_rtl) {
pos_type last = lastPos(*pit, rit);
if (body_pos > 0 &&
- (body_pos - 1 > last ||
- !pit->isLineSeparator(body_pos - 1))) {
+ (body_pos - 1 > last ||
+ !pit->isLineSeparator(body_pos - 1))) {
x += font_metrics::width(layout->labelsep, getLabelFont(pit));
if (body_pos - 1 <= last)
x += fill_label_hfill;
}
}
+
+ rit->fill_hfill(fill_hfill);
+ rit->fill_label_hfill(fill_label_hfill);
+ rit->fill_separator(fill_separator);
+ rit->x(x);
}
// set height and fill of rows
for (rit = pit->rows.begin(); rit != end; ++rit) {
rit->fill(fill(pit, rit, workWidth()));
+ prepareToPrint(pit, rit);
setHeightOfRow(pit, rit);
}
float LyXText::getCursorX(ParagraphList::iterator pit, RowList::iterator rit,
pos_type pos, pos_type last, bool boundary) const
{
- pos_type cursor_vpos = 0;
- double x;
- double fill_separator;
- double fill_hfill;
- double fill_label_hfill;
- // This call HAS to be here because of the BidiTables!!!
- prepareToPrint(pit, rit, x, fill_separator, fill_hfill,
- fill_label_hfill);
-
- pos_type const rit_pos = rit->pos();
+ pos_type cursor_vpos = 0;
+ double x = rit->x();
+ double fill_separator = rit->fill_separator();
+ double fill_hfill = rit->fill_hfill();
+ double fill_label_hfill = rit->fill_label_hfill();
+ pos_type const rit_pos = rit->pos();
if (last < rit_pos)
cursor_vpos = rit_pos;
pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
RowList::iterator rit, int & x, bool & boundary) const
{
- double tmpx = 0;
- double fill_separator;
- double fill_hfill;
- double fill_label_hfill;
-
- prepareToPrint(pit, rit, tmpx, fill_separator, fill_hfill, fill_label_hfill);
+ double tmpx = rit->x();
+ double fill_separator = rit->fill_separator();
+ double fill_hfill = rit->fill_hfill();
+ double fill_label_hfill = rit->fill_label_hfill();
pos_type vc = rit->pos();
pos_type last = lastPrintablePos(*pit, rit);