* 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_)
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,
error_list);
// Emit the signal to show the error list.
if (format != backend_format)
if (format != backend_format) {
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)
return false;

View File

@ -455,7 +455,7 @@ public:
/// This function is called when the buffer structure is changed.
void structureChanged() const;
/// 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.
void setBusy(bool on) const;
/// 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.
virtual void updateTocItem(std::string const &, DocIterator const &) = 0;
/// 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.
virtual void message(docstring const &) = 0;
/// This function is called when the buffer busy status change.

View File

@ -84,16 +84,24 @@ void GuiErrorList::updateContents()
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;
Buffer const & buf = bufferview()->buffer();
Buffer const * buf = from_master_ ?
bufferview()->buffer().masterBuffer()
: &bufferview()->buffer();
name_ = bformat(_("%1$s Errors (%2$s)"), _(error_type),
from_utf8(buf.absFileName()));
from_utf8(buf->absFileName()));
return true;
}
@ -105,6 +113,10 @@ bool GuiErrorList::goTo(int item)
if (err.par_id == -1)
return false;
if (from_master_)
// FIXME: implement
return false;
Buffer const & buf = buffer();
DocIterator dit = buf.getParFromID(err.par_id);

View File

@ -57,6 +57,8 @@ private:
std::string error_type_;
/// the parent document name
docstring name_;
///
bool from_master_;
};
} // 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())
showDialog("errorlist", error_type);
showDialog("errorlist", data);
}

View File

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