* Pop up error dialog if issuing master-buffer-[view|update] and errors occured.

Navigating in such dialogs does not work yet, but at least the user is informed
  at all that LaTeX wasn't succesful.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30209 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-06-21 12:26:41 +00:00
parent 9388e76dc0
commit 5a54d11157
7 changed files with 38 additions and 13 deletions

View File

@ -2560,10 +2560,10 @@ void Buffer::structureChanged() const
} }
void Buffer::errors(string const & err) const void Buffer::errors(string const & err, bool from_master) const
{ {
if (gui_) if (gui_)
gui_->errors(err); gui_->errors(err, from_master);
} }
@ -2853,8 +2853,14 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
tmp_result_file, FileName(absFileName()), backend_format, format, tmp_result_file, FileName(absFileName()), backend_format, format,
error_list); error_list);
// Emit the signal to show the error list. // Emit the signal to show the error list.
if (format != backend_format) if (format != backend_format) {
errors(error_type); errors(error_type);
// also to the children, in case of master-buffer-view
std::vector<Buffer *> clist = getChildren();
for (vector<Buffer *>::const_iterator cit = clist.begin();
cit != clist.end(); ++cit)
(*cit)->errors(error_type, true);
}
if (!success) if (!success)
return false; return false;

View File

@ -455,7 +455,7 @@ public:
/// This function is called when the buffer structure is changed. /// This function is called when the buffer structure is changed.
void structureChanged() const; void structureChanged() const;
/// This function is called when some parsing error shows up. /// This function is called when some parsing error shows up.
void errors(std::string const & err) const; void errors(std::string const & err, bool from_master = false) const;
/// This function is called when the buffer busy status change. /// This function is called when the buffer busy status change.
void setBusy(bool on) const; void setBusy(bool on) const;
/// This function is called when the buffer readonly status change. /// This function is called when the buffer readonly status change.

View File

@ -65,7 +65,7 @@ public:
/// This function is called when the buffer structure has been updated. /// This function is called when the buffer structure has been updated.
virtual void updateTocItem(std::string const &, DocIterator const &) = 0; virtual void updateTocItem(std::string const &, DocIterator const &) = 0;
/// This function is called when some parsing error shows up. /// This function is called when some parsing error shows up.
virtual void errors(std::string const &) = 0; virtual void errors(std::string const &, bool from_master = false) = 0;
/// This function is called when some message shows up. /// This function is called when some message shows up.
virtual void message(docstring const &) = 0; virtual void message(docstring const &) = 0;
/// This function is called when the buffer busy status change. /// This function is called when the buffer busy status change.

View File

@ -84,16 +84,24 @@ void GuiErrorList::updateContents()
ErrorList const & GuiErrorList::errorList() const ErrorList const & GuiErrorList::errorList() const
{ {
return bufferview()->buffer().errorList(error_type_); return from_master_ ?
bufferview()->buffer().masterBuffer()->errorList(error_type_)
: bufferview()->buffer().errorList(error_type_);
} }
bool GuiErrorList::initialiseParams(string const & error_type) bool GuiErrorList::initialiseParams(string const & data)
{ {
from_master_ = prefixIs(data, "from_master|");
string error_type = data;
if (from_master_)
error_type = split(data, '|');
error_type_ = error_type; error_type_ = error_type;
Buffer const & buf = bufferview()->buffer(); Buffer const * buf = from_master_ ?
bufferview()->buffer().masterBuffer()
: &bufferview()->buffer();
name_ = bformat(_("%1$s Errors (%2$s)"), _(error_type), name_ = bformat(_("%1$s Errors (%2$s)"), _(error_type),
from_utf8(buf.absFileName())); from_utf8(buf->absFileName()));
return true; return true;
} }
@ -105,6 +113,10 @@ bool GuiErrorList::goTo(int item)
if (err.par_id == -1) if (err.par_id == -1)
return false; return false;
if (from_master_)
// FIXME: implement
return false;
Buffer const & buf = buffer(); Buffer const & buf = buffer();
DocIterator dit = buf.getParFromID(err.par_id); DocIterator dit = buf.getParFromID(err.par_id);

View File

@ -57,6 +57,8 @@ private:
std::string error_type_; std::string error_type_;
/// the parent document name /// the parent document name
docstring name_; docstring name_;
///
bool from_master_;
}; };
} // namespace frontend } // namespace frontend

View File

@ -1143,11 +1143,16 @@ void GuiView::disconnectBufferView()
} }
void GuiView::errors(string const & error_type) void GuiView::errors(string const & error_type, bool from_master)
{ {
ErrorList & el = buffer()->errorList(error_type); ErrorList & el = from_master ?
buffer()->masterBuffer()->errorList(error_type)
: buffer()->errorList(error_type);
string data = error_type;
if (from_master)
data = "from_master|" + error_type;
if (!el.empty()) if (!el.empty())
showDialog("errorlist", error_type); showDialog("errorlist", data);
} }

View File

@ -104,7 +104,7 @@ public:
/// GuiBufferDelegate. /// GuiBufferDelegate.
///@{ ///@{
void resetAutosaveTimers(); void resetAutosaveTimers();
void errors(std::string const &); void errors(std::string const &, bool from_master = false);
void structureChanged(); void structureChanged();
void updateTocItem(std::string const &, DocIterator const &); void updateTocItem(std::string const &, DocIterator const &);
///@} ///@}