]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
Change the latex font names in order to match the names of type1inst.
[lyx.git] / src / text.C
index 2d7197b7708110983235eb87f4f934d2f44f443e..296b9c49d5b2173d037c068896bc93b0e923adac 100644 (file)
@@ -476,18 +476,26 @@ void LyXText::drawInset(DrawRowParams & p, pos_type const pos)
        }
  
        LyXFont const & font = getFont(p.bv->buffer(), p.row->par(), pos);
+
        inset->update(p.bv, font, false);
        inset->draw(p.bv, font, p.yo + p.row->baseline(), p.x, p.cleared);
  
        if (!need_break_row && !inset_owner 
-               && p.bv->text->status() == CHANGED_IN_DRAW) {
+           && p.bv->text->status() == CHANGED_IN_DRAW) {
                Row * prev = p.row->previous();
                if (prev && prev->par() == p.row->par()) {
                        breakAgainOneRow(p.bv, prev);
-               } 
+                       if (prev->next() != p.row) {
+                               // breakAgainOneRow() has removed p.row
+                               p.row = 0;  // see what this breaks
+                               need_break_row = prev;
+                       } else {
+                               need_break_row = p.row;
+                       }
+               } else {
+                       need_break_row = p.row;
+               }
                setCursor(p.bv, cursor.par(), cursor.pos());
-               need_break_row = p.row;
        }
 }
 
@@ -955,26 +963,25 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
                while (doitonetime || ((x < width) && (i < last))) {
                        doitonetime = false;
                        char const c = par->getChar(i);
+                       Inset * in = 0;
+                       if (c == Paragraph::META_INSET)
+                               in = par->getInset(i);
                        if (IsNewlineChar(c)) {
                                last_separator = i;
                                x = width; // this means break
-                       } else if (c == Paragraph::META_INSET &&
-                                  par->getInset(i)) {
-                               
+                       } else if (in && !in->isChar()) {
                                // check wether a Display() inset is
                                // valid here. if not, change it to
                                // non-display
-                               if (par->getInset(i)->display() &&
+                               if (in->display() &&
                                    (layout.isCommand() ||
                                     (layout.labeltype == LABEL_MANUAL
                                      && i < beginningOfMainBody(bview->buffer(), par))))
                                {
                                        // display istn't allowd
-                                       par->getInset(i)->display(false);
+                                       in->display(false);
                                        x += singleWidth(bview, par, i, c);
-                               } else if (par->getInset(i)->display() ||
-                                          par->getInset(i)->needFullRow())
-                               {
+                               } else if (in->display() || in->needFullRow()) {
                                        // So break the line here
                                        if (i == pos) {
                                                if (pos < last-1) {
@@ -1000,7 +1007,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
                                                last_separator = i - 1;
                                }
                        } else  {
-                               if (IsLineSeparatorChar(c))
+                               if (IsLineSeparatorChar(c, in))
                                        last_separator = i;
                                x += singleWidth(bview, par, i, c);
                        }
@@ -1034,7 +1041,6 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
        if (main_body && last_separator < main_body)
                last_separator = main_body - 1;
        
-       lyxerr << last_separator << ":" << pos << endl;
        return last_separator;
 }
 
@@ -1549,6 +1555,8 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
        float x = 0;
        if (layout.margintype != MARGIN_RIGHT_ADDRESS_BOX) {
                float dummy;
+               // this IS needed
+               row_ptr->width(maxwidth);
                prepareToPrint(bview, row_ptr, x, dummy, dummy, dummy, false);
        }
        row_ptr->width(int(maxwidth + x));
@@ -1661,7 +1669,7 @@ void LyXText::breakAgainOneRow(BufferView * bview, Row * row)
                        row = row->next();
                        row->height(0);
                } else  {
-                       row= row->next();
+                       row = row->next();
                        ++z;
                        if (row->pos() != z)
                                row->pos(z);
@@ -1892,8 +1900,8 @@ void LyXText::insertChar(BufferView * bview, char c)
                        return;
                }
        } else if (IsNewlineChar(c)) {
-               if (cursor.par() == cursor.par()
-                   && cursor.pos() <= beginningOfMainBody(bview->buffer(), cursor.par())) {
+               if (cursor.pos() <= beginningOfMainBody(bview->buffer(),
+                                                       cursor.par())) {
                        charInserted();
                        return;
                }
@@ -2080,7 +2088,7 @@ void LyXText::prepareToPrint(BufferView * bview,
        fill_separator = 0;
        fill_label_hfill = 0;
 
-        bool const is_rtl =
+       bool const is_rtl =
                row->par()->isRightToLeftPar(bview->buffer()->params);
        if (is_rtl) {
                x = (workWidth(bview) > 0)
@@ -2107,7 +2115,10 @@ void LyXText::prepareToPrint(BufferView * bview,
        if (nh) {
                if (w > 0)
                        fill_hfill = w / nh;
-       } else  {
+       // we don't have to look at the alignment if it is ALIGN_LEFT and
+       // if the row is already larger then the permitted width as then
+       // we force the LEFT_ALIGN'edness!
+       } else if (static_cast<int>(row->width()) < workWidth(bview)) {
                // is it block, flushleft or flushright? 
                // set x how you need it
                int align;
@@ -2350,9 +2361,7 @@ string const LyXText::selectNextWordToSpellcheck(BufferView * bview,
                        value += float(cursor.y())/float(height);
                        return str;
                }
-#warning Dekel please have a look on this one RTL? (Jug)
-#warning DEKEL!
-               // we have to go on checking so move cusor to the right
+               // we have to go on checking so move cusor to the next char
                if (cursor.pos() == cursor.par()->size()) {
                        if (!cursor.par()->next())
                                return str;