]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
* de/UserGuide: some translation work.
[lyx.git] / src / Buffer.cpp
index 1e7f06f5afa592b91b1bb2b153ee260917088f6d..d2eff530f835197ca76ef1481d0c3e2f9177c98c 100644 (file)
@@ -342,7 +342,6 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_,
        temppath = cloned_buffer_->d->temppath;
        file_fully_loaded = true;
        params = cloned_buffer_->d->params;
-       gui_ = cloned_buffer->d->gui_;
        bibfiles_cache_ = cloned_buffer_->d->bibfiles_cache_;
        bibinfo_ = cloned_buffer_->d->bibinfo_;
        bibinfo_cache_valid_ = cloned_buffer_->d->bibinfo_cache_valid_;
@@ -2544,7 +2543,7 @@ Buffer const * Buffer::parent() const
 ListOfBuffers Buffer::allRelatives() const
 {
        ListOfBuffers lb = masterBuffer()->getDescendents();
-       lb.push_front(const_cast<Buffer *>(this));
+       lb.push_front(const_cast<Buffer *>(masterBuffer()));
        return lb;
 }
 
@@ -3558,7 +3557,6 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
                        if (d->cloned_buffer_) {
                                d->cloned_buffer_->d->errorLists["Export"] =
                                        d->errorLists["Export"];
-                               errors("Export");
                        }
                        return false;
                }
@@ -3573,7 +3571,6 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
                        if (d->cloned_buffer_) {
                                d->cloned_buffer_->d->errorLists["Export"] =
                                        d->errorLists["Export"];
-                               errors("Export");
                        }
                        return false;
                }
@@ -3891,24 +3888,50 @@ Buffer::ReadStatus Buffer::loadThisLyXFile(FileName const & fn)
 
 void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
 {
-       TeXErrors::Errors::const_iterator cit = terr.begin();
+       TeXErrors::Errors::const_iterator it = terr.begin();
        TeXErrors::Errors::const_iterator end = terr.end();
+       ListOfBuffers clist = getDescendents();
+       ListOfBuffers::const_iterator cen = clist.end();
 
-       for (; cit != end; ++cit) {
+       for (; it != end; ++it) {
                int id_start = -1;
                int pos_start = -1;
-               int errorRow = cit->error_in_line;
-               bool found = d->texrow.getIdFromRow(errorRow, id_start,
-                                                      pos_start);
+               int errorRow = it->error_in_line;
+               Buffer const * buf = 0;
+               Impl const * p = d;
+               if (it->child_name.empty())
+                   p->texrow.getIdFromRow(errorRow, id_start, pos_start);
+               else {
+                       // The error occurred in a child
+                       ListOfBuffers::const_iterator cit = clist.begin();
+                       for (; cit != cen; ++cit) {
+                               string const child_name =
+                                       DocFileName(changeExtension(
+                                               (*cit)->absFileName(), "tex")).
+                                                       mangledFileName();
+                               if (it->child_name != child_name)
+                                       continue;
+                               (*cit)->d->texrow.getIdFromRow(errorRow,
+                                                       id_start, pos_start);
+                               if (id_start != -1) {
+                                       buf = d->cloned_buffer_
+                                               ? (*cit)->d->cloned_buffer_->d->owner_
+                                               : (*cit)->d->owner_;
+                                       p = (*cit)->d;
+                                       break;
+                               }
+                       }
+               }
                int id_end = -1;
                int pos_end = -1;
+               bool found;
                do {
                        ++errorRow;
-                       found = d->texrow.getIdFromRow(errorRow, id_end, pos_end);
+                       found = p->texrow.getIdFromRow(errorRow, id_end, pos_end);
                } while (found && id_start == id_end && pos_start == pos_end);
 
-               errorList.push_back(ErrorItem(cit->error_desc,
-                       cit->error_text, id_start, pos_start, pos_end));
+               errorList.push_back(ErrorItem(it->error_desc,
+                       it->error_text, id_start, pos_start, pos_end, buf));
        }
 }