]> git.lyx.org Git - features.git/commitdiff
Fixed make updatesrc in forms directory. Various fixes for text insets,
authorJürgen Vigna <jug@sad.it>
Mon, 19 Jun 2000 15:33:58 +0000 (15:33 +0000)
committerJürgen Vigna <jug@sad.it>
Mon, 19 Jun 2000 15:33:58 +0000 (15:33 +0000)
so now selection should work.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@821 a592a061-630c-0410-9148-cb99ea01b6c8

26 files changed:
ChangeLog
forms/layout_forms.fd
forms/makefile
src/BufferView.C
src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/bullet_forms.h
src/credits_form.h
src/form1.h
src/insets/insetert.C
src/insets/insetfoot.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/latexoptions.h
src/layout_forms.C
src/layout_forms.h
src/lyx.h
src/lyx_sendfax.h
src/mathed/math_forms.h
src/print_form.h
src/sp_form.h
src/text.C
src/vspace.C

index 804c2234c9bea395c85a896a85dcf9d33ed5e895..4551cb6cb7226ef86efab491b4745099bf97fbf1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2000-06-19  Juergen Vigna  <jug@sad.it>
+
+       * src/BufferView.h: added screen() function.
+
+       * src/insets/insettext.C (LocalDispatch): some selection code
+       fixed.
+
+       * src/vspace.C (nextToken): use stringfunctions instead of sscanf.
+
+       * src/insets/insettext.C (SetParagraphData):
+       (Read): 
+       (InsetText):  fixes for multiple paragraphs.
+
 2000-06-17  Kayvan A. Sylvan  <kayvan@sylvan.com>
 
        * development/lyx.spec.in: Call configure with ``--without-warnings''
index a371daedfad4ee72b1ec97306bd8a22aa1af5228..7561f29f71c28f15d9f8ffcac7ff4ca9b86e3c03 100644 (file)
@@ -554,8 +554,8 @@ callback:
 argument: 
 
 --------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
+class: FL_BOX
+type: FRAME_BOX
 box: 120 190 190 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_COL1
@@ -717,14 +717,14 @@ argument: 0
 
 =============== FORM ===============
 Name: form_character
-Width: 295
-Height: 385
+Width: 300
+Height: 415
 Number of Objects: 16
 
 --------------------
 class: FL_BOX
 type: UP_BOX
-box: 0 0 295 385
+box: 0 0 300 415
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -739,28 +739,10 @@ name:
 callback: 
 argument: 
 
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 95 155 190 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Language|#L
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_NorthEast
-name: choice_language
-callback: 
-argument: 
-
 --------------------
 class: FL_FRAME
 type: ENGRAVED_FRAME
-box: 10 295 280 45
+box: 10 325 280 45
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -778,133 +760,97 @@ argument:
 --------------------
 class: FL_FRAME
 type: ENGRAVED_FRAME
-box: 10 235 280 45
+box: 10 265 280 45
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Family:|#F
+label: 
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
-name: choice_family
+name: 
 callback: 
 argument: 
 
 --------------------
 class: FL_FRAME
 type: ENGRAVED_FRAME
-box: 10 10 280 210
+box: 10 10 280 240
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Series:|#S
+label: 
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
-name: choice_series
+name: 
 callback: 
 argument: 
 
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 94 95 191 30
+box: 94 15 191 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Shape:|#H
+label: Family:|#F
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
-name: choice_shape
+name: choice_family
 callback: 
 argument: 
 
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 94 50 191 30
+box: 94 55 191 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Color:|#C
+label: Series:|#S
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
-name: choice_color
+name: choice_series
 callback: 
 argument: 
 
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 94 85 191 30
+box: 94 95 191 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: Toggle on all these|#T
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_NorthWest FL_NorthEast
-name: check_toggle_all
-callback: 
-argument: 
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 320 280 45
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_NorthWest FL_NorthEast
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 260 280 45
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
+label: Shape:|#H
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
-name: 
+name: choice_shape
 callback: 
 argument: 
 
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 95 245 191 30
+box: 95 275 191 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -922,7 +868,7 @@ argument:
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 95 305 190 30
+box: 95 335 190 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -940,7 +886,7 @@ argument:
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 60 345 80 30
+box: 60 375 80 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -958,7 +904,7 @@ argument: 0
 --------------------
 class: FL_BUTTON
 type: RETURN_BUTTON
-box: 175 345 80 30
+box: 175 375 80 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -976,7 +922,7 @@ argument: 0
 --------------------
 class: FL_CHOICE
 type: NORMAL_CHOICE
-box: 95 120 191 30
+box: 95 135 191 30
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
@@ -994,12 +940,12 @@ argument:
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 30 190 260 25
+box: 30 215 255 25
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
 style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: Toggle on all these|#T
 shortcut: 
@@ -1012,12 +958,12 @@ argument:
 --------------------
 class: FL_TEXT
 type: NORMAL_TEXT
-box: 20 225 210 20
+box: 20 255 210 20
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
 style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: These are never toggled
 shortcut: 
@@ -1030,12 +976,12 @@ argument:
 --------------------
 class: FL_TEXT
 type: NORMAL_TEXT
-box: 20 285 215 20
+box: 20 315 215 20
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
 style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
 label: These are always toggled
 shortcut: 
@@ -1046,19 +992,19 @@ callback:
 argument: 
 
 --------------------
-class: FL_BOX
-type: FRAME_BOX
+class: FL_CHOICE
+type: DROPLIST_CHOICE
 box: 95 175 190 30
 boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_COL1
+colors: FL_COL1 FL_BLACK
 alignment: FL_ALIGN_LEFT
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
 label: Language:
 shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthWest FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_NorthWest FL_NorthEast
 name: choice_language
 callback: 
 argument: 
index b08a088588515c02041e728cd0ac809c110604a1..99dcce6f86edfa6113c29e173179f184012c1fe7 100644 (file)
@@ -17,15 +17,15 @@ SHELL = /bin/sh
 # Various commands
 FDESIGN = fdesign
 
-SRCS = bullet_forms.fd cite.fd credits_form.fd form1.fd \
+SRCS = bullet_forms.fd credits_form.fd form1.fd \
        latexoptions.fd layout_forms.fd lyx.fd lyx_sendfax.fd math_forms.fd \
        print_form.fd sp_form.fd
 
-OBJS = bullet_forms.c cite.c credits_form.c form1.c \
+OBJS = bullet_forms.c credits_form.c form1.c \
        latexoptions.c layout_forms.c lyx.c lyx_sendfax.c math_forms.c \
        print_form.c sp_form.c
 
-COBJS = bullet_forms.C cite.C credits_form.C form1.C \
+COBJS = bullet_forms.C credits_form.C form1.C \
        latexoptions.C layout_forms.C lyx.C lyx_sendfax.C math_forms.C \
        print_form.C sp_form.C
 
index 7891d1502bc036e70bfafa54503c35833a91210f..e1a72466a66283132143ed775c2186a578867369 100644 (file)
@@ -19,6 +19,7 @@
 #include "BufferView_pimpl.h"
 #include "lyxtext.h"
 #include "WorkArea.h"
+#include "lyxscreen.h"
 
 
 BufferView::BufferView(LyXView * o, int xpos, int ypos,
@@ -44,6 +45,12 @@ Buffer * BufferView::buffer() const
 }
 
 
+LyXScreen * BufferView::screen() const
+{
+       return pimpl_->screen_;
+}
+
+
 LyXView * BufferView::owner() const
 {
        return pimpl_->owner_;
index 4db6866c59bf606b200363714d0449b65bbb5266..91033dbc6c201f1f1788626d69c9d143cca36726 100644 (file)
@@ -23,6 +23,7 @@ class LyXView;
 class LyXText;
 class TeXErrors;
 class Buffer;
+class LyXScreen;
 
 ///
 class BufferView {
@@ -44,6 +45,8 @@ public:
        ///
        Painter & painter();
        ///
+       LyXScreen * screen() const;
+       ///
        void buffer(Buffer * b);
        ///
        void resize(int, int, int, int);
index 61f26c0ead0ed88f77e78165c2d831ed8b32c0f7..ecc4c117188ffafbc2d4be73f239ed7803761a13 100644 (file)
@@ -745,7 +745,7 @@ void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
                        text->SetCursor(this, cursor,
                                        cursor.par(), cursor.pos() - 1);
                y += cursor.y() + the_locking_inset->InsetInInsetY();
-               pimpl_->screen->ShowManualCursor(x, y, asc, desc,
+               pimpl_->screen_->ShowManualCursor(x, y, asc, desc,
                                         LyXScreen::BAR_SHAPE);
        }
 }
@@ -754,7 +754,7 @@ void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
 void BufferView::hideLockedInsetCursor()
 {
        if (the_locking_inset && available()) {
-               pimpl_->screen->HideCursor();
+               pimpl_->screen_->HideCursor();
        }
 }
 
@@ -763,7 +763,7 @@ void BufferView::fitLockedInsetCursor(long x, long y, int asc, int desc)
 {
        if (the_locking_inset && available()){
                y += text->cursor.y() + the_locking_inset->InsetInInsetY();
-               if (pimpl_->screen->FitManualCursor(x, y, asc, desc))
+               if (pimpl_->screen_->FitManualCursor(x, y, asc, desc))
                        updateScrollbar();
        }
 }
index 8613ee40b5c8d057ec5756a3fb49849f3dfee19f..7ec6c4902e4f6973f8e8051aba4910fc061b5dca 100644 (file)
@@ -72,7 +72,7 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
 {
        buffer_ = 0;
        workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
-       screen = 0;
+       screen_ = 0;
 
        cursor_timeout.callback(BufferView::cursorToggleCB, bv_);
        current_scrollbar_value = 0;
@@ -116,8 +116,8 @@ void BufferView::Pimpl::buffer(Buffer * b)
        
        // Nuke old image
        // screen is always deleted when the buffer is changed.
-       delete screen;
-       screen = 0;
+       delete screen_;
+       screen_ = 0;
 
        // If we are closing the buffer, use the first buffer as current
        if (!buffer_) {
@@ -135,7 +135,7 @@ void BufferView::Pimpl::buffer(Buffer * b)
                        updateScreen();
                        updateScrollbar();
                }
-               screen->first = screen->TopCursorVisible();
+               screen_->first = screen_->TopCursorVisible();
                redraw();
                owner_->getDialogs()->updateBufferDependent();
                bv_->insetWakeup();
@@ -184,9 +184,9 @@ void BufferView::Pimpl::redraw()
 
 bool BufferView::Pimpl::fitCursor()
 {
-       Assert(screen); // it is a programming error to call fitCursor
+       Assert(screen_); // it is a programming error to call fitCursor
        // without a valid screen.
-       bool ret = screen->FitCursor();
+       bool ret = screen_->FitCursor();
        if (ret) updateScrollbar();
        return ret;
 }
@@ -266,7 +266,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                        bv_->text->selection = false;
                }
        }
