+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
/* 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"
#include "lyxrc.h"
using SigC::slot;
+using std::endl;
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, 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;
}
#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
+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)
#include "FormVCLog.h"
#include "form_browser.h"
#include "gettext.h"
+#include "Lsstream.h"
FormVCLog::FormVCLog(ControlVCLog & c)
: FormCB<ControlVCLog, FormBrowser>(c, _("Version Control Log"))
{
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());
}
+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