John's VCLog patch + a ChangeLog entry I missed last time

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1910 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-04-11 17:53:45 +00:00
parent 87998757a9
commit aba7831f62
6 changed files with 53 additions and 25 deletions

View 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> 2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* ControlExternal.C: from Angus, clone the new InsetExternal * ControlExternal.C: from Angus, clone the new InsetExternal

View File

@ -1,5 +1,5 @@
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
@ -12,11 +12,14 @@
* \author Angus Leeming <a.leeming@ic.ac.uk> * \author Angus Leeming <a.leeming@ic.ac.uk>
*/ */
#include <fstream>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <config.h> #include <config.h>
#include "Lsstream.h"
#include "ControlVCLog.h" #include "ControlVCLog.h"
#include "buffer.h" #include "buffer.h"
#include "LyXView.h" #include "LyXView.h"
@ -24,6 +27,7 @@
#include "lyxrc.h" #include "lyxrc.h"
using SigC::slot; using SigC::slot;
using std::endl;
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d) ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, d) : ControlDialog<ControlConnectBD>(lv, d)
@ -31,19 +35,31 @@ ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
d_.showVCLogFile.connect(slot(this, &ControlVCLog::show)); d_.showVCLogFile.connect(slot(this, &ControlVCLog::show));
} }
// FIXME: this is all wrong, getLogFile() actually creates a file string const ControlVCLog::getBufferFileName() const
// which we must unlink.
// FIXME: I need to get the Buffer Filename for my window title, need
// to add to params.
void ControlVCLog::setParams()
{ {
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;
} }

View File

@ -16,8 +16,6 @@
#ifndef CONTROLVCLOG_H #ifndef CONTROLVCLOG_H
#define CONTROLVCLOG_H #define CONTROLVCLOG_H
#include <utility>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
@ -27,22 +25,20 @@
/** /**
* A controller for the Version Control log viewer. * A controller for the Version Control log viewer.
*/ */
class stringstream;
class ControlVCLog : public ControlDialog<ControlConnectBD> { class ControlVCLog : public ControlDialog<ControlConnectBD> {
public: public:
/// ///
ControlVCLog(LyXView &, Dialogs &); ControlVCLog(LyXView &, Dialogs &);
/// /// get a stringstream containing the log file
string const & logfile() { return logfile_; } std::stringstream & getVCLogFile(std::stringstream & ss) const;
/// get the filename of the buffer
string const getBufferFileName() const;
private: private:
/// ///
virtual void apply() {} 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 #endif // CONTROLVCLOG_H

View 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> 2001-04-06 John Levon <moz@compsoc.man.ac.uk>
* forms/form_external.fd: make params update state (from Angus) * forms/form_external.fd: make params update state (from Angus)

View File

@ -13,6 +13,7 @@
#include "FormVCLog.h" #include "FormVCLog.h"
#include "form_browser.h" #include "form_browser.h"
#include "gettext.h" #include "gettext.h"
#include "Lsstream.h"
FormVCLog::FormVCLog(ControlVCLog & c) FormVCLog::FormVCLog(ControlVCLog & c)
: FormCB<ControlVCLog, FormBrowser>(c, _("Version Control Log")) : FormCB<ControlVCLog, FormBrowser>(c, _("Version Control Log"))
@ -23,8 +24,8 @@ void FormVCLog::update()
{ {
fl_clear_browser(dialog_->browser); fl_clear_browser(dialog_->browser);
if (controller().logfile().empty() || std::stringstream ss;
!fl_load_browser(dialog_->browser, controller().logfile().c_str()))
fl_add_browser_line(dialog_->browser, fl_add_browser_line(dialog_->browser,
_("No version control log file available")); controller().getVCLogFile(ss).str().c_str());
} }

View 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> 2001-04-06 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insettext.C (InsetText): fix new * insettext.C (InsetText): fix new