]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
mathed31.diff
[lyx.git] / src / text.C
index 64fa5b2615dca7444bec1a95e5f570577a28b255..2964b22df4da5a8e38e7376e1fe31af268c7598e 100644 (file)
@@ -54,6 +54,15 @@ int LyXText::workWidth(BufferView * bview) const
 }
 
 
+int LyXText::GetRealCursorX(BufferView * bview) const
+{
+       int x = cursor.x();
+       if (the_locking_inset && (the_locking_inset->getLyXText(bview)!=this))
+               x = the_locking_inset->getLyXText(bview)->GetRealCursorX(bview);
+       return x;
+}
+
+
 unsigned char LyXText::TransformChar(unsigned char c, LyXParagraph * par,
                        LyXParagraph::size_type pos) const
 {
@@ -2412,7 +2421,7 @@ void LyXText::SelectWord(BufferView * bview)
        SetCursor(bview, cursor.par(), cursor.pos() );
        
        // finally set the selection
-       SetSelection();
+       SetSelection(bview);
 }
 
 
@@ -2523,7 +2532,7 @@ void LyXText::SelectSelectedWord(BufferView * bview)
        SetCursor(bview, cursor.par(), cursor.pos());
        
        // finally set the selection
-       SetSelection();
+       SetSelection(bview);
 }
 
 
@@ -2540,7 +2549,7 @@ void LyXText::DeleteWordForward(BufferView * bview)
                SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
                sel_cursor = cursor;
                cursor = tmpcursor;
-               SetSelection(); 
+               SetSelection(bview); 
                
                /* -----> Great, CutSelection() gets rid of multiple spaces. */
                CutSelection(bview);
@@ -2561,7 +2570,7 @@ void LyXText::DeleteWordBackward(BufferView * bview)
               SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
               sel_cursor = cursor;
               cursor = tmpcursor;
-              SetSelection();
+              SetSelection(bview);
               CutSelection(bview);
        }
 }
@@ -2583,7 +2592,7 @@ void LyXText::DeleteLineForward(BufferView * bview)
                SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
                sel_cursor = cursor;
                cursor = tmpcursor;
-               SetSelection();
+               SetSelection(bview);
                // What is this test for ??? (JMarc)
                if (!selection) {
                        DeleteWordForward(bview);
@@ -3088,15 +3097,12 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
 #warning Should be fixed with a lyxinset::clear_width(bv, font) function! (Jug)
 #warning Should we not fix this in the Painter, please have a look Lars! (Jug)
 #endif
-               int w = (inset_owner ? inset_owner->width(bview, font)-2 : ww);
-               int h = row_ptr->height();
-               int x = x_offset;
-               int y = y_offset;
-               if (y < 0) {
-                   h += y;
-                   y = 0;
-               }
-
+               int const y = y_offset < 0 ? 0 : y_offset;
+               int const h = y_offset < 0 ?
+                       row_ptr->height() + y_offset : row_ptr->height();
+               int const w = inset_owner ?
+                       inset_owner->width(bview, font) - 2 : ww;
+               int const x = x_offset;
                pain.fillRectangle(x, y, w, h);
        } else if (inset != 0) {
                int h = row_ptr->baseline() - inset->ascent(bview, font);