]> git.lyx.org Git - features.git/commitdiff
Fix for VCS after the revert patch.
authorJohn Levon <levon@movementarian.org>
Sat, 8 Mar 2003 05:37:54 +0000 (05:37 +0000)
committerJohn Levon <levon@movementarian.org>
Sat, 8 Mar 2003 05:37:54 +0000 (05:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6385 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/BufferView.h
src/ChangeLog
src/lyxfunc.C
src/lyxfunc.h
src/lyxvc.C
src/vc-backend.C
src/vc-backend.h

index 293e0f9f4ed9452c6b1d76dcd9a966b82ff5a9c3..618d55580e3066ea80195c833acf650b62f5156e 100644 (file)
@@ -102,6 +102,14 @@ void BufferView::buffer(Buffer * b)
 }
 
 
+void BufferView::reload()
+{
+       string const fn = buffer()->fileName();
+       if (bufferlist.close(buffer()))
+               buffer(bufferlist.loadLyXFile(fn));
+}
+
+
 void BufferView::resize()
 {
        if (pimpl_->buffer_) {
index 77aff425ef7ea5443b348333dbe9d2c02d7c2266..a7398d07776fe474681622276008c1c497397e6b 100644 (file)
@@ -79,6 +79,9 @@ public:
         */
        void repaint();
 
+       /// reload the contained buffer
+       void reload();
+
        /// fit the user cursor within the visible view
        bool fitCursor();
        /// perform pending painting updates
index 4e40deedfa741dffdfc7760ee6b7353ce218df76..5463c31b3ab4aadc07ef437f68c53463d5388b89 100644 (file)
@@ -1,3 +1,17 @@
+2003-03-08  John Levon  <levon@movementarian.org>
+
+       * lyxfunc.h:
+       * lyxfunc.C: move reloadBuffer()
+
+       * BufferView.h:
+       * BufferView.C: to here
+
+       * lyxvc.C: add comment
+
+       * vc-backend.h:
+       * vc-backend.C: call bv->reload() to avoid
+         getStatus() check on MENURELOAD
+
 2003-03-07  Dekel Tsur  <dekelts@tau.ac.il>
 
        * LaTeX.C (run): Fix a bug where the DVI file was not updated due
index 64b89f17850f1c32eb3550e233d9ad8af280049b..0092cc52960cefbd1c274716c2dec8130c377424 100644 (file)
@@ -1023,7 +1023,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                break;
 
        case LFUN_MENURELOAD:
-               reloadBuffer();
+               view()->reload();
                break;
 
        case LFUN_UPDATE:
@@ -1876,14 +1876,6 @@ void LyXFunc::doImport(string const & argument)
 }
 
 
-void LyXFunc::reloadBuffer()
-{
-       string const fn = owner->buffer()->fileName();
-       if (bufferlist.close(owner->buffer()))
-               view()->buffer(bufferlist.loadLyXFile(fn));
-}
-
-
 void LyXFunc::closeBuffer()
 {
        if (bufferlist.close(owner->buffer()) && !quitting) {
index 1482b175cb5cd591c24f3bbab848f1500391a76d..59fb6ac85eeef59243d5667fc112071f2095be0b 100644 (file)
@@ -114,8 +114,6 @@ private:
        ///
        void closeBuffer();
        ///
-       void reloadBuffer();
-       ///
        //  This return or directly text (default) of getLyXText()
        ///
        LyXText * TEXT(bool) const;
index 629e6daebf117943803b158fb3af723fe0efd31d..ddf087580a90c681921398b4338cb6f5076be719 100644 (file)
 using std::endl;
 using std::pair;
 
+/* WARNING: Several of the vcs-> methods end up
+ * deleting this object via BufferView::reload() !
+ */
+
 LyXVC::LyXVC()
 {
        vcs = 0;
@@ -173,7 +177,6 @@ void LyXVC::checkOut()
        }
 
        vcs->checkOut();
-
 }
 
 
index 3e58f9082a8cb8af64f18d319834b5b7a8b402d8..52b9a73f50f3f3bac7eb5351e18c8913bdea6ace 100644 (file)
@@ -45,6 +45,15 @@ int VCS::doVCCommand(string const & cmd, string const & path)
 }
 
 
+void VCS::reload()
+{
+       owner_->getUser()->reload();
+       /* Watch out ! We have deleted ourselves here
+        * via the ->reload() !
+        */
+}
+
+
 RCS::RCS(string const & m)
 {
        master_ = m;
@@ -161,7 +170,6 @@ void RCS::registrer(string const & msg)
        cmd += OnlyFilename(owner_->fileName());
        cmd += '"';
        doVCCommand(cmd, owner_->filePath());
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
 }
 
 
@@ -170,7 +178,7 @@ void RCS::checkIn(string const & msg)
        doVCCommand("ci -q -u -m\"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + '"',
                    owner_->filePath());
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
+       reload();
 }
 
 
@@ -180,7 +188,7 @@ void RCS::checkOut()
        doVCCommand("co -q -l \""
                    + OnlyFilename(owner_->fileName()) + '"',
                    owner_->filePath());
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
+       reload();
 }
 
 
@@ -191,7 +199,7 @@ void RCS::revert()
                    owner_->filePath());
        // We ignore changes and just reload!
        owner_->markClean();
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
+       reload();
 }
 
 
@@ -300,7 +308,7 @@ void CVS::registrer(string const & msg)
        doVCCommand("cvs -q add -m \"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + '"',
                    owner_->filePath());
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
+       reload();
 }
 
 
@@ -309,7 +317,7 @@ void CVS::checkIn(string const & msg)
        doVCCommand("cvs -q commit -m \"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + '"',
                    owner_->filePath());
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
+       reload();
 }
 
 
@@ -329,7 +337,7 @@ void CVS::revert()
        doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + '"',
                    owner_->filePath());
        owner_->markClean();
-       owner_->getUser()->owner()->dispatch(FuncRequest(LFUN_MENURELOAD));
+       reload();
 }
 
 
index 95c084975056dbbe49fbc2d672b9075f0531974d..a42c30f163d87e3719eb342dfc6cba9d0fd8996b 100644 (file)
@@ -59,6 +59,9 @@ protected:
        /// parse information from the version file
        virtual void scanMaster() = 0;
 
+       /// reload the document
+       void reload();
+
        /**
         * doVCCommand - call out to the version control utility
         * @param cmd the command to execute