]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView2.C
Look for mathed xpms. Doesn't do anything yet due to lack of workable XPMs
[lyx.git] / src / BufferView2.C
index f555045e72ce8a73f656339dc791ea245f858339..c467f4922ff0060c13b1cf01a5a450235da02a25 100644 (file)
@@ -63,7 +63,8 @@ bool BufferView::insertLyXFile(string const & filen)
        //
        // Moved from lyx_cb.C (Lgb)
 {
-       if (filen.empty()) return false;
+       if (filen.empty())
+               return false;
 
        string const fname = MakeAbsPath(filen);
 
@@ -314,17 +315,16 @@ bool BufferView::insertInset(Inset * inset, string const & lout)
 }
 
 
-/* This is also a buffer property (ale) */
+// This is also a buffer property (ale)
 // Not so sure about that. a goto Label function can not be buffer local, just
-// think how this will work in a multiwindo/buffer environment, all the
+// think how this will work in a multiwindow/buffer environment, all the
 // cursors in all the views showing this buffer will move. (Lgb)
 // OK, then no cursor action should be allowed in buffer. (ale)
 bool BufferView::gotoLabel(string const & label)
-
 {
        for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
             it != buffer()->inset_iterator_end(); ++it) {
-               vector<string> labels = (*it)->getLabelList();
+               vector<string> labels = it->getLabelList();
                if (find(labels.begin(),labels.end(),label)
                     != labels.end()) {
                        beforeChange(text);
@@ -391,57 +391,7 @@ void BufferView::pasteEnvironment()
 }
 
 
-void BufferView::copy()
-{
-       if (available()) {
-               getLyXText()->copySelection(this);
-               owner()->message(_("Copy"));
-       }
-}
-
-
-void BufferView::cut(bool realcut)
-{
-       if (available()) {
-               hideCursor();
-               update(text, BufferView::SELECT|BufferView::FITCUR);
-               text->cutSelection(this, true, realcut);
-               update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-               owner()->message(_("Cut"));
-       }
-}
-
-
-void BufferView::paste()
-{
-       if (!available())
-               return;
-
-       owner()->message(_("Paste"));
-
-       hideCursor();
-       // clear the selection
-       toggleSelection();
-       text->clearSelection();
-       update(text, BufferView::SELECT|BufferView::FITCUR);
-
-       // paste
-       text->pasteSelection(this);
-       // bug 393
-       text->clearSelection();
-       update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-// why fake a selection only I think it should be a real one and not only
-// a painted one (Jug 20020318).
-#if 0
-       // clear the selection
-       toggleSelection();
-       text->clearSelection();
-       update(text, BufferView::SELECT|BufferView::FITCUR);
-#endif
-}
-
-
-/* these functions are for the spellchecker */
+// these functions are for the spellchecker
 WordLangTuple const BufferView::nextWord(float & value)
 {
        if (!available()) {
@@ -455,7 +405,8 @@ WordLangTuple const BufferView::nextWord(float & value)
 
 void BufferView::selectLastWord()
 {
-       if (!available()) return;
+       if (!available())
+               return;
 
        LyXCursor cur = text->selection.cursor;
        hideCursor();
@@ -481,17 +432,18 @@ void BufferView::endOfSpellCheck()
 
 void BufferView::replaceWord(string const & replacestring)
 {
-       if (!available()) return;
+       if (!available())
+               return;
 
        LyXText * tt = getLyXText();
        hideCursor();
        update(tt, BufferView::SELECT|BufferView::FITCUR);
 
-       /* clear the selection (if there is any) */
+       // clear the selection (if there is any)
        toggleSelection(false);
        update(tt, BufferView::SELECT|BufferView::FITCUR);
 
-       /* clear the selection (if there is any) */
+       // clear the selection (if there is any)
        toggleSelection(false);
        tt->replaceSelectionWithString(this, replacestring);
 
@@ -525,26 +477,24 @@ bool BufferView::lockInset(UpdatableInset * inset)
                        }
                }
                // Then do a deep look of the inset and lock the right one
-               Paragraph * par = &*(buffer()->paragraphs.begin());
                int const id = inset->id();
-               while (par) {
-                       InsetList::iterator it =
-                               par->insetlist.begin();
-                       InsetList::iterator const end =
-                               par->insetlist.end();
+               ParagraphList::iterator pit = buffer()->paragraphs.begin();
+               ParagraphList::iterator pend = buffer()->paragraphs.end();
+               for (; pit != pend; ++pit) {
+                       InsetList::iterator it = pit->insetlist.begin();
+                       InsetList::iterator end = pit->insetlist.end();
                        for (; it != end; ++it) {
                                if (it.getInset() == inset) {
-                                       text->setCursorIntern(this, par, it.getPos());
+                                       text->setCursorIntern(this, &*pit, it.getPos());
                                        theLockingInset(inset);
                                        return true;
                                }
                                if (it.getInset()->getInsetFromID(id)) {
-                                       text->setCursorIntern(this, par, it.getPos());
+                                       text->setCursorIntern(this, &*pit, it.getPos());
                                        it.getInset()->edit(this);
                                        return theLockingInset()->lockInsetInInset(this, inset);
                                }
                        }
-                       par = par->next();
                }
                return false;
        }