-       screen->first = screen->TopCursorVisible(); /* this will scroll the
+       screen_->first = screen_->TopCursorVisible(); /* this will scroll the
                                                     * screen such that the
                                                     * cursor becomes
                                                     * visible */ 
@@ -285,10 +285,10 @@ int BufferView::Pimpl::resizeCurrentBuffer()
 
 void BufferView::Pimpl::gotoError()
 {
-       if (!screen)
+       if (!screen_)
                return;
    
-       screen->HideCursor();
+       screen_->HideCursor();
        bv_->beforeChange();
        update(BufferView::SELECT|BufferView::FITCUR);
        LyXCursor tmp;
@@ -318,8 +318,8 @@ void BufferView::Pimpl::gotoError()
 void BufferView::Pimpl::updateScreen()
 {
        // Regenerate the screen.
-       delete screen;
-       screen = new LyXScreen(*workarea_, bv_->text);
+       delete screen_;
+       screen_ = new LyXScreen(*workarea_, bv_->text);
 }
 
 
@@ -342,8 +342,8 @@ void BufferView::Pimpl::updateScrollbar()
 
        if (bv_->text)
                cbth = bv_->text->height;
-       if (screen)
-               cbsf = screen->first;
+       if (screen_)
+               cbsf = screen_->first;
 
        // check if anything has changed.
        if (max2 == cbth &&
@@ -395,23 +395,23 @@ void BufferView::Pimpl::scrollCB(double value)
        if (current_scrollbar_value < 0)
                current_scrollbar_value = 0;
    
-       if (!screen)
+       if (!screen_)
                return;
 
-       screen->Draw(current_scrollbar_value);
+       screen_->Draw(current_scrollbar_value);
 
        if (cursor_follows_scrollbar) {
                LyXText * vbt = bv_->text;
                unsigned int height = vbt->DefaultHeight();
                
-               if (vbt->cursor.y() < screen->first + height) {
+               if (vbt->cursor.y() < screen_->first + height) {
                        vbt->SetCursorFromCoordinates(bv_, 0,
-                                                     screen->first +
+                                                     screen_->first +
                                                      height);
                } else if (vbt->cursor.y() >
-                          screen->first + workarea_->height() - height) {
+                          screen_->first + workarea_->height() - height) {
                        vbt->SetCursorFromCoordinates(bv_, 0,
-                                                     screen->first +
+                                                     screen_->first +
                                                      workarea_->height()  -
                                                      height);
                }
@@ -423,7 +423,7 @@ void BufferView::Pimpl::scrollCB(double value)
 int BufferView::Pimpl::scrollUp(long time)
 {
        if (buffer_ == 0) return 0;
-       if (!screen) return 0;
+       if (!screen_) return 0;
    
        double value = workarea_->getScrollbarValue();
    
@@ -451,7 +451,7 @@ int BufferView::Pimpl::scrollUp(long time)
 int BufferView::Pimpl::scrollDown(long time)
 {
        if (buffer_ == 0) return 0;
-       if (!screen) return 0;
+       if (!screen_) return 0;
    
        double value= workarea_->getScrollbarValue();
        pair<float, float> p = workarea_->getScrollbarBounds();
@@ -484,7 +484,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
        if (!(state & Button1MotionMask))
                return;
 
-       if (buffer_ == 0 || !screen) return;
+       if (buffer_ == 0 || !screen_) return;
 
        // Check for inset locking
        if (bv_->the_locking_inset) {
@@ -492,7 +492,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
                bv_->the_locking_inset->
                        InsetMotionNotify(bv_,
                                          x - cursor.x(),
-                                         y - cursor.y() + screen->first,
+                                         y - cursor.y() + screen_->first,
                                          state);
                return;
        }
@@ -500,17 +500,17 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
        /* The selection possible is needed, that only motion events are 
         * used, where the bottom press event was on the drawing area too */
        if (selection_possible) {
-               screen->HideCursor();
+               screen_->HideCursor();
 
-               bv_->text->SetCursorFromCoordinates(bv_, x, y + screen->first);
+               bv_->text->SetCursorFromCoordinates(bv_, x, y + screen_->first);
       
                if (!bv_->text->selection)
                        update(BufferView::UPDATE); // Maybe an empty line was deleted
       
                bv_->text->SetSelection();
-               screen->ToggleToggle();
+               screen_->ToggleToggle();
                fitCursor();
-               screen->ShowCursor();
+               screen_->ShowCursor();
        }
        return;
 }
@@ -523,7 +523,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        last_click_x = -1;
        last_click_y = -1;
 
-       if (buffer_ == 0 || !screen) return;
+       if (buffer_ == 0 || !screen_) return;
 
        Inset * inset_hit = checkInsetHit(xpos, ypos, button);
 
@@ -557,15 +557,15 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        
        if (!inset_hit)
                selection_possible = true;
-       screen->HideCursor();
+       screen_->HideCursor();
 
 #ifndef NEW_TABULAR
        // Right button mouse click on a table
        if (button == 3 &&
            (bv_->text->cursor.par()->table ||
-            bv_->text->MouseHitInTable(bv_, xpos, ypos + screen->first))) {
+            bv_->text->MouseHitInTable(bv_, xpos, ypos + screen_->first))) {
                // Set the cursor to the press-position
-               bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen->first);
+               bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen_->first);
                bool doit = true;
                
                // Only show the table popup if the hit is in
@@ -577,10 +577,10 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                // Hit above or below the table?
                if (doit) {
                        if (!bv_->text->selection) {
-                               screen->ToggleSelection();
+                               screen_->ToggleSelection();
                                bv_->text->ClearSelection();
                                bv_->text->FullRebreak(bv_);
-                               screen->Update();
+                               screen_->Update();
                                updateScrollbar();
                        }
                        // Popup table popup when on a table.
@@ -598,7 +598,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        }
 #endif
        
-       int screen_first = screen->first;
+       int screen_first = screen_->first;
        
        // Middle button press pastes if we have a selection
        bool paste_internally = false;
@@ -609,10 +609,10 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        }
        
        // Clear the selection
-       screen->ToggleSelection();
+       screen_->ToggleSelection();
        bv_->text->ClearSelection();
        bv_->text->FullRebreak(bv_);
-       screen->Update();
+       screen_->Update();
        updateScrollbar();
        
        // Single left click in math inset?
@@ -664,11 +664,11 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
 {
        // select a word
        if (buffer_ && !bv_->the_locking_inset) {
-               if (screen && button == 1) {
-                       screen->HideCursor();
-                       screen->ToggleSelection();
+               if (screen_ && button == 1) {
+                       screen_->HideCursor();
+                       screen_->ToggleSelection();
                        bv_->text->SelectWord(bv_);
-                       screen->ToggleSelection(false);
+                       screen_->ToggleSelection(false);
                        /* This will fit the cursor on the screen
                         * if necessary */
                        update(BufferView::SELECT|BufferView::FITCUR);
@@ -680,14 +680,14 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
 void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
 {
        // select a line
-       if (buffer_ && screen && button == 1) {
-               screen->HideCursor();
-               screen->ToggleSelection();
+       if (buffer_ && screen_ && button == 1) {
+               screen_->HideCursor();
+               screen_->ToggleSelection();
                bv_->text->CursorHome(bv_);
                bv_->text->sel_cursor = bv_->text->cursor;
                bv_->text->CursorEnd(bv_);
                bv_->text->SetSelection();
-               screen->ToggleSelection(false);
+               screen_->ToggleSelection(false);
                /* This will fit the cursor on the screen
                 * if necessary */
                update(BufferView::SELECT|BufferView::FITCUR);
@@ -716,7 +716,7 @@ void BufferView::Pimpl::leaveView()
 void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                                              unsigned int button)
 {
-       if (buffer_ == 0 || screen == 0) return;
+       if (buffer_ == 0 || screen_ == 0) return;
 
        // If we hit an inset, we have the inset coordinates in these
        // and inset_hit points to the inset.  If we do not hit an
@@ -841,7 +841,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                int box_x = 20; // LYX_PAPER_MARGIN;
                box_x += lyxfont::width(" wide-tab ", font);
 
-               unsigned int screen_first = screen->first;
+               unsigned int screen_first = screen_->first;
 
                if (x < box_x
                    && y + screen_first > bv_->text->cursor.y() -
@@ -876,10 +876,10 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
 Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
                                         unsigned int /* button */)
 {
-       if (!screen)
+       if (!screen_)
                return 0;
   
-       unsigned int y_tmp = y + screen->first;
+       unsigned int y_tmp = y + screen_->first;
   
        LyXCursor cursor;
        bv_->text->SetCursorFromCoordinates(bv_, cursor, x, y_tmp);
@@ -999,7 +999,7 @@ void BufferView::Pimpl::workAreaExpose()
                        // ...including the minibuffer
                        owner_->getMiniBuffer()->Init();
 
-               } else if (screen) screen->Redraw();
+               } else if (screen_) screen_->Redraw();
        } else {
                // Grey box when we don't have a buffer
                workarea_->greyOut();
@@ -1014,7 +1014,7 @@ void BufferView::Pimpl::workAreaExpose()
 
 void BufferView::Pimpl::update()
 {
-       if (screen) screen->Update();
+       if (screen_) screen_->Update();
 }
 
 // Values used when calling update:
@@ -1131,13 +1131,13 @@ void BufferView::Pimpl::cursorToggle()
 
        updatelist.update(bv_);
        
-       if (!screen) {
+       if (!screen_) {
                goto set_timer_and_return;
        }
 
        if (lyx_focus && work_area_focus) {
                if (!bv_->the_locking_inset) {
-                       screen->CursorToggle();
+                       screen_->CursorToggle();
                } else {
                        bv_->the_locking_inset->
                                ToggleInsetCursor(bv_);
@@ -1146,7 +1146,7 @@ void BufferView::Pimpl::cursorToggle()
        } else {
                // Make sure that the cursor is visible.
                if (!bv_->the_locking_inset) {
-                       screen->ShowCursor();
+                       screen_->ShowCursor();
                } else {
                        if (!bv_->the_locking_inset->isCursorVisible())
                                bv_->the_locking_inset->
@@ -1190,7 +1190,7 @@ void BufferView::Pimpl::cursorPrevious()
 {
        if (!bv_->text->cursor.row()->previous()) return;
        
-       long y = screen->first;
+       long y = screen_->first;
        Row * cursorrow = bv_->text->cursor.row();
        bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
        bv_->text->FinishUndo();
@@ -1199,7 +1199,7 @@ void BufferView::Pimpl::cursorPrevious()
                bv_->text->CursorUp(bv_);
        
        if (bv_->text->cursor.row()->height() < workarea_->height())
-               screen->Draw(bv_->text->cursor.y()
+               screen_->Draw(bv_->text->cursor.y()
                             - bv_->text->cursor.row()->baseline()
                             + bv_->text->cursor.row()->height()
                                  - workarea_->height() + 1 );
@@ -1211,7 +1211,7 @@ void BufferView::Pimpl::cursorNext()
 {
        if (!bv_->text->cursor.row()->next()) return;
        
-       long y = screen->first;
+       long y = screen_->first;
        bv_->text->GetRowNearY(y);
        Row * cursorrow = bv_->text->cursor.row();
        bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y
@@ -1222,7 +1222,7 @@ void BufferView::Pimpl::cursorNext()
                bv_->text->CursorDown(bv_);
        
        if (bv_->text->cursor.row()->height() < workarea_->height())
-               screen->Draw(bv_->text->cursor.y()
+               screen_->Draw(bv_->text->cursor.y()
                             - bv_->text->cursor.row()->baseline());
        updateScrollbar();
 }
@@ -1347,29 +1347,29 @@ bool BufferView::Pimpl::belowMouse() const
 
 void BufferView::Pimpl::showCursor()
 {
-       if (screen)
-               screen->ShowCursor();
+       if (screen_)
+               screen_->ShowCursor();
 }
 
 
 void BufferView::Pimpl::hideCursor()
 {
-       if (screen)
-               screen->HideCursor();
+       if (screen_)
+               screen_->HideCursor();
 }
 
 
 void BufferView::Pimpl::toggleSelection(bool b)
 {
-       if (screen)
-               screen->ToggleSelection(b);
+       if (screen_)
+               screen_->ToggleSelection(b);
 }
 
 
 void BufferView::Pimpl::toggleToggle()
 {
-       if (screen)
-               screen->ToggleToggle();
+       if (screen_)
+               screen_->ToggleToggle();
 }
 
 
@@ -1377,9 +1377,9 @@ void BufferView::Pimpl::center()
 {
        beforeChange();
        if (bv_->text->cursor.y() > workarea_->height() / 2) {
-               screen->Draw(bv_->text->cursor.y() - workarea_->height() / 2);
+               screen_->Draw(bv_->text->cursor.y() - workarea_->height() / 2);
        } else {
-               screen->Draw(0);
+               screen_->Draw(0);
        }
        update(BufferView::SELECT|BufferView::FITCUR);
        redraw();
@@ -1390,7 +1390,7 @@ void BufferView::Pimpl::pasteClipboard(bool asPara)
 {
        if (buffer_ == 0) return;
 
-       screen->HideCursor();
+       screen_->HideCursor();
        bv_->beforeChange();
        
        string clip(workarea_->getClipboard());
index 954258ee438a311a0c91a4672fefe0ccc4703733..5f855c2e613edef8bc192f41719d97fe9b05ab3c 100644 (file)
@@ -118,7 +118,7 @@ struct BufferView::Pimpl {
        ///
        Buffer * buffer_;
        ///
-       LyXScreen * screen;
+       LyXScreen * screen_;
        ///
        long current_scrollbar_value;
        ///
index ee0fbcafb348034ed2c9f54926758f09574f4e33..0f21f8d23c11670557c4d13b548f4a39d0f5bf93 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_form_bullet_h_
 #define FD_form_bullet_h_
index ba63e10b765efdc37d5c48dce399dd4e53da5d1a..2fdf4c273cb793fe2a0e2a6001b0fd1a586c5a2f 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_form_credits_h_
 #define FD_form_credits_h_
index e83d512bb7b8793eda74f939978a0cf9f6f7a8bb..c62f4fce7edc968f08a5c19d66b575f820863eef 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_KeyMap_h_
 #define FD_KeyMap_h_
index 396342f49f1114d74e2e556f919cd27d6c535a92..854a3f52ce517a420ad84d8d134f32e06a203663 100644 (file)
@@ -28,7 +28,6 @@ InsetERT::InsetERT() : InsetCollapsable()
     setLabel(_("ERT"));
     LyXFont font(LyXFont::ALL_SANE);
     font.setLatex (LyXFont::ON);
-    real_current_font = current_font = font;
     labelfont = LyXFont(LyXFont::ALL_SANE);
     labelfont.decSize();
     labelfont.decSize();
@@ -72,5 +71,4 @@ void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
     InsetCollapsable::Edit(bv, x, y, button);
     LyXFont font(LyXFont::ALL_SANE);
     font.setLatex (LyXFont::ON);
-    current_font = real_current_font = font;
 }
index 04323504159e587e4057e00e3b85f05e044100c7..8ef185da8c3458922a7e77e2b7dfe62086ad782f 100644 (file)
@@ -18,6 +18,7 @@
 #include "lyxfont.h"
 #include "BufferView.h"
 #include "Painter.h"
+#include "lyxtext.h"
 #include "support/LOstream.h"
 
 using std::ostream;
@@ -84,7 +85,7 @@ bool InsetFoot::InsertInsetAllowed(Inset * inset) const
 
 LyXFont InsetFoot::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
 {
-    LyXFont fn = InsetCollapsable::GetDrawFont(buf, p, pos);
+    LyXFont fn = text->GetFont(buf, p, pos);
     fn.decSize().decSize();
     return fn;
 }
index 8a0cac3fea3a20df60a2b4bcd4d477e235f0bbba..742ec1a1b738ca23e9567bad7c387334f490645e 100644 (file)
@@ -1281,11 +1281,11 @@ bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const
 // in pixels if we have a pwidth for this cell.
 int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const
 {
-    string w;
+    string s = tabular->GetPWidth(cell);
 
-    if ((w=tabular->GetPWidth(cell)).empty())
+    if (s.empty())
        return -1;
-    return VSpace(w).inPixels( 0, 0);
+    return VSpace(s).inPixels( 0, 0);
 }
 
 int InsetTabular::getMaxWidth(Painter & pain,
@@ -1320,7 +1320,6 @@ void InsetTabular::recomputeTextInsets(BufferView * bv, const LyXFont & font) co
            cell = tabular->GetCellNumber(i,j);
            inset = tabular->GetCellInset(cell);
            inset->update(bv, font);
-           inset->computeTextRows(bv->painter());
            tabular->SetWidthOfCell(cell, inset->width(bv->painter(), font));
        }
 //     cell = tabular->GetCellNumber(0, j);
index bf90dc2a145b2189b9cf03b9bf073f826df66fde..0a39eccf9077837366079f7d43e77d30589b56f1 100644 (file)
@@ -46,6 +46,7 @@
 #include "lyxrc.h"
 #include "intl.h"
 #include "trans_mgr.h"
+#include "lyxscreen.h"
 
 using std::ostream;
 using std::ifstream;
@@ -66,7 +67,8 @@ InsetText::InsetText()
 }
 
 
-InsetText::InsetText(InsetText const & ins) : UpdatableInset()
+InsetText::InsetText(InsetText const & ins)
+       : UpdatableInset()
 {
     par = 0;
     init(&ins);
@@ -87,11 +89,9 @@ void InsetText::init(InsetText const * ins)
 {
     the_locking_inset = 0;
     cursor_visible = false;
-    cursor.x_fix(-1);
     interline_space = 1;
     no_selection = false;
     init_inset = true;
-    maxAscent = maxDescent = insetWidth = 0;
     drawTextXOffset = drawTextYOffset = 0;
     autoBreakRows = drawLockedFrame = false;
     xpos = 0.0;
@@ -101,9 +101,7 @@ void InsetText::init(InsetText const * ins)
        drawLockedFrame = ins->drawLockedFrame;
     }
     par->SetInsetOwner(this);
-    cursor.par(par);
-    cursor.pos(0);
-    selection_start_cursor = selection_end_cursor = cursor;
+//    selection_start_cursor = selection_end_cursor = cursor;
     frame_color = LColor::insetframe;
     locked = false;
     old_par = 0;
@@ -112,7 +110,14 @@ void InsetText::init(InsetText const * ins)
 
 InsetText::~InsetText()
 {
+    LyXParagraph * p;
+    p = par->next;
     delete par;
+    while(p) {
+       par = p;
+       p = p->next;
+       delete par;
+    }
 }
 
 
@@ -146,10 +151,15 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
     LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
     LyXFont font(LyXFont::ALL_INHERIT);
 
+    LyXParagraph * p;
+    p = par->next;
     delete par;
+    while(p) {
+       par = p;
+       p = p->next;
+       delete par;
+    }
     par = new LyXParagraph;
-    par->SetInsetOwner(this);
-    
     while (lex.IsOK()) {
         lex.nextToken();
         token = lex.GetString();
@@ -169,6 +179,11 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
     if (!return_par)
            return_par = par;
     par = return_par;
+    while(return_par) {
+       return_par->SetInsetOwner(this);
+       return_par = return_par->next;
+    }
+    
     if (token != "\\end_inset") {
         lex.printError("Missing \\end_inset at this point. "
                        "Read: `$$Token'");
@@ -206,29 +221,14 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
     xpos = x;
     UpdatableInset::draw(pain, f, baseline, x);
  
-#if 0   
-    if (init_inset) {
-       text->init(current_view);
-       computeTextRows(pain);
-       init_inset = false;
-    }
-#endif
-    if ((baseline != top_baseline) || (top_x != int(x))) {
-       top_baseline = baseline;
-       top_x = int(x);
-       computeBaselines(baseline);
-    }
-    if (the_locking_inset && (text->cursor.pos() == inset_pos)) {
-       resetPos(pain);
+    top_baseline = baseline;
+    top_x = int(x);
+
+    if (the_locking_inset && (cpos() == inset_pos)) {
        inset_x = cx() - top_x + drawTextXOffset;
        inset_y = cy() + drawTextYOffset;
     }
-    if (drawLockedFrame && locked) {
-       pain.rectangle(int(x), baseline - ascent(pain, f), width(pain, f),
-                      ascent(pain,f) + descent(pain, f), frame_color);
-    }
     x += TEXT_TO_INSET_OFFSET; // place for border
-#if 1
     long int y = 0;
     Row * row = text->GetRowNearY(y);
     y += baseline - row->ascent_of_text() + 1;
@@ -237,14 +237,11 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
        y += row->height();
        row = row->next();
     }
-#else
-    for(RowList::size_type r = 0; r < rows.size() - 1; ++r) {
-        drawRowSelection(pain, rows[r].pos, rows[r + 1].pos, r, 
-                         rows[r].baseline, x);
-        drawRowText(pain, rows[r].pos, rows[r + 1].pos, rows[r].baseline, x);
+    x += width(pain, f) - TEXT_TO_INSET_OFFSET;
+    if (drawLockedFrame && locked) {
+       pain.rectangle(top_x, baseline - ascent(pain, f), width(pain, f),
+                      ascent(pain,f) + descent(pain, f), frame_color);
     }
-#endif
-    x += insetWidth - TEXT_TO_INSET_OFFSET;
 }
 
 
@@ -274,107 +271,6 @@ void InsetText::update(BufferView * bv, LyXFont const &) const
 }
 
 
-void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos,
-                                 int row, int baseline, float x) const
-{
-    if (!hasSelection())
-       return;
-
-    int s_start, s_end;
-    if (selection_start_cursor.pos() > selection_end_cursor.pos()) {
-       s_start = selection_end_cursor.pos();
-       s_end = selection_start_cursor.pos();
-    } else {
-       s_start = selection_start_cursor.pos();
-       s_end = selection_end_cursor.pos();
-    }
-    if ((s_start > endpos) || (s_end < startpos))
-       return;
-    
-    int esel_x;
-    int ssel_x = esel_x = int(x);
-    LyXFont font;
-    int p = startpos;
-    for(; p < endpos; ++p) {
-       if (p == s_start)
-           ssel_x = int(x);
-       if ((p >= s_start) && (p <= s_end))
-           esel_x = int(x);
-       char ch = par->GetChar(p);
-       font = GetDrawFont(current_view->buffer(), par, p);
-       if (IsFloatChar(ch)) {
-           // skip for now
-       } else if (ch == LyXParagraph::META_INSET) {
-           Inset const * tmpinset = par->GetInset(p);
-           x += tmpinset->width(pain, font);
-       } else {
-           x += lyxfont::width(ch, font);
-       }
-    }
-    if (p == s_start)
-       ssel_x = int(x);
-    if ((p >= s_start) && (p <= s_end))
-       esel_x = int(x);
-    if (ssel_x < esel_x) {
-       pain.fillRectangle(int(ssel_x), baseline-rows[row].asc,
-                          int(esel_x - ssel_x),
-                          rows[row].asc + rows[row].desc,
-                          LColor::selection);
-    }
-}
-
-
-void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
-                           int baseline, float x) const
-{
-    Assert(endpos <= par->Last());
-
-    for(int p = startpos; p < endpos; ++p) {
-       char ch = par->GetChar(p);
-       LyXFont font = GetDrawFont(current_view->buffer(), par, p);
-       if (IsFloatChar(ch)) {
-           // skip for now
-       } else if (par->IsNewline(p)) {
-               // Draw end-of-line marker
-               int wid = lyxfont::width('n', font);
-               int asc = lyxfont::maxAscent(font);
-               int y = baseline;
-               int xp[3], yp[3];
-               
-               xp[0] = int(x + wid * 0.375);
-               yp[0] = int(y - 0.875 * asc * 0.75);
-               
-               xp[1] = int(x);
-               yp[1] = int(y - 0.500 * asc * 0.75);
-               
-               xp[2] = int(x + wid * 0.375);
-               yp[2] = int(y - 0.125 * asc * 0.75);
-               
-               pain.lines(xp, yp, 3, LColor::eolmarker);
-               
-               xp[0] = int(x);
-               yp[0] = int(y - 0.500 * asc * 0.75);
-               
-               xp[1] = int(x + wid);
-               yp[1] = int(y - 0.500 * asc * 0.75);
-               
-               xp[2] = int(x + wid);
-               yp[2] = int(y - asc * 0.75);
-                       
-               pain.lines(xp, yp, 3, LColor::eolmarker);
-               x += wid;
-       } else if (ch == LyXParagraph::META_INSET) {
-           Inset * tmpinset = par->GetInset(p);
-           if (tmpinset) 
-               tmpinset->draw(pain, font, baseline, x);
-       } else {
-           pain.text(int(x), baseline, ch, font);
-           x += lyxfont::width(ch, font);
-       }
-    }
-}
-
-
 char const * InsetText::EditMessage() const
 {
     return _("Opened Text Inset");
@@ -393,9 +289,9 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
     locked = true;
     the_locking_inset = 0;
     inset_pos = inset_x = inset_y = 0;
-    setPos(bv->painter(), x, y);
+//    setPos(bv->painter(), x, y);
     checkAndActivateInset(bv, x, y, button);
-    selection_start_cursor = selection_end_cursor = cursor;
+//    selection_start_cursor = selection_end_cursor = cursor;
     text->sel_cursor = text->cursor;
     bv->text->FinishUndo();
     UpdateLocal(bv, true, false);
@@ -411,7 +307,7 @@ void InsetText::InsetUnlock(BufferView * bv)
     HideInsetCursor(bv);
     lyxerr[Debug::INSETS] << "InsetText::InsetUnlock(" << this <<
            ")" << endl;
-    selection_start_cursor = selection_end_cursor = cursor;
+//    selection_start_cursor = selection_end_cursor = cursor;
     no_selection = false;
     locked = false;
     UpdateLocal(bv, true, false);
@@ -423,18 +319,18 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
     lyxerr[Debug::INSETS] << "InsetText::LockInsetInInset(" << inset << "): ";
     if (!inset)
        return false;
-    if (inset == par->GetInset(text->cursor.pos())) {
+    if (inset == par->GetInset(cpos())) {
        lyxerr[Debug::INSETS] << "OK" << endl;
        the_locking_inset = inset;
-       resetPos(bv->painter());
+//     resetPos(bv->painter());
        inset_x = cx() - top_x + drawTextXOffset;
        inset_y = cy() + drawTextYOffset;
-       inset_pos = text->cursor.pos();
+       inset_pos = cpos();
        return true;
     } else if (the_locking_inset && (the_locking_inset == inset)) {
-       if (text->cursor.pos() == inset_pos) {
+       if (cpos() == inset_pos) {
            lyxerr[Debug::INSETS] << "OK" << endl;
-           resetPos(bv->painter());
+//         resetPos(bv->painter());
            inset_x = cx() - top_x + drawTextXOffset;
            inset_y = cy() + drawTextYOffset;
        } else {
@@ -474,7 +370,7 @@ bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
     lyxerr[Debug::INSETS] << "InsetText::UpdateInsetInInset(" << inset <<
            ")" << endl;
     UpdateLocal(bv, true, false);
-    if (text->cursor.pos() == inset_pos) {
+    if (cpos() == inset_pos) {
        inset_x = cx() - top_x + drawTextXOffset;
        inset_y = cy() + drawTextYOffset;
     }
@@ -484,25 +380,26 @@ bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
 
 void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
 {
-    if (hasSelection()) {
-       selection_start_cursor = selection_end_cursor = cursor;
+    if (text->selection) {
+       text->selection = 0;
        UpdateLocal(bv, false, false);
     }
     no_selection = false;
-    setPos(bv->painter(), x, y);
-    cursor.x_fix(-1);
+//    setPos(bv->painter(), x, y);
+//    cursor.x_fix(-1);
+    text->SetCursorFromCoordinates(bv, x, y+bv->screen()->first);
     if (the_locking_inset) {
        UpdatableInset * inset = 0;
-       if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET)
-           inset = static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
+       if (par->GetChar(cpos()) == LyXParagraph::META_INSET)
+           inset = static_cast<UpdatableInset*>(par->GetInset(cpos()));
        if (the_locking_inset == inset) {
            the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button);
            return;
        } else if (inset) {
            // otherwise unlock the_locking_inset and lock the new inset
            the_locking_inset->InsetUnlock(bv);
-           inset_x = cursor.x() - top_x + drawTextXOffset;
-           inset_y = cursor.y() + drawTextYOffset;
+           inset_x = cx() - top_x + drawTextXOffset;
+           inset_y = cy() + drawTextYOffset;
            inset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
            inset->Edit(bv, x - inset_x, y - inset_y, button);
            UpdateLocal(bv, true, false);
@@ -513,19 +410,19 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
        the_locking_inset = 0;
     }
     if (bv->the_locking_inset) {
-       if ((par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) &&
-           par->GetInset(cursor.pos()) &&
-           (par->GetInset(cursor.pos())->Editable() == Inset::HIGHLY_EDITABLE)) {
+       if ((par->GetChar(cpos()) == LyXParagraph::META_INSET) &&
+           par->GetInset(cpos()) &&
+           (par->GetInset(cpos())->Editable() == Inset::HIGHLY_EDITABLE)) {
            UpdatableInset * inset =
-               static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
-           inset_x = cursor.x() - top_x + drawTextXOffset;
-           inset_y = cursor.y() + drawTextYOffset;
+               static_cast<UpdatableInset*>(par->GetInset(cpos()));
+           inset_x = cx() - top_x + drawTextXOffset;
+           inset_y = cy() + drawTextYOffset;
            inset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
            inset->Edit(bv, x - inset_x, y - inset_y, 0);
            UpdateLocal(bv, true, false);
        }
     }
-    selection_start_cursor = selection_end_cursor = cursor;
+//    selection_start_cursor = selection_end_cursor = cursor;
 }
 
 
@@ -536,13 +433,13 @@ void InsetText::InsetButtonRelease(BufferView * bv, int x, int y, int button)
     if (the_locking_inset) {
            the_locking_inset->InsetButtonRelease(bv, x-inset_x, y-inset_y,button);
     } else {
-       if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
-           inset = static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
+       if (par->GetChar(cpos()) == LyXParagraph::META_INSET) {
+           inset = static_cast<UpdatableInset*>(par->GetInset(cpos()));
            if (inset->Editable() == Inset::HIGHLY_EDITABLE) {
                inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
            } else {
-               inset_x = cursor.x() - top_x + drawTextXOffset;
-               inset_y = cursor.y() + drawTextYOffset;
+               inset_x = cx() - top_x + drawTextXOffset;
+               inset_y = cy() + drawTextYOffset;
                inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
                inset->Edit(bv, x - inset_x, y - inset_y, button);
            }
@@ -559,13 +456,14 @@ void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state)
                                             y - inset_y,state);
         return;
     }
+#warning REDO this (Jug)
     if (!no_selection) {
-       LyXCursor old = selection_end_cursor;
+//     LyXCursor old = selection_end_cursor;
        HideInsetCursor(bv);
-       setPos(bv->painter(), x, y);
-       selection_end_cursor = cursor;
-       if (old != selection_end_cursor)
-           UpdateLocal(bv, false, false);
+//     setPos(bv->painter(), x, y);
+//     selection_end_cursor = cursor;
+//     if (old != selection_end_cursor)
+//         UpdateLocal(bv, false, false);
        ShowInsetCursor(bv);
     }
     no_selection = false;
@@ -589,7 +487,7 @@ InsetText::LocalDispatch(BufferView * bv,
     UpdatableInset::RESULT
         result= UpdatableInset::LocalDispatch(bv, action, arg);
     if (result != UNDISPATCHED) {
-       resetPos(bv->painter());
+//     resetPos(bv->painter());
        return DISPATCHED;
     }
 
@@ -597,9 +495,6 @@ InsetText::LocalDispatch(BufferView * bv,
     if ((action < 0) && arg.empty())
         return FINISHED;
 
-    if ((action != LFUN_DOWN) && (action != LFUN_UP) &&
-        (action != LFUN_DOWNSEL) && (action != LFUN_UPSEL))
-        cursor.x_fix(-1);
     if (the_locking_inset) {
         result = the_locking_inset->LocalDispatch(bv, action, arg);
        if (result == DISPATCHED_NOUPDATE)
@@ -613,8 +508,9 @@ InsetText::LocalDispatch(BufferView * bv,
            switch(action) {
            case -1:
            case LFUN_RIGHT:
-               cursor.pos(inset_pos + 1);
-               resetPos(bv->painter());
+               moveRight(bv);
+//             text->cursor.pos(inset_pos + 1);
+//             resetPos(bv->painter());
                break;
            case LFUN_DOWN:
                moveDown(bv);
@@ -665,6 +561,7 @@ InsetText::LocalDispatch(BufferView * bv,
     case LFUN_RIGHT:
        bv->text->FinishUndo();
        result = moveRight(bv);
+       text->selection = 0;
        text->sel_cursor = text->cursor;
        UpdateLocal(bv, false, false);
        break;
@@ -677,41 +574,46 @@ InsetText::LocalDispatch(BufferView * bv,
     case LFUN_LEFT:
        bv->text->FinishUndo();
        result= moveLeft(bv);
+       text->selection = 0;
        text->sel_cursor = text->cursor;
        UpdateLocal(bv, false, false);
        break;
     case LFUN_DOWNSEL:
        bv->text->FinishUndo();
        moveDown(bv);
-       selection_end_cursor = cursor;
+       text->SetSelection();
        UpdateLocal(bv, false, false);
        break;
     case LFUN_DOWN:
        bv->text->FinishUndo();
        result = moveDown(bv);
+       text->selection = 0;
        text->sel_cursor = text->cursor;
        UpdateLocal(bv, false, false);
        break;
     case LFUN_UPSEL:
        bv->text->FinishUndo();
        moveUp(bv);
-       selection_end_cursor = cursor;
+       text->SetSelection();
        UpdateLocal(bv, false, false);
        break;
     case LFUN_UP:
        bv->text->FinishUndo();
        result = moveUp(bv);
+       text->selection = 0;
        text->sel_cursor = text->cursor;
        UpdateLocal(bv, false, false);
        break;
     case LFUN_HOME:
        bv->text->FinishUndo();
        text->CursorHome(bv);
+       text->selection = 0;
        text->sel_cursor = text->cursor;
        UpdateLocal(bv, false, false);
        break;
     case LFUN_END:
        text->CursorEnd(bv);
+       text->selection = 0;
        text->sel_cursor = text->cursor;
        UpdateLocal(bv, false, false);
        break;
@@ -793,7 +695,7 @@ InsetText::LocalDispatch(BufferView * bv,
        if (cur_layout != layout.second) {
            cur_layout = layout.second;
            text->SetLayout(bv, layout.second);
-           bv->owner()->getToolbar()->combox->select(cursor.par()->GetLayout()+1);
+           bv->owner()->getToolbar()->combox->select(cpar()->GetLayout()+1);
            UpdateLocal(bv, true, true);
        }
     }
@@ -824,132 +726,6 @@ void InsetText::Validate(LaTeXFeatures & features) const
 }
 
 
-// Returns the width of a character at a certain spot
-int InsetText::SingleWidth(Painter & pain, LyXParagraph * p, int pos) const
-{
-    LyXFont font = GetDrawFont(current_view->buffer(), p, pos);
-    char c = p->GetChar(pos);
-
-    if (IsPrintable(c)) {
-        return lyxfont::width(c, font);
-    } else if (c == LyXParagraph::META_INSET) {
-        Inset const * tmpinset = p->GetInset(pos);
-        if (tmpinset)
-            return tmpinset->width(pain, font);
-        else
-            return 0;
-    } else if (IsSeparatorChar(c))
-        c = ' ';
-    else if (IsNewlineChar(c))
-        c = 'n';
-    return lyxfont::width(c, font);
-}
-
-
-// Returns the width of a character at a certain spot
-void InsetText::SingleHeight(Painter & pain, LyXParagraph * p,int pos,
-                            int & asc, int & desc) const
-{
-    LyXFont font = GetDrawFont(current_view->buffer(), p, pos);
-    char c = p->GetChar(pos);
-
-    asc = desc = 0;
-    if (c == LyXParagraph::META_INSET) {
-        Inset const * tmpinset=p->GetInset(pos);
-        if (tmpinset) {
-           asc = tmpinset->ascent(pain, font);
-           desc = tmpinset->descent(pain, font);
-        }
-    } else {
-        asc = lyxfont::maxAscent(font);
-        desc = lyxfont::maxDescent(font);
-    }
-    return;
-}
-
-
-// Gets the fully instantiated font at a given position in a paragraph
-// Basically the same routine as LyXParagraph::getFont() in paragraph.C.
-// The difference is that this one is used for displaying, and thus we
-// are allowed to make cosmetic improvements. For instance make footnotes
-// smaller. (Asger)
-// If position is -1, we get the layout font of the paragraph.
-// If position is -2, we get the font of the manual label of the paragraph.
-LyXFont InsetText::GetFont(Buffer const * buf, LyXParagraph * p, int pos) const
-{
-    char par_depth = p->GetDepth();
-
-    LyXLayout const & layout =
-           textclasslist.Style(buf->params.textclass, p->GetLayout());
-
-    // We specialize the 95% common case:
-    if (p->footnoteflag == LyXParagraph::NO_FOOTNOTE && !par_depth) {
-        if (pos >= 0) {
-            // 95% goes here
-            if (layout.labeltype == LABEL_MANUAL
-                && pos < BeginningOfMainBody(buf, p)) {
-               // 1% goes here
-                return p->GetFontSettings(buf->params,
-                                         pos).realize(layout.reslabelfont);
-            } else
-                return p->GetFontSettings(buf->params,
-                                         pos).realize(layout.resfont);
-        } else {
-            // 5% goes here.
-            // process layoutfont for pos == -1 and labelfont for pos < -1
-            if (pos == -1)
-                return layout.resfont;
-            else
-                return layout.reslabelfont;
-        }
-    }
-    // The uncommon case need not be optimized as much
-
-    LyXFont layoutfont, tmpfont;
-
-    if (pos >= 0){
-        // 95% goes here
-        if (pos < BeginningOfMainBody(buf, p)) {
-            // 1% goes here
-            layoutfont = layout.labelfont;
-        } else {
-            // 99% goes here
-            layoutfont = layout.font;
-        }
-        tmpfont = p->GetFontSettings(buf->params, pos);
-        tmpfont.realize(layoutfont);
-    } else{
-        // 5% goes here.
-        // process layoutfont for pos == -1 and labelfont for pos < -1
-        if (pos == -1)
-            tmpfont = layout.font;
-        else
-            tmpfont = layout.labelfont;
-    }
-    
-    // Resolve against environment font information
-    //if (par->GetDepth()){ // already in while condition
-    while (p && par_depth && !tmpfont.resolved()) {
-        p = p->DepthHook(par_depth - 1);
-        if (p) {
-            tmpfont.realize(textclasslist.Style(buf->params.textclass,
-                                                p->GetLayout()).font);
-            par_depth = p->GetDepth();
-        }
-    }
-    tmpfont.realize((textclasslist.TextClass(buf->params.textclass).
-                    defaultfont()));
-    return tmpfont;
-}
-
-
-// the font for drawing may be different from the real font
-LyXFont InsetText::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
-{
-    return text->GetFont(buf, p, pos);
-}
-
-
 int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const
 {
     if (textclasslist.Style(buf->params.textclass,
@@ -962,8 +738,8 @@ int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const
 
 void InsetText::GetCursorPos(int & x, int & y) const
 {
-    x = cursor.x();
-    y = cursor.y();
+    x = cx();
+    y = cy();
 }
 
 
@@ -983,7 +759,7 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
         return;
     }
 
-    LyXFont font = GetDrawFont(bv->buffer(), cpar(), cpos());
+    LyXFont font = text->GetFont(bv->buffer(), cpar(), cpos());
 
     int asc = lyxfont::maxAscent(font);
     int desc = lyxfont::maxDescent(font);
@@ -1004,7 +780,7 @@ void InsetText::ShowInsetCursor(BufferView * bv)
        return;
     }
     if (!cursor_visible) {
-       LyXFont font = GetDrawFont(bv->buffer(), cpar(), cpos());
+       LyXFont font = text->GetFont(bv->buffer(), cpar(), cpos());
        
        int asc = lyxfont::maxAscent(font);
        int desc = lyxfont::maxDescent(font);
@@ -1027,70 +803,6 @@ void InsetText::HideInsetCursor(BufferView * bv)
 }
 
 
-void InsetText::setPos(Painter & pain, int x, int y) const
-{
-    x -= drawTextXOffset;
-    y -= drawTextYOffset;
-    // search right X-pos x==0 -> top_x
-    cursor.pos(0);
-    actrow = 0;
-    cursor.y(top_baseline);
-    y += cursor.y();
-    for(unsigned int i = 1;
-       (long(cursor.y() + rows[i - 1].desc) < y)
-               && (i < rows.size() - 1); ++i) {
-       cursor.y(rows[i].baseline);
-       cursor.pos(rows[i].pos);
-       actrow = i;
-    }
-    cursor.y(cursor.y() - top_baseline);
-    cursor.x(top_x + 2); // 2 = frame width
-    x += cursor.x();
-
-    int swh;
-    int sw = swh = SingleWidth(pain, par, cursor.pos());
-    if (par->GetChar(cursor.pos()) != LyXParagraph::META_INSET)
-       swh /= 2;
-    int checkpos = rows[actrow + 1].pos;
-    if ((actrow + 2) < (int)rows.size())
-       --checkpos;
-    while ((cursor.pos() < checkpos) && ((cursor.x() + swh) < x)) {
-       cursor.x(cursor.x() + sw);
-       cursor.pos(cursor.pos() + 1);
-       sw = swh = SingleWidth(pain, par, cursor.pos());
-       if (par->GetChar(cursor.pos())!=LyXParagraph::META_INSET)
-           swh /= 2;
-    }
-}
-
-
-void InsetText::resetPos(Painter & pain) const
-{
-    cursor.par(par);
-
-    if (!rows.size())
-       return;
-
-    int old_pos = cursor.pos();
-
-    cursor.y(top_baseline);
-    actrow = 0;
-    for(unsigned int i = 0;
-       i < (rows.size() - 1) && rows[i].pos <= cursor.pos();
-       ++i) {
-       cursor.y(rows[i].baseline);
-       actrow = i;
-    }
-    cursor.y(cursor.y() - top_baseline);
-    setPos(pain, 0, cursor.y());
-    cursor.x(top_x + 2); // 2 = frame width
-    while(cursor.pos() < old_pos) {
-       cursor.x(cursor.x() + SingleWidth(pain, par,cursor.pos()));
-       cursor.pos(cursor.pos() + 1);
-    }
-}
-
-
 UpdatableInset::RESULT
 InsetText::moveRight(BufferView * bv, bool activate_inset)
 {
@@ -1140,11 +852,11 @@ InsetText::moveDown(BufferView * bv)
 
 bool InsetText::Delete()
 {
-    if ((par->GetChar(cursor.pos())==LyXParagraph::META_INSET) &&
-       !par->GetInset(cursor.pos())->Deletable()) {
+    if ((par->GetChar(cpos())==LyXParagraph::META_INSET) &&
+       !par->GetInset(cpos())->Deletable()) {
        return false;
     }
-    par->Erase(cursor.pos());
+    par->Erase(cpos());
     return true;
 }
 
@@ -1163,13 +875,9 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
        UpdatableInset * i = static_cast<UpdatableInset *>(inset);
        i->setOwner(static_cast<UpdatableInset *>(this));
     }
-    par->InsertChar(cursor.pos(), LyXParagraph::META_INSET);
-    par->InsertInset(cursor.pos(), inset);
-    if (hasSelection()) {
-       selection_start_cursor = selection_end_cursor = cursor;
-    } else {
-       selection_start_cursor = selection_end_cursor = cursor;
-    }
+    par->InsertChar(cpos(), LyXParagraph::META_INSET);
+    par->InsertInset(cpos(), inset);
+    text->selection = 0;
     UpdateLocal(bv, true, true);
     static_cast<UpdatableInset*>(inset)->Edit(bv, 0, 0, 0);
     return true;
@@ -1198,175 +906,6 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
 }
 
 
-void InsetText::computeTextRows(Painter & pain) const
-{
-    int p,
-       nwp = 0,
-       asc = 0,
-       desc = 0,
-       oasc = 0,
-       odesc = 0,
-       wordAscent,
-       wordDescent;
-    row_struct row;
-
-    if (rows.size())
-           rows.clear();
-    int width = wordAscent = wordDescent = 0;
-    insetWidth = maxAscent = maxDescent = 0;
-    row.asc      = 0;
-    row.desc     = 0;
-    row.pos      = 0;
-    row.baseline = 0;
-    rows.push_back(row);
-    if (!autoBreakRows || (getMaxTextWidth(pain, this) < 0)) {
-       for(p = 0; p < par->Last(); ++p) {
-           insetWidth += SingleWidth(pain, par, p);
-           SingleHeight(pain, par, p, asc, desc);
-           maxAscent = max(maxAscent, asc);
-           maxDescent = max(maxDescent, desc);
-       }
-       insetWidth += (2 * TEXT_TO_INSET_OFFSET);
-       rows[0].asc = maxAscent;
-       rows[0].desc = maxDescent;
-       // alocate a dummy row for the endpos
-       row.pos = par->Last();
-       rows.push_back(row);
-       return;
-    }
-
-    bool is_first_word_in_row = true;
-    int cw, lastWordWidth = 0;
-    int maxWidth = getMaxTextWidth(pain, this);
-    // if we auto break rows than the insetwidth should be always the max
-    // width as the display is stable it may get larger if we have a really
-    // large word below and we draw it!!!
-    insetWidth = maxWidth;
-
-    for(p = 0; p < par->Last(); ++p) {
-       if (par->IsNewline(p)) {
-           rows.back().asc = wordAscent;
-           rows.back().desc = wordDescent;
-           row.pos = p+1;
-           rows.push_back(row);
-           nwp = p+1;
-           width = lastWordWidth = 0;
-           oasc = odesc = wordAscent = wordDescent = 0;
-           is_first_word_in_row = true;
-           continue;
-       }
-       cw = SingleWidth(pain, par, p);
-       Inset * inset = 0;
-       if (par->GetChar(p) == LyXParagraph::META_INSET)
-           inset = par->GetInset(p);
-       if (inset && inset->display()) {
-           inset->setOwner(const_cast<InsetText *>(this));
-           if (cw > insetWidth)
-               insetWidth = cw;
-           if (!is_first_word_in_row || (p != nwp)) {
-               oasc = max(oasc, wordAscent);
-               odesc = max(odesc, wordDescent);
-               rows.back().asc = oasc;
-               rows.back().desc = odesc;
-               row.pos = p;
-               rows.push_back(row);
-           }
-           SingleHeight(pain, par, p, asc, desc);
-           rows.back().asc = asc;
-           rows.back().desc = desc;
-           row.pos = nwp = p + 1;
-           rows.push_back(row);
-           width = lastWordWidth = 0;
-           oasc = odesc = wordAscent = wordDescent = 0;
-           is_first_word_in_row = true;
-           continue;
-       }
-       SingleHeight(pain, par, p, asc, desc);
-       width += cw;
-       lastWordWidth += cw;
-       if (width > maxWidth) {
-           if (is_first_word_in_row) {
-               if (!(width-cw)) { // only this character in word
-                   rows.back().asc = asc;
-                   rows.back().desc = desc;
-                   row.pos = p+1;
-                   rows.push_back(row);
-                   oasc = 0;
-                   odesc = 0;
-                   wordAscent = 0;
-                   wordDescent = 0;
-                   nwp = p + 1;
-                   lastWordWidth = width = 0;
-               } else {
-                   rows.back().asc = wordAscent;
-                   rows.back().desc = wordDescent;
-                   row.pos = p;
-                   rows.push_back(row);
-                   oasc = 0;
-                   odesc = 0;
-                   wordAscent = asc;
-                   wordDescent = desc;
-                   lastWordWidth = width = cw;
-                   nwp = p;
-               }
-           } else {
-               rows.back().asc = oasc;
-               rows.back().desc = odesc;
-               row.pos = nwp;
-               rows.push_back(row);
-               oasc = wordAscent;
-               odesc = wordDescent;
-               width = lastWordWidth;  
-               wordAscent = max(wordAscent, asc);
-               wordDescent = max(wordDescent, desc);
-               is_first_word_in_row = true;
-           }
-       } else {
-           wordAscent = max(wordAscent, asc);
-           wordDescent = max(wordDescent, desc);
-       }
-       if (par->IsSeparator(p) || inset) {
-           if (inset) {
-               inset->setOwner(const_cast<InsetText *>(this));
-               if (cw > maxWidth)
-                   insetWidth = cw;
-           }
-           oasc = max(oasc, wordAscent);
-           odesc = max(odesc, wordDescent);
-           wordAscent = wordDescent = lastWordWidth = 0;
-           nwp = p + 1;
-           is_first_word_in_row = false;
-       }
-    }
-    // if we have some data in the paragraph we have ascent/descent
-    if (p) {
-       // assign last row data
-       rows.back().asc = max(oasc, wordAscent);
-       rows.back().desc = max(odesc, wordDescent);
-    }
-    insetWidth += (2 * TEXT_TO_INSET_OFFSET);
-    // alocate a dummy row for the endpos
-    row.pos = par->Last();
-    rows.push_back(row);
-    // calculate maxAscent/Descent
-    maxAscent = rows[0].asc;
-    maxDescent = rows[0].desc;
-    for (RowList::size_type i = 1; i < rows.size() - 1; ++i) {
-       maxDescent += rows[i].asc + rows[i].desc + interline_space;
-    }
-}
-
-
-void InsetText::computeBaselines(int baseline) const
-{
-    rows[0].baseline = baseline;
-    for (unsigned int i = 1; i < rows.size() - 1; i++) {
-       rows[i].baseline = rows[i - 1].baseline + rows[i - 1].desc + 
-           rows[i].asc + interline_space;
-    }
-}
-
-
 void InsetText::UpdateLocal(BufferView * bv, bool what, bool mark_dirty)
 {
     if (what) {
@@ -1382,79 +921,19 @@ void InsetText::UpdateLocal(BufferView * bv, bool what, bool mark_dirty)
 }
 
 
-bool InsetText::cutSelection(Buffer const * buf)
-{
-    if (!hasSelection())
-       return false;
-
-    CutAndPaste cap;
-
-    LyXParagraph * endpar = par;
-    int start, end;
-    if (selection_start_cursor.pos() > selection_end_cursor.pos()) {
-           start = selection_end_cursor.pos();
-           end = selection_start_cursor.pos();
-    } else {
-           start = selection_start_cursor.pos();
-           end = selection_end_cursor.pos();
-    }
-
-    return cap.cutSelection(par, &endpar, start, end, buf->params.textclass);
-}
-
-
-bool InsetText::copySelection(Buffer const * buf)
-{
-    if (!hasSelection())
-       return false;
-
-    CutAndPaste cap;
-
-    int start, end;
-    if (selection_start_cursor.pos() > selection_end_cursor.pos()) {
-           start = selection_end_cursor.pos();
-           end = selection_start_cursor.pos();
-    } else {
-           start = selection_start_cursor.pos();
-           end = selection_end_cursor.pos();
-    }
-    return cap.copySelection(par, par, start, end, buf->params.textclass);
-}
-
-
-bool InsetText::pasteSelection(Buffer const * buf)
-{
-    CutAndPaste cap;
-
-    if (cap.nrOfParagraphs() > 1) {
-       WriteAlert(_("Impossible operation"),
-                  _("Cannot include more than one paragraph!"),
-                  _("Sorry."));
-       return false;
-    }
-    LyXParagraph * endpar;
-    LyXParagraph * actpar = par;
-
-    int pos = cursor.pos();
-    bool ret = cap.pasteSelection(&actpar, &endpar, pos,buf->params.textclass);
-    cursor.pos(pos);
-    return ret;
-}
-
-
 bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
                                      int button)
 {
-    if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
+    if (par->GetChar(cpos()) == LyXParagraph::META_INSET) {
        UpdatableInset * inset =
-           static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
+           static_cast<UpdatableInset*>(par->GetInset(cpos()));
        LyXFont font = text->GetFont(bv->buffer(), cpar(), cpos());
        if (x < 0)
            x = inset->width(bv->painter(), font);
        if (y < 0)
            y = inset->descent(bv->painter(), font);
-       inset_x = cursor.x() - top_x + drawTextXOffset;
-       inset_y = cursor.y() + drawTextYOffset;
+       inset_x = cx() - top_x + drawTextXOffset;
+       inset_y = cy() + drawTextYOffset;
        inset->Edit(bv, x - inset_x, y - inset_y, button);
        if (!the_locking_inset)
            return false;
@@ -1467,17 +946,31 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
 
 int InsetText::getMaxTextWidth(Painter & pain, UpdatableInset const * inset) const
 {
-//    int w=getMaxWidth(pain, inset);
-//    return (w - x);
     return getMaxWidth(pain, inset) - 4; // 2+2 width of eventual border
 }
 
 void InsetText::SetParagraphData(LyXParagraph *p)
 {
-    if (par)
+    LyXParagraph * np;
+
+    if (par) {
+       np = par->next;
        delete par;
+       while(np) {
+           par = np;
+           np = np->next;
+           delete par;
+       }
+    }
     par = p->Clone();
     par->SetInsetOwner(this);
+    np = par;
+    while(p->next) {
+       p = p->next;
+       np->next = p->Clone();
+       np->next->previous = np;
+       np = np->next;
+    }
     init_inset = true;
 }
 
@@ -1505,6 +998,11 @@ void InsetText::SetFrameColor(LColor::color col)
     }
 }
 
+LyXFont InsetText::GetDrawFont(Buffer const * buf, LyXParagraph * par, int pos) const
+{
+    return text->GetFont(buf, par, pos);
+}
+
 int InsetText::cx() const
 {
     return text->cursor.x() + top_x + 1;
index 36a32ebd46d9e565ffb27c1d66c342991cc41224..40193fa3c32496ca2365b04a173de398d0135a4e 100644 (file)
@@ -124,7 +124,7 @@ public:
     ///
     void SetFrameColor(LColor::color);
     ///
-    void computeTextRows(Painter &) const;
+    LyXFont GetDrawFont(Buffer const *, LyXParagraph *, int pos) const;
     ///
     LyXParagraph * par;
     ///
@@ -135,33 +135,10 @@ protected:
     ///
     void WriteParagraphData(Buffer const *, std::ostream &) const;
     ///
-    void resetPos(Painter &) const;
-    ///
-    void drawSelection(Painter &, int pos, int baseline, float x);
-    ///
-    void SingleHeight(Painter &, LyXParagraph * par,int pos,
-                     int & asc, int & desc) const;
-    ///
-    int SingleWidth(Painter &, LyXParagraph * par, int pos) const;
-    ///
-    LyXFont GetFont(Buffer const *, LyXParagraph * par, int pos) const;
-    ///
-    virtual LyXFont GetDrawFont(Buffer const *, LyXParagraph * par, int pos) const;
-    ///
     virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
 
     LyXText * text;
     ///
-    LyXFont current_font;
-    ///
-    LyXFont real_current_font;
-    ///
-    mutable int maxAscent;
-    ///
-    mutable int maxDescent;
-    ///
-    mutable int insetWidth;
-    ///
     mutable int drawTextXOffset;
     mutable int drawTextYOffset;
     ///
@@ -171,14 +148,6 @@ protected:
     LColor::color frame_color;
 
 private:
-    ///
-    void drawRowSelection(Painter &, int startpos, int endpos, int row,
-                         int baseline, float x) const;
-    ///
-    void drawRowText(Painter &, int startpos, int endpos, int baseline,
-                     float x) const;
-    ///
-    void computeBaselines(int) const;
     ///
     int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
     ///
@@ -186,8 +155,6 @@ private:
     ///
     void HideInsetCursor(BufferView *);
     ///
-    void setPos(Painter &, int x, int y) const;
-    ///
     UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true);
     ///
     UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true);
@@ -198,15 +165,6 @@ private:
     ///
     bool Delete();
     ///
-    bool cutSelection(Buffer const *);
-    ///
-    bool copySelection(Buffer const *);
-    ///
-    bool pasteSelection(Buffer const *);
-    ///
-    bool hasSelection() const
-        { return (selection_start_cursor != selection_end_cursor); }
-    ///
     void SetCharFont(Buffer const *, int pos, LyXFont const & font);
     ///
     string getText(int);
@@ -231,16 +189,6 @@ private:
     ///
     int interline_space;
     ///
-    LyXCursor selection_start_cursor;
-    ///
-    LyXCursor selection_end_cursor;
-    ///
-    mutable LyXCursor cursor;
-    ///
-    mutable LyXCursor old_cursor;
-    ///
-    mutable int actrow;
-    ///
     bool no_selection;
     ///
     mutable float xpos;
@@ -249,21 +197,6 @@ private:
     ///
     UpdatableInset * the_locking_inset;
     ///
-    struct row_struct {
-       ///
-       int asc;
-       ///
-       int desc;
-       ///
-       int pos;
-       ///
-       int baseline;
-    };
-    ///
-    typedef std::vector<row_struct> RowList;
-    ///
-    mutable RowList rows;
-    ///
     LyXParagraph * old_par;
 };
 #endif
index 270eedd6935e4fe8b6e5ff6788f4956a71668e5c..9d63cfb7a796c93dbb0b03e1da17768db254c14f 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_LaTeXOptions_h_
 #define FD_LaTeXOptions_h_
index 6bd984ce92acbd3205de2947bfaced7d0a50091d..7f88ea6f9d4234ef8d888ba32073c1b3623f0227 100644 (file)
@@ -138,10 +138,9 @@ FD_form_document *create_form_form_document(void)
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
     fl_set_object_resize(obj, FL_RESIZE_NONE);
-  fdui->choice_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 190, 190, 30, _("Language:"));
-    fl_set_object_boxtype(obj, FL_FRAME_BOX);
-    fl_set_object_color(obj, FL_COL1, FL_COL1);
+  fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX, 120, 190, 190, 30, _("Language:"));
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_lalign(obj, FL_ALIGN_LEFT);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
     fl_set_object_resize(obj, FL_RESIZE_NONE);
   fdui->input_default_skip = obj = fl_add_input(FL_NORMAL_INPUT, 220, 310, 90, 30, "");
@@ -197,20 +196,16 @@ FD_form_character *create_form_form_character(void)
   FL_OBJECT *obj;
   FD_form_character *fdui = (FD_form_character *) fl_calloc(1, sizeof(FD_form_character));
 
-  fdui->form_character = fl_bgn_form(FL_NO_BOX, 295, 385);
-  obj = fl_add_box(FL_UP_BOX, 0, 0, 295, 385, "");
+  fdui->form_character = fl_bgn_form(FL_NO_BOX, 300, 415);
+  obj = fl_add_box(FL_UP_BOX, 0, 0, 300, 415, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
-  fdui->choice_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 155, 190, 30, idex(_("Language|#L")));fl_set_button_shortcut(obj, scex(_("Language|#L")), 1);
-    fl_set_object_boxtype(obj, FL_FRAME_BOX);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 295, 280, 45, "");
+  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 325, 280, 45, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 235, 280, 45, "");
+  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 265, 280, 45, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 210, "");
+  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 240, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
   fdui->choice_family = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 15, 191, 30, idex(_("Family:|#F")));fl_set_button_shortcut(obj, scex(_("Family:|#F")), 1);
@@ -218,27 +213,27 @@ FD_form_character *create_form_form_character(void)
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 50, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1);
+  fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 55, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1);
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 85, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1);
+  fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 95, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1);
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 245, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1);
+  fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 275, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1);
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 305, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1);
+  fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 335, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1);
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 345, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
+  fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 375, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
     fl_set_object_callback(obj, CharacterApplyCB, 0);
@@ -246,30 +241,29 @@ FD_form_character *create_form_form_character(void)
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
     fl_set_object_callback(obj, CharacterCloseCB, 0);
-  fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 120, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1);
+  fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 135, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1);
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 190, 260, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+  fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 215, 255, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_text(FL_NORMAL_TEXT, 20, 225, 210, 20, _("These are never toggled"));
+  obj = fl_add_text(FL_NORMAL_TEXT, 20, 255, 210, 20, _("These are never toggled"));
     fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
     fl_set_object_lstyle(obj, FL_BOLD_STYLE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_text(FL_NORMAL_TEXT, 20, 285, 215, 20, _("These are always toggled"));
+  obj = fl_add_text(FL_NORMAL_TEXT, 20, 315, 215, 20, _("These are always toggled"));
     fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
     fl_set_object_lstyle(obj, FL_BOLD_STYLE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX, 95, 175, 190, 30, _("Language:"));
+  fdui->choice_language = obj = fl_add_choice(FL_DROPLIST_CHOICE, 95, 175, 190, 30, _("Language:"));
+    fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_lalign(obj, FL_ALIGN_LEFT);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
-    fl_set_object_resize(obj, FL_RESIZE_NONE);
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
+    fl_set_object_resize(obj, FL_RESIZE_X);
   fl_end_form();
 
   //fdui->form_character->fdui = fdui;
index 4a229f4944ea24c4d7da5fdc0e8fb9e0d33dca69..deae8167390083aef6a37aa2139aadbd7a26212d 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_form_document_h_
 #define FD_form_document_h_
@@ -115,16 +115,16 @@ typedef struct {
        void *vdata;
        char *cdata;
        long  ldata;
-       FL_OBJECT *choice_language;
        FL_OBJECT *choice_family;
        FL_OBJECT *choice_series;
        FL_OBJECT *choice_shape;
-       FL_OBJECT *choice_color;
-       FL_OBJECT *check_toggle_all;
        FL_OBJECT *choice_size;
        FL_OBJECT *choice_bar;
        FL_OBJECT *button_apply;
        FL_OBJECT *button_close;
+       FL_OBJECT *choice_color;
+       FL_OBJECT *check_toggle_all;
+       FL_OBJECT *choice_language;
 } FD_form_character;
 
 extern FD_form_character * create_form_form_character(void);
index 53744a1f15a18825915a9db290f55592fd2b7ced..3d3f2aae8d48758dc2ca37eb85169a144b90546c 100644 (file)
--- a/src/lyx.h
+++ b/src/lyx.h
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_form_title_h_
 #define FD_form_title_h_
index 505a9be531699e2b71798ef99a51c676cd96b55c..3fe5d40359fb6feacf0a0728112a0835b2c3eb9b 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_xsendfax_h_
 #define FD_xsendfax_h_
index 5cecb5f30e48d20dbe41c2309f50b4cafba65bd1..e58703bbcf605f933ca62261a821cd71da9c7f5d 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_panel_h_
 #define FD_panel_h_
index ae797a0131e4ac6193087fc5cbae549210cc3586..41526b447f1da893bdd57a452cc4efb121868bd6 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_form_sendto_h_
 #define FD_form_sendto_h_
index 733c64f07083e9c878e0642dc8d9a4bbccb8ae24..c02f58f8ec8b22c003dfe78e59aacd69a208ddef 100644 (file)
@@ -1,4 +1,4 @@
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
 
 #ifndef FD_form_spell_options_h_
 #define FD_form_spell_options_h_
index 4f5519891b901c0a025e24ef45152db54a6aa489..bfb9ce4c63c40915418372193e0eb71034659882 100644 (file)
@@ -3780,7 +3780,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
        int y_top, y_bottom;
        float fill_separator, fill_hfill, fill_label_hfill;
 
-       LyXFont font;
+       LyXFont font(LyXFont::ALL_SANE);
        int maxdesc;
        if (row_ptr->height() <= 0) {
                lyxerr << "LYX_ERROR: row.height: "
@@ -3793,9 +3793,12 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
        x += x_offset;
        
        // clear the area where we want to paint/print
-       int ww = workWidth(bview);
-       if (ww < 0)
+       int ww;
+       if (inset_owner)
+               ww = inset_owner->width(bview->painter(), font) - 1;
+       else
                ww = bview->workWidth();
+
        if (bv_owner)
                pain.fillRectangle(x_offset, y_offset, ww, row_ptr->height());
        
@@ -3805,12 +3808,14 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
                        if (sel_start_cursor.row() == row_ptr &&
                            sel_end_cursor.row() == row_ptr) {
                                if (sel_start_cursor.x() < sel_end_cursor.x())
-                                       pain.fillRectangle(sel_start_cursor.x(), y_offset,
+                                       pain.fillRectangle(x_offset + sel_start_cursor.x(),
+                                                          y_offset,
                                                           sel_end_cursor.x() - sel_start_cursor.x(),
                                                           row_ptr->height(),
                                                           LColor::selection);
                                else
-                                       pain.fillRectangle(sel_end_cursor.x(), y_offset,
+                                       pain.fillRectangle(x_offset + sel_end_cursor.x(),
+                                                          y_offset,
                                                           sel_start_cursor.x() - sel_end_cursor.x(),
                                                           row_ptr->height(),
                                                           LColor::selection);
@@ -3821,13 +3826,15 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
                                                           row_ptr->height(),
                                                           LColor::selection);
                                else
-                                       pain.fillRectangle(sel_start_cursor.x(), y_offset,
+                                       pain.fillRectangle(x_offset + sel_start_cursor.x(),
+                                                          y_offset,
                                                           ww - sel_start_cursor.x(),
                                                           row_ptr->height(),
                                                           LColor::selection);
                        } else if (sel_end_cursor.row() == row_ptr) {
                                if (is_rtl)
-                                       pain.fillRectangle(sel_end_cursor.x(), y_offset,
+                                       pain.fillRectangle(x_offset + sel_end_cursor.x(),
+                                                          y_offset,
                                                           ww - sel_end_cursor.x(),
                                                           row_ptr->height(),
                                                           LColor::selection);
@@ -3838,15 +3845,16 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
                                                           LColor::selection);
                        } else if (y > long(sel_start_cursor.y())
                                   && y < long(sel_end_cursor.y())) {
-                               pain.fillRectangle(x_offset, y_offset,
-                                                  ww, row_ptr->height(),
+                               pain.fillRectangle(x_offset, y_offset, ww,
+                                                  row_ptr->height(),
                                                   LColor::selection);
                        }
                } else if ( sel_start_cursor.row() != row_ptr &&
                            sel_end_cursor.row() != row_ptr &&
                            y > long(sel_start_cursor.y())
                            && y < long(sel_end_cursor.y())) {
-                       pain.fillRectangle(x_offset, y_offset, ww, row_ptr->height(),
+                       pain.fillRectangle(x_offset, y_offset, ww,
+                                          row_ptr->height(),
                                           LColor::selection);
                } else if (sel_start_cursor.row() == row_ptr ||
                           sel_end_cursor.row() == row_ptr) {
@@ -3882,7 +3890,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
                                              sel_start_cursor.pos() <= pos) &&
                                             (sel_end_cursor.row() != row_ptr ||
                                              pos < sel_end_cursor.pos()) )
-                                               pain.fillRectangle(int(old_tmpx), y_offset,
+                                               pain.fillRectangle(x_offset + int(old_tmpx),
+                                                                  y_offset,
                                                                   int(tmpx - old_tmpx + 1),
                                                                   row_ptr->height(),
                                                                   LColor::selection);
@@ -3922,17 +3931,19 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
                                              sel_start_cursor.pos() <= pos) &&
                                             (sel_end_cursor.row() != row_ptr ||
                                              pos < sel_end_cursor.pos()) )
-                                               pain.fillRectangle(int(old_tmpx), y_offset,
+                                               pain.fillRectangle(x_offset + int(old_tmpx),
+                                                                  y_offset,
                                                                   int(tmpx - old_tmpx + 1),
                                                                   row_ptr->height(),
-                                                          LColor::selection);
+                                                                  LColor::selection);
                                }
 #ifndef NEW_TABULAR
                        }
 #endif
                        if ( (sel_start_cursor.row() != row_ptr && is_rtl) ||
                             (sel_end_cursor.row() != row_ptr && !is_rtl) )
-                               pain.fillRectangle(int(tmpx), y_offset,
+                               pain.fillRectangle(x_offset + int(tmpx),
+                                                  y_offset,
                                                   int(ww - tmpx),
                                                   row_ptr->height(),
                                                   LColor::selection);
index 92de80386154ecf5ac1bda878fc4f63b82e85131..5b4e41e625c2369758b49f561e399a017d0a9b02 100644 (file)
@@ -96,9 +96,10 @@ char nextToken (string & data)
                // I really mean assignment ("=") below, not equality!
                if ((i = data.find_last_of("0123456789.")) != string::npos) {
                        if (number_index > 3) return 'E';  // Error
-                        string buffer = data.substr(0, i + 1);
-                       if (sscanf (buffer.c_str(),
-                                   "%f", &number[number_index]) == 1) {
+                        string buffer = data.substr(0, i + 1).c_str();
+                       double x = strToDbl(buffer);
+                       if (x) {
+                               number[number_index] = x;
                                lyx_advance (data, i + 1);
                                ++number_index;
                                return 'n';