]> git.lyx.org Git - features.git/commitdiff
a couple of name changes and new functionality in lyxvc and vc-backend
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 9 Nov 1999 23:52:04 +0000 (23:52 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 9 Nov 1999 23:52:04 +0000 (23:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@302 a592a061-630c-0410-9148-cb99ea01b6c8

36 files changed:
src/BufferView.C
src/BufferView.h
src/FontLoader.C
src/LaTeXFeatures.C
src/LaTeXFeatures.h
src/LaTeXLog.C
src/LyXSendto.C
src/LyXView.C
src/LyXView.h
src/Makefile.am
src/PaperLayout.C
src/ParagraphExtra.C
src/TableLayout.C
src/buffer.C
src/bullet_forms_cb.C
src/intl.C
src/lyx_cb.C
src/lyx_gui.C
src/lyx_gui_misc.C
src/lyx_main.C
src/lyxfr1.C
src/lyxfunc.C
src/lyxlookup.C
src/lyxvc.C
src/lyxvc.h
src/menus.C
src/minibuffer.C
src/paragraph.C
src/spellchecker.C
src/support/lyxstring.C
src/texoptions.C
src/text.C
src/trans_mgr.C
src/vc-backend.C [new file with mode: 0644]
src/vc-backend.h [new file with mode: 0644]
src/vspace.C

index 733883e887f8b0f2091b5b08dd729f920aafe14b..e1a57a50044991c4418f73c89da32cfea2a6b735 100644 (file)
@@ -61,9 +61,9 @@ FL_OBJECT * figinset_canvas;
 
 BufferView::BufferView(LyXView *o, int xpos, int ypos,
                       int width, int height)
-       : _owner(o)
+       : owner_(o)
 {
-       _buffer = 0;
+       buffer_ = 0;
        
        screen = 0;
        work_area = 0;
@@ -76,22 +76,22 @@ BufferView::BufferView(LyXView *o, int xpos, int ypos,
        create_view(xpos, ypos, width, height);
        // Activate the timer for the cursor 
        fl_set_timer(timer_cursor, 0.4);
-       fl_set_focus_object(_owner->getForm(), work_area);
+       fl_set_focus_object(owner_->getForm(), work_area);
        work_area_focus = true;
        lyx_focus = false;
 }
 
 
-void BufferView::setBuffer(Buffer *b)
+void BufferView::buffer(Buffer *b)
 {
-       lyxerr.debug() << "Setting buffer in BufferView" << endl;
-       if (_buffer) {
-               _buffer->InsetSleep();
-               _buffer->delUser(this);
+       lyxerr[Debug::INFO] << "Setting buffer in BufferView" << endl;
+       if (buffer_) {
+               buffer_->InsetSleep();
+               buffer_->delUser(this);
        }
 
        // Set current buffer
-       _buffer = b;
+       buffer_ = b;
 
        if (bufferlist.getState() == BufferList::CLOSING) return;
        
@@ -101,16 +101,16 @@ void BufferView::setBuffer(Buffer *b)
        screen = 0;
 
        // If we are closing the buffer, use the first buffer as current
-       if (!_buffer) {
-               _buffer = bufferlist.first();
+       if (!buffer_) {
+               buffer_ = bufferlist.first();
        }
 
-       if (_buffer) {
-               lyxerr.debug() << "  Buffer addr: " << _buffer << endl;
-               _buffer->addUser(this);
-               _owner->getMenus()->showMenus();
+       if (buffer_) {
+               lyxerr[Debug::INFO] << "  Buffer addr: " << buffer_ << endl;
+               buffer_->addUser(this);
+               owner_->getMenus()->showMenus();
                // If we don't have a text object for this, we make one
-               if (_buffer->text == 0)
+               if (buffer_->text == 0)
                        resizeCurrentBuffer();
                else {
                        updateScreen();
@@ -119,17 +119,17 @@ void BufferView::setBuffer(Buffer *b)
                screen->first = screen->TopCursorVisible();
                redraw();
                updateAllVisibleBufferRelatedPopups();
-               _buffer->InsetWakeup();
+               buffer_->InsetWakeup();
        } else {
-               lyxerr.debug() << "  No Buffer!" << endl;
-               _owner->getMenus()->hideMenus();
+               lyxerr[Debug::INFO] << "  No Buffer!" << endl;
+               owner_->getMenus()->hideMenus();
                updateScrollbar();
                fl_redraw_object(work_area);
        }
        // should update layoutchoice even if we don't have a buffer.
-       _owner->updateLayoutChoice();
-       _owner->getMiniBuffer()->Init();
-       _owner->updateWindowTitle();
+       owner_->updateLayoutChoice();
+       owner_->getMiniBuffer()->Init();
+       owner_->updateWindowTitle();
 }
 
 
@@ -143,14 +143,14 @@ void BufferView::updateScreen()
                               work_area->h,
                               work_area->x,
                               work_area->y,
-                              _buffer->text);
+                              buffer_->text);
 }
 
 
 void BufferView::resize()
 {
        // This will resize the buffer. (Asger)
-       if (_buffer)
+       if (buffer_)
                resizeCurrentBuffer();
 }
 
@@ -159,7 +159,7 @@ static bool lgb_hack = false;
 
 void BufferView::redraw()
 {
-       lyxerr.debug() << "BufferView::redraw()" << endl;
+       lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
        lgb_hack = true;
        fl_redraw_object(work_area);
        fl_redraw_object(scrollbar);
@@ -187,7 +187,7 @@ void BufferView::updateScrollbar()
         * maximum must be the working area height. No scrolling will 
         * be possible */
 
-       if (!_buffer) {
+       if (!buffer_) {
                fl_set_slider_value(scrollbar, 0);
                fl_set_slider_size(scrollbar, scrollbar->h);
                return;
@@ -199,8 +199,8 @@ void BufferView::updateScrollbar()
        long cbth = 0;
        long cbsf = 0;
 
-       if (_buffer->text)
-               cbth = _buffer->text->height;
+       if (buffer_->text)
+               cbth = buffer_->text->height;
        if (screen)
                cbsf = screen->first;
 
@@ -222,7 +222,7 @@ void BufferView::updateScrollbar()
        long maximum_height = work_area->h * 3/4 + cbth;
        long value = cbsf;
 
-       /* set the scrollbar */
+       // set the scrollbar
        double hfloat = work_area->h;
        double maxfloat = maximum_height;
    
@@ -230,7 +230,7 @@ void BufferView::updateScrollbar()
        fl_set_slider_bounds(scrollbar, 0,
                             maximum_height - work_area->h);
 #if FL_REVISION > 85
-       double lineh = _buffer->text->DefaultHeight();
+       double lineh = buffer_->text->DefaultHeight();
        fl_set_slider_increment(scrollbar,work_area->h-lineh,lineh);
 #endif
        if (maxfloat>0){
@@ -248,17 +248,17 @@ void BufferView::updateScrollbar()
 
 void BufferView::redoCurrentBuffer()
 {
-       lyxerr.debug() << "BufferView::redoCurrentBuffer" << endl;
-       if (_buffer && _buffer->text) {
+       lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl;
+       if (buffer_ && buffer_->text) {
                resize();
-               _owner->updateLayoutChoice();
+               owner_->updateLayoutChoice();
        }
 }
 
 
 int BufferView::resizeCurrentBuffer()
 {
-       lyxerr.debug() << "resizeCurrentBuffer" << endl;
+       lyxerr[Debug::INFO] << "resizeCurrentBuffer" << endl;
        
        LyXParagraph * par = 0;
        LyXParagraph * selstartpar = 0;
@@ -271,41 +271,41 @@ int BufferView::resizeCurrentBuffer()
 
        ProhibitInput();
 
-       _owner->getMiniBuffer()->Set(_("Formatting document..."));   
-
-       if (_buffer->text) {
-               par = _buffer->text->cursor.par;
-               pos = _buffer->text->cursor.pos;
-               selstartpar = _buffer->text->sel_start_cursor.par;
-               selstartpos = _buffer->text->sel_start_cursor.pos;
-               selendpar = _buffer->text->sel_end_cursor.par;
-               selendpos = _buffer->text->sel_end_cursor.pos;
-               selection = _buffer->text->selection;
-               mark_set = _buffer->text->mark_set;
-               delete _buffer->text;
+       owner_->getMiniBuffer()->Set(_("Formatting document..."));   
+
+       if (buffer_->text) {
+               par = buffer_->text->cursor.par;
+               pos = buffer_->text->cursor.pos;
+               selstartpar = buffer_->text->sel_start_cursor.par;
+               selstartpos = buffer_->text->sel_start_cursor.pos;
+               selendpar = buffer_->text->sel_end_cursor.par;
+               selendpos = buffer_->text->sel_end_cursor.pos;
+               selection = buffer_->text->selection;
+               mark_set = buffer_->text->mark_set;
+               delete buffer_->text;
        }
-       _buffer->text = new LyXText(work_area->w, _buffer);
+       buffer_->text = new LyXText(work_area->w, buffer_);
 
        updateScreen();
    
        if (par) {
-               _buffer->text->selection = true;
+               buffer_->text->selection = true;
                /* at this point just
                 * to avoid the Delete-
                 * Empty-Paragraph
                 * Mechanism when
                 * setting the cursor */
-               _buffer->text->mark_set = mark_set;
+               buffer_->text->mark_set = mark_set;
                if (selection) {
-                       _buffer->text->SetCursor(selstartpar, selstartpos);
-                       _buffer->text->sel_cursor = _buffer->text->cursor;
-                       _buffer->text->SetCursor(selendpar, selendpos);
-                       _buffer->text->SetSelection();
-                       _buffer->text->SetCursor(par, pos);
+                       buffer_->text->SetCursor(selstartpar, selstartpos);
+                       buffer_->text->sel_cursor = buffer_->text->cursor;
+                       buffer_->text->SetCursor(selendpar, selendpos);
+                       buffer_->text->SetSelection();
+                       buffer_->text->SetCursor(par, pos);
                } else {
-                       _buffer->text->SetCursor(par, pos);
-                       _buffer->text->sel_cursor = _buffer->text->cursor;
-                       _buffer->text->selection = false;
+                       buffer_->text->SetCursor(par, pos);
+                       buffer_->text->sel_cursor = buffer_->text->cursor;
+                       buffer_->text->selection = false;
                }
        }
        screen->first = screen->TopCursorVisible(); /* this will scroll the
@@ -314,7 +314,7 @@ int BufferView::resizeCurrentBuffer()
                                                     * visible */ 
        updateScrollbar();
        redraw();
-       _owner->getMiniBuffer()->Init();
+       owner_->getMiniBuffer()->Init();
        AllowInput();
 
        // Now if the title form still exist kill it
@@ -331,30 +331,30 @@ void BufferView::gotoError()
    
        screen->HideCursor();
        BeforeChange();
-       _buffer->update(-2);
+       buffer_->update(-2);
        LyXCursor tmp;
    
-       if (!_buffer->text->GotoNextError()) {
-               if (_buffer->text->cursor.pos 
-                   || _buffer->text->cursor.par !=
-                   _buffer->text->FirstParagraph()) {
-                       tmp = _buffer->text->cursor;
-                       _buffer->text->cursor.par =
-                               _buffer->text->FirstParagraph();
-                       _buffer->text->cursor.pos = 0;
-                       if (!_buffer->text->GotoNextError()) {
-                               _buffer->text->cursor = tmp;
-                               _owner->getMiniBuffer()->Set(_("No more errors"));
+       if (!buffer_->text->GotoNextError()) {
+               if (buffer_->text->cursor.pos 
+                   || buffer_->text->cursor.par !=
+                   buffer_->text->FirstParagraph()) {
+                       tmp = buffer_->text->cursor;
+                       buffer_->text->cursor.par =
+                               buffer_->text->FirstParagraph();
+                       buffer_->text->cursor.pos = 0;
+                       if (!buffer_->text->GotoNextError()) {
+                               buffer_->text->cursor = tmp;
+                               owner_->getMiniBuffer()->Set(_("No more errors"));
                                LyXBell();
                        }
                } else {
-                       _owner->getMiniBuffer()->Set(_("No more errors"));
+                       owner_->getMiniBuffer()->Set(_("No more errors"));
                        LyXBell();
                }
        }
-       _buffer->update(0);
-       _buffer->text->sel_cursor =
-               _buffer->text->cursor;
+       buffer_->update(0);
+       buffer_->text->sel_cursor =
+               buffer_->text->cursor;
 }
 
 
@@ -439,7 +439,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
        obj->u_vdata = this;
        fl_set_pixmapbutton_data(obj, up_xpm);
 
-#if FL_REVISION >85
+#if FL_REVISION > 85
        // Remove the blue feedback rectangle
        fl_set_pixmapbutton_focus_outline(obj,0);
 #endif 
@@ -498,7 +498,7 @@ void BufferView::UpCB(FL_OBJECT * ob, long)
 {
        BufferView * view = static_cast<BufferView*>(ob->u_vdata);
        
-       if (view->_buffer == 0) return;
+       if (view->buffer_ == 0) return;
 
        XEvent const * ev2;
        static long time = 0;
@@ -548,10 +548,10 @@ void waitForX()
 // Callback for scrollbar slider
 void BufferView::ScrollCB(FL_OBJECT * ob, long)
 {
-       BufferView *view = static_cast<BufferView*>(ob->u_vdata);
+       BufferView * view = static_cast<BufferView*>(ob->u_vdata);
        extern bool cursor_follows_scrollbar;
        
-       if (view->_buffer == 0) return;
+       if (view->buffer_ == 0) return;
 
        view->current_scrollbar_value = long(fl_get_slider_value(ob));
        if (view->current_scrollbar_value < 0)
@@ -563,7 +563,7 @@ void BufferView::ScrollCB(FL_OBJECT * ob, long)
        view->screen->Draw(view->current_scrollbar_value);
 
        if (cursor_follows_scrollbar) {
-               LyXText * vbt = view->_buffer->text;
+               LyXText * vbt = view->buffer_->text;
                int height = vbt->DefaultHeight();
                
                if (vbt->cursor.y < view->screen->first + height) {
@@ -588,9 +588,9 @@ void BufferView::DownCB(FL_OBJECT * ob, long)
 {
        BufferView * view = static_cast<BufferView*>(ob->u_vdata);
 
-       if (view->_buffer == 0) return;
+       if (view->buffer_ == 0) return;
        
-       XEvent const *ev2;
+       XEvent const * ev2;
        static long time = 0;
        ev2 = fl_last_event();
        if (ev2->type == ButtonPress || ev2->type == ButtonRelease) 
@@ -609,7 +609,7 @@ void BufferView::DownCB(FL_OBJECT * ob, long)
 
 int BufferView::ScrollUp(long time)
 {
-       if (_buffer == 0) return 0;
+       if (buffer_ == 0) return 0;
        if (!screen)
                return 0;
    
@@ -618,12 +618,12 @@ int BufferView::ScrollUp(long time)
        if (value == 0)
                return 0;
    
-       float add_value =  (_buffer->text->DefaultHeight()
+       float add_value =  (buffer_->text->DefaultHeight()
                            + float(time) * float(time) * 0.125);
    
        if (add_value > work_area->h)
                add_value = float(work_area->h -
-                                 _buffer->text->DefaultHeight());
+                                 buffer_->text->DefaultHeight());
    
        value -= add_value;
 
@@ -639,7 +639,7 @@ int BufferView::ScrollUp(long time)
 
 int BufferView::ScrollDown(long time)
 {
-       if (_buffer == 0) return 0;
+       if (buffer_ == 0) return 0;
        if (!screen)
                return 0;
    
@@ -650,12 +650,12 @@ int BufferView::ScrollDown(long time)
        if (value == max)
                return 0;
    
-       float add_value =  (_buffer->text->DefaultHeight()
+       float add_value =  (buffer_->text->DefaultHeight()
                            + float(time) * float(time) * 0.125);
    
        if (add_value > work_area->h)
                add_value = float(work_area->h -
-                                 _buffer->text->DefaultHeight());
+                                 buffer_->text->DefaultHeight());
    
        value += add_value;
    
@@ -671,7 +671,7 @@ int BufferView::ScrollDown(long time)
 
 void BufferView::ScrollUpOnePage(long /*time*/)
 {
-       if (_buffer == 0) return;
+       if (buffer_ == 0) return;
        if (!screen)
                return;
    
@@ -679,7 +679,7 @@ void BufferView::ScrollUpOnePage(long /*time*/)
 
        if (!y) return;
    
-       Row* row = _buffer->text->GetRowNearY(y);
+       Row* row = buffer_->text->GetRowNearY(y);
        y = y - work_area->h + row->height;
        
        fl_set_slider_value(scrollbar, y);
@@ -690,7 +690,7 @@ void BufferView::ScrollUpOnePage(long /*time*/)
 
 void BufferView::ScrollDownOnePage(long /*time*/)
 {
-       if (_buffer == 0) return;
+       if (buffer_ == 0) return;
        if (!screen)
                return;
    
@@ -698,11 +698,11 @@ void BufferView::ScrollDownOnePage(long /*time*/)
        fl_get_slider_bounds(scrollbar, &min, &max);
        long y = screen->first;
    
-       if (y > _buffer->text->height - work_area->h)
+       if (y > buffer_->text->height - work_area->h)
                return;
    
        y += work_area->h;
-       _buffer->text->GetRowNearY(y);
+       buffer_->text->GetRowNearY(y);
        
        fl_set_slider_value(scrollbar, y);
    
@@ -747,18 +747,18 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
        // Done by the raw callback:
        //  case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
        case FL_FOCUS:
-               if (!view->_owner->getMiniBuffer()->shows_no_match)
-                       view->_owner->getMiniBuffer()->Init();
-               view->_owner->getMiniBuffer()->shows_no_match = false;
+               if (!view->owner_->getMiniBuffer()->shows_no_match)
+                       view->owner_->getMiniBuffer()->Init();
+               view->owner_->getMiniBuffer()->shows_no_match = false;
                view->work_area_focus = true;
                fl_set_timer(view->timer_cursor, 0.4);
                break;
        case FL_UNFOCUS:
-               view->_owner->getMiniBuffer()->ExecCommand();
+               view->owner_->getMiniBuffer()->ExecCommand();
                view->work_area_focus = false;
                break;
        case FL_ENTER:
-               SetXtermCursor(view->_owner->getForm()->window);
+               SetXtermCursor(view->owner_->getForm()->window);
                // reset the timer
                view->lyx_focus = true;
                fl_set_timer(view->timer_cursor, 0.4);
@@ -766,7 +766,7 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
        case FL_LEAVE: 
                if (!input_prohibited)
                        XUndefineCursor(fl_display,
-                                       view->_owner->getForm()->window);
+                                       view->owner_->getForm()->window);
                view->lyx_focus = false; // This is not an absolute truth
                // but if it is not true, it will be changed within a blink
                // of an eye. ... Not good enough... use regulare timeperiod
@@ -775,37 +775,37 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
                break;
        case FL_DBLCLICK: 
                // select a word 
-               if (view->_buffer && !view->_buffer->the_locking_inset) {
+               if (view->buffer_ && !view->buffer_->the_locking_inset) {
                        if (view->screen && ev->xbutton.button == 1) {
                                view->screen->HideCursor();
                                view->screen->ToggleSelection(); 
-                               view->_buffer->text->SelectWord();
+                               view->buffer_->text->SelectWord();
                                view->screen->ToggleSelection(false);
                                /* This will fit the cursor on the screen
                                 * if necessary */ 
-                               view->_buffer->update(0); 
+                               view->buffer_->update(0); 
                        }
                }
                break;
        case FL_TRPLCLICK:
                // select a line
-               if (view->_buffer && view->screen && ev->xbutton.button == 1) {
+               if (view->buffer_ && view->screen && ev->xbutton.button == 1) {
                        view->screen->HideCursor(); 
                        view->screen->ToggleSelection(); 
-                       view->_buffer->text->CursorHome();
-                       view->_buffer->text->sel_cursor =
-                               view->_buffer->text->cursor;
-                       view->_buffer->text->CursorEnd();
-                       view->_buffer->text->SetSelection();
+                       view->buffer_->text->CursorHome();
+                       view->buffer_->text->sel_cursor =
+                               view->buffer_->text->cursor;
+                       view->buffer_->text->CursorEnd();
+                       view->buffer_->text->SetSelection();
                        view->screen->ToggleSelection(false); 
                        /* This will fit the cursor on the screen
                         * if necessary */ 
-                       view->_buffer->update(0); 
+                       view->buffer_->update(0); 
                }
                break;
        case FL_OTHER:
                view->WorkAreaSelectionNotify(ob,
-                                             view->_owner->getForm()->window,
+                                             view->owner_->getForm()->window,
                                              0,0,ev,0); 
                break;
        }
@@ -817,13 +817,13 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
                                     XEvent *ev, void */*d*/)
 {
 
-       if (_buffer == 0) return 0;
+       if (buffer_ == 0) return 0;
        if (!screen) return 0;
 
        // Check for inset locking
-       if (_buffer->the_locking_inset) {
-               LyXCursor cursor = _buffer->text->cursor;
-               _buffer->the_locking_inset->
+       if (buffer_->the_locking_inset) {
+               LyXCursor cursor = buffer_->text->cursor;
+               buffer_->the_locking_inset->
                        InsetMotionNotify(ev->xbutton.x - ob->x - cursor.x,
                                          ev->xbutton.y - ob->y -
                                          (cursor.y),
@@ -840,15 +840,15 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
        if (selection_possible) {
                screen->HideCursor();
 
-               _buffer->text->
+               buffer_->text->
                        SetCursorFromCoordinates(ev->xbutton.x - ob->x,
                                                 ev->xbutton.y - ob->y +
                                                 screen->first);
       
-               if (!_buffer->text->selection)
-                   _buffer->update(-3); // Maybe an empty line was deleted
+               if (!buffer_->text->selection)
+                   buffer_->update(-3); // Maybe an empty line was deleted
       
-               _buffer->text->SetSelection();
+               buffer_->text->SetSelection();
                screen->ToggleToggle();
                if (screen->FitCursor())
                        updateScrollbar(); 
@@ -867,7 +867,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
        last_click_x = -1;
        last_click_y = -1;
 
-       if (_buffer == 0) return 0;
+       if (buffer_ == 0) return 0;
        if (!screen) return 0;
 
        int const x = ev->xbutton.x - ob->x;
@@ -885,17 +885,17 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
 
        {
                
-       if (_buffer->the_locking_inset) {
+       if (buffer_->the_locking_inset) {
                // We are in inset locking mode
                
                /* Check whether the inset was hit. If not reset mode,
                   otherwise give the event to the inset */
                if (inset_hit != 0) {
-                       _buffer->the_locking_inset->
+                       buffer_->the_locking_inset->
                                InsetButtonPress(inset_x, inset_y, button);
                        return 0;
                } else {
-                       UnlockInset(_buffer->the_locking_inset);
+                       UnlockInset(buffer_->the_locking_inset);
                }
        }
        
@@ -904,22 +904,22 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
        
        // Right button mouse click on a table
        if (button == 3 &&
-           (_buffer->text->cursor.par->table ||
-            _buffer->text->MouseHitInTable(x, y+screen->first))) {
+           (buffer_->text->cursor.par->table ||
+            buffer_->text->MouseHitInTable(x, y+screen->first))) {
                // Set the cursor to the press-position
-               _buffer->text->SetCursorFromCoordinates(x, y + screen->first);
+               buffer_->text->SetCursorFromCoordinates(x, y + screen->first);
                bool doit = true;
                
                // Only show the table popup if the hit is in the table, too
-               if (!_buffer->text->HitInTable(_buffer->text->cursor.row, x))
+               if (!buffer_->text->HitInTable(buffer_->text->cursor.row, x))
                        doit = false;
                
                // Hit above or below the table?
                if (doit) {
-                       if (!_buffer->text->selection) {
+                       if (!buffer_->text->selection) {
                                screen->ToggleSelection();
-                               _buffer->text->ClearSelection();
-                               _buffer->text->FullRebreak();
+                               buffer_->text->ClearSelection();
+                               buffer_->text->FullRebreak();
                                screen->Update();
                                updateScrollbar();
                        }
@@ -930,7 +930,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
                        // the right mouse. So this should be done more
                        // general in the future. Matthias.
                        selection_possible = false;
-                       _owner->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
+                       owner_->getLyXFunc()->Dispatch(LFUN_LAYOUT_TABLE,
                                                       "true");
                        return 0;
                }
@@ -940,16 +940,16 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
        
        // Middle button press pastes if we have a selection
        bool paste_internally = false;
-       if (button == 2  // && !_buffer->the_locking_inset
-           && _buffer->text->selection) {
-               _owner->getLyXFunc()->Dispatch(LFUN_COPY);
+       if (button == 2  // && !buffer_->the_locking_inset
+           && buffer_->text->selection) {
+               owner_->getLyXFunc()->Dispatch(LFUN_COPY);
                paste_internally = true;
        }
        
        // Clear the selection
        screen->ToggleSelection();
-       _buffer->text->ClearSelection();
-       _buffer->text->FullRebreak();
+       buffer_->text->ClearSelection();
+       buffer_->text->FullRebreak();
        screen->Update();
        updateScrollbar();
                
@@ -957,8 +957,8 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
        if (inset_hit != 0 && inset_hit->Editable() == 2) {
                // Highly editable inset, like math
                selection_possible = false;
-               _owner->updateLayoutChoice();
-               _owner->getMiniBuffer()->Set(inset_hit->EditMessage());
+               owner_->updateLayoutChoice();
+               owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
                inset_hit->Edit(inset_x, inset_y);
                return 0;
        } 
@@ -969,12 +969,12 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
                return 0;
        }
        
-       _buffer->text->SetCursorFromCoordinates(x, y + screen_first);
-       _buffer->text->FinishUndo();
-       _buffer->text->sel_cursor = _buffer->text->cursor;
-       _buffer->text->cursor.x_fix = _buffer->text->cursor.x;
+       buffer_->text->SetCursorFromCoordinates(x, y + screen_first);
+       buffer_->text->FinishUndo();
+       buffer_->text->sel_cursor = buffer_->text->cursor;
+       buffer_->text->cursor.x_fix = buffer_->text->cursor.x;
        
-       _owner->updateLayoutChoice();
+       owner_->updateLayoutChoice();
        if (screen->FitCursor()){
                updateScrollbar();
                selection_possible = false;
@@ -982,11 +982,11 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
 
        // Insert primary selection with middle mouse
        // if there is a local selection in the current buffer, insert this
-       if (button == 2) { //  && !_buffer->the_locking_inset){
+       if (button == 2) { //  && !buffer_->the_locking_inset){
                if (paste_internally)
-                       _owner->getLyXFunc()->Dispatch(LFUN_PASTE);
+                       owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
                else
-                       _owner->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
+                       owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
                                                       "paragraph");
                selection_possible = false;
                return 0;
@@ -1025,7 +1025,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
 int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
                          int /*w*/, int /*h*/, XEvent *ev, void */*d*/)
 {
-       if (_buffer == 0 || screen == 0) return 0;
+       if (buffer_ == 0 || screen == 0) return 0;
 
        int const x = ev->xbutton.x - ob->x;
        int const y = ev->xbutton.y - ob->y;
@@ -1037,28 +1037,28 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
        int inset_y = y;
        Inset * inset_hit = checkInsetHit(inset_x, inset_y);
 
-       if (_buffer->the_locking_inset) {
+       if (buffer_->the_locking_inset) {
                // We are in inset locking mode.
 
                /* LyX does a kind of work-area grabbing for insets.
                   Only a ButtonPress Event outside the inset will 
                   force a InsetUnlock. */
-               _buffer->the_locking_inset->
+               buffer_->the_locking_inset->
                        InsetButtonRelease(inset_x, inset_y, 
                                           ev->xbutton.button);
                return 0;
        }
   
        selection_possible = false;
-        if (_buffer->text->cursor.par->table) {
-                int cell = _buffer->text->
-                        NumberOfCell(_buffer->text->cursor.par,
-                                     _buffer->text->cursor.pos);
-                if (_buffer->text->cursor.par->table->IsContRow(cell) &&
-                    _buffer->text->cursor.par->table->
-                    CellHasContRow(_buffer->text->cursor.par->table->
+        if (buffer_->text->cursor.par->table) {
+                int cell = buffer_->text->
+                        NumberOfCell(buffer_->text->cursor.par,
+                                     buffer_->text->cursor.pos);
+                if (buffer_->text->cursor.par->table->IsContRow(cell) &&
+                    buffer_->text->cursor.par->table->
+                    CellHasContRow(buffer_->text->cursor.par->table->
                                    GetCellAbove(cell))<0) {
-                        _buffer->text->CursorUp();
+                        buffer_->text->CursorUp();
                 }
         }
        
@@ -1092,38 +1092,38 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
                // ...or maybe the SetCursorParUndo()
                // below isn't necessary at all anylonger?
                if (inset_hit->LyxCode() == Inset::REF_CODE) {
-                       _buffer->text->SetCursorParUndo();
+                       buffer_->text->SetCursorParUndo();
                }
 
-               _owner->getMiniBuffer()->Set(inset_hit->EditMessage());
+               owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
                inset_hit->Edit(inset_x, inset_y);
                return 0;
        }
 
        // check whether we want to open a float
-       if (_buffer->text) {
+       if (buffer_->text) {
                bool hit = false;
                char c = ' ';
-               if (_buffer->text->cursor.pos <
-                   _buffer->text->cursor.par->Last()) {
-                       c = _buffer->text->cursor.par->
-                               GetChar(_buffer->text->cursor.pos);
+               if (buffer_->text->cursor.pos <
+                   buffer_->text->cursor.par->Last()) {
+                       c = buffer_->text->cursor.par->
+                               GetChar(buffer_->text->cursor.pos);
                }
                if (c == LYX_META_FOOTNOTE || c == LYX_META_MARGIN
                    || c == LYX_META_FIG || c == LYX_META_TAB
                    || c == LYX_META_WIDE_FIG || c == LYX_META_WIDE_TAB
                     || c == LYX_META_ALGORITHM){
                        hit = true;
-               } else if (_buffer->text->cursor.pos - 1 >= 0) {
-                       c = _buffer->text->cursor.par->
-                               GetChar(_buffer->text->cursor.pos - 1);
+               } else if (buffer_->text->cursor.pos - 1 >= 0) {
+                       c = buffer_->text->cursor.par->
+                               GetChar(buffer_->text->cursor.pos - 1);
                        if (c == LYX_META_FOOTNOTE || c == LYX_META_MARGIN
                            || c == LYX_META_FIG || c == LYX_META_TAB
                            || c == LYX_META_WIDE_FIG 
                            || c == LYX_META_WIDE_TAB
                            || c == LYX_META_ALGORITHM){
                                // We are one step too far to the right
-                               _buffer->text->CursorLeft();
+                               buffer_->text->CursorLeft();
                                hit = true;
                        }
                }
@@ -1135,11 +1135,11 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
        }
 
        // Do we want to close a float? (click on the float-label)
-       if (_buffer->text->cursor.row->par->footnoteflag ==
+       if (buffer_->text->cursor.row->par->footnoteflag ==
            LyXParagraph::OPEN_FOOTNOTE
-           && _buffer->text->cursor.pos == 0
-           && _buffer->text->cursor.row->previous &&
-           _buffer->text->cursor.row->previous->par->
+           && buffer_->text->cursor.pos == 0
+           && buffer_->text->cursor.row->previous &&
+           buffer_->text->cursor.row->previous->par->
            footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
                LyXFont font (LyXFont::ALL_SANE);
                font.setSize(LyXFont::SIZE_SMALL);
@@ -1150,10 +1150,10 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
                int screen_first = screen->first;
 
                if (x < box_x
-                   && y + screen_first > _buffer->text->cursor.y -
-                   _buffer->text->cursor.row->baseline
-                   && y + screen_first < _buffer->text->cursor.y -
-                   _buffer->text->cursor.row->baseline
+                   && y + screen_first > buffer_->text->cursor.y -
+                   buffer_->text->cursor.row->baseline
+                   && y + screen_first < buffer_->text->cursor.y -
+                   buffer_->text->cursor.row->baseline
                    + font.maxAscent()*1.2 + font.maxDescent()*1.2) {
                        ToggleFloat();
                        selection_possible = false;
@@ -1162,10 +1162,10 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
        }
 
        // Maybe we want to edit a bibitem ale970302
-       if (_buffer->text->cursor.par->bibkey && x < 20 + 
-           bibitemMaxWidth(textclasslist.TextClass(_buffer->
+       if (buffer_->text->cursor.par->bibkey && x < 20 + 
+           bibitemMaxWidth(textclasslist.TextClass(buffer_->
                                        params.textclass).defaultfont())) {
-               _buffer->text->cursor.par->bibkey->Edit(0, 0);
+               buffer_->text->cursor.par->bibkey->Edit(0, 0);
        }
 
        return 0;
@@ -1184,7 +1184,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
   
        int y_tmp = y + getScreen()->first;
   
-       LyXCursor cursor = _buffer->text->cursor;
+       LyXCursor cursor = buffer_->text->cursor;
        if (cursor.pos < cursor.par->Last() 
            && cursor.par->GetChar(cursor.pos) == LYX_META_INSET
            && cursor.par->GetInset(cursor.pos)
@@ -1192,7 +1192,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
 
                // Check whether the inset really was hit
                Inset* tmpinset = cursor.par->GetInset(cursor.pos);
-               LyXFont font = _buffer->text->GetFont(cursor.par, cursor.pos);
+               LyXFont font = buffer_->text->GetFont(cursor.par, cursor.pos);
                if (x > cursor.x
                    && x < cursor.x + tmpinset->Width(font) 
                    && y_tmp > cursor.y - tmpinset->Ascent(font)
@@ -1206,10 +1206,10 @@ Inset * BufferView::checkInsetHit(int & x, int & y)
                   && cursor.par->GetChar(cursor.pos - 1) == LYX_META_INSET
                   && cursor.par->GetInset(cursor.pos - 1)
                   && cursor.par->GetInset(cursor.pos - 1)->Editable()) {
-               _buffer->text->CursorLeft();
+               buffer_->text->CursorLeft();
                Inset * result = checkInsetHit(x, y);
                if (result == 0) {
-                       _buffer->text->CursorRight();
+                       buffer_->text->CursorRight();
                        return 0;
                } else {
                        return result;
@@ -1239,7 +1239,7 @@ int BufferView::workAreaExpose()
        // update from work area
        work_area_width = work_area->w;
        work_area_height = work_area->h;
-       if (_buffer != 0) {
+       if (buffer_ != 0) {
                if (widthChange) {
                        // All buffers need a resize
                        bufferlist.resize();
@@ -1254,7 +1254,7 @@ int BufferView::workAreaExpose()
                        // The main window size has changed, repaint most stuff
                        redraw();
                        // ...including the minibuffer
-                       _owner->getMiniBuffer()->Init();
+                       owner_->getMiniBuffer()->Init();
 
                } else if (screen) screen->Redraw();
        } else {
@@ -1266,7 +1266,7 @@ int BufferView::workAreaExpose()
 
        // always make sure that the scrollbar is sane.
        updateScrollbar();
-       _owner->updateLayoutChoice();
+       owner_->updateLayoutChoice();
        return 1;
 }
 
@@ -1278,7 +1278,7 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
        
        /* quite a nice place for asyncron Inset updating, isn't it? */
        // actually no! This is run even if no buffer exist... so (Lgb)
-       if (view && !view->_buffer) {
+       if (view && !view->buffer_) {
                goto set_timer_and_return;
        }
 
@@ -1326,20 +1326,20 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
        }
 
        if (view->lyx_focus && view->work_area_focus) {
-               if (!view->_buffer->the_locking_inset){
+               if (!view->buffer_->the_locking_inset){
                        view->screen->CursorToggle();
                } else {
-                       view->_buffer->the_locking_inset->
+                       view->buffer_->the_locking_inset->
                                ToggleInsetCursor();
                }
                goto set_timer_and_return;
        } else {
                // Make sure that the cursor is visible.
-               if (!view->_buffer->the_locking_inset){
+               if (!view->buffer_->the_locking_inset){
                        view->screen->ShowCursor();
                } else {
-                       if (!view->_buffer->the_locking_inset->isCursorVisible())
-                               view->_buffer->the_locking_inset->
+                       if (!view->buffer_->the_locking_inset->isCursorVisible())
+                               view->buffer_->the_locking_inset->
                                        ToggleInsetCursor();
                }
 
@@ -1349,12 +1349,12 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
                XGetInputFocus(fl_display, &tmpwin, &tmp);
                if (lyxerr.debugging()) {
                        lyxerr << "tmpwin: " << tmpwin
-                              << "\nwindow: " << view->_owner->getForm()->window
+                              << "\nwindow: " << view->owner_->getForm()->window
                               << "\nwork_area_focus: " << view->work_area_focus
                               << "\nlyx_focus      : " << view->lyx_focus
                               << endl;
                }
-               if (tmpwin != view->_owner->getForm()->window) {
+               if (tmpwin != view->owner_->getForm()->window) {
                        view->lyx_focus = false;
                        goto skip_timer;
                } else {
@@ -1376,7 +1376,7 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
 int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
                            int /*w*/, int /*h*/, XEvent *event, void */*d*/)
 {
-       if (_buffer == 0) return 0;
+       if (buffer_ == 0) return 0;
        if (event->type != SelectionNotify)
                return 0;
 
@@ -1433,17 +1433,17 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
         
                if (uc){
                        if (!ascii_type) {
-                               _buffer->text->
+                               buffer_->text->
                                        InsertStringA(reinterpret_cast<char*>(uc));
                        } else {
-                               _buffer->text->
+                               buffer_->text->
                                        InsertStringB(reinterpret_cast<char*>(uc));
                        }
                        free(uc);
                        uc = 0;
                }
     
-               _buffer->update(1);
+               buffer_->update(1);
        }
        return 0;
 }
@@ -1451,61 +1451,61 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
 
 void BufferView::cursorPrevious()
 {
-       if (!currentBuffer()->text->cursor.row->previous) return;
+       if (!buffer()->text->cursor.row->previous) return;
        
        long y = getScreen()->first;
-       Row * cursorrow = currentBuffer()->text->cursor.row;
-       currentBuffer()->text->
-         SetCursorFromCoordinates(currentBuffer()->text->
+       Row * cursorrow = buffer()->text->cursor.row;
+       buffer()->text->
+         SetCursorFromCoordinates(buffer()->text->
                                   cursor.x_fix,
                                   y);
-       currentBuffer()->text->FinishUndo();
-       /* this is to allow jumping over large insets */
-       if ((cursorrow == currentBuffer()->text->cursor.row))
-         currentBuffer()->text->CursorUp();
+       buffer()->text->FinishUndo();
+       // this is to allow jumping over large insets
+       if ((cursorrow == buffer()->text->cursor.row))
+         buffer()->text->CursorUp();
        
-       if (currentBuffer()->text->cursor.row->height < work_area->h)
-         getScreen()->Draw(currentBuffer()->text->cursor.y
-                           - currentBuffer()->text->cursor.row->baseline
-                           + currentBuffer()->text->cursor.row->height
+       if (buffer()->text->cursor.row->height < work_area->h)
+         getScreen()->Draw(buffer()->text->cursor.y
+                           - buffer()->text->cursor.row->baseline
+                           + buffer()->text->cursor.row->height
                            - work_area->h +1 );
 }
 
 
 void BufferView::cursorNext()
 {
-       if (!currentBuffer()->text->cursor.row->next) return;
+       if (!buffer()->text->cursor.row->next) return;
        
        long y = getScreen()->first;
-       currentBuffer()->text->GetRowNearY(y);
-       Row* cursorrow = currentBuffer()->text->cursor.row;
-       currentBuffer()->text->
-               SetCursorFromCoordinates(currentBuffer()->text->
+       buffer()->text->GetRowNearY(y);
+       Row * cursorrow = buffer()->text->cursor.row;
+       buffer()->text->
+               SetCursorFromCoordinates(buffer()->text->
                                         cursor.x_fix, 
                                         y + work_area->h);
-       currentBuffer()->text->FinishUndo();
+       buffer()->text->FinishUndo();
        /* this is to allow jumping over large insets */
-       if ((cursorrow == currentBuffer()->text->cursor.row))
-         currentBuffer()->text->CursorDown();
+       if ((cursorrow == buffer()->text->cursor.row))
+         buffer()->text->CursorDown();
        
-       if (currentBuffer()->text->cursor.row->height < work_area->h)
-         getScreen()->Draw(currentBuffer()->text->cursor.y
-                           - currentBuffer()->text->cursor.row->baseline);
+       if (buffer()->text->cursor.row->height < work_area->h)
+         getScreen()->Draw(buffer()->text->cursor.y
+                           - buffer()->text->cursor.row->baseline);
 }
 
 
 bool BufferView::available() const
 {
-       if (_buffer && _buffer->text) return true;
+       if (buffer_ && buffer_->text) return true;
        return false;
 }
 
 
 void BufferView::savePosition()
 {
-       backstack.push(currentBuffer()->getFileName(),
-                       currentBuffer()->text->cursor.x,
-                       currentBuffer()->text->cursor.y);
+       backstack.push(buffer()->getFileName(),
+                       buffer()->text->cursor.x,
+                       buffer()->text->cursor.y);
 }
 
 
@@ -1519,7 +1519,7 @@ void BufferView::restorePosition()
        BeforeChange();
        Buffer * b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
                bufferlist.loadLyXFile(fname); // don't ask, just load it
-       setBuffer(b);
-       currentBuffer()->text->SetCursorFromCoordinates(x, y);
-       currentBuffer()->update(0);
+       buffer(b);
+       buffer()->text->SetCursorFromCoordinates(x, y);
+       buffer()->update(0);
 } 
index 07bc95f88a3d72b922443318d0108614bfa20b7c..2dd63c345ec46d875442d18f37ef66cd0bea4b53 100644 (file)
@@ -30,11 +30,11 @@ public:
        ///
        BufferView(LyXView *owner, int ,int ,int, int);
        ///
-       Buffer *currentBuffer() { return _buffer; }
+       Buffer * buffer() const { return buffer_; }
        ///
-       FL_OBJECT *getWorkArea() { return work_area; }
+       FL_OBJECT * getWorkArea() { return work_area; }
        ///
-       void setBuffer(Buffer *b);
+       void buffer(Buffer * b);
        ///
        void resize();
        ///
@@ -58,9 +58,9 @@ public:
        /// 
        bool available() const;
        ///
-       LyXView *getOwner() { return _owner; }
+       LyXView * owner() const { return owner_; }
        ///
-       LyXScreen *getScreen()
+       LyXScreen * getScreen()
        {
                fl_set_timer(timer_cursor, 0.4);
                return screen;
@@ -77,7 +77,7 @@ private:
        ///
        void create_view(int, int, int, int);
        ///
-       Inset * checkInsetHit(int &x, int &y);
+       Inset * checkInsetHit(int & x, int & y);
        /// 
        int ScrollUp(long time);
        ///
@@ -89,46 +89,46 @@ private:
 
 public:
        /// A callback for the up arrow in the scrollbar.
-       static void UpCB(FL_OBJECT *ob, long);
+       static void UpCB(FL_OBJECT * ob, long);
 
        /// A callback for the slider in the scrollbar.
-       static void ScrollCB(FL_OBJECT *ob, long);
+       static void ScrollCB(FL_OBJECT * ob, long);
 
        /// A callback for the down arrow in the scrollbar.
-       static void DownCB(FL_OBJECT *ob, long);
+       static void DownCB(FL_OBJECT * ob, long);
 
        ///
-       static void CursorToggleCB(FL_OBJECT *ob, long);
+       static void CursorToggleCB(FL_OBJECT * ob, long);
        /** Work area free object handler
         */
        static int work_area_handler(FL_OBJECT *, int event,
                                     FL_Coord, FL_Coord, int key, void *xev);
 private:
        ///
-       int WorkAreaMotionNotify(FL_OBJECT *ob,
+       int WorkAreaMotionNotify(FL_OBJECT * ob,
                                 Window win,
                                 int w, int h,
-                                XEvent *ev, void *d);
+                                XEvent * ev, void * d);
        ///
        int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
                                    int /*w*/, int /*h*/,
-                                   XEvent *event, void */*d*/);
+                                   XEvent * event, void * /*d*/);
        ///
-       int WorkAreaButtonPress(FL_OBJECT *ob,
+       int WorkAreaButtonPress(FL_OBJECT * ob,
                                Window win,
                                int w, int h,
-                               XEvent *ev, void *d);
+                               XEvent * ev, void * d);
        ///
-       int WorkAreaButtonRelease(FL_OBJECT *ob,
+       int WorkAreaButtonRelease(FL_OBJECT * ob,
                                  Window win,
                                  int w, int h,
-                                 XEvent *ev, void *d);
+                                 XEvent * ev, void * d);
        ///
-       LyXView *_owner;
+       LyXView * owner_;
        ///
-       Buffer *_buffer;
+       Buffer * buffer_;
        ///
-       LyXScreen *screen;
+       LyXScreen * screen;
        ///
        long current_scrollbar_value;
        ///
@@ -138,17 +138,17 @@ private:
        ///
        bool work_area_focus;
        ///
-       FL_OBJECT *work_area;
+       FL_OBJECT * work_area;
        ///
-       FL_OBJECT *figinset_canvas;
+       FL_OBJECT * figinset_canvas;
        ///
-       FL_OBJECT *scrollbar;
+       FL_OBJECT * scrollbar;
        ///
-       FL_OBJECT *button_down;
+       FL_OBJECT * button_down;
        ///
-       FL_OBJECT *button_up;
+       FL_OBJECT * button_up;
        ///
-       FL_OBJECT *timer_cursor;
+       FL_OBJECT * timer_cursor;
         ///
         BackStack backstack;
        ///
index 6f1480c31488beedfe88af2578db2412bb0b2295..3901695e2ce780c171c0f050f1a6c33fee8d90b3 100644 (file)
@@ -196,14 +196,14 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
 }
 
 /// Do load font
-XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family, 
+XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, 
                                LyXFont::FONT_SERIES series, 
                                LyXFont::FONT_SHAPE shape, 
                                LyXFont::FONT_SIZE size)
 {
        getFontinfo(family,series,shape);
-       int fsize = (int) ( (lyxrc->font_sizes[size] * lyxrc->dpi * 
-                               (lyxrc->zoom/100.0) ) / 72.27 + 0.5 );
+       int fsize = int( (lyxrc->font_sizes[size] * lyxrc->dpi * 
+                         (lyxrc->zoom/100.0) ) / 72.27 + 0.5 );
 
        string font = fontinfo[family][series][shape]->getFontname(fsize);
 
@@ -216,10 +216,10 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
        minibuffer->Store();
        minibuffer->Set(_("Loading font into X-Server..."));
 
-       XFontStruct* fs = XLoadQueryFont(fl_display, font.c_str());
+       XFontStruct * fs = XLoadQueryFont(fl_display, font.c_str());
 
        if (fs == 0) {
-               if (font=="fixed") {
+               if (font == "fixed") {
                        lyxerr << "We're doomed. Can't get 'fixed' font." << endl;
                } else {
                        lyxerr << "Could not get font. Using 'fixed'." << endl;
index 6c2c72669b37b346e36a7ce394636b000fe2d7db..cf839c676274929039cd04abe66e0f47b1cdfb10 100644 (file)
@@ -7,7 +7,7 @@
  *           Copyright 1995 Matthias Ettrich
  *           Copyright 1995-1999 the LyX Team.
  *
- * ======================================================*/
+ * ====================================================== */
 
 #include <config.h>
 
@@ -25,7 +25,8 @@
 
 extern LyXRC * lyxrc;
 
-LaTeXFeatures::LaTeXFeatures(int n) 
+LaTeXFeatures::LaTeXFeatures(int n)
+       : layout(n, false)
 {
        // packages
        color = false;
@@ -66,15 +67,10 @@ LaTeXFeatures::LaTeXFeatures(int n)
        LyXParagraphIndent = false;
        NeedLyXFootnoteCode = false;
        NeedLyXMinipageIndent = false;
-
-       // layouts
-       layout = new bool[n];
-       for (int i = n; i--;) 
-               layout[i] = false;
 }
 
 
-string LaTeXFeatures::getPackages(BufferParams const &params)
+string LaTeXFeatures::getPackages(BufferParams const & params)
 {
        string packages;
        LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
@@ -232,9 +228,10 @@ string LaTeXFeatures::getTClassPreamble(BufferParams const & params)
        LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
        string tcpreamble = tclass.preamble();
 
-       for (LyXTextClass::LayoutList::const_iterator cit = tclass.begin();
-            cit != tclass.end(); ++cit) {
-               tcpreamble += (*cit).preamble();
+       for (unsigned int i = 0; i < tclass.numLayouts(); ++i) {
+               if (layout[i]) {
+                       tcpreamble += tclass[i].preamble();
+               }
        }
 
        return tcpreamble;
index a7c828ab303dbd4bb1c691030442f9a33eef7fb9..9962d17a744d531ed1022ec78ea9958c892e3deb 100644 (file)
@@ -17,6 +17,8 @@
 #pragma interface
 #endif
 
+#include <vector>
+
 #include "LString.h"
 
 class BufferParams; 
@@ -31,10 +33,6 @@ class LyXTextClass;
 struct LaTeXFeatures {
        ///
        LaTeXFeatures(int n) ;
-       ///
-       ~LaTeXFeatures() {
-               delete[] layout;
-       }
        /// The packaes needed by the document
        string getPackages(BufferParams const &params);
        /// The macros definitions needed by the document
@@ -118,7 +116,7 @@ struct LaTeXFeatures {
        
        //@Man: Layouts
        //@{
-       bool *layout;
+       vector<bool> layout;
        //@}
        
        //@Man: Special features
index bd7f7e58d10fe4815f07064b370f13884e59cfc4..6d062b3237dc44983937bf4430920ea3d09650da 100644 (file)
@@ -22,14 +22,14 @@ void ShowLatexLog()
        bool use_build = false;
        static int ow = -1, oh;
 
-       filename = current_view->currentBuffer()->getFileName();
+       filename = current_view->buffer()->getFileName();
        if (!filename.empty()) {
                fname = SpaceLess(ChangeExtension(filename, ".log", true));
                bname = SpaceLess(ChangeExtension(filename,
                                                  lyxrc->literate_extension + ".out", true));
                path = OnlyPath(filename);
                if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
-                       path = current_view->currentBuffer()->tmppath;
+                       path = current_view->buffer()->tmppath;
                }
                FileInfo f_fi(path + fname), b_fi(path + bname);
                if (b_fi.exist())
index 539755b3a1382101764c7c84167c9bc8c54bab51..e85eee0df0c89e1babd63241af3ae462bbe0d13d 100644 (file)
@@ -52,7 +52,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
     string command = fl_get_input(fd_form_sendto->input_cmd);
     if (command.empty())
         return;
-    Buffer *buffer = current_view->currentBuffer();
+    Buffer * buffer = current_view->buffer();
     if (fl_get_button(fd_form_sendto->radio_ftype_dvi) ||
         fl_get_button(fd_form_sendto->radio_ftype_ps)) {
         ProhibitInput();
index 5e2b9ba3e123e8888473fb7be821a16c0ae45cbe..2ca56a41eef46f88b5f416b6f025d54effba027f 100644 (file)
 #include "layout.h"
 #include "lyxtext.h"
 
-extern FD_form_document *fd_form_document;
-FD_form_main *fd_form_main; /* a pointer to the one in LyXView
+extern FD_form_document * fd_form_document;
+FD_form_main * fd_form_main; /* a pointer to the one in LyXView
                               should be removed as soon as possible */
 
-MiniBuffer *minibuffer;/* a pointer to the one in LyXView
+MiniBuffer * minibuffer;/* a pointer to the one in LyXView
                          should be removed as soon as possible */
 
 extern void AutoSave();
@@ -44,7 +44,7 @@ extern void QuitLyX();
 int current_layout = 0;
 
 // This is very temporary
-BufferView *current_view;
+BufferView * current_view;
 
 extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
 
@@ -52,7 +52,7 @@ LyXView::LyXView(int width, int height)
 {
        fd_form_main = create_form_form_main(width,height);
        fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0);
-       lyxerr.debug() << "Initializing LyXFunc" << endl;
+       lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
        lyxfunc = new LyXFunc(this);
        intl = new Intl;
 }
@@ -70,31 +70,31 @@ LyXView::~LyXView()
 
 /// Redraw the main form.
 void LyXView::redraw() {
-       lyxerr.debug() << "LyXView::redraw()" << endl;
+       lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
        fl_redraw_form(_form);
        minibuffer->Activate();
 }
 
 
 // Callback for update timer
-void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
+void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
 {
-       LyXView *view = (LyXView*) ob->u_vdata;
+       LyXView * view = static_cast<LyXView*>(ob->u_vdata);
        if (!view->currentView()->available()) 
                return;
        if (!view->currentView()->getScreen() || !updatetimer)
                return;
 
        view->currentView()->getScreen()->HideCursor();
-       view->currentBuffer()->update(-2);
+       view->buffer()->update(-2);
        /* This update can happen, even when the work area has lost
         * the focus. So suppress the cursor in that case */
        updatetimer = 0;
 }
 
 // Wrapper for the above
-extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
-       LyXView::UpdateTimerCB(ob,data);
+extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data) {
+       LyXView::UpdateTimerCB(ob, data);
 }
 
 
@@ -102,12 +102,12 @@ extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT *ob, long data) {
 // Callback for autosave timer
 void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
 {
-       lyxerr.debug() << "Running AutoSave()" << endl;
+       lyxerr[Debug::INFO] << "Running AutoSave()" << endl;
        AutoSave();
 }
 
 // Wrapper for the above
-extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT *ob, long data) {
+extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data) {
        LyXView::AutosaveTimerCB(ob, data);
 }
 
@@ -127,9 +127,10 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
        return FL_IGNORE;
 }
 
+
 // Wrapper for the above
-extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *form, void *p) {
-       return LyXView::atCloseMainFormCB(form,p);
+extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p) {
+       return LyXView::atCloseMainFormCB(form, p);
 }
 
 
@@ -139,7 +140,7 @@ void LyXView::setPosition(int x, int y)
 }
 
 
-void LyXView::show(int place, int border, char const* title)
+void LyXView::show(int place, int border, char const * title)
 {
        fl_show_form(_form, place, border, title);
        minibuffer->Init();
@@ -147,7 +148,7 @@ void LyXView::show(int place, int border, char const* title)
 }
 
 
-FD_form_main *LyXView::create_form_form_main(int width, int height)
+FD_form_main * LyXView::create_form_form_main(int width, int height)
        /* to make this work as it should, .lyxrc should have been
         * read first; OR maybe this one should be made dynamic.
         * Hmmmm. Lgb. 
@@ -156,7 +157,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
         * are presented (and rightly so) in GUI popups. Asger. 
         */
 {
-       FL_OBJECT *obj;
+       FL_OBJECT * obj;
        
        FD_form_main *fdui = (FD_form_main *)
                fl_calloc(1, sizeof(FD_form_main));
@@ -165,9 +166,9 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
 
        // the main form
        _form = fdui->form_main = fl_bgn_form(FL_NO_BOX, width, height);
-       fdui->form_main->u_vdata = (void*) this;
-       obj = fl_add_box(FL_FLAT_BOX,0,0,width,height,"");
-       fl_set_object_color(obj,FL_MCOL,FL_MCOL);
+       fdui->form_main->u_vdata = this;
+       obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
+       fl_set_object_color(obj, FL_MCOL, FL_MCOL);
 
        // Parameters for the appearance of the main form
        const int air = 2;
@@ -221,7 +222,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
        fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER,
                                                0,0,0,0,"Timer");
        fl_set_object_callback(obj,C_LyXView_UpdateTimerCB,0);
-       obj->u_vdata = (void*) this;
+       obj->u_vdata = this;
 
        //
        // Misc
@@ -248,7 +249,7 @@ FD_form_main *LyXView::create_form_form_main(int width, int height)
        return fdui;
 }
 
-extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev);
+extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
 
 void LyXView::init()
 {
@@ -283,7 +284,7 @@ void LyXView::updateLayoutChoice()
 
        // this has a bi-effect that the layouts are not showed when no
        // document is loaded.
-       if (bufferview==0 || bufferview->currentBuffer()==0) {
+       if (bufferview == 0 || bufferview->buffer()==0) {
                toolbar->combox->clear();
                toolbar->combox->Redraw();
                return; 
@@ -291,26 +292,26 @@ void LyXView::updateLayoutChoice()
 
        // If textclass is different, we need to update the list
        if (toolbar->combox->empty() ||
-           (last_textclass != int(currentBuffer()->params.textclass))) {
+           (last_textclass != int(buffer()->params.textclass))) {
                toolbar->combox->clear();
                for (int i = 0;
-                    textclasslist.NameOfLayout(currentBuffer()->
+                    textclasslist.NameOfLayout(buffer()->
                                           params.textclass, i) !="@@end@@";
                     i++) {
                        LyXLayout const & layout = textclasslist.
-                               Style(currentBuffer()->params.textclass, i);
+                               Style(buffer()->params.textclass, i);
                        if (layout.obsoleted_by().empty())
                                toolbar->combox->addline(layout.name().c_str());
                        else
                                toolbar->combox->addline(("@N"+layout.name()).c_str());
                }
-               last_textclass = int(currentBuffer()->params.textclass);
+               last_textclass = int(buffer()->params.textclass);
                current_layout = 0;
        }
        // we need to do this.
        toolbar->combox->Redraw();
        
-       char layout = currentBuffer()->text->cursor.par->GetLayout();
+       char layout = buffer()->text->cursor.par->GetLayout();
 
        if (layout != current_layout){
                toolbar->combox->select(layout + 1);
@@ -321,7 +322,7 @@ void LyXView::updateLayoutChoice()
 
 void LyXView::UpdateDocumentClassChoice()
 {
-       /* update the document class display in the document form */
+       // update the document class display in the document form
        int i;
        if (fd_form_document) {
                fl_clear_choice(fd_form_document->choice_class);
@@ -337,38 +338,38 @@ void LyXView::UpdateDocumentClassChoice()
 // as FL_KEYBOARD events :-(   Matthias 280596
 int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
 {
-       LyXView *view = (LyXView*) fl->u_vdata;
+       LyXView * view = static_cast<LyXView*>(fl->u_vdata);
        int retval = 0;  // 0 means XForms should have a look at this event
 
        // funny. Even though the raw_callback is registered with KeyPressMask,
        // also KeyRelease-events are passed through:-(
        // [It seems that xforms puts them in pairs... (JMarc)]
-       if (((XEvent*)xev)->type == KeyPress
+       if (static_cast<XEvent*>(xev)->type == KeyPress
            && view->bufferview->getWorkArea()->focus
            && view->bufferview->getWorkArea()->active)
-               retval = view->getLyXFunc()->processKeyEvent((XEvent*)xev);
-
+               retval = view->getLyXFunc()
+                       ->processKeyEvent(static_cast<XEvent*>(xev));
        return retval;
 }
 
 // wrapper for the above
-extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
+extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
 {
        return LyXView::KeyPressMask_raw_callback(fl, xev);
 }
 
 // Updates the title of the window with the filename of the current document
 void LyXView::updateWindowTitle() {
-       static string last_title="LyX";
+       static string last_title = "LyX";
        string title = "LyX";
 
        if (currentView()->available()) {
-               string cur_title = currentBuffer()->getFileName();
+               string cur_title = buffer()->getFileName();
                if (!cur_title.empty()){
                        title += ": " + OnlyFilename(cur_title);
-                       if (!currentBuffer()->isLyxClean())
+                       if (!buffer()->isLyxClean())
                                title += _(" (Changed)");
-                       if (currentBuffer()->isReadonly())
+                       if (buffer()->isReadonly())
                                title += _(" (read only)");
                }
        }
index 0f6d4597925f5df608b69d58847c72ed4f2c1924..95565adcff3c9c206c344dd80cdf727cd0342e32 100644 (file)
@@ -31,13 +31,13 @@ class Intl;
 ///
 struct  FD_form_main {
        ///
-       FL_FORM *form_main;
+       FL_FORM * form_main;
        ///
-       FL_OBJECT *timer_autosave;
+       FL_OBJECT * timer_autosave;
        ///
-       FL_OBJECT *timer_update;
+       FL_OBJECT * timer_update;
        ///
-       void *vdata;
+       void * vdata;
        ///
        long ldata;
 };
@@ -70,7 +70,7 @@ public:
        void redraw();
 
        /// returns the buffer currently shown in the main form.
-       Buffer * currentBuffer(){ return bufferview->currentBuffer();}
+       Buffer * buffer() const { return bufferview->buffer(); }
 
        ///
        BufferView * currentView() { return bufferview; }
index 43a680f1edd26ca6098755989ca35a667610c1a7..648140c42d9dab65e97fbeb9d2adc496736ec8ef 100644 (file)
@@ -168,6 +168,8 @@ lyx_SOURCES = \
        trans_mgr.C \
        trans_mgr.h \
        undo.h \
+       vc-backend.C \
+       vc-backend.h \
        version.h \
        vms_defines.h \
        vspace.C \
index 193db2a8d2736eb2a059e0969a18b6973920e3c0..a64ce1f0f4253fffc21cb240ae13e0b657ce9c65 100644 (file)
@@ -112,7 +112,7 @@ bool UpdateLayoutPaper()
                update = false;
 
        if (update) {
-               BufferParams * params = &current_view->currentBuffer()->params;
+               BufferParams * params = &current_view->buffer()->params;
 
                fl_set_choice(fd_form_paper->choice_papersize2,
                              params->papersize2 + 1);
@@ -148,7 +148,7 @@ bool UpdateLayoutPaper()
                fl_set_focus_object(fd_form_paper->form_paper,
                                    fd_form_paper->choice_papersize2);
                fl_hide_object(fd_form_paper->text_warning);
-               if (current_view->currentBuffer()->isReadonly()) {
+               if (current_view->buffer()->isReadonly()) {
                        DisablePaperLayout();
                        fl_set_object_label(fd_form_paper->text_warning,
                                            _("Document is read-only."
@@ -184,7 +184,7 @@ void PaperApplyCB(FL_OBJECT *, long)
        if (! current_view->available()) 
                return;
        
-       BufferParams * params = &current_view->currentBuffer()->params;
+       BufferParams * params = &current_view->buffer()->params;
        
        FD_form_paper const * fd = fd_form_paper;
     
@@ -204,9 +204,9 @@ void PaperApplyCB(FL_OBJECT *, long)
        params->headheight = fl_get_input(fd->input_head_height);
        params->headsep = fl_get_input(fd->input_head_sep);
        params->footskip = fl_get_input(fd->input_foot_skip);
-       current_view->currentBuffer()->setPaperStuff();
+       current_view->buffer()->setPaperStuff();
        minibuffer->Set(_("Paper layout set"));
-       current_view->currentBuffer()->markDirty();
+       current_view->buffer()->markDirty();
        
        return;
 }
index 934fd3d270d5164aaaf8a1e04e0e20f580fafe9b..dfd5aac7b066634ada0f18bd3f3d93d7ac00c142 100644 (file)
@@ -76,7 +76,7 @@ bool UpdateParagraphExtra()
     bool update = false;
     if (current_view->getScreen() && current_view->available()) {
         update = true;
-        LyXParagraph* par = current_view->currentBuffer()->text->cursor.par;
+        LyXParagraph * par = current_view->buffer()->text->cursor.par;
 
        EnableParagraphExtra();
 
@@ -137,7 +137,7 @@ bool UpdateParagraphExtra()
     }
     fl_hide_object(fd_form_paragraph_extra->text_warning);
 
-    if (current_view->currentBuffer()->isReadonly()) {
+    if (current_view->buffer()->isReadonly()) {
       DisableParagraphExtra();
       fl_set_object_label(fd_form_paragraph_extra->text_warning,
                          _("Document is read-only.  No changes to layout permitted."));
@@ -165,12 +165,10 @@ void ParagraphExtraOpen(FL_OBJECT *, long)
 void ParagraphExtraApplyCB(FL_OBJECT *, long)
 {
     if (current_view->getScreen() && current_view->available()) {
-        const FD_form_paragraph_extra* fd = fd_form_paragraph_extra;
-        const char
-            *width = fl_get_input(fd->input_pextra_width),
-            *widthp = fl_get_input(fd->input_pextra_widthp);
-        LyXText
-            *text = current_view->currentBuffer()->text;
+        FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
+        const char * width = fl_get_input(fd->input_pextra_width);
+        const char * widthp = fl_get_input(fd->input_pextra_widthp);
+        LyXText * text = current_view->buffer()->text;
         int type = PEXTRA_NONE;
        int alignment = 0;
         bool
@@ -195,7 +193,7 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
         }
         text->SetParagraphExtraOpt(type,width,widthp,alignment,hfill,
                                    start_minipage);
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(1);
        minibuffer->Set(_("ParagraphExtra layout set"));
     }
     return;
index 7f7c259fddaacffabaabae014bbb34da78058ab2..16f8e78a9ece6c5385e9a30b23b394a538ac1ee9 100644 (file)
@@ -43,21 +43,20 @@ bool UpdateLayoutTable(int flag)
     if (!current_view->getScreen() || !current_view->available())
         update = false;
     
-    if (update && current_view->currentBuffer()->text->cursor.par->table) {
+    if (update && current_view->buffer()->text->cursor.par->table) {
         int
             align,
-            cell,
             column,row;
         char
             buf[12];
         string
             pwidth, special;
     
-        LyXTable *table = current_view->currentBuffer()->text->cursor.par->table;
+        LyXTable * table = current_view->buffer()->text->cursor.par->table;
 
-        cell = current_view->currentBuffer()->text->
-            NumberOfCell(current_view->currentBuffer()->text->cursor.par, 
-                         current_view->currentBuffer()->text->cursor.pos);
+        int cell = current_view->buffer()->text->
+            NumberOfCell(current_view->buffer()->text->cursor.par, 
+                         current_view->buffer()->text->cursor.pos);
         ActCell = cell;
         column = table->column_of_cell(cell)+1;
         fl_set_object_label(fd_form_table_options->text_warning,"");
@@ -108,7 +107,7 @@ bool UpdateLayoutTable(int flag)
            fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
                    extra_col_cursor_x, 0); // restore the cursor
        }
-        if (current_view->currentBuffer()->isReadonly()) 
+        if (current_view->buffer()->isReadonly()) 
             fl_deactivate_object(fd_form_table_extra->input_special_alignment);
         special = table->GetAlignSpecial(cell,LyXTable::SET_SPECIAL_MULTI);
         if (flag)
@@ -118,12 +117,12 @@ bool UpdateLayoutTable(int flag)
            fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
                    extra_multicol_cursor_x, 0); // restore the cursor
        }
-        if (current_view->currentBuffer()->isReadonly()) 
+        if (current_view->buffer()->isReadonly()) 
             fl_deactivate_object(fd_form_table_extra->input_special_multialign);
         pwidth = table->GetPWidth(cell);
         if (flag)
             fl_set_input(fd_form_table_options->input_column_width,pwidth.c_str());
-        if (current_view->currentBuffer()->isReadonly()) 
+        if (current_view->buffer()->isReadonly()) 
             fl_deactivate_object(fd_form_table_options->input_column_width);
         if (!pwidth.empty()) {
             fl_activate_object(fd_form_table_options->radio_linebreak_cell);
@@ -264,7 +263,6 @@ void TableOptionsCB(FL_OBJECT *ob, long)
     LyXTable
         *table = 0;
     int
-        cell,
         s,
         num = 0;
     string
@@ -273,14 +271,14 @@ void TableOptionsCB(FL_OBJECT *ob, long)
 
     if (!current_view->available()
        ||
-       !(table = current_view->currentBuffer()->text->cursor.par->table)) 
+       !(table = current_view->buffer()->text->cursor.par->table)) 
       {
         MenuLayoutTable(0);
        return;
       }
-    cell = current_view->currentBuffer()->text->
-        NumberOfCell(current_view->currentBuffer()->text->cursor.par, 
-                     current_view->currentBuffer()->text->cursor.pos);
+    int cell = current_view->buffer()->text->
+        NumberOfCell(current_view->buffer()->text->cursor.par, 
+                     current_view->buffer()->text->cursor.pos);
     if (ActCell != cell) {
         MenuLayoutTable(0);
         fl_set_object_label(fd_form_table_options->text_warning,
@@ -292,7 +290,7 @@ void TableOptionsCB(FL_OBJECT *ob, long)
     }
     // No point in processing directives that you can't do anything with
     // anyhow, so exit now if the buffer is read-only.
-    if (current_view->currentBuffer()->isReadonly()) {
+    if (current_view->buffer()->isReadonly()) {
       MenuLayoutTable(0);
       return;
     }
@@ -431,16 +429,16 @@ void TableOptionsCB(FL_OBJECT *ob, long)
         return;
     if (current_view->available()){
         current_view->getScreen()->HideCursor();
-        if (!current_view->currentBuffer()->text->selection){
+        if (!current_view->buffer()->text->selection){
             BeforeChange(); 
-            current_view->currentBuffer()->update(-2);
+            current_view->buffer()->update(-2);
         }
         if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
             (num == LyXTable::SET_SPECIAL_MULTI))
-            current_view->currentBuffer()->text->TableFeatures(num,special);
+            current_view->buffer()->text->TableFeatures(num,special);
         else
-            current_view->currentBuffer()->text->TableFeatures(num);
-        current_view->currentBuffer()->update(1);
+            current_view->buffer()->text->TableFeatures(num);
+        current_view->buffer()->update(1);
     }
     if (num == LyXTable::DELETE_TABLE) {
        fl_set_focus_object(fd_form_table_options->form_table_options,
@@ -483,12 +481,12 @@ void SetPWidthCB(FL_OBJECT *ob, long)
         }
         if (current_view->available()){
             current_view->getScreen()->HideCursor();
-            if (!current_view->currentBuffer()->text->selection){
+            if (!current_view->buffer()->text->selection){
                 BeforeChange(); 
-                current_view->currentBuffer()->update(-2);
+                current_view->buffer()->update(-2);
             }
-            current_view->currentBuffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str);
-            current_view->currentBuffer()->update(1);
+            current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str);
+            current_view->buffer()->update(1);
         }
         MenuLayoutTable(0); // update for alignment
     }
index 117b1d3e06e16968087875484b2fb8446db26649..3b4788e8e70fff443112cff97f08fd7ff9701d26 100644 (file)
@@ -102,6 +102,7 @@ extern void FreeUpdateTimer();
 
 Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
 {
+       lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
        filename = file;
        filepath = OnlyPath(file);
        paragraph = 0;
@@ -115,8 +116,7 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
        read_only = ronly;
        inset_slept = false;
        users = 0;
-       lyxvc.setBuffer(this);
-       lyxerr.debug() << "Buffer::Buffer()" << endl;
+       lyxvc.buffer(this);
        if (read_only || (lyxrc && lyxrc->use_tempdir)) {
                tmppath = CreateBufferTmpDir();
        } else tmppath.clear();
@@ -125,14 +125,14 @@ Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly)
 
 Buffer::~Buffer()
 {
-       lyxerr.debug() << "Buffer::~Buffer()" << endl;
+       lyxerr[Debug::INFO] << "Buffer::~Buffer()" << endl;
        // here the buffer should take care that it is
        // saved properly, before it goes into the void.
 
        // make sure that views using this buffer
        // forgets it.
        if (users)
-               users->setBuffer(0);
+               users->buffer(0);
        
        if (!tmppath.empty()) {
                DestroyBufferTmpDir(tmppath);
@@ -169,7 +169,7 @@ bool Buffer::saveParamsAsDefaults()
 // Should work on a list
 void Buffer::updateTitles()
 {
-       if (users) users->getOwner()->updateWindowTitle();
+       if (users) users->owner()->updateWindowTitle();
 }
 
 
@@ -177,7 +177,7 @@ void Buffer::updateTitles()
 // Should work on a list
 void Buffer::resetAutosaveTimers()
 {
-       if (users) users->getOwner()->resetAutosaveTimer();
+       if (users) users->owner()->resetAutosaveTimer();
 }
 
 
@@ -3209,7 +3209,7 @@ int Buffer::runLaTeX()
        }
 
        Path p(path); // path to LaTeX file
-       users->getOwner()->getMiniBuffer()->Set(_("Running LaTeX..."));   
+       users->owner()->getMiniBuffer()->Set(_("Running LaTeX..."));   
 
        // Remove all error insets
        bool a = removeAutoInsets();
@@ -3221,14 +3221,15 @@ int Buffer::runLaTeX()
        // do the LaTex run(s)
        TeXErrors terr;
        LaTeX latex(lyxrc->latex_command, name, filepath);
-       int res = latex.run(terr,users->getOwner()->getMiniBuffer()); // running latex
+       int res = latex.run(terr,
+                           users->owner()->getMiniBuffer()); // running latex
 
        // check return value from latex.run().
        if ((res & LaTeX::NO_LOGFILE)) {
                WriteAlert(_("LaTeX did not work!"),
                           _("Missing log file:"), name);
        } else if ((res & LaTeX::ERRORS)) {
-               users->getOwner()->getMiniBuffer()->Set(_("Done"));
+               users->owner()->getMiniBuffer()->Set(_("Done"));
                // Insert all errors as errors boxes
                insertErrors(terr);
                
@@ -3237,7 +3238,7 @@ int Buffer::runLaTeX()
                // to view a dirty dvi too.
        } else {
                //no errors or any other things to think about so:
-               users->getOwner()->getMiniBuffer()->Set(_("Done"));
+               users->owner()->getMiniBuffer()->Set(_("Done"));
                markDviClean();
        }
 
@@ -3273,7 +3274,7 @@ int Buffer::runLiterate()
        }
 
        Path p(path); // path to Literate file
-       users->getOwner()->getMiniBuffer()->Set(_("Running Literate..."));   
+       users->owner()->getMiniBuffer()->Set(_("Running Literate..."));   
 
        // Remove all error insets
        bool a = removeAutoInsets();
@@ -3289,14 +3290,14 @@ int Buffer::runLiterate()
                          lyxrc->literate_command, lyxrc->literate_error_filter,
                          lyxrc->build_command, lyxrc->build_error_filter);
        TeXErrors terr;
-       int res = literate.weave(terr, users->getOwner()->getMiniBuffer());
+       int res = literate.weave(terr, users->owner()->getMiniBuffer());
 
        // check return value from literate.weave().
        if ((res & Literate::NO_LOGFILE)) {
                WriteAlert(_("Literate command did not work!"),
                           _("Missing log file:"), name);
        } else if ((res & Literate::ERRORS)) {
-               users->getOwner()->getMiniBuffer()->Set(_("Done"));
+               users->owner()->getMiniBuffer()->Set(_("Done"));
                // Insert all errors as errors boxes
                insertErrors(terr);
                
@@ -3305,7 +3306,7 @@ int Buffer::runLiterate()
                // to view a dirty dvi too.
        } else {
                //no errors or any other things to think about so:
-               users->getOwner()->getMiniBuffer()->Set(_("Done"));
+               users->owner()->getMiniBuffer()->Set(_("Done"));
                markDviClean();
        }
 
@@ -3341,7 +3342,7 @@ int Buffer::buildProgram()
         }
  
         Path p(path); // path to Literate file
-        users->getOwner()->getMiniBuffer()->Set(_("Building Program..."));   
+        users->owner()->getMiniBuffer()->Set(_("Building Program..."));   
  
         // Remove all error insets
         bool a = removeAutoInsets();
@@ -3357,14 +3358,14 @@ int Buffer::buildProgram()
                          lyxrc->literate_command, lyxrc->literate_error_filter,
                          lyxrc->build_command, lyxrc->build_error_filter);
         TeXErrors terr;
-        int res = literate.build(terr, users->getOwner()->getMiniBuffer());
+        int res = literate.build(terr, users->owner()->getMiniBuffer());
  
         // check return value from literate.build().
         if ((res & Literate::NO_LOGFILE)) {
                 WriteAlert(_("Build did not work!"),
                            _("Missing log file:"), name);
         } else if ((res & Literate::ERRORS)) {
-                users->getOwner()->getMiniBuffer()->Set(_("Done"));
+                users->owner()->getMiniBuffer()->Set(_("Done"));
                 // Insert all errors as errors boxes
                 insertErrors(terr);
                 
@@ -3372,7 +3373,7 @@ int Buffer::buildProgram()
                 // command run ends up with errors.
         } else {
                 //no errors or any other things to think about so:
-                users->getOwner()->getMiniBuffer()->Set(_("Done"));
+                users->owner()->getMiniBuffer()->Set(_("Done"));
                 markNwClean();
         }
  
@@ -3408,7 +3409,7 @@ int Buffer::runChktex()
        }
 
        Path p(path); // path to LaTeX file
-       users->getOwner()->getMiniBuffer()->Set(_("Running chktex..."));
+       users->owner()->getMiniBuffer()->Set(_("Running chktex..."));
 
        // Remove all error insets
        bool a = removeAutoInsets();
@@ -3673,7 +3674,7 @@ void Buffer::update(signed char f)
 {
        if (!users) return;
        
-       users->getOwner()->updateLayoutChoice();
+       users->owner()->updateLayoutChoice();
 
        if (!text->selection && f > -3)
                text->sel_cursor = text->cursor;
@@ -3690,7 +3691,7 @@ void Buffer::update(signed char f)
        if (f==1 || f==-1) {
                if (isLyxClean()) {
                        markDirty();
-                       users->getOwner()->getMiniBuffer()->setTimer(4);
+                       users->owner()->getMiniBuffer()->setTimer(4);
                } else {
                        markDirty();
                }
index 04954de7aabfa7d91e64c820c87f899f2abd6493..4bfae2182239364bca40054fd899f7bf517db6de 100644 (file)
@@ -61,8 +61,8 @@ bool updateBulletForm()
        }
        if (!current_view->available()) {
                update = false;
-       } else if (current_view->currentBuffer()->isReadonly()
-                  || current_view->currentBuffer()->isLinuxDoc()) {
+       } else if (current_view->buffer()->isReadonly()
+                  || current_view->buffer()->isLinuxDoc()) {
                fl_deactivate_object (fd_form_bullet->button_ok);
                fl_deactivate_object (fd_form_bullet->button_apply);
                fl_set_object_lcol (fd_form_bullet->button_ok, FL_INACTIVE);
@@ -85,10 +85,10 @@ bool updateBulletForm()
                // any settings that need doing each time
                fl_set_button(fd_form_bullet->radio_bullet_depth_1, 1);
                fl_set_input(fd_form_bullet->input_bullet_latex,
-                            current_view->currentBuffer()
+                            current_view->buffer()
                             ->params.user_defined_bullets[0].c_str());
                fl_set_choice(fd_form_bullet->choice_bullet_size,
-                             current_view->currentBuffer()
+                             current_view->buffer()
                              ->params.user_defined_bullets[0].getSize() + 2);
        } else {
                if (fd_form_bullet->form_bullet->visible) {
@@ -110,15 +110,15 @@ void BulletOKCB(FL_OBJECT *ob, long data)
 
 void BulletApplyCB(FL_OBJECT * /*ob*/, long /*data*/ )
 {
-       /* update the bullet settings */
-       BufferParams & param = current_view->currentBuffer()->params;
+       // update the bullet settings
+       BufferParams & param = current_view->buffer()->params;
 
        // a little bit of loop unrolling
        param.user_defined_bullets[0] = param.temp_bullets[0];
        param.user_defined_bullets[1] = param.temp_bullets[1];
        param.user_defined_bullets[2] = param.temp_bullets[2];
        param.user_defined_bullets[3] = param.temp_bullets[3];
-       current_view->currentBuffer()->markDirty();
+       current_view->buffer()->markDirty();
 }
 
 
@@ -126,7 +126,7 @@ void BulletCancelCB(FL_OBJECT * /*ob*/, long /*data*/ )
 {
        fl_hide_form(fd_form_bullet->form_bullet);
        // this avoids confusion when reopening
-       BufferParams & param = current_view->currentBuffer()->params;
+       BufferParams & param = current_view->buffer()->params;
        param.temp_bullets[0] = param.user_defined_bullets[0];
        param.temp_bullets[1] = param.user_defined_bullets[1];
        param.temp_bullets[2] = param.user_defined_bullets[2];
@@ -136,8 +136,8 @@ void BulletCancelCB(FL_OBJECT * /*ob*/, long /*data*/ )
 
 void InputBulletLaTeXCB(FL_OBJECT *, long)
 {
-  /* fill-in code for callback */
-       BufferParams & param = current_view->currentBuffer()->params;
+       // fill-in code for callback
+       BufferParams & param = current_view->buffer()->params;
 
        param.temp_bullets[current_bullet_depth].setText(
                fl_get_input(fd_form_bullet->input_bullet_latex));
@@ -146,7 +146,7 @@ void InputBulletLaTeXCB(FL_OBJECT *, long)
 
 void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
 {
-       BufferParams & param = current_view->currentBuffer()->params;
+       BufferParams & param = current_view->buffer()->params;
 
        // convert from 1-6 range to -1-4 
        param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
@@ -155,7 +155,7 @@ void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
 }
 
 
-void BulletDepthCB(FL_OBJECT *ob, long data)
+void BulletDepthCB(FL_OBJECT * ob, long data)
 {
        /* Should I do the following:                                 */
        /*  1. change to the panel that the current bullet belongs in */
@@ -165,7 +165,7 @@ void BulletDepthCB(FL_OBJECT *ob, long data)
        /*                                                            */
        /* I'm inclined to just go with 3 and 4 at the moment and     */
        /* maybe try to support the others later                      */
-       BufferParams & param = current_view->currentBuffer()->params;
+       BufferParams & param = current_view->buffer()->params;
 
        switch (fl_get_button_numb(ob)) {
        case 3:
@@ -242,7 +242,7 @@ void BulletBMTableCB(FL_OBJECT *ob, long /*data*/ )
        /* to that extracted from the current chosen position of the BMTable  */
        /* Don't forget to free the button's old pixmap first.                */
 
-       BufferParams & param = current_view->currentBuffer()->params;
+       BufferParams & param = current_view->buffer()->params;
        int bmtable_button = fl_get_bmtable(ob);
 
        /* try to keep the button held down till another is pushed */
index b96fc747a0d392e78b226b75fdbe589f2172a982..6e4f662ae909e36ad20f8b055e5e1537e70b2833 100644 (file)
@@ -236,7 +236,7 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code)
 void Intl::InitKeyMapper(bool on)
        /* initialize key mapper */
 {
-       lyxerr[Debug::KBMAP] << "Initializing key mappings..." << endl;
+       lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
 
        if (prim_lang.empty() && sec_lang.empty())
                keymapon = false; 
index 715ff517a8aee27b79a3afcae0c8efb007846f6c..a99282cb4b21b0021d86602c2ed9ac89d10a4ea1 100644 (file)
@@ -196,7 +196,7 @@ unsigned char GetCurrentTextClass()
        // Shouldn't this question be directed to the buffer?
        // Indeed it should. Asger.
 {
-       return current_view->currentBuffer()->params.textclass;
+       return current_view->buffer()->params.textclass;
 }
 
 
@@ -292,7 +292,7 @@ void SetUpdateTimer(float time)
 void BeforeChange()
 {
        current_view->getScreen()->ToggleSelection();
-       current_view->currentBuffer()->text->ClearSelection();
+       current_view->buffer()->text->ClearSelection();
        FreeUpdateTimer();
 }
 
@@ -302,24 +302,24 @@ void SmallUpdate(signed char f)
        current_view->getScreen()->SmallUpdate();
        if (current_view->getScreen()->TopCursorVisible()
            != current_view->getScreen()->first){
-               current_view->currentBuffer()->update(f);
+               current_view->buffer()->update(f);
                return;
        }
 
        current_view->fitCursor();
        current_view->updateScrollbar();
    
-       if (!current_view->currentBuffer()->text->selection)
-               current_view->currentBuffer()->text->sel_cursor = 
-                       current_view->currentBuffer()->text->cursor;
+       if (!current_view->buffer()->text->selection)
+               current_view->buffer()->text->sel_cursor = 
+                       current_view->buffer()->text->cursor;
 
        if (f==1 || f==-1) {
-               if (current_view->currentBuffer()->isLyxClean()) {
-                       current_view->currentBuffer()->markDirty();
+               if (current_view->buffer()->isLyxClean()) {
+                       current_view->buffer()->markDirty();
                        minibuffer->setTimer(4);
                }
                else {
-                       current_view->currentBuffer()->markDirty();
+                       current_view->buffer()->markDirty();
                }
        }
 }
@@ -987,19 +987,19 @@ void AutoSave()
        if (!current_view->getScreen() || !current_view->available())
                return;
 
-       if (current_view->currentBuffer()->isBakClean()
-           || current_view->currentBuffer()->isReadonly()) {
+       if (current_view->buffer()->isBakClean()
+           || current_view->buffer()->isReadonly()) {
                // We don't save now, but we'll try again later
-               current_view->getOwner()->resetAutosaveTimer();
+               current_view->owner()->resetAutosaveTimer();
                return;
        }
 
        minibuffer->Set(_("Autosaving current document..."));
        
        // create autosave filename
-       string fname =  OnlyPath(current_view->currentBuffer()->getFileName());
+       string fname =  OnlyPath(current_view->buffer()->getFileName());
        fname += "#";
-       fname += OnlyFilename(current_view->currentBuffer()->getFileName());
+       fname += OnlyFilename(current_view->buffer()->getFileName());
        fname += "#";
        
        // tmp_ret will be located (usually) in /tmp
@@ -1015,7 +1015,7 @@ void AutoSave()
                // anyway.
                bool failed = false;
                if (!tmp_ret.empty()) {
-                       current_view->currentBuffer()->writeFile(tmp_ret, 1);
+                       current_view->buffer()->writeFile(tmp_ret, 1);
                        // assume successful write of tmp_ret
                        if (rename(tmp_ret.c_str(), fname.c_str()) == -1) {
                                failed = true;
@@ -1030,8 +1030,7 @@ void AutoSave()
                
                if (failed) {
                        // failed to write/rename tmp_ret so try writing direct
-                       if (!current_view->currentBuffer()->writeFile(fname,
-                                                                     1)) {
+                       if (!current_view->buffer()->writeFile(fname, 1)) {
                                // It is dangerous to do this in the child,
                                // but safe in the parent, so...
                                if (pid == -1)
@@ -1043,8 +1042,8 @@ void AutoSave()
                }
        }
        
-       current_view->currentBuffer()->markBakClean();
-       current_view->getOwner()->resetAutosaveTimer();
+       current_view->buffer()->markBakClean();
+       current_view->owner()->resetAutosaveTimer();
 }
 
 
@@ -1093,7 +1092,7 @@ void InsertAsciiFile(string const & f, bool asParagraph)
        if (fname.empty()) {
                ProhibitInput();
                fname = fileDlg.Select(_("File to Insert"), 
-                                      current_view->getOwner()->currentBuffer()->filepath,
+                                      current_view->owner()->buffer()->filepath,
                                       "*");
                AllowInput();
                if (fname.empty()) return;
@@ -1127,11 +1126,11 @@ void InsertAsciiFile(string const & f, bool asParagraph)
        // clear the selection
        BeforeChange();
        if (!asParagraph)
-               current_view->currentBuffer()->text->InsertStringA(tmppar->text);
+               current_view->buffer()->text->InsertStringA(tmppar->text);
        else
-               current_view->currentBuffer()->text->InsertStringB(tmppar->text);
+               current_view->buffer()->text->InsertStringB(tmppar->text);
        delete tmppar;
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(1);
 }
 
 
@@ -1165,7 +1164,7 @@ void MenuInsertLabel(const char *arg)
        if (!label.empty()) {
                InsetLabel *new_inset = new InsetLabel;
                new_inset->setContents(label);
-               current_view->currentBuffer()->insertInset(new_inset);
+               current_view->buffer()->insertInset(new_inset);
        }
        AllowInput();
 }
@@ -1217,16 +1216,16 @@ extern "C" void FootCB(FL_OBJECT*, long)
        
        minibuffer->Set(_("Inserting Footnote..."));
        current_view->getScreen()->HideCursor();
-       current_view->currentBuffer()->update(-2);
-       current_view->currentBuffer()->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(-2);
+       current_view->buffer()->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
+       current_view->buffer()->update(1);
 }
 
 
 void LayoutsCB(int sel, void *)
 {
        string tmp = tostr(sel);
-       current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
+       current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
                                                         tmp.c_str());
 }
 
@@ -1250,15 +1249,15 @@ int RunLinuxDoc(int flag, string const & filename)
        name = ChangeExtension (filename, ".sgml", true);
        path = OnlyPath (filename);
        if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
-               path = current_view->currentBuffer()->tmppath;
+               path = current_view->buffer()->tmppath;
        }
        Path p(path);
        
        if (flag != -1) {
                if (!current_view->available())
                        return 0;
-               current_view->currentBuffer()->makeLinuxDocFile(name,0);
-               LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->currentBuffer()->params.papersize;
+               current_view->buffer()->makeLinuxDocFile(name,0);
+               LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
                switch (ps) {
                case PAPER_A4PAPER:  add_flags = "-p a4";     break;
                case PAPER_USLETTER: add_flags = "-p letter"; break;
@@ -1292,7 +1291,7 @@ int RunLinuxDoc(int flag, string const & filename)
                if (one.startscript(Systemcalls::System, s2)) {
                        errorcode = 1;
                } else
-                       current_view->currentBuffer()->markDviClean();
+                       current_view->buffer()->markDviClean();
                break;
        default: /* unknown output */
                break;
@@ -1300,7 +1299,7 @@ int RunLinuxDoc(int flag, string const & filename)
        
        AllowInput();
 
-        current_view->currentBuffer()->redraw();
+        current_view->buffer()->redraw();
        return errorcode;
 }
 
@@ -1321,18 +1320,18 @@ int RunDocBook(int flag, string const & filename)
        name = ChangeExtension (filename, ".sgml", true);
        path = OnlyPath (filename);
        if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)) {
-               path = current_view->currentBuffer()->tmppath;
+               path = current_view->buffer()->tmppath;
        }
        Path p(path);
 
        if (!current_view->available())
                return 0;
        
-       current_view->currentBuffer()->makeDocBookFile(name,0);
+       current_view->buffer()->makeDocBookFile(name,0);
 
        // Shall this code go or should it stay? (Lgb)
 //     string add_flags;
-//     LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->currentBuffer()->params.papersize;
+//     LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize;
 //     switch (ps) {
 //     case PAPER_A4PAPER:  add_flags = "-p a4";     break;
 //     case PAPER_USLETTER: add_flags = "-p letter"; break;
@@ -1348,7 +1347,7 @@ int RunDocBook(int flag, string const & filename)
                if (one.startscript(Systemcalls::System, s2)) {
                        errorcode = 1;
                } else
-                       current_view->currentBuffer()->markDviClean();
+                       current_view->buffer()->markDviClean();
                break;
        default: /* unknown output */
                break;
@@ -1356,7 +1355,7 @@ int RunDocBook(int flag, string const & filename)
        
        AllowInput();
 
-        current_view->currentBuffer()->redraw();
+        current_view->buffer()->redraw();
        return errorcode;
 }
 
@@ -1366,7 +1365,7 @@ void AllFloats(char flag, char figmar)
        if (!current_view->available())
                return;
    
-       LyXCursor cursor = current_view->currentBuffer()->text->cursor;
+       LyXCursor cursor = current_view->buffer()->text->cursor;
 
        if (!flag && cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE
            && ((figmar 
@@ -1386,7 +1385,7 @@ void AllFloats(char flag, char figmar)
        cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos);
        cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos);
 
-       LyXParagraph *par = current_view->currentBuffer()->paragraph;
+       LyXParagraph *par = current_view->buffer()->paragraph;
        while (par) {
                if (flag) {
                        if (par->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE
@@ -1415,9 +1414,9 @@ void AllFloats(char flag, char figmar)
                                if (par->previous
                                    && par->previous->footnoteflag !=
                                    LyXParagraph::CLOSED_FOOTNOTE){ /* should be */ 
-                                       current_view->currentBuffer()->text->SetCursorIntern(par->previous,
+                                       current_view->buffer()->text->SetCursorIntern(par->previous,
                                                                      0);
-                                       current_view->currentBuffer()->text->OpenFootnote();
+                                       current_view->buffer()->text->OpenFootnote();
                                }
                        }
                }
@@ -1445,14 +1444,14 @@ void AllFloats(char flag, char figmar)
                                            )
                                    )
                                ){
-                               current_view->currentBuffer()->text->SetCursorIntern(par, 0);
-                               current_view->currentBuffer()->text->CloseFootnote();
+                               current_view->buffer()->text->SetCursorIntern(par, 0);
+                               current_view->buffer()->text->CloseFootnote();
                        }
                }
                par = par->next;
        }
 
-       current_view->currentBuffer()->text->SetCursorIntern(cursor.par, cursor.pos);
+       current_view->buffer()->text->SetCursorIntern(cursor.par, cursor.pos);
        current_view->redraw();
        current_view->fitCursor();
        current_view->updateScrollbar();
@@ -1546,7 +1545,7 @@ bool UpdateLayoutParagraph()
                return false;
        }
 
-       Buffer * buf = current_view->currentBuffer();
+       Buffer * buf = current_view->buffer();
 
        fl_set_input(fd_form_paragraph->input_labelwidth,
                     buf->text->cursor.par->GetLabelWidthString().c_str());
@@ -1660,7 +1659,7 @@ bool UpdateLayoutParagraph()
        fl_set_button(fd_form_paragraph->check_noindent,
                      buf->text->cursor.par->FirstPhysicalPar()->noindent);
 
-       if (current_view->currentBuffer()->isReadonly()) {
+       if (current_view->buffer()->isReadonly()) {
                DisableParagraphLayout();
        } else {
                EnableParagraphLayout();
@@ -1774,7 +1773,7 @@ bool UpdateLayoutDocument(BufferParams *params)
        }               
 
        if (params == 0)
-               params = &current_view->currentBuffer()->params;
+               params = &current_view->buffer()->params;
        LyXTextClass const & tclass = textclasslist.TextClass(params->textclass);
        
        fl_set_choice_text(fd_form_document->choice_class, 
@@ -1899,7 +1898,7 @@ bool UpdateLayoutDocument(BufferParams *params)
        else
                fl_set_input(fd_form_document->input_extra, "");
 
-       if (current_view->currentBuffer()->isSGML()) {
+       if (current_view->buffer()->isSGML()) {
                // bullets not used in SGML derived documents
                fl_deactivate_object(fd_form_document->button_bullets);
                fl_set_object_lcol(fd_form_document->button_bullets,
@@ -1910,7 +1909,7 @@ bool UpdateLayoutDocument(BufferParams *params)
                                   FL_BLACK);
        }
 
-       if (current_view->currentBuffer()->isReadonly()) {
+       if (current_view->buffer()->isReadonly()) {
                DisableDocumentLayout();
        } else {
                EnableDocumentLayout();
@@ -1938,16 +1937,16 @@ bool UpdateLayoutQuotes()
        bool update = true;
        if (!current_view->getScreen()
            || !current_view->available()
-           || current_view->currentBuffer()->isReadonly())
+           || current_view->buffer()->isReadonly())
                update = false;
        
        if (update) {
                fl_set_choice(fd_form_quotes->choice_quotes_language,
-                     current_view->currentBuffer()->params.quotes_language + 1);
+                     current_view->buffer()->params.quotes_language + 1);
                fl_set_button(fd_form_quotes->radio_single, 0);
                fl_set_button(fd_form_quotes->radio_double, 0);
        
-               if (current_view->currentBuffer()->params.quotes_times == InsetQuotes::SingleQ)
+               if (current_view->buffer()->params.quotes_times == InsetQuotes::SingleQ)
                        fl_set_button(fd_form_quotes->radio_single, 1);
                else
                        fl_set_button(fd_form_quotes->radio_double, 1);
@@ -1979,9 +1978,9 @@ bool UpdateLayoutPreamble()
 
        if (update) {
                fl_set_input(fd_form_preamble->input_preamble,
-                    current_view->currentBuffer()->params.preamble.c_str());
+                    current_view->buffer()->params.preamble.c_str());
 
-               if (current_view->currentBuffer()->isReadonly()) {
+               if (current_view->buffer()->isReadonly()) {
                  fl_deactivate_object(fd_form_preamble->input_preamble);
                  fl_deactivate_object(fd_form_preamble->button_ok);
                  fl_deactivate_object(fd_form_preamble->button_apply);
@@ -2031,16 +2030,16 @@ void MenuLayoutSave()
        if (AskQuestion(_("Do you want to save the current settings"),
                        _("for Character, Document, Paper and Quotes"),
                        _("as default for new documents?")))
-               current_view->currentBuffer()->saveParamsAsDefaults();
+               current_view->buffer()->saveParamsAsDefaults();
 }
 
 
 void NoteCB()
 {
        InsetInfo *new_inset = new InsetInfo();
-       current_view->currentBuffer()->insertInset(new_inset);
+       current_view->buffer()->insertInset(new_inset);
        new_inset->Edit(0,0);
-       //current_view->currentBuffer()->update(-1);
+       //current_view->buffer()->update(-1);
 }
 
 
@@ -2050,9 +2049,9 @@ void OpenStuff()
                minibuffer->Set(_("Open/Close..."));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->OpenStuff();
-               current_view->currentBuffer()->update(0);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->OpenStuff();
+               current_view->buffer()->update(0);
        }
 }
 
@@ -2062,16 +2061,16 @@ void ToggleFloat()
                minibuffer->Set(_("Open/Close..."));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->ToggleFootnote();
-               current_view->currentBuffer()->update(0);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->ToggleFootnote();
+               current_view->buffer()->update(0);
        }
 }
 
 
 void MenuUndo()
 {
-/*     if (current_view->currentBuffer()->the_locking_inset) {
+/*     if (current_view->buffer()->the_locking_inset) {
                minibuffer->Set(_("Undo not yet supported in math mode"));
                return;
        }*/
@@ -2080,18 +2079,18 @@ void MenuUndo()
                minibuffer->Set(_("Undo"));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-               current_view->currentBuffer()->update(-2);
-               if (!current_view->currentBuffer()->text->TextUndo())
+               current_view->buffer()->update(-2);
+               if (!current_view->buffer()->text->TextUndo())
                        minibuffer->Set(_("No further undo information"));
                else
-                       current_view->currentBuffer()->update(-1);
+                       current_view->buffer()->update(-1);
        }
 }
 
 
 void MenuRedo()
 {
-       if (current_view->currentBuffer()->the_locking_inset) {
+       if (current_view->buffer()->the_locking_inset) {
                minibuffer->Set(_("Redo not yet supported in math mode"));
                return;
        }    
@@ -2100,11 +2099,11 @@ void MenuRedo()
                minibuffer->Set(_("Redo"));
                current_view->getScreen()->HideCursor();
                BeforeChange();
-               current_view->currentBuffer()->update(-2);
-               if (!current_view->currentBuffer()->text->TextRedo())
+               current_view->buffer()->update(-2);
+               if (!current_view->buffer()->text->TextRedo())
                        minibuffer->Set(_("No further redo information"));
                else
-                       current_view->currentBuffer()->update(-1);
+                       current_view->buffer()->update(-1);
        }
 }
 
@@ -2113,11 +2112,11 @@ void HyphenationPoint()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->update(-2);
                InsetSpecialChar *new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
-               current_view->currentBuffer()->insertInset(new_inset);
-               //current_view->currentBuffer()->update(-1);
+               current_view->buffer()->insertInset(new_inset);
+               //current_view->buffer()->update(-1);
        }
 }
 
@@ -2126,10 +2125,10 @@ void Ldots()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->update(-2);
                InsetSpecialChar *new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::LDOTS);
-               current_view->currentBuffer()->insertInset(new_inset);
+               current_view->buffer()->insertInset(new_inset);
        }
 }
 
@@ -2138,10 +2137,10 @@ void EndOfSentenceDot()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->update(-2);
                InsetSpecialChar *new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
-               current_view->currentBuffer()->insertInset(new_inset);
+               current_view->buffer()->insertInset(new_inset);
        }
 }
 
@@ -2150,11 +2149,11 @@ void MenuSeparator()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->update(-2);
                InsetSpecialChar *new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
-               current_view->currentBuffer()->insertInset(new_inset);
-               //current_view->currentBuffer()->update(-1);
+               current_view->buffer()->insertInset(new_inset);
+               //current_view->buffer()->update(-1);
        }
 }
 
@@ -2163,9 +2162,9 @@ void Newline()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->InsertChar(LYX_META_NEWLINE);
-               current_view->currentBuffer()->update(-1);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->InsertChar(LYX_META_NEWLINE);
+               current_view->buffer()->update(-1);
        }
 }
 
@@ -2174,9 +2173,9 @@ void ProtectedBlank()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->InsertChar(LYX_META_PROTECTED_SEPARATOR);
-               current_view->currentBuffer()->update(-1);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->InsertChar(LYX_META_PROTECTED_SEPARATOR);
+               current_view->buffer()->update(-1);
        }
 }
 
@@ -2185,9 +2184,9 @@ void HFill()
 {
        if (current_view->available())  {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->InsertChar(LYX_META_HFILL);
-               current_view->currentBuffer()->update(-1);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->InsertChar(LYX_META_HFILL);
+               current_view->buffer()->update(-1);
        }
 }
 
@@ -2288,7 +2287,7 @@ string CurrentState()
        if (current_view->available()) { 
                // I think we should only show changes from the default
                // font. (Asger)
-               Buffer * buffer = current_view->currentBuffer();
+               Buffer * buffer = current_view->buffer();
                LyXFont font = buffer->text->real_current_font;
                LyXFont defaultfont = textclasslist.TextClass(buffer->
                                                         params.textclass).defaultfont();
@@ -2311,9 +2310,9 @@ void ToggleAndShow(LyXFont const & font)
 {
        if (current_view->available()) { 
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->ToggleFree(font, toggleall);
-               current_view->currentBuffer()->update(1);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->ToggleFree(font, toggleall);
+               current_view->buffer()->update(1);
        }
        // removed since it overrides the ToggleFree Message about the style
        // Since Styles are more "High Level" than raw fonts I think the user
@@ -2327,9 +2326,9 @@ extern "C" void MarginCB(FL_OBJECT *, long)
        if (current_view->available()) {
                minibuffer->Set(_("Inserting margin note..."));
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
-               current_view->currentBuffer()->update(1);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
+               current_view->buffer()->update(1);
        }
 }
 
@@ -2361,11 +2360,11 @@ extern "C" void TableCB(FL_OBJECT *, long)
 void CopyEnvironmentCB()
 {
        if (current_view->available()) {
-               current_view->currentBuffer()->text->copyEnvironmentType();
+               current_view->buffer()->text->copyEnvironmentType();
                /* clear the selection, even if mark_set */ 
                current_view->getScreen()->ToggleSelection();
-               current_view->currentBuffer()->text->ClearSelection();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->text->ClearSelection();
+               current_view->buffer()->update(-2);
                minibuffer->Set(_("Paragraph environment type copied"));
        }
 }
@@ -2374,9 +2373,9 @@ void CopyEnvironmentCB()
 void PasteEnvironmentCB()
 {
        if (current_view->available()) {
-               current_view->currentBuffer()->text->pasteEnvironmentType();
+               current_view->buffer()->text->pasteEnvironmentType();
                minibuffer->Set(_("Paragraph environment type set"));
-               current_view->currentBuffer()->update(1);
+               current_view->buffer()->update(1);
        }
 }
 
@@ -2384,11 +2383,11 @@ void PasteEnvironmentCB()
 void CopyCB()
 {
        if (current_view->available()) {
-               current_view->currentBuffer()->text->CopySelection();
+               current_view->buffer()->text->CopySelection();
                /* clear the selection, even if mark_set */ 
                current_view->getScreen()->ToggleSelection();
-               current_view->currentBuffer()->text->ClearSelection();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->text->ClearSelection();
+               current_view->buffer()->update(-2);
                minibuffer->Set(_("Copy"));
        }
 }
@@ -2398,9 +2397,9 @@ void CutCB()
 {
        if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
-               current_view->currentBuffer()->text->CutSelection();
-               current_view->currentBuffer()->update(1);
+               current_view->buffer()->update(-2);
+               current_view->buffer()->text->CutSelection();
+               current_view->buffer()->update(1);
                minibuffer->Set(_("Cut"));
        }
 }
@@ -2414,17 +2413,17 @@ void PasteCB()
        current_view->getScreen()->HideCursor();
        /* clear the selection */ 
        current_view->getScreen()->ToggleSelection();
-       current_view->currentBuffer()->text->ClearSelection();
-       current_view->currentBuffer()->update(-2);
+       current_view->buffer()->text->ClearSelection();
+       current_view->buffer()->update(-2);
        
        /* paste */ 
-       current_view->currentBuffer()->text->PasteSelection();
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->text->PasteSelection();
+       current_view->buffer()->update(1);
        
        /* clear the selection */ 
        current_view->getScreen()->ToggleSelection();
-       current_view->currentBuffer()->text->ClearSelection();
-       current_view->currentBuffer()->update(-2);
+       current_view->buffer()->text->ClearSelection();
+       current_view->buffer()->update(-2);
 }
 
 
@@ -2435,9 +2434,9 @@ extern "C" void MeltCB(FL_OBJECT *, long)
        minibuffer->Set(_("Melt"));
        current_view->getScreen()->HideCursor();
        BeforeChange();
-       current_view->currentBuffer()->update(-2);
-       current_view->currentBuffer()->text->MeltFootnoteEnvironment();
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(-2);
+       current_view->buffer()->text->MeltFootnoteEnvironment();
+       current_view->buffer()->update(1);
 }
 
 
@@ -2460,12 +2459,12 @@ extern "C" void DepthCB(FL_OBJECT *ob, long decInc)
   
        if (current_view->available()) {
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->update(-2);
                if (button == 1)
-                       current_view->currentBuffer()->text->IncDepth();
+                       current_view->buffer()->text->IncDepth();
                else
-                       current_view->currentBuffer()->text->DecDepth();
-               current_view->currentBuffer()->update(1);
+                       current_view->buffer()->text->DecDepth();
+               current_view->buffer()->update(1);
                minibuffer->Set(_("Changed environment depth"
                                  " (in possible range, maybe not)"));
        }
@@ -2694,7 +2693,7 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
        labelwidthstring = fl_get_input(fd_form_paragraph->input_labelwidth);
        noindent = fl_get_button(fd_form_paragraph->check_noindent);
    
-       current_view->currentBuffer()->text->SetParagraph(line_top,
+       current_view->buffer()->text->SetParagraph(line_top,
                                                          line_bottom,
                                                          pagebreak_top,
                                                          pagebreak_bottom,
@@ -2703,7 +2702,7 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
                                                          align, 
                                                          labelwidthstring,
                                                          noindent);
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(1);
        minibuffer->Set(_("Paragraph layout set"));
 }
 
@@ -2849,8 +2848,8 @@ extern "C" void DocumentSpacingCB(FL_OBJECT *obj, long)
 extern "C" void DocumentApplyCB(FL_OBJECT *, long)
 {
        bool redo = false;
-       BufferParams *params = &(current_view->currentBuffer()->params);
-       current_view->currentBuffer()->params.language =
+       BufferParams *params = &(current_view->buffer()->params);
+       current_view->buffer()->params.language =
                combo_language->getline();
 
        // If default skip is a "Length" but there's no text in the
@@ -2888,12 +2887,12 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
                        // successfully loaded
                        redo = true;
                        minibuffer->Set(_("Converting document to new document class..."));
-                       int ret = current_view->currentBuffer()->
+                       int ret = current_view->buffer()->
                                text->
-                               SwitchLayoutsBetweenClasses(current_view->currentBuffer()->
+                               SwitchLayoutsBetweenClasses(current_view->buffer()->
                                                            params.textclass,
                                                            new_class,
-                                                           current_view->currentBuffer()->
+                                                           current_view->buffer()->
                                                            paragraph);
 
                        if (ret){
@@ -2992,7 +2991,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
                current_view->redoCurrentBuffer();
    
        minibuffer->Set(_("Document layout set"));
-       current_view->currentBuffer()->markDirty();
+       current_view->buffer()->markDirty();
 
         params->options =
                fl_get_input(fd_form_document->input_extra);
@@ -3027,20 +3026,20 @@ void GotoNote()
    
        current_view->getScreen()->HideCursor();
        BeforeChange();
-       current_view->currentBuffer()->update(-2);
+       current_view->buffer()->update(-2);
        LyXCursor tmp;
    
-       if (!current_view->currentBuffer()->text->GotoNextNote()) {
-               if (current_view->currentBuffer()->text->cursor.pos 
-                   || current_view->currentBuffer()->text->cursor.par !=
-                   current_view->currentBuffer()->text->FirstParagraph())
+       if (!current_view->buffer()->text->GotoNextNote()) {
+               if (current_view->buffer()->text->cursor.pos 
+                   || current_view->buffer()->text->cursor.par !=
+                   current_view->buffer()->text->FirstParagraph())
                        {
-                               tmp = current_view->currentBuffer()->text->cursor;
-                               current_view->currentBuffer()->text->cursor.par =
-                                       current_view->currentBuffer()->text->FirstParagraph();
-                               current_view->currentBuffer()->text->cursor.pos = 0;
-                               if (!current_view->currentBuffer()->text->GotoNextNote()) {
-                                       current_view->currentBuffer()->text->cursor = tmp;
+                               tmp = current_view->buffer()->text->cursor;
+                               current_view->buffer()->text->cursor.par =
+                                       current_view->buffer()->text->FirstParagraph();
+                               current_view->buffer()->text->cursor.pos = 0;
+                               if (!current_view->buffer()->text->GotoNextNote()) {
+                                       current_view->buffer()->text->cursor = tmp;
                                        minibuffer->Set(_("No more notes"));
                                        LyXBell();
                                }
@@ -3049,15 +3048,15 @@ void GotoNote()
                                LyXBell();
                        }
        }
-       current_view->currentBuffer()->update(0);
-       current_view->currentBuffer()->text->sel_cursor =
-               current_view->currentBuffer()->text->cursor;
+       current_view->buffer()->update(0);
+       current_view->buffer()->text->sel_cursor =
+               current_view->buffer()->text->cursor;
 }
 
 
 void InsertCorrectQuote()
 {
-       Buffer *cbuffer = current_view->currentBuffer();
+       Buffer *cbuffer = current_view->buffer();
        char c;
 
        if  (cbuffer->text->cursor.pos )
@@ -3077,7 +3076,7 @@ extern "C" void QuotesApplyCB(FL_OBJECT *, long)
                return;
        
        minibuffer->Set(_("Quotes type set"));
-       //current_view->currentBuffer()->params.quotes_language =
+       //current_view->buffer()->params.quotes_language =
        //      fl_get_choice(fd_form_quotes->choice_quotes_language) - 1;
        InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
        switch(fl_get_choice(fd_form_quotes->choice_quotes_language) - 1) {
@@ -3100,12 +3099,12 @@ extern "C" void QuotesApplyCB(FL_OBJECT *, long)
                lga = InsetQuotes::DanishQ;
                break;
        }
-       current_view->currentBuffer()->params.quotes_language = lga;
+       current_view->buffer()->params.quotes_language = lga;
        if (fl_get_button(fd_form_quotes->radio_single))   
-               current_view->currentBuffer()->
+               current_view->buffer()->
                        params.quotes_times = InsetQuotes::SingleQ;
        else
-               current_view->currentBuffer()->
+               current_view->buffer()->
                        params.quotes_times = InsetQuotes::DoubleQ;
 }
 
@@ -3137,9 +3136,9 @@ extern "C" void PreambleApplyCB(FL_OBJECT *, long)
        if (!current_view->available())
                return;
        
-       current_view->currentBuffer()->params.preamble =
+       current_view->buffer()->params.preamble =
                fl_get_input(fd_form_preamble->input_preamble);
-       current_view->currentBuffer()->markDirty();
+       current_view->buffer()->markDirty();
        minibuffer->Set(_("LaTeX preamble set"));
 }
 
@@ -3160,7 +3159,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
                return;
    
        // check for tables in tables
-       if (current_view->currentBuffer()->text->cursor.par->table){
+       if (current_view->buffer()->text->cursor.par->table){
                WriteAlert(_("Impossible Operation!"),
                           _("Cannot insert table in table."),
                           _("Sorry."));
@@ -3175,34 +3174,34 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
    
        current_view->getScreen()->HideCursor();
        BeforeChange();
-       current_view->currentBuffer()->update(-2);
+       current_view->buffer()->update(-2);
    
-       current_view->currentBuffer()->text->SetCursorParUndo(); 
-       current_view->currentBuffer()->text->FreezeUndo();
+       current_view->buffer()->text->SetCursorParUndo(); 
+       current_view->buffer()->text->FreezeUndo();
 
-       current_view->currentBuffer()->text->BreakParagraph();
-       current_view->currentBuffer()->update(-1);
+       current_view->buffer()->text->BreakParagraph();
+       current_view->buffer()->update(-1);
    
-       if (current_view->currentBuffer()->text->cursor.par->Last()) {
-               current_view->currentBuffer()->text->CursorLeft();
+       if (current_view->buffer()->text->cursor.par->Last()) {
+               current_view->buffer()->text->CursorLeft();
       
-               current_view->currentBuffer()->text->BreakParagraph();
-               current_view->currentBuffer()->update(-1);
+               current_view->buffer()->text->BreakParagraph();
+               current_view->buffer()->update(-1);
        }
 
-       current_view->currentBuffer()->text->current_font.setLatex(LyXFont::OFF);
+       current_view->buffer()->text->current_font.setLatex(LyXFont::OFF);
        //if (!fl_get_button(fd_form_table->check_latex)){
        // insert the new wysiwy table
-       current_view->currentBuffer()->text->SetLayout(0); // standard layout
-       if (current_view->currentBuffer()->text->cursor.par->footnoteflag ==
+       current_view->buffer()->text->SetLayout(0); // standard layout
+       if (current_view->buffer()->text->cursor.par->footnoteflag ==
            LyXParagraph::NO_FOOTNOTE) {
-               current_view->currentBuffer()->
+               current_view->buffer()->
                        text->SetParagraph(0, 0,
                                           0, 0,
-                                          VSpace (0.3 * current_view->currentBuffer()->
+                                          VSpace (0.3 * current_view->buffer()->
                                                   params.spacing.getValue(),
                                                   LyXLength::CM),
-                                          VSpace (0.3 * current_view->currentBuffer()->
+                                          VSpace (0.3 * current_view->buffer()->
                                                   params.spacing.getValue(),
                                                   LyXLength::CM),
                                           LYX_ALIGN_CENTER,
@@ -3210,7 +3209,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
                                           0);
        }
        else
-               current_view->currentBuffer()->text->SetParagraph(0, 0,
+               current_view->buffer()->text->SetParagraph(0, 0,
                                                                  0, 0,
                                                                  VSpace(VSpace::NONE),
                                                                  VSpace(VSpace::NONE),
@@ -3218,15 +3217,15 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
                                           string(),
                                           0);
 
-       current_view->currentBuffer()->text->cursor.par->table = new LyXTable(xsize, ysize);
+       current_view->buffer()->text->cursor.par->table = new LyXTable(xsize, ysize);
        int i;
        for (i=0; i<xsize * ysize - 1; i++)
-               current_view->currentBuffer()->text->cursor.par->InsertChar(0,LYX_META_NEWLINE);
-       current_view->currentBuffer()->text->RedoParagraph();
+               current_view->buffer()->text->cursor.par->InsertChar(0,LYX_META_NEWLINE);
+       current_view->buffer()->text->RedoParagraph();
    
-       current_view->currentBuffer()->text->UnFreezeUndo();
+       current_view->buffer()->text->UnFreezeUndo();
      
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(1);
        minibuffer->Set(_("Table inserted"));
 }
 
@@ -3262,7 +3261,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long)
 {
        if (!current_view->available())
                return;
-        Buffer *buffer = current_view->currentBuffer();
+        Buffer *buffer = current_view->buffer();
         string path = OnlyPath(buffer->getFileName());
 
        string pageflag;
@@ -3433,7 +3432,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
        if (!current_view->available())
                return;
 
-       Buffer * buffer = current_view->currentBuffer();
+       Buffer * buffer = current_view->buffer();
        if(buffer->isReadonly()) // paranoia
                return;
        
@@ -3546,7 +3545,7 @@ void LaTeXOptions()
                return;
 
        fl_set_button(fd_latex_options->accents,
-                     (int)current_view->currentBuffer()->params.allowAccents);
+                     (int)current_view->buffer()->params.allowAccents);
        
        if (fd_latex_options->LaTeXOptions->visible) {
                fl_raise_form(fd_latex_options->LaTeXOptions);
@@ -3585,7 +3584,7 @@ char* NextWord(float &value)
                return 0;
        }
    
-       char* string =  current_view->currentBuffer()->text->SelectNextWord(value);
+       char* string =  current_view->buffer()->text->SelectNextWord(value);
 
        return string;
 }
@@ -3598,9 +3597,9 @@ void SelectLastWord()
    
        current_view->getScreen()->HideCursor();
        BeforeChange(); 
-       current_view->currentBuffer()->text->SelectSelectedWord();
+       current_view->buffer()->text->SelectSelectedWord();
        current_view->getScreen()->ToggleSelection(false);
-       current_view->currentBuffer()->update(0);
+       current_view->buffer()->update(0);
 }
 
 
@@ -3611,9 +3610,9 @@ void EndOfSpellCheck()
    
        current_view->getScreen()->HideCursor();
        BeforeChange(); 
-       current_view->currentBuffer()->text->SelectSelectedWord();
-       current_view->currentBuffer()->text->ClearSelection();
-       current_view->currentBuffer()->update(0);
+       current_view->buffer()->text->SelectSelectedWord();
+       current_view->buffer()->text->ClearSelection();
+       current_view->buffer()->update(0);
 }
 
 
@@ -3623,20 +3622,20 @@ void ReplaceWord(string const & replacestring)
                return;
 
        current_view->getScreen()->HideCursor();
-       current_view->currentBuffer()->update(-2);
+       current_view->buffer()->update(-2);
    
        /* clear the selection (if there is any) */ 
        current_view->getScreen()->ToggleSelection(false);
-       current_view->currentBuffer()->text->
+       current_view->buffer()->text->
                ReplaceSelectionWithString(replacestring.c_str());
    
-       current_view->currentBuffer()->text->SetSelectionOverString(replacestring.c_str());
+       current_view->buffer()->text->SetSelectionOverString(replacestring.c_str());
 
        // Go back so that replacement string is also spellchecked
        for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
-               current_view->currentBuffer()->text->CursorLeftIntern();
+               current_view->buffer()->text->CursorLeftIntern();
        }
-       current_view->currentBuffer()->update(1);
+       current_view->buffer()->update(1);
 }
 // End of spellchecker stuff
 
@@ -3673,7 +3672,7 @@ extern "C" void TocSelectCB(FL_OBJECT *ob, long)
                return;
      
 
-       LyXParagraph *par = current_view->currentBuffer()->paragraph;
+       LyXParagraph *par = current_view->buffer()->paragraph;
        while (par && (par->GetFirstCounter(0) != tmptoclist->counter[0] ||
                       par->GetFirstCounter(1) != tmptoclist->counter[1] ||
                       par->GetFirstCounter(2) != tmptoclist->counter[2] ||
@@ -3686,10 +3685,10 @@ extern "C" void TocSelectCB(FL_OBJECT *ob, long)
    
        if (par) {
                BeforeChange();
-               current_view->currentBuffer()->text->SetCursor(par, 0);
-               current_view->currentBuffer()->text->sel_cursor =
-                       current_view->currentBuffer()->text->cursor;
-               current_view->currentBuffer()->update(0);
+               current_view->buffer()->text->SetCursor(par, 0);
+               current_view->buffer()->text->sel_cursor =
+                       current_view->buffer()->text->cursor;
+               current_view->buffer()->update(0);
        }
        else {
                WriteAlert(_("Error"), 
@@ -3730,7 +3729,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
        }
        fl_hide_object(fd_form_toc->browser_toc);
        /* get the table of contents */ 
-       LyXParagraph * par = current_view->currentBuffer()->paragraph;
+       LyXParagraph * par = current_view->buffer()->paragraph;
        char labeltype;
        char * line = new char[200];
        int pos = 0;
@@ -3742,18 +3741,18 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
        stapar = par;
    
        while (par) {
-               labeltype = textclasslist.Style(current_view->currentBuffer()->params.textclass, 
+               labeltype = textclasslist.Style(current_view->buffer()->params.textclass, 
                                           par->GetLayout()).labeltype;
       
                if (labeltype >= LABEL_COUNTER_CHAPTER
                    && labeltype <= LABEL_COUNTER_CHAPTER +
-                   current_view->currentBuffer()->params.tocdepth) {
+                   current_view->buffer()->params.tocdepth) {
                        /* insert this into the table of contents */ 
                        /* first indent a little bit */ 
                        
                        for (pos=0; 
                             pos < (labeltype - 
-                                   textclasslist.TextClass(current_view->currentBuffer()->
+                                   textclasslist.TextClass(current_view->buffer()->
                                                       params.textclass).maxcounter()) * 4 + 2;
                             pos++)
                                line[pos] = ' ';
@@ -3829,7 +3828,7 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data)
                return;
 
         if (data==2) {
-                current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
+                current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
                return;
        }
            
@@ -3839,14 +3838,14 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data)
        else
                t += "\\pageref";
 
-       if(current_view->currentBuffer()->isSGML())
+       if(current_view->buffer()->isSGML())
                t += "[" + u + "]" + "{" + s + "}";
        else
                t += "{" + s + "}";
 
        Inset *new_inset =
-               new InsetRef(t, current_view->currentBuffer());
-       current_view->currentBuffer()->insertInset(new_inset);
+               new InsetRef(t, current_view->buffer());
+       current_view->buffer()->insertInset(new_inset);
 }
 
 
@@ -3868,7 +3867,7 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
 
        fl_clear_browser(brow);
 
-       string refs = current_view->currentBuffer()->getReferenceList('\n');
+       string refs = current_view->buffer()->getReferenceList('\n');
        int topline = 1;
 
 #if FL_REVISION > 85
@@ -3903,12 +3902,12 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
                fl_select_browser_line(brow, topline);
                fl_activate_object(brow);
        }
-       if (current_view->currentBuffer()->isReadonly()) {
+       if (current_view->buffer()->isReadonly()) {
                // would be better to de/activate insert buttons
                // but that's more work... besides this works. ARRae
                fl_hide_form(fd_form_ref->form_ref);
        }
-       if (!current_view->currentBuffer()->isSGML()) {
+       if (!current_view->buffer()->isSGML()) {
                fl_deactivate_object(fd_form_ref->ref_name);
                fl_set_object_lcol(fd_form_ref->ref_name, FL_INACTIVE);
        }
@@ -3931,13 +3930,13 @@ void UpdateInset(Inset* inset, bool mark_dirty)
                return;
 
        /* very first check for locking insets*/
-       if (current_view->currentBuffer()->the_locking_inset == inset){
-               if (current_view->currentBuffer()->text->UpdateInset(inset)){
+       if (current_view->buffer()->the_locking_inset == inset){
+               if (current_view->buffer()->text->UpdateInset(inset)){
                        current_view->update();
                        if (mark_dirty){
-                               if (current_view->currentBuffer()->isLyxClean())
+                               if (current_view->buffer()->isLyxClean())
                                        minibuffer->setTimer(4);
-                               current_view->currentBuffer()->markDirty();
+                               current_view->buffer()->markDirty();
                        }
                        current_view->updateScrollbar();
                        return;
@@ -3947,12 +3946,12 @@ void UpdateInset(Inset* inset, bool mark_dirty)
        /* first check the current buffer */
        if (current_view->available()){
                current_view->getScreen()->HideCursor();
-               current_view->currentBuffer()->update(-3);
-               if (current_view->currentBuffer()->text->UpdateInset(inset)){
+               current_view->buffer()->update(-3);
+               if (current_view->buffer()->text->UpdateInset(inset)){
                        if (mark_dirty)
-                               current_view->currentBuffer()->update(1);
+                               current_view->buffer()->update(1);
                        else 
-                               current_view->currentBuffer()->update(3);
+                               current_view->buffer()->update(3);
                        return;
                }
        }
@@ -3967,8 +3966,8 @@ void UpdateInset(Inset* inset, bool mark_dirty)
    otherwise 0 */
 int LockInset(UpdatableInset* inset)
 {
-       if (!current_view->currentBuffer()->the_locking_inset && inset){
-               current_view->currentBuffer()->the_locking_inset = inset;
+       if (!current_view->buffer()->the_locking_inset && inset){
+               current_view->buffer()->the_locking_inset = inset;
                return 0;
        }
        return 1;
@@ -3977,9 +3976,9 @@ int LockInset(UpdatableInset* inset)
 
 void ShowLockedInsetCursor(long x, long y, int asc, int desc)
 {
-       if (current_view->currentBuffer()->the_locking_inset &&
+       if (current_view->buffer()->the_locking_inset &&
            current_view->getScreen()){
-               y += current_view->currentBuffer()->text->cursor.y;
+               y += current_view->buffer()->text->cursor.y;
                current_view->getScreen()->ShowManualCursor(x, y,
                                                            asc, desc);
        }
@@ -3988,9 +3987,9 @@ void ShowLockedInsetCursor(long x, long y, int asc, int desc)
 
 void HideLockedInsetCursor(long x, long y, int asc, int desc)
 {
-       if (current_view->currentBuffer()->the_locking_inset &&
+       if (current_view->buffer()->the_locking_inset &&
            current_view->getScreen()){
-               y += current_view->currentBuffer()->text->cursor.y;
+               y += current_view->buffer()->text->cursor.y;
                current_view->getScreen()->HideManualCursor(x, y,
                                                            asc, desc);
        }
@@ -3999,9 +3998,9 @@ void HideLockedInsetCursor(long x, long y, int asc, int desc)
 
 void FitLockedInsetCursor(long x, long y, int asc, int desc)
 {
-       if (current_view->currentBuffer()->the_locking_inset &&
+       if (current_view->buffer()->the_locking_inset &&
            current_view->getScreen()){
-               y += current_view->currentBuffer()->text->cursor.y;
+               y += current_view->buffer()->text->cursor.y;
                if (current_view->getScreen()->FitManualCursor(x, y, asc, desc))
                        current_view->updateScrollbar();
        }
@@ -4011,10 +4010,10 @@ void FitLockedInsetCursor(long x, long y, int asc, int desc)
 int UnlockInset(UpdatableInset* inset)
 {
        if (inset &&
-           current_view->currentBuffer()->the_locking_inset == inset){
+           current_view->buffer()->the_locking_inset == inset){
                inset->InsetUnlock();
-               current_view->currentBuffer()->the_locking_inset = 0;
-               current_view->currentBuffer()->text->FinishUndo();
+               current_view->buffer()->the_locking_inset = 0;
+               current_view->buffer()->text->FinishUndo();
                return 0;
        }
        return bufferlist.unlockInset(inset);
@@ -4023,15 +4022,15 @@ int UnlockInset(UpdatableInset* inset)
 
 void LockedInsetStoreUndo(Undo::undo_kind kind)
 {
-       if (!current_view->currentBuffer()->the_locking_inset)
+       if (!current_view->buffer()->the_locking_inset)
                return; // shouldn't happen
        if (kind == Undo::EDIT) // in this case insets would not be stored!
                kind = Undo::FINISH;
-       current_view->currentBuffer()->text->SetUndo(kind,
-                             current_view->currentBuffer()->text->cursor.par->
-                             ParFromPos(current_view->currentBuffer()->text->cursor.pos)->previous, 
-                             current_view->currentBuffer()->text->cursor.par->
-                             ParFromPos(current_view->currentBuffer()->text->cursor.pos)->next); 
+       current_view->buffer()->text->SetUndo(kind,
+                             current_view->buffer()->text->cursor.par->
+                             ParFromPos(current_view->buffer()->text->cursor.pos)->previous, 
+                             current_view->buffer()->text->cursor.par->
+                             ParFromPos(current_view->buffer()->text->cursor.pos)->next); 
 }
 
 
@@ -4054,7 +4053,7 @@ void UpdateInsetUpdateList()
                tmp = tmp->next;
        }
   
-       /* delete the update list */
+       // delete the update list
        while (InsetUpdateList) {
                tmp = InsetUpdateList;
                InsetUpdateList = InsetUpdateList->next;
index cc6498dc01b74af6c53a0b9003c160283520544a..0622a55de2406d1347f939889b1ca81fb9802d05 100644 (file)
@@ -325,9 +325,9 @@ void LyXGUI::init()
 
 void LyXGUI::create_forms()
 {
-       lyxerr.debug() << "Initializing LyXView..." << endl;
+       lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
        lyxViews = new LyXView(width, height);
-       lyxerr.debug() << "Initializing LyXView...done" << endl;
+       lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
 
        // From here down should be done by somebody else. (Lgb)
 
@@ -641,5 +641,5 @@ void LyXGUI::runTime()
 
 void LyXGUI::regBuf(Buffer *b)
 {
-       lyxViews->currentView()->setBuffer(b);
+       lyxViews->currentView()->buffer(b);
 }
index 4df85410b499eec7d91a3e6a9d398ffe0487bbc4..ff860e9dcda3b7e5ab183083d2e04f664f2b8445 100644 (file)
@@ -242,7 +242,7 @@ void updateAllVisibleBufferRelatedPopups()
                RefUpdateCB(0,0);
        }
 #endif
-       if (current_view->currentBuffer()->isReadonly()) {
+       if (current_view->buffer()->isReadonly()) {
                // a little crude perhaps but it works. ARRae
                if (fd_form_character->form_character->visible) {
                        fl_hide_form(fd_form_character->form_character);
@@ -410,6 +410,6 @@ void WarnReadonly()
 {
        WriteAlert(_("Any changes will be ignored"),
                   _("The document is read-only:"),
-                  current_view->currentBuffer()->getFileName());
+                  current_view->buffer()->getFileName());
 }
 
index fe94a10cea8d67f17294bfff3f7b6846e44e30ec..ede5b9c5292dae988ef3140e85598cf3f4f97525 100644 (file)
@@ -66,19 +66,19 @@ LyX::LyX(int * argc, char * argv[])
        // Global bindings (this must be done as early as possible.) (Lgb)
        toplevel_keymap = new kb_keymap;
 
-       lyxerr.debug() << "Initializing lyxrc" << endl;
+       lyxerr[Debug::INIT] << "Initializing lyxrc" << endl;
        lyxrc = new LyXRC;
 
        // Make the GUI object, and let it take care of the
        // command line arguments that concerns it.
-       lyxerr.debug() << "Initializing LyXGUI..." << endl;
+       lyxerr[Debug::INIT] << "Initializing LyXGUI..." << endl;
        lyxGUI = new LyXGUI(this, argc, argv, gui);
-       lyxerr.debug() << "Initializing LyXGUI...done" << endl;
+       lyxerr[Debug::INIT] << "Initializing LyXGUI...done" << endl;
 
        // Initialization of LyX (reads lyxrc and more)
-       lyxerr.debug() << "Initializing LyX::init..." << endl;
+       lyxerr[Debug::INIT] << "Initializing LyX::init..." << endl;
        init(argc, argv);
-       lyxerr.debug() << "Initializing LyX::init...done" << endl;
+       lyxerr[Debug::INIT] << "Initializing LyX::init...done" << endl;
 
        lyxGUI->init();
 
@@ -87,13 +87,13 @@ LyX::LyX(int * argc, char * argv[])
        // the only thing left on the command line should be
        // filenames.
        if ((*argc)==2) 
-               lyxerr.debug() << "Opening document..." << endl;
+               lyxerr[Debug::INFO] << "Opening document..." << endl;
        else if ((*argc)>2)
-               lyxerr.debug() << "Opening documents..." << endl;
+               lyxerr[Debug::INFO] << "Opening documents..." << endl;
 
        Buffer * last_loaded = 0;
 
-       for (int argi = (*argc) - 1; argi >= 1; argi--) {
+       for (int argi = (*argc) - 1; argi >= 1; --argi) {
                Buffer * loadb = bufferlist.loadLyXFile(argv[argi]);
                if (loadb != 0) {
                        last_loaded = loadb;
@@ -169,7 +169,7 @@ void LyX::init(int */*argc*/, char **argv)
                       << _("If you have problems, try starting LyX with an absolute path.")
                       << endl;
        }
-       lyxerr.debug() << "Path of binary: " << binpath << endl;
+       lyxerr[Debug::INIT] << "Path of binary: " << binpath << endl;
 
        //
        // Determine system directory.
@@ -323,7 +323,7 @@ void LyX::init(int */*argc*/, char **argv)
        Screen * scr=(DefaultScreenOfDisplay(fl_get_display()));
        lyxrc->dpi = ((HeightOfScreen(scr)* 25.4 / HeightMMOfScreen(scr)) +
                      (WidthOfScreen(scr)* 25.4 / WidthMMOfScreen(scr))) / 2;
-       lyxerr.debug() << "DPI setting detected to be "
+       lyxerr[Debug::INFO] << "DPI setting detected to be "
                       << lyxrc->dpi+0.5 << endl;
 
        //
index 233ac3cfbb44faf2b988da32438ed47f32417236..1e4cee8ca241f558cff4906669f29ca915ba1323 100644 (file)
@@ -141,10 +141,10 @@ void SetSelectionOverLenChars(LyXText *lt, int len)
 void LyXFindReplace1::StartSearch()
 {
        LyXFindReplace0::StartSearch();
-       SetReplaceEnabled(!current_view->currentBuffer()->isReadonly());
+       SetReplaceEnabled(!current_view->buffer()->isReadonly());
        searchForward = true;
        if (lsSearch.empty()) 
-               SetSearchString(GetSelectionOrWordAtCursor(current_view->currentBuffer()->text));
+               SetSearchString(GetSelectionOrWordAtCursor(current_view->buffer()->text));
 }      
 
 
@@ -155,7 +155,7 @@ void LyXFindReplace1::SearchReplaceCB()
 
        if (!current_view->getScreen())
                return;
-       if (current_view->currentBuffer()->isReadonly())
+       if (current_view->buffer()->isReadonly())
                return;
        
        // CutSelection cannot cut a single space, so we have to stop
@@ -171,17 +171,17 @@ void LyXFindReplace1::SearchReplaceCB()
        string const replacestring = ReplaceString();
 
        current_view->getScreen()->HideCursor();
-       current_view->currentBuffer()->update(-2);
+       current_view->buffer()->update(-2);
 
-       ltCur = current_view->currentBuffer()->text;    
+       ltCur = current_view->buffer()->text;   
        if (ltCur->selection) {
                // clear the selection (if there is any) 
                current_view->getScreen()->ToggleSelection(false);
-               current_view->currentBuffer()->text->
+               current_view->buffer()->text->
                        ReplaceSelectionWithString(replacestring.c_str());
-               current_view->currentBuffer()->text->
+               current_view->buffer()->text->
                        SetSelectionOverString(replacestring.c_str());
-               current_view->currentBuffer()->update(1);
+               current_view->buffer()->update(1);
        }
        
        // jump to next match:
@@ -196,7 +196,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
 
        if (!current_view->getScreen())
                return;
-       if (current_view->currentBuffer()->isReadonly())
+       if (current_view->buffer()->isReadonly())
                return;
 
        // CutSelection cannot cut a single space, so we have to stop
@@ -214,20 +214,20 @@ void LyXFindReplace1::SearchReplaceAllCB()
        current_view->getScreen()->HideCursor();
 
        // start at top
-       current_view->currentBuffer()->text->ClearSelection();
-       current_view->currentBuffer()->text->CursorTop();
+       current_view->buffer()->text->ClearSelection();
+       current_view->buffer()->text->CursorTop();
 
        int replace_count = 0;
        do {
-               ltCur = current_view->currentBuffer()->text;    
+               ltCur = current_view->buffer()->text;   
                if (ltCur->selection) {
-                       current_view->currentBuffer()->update(-2);
+                       current_view->buffer()->update(-2);
                        current_view->getScreen()->ToggleSelection(false);
-                       current_view->currentBuffer()->text->
+                       current_view->buffer()->text->
                                ReplaceSelectionWithString(replacestring.c_str());
-                       current_view->currentBuffer()->text->
+                       current_view->buffer()->text->
                                SetSelectionOverString(replacestring.c_str());
-                       current_view->currentBuffer()->update(1); 
+                       current_view->buffer()->update(1); 
                        replace_count++;
                }
        } while( SearchCB(true) );
@@ -259,8 +259,8 @@ bool LyXFindReplace1::SearchCB(bool fForward)
                return(false);
    
        current_view->getScreen()->HideCursor();
-       current_view->currentBuffer()->update(-2);
-       ltCur = current_view->currentBuffer()->text;
+       current_view->buffer()->update(-2);
+       ltCur = current_view->buffer()->text;
        if (ltCur->selection) 
                ltCur->cursor = fForward ? ltCur->sel_end_cursor :
                                                  ltCur->sel_start_cursor;
@@ -270,14 +270,14 @@ bool LyXFindReplace1::SearchCB(bool fForward)
    
        if (!ValidSearchData() ||
            (fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
-               current_view->currentBuffer()->update(-2);
+               current_view->buffer()->update(-2);
 
                // clear the selection (if there is any) 
                current_view->getScreen()->ToggleSelection();
-               current_view->currentBuffer()->text->ClearSelection();
+               current_view->buffer()->text->ClearSelection();
 
                // set the new selection 
-               SetSelectionOverLenChars(current_view->currentBuffer()->text, iLenSelected);
+               SetSelectionOverLenChars(current_view->buffer()->text, iLenSelected);
                current_view->getScreen()->ToggleSelection(false);
                minibuffer->Set(_("Found."));
                result = true;
index 63caf89c83239250f10672daf94177bd18fad2fe..355a0a8e108dd914aa9d1b38077e62a440464abd 100644 (file)
@@ -170,12 +170,12 @@ LyXFunc::~LyXFunc()
 inline
 void LyXFunc::moveCursorUpdate(bool selecting)
 {
-       if (selecting || owner->currentBuffer()->text->mark_set) {
-               owner->currentBuffer()->text->SetSelection();
+       if (selecting || owner->buffer()->text->mark_set) {
+               owner->buffer()->text->SetSelection();
                owner->currentView()->getScreen()->ToggleToggle();
-               owner->currentBuffer()->update(0);
+               owner->buffer()->update(0);
        } else {
-               owner->currentBuffer()->update(-2); // this IS necessary
+               owner->buffer()->update(-2); // this IS necessary
                // (Matthias) 
        }
        owner->currentView()->getScreen()->ShowCursor();
@@ -217,10 +217,10 @@ int LyXFunc::processKeyEvent(XEvent *ev)
        
        // this function should be used always [asierra060396]
        if (owner->currentView()->available() &&
-           owner->currentBuffer()->the_locking_inset &&
+           owner->buffer()->the_locking_inset &&
            keysym_return == XK_Escape) {
-               UnlockInset(owner->currentBuffer()->the_locking_inset);
-               owner->currentBuffer()->text->CursorRight();
+               UnlockInset(owner->buffer()->the_locking_inset);
+               owner->buffer()->text->CursorRight();
                return 0;
        }
 
@@ -432,7 +432,7 @@ string LyXFunc::Dispatch(int ac,
         // Now that we know which action, if the buffer is RO let's check 
        // whether the action is legal.  Alejandro 970603
         if (owner->currentView()->available() && 
-            owner->currentBuffer()->isReadonly() && 
+            owner->buffer()->isReadonly() && 
             lyxaction.isFuncRO(action)) {
                setErrorMessage(N_("Document is read-only"));
                lyxerr.debug() << "Error: Document is read-only." << endl;
@@ -442,7 +442,7 @@ string LyXFunc::Dispatch(int ac,
        // If in math mode pass the control to
        // the math inset [asierra060396]
        if (owner->currentView()->available() &&
-           owner->currentBuffer()->the_locking_inset) {
+           owner->buffer()->the_locking_inset) {
                if (action>1 || (action==LFUN_UNKNOWN_ACTION && keyseq.length>=-1)) {
                        if (action==LFUN_UNKNOWN_ACTION && argument.empty()) {
                                argument = keyseq.getiso();
@@ -451,32 +451,32 @@ string LyXFunc::Dispatch(int ac,
                        if (action==LFUN_UNDO) {
                                int slx, sly;
                                UpdatableInset* inset =
-                                       owner->currentBuffer()->the_locking_inset;
+                                       owner->buffer()->the_locking_inset;
                                inset->GetCursorPos(slx, sly);
                                UnlockInset(inset);
                                MenuUndo();
-                               inset = (UpdatableInset*)owner->currentBuffer()->text->cursor.par->GetInset(owner->currentBuffer()->text->cursor.pos);
+                               inset = (UpdatableInset*)owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos);
                                if (inset) 
                                        inset->Edit(slx, sly);
                                return string();
                        } else 
                                if (action==LFUN_REDO) {
                                        int slx, sly;
-                                       UpdatableInset* inset = owner->currentBuffer()->the_locking_inset;
+                                       UpdatableInset* inset = owner->buffer()->the_locking_inset;
                                        inset->GetCursorPos(slx, sly);
                                        UnlockInset(inset);
                                        MenuRedo();
-                                       inset = (UpdatableInset*)owner->currentBuffer()->text->cursor.par->GetInset(owner->currentBuffer()->text->cursor.pos);
+                                       inset = (UpdatableInset*)owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos);
                                        if (inset)
                                                inset->Edit(slx, sly);
                                        return string();
                                } else
-                                       if (owner->currentBuffer()->the_locking_inset->LocalDispatch(action, argument.c_str()))
+                                       if (owner->buffer()->the_locking_inset->LocalDispatch(action, argument.c_str()))
                                                return string();
                                        else {
                                                setMessage(N_("Text mode"));
                                                if (action==LFUN_RIGHT || action==-1)
-                                                       owner->currentBuffer()->text->CursorRight();
+                                                       owner->buffer()->text->CursorRight();
                                                if (action==LFUN_LEFT || action==LFUN_RIGHT)
                                                        return string();
                                        }
@@ -486,8 +486,7 @@ string LyXFunc::Dispatch(int ac,
        switch(action) {
                // --- Misc -------------------------------------------
        case LFUN_WORDFINDFORWARD  : 
-       case LFUN_WORDFINDBACKWARD : { 
-               LyXText *ltCur;
+       case LFUN_WORDFINDBACKWARD : {
                static string last_search;
                string searched_string;
            
@@ -498,7 +497,7 @@ string LyXFunc::Dispatch(int ac,
                        searched_string = last_search;
                }
 
-               ltCur =  owner->currentView()->currentBuffer()->text ;   
+               LyXText * ltCur = owner->currentView()->buffer()->text ;
 
                if (!searched_string.empty() &&
                    (    (action == LFUN_WORDFINDBACKWARD) ? 
@@ -507,17 +506,17 @@ string LyXFunc::Dispatch(int ac,
                         )){
 
                        // ??? What is that ???
-                       owner->currentView()->currentBuffer()->update(-2);
+                       owner->currentView()->buffer()->update(-2);
 
                        // ??? Needed ???
                        // clear the selection (if there is any) 
                        owner->currentView()->getScreen()->ToggleSelection();
-                       owner->currentView()->currentBuffer()->text->ClearSelection();
+                       owner->currentView()->buffer()->text->ClearSelection();
 
                        // Move cursor so that successive C-s 's will not stand in place. 
                        if( action == LFUN_WORDFINDFORWARD ) 
-                               owner->currentBuffer()->text->CursorRightOneWord();
-                       owner->currentBuffer()->text->FinishUndo();
+                               owner->buffer()->text->CursorRightOneWord();
+                       owner->buffer()->text->FinishUndo();
                        moveCursorUpdate(false);
 
                        // ??? Needed ???
@@ -536,7 +535,7 @@ string LyXFunc::Dispatch(int ac,
        {
                if (owner->currentView()->available()
                    && owner->currentView()->getScreen()) {
-                       owner->currentBuffer()->update(-2);
+                       owner->buffer()->update(-2);
                }
                char buf[100];
                keyseq.print(buf,100, true);
@@ -569,33 +568,33 @@ string LyXFunc::Dispatch(int ac,
        break;  
 
        case LFUN_READ_ONLY_TOGGLE:
-               if (owner->currentBuffer()->lyxvc.inUse()) {
-                       owner->currentBuffer()->lyxvc.toggleReadOnly();
+               if (owner->buffer()->lyxvc.inUse()) {
+                       owner->buffer()->lyxvc.toggleReadOnly();
                } else {
-                       owner->currentBuffer()->setReadonly(
-                               !owner->currentBuffer()->isReadonly());
+                       owner->buffer()->setReadonly(
+                               !owner->buffer()->isReadonly());
                }
                break;
                
        case LFUN_CENTER: // this is center and redraw.
                BeforeChange();
-               if (owner->currentBuffer()->text->cursor.y >
+               if (owner->buffer()->text->cursor.y >
                    owner->currentView()->getWorkArea()->h / 2) {
                        owner->currentView()->getScreen()->
-                               Draw(owner->currentBuffer()->text->cursor.y -
+                               Draw(owner->buffer()->text->cursor.y -
                                     owner->currentView()->getWorkArea()->h/2);
                } else { // <=
                        owner->currentView()->getScreen()->
                                Draw(0);
                }
-               owner->currentBuffer()->update(0);
+               owner->buffer()->update(0);
                owner->currentView()->redraw();
                break;
                
        case LFUN_APPENDIX:
                if (owner->currentView()->available()) {
-                       owner->currentBuffer()->text->toggleAppendix();
-                       owner->currentBuffer()->update(1);
+                       owner->buffer()->text->toggleAppendix();
+                       owner->buffer()->update(1);
                }
                break;
 
@@ -617,11 +616,11 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_MENUWRITE:
-               MenuWrite(owner->currentBuffer());
+               MenuWrite(owner->buffer());
                break;
                
        case LFUN_MENUWRITEAS:
-               MenuWriteAs(owner->currentBuffer());
+               MenuWriteAs(owner->buffer());
                break;
                
        case LFUN_MENURELOAD:
@@ -629,35 +628,35 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_PREVIEW:
-               MenuPreview(owner->currentBuffer());
+               MenuPreview(owner->buffer());
                break;
                        
        case LFUN_PREVIEWPS:
-               MenuPreviewPS(owner->currentBuffer());
+               MenuPreviewPS(owner->buffer());
                break;
                
        case LFUN_RUNLATEX:
-               MenuRunLaTeX(owner->currentBuffer());
+               MenuRunLaTeX(owner->buffer());
                break;
                
         case LFUN_BUILDPROG:
-                MenuBuildProg(owner->currentBuffer());
+                MenuBuildProg(owner->buffer());
                 break;
                 
        case LFUN_RUNCHKTEX:
-               MenuRunChktex(owner->currentBuffer());
+               MenuRunChktex(owner->buffer());
                break;
                
        case LFUN_RUNDVIPS:
-               MenuRunDvips(owner->currentBuffer(), false);
+               MenuRunDvips(owner->buffer(), false);
                break;
                
        case LFUN_MENUPRINT:
-               MenuPrint(owner->currentBuffer());
+               MenuPrint(owner->buffer());
                break;
                
        case LFUN_FAX:
-               MenuFax(owner->currentBuffer());
+               MenuFax(owner->buffer());
                break;
                        
        case LFUN_EXPORT:
@@ -668,17 +667,17 @@ string LyXFunc::Dispatch(int ac,
                // latex
                if (extyp == "latex") {
                        // make sure that this buffer is not linuxdoc
-                       MenuMakeLaTeX(owner->currentBuffer());
+                       MenuMakeLaTeX(owner->buffer());
                }
                // linuxdoc
                else if (extyp == "linuxdoc") {
                        // make sure that this buffer is not latex
-                       MenuMakeLinuxDoc(owner->currentBuffer());
+                       MenuMakeLinuxDoc(owner->buffer());
                }
                // docbook
                else if (extyp == "docbook") {
                        // make sure that this buffer is not latex or linuxdoc
-                       MenuMakeDocBook(owner->currentBuffer());
+                       MenuMakeDocBook(owner->buffer());
                }
                // dvi
                else if (extyp == "dvi") {
@@ -689,20 +688,20 @@ string LyXFunc::Dispatch(int ac,
                        // *.log and *.aux files also. (Asger)
                        bool flag = lyxrc->use_tempdir;
                        lyxrc->use_tempdir = false;
-                       MenuRunLaTeX(owner->currentBuffer());
+                       MenuRunLaTeX(owner->buffer());
                        lyxrc->use_tempdir = flag;
                }
                // postscript
                else if (extyp == "postscript") {
                        // Start Print-dialog. Not as good as dvi... Bernhard.
-                       MenuPrint(owner->currentBuffer());
+                       MenuPrint(owner->buffer());
                        // Since the MenuPrint is a pop-up, we can't use
                        // the same trick as above. (Asger)
                        // MISSING: Move of ps-file :-(
                }
                // ascii
                else if (extyp == "ascii") {
-                       MenuMakeAscii(owner->currentBuffer());
+                       MenuMakeAscii(owner->buffer());
                }
                else if (extyp == "custom") {
                        MenuSendto();
@@ -711,10 +710,10 @@ string LyXFunc::Dispatch(int ac,
                // HTML
                else if (extyp == "html" && lyxrc->html_command != "none") {
                        // First, create LaTeX file
-                       MenuMakeLaTeX(owner->currentBuffer());
+                       MenuMakeLaTeX(owner->buffer());
 
                        // And now, run the converter
-                       string file = owner->currentBuffer()->getFileName();
+                       string file = owner->buffer()->getFileName();
                        Path path(OnlyPath(file));
                        // the tex file name has to be correct for
                        // latex, but the html file name can be
@@ -791,8 +790,8 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_TOC_INSERT:
        {
                Inset *new_inset =
-                       new InsetTOC(owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset,
+                       new InsetTOC(owner->buffer());
+               owner->buffer()->insertInset(new_inset,
                                                    "Standard", true);
                break;
        }
@@ -800,8 +799,8 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_LOF_INSERT:
        {
                Inset *new_inset =
-                       new InsetLOF(owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset,
+                       new InsetLOF(owner->buffer());
+               owner->buffer()->insertInset(new_inset,
                                                    "Standard", true);
                break;
        }
@@ -809,8 +808,8 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_LOA_INSERT:
        {
                Inset *new_inset =
-                       new InsetLOA(owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset,
+                       new InsetLOA(owner->buffer());
+               owner->buffer()->insertInset(new_inset,
                                                    "Standard", true);
                break;
        }
@@ -818,8 +817,8 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_LOT_INSERT:
        {
                Inset *new_inset =
-                       new InsetLOT(owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset,
+                       new InsetLOT(owner->buffer());
+               owner->buffer()->insertInset(new_inset,
                                                    "Standard", true);
                break;
        }
@@ -881,7 +880,7 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_REMOVEERRORS:
-               if (owner->currentBuffer()->removeAutoInsets()) {
+               if (owner->buffer()->removeAutoInsets()) {
                        owner->currentView()->redraw();
                        owner->currentView()->fitCursor();
                        owner->currentView()->updateScrollbar();
@@ -946,11 +945,11 @@ string LyXFunc::Dispatch(int ac,
 
        case LFUN_FOOTMELT:
                if (owner->currentView()->available()
-                   && !owner->currentBuffer()->text->selection
-                   && owner->currentBuffer()->text->cursor.par->footnoteflag
+                   && !owner->buffer()->text->selection
+                   && owner->buffer()->text->cursor.par->footnoteflag
                    != LyXParagraph::NO_FOOTNOTE)
                { // only melt footnotes with FOOTMELT, not margins etc
-                 if(owner->currentBuffer()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
+                 if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
                        MeltCB(ob,0);
                }
                else
@@ -959,11 +958,11 @@ string LyXFunc::Dispatch(int ac,
 
        case LFUN_MARGINMELT:
                if (owner->currentView()->available()
-                   && !owner->currentBuffer()->text->selection
-                   && owner->currentBuffer()->text->cursor.par->footnoteflag
+                   && !owner->buffer()->text->selection
+                   && owner->buffer()->text->cursor.par->footnoteflag
                    != LyXParagraph::NO_FOOTNOTE)
                { // only melt margins
-                 if(owner->currentBuffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
+                 if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
                        MeltCB(ob,0);
                }
                else
@@ -973,42 +972,42 @@ string LyXFunc::Dispatch(int ac,
                // --- version control -------------------------------
        case LFUN_VC_REGISTER:
        {
-               if (!owner->currentBuffer()->lyxvc.inUse())
-                       owner->currentBuffer()->lyxvc.registrer();
+               if (!owner->buffer()->lyxvc.inUse())
+                       owner->buffer()->lyxvc.registrer();
        }
        break;
                
        case LFUN_VC_CHECKIN:
        {
-               if (owner->currentBuffer()->lyxvc.inUse()
-                   && !owner->currentBuffer()->isReadonly())
-                       owner->currentBuffer()->lyxvc.checkIn();
+               if (owner->buffer()->lyxvc.inUse()
+                   && !owner->buffer()->isReadonly())
+                       owner->buffer()->lyxvc.checkIn();
        }
        break;
                
        case LFUN_VC_CHECKOUT:
        {
-               if (owner->currentBuffer()->lyxvc.inUse()
-                   && owner->currentBuffer()->isReadonly())
-                       owner->currentBuffer()->lyxvc.checkOut();
+               if (owner->buffer()->lyxvc.inUse()
+                   && owner->buffer()->isReadonly())
+                       owner->buffer()->lyxvc.checkOut();
        }
        break;
        
        case LFUN_VC_REVERT:
        {
-               owner->currentBuffer()->lyxvc.revert();
+               owner->buffer()->lyxvc.revert();
        }
        break;
                
        case LFUN_VC_UNDO:
        {
-               owner->currentBuffer()->lyxvc.undoLast();
+               owner->buffer()->lyxvc.undoLast();
        }
        break;
                
        case LFUN_VC_HISTORY:
        {
-               owner->currentBuffer()->lyxvc.showLog();
+               owner->buffer()->lyxvc.showLog();
                break;
        }
        
@@ -1021,7 +1020,7 @@ string LyXFunc::Dispatch(int ac,
                // remember the previous buffer, not bufferlist.
 //                     if (owner->currentView()->available()){   
 //                             BeforeChange();
-//                             owner->currentBuffer()->update(-2);
+//                             owner->buffer()->update(-2);
 //                     }
 //                     owner->currentView()->setBuffer(bufferlist.prev());
 
@@ -1049,12 +1048,12 @@ string LyXFunc::Dispatch(int ac,
                Buffer * tmpbuf = 0;
                tmpbuf = NewLyxFile(argument);
                if (tmpbuf)
-                       owner->currentView()->setBuffer(tmpbuf);
+                       owner->currentView()->buffer(tmpbuf);
        }
                break;
                        
        case LFUN_FILE_OPEN:
-               owner->currentView()->setBuffer(
+               owner->currentView()->buffer(
                        bufferlist.loadLyXFile(argument));
                break;
 
@@ -1076,7 +1075,7 @@ string LyXFunc::Dispatch(int ac,
 
                // Pretend we got the name instead.
                Dispatch(int(LFUN_LAYOUT), 
-                        textclasslist.NameOfLayout(owner->currentBuffer()->
+                        textclasslist.NameOfLayout(owner->buffer()->
                                               text->parameters->
                                               textclass,
                                               sel).c_str());
@@ -1093,7 +1092,7 @@ string LyXFunc::Dispatch(int ac,
                int layoutno = -1;
                layoutno =
                        textclasslist.NumberOfLayout(owner->
-                                               currentBuffer()->
+                                               buffer()->
                                                text->parameters->
                                                textclass,
                                                argument).second;
@@ -1108,14 +1107,14 @@ string LyXFunc::Dispatch(int ac,
                if (current_layout != layoutno) {
                        owner->currentView()->getScreen()->HideCursor();
                        current_layout = layoutno;
-                       owner->currentBuffer()->update(-2);
-                       owner->currentBuffer()->text->
+                       owner->buffer()->update(-2);
+                       owner->buffer()->text->
                                SetLayout(layoutno);
                        owner->getToolbar()->combox->
-                               select(owner->currentBuffer()->
+                               select(owner->buffer()->
                                       text->cursor.par->
                                       GetLayout() + 1);
-                       owner->currentBuffer()->update(1);
+                       owner->buffer()->update(1);
                }
        }
        break;
@@ -1201,26 +1200,26 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_UPCASE_WORD:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                FreeUpdateTimer();
-               owner->currentBuffer()->text->ChangeWordCase(LyXText::text_uppercase);
-               owner->currentBuffer()->update(1);
+               owner->buffer()->text->ChangeWordCase(LyXText::text_uppercase);
+               owner->buffer()->update(1);
                SetUpdateTimer();
                break;
                
        case LFUN_LOWCASE_WORD:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                FreeUpdateTimer();
-               owner->currentBuffer()->text->ChangeWordCase(LyXText::text_lowercase);
-               owner->currentBuffer()->update(1);
+               owner->buffer()->text->ChangeWordCase(LyXText::text_lowercase);
+               owner->buffer()->update(1);
                SetUpdateTimer();
                break;
                
        case LFUN_CAPITALIZE_WORD:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                FreeUpdateTimer();
-               owner->currentBuffer()->text->ChangeWordCase(LyXText::text_capitalization);
-               owner->currentBuffer()->update(1);
+               owner->buffer()->text->ChangeWordCase(LyXText::text_capitalization);
+               owner->buffer()->update(1);
                SetUpdateTimer();
                break;
                
@@ -1266,7 +1265,7 @@ string LyXFunc::Dispatch(int ac,
                
                if (!label.empty()) {
                        owner->currentView()->savePosition();
-                       owner->currentBuffer()->gotoLabel(label.c_str());
+                       owner->buffer()->gotoLabel(label.c_str());
                }
        }
        break;
@@ -1283,8 +1282,8 @@ string LyXFunc::Dispatch(int ac,
                // --- Cursor Movements -----------------------------
        case LFUN_RIGHT:
        {
-               Buffer *tmpbuffer = owner->currentBuffer();
-               LyXText *tmptext = owner->currentBuffer()->text;
+               Buffer *tmpbuffer = owner->buffer();
+               LyXText *tmptext = owner->buffer()->text;
                if(!tmptext->mark_set)
                        BeforeChange();
                tmpbuffer->update(-2);
@@ -1299,7 +1298,7 @@ string LyXFunc::Dispatch(int ac,
                        break;
                }
                tmptext->CursorRight();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
        }
@@ -1309,9 +1308,9 @@ string LyXFunc::Dispatch(int ac,
        {
                // This is soooo ugly. Isn`t it possible to make
                // it simpler? (Lgb)
-               LyXText *txt= owner->currentBuffer()->text;
+               LyXText *txt= owner->buffer()->text;
                if(!txt->mark_set) BeforeChange();
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                txt->CursorLeft();
                if (txt->cursor.pos < txt->cursor.par->Last()
                    && txt->cursor.par->GetChar(txt->cursor.pos)
@@ -1325,137 +1324,137 @@ string LyXFunc::Dispatch(int ac,
                        //                      tmpinset->Edit(-1, 0);  // -1 means go rightmost
                        break;
                }
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
        }
        break;
                
        case LFUN_UP:
-               if(!owner->currentBuffer()->text->mark_set) BeforeChange();
-               owner->currentBuffer()->update(-3);
-               owner->currentBuffer()->text->CursorUp();
-               owner->currentBuffer()->text->FinishUndo();
+               if(!owner->buffer()->text->mark_set) BeforeChange();
+               owner->buffer()->update(-3);
+               owner->buffer()->text->CursorUp();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_DOWN:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-3);
-               owner->currentBuffer()->text->CursorDown();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-3);
+               owner->buffer()->text->CursorDown();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
 
        case LFUN_UP_PARAGRAPH:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-3);
-               owner->currentBuffer()->text->CursorUpParagraph();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-3);
+               owner->buffer()->text->CursorUpParagraph();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_DOWN_PARAGRAPH:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-3);
-               owner->currentBuffer()->text->CursorDownParagraph();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-3);
+               owner->buffer()->text->CursorDownParagraph();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_PRIOR:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-3);
+               owner->buffer()->update(-3);
                owner->currentView()->cursorPrevious();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_NEXT:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-3);
+               owner->buffer()->update(-3);
                owner->currentView()->cursorNext();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_HOME:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorHome();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorHome();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_END:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorEnd();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorEnd();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_TAB:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorTab();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorTab();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_WORDRIGHT:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorRightOneWord();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorRightOneWord();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_WORDLEFT:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorLeftOneWord();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorLeftOneWord();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_BEGINNINGBUF:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorTop();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorTop();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_ENDBUF:
-               if(!owner->currentBuffer()->text->mark_set)
+               if(!owner->buffer()->text->mark_set)
                        BeforeChange();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorBottom();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorBottom();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
@@ -1463,113 +1462,113 @@ string LyXFunc::Dispatch(int ac,
       
                /* cursor selection ---------------------------- */
        case LFUN_RIGHTSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorRight();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorRight();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_LEFTSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorLeft();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorLeft();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_UPSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorUp();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorUp();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_DOWNSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorDown();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorDown();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
 
        case LFUN_UP_PARAGRAPHSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorUpParagraph();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorUpParagraph();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_DOWN_PARAGRAPHSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorDownParagraph();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorDownParagraph();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_PRIORSEL:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                owner->currentView()->cursorPrevious();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_NEXTSEL:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                owner->currentView()->cursorNext();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_HOMESEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorHome();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorHome();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_ENDSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorEnd();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorEnd();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_WORDRIGHTSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorRightOneWord();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorRightOneWord();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_WORDLEFTSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorLeftOneWord();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorLeftOneWord();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_BEGINNINGBUFSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorTop();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorTop();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
                
        case LFUN_ENDBUFSEL:
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->CursorBottom();
-               owner->currentBuffer()->text->FinishUndo();
+               owner->buffer()->update(-2);
+               owner->buffer()->text->CursorBottom();
+               owner->buffer()->text->FinishUndo();
                moveCursorUpdate(true);
                owner->getMiniBuffer()->Set(CurrentState());
                break;
@@ -1577,7 +1576,7 @@ string LyXFunc::Dispatch(int ac,
                // --- text changing commands ------------------------
        case LFUN_BREAKLINE:
                BeforeChange();
-               owner->currentBuffer()->text->InsertChar(LYX_META_NEWLINE);
+               owner->buffer()->text->InsertChar(LYX_META_NEWLINE);
                SmallUpdate(1);
                SetUpdateTimer(0.01);
                moveCursorUpdate(false);
@@ -1585,7 +1584,7 @@ string LyXFunc::Dispatch(int ac,
                
        case LFUN_PROTECTEDSPACE:
                BeforeChange();
-               owner->currentBuffer()->text->
+               owner->buffer()->text->
                        InsertChar(LYX_META_PROTECTED_SEPARATOR);
                SmallUpdate(1);
                SetUpdateTimer();
@@ -1593,26 +1592,26 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_SETMARK:
-               if(owner->currentBuffer()->text->mark_set) {
+               if(owner->buffer()->text->mark_set) {
                        BeforeChange();
-                       owner->currentBuffer()->update(0);
+                       owner->buffer()->update(0);
                        setMessage(N_("Mark removed"));
                } else {
                        BeforeChange();
-                       owner->currentBuffer()->text->mark_set = 1;
-                       owner->currentBuffer()->update(0);
+                       owner->buffer()->text->mark_set = 1;
+                       owner->buffer()->update(0);
                        setMessage(N_("Mark set"));
                }
-               owner->currentBuffer()->text->sel_cursor =
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->text->sel_cursor =
+                       owner->buffer()->text->cursor;
                break;
                
        case LFUN_DELETE:
                FreeUpdateTimer();
-               if (!owner->currentBuffer()->text->selection) {
-                       owner->currentBuffer()->text->Delete();
-                       owner->currentBuffer()->text->sel_cursor =
-                               owner->currentBuffer()->text->cursor;
+               if (!owner->buffer()->text->selection) {
+                       owner->buffer()->text->Delete();
+                       owner->buffer()->text->sel_cursor =
+                               owner->buffer()->text->cursor;
                        SmallUpdate(1);
                        // It is possible to make it a lot faster still
                        // just comment out the lone below...
@@ -1627,17 +1626,17 @@ string LyXFunc::Dispatch(int ac,
        {
                // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
                
-               LyXCursor cursor = owner->currentBuffer()->text->cursor;
+               LyXCursor cursor = owner->buffer()->text->cursor;
 
                FreeUpdateTimer();
-               if (!owner->currentBuffer()->text->selection) {
+               if (!owner->buffer()->text->selection) {
                        if (cursor.pos == cursor.par->Last()) {
-                               owner->currentBuffer()->text->CursorRight();
-                               cursor = owner->currentBuffer()->text->cursor;
+                               owner->buffer()->text->CursorRight();
+                               cursor = owner->buffer()->text->cursor;
                                if (cursor.pos == 0
                                    && !(cursor.par->added_space_top 
                                         == VSpace (VSpace::NONE))) {
-                                       owner->currentBuffer()->text->SetParagraph
+                                       owner->buffer()->text->SetParagraph
                                                (cursor.par->line_top,
                                                 cursor.par->line_bottom,
                                                 cursor.par->pagebreak_top, 
@@ -1646,19 +1645,19 @@ string LyXFunc::Dispatch(int ac,
                                                 cursor.par->added_space_bottom,
                                                 cursor.par->align, 
                                                 cursor.par->labelwidthstring, 0);
-                                       owner->currentBuffer()->text->CursorLeft();
-                                       owner->currentBuffer()->update (1);
+                                       owner->buffer()->text->CursorLeft();
+                                       owner->buffer()->update (1);
                                } else {
-                                       owner->currentBuffer()->text->CursorLeft();
-                                       owner->currentBuffer()->text->Delete();
-                                       owner->currentBuffer()->text->sel_cursor =
-                                               owner->currentBuffer()->text->cursor;
+                                       owner->buffer()->text->CursorLeft();
+                                       owner->buffer()->text->Delete();
+                                       owner->buffer()->text->sel_cursor =
+                                               owner->buffer()->text->cursor;
                                        SmallUpdate(1);
                                }
                        } else {
-                               owner->currentBuffer()->text->Delete();
-                               owner->currentBuffer()->text->sel_cursor =
-                                       owner->currentBuffer()->text->cursor;
+                               owner->buffer()->text->Delete();
+                               owner->buffer()->text->sel_cursor =
+                                       owner->buffer()->text->cursor;
                                SmallUpdate(1);
                        }
                } else {
@@ -1670,20 +1669,20 @@ string LyXFunc::Dispatch(int ac,
 
        /* -------> Delete word forward. */
        case LFUN_DELETE_WORD_FORWARD:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                FreeUpdateTimer();
-               owner->currentBuffer()->text->DeleteWordForward();
-               owner->currentBuffer()->update( 1 );
+               owner->buffer()->text->DeleteWordForward();
+               owner->buffer()->update( 1 );
                SetUpdateTimer();
                moveCursorUpdate(false);
                break;
 
                /* -------> Delete word backward. */
        case LFUN_DELETE_WORD_BACKWARD:
-               owner->currentBuffer()->update(-2);
+               owner->buffer()->update(-2);
                FreeUpdateTimer();
-               owner->currentBuffer()->text->DeleteWordBackward();
-               owner->currentBuffer()->update( 1 );
+               owner->buffer()->text->DeleteWordBackward();
+               owner->buffer()->update( 1 );
                SetUpdateTimer();
                moveCursorUpdate(false);
                break;
@@ -1691,9 +1690,9 @@ string LyXFunc::Dispatch(int ac,
                /* -------> Kill to end of line. */
        case LFUN_DELETE_LINE_FORWARD:
                FreeUpdateTimer();
-               owner->currentBuffer()->update(-2);
-               owner->currentBuffer()->text->DeleteLineForward();
-               owner->currentBuffer()->update( 1 );
+               owner->buffer()->update(-2);
+               owner->buffer()->text->DeleteLineForward();
+               owner->buffer()->update( 1 );
                SetUpdateTimer();
                moveCursorUpdate(false);
                break;
@@ -1701,30 +1700,30 @@ string LyXFunc::Dispatch(int ac,
                /* -------> Set mark off. */
        case LFUN_MARK_OFF:
                BeforeChange();
-               owner->currentBuffer()->update(0);
-               owner->currentBuffer()->text->sel_cursor =
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->update(0);
+               owner->buffer()->text->sel_cursor =
+                       owner->buffer()->text->cursor;
                setMessage(N_("Mark off"));
                break;
 
                /* -------> Set mark on. */
        case LFUN_MARK_ON:
                BeforeChange();
-               owner->currentBuffer()->text->mark_set = 1;
-               owner->currentBuffer()->update( 0 );
-               owner->currentBuffer()->text->sel_cursor =
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->text->mark_set = 1;
+               owner->buffer()->update( 0 );
+               owner->buffer()->text->sel_cursor =
+                       owner->buffer()->text->cursor;
                setMessage(N_("Mark on"));
                break;
                
        case LFUN_BACKSPACE:
        {
                FreeUpdateTimer();
-               if (!owner->currentBuffer()->text->selection) {
+               if (!owner->buffer()->text->selection) {
                        if (owner->getIntl()->getTrans()->backspace()) {
-                               owner->currentBuffer()->text->Backspace();
-                               owner->currentBuffer()->text->sel_cursor =
-                                       owner->currentBuffer()->text->cursor;
+                               owner->buffer()->text->Backspace();
+                               owner->buffer()->text->sel_cursor =
+                                       owner->buffer()->text->cursor;
                                SmallUpdate(1);
                                // It is possible to make it a lot faster still
                                // just comment out the lone below...
@@ -1741,14 +1740,14 @@ string LyXFunc::Dispatch(int ac,
        {
                // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
                
-               LyXCursor cursor = owner->currentBuffer()->text->cursor;
+               LyXCursor cursor = owner->buffer()->text->cursor;
                
                FreeUpdateTimer();
-               if (!owner->currentBuffer()->text->selection) {
+               if (!owner->buffer()->text->selection) {
                        if (cursor.pos == 0 
                            && !(cursor.par->added_space_top 
                                 == VSpace (VSpace::NONE))) {
-                               owner->currentBuffer()->text->SetParagraph 
+                               owner->buffer()->text->SetParagraph 
                                        (cursor.par->line_top,      
                                         cursor.par->line_bottom,
                                         cursor.par->pagebreak_top, 
@@ -1756,10 +1755,10 @@ string LyXFunc::Dispatch(int ac,
                                         VSpace(VSpace::NONE), cursor.par->added_space_bottom,
                                         cursor.par->align, 
                                         cursor.par->labelwidthstring, 0);
-                               owner->currentBuffer()->update (1);
+                               owner->buffer()->update (1);
                        } else {
-                               owner->currentBuffer()->text->Backspace();
-                               owner->currentBuffer()->text->sel_cursor 
+                               owner->buffer()->text->Backspace();
+                               owner->buffer()->text->sel_cursor 
                                        = cursor;
                                SmallUpdate (1);
                        }
@@ -1772,22 +1771,22 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_BREAKPARAGRAPH:
        {
                BeforeChange();
-               owner->currentBuffer()->text->BreakParagraph(0);
+               owner->buffer()->text->BreakParagraph(0);
                SmallUpdate(1);
                SetUpdateTimer(0.01);
-               owner->currentBuffer()->text->sel_cursor =
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->text->sel_cursor =
+                       owner->buffer()->text->cursor;
                break;
        }
 
        case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
        {
                BeforeChange();
-               owner->currentBuffer()->text->BreakParagraph(1);
+               owner->buffer()->text->BreakParagraph(1);
                SmallUpdate(1);
                SetUpdateTimer(0.01);
-               owner->currentBuffer()->text->sel_cursor =
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->text->sel_cursor =
+                       owner->buffer()->text->cursor;
                break;
        }
        
@@ -1797,12 +1796,12 @@ string LyXFunc::Dispatch(int ac,
                // indentation and add a "defskip" at the top.
                // Otherwise, do the same as LFUN_BREAKPARAGRAPH.
                
-               LyXCursor cursor = owner->currentBuffer()->text->cursor;
+               LyXCursor cursor = owner->buffer()->text->cursor;
                
                BeforeChange();
                if (cursor.pos == 0) {
                        if (cursor.par->added_space_top == VSpace(VSpace::NONE)) {
-                               owner->currentBuffer()->text->SetParagraph
+                               owner->buffer()->text->SetParagraph
                                        (cursor.par->line_top,      
                                         cursor.par->line_bottom,
                                         cursor.par->pagebreak_top, 
@@ -1810,21 +1809,21 @@ string LyXFunc::Dispatch(int ac,
                                         VSpace(VSpace::DEFSKIP), cursor.par->added_space_bottom,
                                         cursor.par->align, 
                                         cursor.par->labelwidthstring, 1);
-                               owner->currentBuffer()->update(1);
+                               owner->buffer()->update(1);
                        } 
                }
                else {
-                       owner->currentBuffer()->text->BreakParagraph(0);
+                       owner->buffer()->text->BreakParagraph(0);
                        SmallUpdate(1);
                }
                SetUpdateTimer(0.01);
-               owner->currentBuffer()->text->sel_cursor = cursor;
+               owner->buffer()->text->sel_cursor = cursor;
        }
        break;
        
        case LFUN_QUOTE:
                BeforeChange();
-               owner->currentBuffer()->text->InsertChar('\"');  // This " matches the single quote in the code
+               owner->buffer()->text->InsertChar('\"');  // This " matches the single quote in the code
                SmallUpdate(1);
                SetUpdateTimer();
                 moveCursorUpdate(false);
@@ -1838,7 +1837,7 @@ string LyXFunc::Dispatch(int ac,
                        new_inset = new InsetUrl("htmlurl", "", "");
                else
                        new_inset = new InsetUrl("url", "", "");
-               owner->currentBuffer()->insertInset(new_inset);
+               owner->buffer()->insertInset(new_inset);
                new_inset->Edit(0, 0);
        }
        break;
@@ -1849,13 +1848,13 @@ string LyXFunc::Dispatch(int ac,
        {
 #ifdef NEW_TEXT
                LyXParagraph::size_type pos =
-                 owner->currentBuffer()->text->cursor.pos;
-               if(pos < owner->currentBuffer()->text->cursor.par->size())
+                 owner->buffer()->text->cursor.pos;
+               if(pos < owner->buffer()->text->cursor.par->size())
 #else
-               int pos = owner->currentBuffer()->text->cursor.pos;
-               if(pos < owner->currentBuffer()->text->cursor.par->last)
+               int pos = owner->buffer()->text->cursor.pos;
+               if(pos < owner->buffer()->text->cursor.par->last)
 #endif
-                       dispatch_buffer = owner->currentBuffer()->text->
+                       dispatch_buffer = owner->buffer()->text->
                                cursor.par->text[pos];
                else
                        dispatch_buffer = "EOF";
@@ -1864,8 +1863,8 @@ string LyXFunc::Dispatch(int ac,
        
        case LFUN_GETXY:
                dispatch_buffer = 
-                        tostr(owner->currentBuffer()->text->cursor.x) + ' '
-                       + tostr(owner->currentBuffer()->text->cursor.y);
+                        tostr(owner->buffer()->text->cursor.x) + ' '
+                       + tostr(owner->buffer()->text->cursor.y);
                break;
                
        case LFUN_SETXY:
@@ -1873,18 +1872,18 @@ string LyXFunc::Dispatch(int ac,
                int  x;
                long y;
                sscanf(argument.c_str(), " %d %ld", &x, &y);
-               owner->currentBuffer()->text->SetCursorFromCoordinates(x, y);
+               owner->buffer()->text->SetCursorFromCoordinates(x, y);
        }
        break;
        
        case LFUN_GETLAYOUT:
                dispatch_buffer =  
-                       tostr(owner->currentBuffer()->text->cursor.par->layout);
+                       tostr(owner->buffer()->text->cursor.par->layout);
                break;
                        
        case LFUN_GETFONT:
        {
-               LyXFont *font = &(owner->currentBuffer()->text->current_font);
+               LyXFont *font = &(owner->buffer()->text->current_font);
                 if(font->shape() == LyXFont::ITALIC_SHAPE)
                        dispatch_buffer = 'E';
                 else if(font->shape() == LyXFont::SMALLCAPS_SHAPE)
@@ -1897,7 +1896,7 @@ string LyXFunc::Dispatch(int ac,
 
        case LFUN_GETLATEX:
        {
-               LyXFont *font = &(owner->currentBuffer()->text->current_font);
+               LyXFont *font = &(owner->buffer()->text->current_font);
                 if(font->latex() == LyXFont::ON)
                        dispatch_buffer = 'L';
                 else
@@ -1906,9 +1905,9 @@ string LyXFunc::Dispatch(int ac,
        break;
 
        case LFUN_GETNAME:
-               setMessage(owner->currentBuffer()->getFileName());
+               setMessage(owner->buffer()->getFileName());
                lyxerr.debug() << "FNAME["
-                              << owner->currentBuffer()->getFileName()
+                              << owner->buffer()->getFileName()
                               << "] " << endl;
                break;
                
@@ -1932,25 +1931,25 @@ string LyXFunc::Dispatch(int ac,
 
                // Either change buffer or load the file
                if (bufferlist.exists(s))
-                       owner->currentView()->setBuffer(bufferlist.getBuffer(s));
+                       owner->currentView()->buffer(bufferlist.getBuffer(s));
                else
-                       owner->currentView()->setBuffer(bufferlist.loadLyXFile(s));
+                       owner->currentView()->buffer(bufferlist.loadLyXFile(s));
 
                // Set the cursor  
-               owner->currentBuffer()->setCursorFromRow(row);
+               owner->buffer()->setCursorFromRow(row);
 
                // Recenter screen
                BeforeChange();
-               if (owner->currentBuffer()->text->cursor.y >
+               if (owner->buffer()->text->cursor.y >
                    owner->currentView()->getWorkArea()->h / 2) {
                        owner->currentView()->getScreen()->
-                               Draw(owner->currentBuffer()->text->cursor.y -
+                               Draw(owner->buffer()->text->cursor.y -
                                     owner->currentView()->getWorkArea()->h/2);
                } else { // <=
                        owner->currentView()->getScreen()->
                                Draw(0);
                }
-               owner->currentBuffer()->update(0);
+               owner->buffer()->update(0);
                owner->currentView()->redraw();
        }
        break;
@@ -1992,7 +1991,7 @@ string LyXFunc::Dispatch(int ac,
                
                owner->getIntl()->getTrans()->
                        deadkey(c, get_accent(action).accent, 
-                               owner->currentBuffer()->text);
+                               owner->buffer()->text);
                
                // Need to reset, in case the minibuffer calls these
                // actions
@@ -2002,8 +2001,8 @@ string LyXFunc::Dispatch(int ac,
                // copied verbatim from do_accent_char
                SmallUpdate(1);
                SetUpdateTimer();
-               owner->currentBuffer()->text->sel_cursor = 
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->text->sel_cursor = 
+                       owner->buffer()->text->cursor;
        }   
        break;
        
@@ -2051,7 +2050,7 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_INSERT_INSET_LATEX:
        {
                Inset *new_inset = new InsetLatex(argument);
-               owner->currentBuffer()->insertInset(new_inset);
+               owner->buffer()->insertInset(new_inset);
        }
        break;
 
@@ -2084,9 +2083,9 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_INSERT_MATRIX:
        {          
                if (owner->currentView()->available()) { 
-                       owner->currentBuffer()->
+                       owner->buffer()->
                                open_new_inset(new InsetFormula(false));
-                       owner->currentBuffer()->
+                       owner->buffer()->
                                the_locking_inset->LocalDispatch(action, argument.c_str());
                }
        }          
@@ -2101,7 +2100,7 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_MATH_DISPLAY:
        {
                if (owner->currentView()->available())
-                       owner->currentBuffer()->open_new_inset(new InsetFormula(true));
+                       owner->buffer()->open_new_inset(new InsetFormula(true));
                break;
        }
                    
@@ -2114,7 +2113,7 @@ string LyXFunc::Dispatch(int ac,
                        else {
                            string s1 = token(s, ' ', 1);
                            int na = s1.empty() ? 0: atoi(s1.c_str());
-                           owner->currentBuffer()->
+                           owner->buffer()->
                              open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
                        }
                }
@@ -2125,7 +2124,7 @@ string LyXFunc::Dispatch(int ac,
        {
                
                if (owner->currentView()->available())
-                       owner->currentBuffer()->open_new_inset(new InsetFormula);
+                       owner->buffer()->open_new_inset(new InsetFormula);
                setMessage(N_("Math editor mode"));
        }
        break;
@@ -2150,9 +2149,9 @@ string LyXFunc::Dispatch(int ac,
                                new_inset->setOptions(token(lsarg, '|', 1));
                        } else
                                new_inset->setContents(lsarg);
-                       owner->currentBuffer()->insertInset(new_inset);
+                       owner->buffer()->insertInset(new_inset);
                } else {
-                       owner->currentBuffer()->insertInset(new_inset);
+                       owner->buffer()->insertInset(new_inset);
                        new_inset->Edit(0,0);
                }
        }
@@ -2170,9 +2169,9 @@ string LyXFunc::Dispatch(int ac,
                InsetBibtex *new_inset 
                        = new InsetBibtex(token(lsarg, ' ', 0),
                                          bibstyle,
-                                         owner->currentBuffer());
+                                         owner->buffer());
                
-               owner->currentBuffer()->insertInset(new_inset);
+               owner->buffer()->insertInset(new_inset);
                if (lsarg.empty()) {
                        new_inset->Edit(0,0);
                }
@@ -2217,7 +2216,7 @@ string LyXFunc::Dispatch(int ac,
                if (!argument.empty()) {
                        string lsarg(argument);
                        new_inset->setContents(lsarg);
-                       owner->currentBuffer()->insertInset(new_inset);
+                       owner->buffer()->insertInset(new_inset);
                } else {
                  //reh 98/09/21
                  //get the current word for an argument
@@ -2227,11 +2226,11 @@ string LyXFunc::Dispatch(int ac,
 
 #ifdef NEW_TEXT
                  LyXParagraph::size_type lastpos =
-                         owner->currentBuffer()->text->cursor.pos - 1;
+                         owner->buffer()->text->cursor.pos - 1;
                  // If this can't happen, let's make sure that it really don't
-                 Assert(owner->currentBuffer()->text->cursor.pos - 1 >= 0);
+                 Assert(owner->buffer()->text->cursor.pos - 1 >= 0);
 #else
-                 int lastpos =owner->currentBuffer()->text->cursor.pos - 1;
+                 int lastpos =owner->buffer()->text->cursor.pos - 1;
                  //this shouldn't happen, but let's be careful
                  if (lastpos < 0) lastpos=0;
 #endif
@@ -2239,7 +2238,7 @@ string LyXFunc::Dispatch(int ac,
                  // note that this must be done before 
                  // inserting the inset, or the inset will break
                  // the word
-                 string curstring(owner->currentBuffer()
+                 string curstring(owner->buffer()
                                   ->text->cursor.par->GetWord(lastpos));
 
                  //make the new inset and write the current word into it
@@ -2256,36 +2255,36 @@ string LyXFunc::Dispatch(int ac,
 
                      // move the cursor to the returned value of lastpos
                      // but only for the auto-insert
-                     owner->currentBuffer()->text->cursor.pos=lastpos;
+                     owner->buffer()->text->cursor.pos=lastpos;
                  }
 
                  //put the new inset into the buffer.
                  // there should be some way of knowing the user
                  //cancelled & avoiding this, but i don't know how
-                 owner->currentBuffer()->insertInset(new_inset);
+                 owner->buffer()->insertInset(new_inset);
                }
        }
        break;
 
        case LFUN_INDEX_PRINT:
        {
-               Inset *new_inset = new InsetPrintIndex(owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset, "Standard", true);
+               Inset *new_inset = new InsetPrintIndex(owner->buffer());
+               owner->buffer()->insertInset(new_inset, "Standard", true);
        }
        break;
 
        case LFUN_PARENTINSERT:
        {
                lyxerr << "arg " << argument << endl;
-               Inset *new_inset = new InsetParent(argument, owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset, "Standard", true);
+               Inset *new_inset = new InsetParent(argument, owner->buffer());
+               owner->buffer()->insertInset(new_inset, "Standard", true);
        }
        break;
 
        case LFUN_CHILDINSERT:
        {
-               Inset *new_inset = new InsetInclude(argument,owner->currentBuffer());
-               owner->currentBuffer()->insertInset(new_inset, "Standard", true);
+               Inset *new_inset = new InsetInclude(argument,owner->buffer());
+               owner->buffer()->insertInset(new_inset, "Standard", true);
                new_inset->Edit(0,0);
        }
        break;
@@ -2293,14 +2292,14 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_CHILDOPEN:
        {
                string filename = MakeAbsPath(argument, 
-                                              OnlyPath(owner->currentBuffer()->getFileName()));
+                                              OnlyPath(owner->buffer()->getFileName()));
                setMessage(N_("Opening child document ") +
                           MakeDisplayPath(filename) + "...");
                owner->currentView()->savePosition();
                if (bufferlist.exists(filename))
-                 owner->currentView()->setBuffer(bufferlist.getBuffer(filename));
+                 owner->currentView()->buffer(bufferlist.getBuffer(filename));
                else
-                 owner->currentView()->setBuffer(bufferlist.loadLyXFile(filename));
+                 owner->currentView()->buffer(bufferlist.loadLyXFile(filename));
        }
        break;
 
@@ -2329,8 +2328,8 @@ string LyXFunc::Dispatch(int ac,
                        setErrorMessage(N_("Unknown kind of footnote"));
                        break;
                }
-               owner->currentBuffer()->text->InsertFootnoteEnvironment(kind);
-               owner->currentBuffer()->update(1);
+               owner->buffer()->text->InsertFootnoteEnvironment(kind);
+               owner->buffer()->update(1);
        }
        break;
        
@@ -2361,21 +2360,21 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_SELFINSERT:
        {
                for (string::size_type i = 0; i < argument.length(); ++i) {
-                       owner->currentBuffer()->text->InsertChar(argument[i]);
+                       owner->buffer()->text->InsertChar(argument[i]);
                        // This needs to be in the loop, or else we
                        // won't break lines correctly. (Asger)
                        SmallUpdate(1);
                }
                SetUpdateTimer();
-               owner->currentBuffer()->text->sel_cursor =
-                       owner->currentBuffer()->text->cursor;
+               owner->buffer()->text->sel_cursor =
+                       owner->buffer()->text->cursor;
                moveCursorUpdate(false);
        }
        break;
 
        case LFUN_UNKNOWN_ACTION:
        {
-               if (owner->currentBuffer()->isReadonly()) {
+               if (owner->buffer()->isReadonly()) {
                        LyXBell();
                        setErrorMessage(N_("Document is read only"));
                        break;
@@ -2390,9 +2389,9 @@ string LyXFunc::Dispatch(int ac,
                         * true (on). */
                
                        if ( lyxrc->auto_region_delete ) {
-                               if (owner->currentBuffer()->text->selection){
-                                       owner->currentBuffer()->text->CutSelection(false);
-                                       owner->currentBuffer()->update(-1);
+                               if (owner->buffer()->text->selection){
+                                       owner->buffer()->text->CutSelection(false);
+                                       owner->buffer()->update(-1);
                                }
                        }
                        
@@ -2400,16 +2399,16 @@ string LyXFunc::Dispatch(int ac,
                        for (string::size_type i = 0; i < argument.length(); ++i) {
                                if (greek_kb_flag) {
                                        if (!math_insert_greek(argument[i]))
-                                               owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->currentBuffer()->text);
+                                               owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text);
                                } else
-                                       owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->currentBuffer()->text);
+                                       owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text);
                        }
                        
                        SmallUpdate(1);
                        SetUpdateTimer();
 
-                       owner->currentBuffer()->text->sel_cursor =
-                               owner->currentBuffer()->text->cursor;
+                       owner->buffer()->text->sel_cursor =
+                               owner->buffer()->text->cursor;
                        moveCursorUpdate(false);
                        return string();
                } else {
@@ -2460,7 +2459,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
        LyXFileDlg fileDlg;
 
        if (owner->currentView()->available()) {
-               string trypath = owner->currentBuffer()->filepath;
+               string trypath = owner->buffer()->filepath;
                // If directory is writeable, use this as default.
                if (IsDirWriteable(trypath) == 1)
                        initpath = trypath;
@@ -2498,7 +2497,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
                                return;
                        break;
                case 2: // No: switch to the open document
-                       owner->currentView()->setBuffer(bufferlist.getBuffer(s));
+                       owner->currentView()->buffer(bufferlist.getBuffer(s));
                        return;
                case 3: // Cancel: Do nothing
                        owner->getMiniBuffer()->Set(_("Canceled."));
@@ -2517,7 +2516,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
                        owner->getMiniBuffer()->Set(_("Opening document"), 
                                                    MakeDisplayPath(s), "...");
                        XFlush(fl_display);
-                       owner->currentView()->setBuffer(
+                       owner->currentView()->buffer(
                                bufferlist.loadLyXFile(s));
                        owner->getMiniBuffer()->Set(_("Document"),
                                                    MakeDisplayPath(s),
@@ -2539,7 +2538,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
   
        // find a free buffer
        lyxerr.debug() << "Find a free buffer." << endl;
-       owner->currentView()->setBuffer(bufferlist.newFile(s,templname));
+       owner->currentView()->buffer(bufferlist.newFile(s,templname));
 }
 
 
@@ -2549,7 +2548,7 @@ void LyXFunc::MenuOpen()
        LyXFileDlg fileDlg;
   
        if (owner->currentView()->available()) {
-               string trypath = owner->currentBuffer()->filepath;
+               string trypath = owner->buffer()->filepath;
                // If directory is writeable, use this as default.
                if (IsDirWriteable(trypath) == 1)
                        initpath = trypath;
@@ -2581,7 +2580,7 @@ void LyXFunc::MenuOpen()
                                    MakeDisplayPath(filename), "...");
        Buffer * openbuf = bufferlist.loadLyXFile(filename);
        if (openbuf) {
-               owner->currentView()->setBuffer(openbuf);
+               owner->currentView()->buffer(openbuf);
                owner->getMiniBuffer()->Set(_("Document"),
                                            MakeDisplayPath(filename),
                                            _("opened."));
@@ -2598,7 +2597,7 @@ void LyXFunc::doImportASCII(bool linorpar)
        LyXFileDlg fileDlg;
   
        if (owner->currentView()->available()) {
-               string trypath = owner->currentBuffer()->filepath;
+               string trypath = owner->buffer()->filepath;
                // If directory is writeable, use this as default.
                if (IsDirWriteable(trypath) == 1)
                        initpath = trypath;
@@ -2637,7 +2636,7 @@ void LyXFunc::doImportASCII(bool linorpar)
                                return;
                        break;
                case 2: // No: switch to the open document
-                       owner->currentView()->setBuffer(bufferlist.getBuffer(s));
+                       owner->currentView()->buffer(bufferlist.getBuffer(s));
                        return;
                case 3: // Cancel: Do nothing
                        owner->getMiniBuffer()->Set(_("Canceled."));
@@ -2654,7 +2653,7 @@ void LyXFunc::doImportASCII(bool linorpar)
                return;
        }
 
-       owner->currentView()->setBuffer(bufferlist.newFile(s,string()));
+       owner->currentView()->buffer(bufferlist.newFile(s,string()));
        owner->getMiniBuffer()->Set(_("Importing ASCII file"),
                                    MakeDisplayPath(filename), "...");
        // Insert ASCII file
@@ -2671,7 +2670,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
        LyXFileDlg fileDlg;
   
        if (owner->currentView()->available()) {
-               string trypath = owner->currentBuffer()->filepath;
+               string trypath = owner->buffer()->filepath;
                // If directory is writeable, use this as default.
                if (IsDirWriteable(trypath) == 1)
                        initpath = trypath;
@@ -2716,7 +2715,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
                                return;
                        break;
                case 2: // No: switch to the open document
-                       owner->currentView()->setBuffer(
+                       owner->currentView()->buffer(
                                bufferlist.getBuffer(LyXfilename));
                        return;
                case 3: // Cancel: Do nothing
@@ -2748,7 +2747,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
                openbuf = myImport.run();
        }
        if (openbuf) {
-               owner->currentView()->setBuffer(openbuf);
+               owner->currentView()->buffer(openbuf);
                owner->getMiniBuffer()->Set(isnoweb ?
                                            _("Noweb file ") : _("LateX file "),
                                            MakeDisplayPath(filename),
@@ -2772,7 +2771,7 @@ void LyXFunc::MenuInsertLyXFile(string const & filen)
                LyXFileDlg fileDlg;
 
                if (owner->currentView()->available()) {
-                       string trypath = owner->currentBuffer()->filepath;
+                       string trypath = owner->buffer()->filepath;
                        // If directory is writeable, use this as default.
                        if (IsDirWriteable(trypath) == 1)
                                initpath = trypath;
@@ -2803,7 +2802,7 @@ void LyXFunc::MenuInsertLyXFile(string const & filen)
        // Inserts document
        owner->getMiniBuffer()->Set(_("Inserting document"),
                                    MakeDisplayPath(filename), "...");
-       bool res = owner->currentBuffer()->insertLyXFile(filename);
+       bool res = owner->buffer()->insertLyXFile(filename);
        if (res) {
                owner->getMiniBuffer()->Set(_("Document"),
                                            MakeDisplayPath(filename),
@@ -2817,15 +2816,15 @@ void LyXFunc::MenuInsertLyXFile(string const & filen)
 
 void LyXFunc::reloadBuffer()
 {
-       string fn = owner->currentBuffer()->getFileName();
-       if (bufferlist.close(owner->currentBuffer()))
-               owner->currentView()->setBuffer(bufferlist.loadLyXFile(fn));
+       string fn = owner->buffer()->getFileName();
+       if (bufferlist.close(owner->buffer()))
+               owner->currentView()->buffer(bufferlist.loadLyXFile(fn));
 }
 
 
 void LyXFunc::CloseBuffer()
 {
-       if (bufferlist.close(owner->currentBuffer()) && !quitting) {
+       if (bufferlist.close(owner->buffer()) && !quitting) {
                if (bufferlist.empty()) {
                        // need this otherwise SEGV may occur while trying to
                        // set variables that don't exist
@@ -2833,7 +2832,7 @@ void LyXFunc::CloseBuffer()
                        CloseAllBufferRelatedPopups();
                }
                else {
-                       owner->currentView()->setBuffer(bufferlist.first());
+                       owner->currentView()->buffer(bufferlist.first());
                }
        }
 }
@@ -2843,7 +2842,7 @@ Inset * LyXFunc::getInsetByCode(Inset::Code code)
 {
        bool found = false;
        Inset * inset = 0;
-       LyXCursor cursor = owner->currentBuffer()->text->cursor;
+       LyXCursor cursor = owner->buffer()->text->cursor;
 #ifdef NEW_TEXT
        LyXParagraph::size_type pos = cursor.pos;
 #else
index 38c6368344e6c1735f374cbc67594ccd80ac194b..99565a84560f2d759ef89ea26315c6436480c5a9 100644 (file)
@@ -35,12 +35,12 @@ void InitLyXLookup(Display* display, Window window)
        // This part could be done before opening display
        setlocale(LC_CTYPE,"");
                if (!XSupportsLocale()) {
-               lyxerr.debug("InitLyXLookup: X does not support this locale.");
+               lyxerr.debug() << "InitLyXLookup: X does not support this locale." << endl;
                return;
        } 
        if (!XSetLocaleModifiers("")) {
-               lyxerr.debug("InitLyXLookup: Could not set modifiers "
-                            "for this locale.");
+               lyxerr.debug() << "InitLyXLookup: Could not set modifiers "
+                       "for this locale." << endl;
                return;
        }
 
@@ -54,15 +54,15 @@ void InitLyXLookup(Display* display, Window window)
                            0);
                
                if (!xic) {
-                       lyxerr.debug("InitLyXLookup: could not create "
-                                    "an input context");
+                       lyxerr.debug() << "InitLyXLookup: could not create "
+                               "an input context" << endl;
                        XCloseIM (xim);
                        xim = 0;
                } 
        }
        else 
-               lyxerr.debug("InitLyXLookup: could not open "
-                            "an input method.");
+               lyxerr.debug() << "InitLyXLookup: could not open "
+                       "an input method." << endl;
 
 }
 
@@ -152,8 +152,8 @@ int LyXLookupString(XEvent *event,
                         return 0;
                }
                if (event->type != KeyPress)
-                       lyxerr <<"LyXLookupString: wrong event type" 
-                                     +string(event->type));
+                       lyxerr << "LyXLookupString: wrong event type" 
+                              <<  event->type << endl;
                Status status_return;
                
                result =  XmbLookupString(xic, &event->xkey, buffer_return,
@@ -189,7 +189,8 @@ int LyXLookupString(XEvent *event,
 void CloseLyXLookup() 
 {
        if (xic) {
-               lyxerr.debug("CloseLyXLookup: destroying input context");
+               lyxerr.debug() << "CloseLyXLookup: destroying input context"
+                              << endl;
                XDestroyIC(xic);
                XCloseIM(xim);
        }
index 2940da6ab39a9da898db94b73b81d59a9d7385a6..9ef4c774bb84f69427db0001046f413f01ffa855 100644 (file)
@@ -4,29 +4,25 @@
 #pragma implementation
 #endif
 
+#include <unistd.h>
+
 #include FORMS_H_LOCATION
 #include "lyxvc.h"
+#include "vc-backend.h"
 #include "debug.h"
 #include "lyx_gui_misc.h"
-#include "bufferlist.h"
-#include "support/syscall.h"
-#include "support/path.h"
-#include "support/filetools.h"
-#include "support/FileInfo.h"
+#include "buffer.h"
 #include "gettext.h"
-#include "LyXView.h"
+#include "support/filetools.h"
 #include "lyxfunc.h"
-#include "latexoptions.h"
-
-extern BufferList bufferlist;
-extern void MenuWrite(Buffer *);
+#include "LyXView.h"
 
 
 LyXVC::LyXVC()
 {
-       backend = UNKNOWN_VCS;
-       _owner = 0;
+       vcs = 0;
        browser = 0;
+       owner_ = 0;
 }
 
 
@@ -37,39 +33,27 @@ LyXVC::~LyXVC()
                        fl_hide_form(browser->LaTeXLog);
                fl_free_form(browser->LaTeXLog);
        }
+       if (vcs) {
+               delete vcs;
+       }
 }
 
 
 bool LyXVC::file_found_hook(string const & fn)
 {
-       string tmp(fn);
-       FileInfo f;
-       // Check if *,v exists.
-       tmp += ",v";
-       lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
-                            << tmp << endl;
-       if (f.newFile(tmp).readable()) {
-               lyxerr[Debug::LYXVC] << "Yes it is under vc." << endl;
-               master = tmp;
-               backend = RCS_VCS;
-               scanMaster();
+       string found_file;
+       // Check if file is under RCS
+       if (!(found_file = RCS::find_file(fn)).empty()) {
+               vcs = new RCS(found_file);
+               vcs->owner(owner_);
+               return true;
+       }
+       // Check if file is under CVS
+       if (!(found_file = CVS::find_file(fn)).empty()) {
+               vcs = new CVS(found_file, fn);
+               vcs->owner(owner_);
                return true;
-       } else {
-               // Check if RCS/*,v exists.
-               tmp = AddName(AddPath(OnlyPath(fn), "RCS"), fn);
-               tmp += ",v";
-               lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
-                                    << tmp << endl;
-               if (f.newFile(tmp).readable()) {
-                       lyxerr[Debug::LYXVC] << "Yes it is under vc."<< endl;
-                       master = tmp;
-                       backend = RCS_VCS;
-                       scanMaster();
-                       return true;
-               }
        }
-       // If either one, return true
-
        // file is not under any VCS.
        return false;
 }
@@ -82,98 +66,34 @@ bool LyXVC::file_not_found_hook(string const &)
 }
 
 
-void LyXVC::scanMaster()
-{
-       lyxerr[Debug::LYXVC] << "LyXVC: This file is a VC file." << endl;
-
-       LyXLex lex(0, 0);
-       lex.setFile(master);
-
-       string token;
-       bool read_enough = false;
-       while (lex.IsOK() && !read_enough) {
-               lex.next();
-               token = lex.GetString();
-               
-               lyxerr[Debug::LYXVC] <<"LyXVC::scanMaster: current lex text: `"
-                                    << token << "'" << endl;
-
-               if (token.empty())
-                       continue;
-               else if (token == "head") {
-                       // get version here
-                       lex.next();
-                       string tmv = strip(lex.GetString(), ';');
-                       version = tmv;
-               } else if (contains(token, "access")
-                          || contains(token, "symbols")
-                          || contains(token, "strict")) {
-                       // nothing
-               } else if (contains(token, "locks")) {
-                       // get locker here
-                       if (contains(token, ";")) {
-                               locker = "Unlocked";
-                               vcstat = UNLOCKED;
-                               continue;
-                       }
-                       string tmpt, s1, s2;
-                       do {
-                               lex.next();
-                               s1 = strip(tmpt = lex.GetString(), ';');
-                               // tmp is now in the format <user>:<version>
-                               s1 = split(s1, s2, ':');
-                               // s2 is user, and s1 is version
-                               if (s1 == version) {
-                                       locker = s2;
-                                       vcstat = LOCKED;
-                                       break;
-                               }
-                       } while (!contains(tmpt, ";"));
-                       
-               } else if (token == "comment") {
-                       // we don't need to read any further than this.
-                       read_enough = true;
-               } else {
-                       // unexpected
-                       lyxerr[Debug::LYXVC]
-                               << "LyXVC::scanMaster(): unexpected token"
-                               << endl;
-               }
-       }
-}
-
-
-void LyXVC::setBuffer(Buffer * buf)
+void LyXVC::buffer(Buffer * buf)
 {
-       _owner = buf;
+       owner_ = buf;
 }
 
 
-//
-// I will probably add some backend_xxxx functions later to perform the
-// version control system specific commands. Something like:
-// void backend_revert(<params>) {
-//        if (backend == "RCS") {
-//        } else if (backend == "CVS") {
-//        } else if (backend == "SCCS") {
-//        }
-//
-// But for 0.12 we will only support RCS.
-//
-
 void LyXVC::registrer()
 {
+       // it is very likely here that the vcs is not created yet...
+       // so... we use RCS as default, later this should perhaps be
+       // a lyxrc option.
+       if (!vcs) {
+               vcs = new RCS(owner_->getFileName());
+               vcs->owner(owner_);
+       }
+       
        // If the document is changed, we might want to save it
-       if (!_owner->isLyxClean() && 
+       if (!vcs->owner()->isLyxClean() && 
            AskQuestion(_("Changes in document:"),
-                       MakeDisplayPath(_owner->getFileName(),50),
+                       MakeDisplayPath(vcs->owner()->getFileName(),50),
                        _("Save document and proceed?"))) {
-               MenuWrite(_owner);
+               vcs->owner()->getUser()->owner()
+                       ->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
        }
 
        // Maybe the save fails, or we answered "no". In both cases,
        // the document will be dirty, and we abort.
-       if (!_owner->isLyxClean()) {
+       if (!vcs->owner()->isLyxClean()) {
                return;
        }
 
@@ -185,56 +105,49 @@ void LyXVC::registrer()
                WriteAlert(_("Info"), _("This document has NOT been registered."));
                return;
        }
-       string cmd = "ci -q -u -i -t-\"";
-       cmd += tmp;
-       cmd += "\" \"";
-       cmd += OnlyFilename(_owner->getFileName());
-       cmd += "\"";
-       doVCCommand(cmd);
-       _owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
+       
+       vcs->registrer(tmp);
 }
 
 
 void LyXVC::checkIn()
 {
        // If the document is changed, we might want to save it
-       if (!_owner->isLyxClean() && 
+       if (!vcs->owner()->isLyxClean() && 
            AskQuestion(_("Changes in document:"),
-                       MakeDisplayPath(_owner->getFileName(),50),
+                       MakeDisplayPath(vcs->owner()->getFileName(),50),
                        _("Save document and proceed?"))) {
-               MenuWrite(_owner);
+               vcs->owner()->getUser()->owner()
+                       ->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
        }
 
        // Maybe the save fails, or we answered "no". In both cases,
        // the document will be dirty, and we abort.
-       if (!_owner->isLyxClean()) {
+       if (!vcs->owner()->isLyxClean()) {
                return;
        }
 
        lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
-       _owner->getUser()->getOwner()->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
        string tmp = askForText(_("LyX VC: Log Message"));
        if (tmp.empty()) tmp = "(no log msg)";
-       doVCCommand("ci -q -u -m\"" + tmp + "\" \""
-                   + OnlyFilename(_owner->getFileName()) + "\"");
-       _owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
+
+       vcs->checkIn(tmp);
+       
 }
 
 
 void LyXVC::checkOut()
 {
        lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
-       if (!_owner->isLyxClean() 
+       if (!vcs->owner()->isLyxClean() 
            && !AskQuestion(_("Changes in document:"),
-                          MakeDisplayPath(_owner->getFileName(),50),
+                          MakeDisplayPath(vcs->owner()->getFileName(),50),
                           _("Ignore changes and proceed with check out?"))) {
                return;
        }
 
-       _owner->markLyxClean();
-       doVCCommand("co -q -l \""
-                   + OnlyFilename(_owner->getFileName()) + "\"");
-       _owner->getUser()->getOwner()->getLyXFunc()->Dispatch("buffer-reload");
+       vcs->checkOut();
+       
 }
 
 
@@ -247,32 +160,27 @@ void LyXVC::revert()
        if (AskQuestion(_("When you revert, you will loose all changes made"),
                        _("to the document since the last check in."),
                        _("Do you still want to do it?"))) {
-               
-               doVCCommand("co -f -u" + getVersion() + " \""
-                           + OnlyFilename(_owner->getFileName()) + "\"");
-               // We ignore changes and just reload!
-               _owner->markLyxClean();
-               _owner->getUser()->getOwner()->
-                       getLyXFunc()->Dispatch("buffer-reload");
+
+               vcs->revert();
        }
 }
 
 
 void LyXVC::undoLast()
 {
-       lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
-       doVCCommand("rcs -o" + getVersion() + " \""
-                   + OnlyFilename(_owner->getFileName()) + "\"");
+       vcs->undoLast();
 }
 
 
 void LyXVC::toggleReadOnly()
 {
-       switch (vcstat) {
-       case UNLOCKED:
+       switch (vcs->stat()) {
+       case VCS::UNLOCKED:
+               lyxerr[Debug::LYXVC] << "LyXVC: toggle to locked" << endl;
                checkOut();
                break;
-       case LOCKED:
+       case VCS::LOCKED:
+               lyxerr[Debug::LYXVC] << "LyXVC: toggle to unlocked" << endl;
                checkIn();
                break;
        }
@@ -281,23 +189,23 @@ void LyXVC::toggleReadOnly()
 
 bool LyXVC::inUse()
 {
-       if (!master.empty())
-               return true;
+       if (vcs) return true;
        return false;
 }
 
 
-string const LyXVC::getVersion() const
+string const & LyXVC::version() const
 {
-       return version;
+       return vcs->version();
 }
 
 
-string const LyXVC::getLocker() const
+string const & LyXVC::locker() const
 {
-       return locker;
+       return vcs->locker();
 }
 
+
 // This is a hack anyway so I'll put it here in the mean time.
 void LyXVC::logClose(FL_OBJECT * obj, long)
 {
@@ -354,14 +262,14 @@ void LyXVC::viewLog(string const & fil)
 
        if (!fl_load_browser(browser->browser_latexlog, fil.c_str()))
                fl_add_browser_line(browser->browser_latexlog,
-                                   _("No RCS History!"));
+                                   _("No VC History!"));
        
        if (browser->LaTeXLog->visible) {
                fl_raise_form(browser->LaTeXLog);
        } else {
                fl_show_form(browser->LaTeXLog,
                             FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
-                            _("RCS History"));
+                            _("VC History"));
                if (ow < 0) {
                        ow = browser->LaTeXLog->w;
                        oh = browser->LaTeXLog->h;
@@ -374,18 +282,7 @@ void LyXVC::viewLog(string const & fil)
 void LyXVC::showLog()
 {
        string tmpf = tmpnam(0);
-       doVCCommand("rlog \""
-                   + OnlyFilename(_owner->getFileName()) + "\" > " + tmpf);
+       vcs->getLog(tmpf);
        viewLog(tmpf);
        unlink(tmpf.c_str());
 }
-
-
-int LyXVC::doVCCommand(string const & cmd)
-{
-       lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl;
-        Systemcalls one;
-       Path p(_owner->filepath);
-       int ret = one.startscript(Systemcalls::System, cmd);
-       return ret;
-}
index c28a428804ddaead73fd754bc95830c0b9abaa31..ee4df7ba60846886dd4dd14fd3eeef5b234f430f 100644 (file)
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 
-#ifndef _LYX_VC_H_
-#define _LYX_VC_H_
+#ifndef LYX_VC_H
+#define LYX_VC_H
 
 #ifdef __GNUG__
 #pragma interface
 #include "LString.h"
 #include "latexoptions.h"
 
+class VCS;
 class Buffer;
 
-/** Version Control for LyX. This is the class giving the verison control
-features to LyX. It is
-  intended to support different kinds of version control, but at this point
-  we will only support RCS. Later CVS is a likely candidate for support.
-  The support in LyX is based loosely upon the version control in GNU Emacs,
-  but is not as extensive as that one. See examples/VC.lyx for a simple
-  tutorial and manual for the use of the version control system in LyX.
-
-  LyXVC use this algorithm when it searches for VC files:
-  for RCS it searches for <filename>,v and RCS/<filename>,v similar
-  should be done for CVS. By doing this there doesn't need to be any
-  special support for VC in the lyx format, and this is especially good
-  when the lyx format will be a subset of LaTeX.
-  */
+/** Version Control for LyX.
+    This is the class giving the verison control features to LyX. It is
+    intended to support different kinds of version control, but at this point
+    we will only support RCS. Later CVS is a likely candidate for support.
+    The support in LyX is based loosely upon the version control in GNU Emacs,
+    but is not as extensive as that one. See examples/VC.lyx for a simple
+    tutorial and manual for the use of the version control system in LyX.
+    
+    LyXVC use this algorithm when it searches for VC files:
+    for RCS it searches for <filename>,v and RCS/<filename>,v similar
+    should be done for CVS. By doing this there doesn't need to be any
+    special support for VC in the lyx format, and this is especially good
+    when the lyx format will be a subset of LaTeX.
+*/
 class LyXVC {
 public:
        ///
@@ -51,9 +52,7 @@ public:
        static bool file_not_found_hook(string const & fn);
 
        ///
-       void scanMaster();
-       ///
-       void setBuffer(Buffer*);
+       void buffer(Buffer *);
 
        /// Register the document as an VC file.
        void registrer();
@@ -83,60 +82,25 @@ public:
        bool inUse();
 
        /// Returns the version number.
-       string const getVersion() const;
+       string const & version() const;
 
        /// Returns the userid of the person who has locked the doc.
-       string const getLocker() const;
+       string const & locker() const;
 
        ///
-       static void logClose(FL_OBJECT*, long);
+       static void logClose(FL_OBJECT *, long);
        ///
-       static void logUpdate(FL_OBJECT*, long);
+       static void logUpdate(FL_OBJECT *, long);
 protected:
 private:
        ///
-       int doVCCommand(string const&);
+       Buffer * owner_;
        
-       /** The master VC file. For RCS this is *,v or RCS/ *,v. master should
-         have full path.
-         */
-       string master;
-
-       /** The version of the VC file. I am not sure if this can be a
-       string of if it must be a
-         float/int. */
-       string version;
-
-       /// The user currently keeping the lock on the VC file.
-       string locker;
-
        ///
-       enum VCStatus {
-               ///
-               UNLOCKED,
-               ///
-               LOCKED
-       };
-
-       /// The status of the VC controlled file.
-       VCStatus vcstat;
-
-       ///     
-       enum Backend {
-               ///
-               UNKNOWN_VCS,
-               ///
-               RCS_VCS
-       };
-
-       /// The VC backend used. (so far this can only be RCS)
-       Backend backend;
-
-       /// The buffer using this VC
-       Buffer *_owner;
+       VCS * vcs;
 
        ///
-       FD_LaTeXLog *browser; // FD_LaTeXLog is just a browser with a
+       FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
        // close button. Unfortunately we can not use the standard callbacks.
 };
 
index b78968f0f627311f8ba3dd264e9c139297e2fffd..e628836ea9c4ba6eb7e0afc5691018f3ea58225a 100644 (file)
@@ -458,7 +458,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
        fl_set_button(ob, 0);
        fl_redraw_object(ob);
 
-       Buffer * tmpbuffer = men->_view->currentBuffer();
+       Buffer * tmpbuffer = men->_view->buffer();
        LyXFunc * tmpfunc = men->_view->getLyXFunc();
 
        bool LinuxDoc = tmpbuffer->isLinuxDoc();
@@ -673,7 +673,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
        case 18: // The first item with lastfiles.
        default:
                men->currentView()
-                       ->setBuffer(bufferlist
+                       ->buffer(bufferlist
                                    .loadLyXFile((*lastfiles)[choice - 18]));
                break;
        }
@@ -789,7 +789,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
        case 6: // The first item with lastfiles.
        default:
                men->currentView()
-                       ->setBuffer(bufferlist
+                       ->buffer(bufferlist
                                    .loadLyXFile((*lastfiles)[choice - 6]));
                break;
        }
@@ -810,7 +810,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
        fl_set_button(ob, 0);
        fl_redraw_object(ob);
 
-       Buffer * tmpbuffer = men->_view->currentBuffer();
+       Buffer * tmpbuffer = men->_view->buffer();
        LyXFunc * tmpfunc = men->_view->getLyXFunc();
 
        // Floats & Insets submenu
@@ -1135,7 +1135,7 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
        fl_set_button(ob, 0);
        fl_redraw_object(ob);
    
-       Buffer * tmpbuffer = men->_view->currentBuffer();
+       Buffer * tmpbuffer = men->_view->buffer();
        LyXFunc * tmpfunc = men->_view->getLyXFunc();
 
        int LayoutMenu = fl_newpup(FL_ObjWin(ob));
@@ -1225,7 +1225,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
        fl_set_button(ob, 0);
        fl_redraw_object(ob);
  
-       Buffer * tmpbuffer = men->_view->currentBuffer();
+       Buffer * tmpbuffer = men->_view->buffer();
        LyXFunc * tmpfunc = men->_view->getLyXFunc();
 
        int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
@@ -1428,7 +1428,7 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
        fl_set_button(ob, 0);
        fl_redraw_object(ob);
 
-       Buffer * tmpbuffer = men->_view->currentBuffer();
+       Buffer * tmpbuffer = men->_view->buffer();
        LyXFunc * tmpfunc = men->_view->getLyXFunc();
 
        int MathMenu = fl_defpup(FL_ObjWin(ob), 
@@ -1662,7 +1662,7 @@ void Menus::MenuDocu(string const & docname)
        string fname = i18nLibFileSearch("doc", docname, "lyx");
        _view->getMiniBuffer()->Set(_("Opening help file"),
                                    MakeDisplayPath(fname),"...");
-       currentView()->setBuffer(bufferlist.loadLyXFile(fname,false));
+       currentView()->buffer(bufferlist.loadLyXFile(fname,false));
 
        if (docname == "Reference")
                _view->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
@@ -1671,5 +1671,5 @@ void Menus::MenuDocu(string const & docname)
 
 void Menus::handleBufferMenu(int choice)
 {
-       currentView()->setBuffer(bufferlist.getBuffer(choice));
+       currentView()->buffer(bufferlist.getBuffer(choice));
 }
index e74ed3eac5aa06a3288c64d2386a8f08ea008343..52f41e70d0483ad4264cfb53b65d33955c02462a 100644 (file)
@@ -30,20 +30,20 @@ extern string keyseqOptions(int l=190);
 extern string keyseqStr(int l=190);
 extern LyXAction lyxaction;
 
-void MiniBuffer::TimerCB(FL_OBJECT *, long tmp)
+void MiniBuffer::TimerCB(FL_OBJECT * ob, long)
 {
-       MiniBuffer *obj= (MiniBuffer*)tmp;
+       MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
        obj->Init();
 }
 
-extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT *ob, long data)
+extern "C" void C_MiniBuffer_TimerCB(FL_OBJECT * ob, long data)
 {
        MiniBuffer::TimerCB(ob, data);
 }
 
-void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
+void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
 {
-       MiniBuffer *obj = (MiniBuffer*)ob->u_vdata;
+       MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
        lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
        fl_set_focus_object(obj->owner->getForm(),
                            obj->owner->currentView()->getWorkArea());
@@ -68,7 +68,7 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
                       << "\nArg     : " << arg << endl;
 
        // Dispatch only returns requested data for a few commands (ale)
-       string res=obj->owner->getLyXFunc()->Dispatch(function.c_str(),
+       string res = obj->owner->getLyXFunc()->Dispatch(function.c_str(),
                                                       arg.c_str());
        lyxerr.debug() << "Minibuffer Res: " << res << endl;
        obj->shows_no_match = false;
@@ -76,19 +76,19 @@ void MiniBuffer::ExecutingCB(FL_OBJECT *ob, long)
        return ;
 }
 
-extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT *ob, long data)
+extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT * ob, long data)
 {
        MiniBuffer::TimerCB(ob, data);
 }
 
 // This is not as dirty as it seems, the hidden buttons removed by this
 // function were just kludges for an uncomplete keyboard callback (ale)
-int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
+int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
                           int key, void */*xev*/)
 {
-       MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
+       MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
        
-       if (event==FL_KEYBOARD){
+       if (event == FL_KEYBOARD){
                switch (key) {
                case XK_Down:
                        mini->history_idx++;
@@ -105,7 +105,7 @@ int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
                case XK_Tab:
                {
                        // complete or increment the command
-                       const char *s = lyxaction.getApproxFuncName(fl_get_input(ob));
+                       char const * s = lyxaction.getApproxFuncName(fl_get_input(ob));
                        if (s && s[0])
                                fl_set_input(ob, s);
                        return 1; 
@@ -130,9 +130,9 @@ int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
        return 0;
 }
 
-extern "C" int C_MiniBuffer_peek_event(FL_OBJECT *ob, int event, 
+extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, 
                                       FL_Coord, FL_Coord,
-                                      int key, void *xev)
+                                      int key, void * xev)
 {
        return MiniBuffer::peek_event(ob,event,0,0,key,xev);
 }
@@ -146,10 +146,10 @@ void MiniBuffer::ExecCommand()
 }
 
 
-FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
+FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
                           FL_Coord w, FL_Coord h)
 {
-       FL_OBJECT *obj;
+       FL_OBJECT * obj;
        
        the_buffer = obj = fl_add_input(type,x,y,w,h,text.c_str());
         fl_set_object_boxtype(obj,FL_DOWN_BOX);
@@ -161,12 +161,13 @@ FL_OBJECT *MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
 
        // To intercept Up, Down, Table for history
         fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
-        obj->u_vdata = (void*)this;
+        obj->u_vdata = this;
         obj->wantkey = FL_KEY_TAB;
        
        // timer
        timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer");
-       fl_set_object_callback(timer, C_MiniBuffer_TimerCB, (long)this);
+       fl_set_object_callback(timer, C_MiniBuffer_TimerCB, 0);
+       timer->u_vdata = this;
        fl_set_input(the_buffer, text.c_str());
 
        return obj;
@@ -210,23 +211,23 @@ void MiniBuffer::Init()
        // Else, show the buffer state.
        else if (owner->currentView()->available()) {
                        string nicename =
-                               MakeDisplayPath(owner->currentBuffer()->
+                               MakeDisplayPath(owner->buffer()->
                                                getFileName());
                        // Should we do this instead? (kindo like emacs)
                        // leaves more room for other information
                        text = "LyX: ";
                        text += nicename;
-                       if (owner->currentBuffer()->lyxvc.inUse()) {
-                               text += " [RCS:";
-                               text += owner->currentBuffer()->lyxvc.getVersion();
+                       if (owner->buffer()->lyxvc.inUse()) {
+                               text += " [";
+                               text += owner->buffer()->lyxvc.version();
                                text += ' ';
-                               text += owner->currentBuffer()->lyxvc.getLocker();
-                               if (owner->currentBuffer()->isReadonly())
+                               text += owner->buffer()->lyxvc.locker();
+                               if (owner->buffer()->isReadonly())
                                        text += " (RO)";
                                text += ']';
-                       } else if (owner->currentBuffer()->isReadonly())
+                       } else if (owner->buffer()->isReadonly())
                                text += " [RO]";
-                       if (!owner->currentBuffer()->isLyxClean())
+                       if (!owner->buffer()->isLyxClean())
                                text += _(" (Changed)");
        } else {
                if (text != _("Welcome to LyX!")) // this is a hack
index 3a3402bc55d2a0806ddcb388f34e2d3674b11d43..d0080cd52863177c2eeb1d3ce2cf85f1668ddf29 100644 (file)
@@ -454,7 +454,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
         if (layout.needprotect 
            && next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
                features.NeedLyXFootnoteCode = true;
-        if ((current_view->currentBuffer()->params.paragraph_separation == LYX_PARSEP_INDENT) &&
+        if ((current_view->buffer()->params.paragraph_separation == LYX_PARSEP_INDENT) &&
             (pextra_type == PEXTRA_MINIPAGE))
                features.NeedLyXMinipageIndent = true;
         if (table && table->NeedRotating())
@@ -3735,7 +3735,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
                        case '°': case '±': case '²': case '³':  
                        case '×': case '÷': case '¹': case 'ª':
                        case 'º': case '¬': case 'µ':
-                               if (current_view->currentBuffer()->params.inputenc == "latin1") {
+                               if (current_view->buffer()->params.inputenc == "latin1") {
                                        file += "\\ensuremath{";
                                        file += c;
                                        file += '}';
@@ -3806,7 +3806,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
                                break;
 
                        case '£':
-                               if (current_view->currentBuffer()->params.inputenc == "default") {
+                               if (current_view->buffer()->params.inputenc == "default") {
                                        file += "\\pounds{}";
                                        column += 8;
                                } else {
@@ -4048,7 +4048,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
                // flags when footnotetext should be appended to file.
         static bool minipage_open = false;
         static int minipage_open_depth = 0;
-       char par_sep = current_view->currentBuffer()->params.paragraph_separation;
+       char par_sep = current_view->buffer()->params.paragraph_separation;
     
        lyxerr[Debug::LATEX] << "TeXEnvironment...     " << this << endl;
        if (IsDummy())
@@ -4347,7 +4347,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
                texrow.newline();
        }
        
-       BufferParams * params = &current_view->currentBuffer()->params;
+       BufferParams * params = &current_view->buffer()->params;
        bool footer_in_body = true;
        switch (footnotekind) {
        case LyXParagraph::FOOTNOTE:
index 5bedccdd96895695a95babc8c80598dbf4e200ad..e534ee81fbc99e98cf59513083b42c838507b13c 100644 (file)
@@ -325,13 +325,13 @@ void create_ispell_pipe(string const & lang)
                        argv[argc++] = tmp;
                }
                if (lyxrc->isp_use_input_encoding &&
-                   current_view->currentBuffer()->params.inputenc != "default") {
+                   current_view->buffer()->params.inputenc != "default") {
                        tmp = new char[3];
                        string("-T").copy(tmp, 2); tmp[2] = '\0';
                        argv[argc++] = tmp; // Input encoding
-                       tmp = new char[current_view->currentBuffer()->params.inputenc.length() + 1];
-                       current_view->currentBuffer()->params.inputenc.copy(tmp, current_view->currentBuffer()->params.inputenc.length());
-                       tmp[current_view->currentBuffer()->params.inputenc.length()] = '\0';
+                       tmp = new char[current_view->buffer()->params.inputenc.length() + 1];
+                       current_view->buffer()->params.inputenc.copy(tmp, current_view->buffer()->params.inputenc.length());
+                       tmp[current_view->buffer()->params.inputenc.length()] = '\0';
                        argv[argc++] = tmp;
                }
 
@@ -585,7 +585,7 @@ void ShowSpellChecker()
                        fl_set_object_lcol(fd_form_spell_check->input, FL_BLACK);
                        fl_set_object_lcol(fd_form_spell_check->browser, FL_BLACK);
                        // activate replace only if the file is not read-only
-                       if (!current_view->currentBuffer()->isReadonly()) { 
+                       if (!current_view->buffer()->isReadonly()) { 
                          fl_activate_object(fd_form_spell_check->replace);
                          fl_set_object_lcol(fd_form_spell_check->replace, FL_BLACK);
                        }
@@ -596,7 +596,7 @@ void ShowSpellChecker()
                        fl_set_object_lcol(fd_form_spell_check->options, FL_INACTIVE);
                        fl_set_object_lcol(fd_form_spell_check->start, FL_INACTIVE);
 
-                       ret = RunSpellChecker(current_view->currentBuffer()->GetLanguage());
+                       ret = RunSpellChecker(current_view->buffer()->GetLanguage());
 
                        // deactivate insert, accept, replace, and stop
                        fl_deactivate_object(fd_form_spell_check->insert);
index 9b6d24ea0f601d122f95f482a081f857a1415199..10db7b232dca0f78a7dc4a826fe38a02a1a1f88e 100644 (file)
@@ -629,7 +629,8 @@ lyxstring & lyxstring::assign(iterator first, iterator last)
 lyxstring::const_reference lyxstring::operator[](size_type pos) const
 {
        Assert(pos <= rep->sz); // OURS!
-       return pos == rep->sz ? '\0' : rep->s[pos];
+       static char helper = '\0';
+       return pos == rep->sz ? helper : rep->s[pos];
 }
 
 
index 82bfb97f83409ffe1d8b44469eb58af96f99ca07..8b9acc687c692fc70c2492b931946c8a52046487 100644 (file)
@@ -31,9 +31,9 @@ void LaTeXOptionsOK(FL_OBJECT *ob, long data)
 void LaTeXOptionsApply(FL_OBJECT *, long)
 {
        if (fl_get_button(fd_latex_options->accents))
-               current_view->currentBuffer()->params.allowAccents = true;
+               current_view->buffer()->params.allowAccents = true;
        else
-               current_view->currentBuffer()->params.allowAccents = false;
+               current_view->buffer()->params.allowAccents = false;
 }
 
 void LaTeXOptionsCancel(FL_OBJECT *, long)
index 1756106483dafe8d44ea7c1753ba7ef2d79f66cf..217d54e459f25d4732ca885f2a4e96a8eea6ec89 100644 (file)
@@ -1807,8 +1807,8 @@ void LyXText::TableFeatures(int feature)
           return;
       }
       case LyXTable::DELETE_ROW:
-          if (current_view->currentBuffer()->the_locking_inset)
-              UnlockInset(current_view->currentBuffer()->the_locking_inset);
+          if (current_view->buffer()->the_locking_inset)
+              UnlockInset(current_view->buffer()->the_locking_inset);
           RemoveTableRow(&cursor);
           RedoParagraph();
           return;
@@ -1821,8 +1821,8 @@ void LyXText::TableFeatures(int feature)
 #endif
           int cell_org = actCell;
           int cell = 0;
-          if (current_view->currentBuffer()->the_locking_inset)
-              UnlockInset(current_view->currentBuffer()->the_locking_inset);
+          if (current_view->buffer()->the_locking_inset)
+              UnlockInset(current_view->buffer()->the_locking_inset);
           do {
               if (!pos || (cursor.par->IsNewline(pos-1))){
                   if (cursor.par->table->DeleteCellIfColumnIsDeleted(cell, cell_org)){
index b11eb6107a1e57fd5b27032393bb077c92e02921..d667f6e89d6ad9c28d81df78124d9fc554a9ec77 100644 (file)
@@ -97,7 +97,7 @@ string TransDeadkeyState::normalkey(char c,char *trans)
     }
     if (l==0) {
        // Not an exception. Check if it allowed
-       if (current_view->currentBuffer()->params.allowAccents==true ||
+       if (current_view->buffer()->params.allowAccents==true ||
            countChar(deadkey_info_.allowed, c) > 0) {
            res=DoAccent(c,deadkey_info_.accent);
        } else {
diff --git a/src/vc-backend.C b/src/vc-backend.C
new file mode 100644 (file)
index 0000000..8c0a29a
--- /dev/null
@@ -0,0 +1,306 @@
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <fstream>
+
+#include "vc-backend.h"
+#include "debug.h"
+#include "support/FileInfo.h"
+#include "support/LRegex.h"
+#include "support/LSubstring.h"
+#include "support/path.h"
+#include "buffer.h"
+#include "LyXView.h"
+#include "lyxfunc.h"
+
+
+int VCS::doVCCommand(string const & cmd)
+{
+       lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl;
+        Systemcalls one;
+       Path p(owner_->filepath);
+       int ret = one.startscript(Systemcalls::System, cmd);
+       return ret;
+}
+
+
+RCS::RCS(string const & m)
+{
+       master_ = m;
+       scanMaster();
+}
+
+
+string RCS::find_file(string const & file)
+{
+       string tmp(file);
+       // Check if *,v exists.
+       tmp += ",v";
+       FileInfo f;
+       lyxerr[Debug::LYXVC] << "Checking if file is under rcs: "
+                            << tmp << endl;
+       if (f.newFile(tmp).readable()) {
+               lyxerr[Debug::LYXVC] << "Yes " << file
+                                    << " is under rcs." << endl;
+               return tmp;
+       } else {
+               // Check if RCS/*,v exists.
+               tmp = AddName(AddPath(OnlyPath(file), "RCS"), file);
+               tmp += ",v";
+               lyxerr[Debug::LYXVC] << "Checking if file is under rcs: "
+                                    << tmp << endl;
+               if (f.newFile(tmp).readable()) {
+                       lyxerr[Debug::LYXVC] << "Yes " << file
+                                            << " it is under rcs."<< endl;
+                       return tmp;
+               }
+       }
+       return string();
+}
+
+
+void RCS::scanMaster()
+{
+       lyxerr[Debug::LYXVC] << "LyXVC::RCS: scanMaster." << endl;
+
+       ifstream ifs(master_.c_str());
+
+       string token;
+       bool read_enough = false;
+
+       while (!read_enough && ifs >> token) {
+               lyxerr[Debug::LYXVC]
+                       << "LyXVC::scanMaster: current lex text: `"
+                       << token << "'" << endl;
+
+               if (token.empty())
+                       continue;
+               else if (token == "head") {
+                       // get version here
+                       string tmv;
+                       ifs >> tmv;
+                       tmv = strip(tmv, ';');
+                       version_ = tmv;
+                       lyxerr[Debug::LYXVC] << "LyXVC: version found to be "
+                                            << tmv << endl;
+               } else if (contains(token, "access")
+                          || contains(token, "symbols")
+                          || contains(token, "strict")) {
+                       // nothing
+               } else if (contains(token, "locks")) {
+                       // get locker here
+                       if (contains(token, ";")) {
+                               locker_ = "Unlocked";
+                               vcstat = UNLOCKED;
+                               continue;
+                       }
+                       string tmpt, s1, s2;
+                       do {
+                               ifs >> tmpt;
+                               s1 = strip(tmpt, ';');
+                               // tmp is now in the format <user>:<version>
+                               s1 = split(s1, s2, ':');
+                               // s2 is user, and s1 is version
+                               if (s1 == version_) {
+                                       locker_ = s2;
+                                       vcstat = LOCKED;
+                                       break;
+                               }
+                       } while (!contains(tmpt, ";"));
+                       
+               } else if (token == "comment") {
+                       // we don't need to read any further than this.
+                       read_enough = true;
+               } else {
+                       // unexpected
+                       lyxerr[Debug::LYXVC]
+                               << "LyXVC::scanMaster(): unexpected token"
+                               << endl;
+               }
+       }
+       version_ = "RCS: " + version_;
+}
+
+
+void RCS::registrer(string const & msg)
+{
+       string cmd = "ci -q -u -i -t-\"";
+       cmd += msg;
+       cmd += "\" \"";
+       cmd += OnlyFilename(owner_->getFileName());
+       cmd += "\"";
+       doVCCommand(cmd);
+       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+}
+
+
+void RCS::checkIn(string const & msg)
+{
+       doVCCommand("ci -q -u -m\"" + msg + "\" \""
+                   + OnlyFilename(owner_->getFileName()) + "\"");
+       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+}
+
+
+void RCS::checkOut()
+{
+       owner_->markLyxClean();
+       doVCCommand("co -q -l \""
+                   + OnlyFilename(owner_->getFileName()) + "\"");
+       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+}
+
+
+void RCS::revert()
+{
+       doVCCommand("co -f -u" + version() + " \""
+                   + OnlyFilename(owner_->getFileName()) + "\"");
+       // We ignore changes and just reload!
+       owner_->markLyxClean();
+       owner_->getUser()->owner()
+               ->getLyXFunc()->Dispatch("buffer-reload");
+}
+
+
+void RCS::undoLast()
+{
+       lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
+       doVCCommand("rcs -o" + version() + " \""
+                   + OnlyFilename(owner_->getFileName()) + "\"");
+}
+
+
+void RCS::getLog(string const & tmpf)
+{
+       doVCCommand("rlog \""
+                   + OnlyFilename(owner_->getFileName()) + "\" > " + tmpf);
+}
+
+
+CVS::CVS(string const & m, string const & f)
+{
+       master_ = m;
+       file_ = f;
+       scanMaster();
+}
+
+
+string CVS::find_file(string const & file)
+{
+       // First we look for the CVS/Entries in the same dir
+       // where we have file.
+       string dir = OnlyPath(file);
+       string tmpf = "/" + OnlyFilename(file) + "/";
+       dir += "/CVS/Entries";
+       lyxerr[Debug::LYXVC] << "LyXVC: checking in `" << dir
+                            << "' for `" << tmpf << "'" << endl;
+       FileInfo f(dir);
+       if (f.readable()) {
+               // Ok we are at least in a CVS dir. Parse the CVS/Entries
+               // and see if we can find this file. We do a fast and
+               // dirty parse here.
+               ifstream ifs(dir.c_str());
+               string line;
+               while (getline(ifs, line)) {
+                       lyxerr[Debug::LYXVC] << "\tEntries: " << line << endl;
+                       if (contains(line, tmpf)) return dir;
+               }
+       }
+       return string();
+}
+
+
+void CVS::scanMaster()
+{
+       lyxerr[Debug::LYXVC] << "LyXVC::CVS: scanMaster. \n     Checking: "
+                            << master_ << endl;
+       // Ok now we do the real scan...
+       ifstream ifs(master_.c_str());
+       string tmpf = "/" + OnlyFilename(file_) + "/";
+       lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << "'" << endl;
+       string line;
+       while(getline(ifs, line)) {
+               lyxerr[Debug::LYXVC] << "\t  line: " << line << endl;
+               if (contains(line, tmpf)) {
+                       // Ok extract the fields.
+                       LRegex reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
+                       LRegex::SubMatches const & sm = reg.exec(line);
+                       //sm[0]; // whole matched string
+                       //sm[1]; // filename
+                       version_ = "CVS: ";
+                       version_ += LSubstring(line, sm[2].first,
+                                             sm[2].second);
+                       string file_date = LSubstring(line, sm[3].first,
+                                                     sm[3].second);
+                       //sm[4]; // options
+                       //sm[5]; // tag or tagdate
+                       FileInfo fi(file_);
+                       time_t mod = fi.getModificationTime();
+                       string mod_date = strip(asctime(gmtime(&mod)), '\n');
+                       lyxerr[Debug::LYXVC]
+                               <<  "Date in Entries: `" << file_date
+                               << "'\nModification date of file: `"
+                               << mod_date << "'" << endl;
+                       if (file_date == mod_date) {
+                               locker_ = "Unlocked";
+                               vcstat = UNLOCKED;
+                       } else {
+                               // Here we should also to some more checking
+                               // to see if there are conflicts or not.
+                               locker_ = "Locked";
+                               vcstat = LOCKED;
+                       }
+#if 0                  
+                       for (LRegex::SubMatches::const_iterator cit = sm.begin();
+                            cit != sm.end(); ++cit) {
+                               if ((*cit).first != string::npos)
+                                       lyxerr << string(line, (*cit).first,
+                                                        (*cit).second) << endl;
+                       }
+#endif
+                       break;
+               }
+       }
+}
+
+
+void CVS::registrer(string const & msg)
+{
+       // cvs add
+}
+
+
+void CVS::checkIn(string const & msg)
+{
+       // cvs commit
+}
+
+
+void CVS::checkOut()
+{
+       // cvs update
+}
+
+
+void CVS::revert()
+{
+       // not sure how to do this...
+       // rm file
+       // cvs update  
+}
+
+
+void CVS::undoLast()
+{
+       // merge the current with the previous version
+       // in a reverse patch kind of way, so that the
+       // result is to revert the last changes.
+}
+
+
+void CVS::getLog(string const &)
+{
+}
diff --git a/src/vc-backend.h b/src/vc-backend.h
new file mode 100644 (file)
index 0000000..77e6c6c
--- /dev/null
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+#ifndef VC_BACKEND_H
+#define VC_BACKEND_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "LString.h"
+#include "support/syscall.h"
+
+class Buffer;
+
+///
+class VCS {
+public:
+       ///
+       enum VCStatus {
+               ///
+               UNLOCKED,
+               ///
+               LOCKED
+       };
+       ///
+       virtual ~VCS() {}
+       ///
+       virtual void scanMaster() = 0;
+       ///
+       virtual void registrer(string const & msg) = 0;
+       ///
+       virtual void checkIn(string const & msg) = 0;
+       ///
+       virtual void checkOut() = 0;
+       ///
+       virtual void revert() = 0;
+       ///
+       virtual void undoLast() = 0;
+       ///
+       virtual void getLog(string const &) = 0;
+       ///
+       string const & version() const { return version_; }
+       ///
+       string const & locker() const { return locker_; }
+       ///
+       void owner(Buffer * b) { owner_ = b; }
+       ///
+       Buffer * owner() const { return owner_; }
+       ///
+       VCStatus stat() const { return vcstat; }
+protected:
+       ///
+       int doVCCommand(string const &);
+
+       /** The master VC file. For RCS this is *,v or RCS/ *,v. master should
+           have full path.
+       */
+       string master_;
+       
+       /// The status of the VC controlled file.
+       VCStatus vcstat;
+       
+       /** The version of the VC file. I am not sure if this can be a
+           string of if it must be a
+           float/int. */
+       string version_;
+       
+       /// The user currently keeping the lock on the VC file.
+       string locker_;
+       /// The buffer using this VC
+       Buffer * owner_;
+};
+
+
+///
+class RCS : public VCS {
+public:
+       ///
+       RCS(string const & m);
+       ///
+       static string find_file(string const & file);
+       ///
+       virtual void scanMaster();
+       ///
+       virtual void registrer(string const & msg);
+       ///
+       virtual void checkIn(string const & msg);
+       ///
+       virtual void checkOut();
+       ///
+       virtual void revert();
+       ///
+       virtual void undoLast();
+       ///
+       virtual void getLog(string const &);
+private:
+};
+
+
+///
+class CVS : public VCS {
+public:
+       ///
+       CVS(string const & m, string const & f);
+       ///
+       static string find_file(string const & file);
+       ///
+       virtual void scanMaster();
+       ///
+       virtual void registrer(string const & msg);
+       ///
+       virtual void checkIn(string const & msg);
+       ///
+       virtual void checkOut();
+       ///
+       virtual void revert();
+       ///
+       virtual void undoLast();
+       ///
+       virtual void getLog(string const &);
+private:
+       string file_;
+};
+#endif
index 2aa68aa8ca36dee5e52597e676bd95567ea5dd07..2d6d7e74f7bc8e8383bfa4aed6ba1830d5e3b6ed 100644 (file)
@@ -473,7 +473,7 @@ string VSpace::asLatexCommand() const
        switch (kin) {
        case NONE:      return string();
        case DEFSKIP:   
-         return current_view->currentBuffer()->params.getDefSkip().asLatexCommand();
+         return current_view->buffer()->params.getDefSkip().asLatexCommand();
        case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
                                  : "\\smallskip{}";
        case MEDSKIP:   return kp ? "\\vspace*{\\medskipamount}"
@@ -492,7 +492,7 @@ string VSpace::asLatexCommand() const
 int VSpace::inPixels() const
 {
        // Height of a normal line in pixels (zoom factor considered)
-       int height = current_view->currentBuffer()->text->DefaultHeight(); // [pixels]
+       int height = current_view->buffer()->text->DefaultHeight(); // [pixels]
 
        // Zoom factor specified by user in percent
        float const zoom = lyxrc->zoom / 100.0; // [percent]
@@ -507,7 +507,7 @@ int VSpace::inPixels() const
        case NONE: return 0;
 
        case DEFSKIP:
-         return current_view->currentBuffer()->params.getDefSkip().inPixels();
+         return current_view->buffer()->params.getDefSkip().inPixels();
 
        // This is how the skips are normally defined by
        // LateX.  But there should be some way to change