This patch - introduces two new signals in buffer: busy and message. I've renamed parseError to error because it's used more generally than for parse errors. It could still use a better name maybe.
- adds all three boost::signals::connection objects to BufferView::pimpl + connect/disconnect signals on buffer switching - use the new signals in buffer,converter,importer,exporter - adds a BufferView::newFile method to hide the BufferView::buffer call in that case. I've noticed that converter still needed BufferView: only for getLyXFunc, and that to pass this LyXFunc to LaTeX, who needs it for showing messages ("latex run nr."). So: - adds a 'message' signal to LaTeX - removes lyxfun/view dependency from converter/latex Comments very welcomed. Regards, Alfredo Index: BufferView.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v retrieving revision 1.166 diff -u -p -u -r1.166 BufferView.C --- BufferView.C 30 Jun 2003 23:55:45 -0000 1.166 +++ BufferView.C 2 Jul 2003 20:31:27 -0000 @@ -104,6 +104,12 @@ void BufferView::buffer(Buffer * b) } +bool BufferView::newFile(string const & fn, string const & tn, bool named) +{ + return pimpl_->newFile(fn, tn, named); +} + + bool BufferView::loadLyXFile(string const & fn, bool tl) { return pimpl_->loadLyXFile(fn, tl); Index: BufferView.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v retrieving revision 1.129 diff -u -p -u -r1.129 BufferView.h --- BufferView.h 24 Jun 2003 21:43:25 -0000 1.129 +++ BufferView.h 2 Jul 2003 20:31:27 -0000 @@ -80,6 +80,9 @@ public: /// reload the contained buffer void reload(); + /// create a new buffer based on template + bool newFile(string const & fname, string const & tname, + bool named = true); /// load a buffer into the view bool loadLyXFile(string const & name, bool tolastfiles = true); Index: BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.385 diff -u -p -u -r1.385 BufferView_pimpl.C --- BufferView_pimpl.C 2 Jul 2003 17:09:55 -0000 1.385 +++ BufferView_pimpl.C 2 Jul 2003 20:31:29 -0000 @@ -135,7 +135,35 @@ BufferView::Pimpl::Pimpl(BufferView * bv void BufferView::Pimpl::addError(ErrorItem const & ei) { errorlist_.push_back(ei); +} + +void BufferView::Pimpl::connectBuffer(Buffer & buf) +{ + if (errorConnection_.connected()) + disconnectBuffer(); + + errorConnection_ = buf.error.connect(boost::bind(&BufferView::Pimpl::addError, this, _1)); + messageConnection_ = buf.message.connect(boost::bind(&LyXView::message, owner_, _1)); + busyConnection_ = buf.busy.connect(boost::bind(&LyXView::busy, owner_, _1)); +} + + +void BufferView::Pimpl::disconnectBuffer() +{ + errorConnection_.disconnect(); + messageConnection_.disconnect(); + busyConnection_.disconnect(); +} + + +bool BufferView::Pimpl::newFile(string const & filename, + string const & tname, + bool isNamed) +{ + Buffer * b = ::newFile(filename, tname, isNamed); + buffer(b); + return true; } @@ -169,26 +197,18 @@ bool BufferView::Pimpl::loadLyXFile(stri } Buffer * b = bufferlist.newBuffer(s); - //attach to the error signal in the buffer - b->parseError.connect(boost::bind(&BufferView::Pimpl::addError, - this, _1)); - - bool loaded = ::loadLyXFile(b, s); + connectBuffer(*b); - if (! loaded) { + if (! ::loadLyXFile(b, s)) { bufferlist.release(b); - string text = bformat(_("The document %1$s does " - "not yet exist.\n\n" - "Do you want to create " + string text = bformat(_("The document %1$s does not yet " + "exist.\n\nDo you want to create " "a new document?"), s); int const ret = Alert::prompt(_("Create new document?"), text, 0, 1, _("&Create"), _("Cancel")); - if (ret == 0) - b = newFile(s, string(), true); - else + if (ret != 0) return false; - } buffer(b); @@ -196,12 +216,12 @@ bool BufferView::Pimpl::loadLyXFile(stri if (tolastfiles) lastfiles->newFile(b->fileName()); - if (loaded) - bv_->showErrorList(_("Parse")); + bv_->showErrorList(_("Parse")); return true; } + WorkArea & BufferView::Pimpl::workarea() const { return *workarea_.get(); @@ -225,6 +245,7 @@ void BufferView::Pimpl::buffer(Buffer * lyxerr[Debug::INFO] << "Setting buffer in BufferView (" << b << ')' << endl; if (buffer_) { + disconnectBuffer(); buffer_->delUser(bv_); // Put the old text into the TextCache, but @@ -253,6 +274,7 @@ void BufferView::Pimpl::buffer(Buffer * if (buffer_) { lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl; buffer_->addUser(bv_); + connectBuffer(*buffer_); // If we don't have a text object for this, we make one if (bv_->text == 0) { Index: BufferView_pimpl.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.h,v retrieving revision 1.90 diff -u -p -u -r1.90 BufferView_pimpl.h --- BufferView_pimpl.h 20 Jun 2003 23:03:41 -0000 1.90 +++ BufferView_pimpl.h 2 Jul 2003 20:31:29 -0000 @@ -55,6 +55,8 @@ struct BufferView::Pimpl : public boost: * change but don't need the full update() logic */ /// + bool newFile(string const &, string const &, bool); + /// bool loadLyXFile(string const &, bool); /// void repaint(); @@ -111,7 +113,16 @@ private: ErrorList errorlist_; /// add an error to the list void addError(ErrorItem const &); - + /// buffer errors signal connection + boost::signals::connection errorConnection_; + /// buffer messages signal connection + boost::signals::connection messageConnection_; + /// buffer busy status signal connection + boost::signals::connection busyConnection_; + /// connect to signals in the given buffer + void connectBuffer(Buffer & buf); + /// disconnect from signals in the given buffer + void disconnectBuffer(); /// track changes for the document void trackChanges(); Index: LaTeX.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LaTeX.C,v retrieving revision 1.84 diff -u -p -u -r1.84 LaTeX.C --- LaTeX.C 30 Jun 2003 23:55:49 -0000 1.84 +++ LaTeX.C 2 Jul 2003 20:31:30 -0000 @@ -16,9 +16,7 @@ #include "LaTeX.h" #include "bufferlist.h" #include "gettext.h" -#include "lyxfunc.h" #include "debug.h" -#include "funcrequest.h" #include "support/filetools.h" #include "support/FileInfo.h" #include "support/tostr.h" @@ -70,14 +68,13 @@ extern BufferList bufferlist; namespace { -void showRunMessage(LyXFunc * lf, unsigned int count) +string runMessage(unsigned int count) { - string str = bformat(_("Waiting for LaTeX run number %1$s"), tostr(count)); - lf->dispatch(FuncRequest(LFUN_MESSAGE, str)); + return bformat(_("Waiting for LaTeX run number %1$s"), tostr(count)); } - }; + /* * CLASS TEXERRORS */ @@ -151,7 +148,7 @@ void LaTeX::deleteFilesOnError() const } -int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) +int LaTeX::run(TeXErrors & terr) // We know that this function will only be run if the lyx buffer // has been changed. We also know that a newly written .tex file // is always different from the previous one because of the date @@ -229,10 +226,8 @@ int LaTeX::run(TeXErrors & terr, LyXFunc ++count; lyxerr[Debug::LATEX] << "Run #" << count << endl; - if (lfun) { - showRunMessage(lfun, count); - } - + message(runMessage(count)); + startscript(); scanres = scanLogFile(terr); if (scanres & ERROR_RERUN) { @@ -265,10 +260,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) { // no checks for now lyxerr[Debug::LATEX] << "Running MakeIndex." << endl; - if (lfun) { - lfun->dispatch(FuncRequest(LFUN_MESSAGE, _("Running MakeIndex."))); - } - + message(_("Running MakeIndex.")); rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx"))); } @@ -280,10 +272,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc // tags is found -> run bibtex and set rerun = true; // no checks for now lyxerr[Debug::LATEX] << "Running BibTeX." << endl; - if (lfun) { - lfun->dispatch(FuncRequest(LFUN_MESSAGE, _("Running BibTeX."))); - } - + message(_("Running BibTeX.")); updateBibtexDependencies(head, bibtex_info); rerun |= runBibTeX(bibtex_info); } else if (!had_depfile) { @@ -312,10 +301,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc << "Dep. file has changed or rerun requested" << endl; lyxerr[Debug::LATEX] << "Run #" << count << endl; - if (lfun) { - showRunMessage(lfun, count); - } - + message(runMessage(count)); startscript(); scanres = scanLogFile(terr); if (scanres & ERRORS) { @@ -342,10 +328,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) { // no checks for now lyxerr[Debug::LATEX] << "Running MakeIndex." << endl; - if (lfun) { - lfun->dispatch(FuncRequest(LFUN_MESSAGE, _("Running MakeIndex."))); - } - + message(_("Running MakeIndex.")); rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx"))); } @@ -366,10 +349,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc rerun = false; ++count; lyxerr[Debug::LATEX] << "Run #" << count << endl; - if (lfun) { - showRunMessage(lfun, count); - } - + message(runMessage(count)); startscript(); scanres = scanLogFile(terr); if (scanres & ERRORS) { Index: LaTeX.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LaTeX.h,v retrieving revision 1.35 diff -u -p -u -r1.35 LaTeX.h --- LaTeX.h 22 May 2003 18:58:55 -0000 1.35 +++ LaTeX.h 2 Jul 2003 20:31:30 -0000 @@ -22,8 +22,7 @@ #include <set> #include <boost/utility.hpp> - -class LyXFunc; +#include <boost/signals/signal1.hpp> /// class TeXErrors { @@ -125,6 +124,9 @@ public: WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING }; + /// This signal emits an informative message + boost::signal1<void, string> message; + /** cmd = the latex command, file = name of the (temporary) latex file, @@ -134,7 +136,7 @@ public: string const & file, string const & path); /// runs LaTeX several times - int run(TeXErrors &, LyXFunc *); + int run(TeXErrors &); /// int getNumErrors() { return num_errors;} Index: buffer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v retrieving revision 1.489 diff -u -p -u -r1.489 buffer.C --- buffer.C 30 Jun 2003 23:55:50 -0000 1.489 +++ buffer.C 2 Jul 2003 20:31:33 -0000 @@ -287,8 +287,8 @@ int Buffer::readHeader(LyXLex & lex) "%1$s %2$s\n"), token, lex.getString()); - parseError(ErrorItem(_("Header error"), s, - -1, 0, 0)); + error(ErrorItem(_("Header error"), s, + -1, 0, 0)); } } } @@ -1187,7 +1187,7 @@ void Buffer::makeLinuxDocFile(string con case LATEX_COMMAND: if (depth != 0) - parseError(ErrorItem(_("Error:"), _("Wrong depth for LatexType Command.\n"), pit->id(), 0, pit->size())); + error(ErrorItem(_("Error:"), _("Wrong depth for LatexType Command.\n"), pit->id(), 0, pit->size())); if (!environment_stack[depth].empty()) { sgml::closeTag(ofs, depth, false, environment_stack[depth]); @@ -1642,7 +1642,7 @@ void Buffer::makeDocBookFile(string cons case LATEX_COMMAND: if (depth != 0) - parseError(ErrorItem(_("Error"), _("Wrong depth for LatexType Command."), par->id(), 0, par->size())); + error(ErrorItem(_("Error"), _("Wrong depth for LatexType Command."), par->id(), 0, par->size())); command_name = style->latexname(); @@ -1904,7 +1904,7 @@ int Buffer::runChktex() { if (!users->text) return 0; - users->owner()->busy(true); + busy(true); // get LaTeX-Filename string const name = getLatexName(); @@ -1916,7 +1916,7 @@ int Buffer::runChktex() } Path p(path); // path to LaTeX file - users->owner()->message(_("Running chktex...")); + message(_("Running chktex...")); // Generate the LaTeX file if neccessary LatexRunParams runparams; @@ -1933,10 +1933,10 @@ int Buffer::runChktex() _("Could not run chktex successfully.")); } else if (res > 0) { // Insert all errors as errors boxes - parseErrors(*this, terr); + bufferErrors(*this, terr); } - users->owner()->busy(false); + busy(false); return res; } Index: buffer.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.h,v retrieving revision 1.146 diff -u -p -u -r1.146 buffer.h --- buffer.h 20 Jun 2003 23:03:41 -0000 1.146 +++ buffer.h 2 Jul 2003 20:31:34 -0000 @@ -129,7 +129,11 @@ public: public: /// This signal is emitted when a parsing error shows up. - boost::signal1<void, ErrorItem> parseError; + boost::signal1<void, ErrorItem> error; + /// This signal is emitted when some message shows up. + boost::signal1<void, string> message; + /// This signal is emmtted when the buffer busy status change. + boost::signal1<void, bool> busy; /** Save file. Takes care of auto-save files and backup file if requested. Index: buffer_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer_funcs.C,v retrieving revision 1.3 diff -u -p -u -r1.3 buffer_funcs.C --- buffer_funcs.C 30 Jun 2003 23:55:50 -0000 1.3 +++ buffer_funcs.C 2 Jul 2003 20:31:34 -0000 @@ -200,7 +200,7 @@ Buffer * newFile(string const & filename } -void parseErrors(Buffer const & buf, TeXErrors const & terr) +void bufferErrors(Buffer const & buf, TeXErrors const & terr) { TeXErrors::Errors::const_iterator cit = terr.begin(); TeXErrors::Errors::const_iterator end = terr.end(); @@ -212,20 +212,20 @@ void parseErrors(Buffer const & buf, TeX buf.texrow.getIdFromRow(errorrow, par_id, posstart); int posend = -1; buf.texrow.getIdFromRow(errorrow + 1, par_id, posend); - buf.parseError(ErrorItem(cit->error_desc, + buf.error(ErrorItem(cit->error_desc, cit->error_text, par_id, posstart, posend)); } } -void parseErrors(Buffer const & buf, ErrorList const & el) +void bufferErrors(Buffer const & buf, ErrorList const & el) { ErrorList::const_iterator it = el.begin(); ErrorList::const_iterator end = el.end(); - for (; it != end; ++it) - buf.parseError(*it); + for (; it != end; ++it) + buf.error(*it); } Index: buffer_funcs.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer_funcs.h,v retrieving revision 1.2 diff -u -p -u -r1.2 buffer_funcs.h --- buffer_funcs.h 24 Jun 2003 20:42:12 -0000 1.2 +++ buffer_funcs.h 2 Jul 2003 20:31:34 -0000 @@ -33,8 +33,8 @@ Buffer * newFile(string const & filename ///return the format of the buffer on a string string const BufferFormat(Buffer const & buffer); -void parseErrors(Buffer const &, TeXErrors const &); +void bufferErrors(Buffer const &, TeXErrors const &); -void parseErrors(Buffer const &, ErrorList const &); +void bufferErrors(Buffer const &, ErrorList const &); #endif // BUFFER_FUNCS_H Index: converter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/converter.C,v retrieving revision 1.79 diff -u -p -u -r1.79 converter.C --- converter.C 30 Jun 2003 23:55:51 -0000 1.79 +++ converter.C 2 Jul 2003 20:31:35 -0000 @@ -19,9 +19,7 @@ #include "bufferview_funcs.h" #include "errorlist.h" #include "LaTeX.h" -#include "lyx_cb.h" // ShowMessage() #include "gettext.h" -#include "BufferView.h" #include "debug.h" #include "frontends/Alert.h" @@ -33,6 +31,9 @@ #include "support/tostr.h" #include "support/systemcall.h" +#include <boost/signals/signal1.hpp> +#include <boost/signals/trackable.hpp> + #include <cctype> using namespace lyx::support; @@ -107,8 +108,8 @@ bool operator<(Converter const & a, Conv int const i = compare_ascii_no_case(a.From->prettyname(), b.From->prettyname()); if (i == 0) - return compare_ascii_no_case(a.To->prettyname(), b.To->prettyname()) - < 0; + return compare_ascii_no_case(a.To->prettyname(), + b.To->prettyname()) < 0; else return i < 0; } @@ -333,8 +334,7 @@ bool Converters::convert(Buffer const * lyxerr[Debug::FILES] << "Calling " << command << endl; if (buffer) - ShowMessage(buffer, _("Executing command:"), command); - + buffer->message(_("Executing command: ") + command); Systemcall::Starttype type = (dummy) ? Systemcall::DontWait : Systemcall::Wait; Systemcall one; @@ -446,8 +446,8 @@ bool Converters::move(string const & fro bool Converters::convert(Buffer const * buffer, - string const & from_file, string const & to_file_base, - string const & from_format, string const & to_format) + string const & from_file, string const & to_file_base, + string const & from_format, string const & to_format) { string to_file; return convert(buffer, from_file, to_file_base, from_format, to_format, @@ -473,56 +473,67 @@ bool Converters::scanLog(Buffer const * if (!buffer) return false; - BufferView * bv = buffer->getUser(); LatexRunParams runparams; runparams.flavor = LatexRunParams::LATEX; LaTeX latex("", runparams, filename, ""); TeXErrors terr; int result = latex.scanLogFile(terr); - if (bv && (result & LaTeX::ERRORS)) - parseErrors(*buffer, terr); + if (result & LaTeX::ERRORS) + bufferErrors(*buffer, terr); return true; } +namespace { + +class showMessage : public boost::signals::trackable { +public: + showMessage(Buffer const * b) : buffer_(b) {}; + void operator()(string m) + { + buffer_->message(m); + } +private: + Buffer const * buffer_; +}; + +} bool Converters::runLaTeX(Buffer const * buffer, string const & command, LatexRunParams const & runparams) { + // when is this needed? if (!buffer) return false; - BufferView * bv = buffer->getUser(); - - if (bv) { - bv->owner()->busy(true); - bv->owner()->message(_("Running LaTeX...")); - // all the autoinsets have already been removed - } + buffer->busy(true); + buffer->message(_("Running LaTeX...")); // do the LaTeX run(s) string name = buffer->getLatexName(); LaTeX latex(command, runparams, name, buffer->filePath()); TeXErrors terr; - int result = latex.run(terr, - bv ? &bv->owner()->getLyXFunc() : 0); + showMessage show(buffer); + latex.message.connect(show); + int result = latex.run(terr); - if (bv && (result & LaTeX::ERRORS)) - parseErrors(*buffer, terr); + if (result & LaTeX::ERRORS) + bufferErrors(*buffer, terr); // check return value from latex.run(). if ((result & LaTeX::NO_LOGFILE)) { - string str = bformat(_("LaTeX did not run successfully. Additionally, LyX " - "could not locate the LaTeX log %1$s."), name); + string str = bformat(_("LaTeX did not run successfully. " + "Additionally, LyX could not locate " + "the LaTeX log %1$s."), name); Alert::error(_("LaTeX failed"), str); } else if (result & LaTeX::NO_OUTPUT) { Alert::warning(_("Output is empty"), - _("An empty output file was generated.")); + _("An empty output file was generated.")); } - if (bv) - bv->owner()->busy(false); + + buffer->busy(false); int const ERROR_MASK = LaTeX::NO_LOGFILE | Index: exporter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/exporter.C,v retrieving revision 1.37 diff -u -p -u -r1.37 exporter.C --- exporter.C 30 Jun 2003 23:55:52 -0000 1.37 +++ exporter.C 2 Jul 2003 20:31:35 -0000 @@ -13,7 +13,6 @@ #include "exporter.h" #include "buffer.h" #include "buffer_funcs.h" -#include "lyx_cb.h" //ShowMessage() #include "support/filetools.h" #include "lyxrc.h" #include "converter.h" @@ -108,11 +107,10 @@ bool Exporter::Export(Buffer * buffer, s return false; if (!put_in_tempdir) - ShowMessage(buffer, - _("Document exported as ") - + formats.prettyName(format) - + _(" to file `") - + MakeDisplayPath(result_file) +'\''); + buffer->message(_("Document exported as ") + + formats.prettyName(format) + + _(" to file `") + + MakeDisplayPath(result_file) +'\''); return true; } Index: format.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/format.C,v retrieving revision 1.9 diff -u -p -u -r1.9 format.C --- format.C 30 Jun 2003 23:55:52 -0000 1.9 +++ format.C 2 Jul 2003 20:31:36 -0000 @@ -14,7 +14,6 @@ #include "buffer.h" #include "lyxrc.h" #include "debug.h" -#include "lyx_cb.h" // for ShowMessage() ... to be removed? #include "gettext.h" #include "LString.h" @@ -191,7 +190,7 @@ bool Formats::view(Buffer const * buffer command = subst(command, token_path, QuoteName(OnlyPath(filename))); lyxerr[Debug::FILES] << "Executing command: " << command << std::endl; - ShowMessage(buffer, _("Executing command:"), command); + buffer->message(_("Executing command: ") + command); Path p(OnlyPath(filename)); Systemcall one; Index: importer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/importer.C,v retrieving revision 1.30 diff -u -p -u -r1.30 importer.C --- importer.C 30 Jun 2003 23:55:52 -0000 1.30 +++ importer.C 2 Jul 2003 20:31:36 -0000 @@ -70,7 +70,7 @@ bool Importer::Import(LyXView * lv, stri if (loader_format == "lyx") { lv->view()->loadLyXFile(lyxfile); } else { - lv->view()->buffer(newFile(lyxfile, string(), true)); + lv->view()->newFile(lyxfile, string(), true); bool as_paragraphs = loader_format == "textparagraph"; string filename2 = (loader_format == format) ? filename : ChangeExtension(filename, Index: lyx_cb.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v retrieving revision 1.209 diff -u -p -u -r1.209 lyx_cb.C --- lyx_cb.C 30 Jun 2003 23:55:52 -0000 1.209 +++ lyx_cb.C 2 Jul 2003 20:31:36 -0000 @@ -60,20 +60,6 @@ extern BufferList bufferlist; bool quitting; // flag, that we are quitting the program -void ShowMessage(Buffer const * buf, - string const & msg1, - string const & msg2, - string const & msg3) -{ - if (lyx_gui::use_gui - && buf && buf->getUser() && buf->getUser()->owner()) { - string const str = msg1 + ' ' + msg2 + ' ' + msg3; - buf->getUser()->owner()->message(str); - } else - lyxerr << msg1 << msg2 << msg3 << endl; -} - - // // Menu callbacks // @@ -310,7 +296,7 @@ void AutoSave(BufferView * bv) // create new file with template // SERVERCMD ! // -Buffer * NewFile(string const & filename) +void NewFile(BufferView * bv, string const & filename) { // Split argument by : string name; @@ -328,11 +314,7 @@ Buffer * NewFile(string const & filename << "\nName is " << name << "\nTemplate is " << tmpname << endl; - // find a free buffer - Buffer * tmpbuf = newFile(name, tmpname); - if (tmpbuf) - lastfiles->newFile(tmpbuf->fileName()); - return tmpbuf; + bv->newFile(name, tmpname); } Index: lyx_cb.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.h,v retrieving revision 1.30 diff -u -p -u -r1.30 lyx_cb.h --- lyx_cb.h 10 Jun 2003 14:39:42 -0000 1.30 +++ lyx_cb.h 2 Jul 2003 20:31:36 -0000 @@ -11,11 +11,6 @@ class BufferView; extern bool quitting; /// -void ShowMessage(Buffer const * buf, - string const & msg1, - string const & msg2 = string(), - string const & msg3 = string()); -/// bool MenuWrite(Buffer * buffer); /// write the given file, or ask if no name given bool WriteAs(Buffer * buffer, string const & filename = string()); @@ -24,7 +19,7 @@ void QuitLyX(); /// void AutoSave(BufferView * bv); /// -Buffer * NewFile(string const & filename); +void NewFile(BufferView * bv, string const & filename); /// void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph); /// Index: lyx_main.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_main.C,v retrieving revision 1.153 diff -u -p -u -r1.153 lyx_main.C --- lyx_main.C 30 Jun 2003 23:55:53 -0000 1.153 +++ lyx_main.C 2 Jul 2003 20:31:38 -0000 @@ -157,7 +157,7 @@ LyX::LyX(int & argc, char * argv[]) } last_loaded = bufferlist.newBuffer(s, false); - last_loaded->parseError.connect(boost::bind(&LyX::printError, this, _1)); + last_loaded->error.connect(boost::bind(&LyX::printError, this, _1)); loadLyXFile(last_loaded, s); } Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.459 diff -u -p -u -r1.459 lyxfunc.C --- lyxfunc.C 30 Jun 2003 23:55:53 -0000 1.459 +++ lyxfunc.C 2 Jul 2003 20:31:40 -0000 @@ -1251,13 +1251,8 @@ void LyXFunc::dispatch(FuncRequest const break; case LFUN_FILE_NEW: - { - // servercmd: argument must be <file>:<template> - Buffer * tmpbuf = NewFile(argument); - if (tmpbuf) - view()->buffer(tmpbuf); - } - break; + NewFile(view(), argument); + break; case LFUN_FILE_OPEN: open(argument); @@ -1723,7 +1718,7 @@ void LyXFunc::menuNew(string const & nam templname = fname; } - view()->buffer(newFile(filename, templname, !name.empty())); + view()->newFile(filename, templname, !name.empty()); } @@ -1778,8 +1773,7 @@ void LyXFunc::open(string const & fname) FileInfo const f(filename, true); if (!f.exist()) { // the user specifically chose this name. Believe them. - Buffer * buffer = newFile(filename, "", true); - view()->buffer(buffer); + view()->newFile(filename, "", true); return; } Index: paragraph_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v retrieving revision 1.47 diff -u -p -u -r1.47 paragraph_funcs.C --- paragraph_funcs.C 30 Jun 2003 23:55:56 -0000 1.47 +++ paragraph_funcs.C 2 Jul 2003 20:31:42 -0000 @@ -1009,8 +1009,8 @@ int readParToken(Buffer & buf, Paragraph string const s = bformat(_("Unknown token: %1$s %2$s\n"), token, lex.getString()); - buf.parseError(ErrorItem(_("Unknown token"), s, - par.id(), 0, par.size())); + buf.error(ErrorItem(_("Unknown token"), s, + par.id(), 0, par.size())); return 1; } return 0; Index: text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.378 diff -u -p -u -r1.378 text2.C --- text2.C 1 Jul 2003 11:51:18 -0000 1.378 +++ text2.C 2 Jul 2003 20:31:45 -0000 @@ -1346,7 +1346,7 @@ void LyXText::pasteSelection(size_t sel_ cursor.par(), cursor.pos(), bv()->buffer()->params.textclass, sel_index, el); - parseErrors(*bv()->buffer(), el); + bufferErrors(*bv()->buffer(), el); bv()->showErrorList(_("Paste")); redoParagraphs(cursor, endpit); Index: frontends/controllers/ControlDocument.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlDocument.C,v retrieving revision 1.26 diff -u -p -u -r1.26 ControlDocument.C --- frontends/controllers/ControlDocument.C 30 Jun 2003 23:56:10 -0000 1.26 +++ frontends/controllers/ControlDocument.C 2 Jul 2003 20:31:45 -0000 @@ -129,7 +129,7 @@ void ControlDocument::classApply() CutAndPaste::SwitchLayoutsBetweenClasses(old_class, new_class, lv_.buffer()->paragraphs, el); - parseErrors(*buffer(), el); + bufferErrors(*buffer(), el); bufferview()->showErrorList(_("Class switch")); } Index: insets/insettext.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v retrieving revision 1.415 diff -u -p -u -r1.415 insettext.C --- insets/insettext.C 30 Jun 2003 23:56:20 -0000 1.415 +++ insets/insettext.C 2 Jul 2003 20:31:50 -0000 @@ -1511,7 +1511,7 @@ int InsetText::docbook(Buffer const * bu break; case LATEX_COMMAND: - buf->parseError(ErrorItem(_("Error"), _("LatexType Command not allowed here.\n"), pit->id(), 0, pit->size())); + buf->error(ErrorItem(_("Error"), _("LatexType Command not allowed here.\n"), pit->id(), 0, pit->size())); return -1; break;