]> git.lyx.org Git - features.git/commitdiff
John's VCLog patch + a ChangeLog entry I missed last time
authorAngus Leeming <leeming@lyx.org>
Wed, 11 Apr 2001 17:53:45 +0000 (17:53 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 11 Apr 2001 17:53:45 +0000 (17:53 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1910 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlVCLog.C
src/frontends/controllers/ControlVCLog.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormVCLog.C
src/insets/ChangeLog

index 972ab96a4df69166525a269e7ae43b4550290e60..7cc6915d08cb09f3f7275ecf1f73f6c357253226 100644 (file)
@@ -1,3 +1,9 @@
+2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * ControlVCLog.h:
+       * ControlVCLog.C: fill a stringstream with the log contents
+       and then delete it
+
 2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
 
        * ControlExternal.C: from Angus, clone the new InsetExternal
index 83c71f7bfaa73f65913c0cb7cdf86e51ddabdeef..e22cb5e5201a34cdffa74e1286d23a810e981432 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of
- * ====================================================== 
+ * ======================================================
  *
  *           LyX, The Document Processor
  *
  * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
+#include <fstream>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include <config.h>
+#include "Lsstream.h"
 #include "ControlVCLog.h"
 #include "buffer.h"
 #include "LyXView.h"
@@ -24,6 +27,7 @@
 #include "lyxrc.h"
 
 using SigC::slot;
+using std::endl;
 
 ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
        : ControlDialog<ControlConnectBD>(lv, d)
@@ -31,19 +35,31 @@ ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
        d_.showVCLogFile.connect(slot(this, &ControlVCLog::show));
 }
 
-// FIXME: this is all wrong, getLogFile() actually creates a file
-// which we must unlink.
-
-// FIXME: I need to get the Buffer Filename for my window title, need
-// to add to params. 
-
-void ControlVCLog::setParams()
+string const ControlVCLog::getBufferFileName() const
 {
-       logfile_ = lv_.view()->buffer()->lyxvc.getLogFile();
+       return lv_.view()->buffer()->fileName();
 }
 
 
-void ControlVCLog::clearParams()
+std::stringstream & ControlVCLog::getVCLogFile(std::stringstream & ss) const
 {
-       logfile_.erase();
+       string const name = lv_.view()->buffer()->lyxvc.getLogFile();
+
+       std::ifstream in(name.c_str());
+
+       bool found = (in.get());
+
+       if (found) {
+               in.seekg(0, std::ios::beg); // rewind to the beginning
+
+               ss << in.rdbuf();
+               found = ss.good();
+       }
+       
+       if (!found)
+               ss << "No version control log file found." << endl;
+
+       lyx::unlink(name);
+
+       return ss;
 }
index 790d4418a70a9b074392dc7d0557f37d282a0ac5..509a24bcb89a77f7bf0f271d616ea02af5fa4d91 100644 (file)
@@ -16,8 +16,6 @@
 #ifndef CONTROLVCLOG_H
 #define CONTROLVCLOG_H
 
-#include <utility>
-
 #ifdef __GNUG__
 #pragma interface
 #endif
 /**
  * A controller for the Version Control log viewer.
  */
+class stringstream;
+
 class ControlVCLog : public ControlDialog<ControlConnectBD> {
 public:
        ///
        ControlVCLog(LyXView &, Dialogs &);
-       ///
-       string const & logfile() { return logfile_; }
+       /// get a stringstream containing the log file
+       std::stringstream & getVCLogFile(std::stringstream & ss) const;
+       /// get the filename of the buffer
+       string const getBufferFileName() const;
 
 private:
        ///
        virtual void apply() {}
-       /// set the params before show or update
-       virtual void setParams();
-       /// clean-up on hide.
-       virtual void clearParams();
-
-       string logfile_;
 };
 
 #endif // CONTROLVCLOG_H
index 864da918d703c7dbc464e70a2410dca6aff2c44d..43d1fe71040a03c08a7f91315662f6c0f5911d16 100644 (file)
@@ -1,3 +1,7 @@
+2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * FormVCLog.C: the log appears as a stringstream now
+
 2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
 
        * forms/form_external.fd: make params update state (from Angus)
index b58b93ac65db7ddc89aeb3599706b956669e01ea..7620ad4c839c4834322a72901fadb06d210a11cb 100644 (file)
@@ -13,6 +13,7 @@
 #include "FormVCLog.h"
 #include "form_browser.h"
 #include "gettext.h"
+#include "Lsstream.h"
 
 FormVCLog::FormVCLog(ControlVCLog & c)
        : FormCB<ControlVCLog, FormBrowser>(c, _("Version Control Log"))
@@ -23,8 +24,8 @@ void FormVCLog::update()
 {
        fl_clear_browser(dialog_->browser);
 
-       if (controller().logfile().empty() ||
-           !fl_load_browser(dialog_->browser, controller().logfile().c_str()))
-               fl_add_browser_line(dialog_->browser,
-                                   _("No version control log file available"));
+       std::stringstream ss;
+       fl_add_browser_line(dialog_->browser,
+                           controller().getVCLogFile(ss).str().c_str());
 }
index ab6277be8eddd59083a88cb477c2d93434db7a12..e16422c244f5b53ac958763e67a97696d395107d 100644 (file)
@@ -1,3 +1,8 @@
+2001-04-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * insetexternal.h:
+       * insetexternal.C: set view on Clone. Add _ to private members.
+
 2001-04-06  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * insettext.C (InsetText): fix new