}
-void BufferView::resetErrorList()
-{
- pimpl_->errorlist_.clear();
-}
-
-
-void BufferView::setErrorList(ErrorList const & el)
-{
- pimpl_->errorlist_ = el;
-}
-
-
void BufferView::showErrorList(string const & action) const
{
if (getErrorList().size()) {
BufferView::getErrorList() const
{
return pimpl_->errorlist_;
+ pimpl_->errorlist_.clear();
}
/// get the stored error list
ErrorList const & getErrorList() const;
- /// clears the stored error list
- void resetErrorList();
- /// stored this error list
- void setErrorList(ErrorList const &);
/// show the error list to the user
void showErrorList(string const &) const;
/// set the cursor based on the given TeX source row
}
Buffer * b = bufferlist.newBuffer(s);
- bv_->resetErrorList();
//attach to the error signal in the buffer
b->parseError.connect(boost::bind(&BufferView::Pimpl::addError,
this, _1));
- bool loaded = true;
+ bool loaded = ::loadLyXFile(b, s);
- if (! ::loadLyXFile(b, s)) {
+ if (! loaded) {
bufferlist.release(b);
string text = bformat(_("The document %1$s does "
"not yet exist.\n\n"
bufferlist.close(buffer_, false);
buffer(newFile(s, string(), true));
}
-
- loaded = false;
}
buffer(b);
+2003-06-24 Alfredo Brauntein <abraunst@lyx.org>
+
+ * converter.C (scanLog, runLaTeX):
+ * buffer.C (makeLinuxDocFile, makeDocBookFile, runChkTeX):
+ move the bv->showErrorList call to the callers
+ * lyxfunc.C: i.e. here...
+ * text2.C: and here
+ * BufferView.[Ch] (setErrorList, resetErrorList): both removed
+ * exporter.[Ch] (Backends, BufferFormat): the first was moved to anon
+ namespace, the second to...
+ * buffer_funcs (BufferFormat, parseErrors): added
+ * errorlist.C (ErrorList(TeXErrors const &)): removed
+
2003-06-24 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* ToolbarBackend.C (getIcon): complain when icon cannot be found
#include <config.h>
#include "buffer.h"
+#include "buffer_funcs.h"
#include "bufferlist.h"
#include "LyXAction.h"
#include "lyxrc.h"
string item_name;
vector<string> environment_stack(5);
- users->resetErrorList();
-
ParagraphList::iterator pit = paragraphs.begin();
ParagraphList::iterator pend = paragraphs.end();
for (; pit != pend; ++pit) {
// we want this to be true outside previews (for insetexternal)
niceFile = true;
-
- users->showErrorList(_("LinuxDoc"));
}
string item_name;
string command_name;
- users->resetErrorList();
-
ParagraphList::iterator par = paragraphs.begin();
ParagraphList::iterator pend = paragraphs.end();
// we want this to be true outside previews (for insetexternal)
niceFile = true;
- users->showErrorList(_("DocBook"));
}
_("Could not run chktex successfully."));
} else if (res > 0) {
// Insert all errors as errors boxes
- ErrorList el (*this, terr);
- users->setErrorList(el);
- users->showErrorList(_("ChkTeX"));
+ parseErrors(*this, terr);
}
users->owner()->busy(false);
#include "buffer_funcs.h"
#include "bufferlist.h"
#include "buffer.h"
+#include "errorlist.h"
#include "gettext.h"
#include "vc-backend.h"
#include "lyxlex.h"
+#include "LaTeX.h"
#include "ParagraphList.h"
#include "paragraph.h"
return b;
}
+
+
+void parseErrors(Buffer const & buf, TeXErrors const & terr)
+{
+ TeXErrors::Errors::const_iterator cit = terr.begin();
+ TeXErrors::Errors::const_iterator end = terr.end();
+
+ for (; cit != end; ++cit) {
+ int par_id = -1;
+ int posstart = -1;
+ int const errorrow = cit->error_in_line;
+ buf.texrow.getIdFromRow(errorrow, par_id, posstart);
+ int posend = -1;
+ buf.texrow.getIdFromRow(errorrow + 1, par_id, posend);
+ buf.parseError(ErrorItem(cit->error_desc,
+ cit->error_text,
+ par_id, posstart, posend));
+ }
+}
+
+
+void parseErrors(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);
+}
+
+
+string const BufferFormat(Buffer const & buffer)
+{
+ if (buffer.isLinuxDoc())
+ return "linuxdoc";
+ else if (buffer.isDocBook())
+ return "docbook";
+ else if (buffer.isLiterate())
+ return "literate";
+ else
+ return "latex";
+}
* Full author contact details are available in file CREDITS
*/
+#ifndef BUFFER_FUNCS_H
+#define BUFFER_FUNCS_H
+
#include "LString.h"
class Buffer;
+class TeXErrors;
+class ErrorList;
/**
* Loads a LyX file \c filename into \c Buffer
*/
Buffer * newFile(string const & filename, string const & templatename,
bool isNamed = false);
+
+///return the format of the buffer on a string
+string const BufferFormat(Buffer const & buffer);
+
+void parseErrors(Buffer const &, TeXErrors const &);
+
+void parseErrors(Buffer const &, ErrorList const &);
+
+#endif // BUFFER_FUNCS_H
#include "format.h"
#include "lyxrc.h"
#include "buffer.h"
+#include "buffer_funcs.h"
#include "bufferview_funcs.h"
#include "errorlist.h"
#include "LaTeX.h"
TeXErrors terr;
int result = latex.scanLogFile(terr);
- if (bv && (result & LaTeX::ERRORS)) {
- ErrorList el(*buffer, terr);
- bv->setErrorList(el);
- bv->showErrorList(_("LaTeX"));
- }
+ if (bv && (result & LaTeX::ERRORS))
+ parseErrors(*buffer, terr);
return true;
}
int result = latex.run(terr,
bv ? &bv->owner()->getLyXFunc() : 0);
- if (bv && (result & LaTeX::ERRORS)) {
- //show errors
- ErrorList el(*buffer, terr);
- bv->setErrorList(el);
- bv->showErrorList(_("LaTeX"));
- }
+ if (bv && (result & LaTeX::ERRORS))
+ parseErrors(*buffer, terr);
// check return value from latex.run().
if ((result & LaTeX::NO_LOGFILE)) {
#include "errorlist.h"
#include "buffer.h"
-#include "LaTeX.h"
ErrorItem::ErrorItem(string const & error, string const & description,
{}
-ErrorList::ErrorList(Buffer const & buf,
- TeXErrors const & terr)
-{
- TeXErrors::Errors::const_iterator cit = terr.begin();
- TeXErrors::Errors::const_iterator end = terr.end();
-
- for (; cit != end; ++cit) {
- int par_id = -1;
- int posstart = -1;
- int const errorrow = cit->error_in_line;
- buf.texrow.getIdFromRow(errorrow, par_id, posstart);
- int posend = -1;
- buf.texrow.getIdFromRow(errorrow + 1, par_id, posend);
- push_back(ErrorItem(cit->error_desc,
- cit->error_text,
- par_id, posstart, posend));
- }
-}
#include <vector>
class Buffer;
-class TeXErrors;
/// A class to hold an error item
struct ErrorItem {
{
public:
ErrorList() : std::vector<ErrorItem> () {};
- ErrorList(Buffer const & buf, TeXErrors const &);
using std::vector<ErrorItem>::push_back;
using std::vector<ErrorItem>::end;
#include "exporter.h"
#include "buffer.h"
+#include "buffer_funcs.h"
#include "lyx_cb.h" //ShowMessage()
#include "support/filetools.h"
#include "lyxrc.h"
using std::vector;
using std::find;
+
+namespace {
+
+vector<string> const Backends(Buffer const * buffer)
+{
+ vector<string> v;
+ if (buffer->params.getLyXTextClass().isTeXClassAvailable())
+ v.push_back(BufferFormat(*buffer));
+ v.push_back("text");
+ return v;
+}
+
+} //namespace anon
+
+
bool Exporter::Export(Buffer * buffer, string const & format,
bool put_in_tempdir, string & result_file)
{
return result;
}
-
-string const Exporter::BufferFormat(Buffer const * buffer)
-{
- if (buffer->isLinuxDoc())
- return "linuxdoc";
- else if (buffer->isDocBook())
- return "docbook";
- else if (buffer->isLiterate())
- return "literate";
- else
- return "latex";
-}
-
-
-vector<string> const Exporter::Backends(Buffer const * buffer)
-{
- vector<string> v;
- if (buffer->params.getLyXTextClass().isTeXClassAvailable())
- v.push_back(BufferFormat(buffer));
- v.push_back("text");
- return v;
-}
std::vector<Format const *> const
GetExportableFormats(Buffer const * buffer, bool only_viewable);
///
-private:
- static
- string const BufferFormat(Buffer const * buffer);
- ///
- static
- std::vector<string> const Backends(Buffer const * buffer);
};
#endif
+2003-06-24 Alfredo Braunstein <abraunst@libero.it>
+
+ * ControlDocument.C (classApply): removed the call to resetErrorList,
+ replaced setErrorList by parseErrors
+
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
* ControlError.[Ch]: removed
#include "lyxfind.h"
#include "buffer.h"
+#include "buffer_funcs.h"
#include "errorlist.h"
#include "language.h"
#include "lyx_main.h"
CutAndPaste::SwitchLayoutsBetweenClasses(old_class, new_class,
lv_.buffer()->paragraphs,
el);
-
- bufferview()->setErrorList(el);
+ parseErrors(*buffer(), el);
bufferview()->showErrorList(_("Class switch"));
}
case LFUN_UPDATE:
Exporter::Export(owner->buffer(), argument, true);
+ view()->showErrorList(BufferFormat(*owner->buffer()));
break;
case LFUN_PREVIEW:
Exporter::Preview(owner->buffer(), argument);
+ view()->showErrorList(BufferFormat(*owner->buffer()));
break;
case LFUN_BUILDPROG:
Exporter::Export(owner->buffer(), "program", true);
+ view()->showErrorList(_("Build"));
break;
case LFUN_RUNCHKTEX:
owner->buffer()->runChktex();
+ view()->showErrorList(_("ChkTeX"));
break;
case LFUN_EXPORT:
if (argument == "custom")
owner->getDialogs().showSendto();
- else
+ else {
Exporter::Export(owner->buffer(), argument, false);
+ view()->showErrorList(BufferFormat(*owner->buffer()));
+ }
break;
case LFUN_IMPORT:
#include "frontends/LyXView.h"
#include "undo_funcs.h"
#include "buffer.h"
+#include "buffer_funcs.h"
#include "bufferparams.h"
#include "errorlist.h"
#include "gettext.h"
cursor.par(), cursor.pos(),
bv()->buffer()->params.textclass,
sel_index, el);
- bv()->setErrorList(el);
+ parseErrors(*bv()->buffer(), el);
bv()->showErrorList(_("Paste"));
redoParagraphs(cursor, endpit);