]> git.lyx.org Git - features.git/commitdiff
Moved the_locking_inset form BufferView to LyXText (where it belongs!)
authorJürgen Vigna <jug@sad.it>
Tue, 3 Oct 2000 13:55:48 +0000 (13:55 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 3 Oct 2000 13:55:48 +0000 (13:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1075 a592a061-630c-0410-9148-cb99ea01b6c8

19 files changed:
ChangeLog
src/BufferView.C
src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/bufferlist.C
src/bufferview_funcs.C
src/frontends/xforms/FormParagraph.C
src/insets/inset.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/insets/lyxinset.h
src/lyxfunc.C
src/lyxtext.h
src/mathed/formula.C
src/mathed/formula.h
src/mathed/math_symbols.C
src/text2.C

index 23fc2ce91ad37aa5b90429805fa78b93f12fe392..2f44366f7705aa45eb668119c06d698050735d52 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-10-03  Juergen Vigna  <jug@sad.it>
+
+       * various files: changed use of BufferView::the_locking_inset.
+       
+       * src/BufferView2.C (theLockingInset): 
+       (theLockingInset): new functions.
+
+       * src/BufferView.h: removed the_locking_inset.
+
+       * src/lyxtext.h: added the_locking_inset
+
+       * src/BufferView_pimpl.C (checkInsetHit): y_tmp form uint to int.
+
+       * src/insets/lyxinset.h: added bool to ShowInsetCursor definition.
+
 2000-10-02  Angus Leeming <a.leeming@ic.ac.uk>
 
        * src/mathed/formula.C (IsMacro): declared but not referenced; removed.
index 88cbba5f8f7f927f7b276d664dd3f2ce37eedb85..5c317948850d6621798675ab06140642b4521f18 100644 (file)
@@ -27,7 +27,6 @@ BufferView::BufferView(LyXView * o, int xpos, int ypos,
        : pimpl_(new Pimpl(this, o, xpos, ypos, width, height))
 {
        text = 0;
-       the_locking_inset = 0;
        inset_slept = false;
 }
 
index e13893664aa5b8b7e1d1c411a4e983c8aa932d96..e6bbd847c5780203b58614d3847f1939290f48ee 100644 (file)
@@ -102,7 +102,8 @@ public:
        ///
        int workWidth() const;
        ///
-       UpdatableInset * the_locking_inset;
+       UpdatableInset * theLockingInset() const;
+       void theLockingInset(UpdatableInset const * inset); 
        ///
        void updateInset(Inset * inset, bool mark_dirty);
        ///
index 524a4f100189c65bc43ebc735cb3440eb7d0e6b8..5ec1a284dead2f6c961d7bc74eefc0d3ed0115de 100644 (file)
@@ -202,9 +202,9 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
 {
        // if we are in a locking inset we should try to insert the
        // inset there otherwise this is a illegal function now
-       if (the_locking_inset) {
-               if (the_locking_inset->InsertInsetAllowed(inset))
-                   return the_locking_inset->InsertInset(this, inset);
+       if (theLockingInset()) {
+               if (theLockingInset()->InsertInsetAllowed(inset))
+                   return theLockingInset()->InsertInset(this, inset);
                return false;
        }
 
@@ -440,7 +440,7 @@ void BufferView::menuUndo()
 
 void BufferView::menuRedo()
 {
-       if (the_locking_inset) {
+       if (theLockingInset()) {
                owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode"));
                return;
        }    
@@ -716,11 +716,11 @@ void BufferView::replaceWord(string const & replacestring)
 
 bool BufferView::lockInset(UpdatableInset * inset)
 {
-       if (!the_locking_inset && inset) {
-               the_locking_inset = inset;
+       if (!theLockingInset() && inset) {
+               theLockingInset(inset);
                return true;
        } else if (inset) {
-           return the_locking_inset->LockInsetInInset(this, inset);
+           return theLockingInset()->LockInsetInInset(this, inset);
        }
        return false;
 }
@@ -728,16 +728,16 @@ bool BufferView::lockInset(UpdatableInset * inset)
 
 void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
 {
-       if (the_locking_inset && available()) {
+       if (theLockingInset() && available()) {
                LyXCursor cursor = text->cursor;
                if ((cursor.pos() - 1 >= 0) &&
                    (cursor.par()->GetChar(cursor.pos() - 1) ==
                     LyXParagraph::META_INSET) &&
                    (cursor.par()->GetInset(cursor.pos() - 1) ==
-                    the_locking_inset->GetLockingInset()))
+                    theLockingInset()->GetLockingInset()))
                        text->SetCursor(this, cursor,
                                        cursor.par(), cursor.pos() - 1);
-               y += cursor.y() + the_locking_inset->InsetInInsetY();
+               y += cursor.y() + theLockingInset()->InsetInInsetY();
                pimpl_->screen_->ShowManualCursor(text, x, y, asc, desc,
                                                  LyXScreen::BAR_SHAPE);
        }
@@ -746,7 +746,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
 
 void BufferView::hideLockedInsetCursor()
 {
-       if (the_locking_inset && available()) {
+       if (theLockingInset() && available()) {
                pimpl_->screen_->HideCursor();
        }
 }
@@ -754,8 +754,8 @@ void BufferView::hideLockedInsetCursor()
 
 void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
 {
-       if (the_locking_inset && available()){
-               y += text->cursor.y() + the_locking_inset->InsetInInsetY();
+       if (theLockingInset() && available()){
+               y += text->cursor.y() + theLockingInset()->InsetInInsetY();
                if (pimpl_->screen_->FitManualCursor(text, x, y, asc, desc))
                        updateScrollbar();
        }
@@ -764,13 +764,13 @@ void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
 
 int BufferView::unlockInset(UpdatableInset * inset)
 {
-       if (inset && the_locking_inset == inset) {
+       if (inset && theLockingInset() == inset) {
                inset->InsetUnlock(this);
-               the_locking_inset = 0;
+               theLockingInset(0);
                text->FinishUndo();
                return 0;
-       } else if (inset && the_locking_inset &&
-                  the_locking_inset->UnlockInsetInInset(this, inset)) {
+       } else if (inset && theLockingInset() &&
+                  theLockingInset()->UnlockInsetInInset(this, inset)) {
                text->FinishUndo();
                return 0;
        }
@@ -780,7 +780,7 @@ int BufferView::unlockInset(UpdatableInset * inset)
 
 void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
 {
-       if (!the_locking_inset)
+       if (!theLockingInset())
                return; // shouldn't happen
        if (kind == Undo::EDIT) // in this case insets would not be stored!
                kind = Undo::FINISH;
@@ -804,8 +804,8 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
                return;
 
        // first check for locking insets
-       if (the_locking_inset) {
-               if (the_locking_inset == inset) {
+       if (theLockingInset()) {
+               if (theLockingInset() == inset) {
                        if (text->UpdateInset(this, inset)){
                                update();
                                if (mark_dirty){
@@ -817,8 +817,8 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
                                updateScrollbar();
                                return;
                        }
-               } else if (the_locking_inset->UpdateInsetInInset(this,inset)) {
-                       if (text->UpdateInset(this, the_locking_inset)) {
+               } else if (theLockingInset()->UpdateInsetInInset(this,inset)) {
+                       if (text->UpdateInset(this, theLockingInset())) {
                                update();
                                if (mark_dirty){
                                        if (buffer()->isLyxClean())
@@ -892,3 +892,15 @@ bool BufferView::ChangeRefs(string const & from, string const & to)
        text->SetCursorIntern(this, cursor.par(), cursor.pos());
        return flag;
 }
+
+
+UpdatableInset * BufferView::theLockingInset() const
+{
+    return text->the_locking_inset;
+}
+
+
+void BufferView::theLockingInset(UpdatableInset const * inset)
+{
+    text->the_locking_inset = inset;
+}
index 36dbfa07c3744369fb5bc1e43b0bedd0c5c6fcf6..c50fbf5f1de87cefc738e0f448e6b5b2b3d66585 100644 (file)
@@ -430,12 +430,13 @@ void BufferView::Pimpl::scrollCB(double value)
                LyXText * vbt = bv_->text;
                unsigned int height = vbt->DefaultHeight();
                
-               if (vbt->cursor.y() < bv_->text->first + height) {
+               if (vbt->cursor.y() < (int)(bv_->text->first + height)) {
                        vbt->SetCursorFromCoordinates(bv_, 0,
                                                      bv_->text->first +
                                                      height);
                } else if (vbt->cursor.y() >
-                          bv_->text->first + workarea_->height() - height) {
+                          (int)(bv_->text->first+workarea_->height()-height))
+               {
                        vbt->SetCursorFromCoordinates(bv_, 0,
                                                      bv_->text->first +
                                                      workarea_->height()  -
@@ -519,12 +520,12 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
        if (buffer_ == 0 || !screen_) return;
 
        // Check for inset locking
-       if (bv_->the_locking_inset) {
+       if (bv_->theLockingInset()) {
                LyXCursor cursor = bv_->text->cursor;
-               bv_->the_locking_inset->
+               bv_->theLockingInset()->
                        InsetMotionNotify(bv_,
                                          x - cursor.x() -
-                                         bv_->the_locking_inset->scroll(),
+                                         bv_->theLockingInset()->scroll(),
                                          y - cursor.y() + bv_->text->first,
                                          state);
                return;
@@ -572,19 +573,19 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                }
        }
        
-       if (bv_->the_locking_inset) {
+       if (bv_->theLockingInset()) {
                // 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 == bv_->the_locking_inset) {
-                       bv_->the_locking_inset->
+               if (inset_hit == bv_->theLockingInset()) {
+                       bv_->theLockingInset()->
                                InsetButtonPress(bv_,
                                                 xpos, ypos,
                                                 button);
                        return;
                } else {
-                       bv_->unlockInset(bv_->the_locking_inset);
+                       bv_->unlockInset(bv_->theLockingInset());
                }
        }
        
@@ -657,7 +658,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
 void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button) 
 {
        // select a word
-       if (buffer_ && !bv_->the_locking_inset) {
+       if (buffer_ && !bv_->theLockingInset()) {
                if (screen_ && button == 1) {
                        screen_->HideCursor();
                        screen_->ToggleSelection(bv_->text);
@@ -674,7 +675,7 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
 void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
 {
        // select a line
-       if (buffer_ && screen_ && !bv_->the_locking_inset && (button == 1)) {
+       if (buffer_ && screen_ && !bv_->theLockingInset() && (button == 1)) {
                screen_->HideCursor();
                screen_->ToggleSelection(bv_->text);
                bv_->text->CursorHome(bv_);
@@ -717,13 +718,13 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
        // inset, inset_hit is 0, and inset_x == x, inset_y == y.
        Inset * inset_hit = checkInsetHit(bv_->text, x, y, button);
 
-       if (bv_->the_locking_inset) {
+       if (bv_->theLockingInset()) {
                // 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. */
-               bv_->the_locking_inset->
+               bv_->theLockingInset()->
                        InsetButtonRelease(bv_, x, y, button);
                return;
        }
@@ -868,7 +869,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
        if (!screen_)
                return 0;
   
-       unsigned int y_tmp = y + text->first;
+       int y_tmp = y + text->first;
   
        LyXCursor cursor;
        text->SetCursorFromCoordinates(bv_, cursor, x, y_tmp);
@@ -927,7 +928,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
                    && y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
                    && y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
 #if 0
-                       if (move_cursor && (tmpinset != bv_->the_locking_inset))
+                       if (move_cursor && (tmpinset != bv_->theLockingInset()))
 #endif
                                text->SetCursor(bv_, cursor.par(),cursor.pos()-1,true);
                        x = x - start_x;
@@ -1119,11 +1120,10 @@ void BufferView::Pimpl::cursorToggle()
                goto set_timer_and_return;
        }
 
-       if (!bv_->the_locking_inset) {
+       if (!bv_->theLockingInset()) {
                screen_->CursorToggle(bv_->text);
        } else {
-               bv_->the_locking_inset->
-                       ToggleInsetCursor(bv_);
+               bv_->theLockingInset()->ToggleInsetCursor(bv_);
        }
        
   set_timer_and_return:
@@ -1245,9 +1245,9 @@ void BufferView::Pimpl::setState()
 
 void BufferView::Pimpl::insetSleep()
 {
-       if (bv_->the_locking_inset && !bv_->inset_slept) {
-               bv_->the_locking_inset->GetCursorPos(bv_, bv_->slx, bv_->sly);
-               bv_->the_locking_inset->InsetUnlock(bv_);
+       if (bv_->theLockingInset() && !bv_->inset_slept) {
+               bv_->theLockingInset()->GetCursorPos(bv_, bv_->slx, bv_->sly);
+               bv_->theLockingInset()->InsetUnlock(bv_);
                bv_->inset_slept = true;
        }
 }
@@ -1255,8 +1255,8 @@ void BufferView::Pimpl::insetSleep()
 
 void BufferView::Pimpl::insetWakeup()
 {
-       if (bv_->the_locking_inset && bv_->inset_slept) {
-               bv_->the_locking_inset->Edit(bv_, bv_->slx, bv_->sly, 0);
+       if (bv_->theLockingInset() && bv_->inset_slept) {
+               bv_->theLockingInset()->Edit(bv_, bv_->slx, bv_->sly, 0);
                bv_->inset_slept = false;
        }
 }
@@ -1264,9 +1264,10 @@ void BufferView::Pimpl::insetWakeup()
 
 void BufferView::Pimpl::insetUnlock()
 {
-       if (bv_->the_locking_inset) {
-               if (!bv_->inset_slept) bv_->the_locking_inset->InsetUnlock(bv_);
-               bv_->the_locking_inset = 0;
+       if (bv_->theLockingInset()) {
+               if (!bv_->inset_slept)
+                       bv_->theLockingInset()->InsetUnlock(bv_);
+               bv_->theLockingInset(0);
                bv_->text->FinishUndo();
                bv_->inset_slept = false;
        }
@@ -1328,7 +1329,7 @@ void BufferView::Pimpl::toggleToggle()
 void BufferView::Pimpl::center() 
 {
        beforeChange();
-       if (bv_->text->cursor.y() > workarea_->height() / 2) {
+       if (bv_->text->cursor.y() > (int)(workarea_->height() / 2)) {
                screen_->Draw(bv_->text, bv_->text->cursor.y() - workarea_->height() / 2);
        } else {
                screen_->Draw(bv_->text, 0);
index 677e92a3f0782fde98fed3f76c03896eed0fc1f8..92019c0de45440d00fe1f9a1069cf389eb9b81ae 100644 (file)
@@ -251,7 +251,7 @@ int BufferList::unlockInset(UpdatableInset * inset)
        for(BufferStorage::iterator it = bstore.begin();
            it != bstore.end(); ++it) {
                if ((*it)->getUser()
-                   && (*it)->getUser()->the_locking_inset == inset) {
+                   && (*it)->getUser()->theLockingInset() == inset) {
                        (*it)->getUser()->insetUnlock();
                        return 0;
                }
index 26073afe8d1bfd8cac3f41ca3410a6dfd045429b..ff4f699d48598910e886a3aca1c7c10b41a86fbe 100644 (file)
@@ -249,8 +249,8 @@ string const CurrentState(BufferView * bv)
                // font. (Asger)
                LyXText *text = 0;
 
-               if (bv->the_locking_inset)
-                   text = bv->the_locking_inset->getLyXText(bv);
+               if (bv->theLockingInset())
+                   text = bv->theLockingInset()->getLyXText(bv);
                if (!text)
                    text = bv->text;
 
@@ -305,8 +305,8 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font)
        if (bv->available()) { 
                bv->hideCursor();
                bv->update(BufferView::SELECT|BufferView::FITCUR);
-               if (bv->the_locking_inset)
-                       bv->the_locking_inset->SetFont(bv, font, toggleall);
+               if (bv->theLockingInset())
+                       bv->theLockingInset()->SetFont(bv, font, toggleall);
                else
                        bv->text->ToggleFree(bv, font, toggleall);
                bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
index f75eb448c40433912e72c837862ecedb50661f5c..4395c61125c8dd4c5245060a1ff5d82c5e1a032a 100644 (file)
@@ -261,8 +261,8 @@ void FormParagraph::general_apply()
     noindent = fl_get_button(general_->check_noindent);
 
     LyXText * text = 0;
-    if (lv_->view()->the_locking_inset)
-       text = lv_->view()->the_locking_inset->getLyXText(lv_->view());
+    if (lv_->view()->theLockingInset())
+       text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
     if (!text)
        text = lv_->view()->text;
     text->SetParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
@@ -326,8 +326,8 @@ void FormParagraph::general_update()
     Buffer * buf = lv_->view()->buffer();
     LyXText * text = 0;
 
-    if (lv_->view()->the_locking_inset)
-       text = lv_->view()->the_locking_inset->getLyXText(lv_->view());
+    if (lv_->view()->theLockingInset())
+       text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
     if (!text)
        text = lv_->view()->text;
 
index 77b969764d7402cf177c2c52a42953764b2e7816..aa1fadca8141c6de87c82d18c989273161aaad1b 100644 (file)
@@ -132,7 +132,7 @@ void UpdatableInset::ToggleInsetCursor(BufferView *)
 }
 
 
-void UpdatableInset::ShowInsetCursor(BufferView *)
+void UpdatableInset::ShowInsetCursor(BufferView *, bool)
 {
 }
 
index 8b00bf278dfacf8bfa39da12a263e8764b6c875b..7b44fc76a8feb500cac2d08080b6e2f5f2b3a06b 100644 (file)
@@ -618,7 +618,7 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
        the_locking_inset->InsetUnlock(bv);
     }
     the_locking_inset = 0;
-    if (inset_hit && bv->the_locking_inset) {
+    if (inset_hit && bv->theLockingInset()) {
        if (ActivateCellInset(bv, x, y, button))
            the_locking_inset->InsetButtonPress(bv, x - inset_x,
                                                y - inset_y, button);
index ddf5d153f9e59c54239bf9544ec08afebbc3ee58..e6bee21a06810495f043c7043f8d513d0b525211 100644 (file)
@@ -592,7 +592,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
        the_locking_inset->InsetUnlock(bv);
        the_locking_inset = 0;
     }
-    if (bv->the_locking_inset) {
+    if (bv->theLockingInset()) {
        if (inset && inset->Editable() == Inset::HIGHLY_EDITABLE) {
            UpdatableInset * uinset = static_cast<UpdatableInset*>(inset);
            inset_x = cx(bv) - top_x + drawTextXOffset;
@@ -1109,7 +1109,7 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
 }
 
 
-void InsetText::ShowInsetCursor(BufferView * bv)
+void InsetText::ShowInsetCursor(BufferView * bv, bool show)
 {
     if (the_locking_inset) {
        the_locking_inset->ShowInsetCursor(bv);
@@ -1122,7 +1122,8 @@ void InsetText::ShowInsetCursor(BufferView * bv)
        int desc = lyxfont::maxDescent(font);
 
        bv->fitLockedInsetCursor(cx(bv), cy(bv), asc, desc);
-       bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
+       if (show)
+           bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
        cursor_visible = true;
     }
 }
index 0080b9894e831a86eec1cca1385a1d9d16f58165..631582fddd12b9b99ca5952b9f2aebf8e1d7faab 100644 (file)
@@ -196,7 +196,7 @@ private:
     ///
     int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
     ///
-    void ShowInsetCursor(BufferView *);
+    void ShowInsetCursor(BufferView *, bool show=true);
     ///
     void HideInsetCursor(BufferView *);
     ///
index 5a33df2bc73318d155a3339b5bc05b6a0dcdfe6e..0e50b02f49b2f7889945ba8252cbf1489296a295 100644 (file)
@@ -304,7 +304,7 @@ public:
        /// may call ToggleLockedInsetCursor
        virtual void ToggleInsetCursor(BufferView *);
        ///
-       virtual void ShowInsetCursor(BufferView *);
+       virtual void ShowInsetCursor(BufferView *, bool show=true);
        ///
        virtual void HideInsetCursor(BufferView *);
        ///
index 22369a0ac47dd71ce8401234ae19f37ae4fd9608..87c4594042547e2a7c7f5b9d8715ce1723a07273 100644 (file)
@@ -192,7 +192,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
        }
        
        // this function should be used always [asierra060396]
-       UpdatableInset * tli = owner->view()->the_locking_inset;
+       UpdatableInset * tli = owner->view()->theLockingInset();
        if (owner->view()->available() && tli && (keysym == XK_Escape)) {
                if (tli == tli->GetLockingInset()) {
                        owner->view()->unlockInset(tli);
@@ -321,7 +321,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
        }
        
        // this function should be used always [asierra060396]
-       UpdatableInset * tli = owner->view()->the_locking_inset;
+       UpdatableInset * tli = owner->view()->theLockingInset();
        if (owner->view()->available() && tli && (keysym_return==XK_Escape)) {
                if (tli == tli->GetLockingInset()) {
                        owner->view()->unlockInset(tli);
@@ -500,23 +500,23 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
 
        case LFUN_LAYOUT_TABULAR:
                disable = true;
-               if (owner->view()->the_locking_inset) {
-                       disable = (owner->view()->the_locking_inset->LyxCode() != Inset::TABULAR_CODE) &&
-                               !owner->view()->the_locking_inset->GetFirstLockingInsetOfType(Inset::TABULAR_CODE);
+               if (owner->view()->theLockingInset()) {
+                       disable = (owner->view()->theLockingInset()->LyxCode() != Inset::TABULAR_CODE) &&
+                               !owner->view()->theLockingInset()->GetFirstLockingInsetOfType(Inset::TABULAR_CODE);
                }
                break;
 
        case LFUN_TABULAR_FEATURE:
                disable = true;
-               if (owner->view()->the_locking_inset) {
+               if (owner->view()->theLockingInset()) {
                        func_status ret = LyXFunc::Disabled;
-                       if (owner->view()->the_locking_inset->LyxCode() == Inset::TABULAR_CODE) {
+                       if (owner->view()->theLockingInset()->LyxCode() == Inset::TABULAR_CODE) {
                                ret = static_cast<InsetTabular *>
-                                       (owner->view()->the_locking_inset)->
+                                       (owner->view()->theLockingInset())->
                                        getStatus(argument);
-                       } else if (owner->view()->the_locking_inset->GetFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
+                       } else if (owner->view()->theLockingInset()->GetFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
                                ret = static_cast<InsetTabular *>
-                                       (owner->view()->the_locking_inset->
+                                       (owner->view()->theLockingInset()->
                                        GetFirstLockingInsetOfType(Inset::TABULAR_CODE))->
                                        getStatus(argument);
                        }
@@ -560,9 +560,9 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
        if (buf) {
                func_status box = LyXFunc::ToggleOff;
                LyXFont font;
-               if (owner->view()->the_locking_inset &&
-                   owner->view()->the_locking_inset->getLyXText(owner->view()))
-                   font = owner->view()->the_locking_inset->
+               if (owner->view()->theLockingInset() &&
+                   owner->view()->theLockingInset()->getLyXText(owner->view()))
+                   font = owner->view()->theLockingInset()->
                        getLyXText(owner->view())->real_current_font;
                else
                    font = owner->view()->text->real_current_font;
@@ -686,8 +686,8 @@ string const LyXFunc::Dispatch(int ac,
                }
         }
 
-       if (owner->view()->available() && owner->view()->the_locking_inset) {
-               text = owner->view()->the_locking_inset->getLyXText(owner->view());
+       if (owner->view()->available() && owner->view()->theLockingInset()) {
+               text = owner->view()->theLockingInset()->getLyXText(owner->view());
                UpdatableInset::RESULT result;
                if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
                                     (keyseq.length >= -1)))
@@ -700,7 +700,7 @@ string const LyXFunc::Dispatch(int ac,
                                int slx;
                                int sly;
                                UpdatableInset * inset = 
-                                       owner->view()->the_locking_inset;
+                                       owner->view()->theLockingInset();
                                inset->GetCursorPos(owner->view(), slx, sly);
                                owner->view()->unlockInset(inset);
                                owner->view()->menuUndo();
@@ -720,7 +720,7 @@ string const LyXFunc::Dispatch(int ac,
                                int slx;
                                int sly;
                                UpdatableInset * inset = owner->view()->
-                                       the_locking_inset;
+                                       theLockingInset();
                                inset->GetCursorPos(owner->view(), slx, sly);
                                owner->view()->unlockInset(inset);
                                owner->view()->menuRedo();
@@ -731,7 +731,7 @@ string const LyXFunc::Dispatch(int ac,
                                if (inset)
                                        inset->Edit(owner->view(),slx,sly,0); 
                                return string();
-                       } else if (((result=owner->view()->the_locking_inset->
+                       } else if (((result=owner->view()->theLockingInset()->
                                   LocalDispatch(owner->view(), action,
                                                 argument)) ==
                                   UpdatableInset::DISPATCHED) ||
@@ -1375,15 +1375,15 @@ string const LyXFunc::Dispatch(int ac,
                break;
 
        case LFUN_LAYOUT_TABULAR:
-           if (owner->view()->the_locking_inset) {
-               if (owner->view()->the_locking_inset->LyxCode()==Inset::TABULAR_CODE) {
+           if (owner->view()->theLockingInset()) {
+               if (owner->view()->theLockingInset()->LyxCode()==Inset::TABULAR_CODE) {
                    InsetTabular * inset = static_cast<InsetTabular *>
-                       (owner->view()->the_locking_inset);
+                       (owner->view()->theLockingInset());
                    inset->OpenLayoutDialog(owner->view());
-               } else if (owner->view()->the_locking_inset->
+               } else if (owner->view()->theLockingInset()->
                           GetFirstLockingInsetOfType(Inset::TABULAR_CODE)!=0) {
                    InsetTabular * inset = static_cast<InsetTabular *>(
-                       owner->view()->the_locking_inset->GetFirstLockingInsetOfType(Inset::TABULAR_CODE));
+                       owner->view()->theLockingInset()->GetFirstLockingInsetOfType(Inset::TABULAR_CODE));
                    inset->OpenLayoutDialog(owner->view());
                }
            }
@@ -2311,11 +2311,11 @@ string const LyXFunc::Dispatch(int ac,
        case LFUN_INSET_CAPTION:
        {
                // Do we have a locking inset...
-               if (owner->view()->the_locking_inset) {
+               if (owner->view()->theLockingInset()) {
                        lyxerr << "Locking inset code: "
-                              << static_cast<int>(owner->view()->the_locking_inset->LyxCode());
+                              << static_cast<int>(owner->view()->theLockingInset()->LyxCode());
                        InsetCaption * new_inset = new InsetCaption;
-                       new_inset->setOwner(owner->view()->the_locking_inset);
+                       new_inset->setOwner(owner->view()->theLockingInset());
                        new_inset->SetAutoBreakRows(true);
                        new_inset->SetDrawFrame(0, InsetText::LOCKED);
                        new_inset->SetFrameColor(0, LColor::footnoteframe);
@@ -2572,7 +2572,7 @@ string const LyXFunc::Dispatch(int ac,
                        owner->view()->
                                open_new_inset(new InsetFormula(false));
                        owner->view()
-                               ->the_locking_inset
+                               ->theLockingInset()
                                ->LocalDispatch(owner->view(),
                                                action,
                                                argument);
index d80ecd259afd733c26e51765316191c1e213fa0f..b1acc90325804564599465397d88179c246e5b70 100644 (file)
@@ -71,6 +71,8 @@ public:
        BufferView * bv_owner;
        ///
        InsetText * inset_owner;
+       ///
+       UpdatableInset * the_locking_inset;
 
        ///
        LyXFont const GetFont(Buffer const *, LyXParagraph * par,
index e1fe06392c465d603206197db5737640168e9256..611e4d2a4f8555d9b2e660cac6a0529aed767128 100644 (file)
@@ -548,7 +548,7 @@ void InsetFormula::ToggleInsetCursor(BufferView * bv)
 }
 
 
-void InsetFormula::ShowInsetCursor(BufferView * bv)
+void InsetFormula::ShowInsetCursor(BufferView * bv, bool)
 {
   if (!cursor_visible) {
     if (mathcursor) {
index dbee7144b7791e9e4e82e20a8bb150be4e04418f..99a018f276c7b7225f48019bb0ee442c8c409c3c 100644 (file)
@@ -86,7 +86,7 @@ public:
        ///
        void ToggleInsetCursor(BufferView *);
        ///
-       void ShowInsetCursor(BufferView *);
+       void ShowInsetCursor(BufferView *, bool show=true);
        ///
        void HideInsetCursor(BufferView *);
        ///
index 34447a4f9da21ac7694411e1644d028fe7842463..a91347731b480fcfb52ad647b493b9ccd263822a 100644 (file)
@@ -338,7 +338,7 @@ bool math_insert_greek(char c)
        ('a'<= c && c<= 'z')))   {
       string tmp;
       tmp = c;
-      if (!current_view->the_locking_inset) {
+      if (!current_view->theLockingInset()) {
         int greek_kb_flag_save = greek_kb_flag;
         InsetFormula * new_inset = new InsetFormula();
         current_view->beforeChange();
@@ -347,10 +347,10 @@ bool math_insert_greek(char c)
         new_inset->Edit(current_view, 0, 0, 0);
         new_inset->LocalDispatch(current_view, LFUN_SELFINSERT, tmp);
         if (greek_kb_flag_save < 2)
-                current_view->unlockInset(current_view->the_locking_inset);
+                current_view->unlockInset(current_view->theLockingInset());
       } else
-        if (current_view->the_locking_inset->LyxCode() == Inset::MATH_CODE)
-               static_cast<InsetFormula*>(current_view->the_locking_inset)->LocalDispatch(current_view, LFUN_SELFINSERT, tmp);
+        if (current_view->theLockingInset()->LyxCode() == Inset::MATH_CODE)
+               static_cast<InsetFormula*>(current_view->theLockingInset())->LocalDispatch(current_view, LFUN_SELFINSERT, tmp);
         else
                lyxerr << "Math error: attempt to write on a wrong "
                        "class of inset." << endl;
@@ -363,7 +363,7 @@ bool math_insert_greek(char c)
 void math_insert_symbol(string const & s)
 {
    if (current_view->available())   {
-      if (!current_view->the_locking_inset) {
+      if (!current_view->theLockingInset()) {
         InsetFormula * new_inset = new InsetFormula();
         current_view->beforeChange();
         current_view->insertInset(new_inset);
@@ -371,8 +371,8 @@ void math_insert_symbol(string const & s)
         new_inset->Edit(current_view, 0, 0, 0);
         new_inset->InsertSymbol(current_view, s);
       } else
-       if (current_view->the_locking_inset->LyxCode() == Inset::MATH_CODE)
-               static_cast<InsetFormula*>(current_view->the_locking_inset)->InsertSymbol(current_view, s);
+       if (current_view->theLockingInset()->LyxCode() == Inset::MATH_CODE)
+               static_cast<InsetFormula*>(current_view->theLockingInset())->InsertSymbol(current_view, s);
         else 
                lyxerr << "Math error: attempt to write on a wrong "
                        "class of inset." << endl;
index 8836bccca5ba1bfe941f8a9cfa2930966de4116c..24ff26b183f8c25159986b91d1543562aa014915 100644 (file)
@@ -67,6 +67,7 @@ LyXText::LyXText(InsetText * inset)
 
 void LyXText::init()
 {
+       the_locking_inset = 0;
        firstrow = 0;
        lastrow = 0;
        number_of_rows = 0;
@@ -2380,16 +2381,17 @@ bool LyXText::IsStringInText(LyXParagraph * par,
                             LyXParagraph::size_type pos,
                             string const & str) const
 {
-       if (par) {
-               LyXParagraph::size_type i = 0;
-               while (pos + i < par->Last()
-                      && string::size_type(i) < str.length()
-                      && str[i] == par->GetChar(pos + i)) {
-                       ++i;
-               }
-               if (str.length() == string::size_type(i))
-                       return true;
+       if (!par)
+               return false;
+
+       LyXParagraph::size_type i = 0;
+       while (pos + i < par->Last()
+              && string::size_type(i) < str.length()
+              && str[i] == par->GetChar(pos + i)) {
+               ++i;
        }
+       if (str.length() == string::size_type(i))
+               return true;
        return false;
 }