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>
* ControlExternal.C: from Angus, clone the new InsetExternal

View File

@ -1,5 +1,5 @@
/* This file is part of
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
@ -12,11 +12,14 @@
* \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;
}

View File

@ -16,8 +16,6 @@
#ifndef CONTROLVCLOG_H
#define CONTROLVCLOG_H
#include <utility>
#ifdef __GNUG__
#pragma interface
#endif
@ -27,22 +25,20 @@
/**
* 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

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>
* forms/form_external.fd: make params update state (from Angus)

View 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());
}

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>
* insettext.C (InsetText): fix new