From: Angus Leeming Date: Wed, 11 Apr 2001 17:53:45 +0000 (+0000) Subject: John's VCLog patch + a ChangeLog entry I missed last time X-Git-Tag: 1.6.10~21319 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=aba7831f628131faf2f711d20d3d5ad7946976e3;p=features.git 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 --- diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 972ab96a4d..7cc6915d08 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,9 @@ +2001-04-06 John Levon + + * ControlVCLog.h: + * ControlVCLog.C: fill a stringstream with the log contents + and then delete it + 2001-04-06 John Levon * ControlExternal.C: from Angus, clone the new InsetExternal diff --git a/src/frontends/controllers/ControlVCLog.C b/src/frontends/controllers/ControlVCLog.C index 83c71f7bfa..e22cb5e520 100644 --- a/src/frontends/controllers/ControlVCLog.C +++ b/src/frontends/controllers/ControlVCLog.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -12,11 +12,14 @@ * \author Angus Leeming */ +#include + #ifdef __GNUG__ #pragma implementation #endif #include +#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(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; } diff --git a/src/frontends/controllers/ControlVCLog.h b/src/frontends/controllers/ControlVCLog.h index 790d4418a7..509a24bcb8 100644 --- a/src/frontends/controllers/ControlVCLog.h +++ b/src/frontends/controllers/ControlVCLog.h @@ -16,8 +16,6 @@ #ifndef CONTROLVCLOG_H #define CONTROLVCLOG_H -#include - #ifdef __GNUG__ #pragma interface #endif @@ -27,22 +25,20 @@ /** * A controller for the Version Control log viewer. */ +class stringstream; + class ControlVCLog : public ControlDialog { 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 diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 864da918d7..43d1fe7104 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2001-04-06 John Levon + + * FormVCLog.C: the log appears as a stringstream now + 2001-04-06 John Levon * forms/form_external.fd: make params update state (from Angus) diff --git a/src/frontends/xforms/FormVCLog.C b/src/frontends/xforms/FormVCLog.C index b58b93ac65..7620ad4c83 100644 --- a/src/frontends/xforms/FormVCLog.C +++ b/src/frontends/xforms/FormVCLog.C @@ -13,6 +13,7 @@ #include "FormVCLog.h" #include "form_browser.h" #include "gettext.h" +#include "Lsstream.h" FormVCLog::FormVCLog(ControlVCLog & c) : FormCB(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()); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ab6277be8e..e16422c244 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2001-04-06 John Levon + + * insetexternal.h: + * insetexternal.C: set view on Clone. Add _ to private members. + 2001-04-06 Lars Gullik Bjønnes * insettext.C (InsetText): fix new