]> git.lyx.org Git - lyx.git/blobdiff - src/lyxvc.C
fix some C++ parsing bugs
[lyx.git] / src / lyxvc.C
index 92670f2a17d8a547bf436eff77847fe8cf86178d..ddf087580a90c681921398b4338cb6f5076be719 100644 (file)
@@ -1,16 +1,12 @@
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "lyxvc.h"
 #include "vc-backend.h"
 #include "debug.h"
 #include "buffer.h"
 #include "BufferView.h"
-#include "lyxfunc.h"
 #include "gettext.h"
+#include "funcrequest.h"
 
 #include "frontends/Alert.h"
 #include "frontends/LyXView.h"
 using std::endl;
 using std::pair;
 
+/* WARNING: Several of the vcs-> methods end up
+ * deleting this object via BufferView::reload() !
+ */
+
 LyXVC::LyXVC()
 {
        vcs = 0;
@@ -76,7 +76,7 @@ void LyXVC::buffer(Buffer * buf)
 void LyXVC::registrer()
 {
        string const filename = owner_->fileName();
+
        // there must be a file to save
        if (!IsFileReadable(filename)) {
                Alert::alert(_("File not saved"),
@@ -113,14 +113,13 @@ void LyXVC::registrer()
                        MakeDisplayPath(filename, 50),
                        _("Save document and proceed?"))) {
                vcs->owner()->getUser()->owner()
-                       ->getLyXFunc().dispatch(LFUN_MENUWRITE);
+                       ->dispatch(FuncRequest(LFUN_MENUWRITE));
        }
 
        // Maybe the save fails, or we answered "no". In both cases,
        // the document will be dirty, and we abort.
-       if (!vcs->owner()->isClean()) {
+       if (!vcs->owner()->isClean())
                return;
-       }
 
        lyxerr[Debug::LYXVC] << "LyXVC: registrer" << endl;
        pair<bool, string> tmp =
@@ -146,14 +145,13 @@ void LyXVC::checkIn()
                        MakeDisplayPath(vcs->owner()->fileName(), 50),
                        _("Save document and proceed?"))) {
                vcs->owner()->getUser()->owner()
-                       ->getLyXFunc().dispatch(LFUN_MENUWRITE);
+                       ->dispatch(FuncRequest(LFUN_MENUWRITE));
        }
 
        // Maybe the save fails, or we answered "no". In both cases,
        // the document will be dirty, and we abort.
-       if (!vcs->owner()->isClean()) {
+       if (!vcs->owner()->isClean())
                return;
-       }
 
        lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
        pair<bool, string> tmp = Alert::askForText(_("LyX VC: Log Message"));
@@ -179,7 +177,6 @@ void LyXVC::checkOut()
        }
 
        vcs->checkOut();
-
 }