+2003-12-05 Angus Leeming <leeming@lyx.org>
+
+ * lyxfunc.C (dispatch): DIALOG_SHOW now handles "latexlog" and
+ "vclog" explicitly, passing the appropriate "<logtype> <filename>"
+ data to the re-worked "log" dialog.
2003-12-03 André Pönitz <poenitz@gmx.net>
+2003-12-05 Angus Leeming <leeming@lyx.org>
+
+ * ControlLog.[Ch]: re-worked so that it is passed the logtype and
+ filename rather than extracting them from the kernel.
+
2003-12-04 Angus Leeming <leeming@lyx.org>
* ControlExternal.[Ch] (bbChanged): new accessor functions to a
#include "ControlLog.h"
+#include "gettext.h"
+#include "lyxlex.h"
+#include "support/std_sstream.h"
+
+#include <fstream>
+
+using std::istringstream;
+using std::ostream;
using std::string;
ControlLog::ControlLog(Dialog & parent)
- : Dialog::Controller(parent)
+ : Dialog::Controller(parent),
+ type_(LatexLog)
{}
-bool ControlLog::initialiseParams(string const &)
+bool ControlLog::initialiseParams(string const & data)
{
- logfile_ = kernel().buffer().getLogName();
+ istringstream is(data);
+ LyXLex lex(0,0);
+ lex.setStream(is);
+
+ string logtype, logfile;
+ lex >> logtype >> logfile;
+ if (!lex)
+ // Parsing of the data failed.
+ return false;
+
+ if (logtype == "latex")
+ type_ = LatexLog;
+ else if (logtype == "literate")
+ type_ = LiterateLog;
+ else if (logtype == "lyx2lyx")
+ type_ = Lyx2lyxLog;
+ else if (logtype == "vc")
+ type_ = VCLog;
+ else
+ return false;
+
+ logfile_ = logfile;
return true;
}
void ControlLog::clearParams()
{
- logfile_.second.erase();
+ logfile_.erase();
+}
+
+
+string const ControlLog::title() const
+{
+ string t;
+ switch (type_) {
+ case LatexLog:
+ t = _("LyX: LaTeX Log");
+ break;
+ case LiterateLog:
+ t = _("LyX: Literate Programming Build Log");
+ break;
+ case Lyx2lyxLog:
+ t = _("LyX: lyx2lyx error Log");
+ break;
+ case VCLog:
+ t = _("Version Control Log");
+ break;
+ }
+ return t;
+}
+
+
+void ControlLog::getContents(std::ostream & ss) const
+{
+ std::ifstream in(logfile_.c_str());
+
+ bool success = false;
+
+ if (in) {
+ ss << in.rdbuf();
+ success = ss.good();
+ }
+
+ if (success)
+ return;
+
+ switch (type_) {
+ case LatexLog:
+ ss << _("No LaTeX log file found.");
+ break;
+ case LiterateLog:
+ ss << _("No literate programming build log file found.");
+ break;
+ case Lyx2lyxLog:
+ ss << _("No lyx2lyx error log file found.");
+ break;
+ case VCLog:
+ ss << _("No version control log file found.");
+ break;
+ }
}
#define CONTROLLOG_H
#include "Dialog.h"
-#include "buffer.h" // Buffer::LogType
-#include <utility>
/**
* A controller for a read-only text browser.
public:
///
ControlLog(Dialog &);
- ///
+ /** \param data should contain "<logtype> <logfile>"
+ * where <logtype> is one of "latex", "literate", "lyx2lyx", "vc".
+ */
virtual bool initialiseParams(std::string const & data);
///
virtual void clearParams();
virtual void dispatchParams() {}
///
virtual bool isBufferDependent() const { return true; }
- ///
- std::pair<Buffer::LogType, std::string> const & logfile() const {
- return logfile_;
- }
+
+ /// The title displayed by the dialog reflects the \c LOGTYPE
+ std::string const title() const;
+ /// put the log file into the ostream
+ void getContents(std::ostream & ss) const;
+
private:
+ /// Recognized log file-types
+ enum LOGTYPE {
+ LatexLog,
+ LiterateLog,
+ Lyx2lyxLog,
+ VCLog
+ };
- std::pair<Buffer::LogType, std::string> logfile_;
+ LOGTYPE type_;
+ std::string logfile_;
};
#endif // CONTROLLOG_H
+2003-12-05 Angus Leeming <leeming@lyx.org>
+
+ * QLog.C: much simplified, thanks to the more powerful interface
+ of ControlLog.
+
+ * Dialogs.C: no need anymore to build a separate VCLog dialog.
+
2003-12-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ui/QExternalDialogBase.ui: improved layout.
#include "ControlTabular.h"
#include "ControlTabularCreate.h"
#include "ControlToc.h"
-#include "ControlVCLog.h"
#include "ControlVSpace.h"
#include "ControlWrap.h"
#include "QTexinfo.h"
#include "QToc.h"
#include "QURL.h"
-#include "QVCLog.h"
#include "QVSpace.h"
#include "QWrap.h"
char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "branch",
"changes", "character", "citation", "error", "errorlist", "ert", "external", "file",
-"float", "graphics", "include", "index", "label", "latexlog",
+"float", "graphics", "include", "index", "label", "log",
"mathpanel", "mathdelimiter", "mathmatrix",
"minipage", "note", "paragraph", "ref", "tabular", "tabularcreate", "texinfo",
"thesaurus",
#endif
-"toc", "url", "vclog", "vspace", "wrap" };
+"toc", "url", "vspace", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
_("LyX: Label"),
qt_("&Label")));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
- } else if (name == "latexlog") {
+ } else if (name == "log") {
dialog->setController(new ControlLog(*dialog));
dialog->setView(new QLog(*dialog));
dialog->bc().bp(new OkCancelPolicy);
dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QURL(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
- } else if (name == "vclog") {
- dialog->setController(new ControlVCLog(*dialog));
- dialog->setView(new QVCLog(*dialog));
- dialog->bc().bp(new OkCancelPolicy);
} else if (name == "vspace") {
dialog->setController(new ControlVSpace(*dialog));
dialog->setView(new QVSpace(*dialog));
#include <config.h>
-#include "debug.h"
-#include "qt_helpers.h"
-#include "ControlLog.h"
-#include "support/std_sstream.h"
+#include "controllers/ControlLog.h"
-#include <qtextview.h>
-#include <qpushbutton.h>
+#include "support/std_sstream.h"
-#include "QLogDialog.h"
#include "QLog.h"
-#include "Qt2BC.h"
+#include "QLogDialog.h"
-#include <fstream>
+#include "qt_helpers.h"
+
+#include <qtextview.h>
+#include <qpushbutton.h>
-using std::ifstream;
-using std::ostringstream;
-using std::string;
typedef QController<ControlLog, QView<QLogDialog> > base_class;
QLog::QLog(Dialog & parent)
- : base_class(parent, _("LyX: LaTeX Log"))
-{
-}
+ : base_class(parent, "")
+{}
void QLog::build_dialog()
{
dialog_.reset(new QLogDialog(this));
-
- bcview().setCancel(dialog_->closePB);
}
void QLog::update_contents()
{
- std::pair<Buffer::LogType, string> const & logfile =
- controller().logfile();
-
- if (logfile.first == Buffer::buildlog)
- setTitle(_("Build log"));
- else
- setTitle(_("LaTeX log"));
-
- dialog_->logTV->setText("");
-
- ifstream ifstr(logfile.second.c_str());
- if (!ifstr) {
- if (logfile.first == Buffer::buildlog)
- dialog_->logTV->setText(qt_("No build log file found."));
- else
- dialog_->logTV->setText(qt_("No LaTeX log file found."));
- return;
- }
+ setTitle(controller().title());
- ostringstream ost;
- ost << ifstr.rdbuf();
+ std::ostringstream ss;
+ controller().getContents(ss);
- dialog_->logTV->setText(toqstr(ost.str()));
+ dialog_->logTV->setText(toqstr(ss.str()));
}
+2003-12-05 Angus Leeming <leeming@lyx.org>
+
+ * FormLog.C: much simplified, thanks to the more powerful interface
+ of ControlLog.
+
+ * Dialogs.C: no need anymore to build a separate VCLog dialog.
+
2003-12-05 Angus Leeming <leeming@lyx.org>
* forms/form_external.fd: try and mimic Jürgen's changes to
#include "ControlTabular.h"
#include "ControlTabularCreate.h"
#include "ControlToc.h"
-#include "ControlVCLog.h"
#include "ControlVSpace.h"
#include "ControlWrap.h"
#include "FormText.h"
#include "FormToc.h"
#include "FormUrl.h"
-#include "FormVCLog.h"
#include "FormVSpace.h"
#include "FormWrap.h"
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "branch", "box", "changes",
"character", "citation", "error", "errorlist" , "ert", "external", "file",
-"float", "graphics", "include", "index", "label", "latexlog", "mathpanel",
+"float", "graphics", "include", "index", "label", "log", "mathpanel",
"mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek",
"mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators",
"thesaurus",
#endif
-"toc", "url", "vclog", "vspace", "wrap" };
+"toc", "url", "vspace", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
dialog->setView(new FormText(*dialog,
_("Label"), _("Label:|#L")));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
- } else if (name == "latexlog") {
+ } else if (name == "log") {
dialog->setController(new ControlLog(*dialog));
dialog->setView(new FormLog(*dialog));
dialog->bc().bp(new OkCancelPolicy);
dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new FormUrl(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
- } else if (name == "vclog") {
- dialog->setController(new ControlVCLog(*dialog));
- dialog->setView(new FormVCLog(*dialog));
- dialog->bc().bp(new OkCancelPolicy);
} else if (name == "vspace") {
dialog->setController(new ControlVSpace(*dialog));
dialog->setView(new FormVSpace(*dialog));
#include "ControlLog.h"
#include "forms/form_browser.h"
-#include "xformsBC.h"
+#include "support/std_sstream.h"
#include "lyx_forms.h"
-using std::string;
-
-
FormLog::FormLog(Dialog & parent)
- : FormController<ControlLog, FormBrowser>(parent, _("LaTeX Log"))
+ : FormController<ControlLog, FormBrowser>(parent, "")
{}
void FormLog::update()
{
- bool const buildlog = controller().logfile().first == Buffer::buildlog;
+ setTitle(controller().title());
- string const title = buildlog ?
- _("LyX: LaTeX Log") :
- _("LyX: Literate Programming Build Log");
- setTitle(title);
+ std::ostringstream ss;
+ controller().getContents(ss);
fl_clear_browser(dialog_->browser);
- int const valid = fl_load_browser(dialog_->browser,
- controller().logfile().second.c_str());
- if (!valid) {
- string const error = buildlog ?
- _("No LaTeX log file found.") :
- _("No Literate Programming build log file found.");
- fl_add_browser_line(dialog_->browser, error.c_str());
- }
+ fl_add_browser_line(dialog_->browser, ss.str().c_str());
}
using std::endl;
using std::make_pair;
+using std::pair;
using std::string;
using std::istringstream;
data = freefont2string();
if (!data.empty())
owner->getDialogs().show("character", data);
- } else if (name == "document")
+ }
+ else if (name == "document")
owner->getDialogs().showDocument();
else if (name == "findreplace")
owner->getDialogs().showSearch();
owner->getDialogs().showPrint();
else if (name == "spellchecker")
owner->getDialogs().showSpellchecker();
+
+ else if (name == "latexlog") {
+ pair<Buffer::LogType, string> const logfile =
+ owner->buffer()->getLogName();
+ switch (logfile.first) {
+ case Buffer::latexlog:
+ data = "latex ";
+ break;
+ case Buffer::buildlog:
+ data = "literate ";
+ break;
+ }
+ data += logfile.second;
+ owner->getDialogs().show("log", data);
+ }
+ else if (name == "vclog") {
+ string const data = "vc " +
+ owner->buffer()->lyxvc().getLogFile();
+ owner->getDialogs().show("log", data);
+ }
else
owner->getDialogs().show(name, data);
break;