Author: rgheck
Date: Wed Jun 8 01:52:22 2011
New Revision: 38979
URL: http://www.lyx.org/trac/changeset/38979
Log:
Revert previous commit, which committed too much.
This reverts commit 4369e725b17fede013eb26bfd797e917eaf6f4ea.
Modified:
lyx-devel/trunk/src/Buffer.cpp
lyx-devel/trunk/src/Buffer.h
lyx-devel/trunk/src/CutAndPaste.cpp
lyx-devel/trunk/src/Text.cpp
lyx-devel/trunk/src/TextClass.cpp
lyx-devel/trunk/src/TextClass.h
lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
lyx-devel/trunk/src/insets/InsetInclude.cpp
Modified: lyx-devel/trunk/src/Buffer.cpp
==============================================================================
--- lyx-devel/trunk/src/Buffer.cpp Wed Jun 8 01:45:33 2011 (r38978)
+++ lyx-devel/trunk/src/Buffer.cpp Wed Jun 8 01:52:22 2011 (r38979)
@@ -3154,9 +3154,9 @@
}
-ErrorList const & Buffer::errorList(string const & type) const
+ErrorList & Buffer::errorList(string const & type) const
{
- static const ErrorList emptyErrorList;
+ static ErrorList emptyErrorList;
map<string, ErrorList>::iterator it = d->errorLists.find(type);
if (it == d->errorLists.end())
return emptyErrorList;
@@ -3165,12 +3165,6 @@
}
-ErrorList & Buffer::errorList(string const & type)
-{
- return d->errorLists[type];
-}
-
-
void Buffer::updateTocItem(std::string const & type,
DocIterator const & dit) const
{
Modified: lyx-devel/trunk/src/Buffer.h
==============================================================================
--- lyx-devel/trunk/src/Buffer.h Wed Jun 8 01:45:33 2011 (r38978)
+++ lyx-devel/trunk/src/Buffer.h Wed Jun 8 01:52:22 2011 (r38979)
@@ -562,8 +562,7 @@
/// errors (like parsing or LateX compilation). This method is const
/// because modifying the returned ErrorList does not touch the document
/// contents.
- ErrorList & errorList(std::string const & type);
- ErrorList const & errorList(std::string const & type) const;
+ ErrorList & errorList(std::string const & type) const;
/// The Toc backend.
/// This is useful only for screen visualisation of the Buffer. This
Modified: lyx-devel/trunk/src/CutAndPaste.cpp
==============================================================================
--- lyx-devel/trunk/src/CutAndPaste.cpp Wed Jun 8 01:45:33 2011 (r38978)
+++ lyx-devel/trunk/src/CutAndPaste.cpp Wed Jun 8 01:52:22 2011 (r38979)
@@ -647,25 +647,13 @@
DocumentClass const & newtc = *newone;
// layouts
- ParIterator it = par_iterator_begin(in);
ParIterator end = par_iterator_end(in);
- // for remembering which layouts we've had to add
- set<docstring> newlayouts;
- for (; it != end; ++it) {
+ for (ParIterator it = par_iterator_begin(in); it != end; ++it) {
docstring const name = it->layout().name();
// the pasted text will keep their own layout name. If this
layout does
// not exist in the new document, it will behave like a
standard layout.
- bool const added_one = newtc.addLayoutIfNeeded(name);
- if (added_one)
- newlayouts.insert(name);
-
- if (added_one || newlayouts.find(name) != newlayouts.end()) {
- // Warn the user.
- docstring const s = bformat(_("Layout `%1$s' was not
found."), name);
- errorlist.push_back(
- ErrorItem(_("Layout Not Found"), s, it->id(),
0, it->size()));
- }
+ newtc.addLayoutIfNeeded(name);
if (in.usePlainLayout())
it->setLayout(newtc.plainLayout());
Modified: lyx-devel/trunk/src/Text.cpp
==============================================================================
--- lyx-devel/trunk/src/Text.cpp Wed Jun 8 01:45:33 2011 (r38978)
+++ lyx-devel/trunk/src/Text.cpp Wed Jun 8 01:52:22 2011 (r38979)
@@ -357,13 +357,6 @@
// all unknown layouts such as frame will be added to document
class article so that
// these layouts can keep their original names.
tclass.addLayoutIfNeeded(layoutname);
- bool const added_one = tclass.addLayoutIfNeeded(layoutname);
- if (added_one) {
- // Warn the user.
- docstring const s = bformat(_("Layout `%1$s' was not
found."), layoutname);
- errorList.push_back(
- ErrorItem(_("Layout Not Found"), s, par.id(),
0, par.size()));
- }
par.setLayout(bp.documentClass()[layoutname]);
Modified: lyx-devel/trunk/src/TextClass.cpp
==============================================================================
--- lyx-devel/trunk/src/TextClass.cpp Wed Jun 8 01:45:33 2011 (r38978)
+++ lyx-devel/trunk/src/TextClass.cpp Wed Jun 8 01:52:22 2011 (r38979)
@@ -1221,13 +1221,10 @@
}
-bool DocumentClass::addLayoutIfNeeded(docstring const & n) const
+void DocumentClass::addLayoutIfNeeded(docstring const & n) const
{
- if (hasLayout(n))
- return false;
-
- layoutlist_.push_back(createBasicLayout(n, true));
- return true;
+ if (!hasLayout(n))
+ layoutlist_.push_back(createBasicLayout(n, true));
}
Modified: lyx-devel/trunk/src/TextClass.h
==============================================================================
--- lyx-devel/trunk/src/TextClass.h Wed Jun 8 01:45:33 2011 (r38978)
+++ lyx-devel/trunk/src/TextClass.h Wed Jun 8 01:52:22 2011 (r38979)
@@ -377,8 +377,7 @@
/// a plain inset layout for use as a default
static InsetLayout const & plainInsetLayout() { return
plain_insetlayout_; }
/// add a new layout \c name if it does not exist in layoutlist_
- /// \return whether we had to add one.
- bool addLayoutIfNeeded(docstring const & name) const;
+ void addLayoutIfNeeded(docstring const & name) const;
///////////////////////////////////////////////////////////////////
// accessors
Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp Wed Jun 8 01:45:33
2011 (r38978)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp Wed Jun 8 01:52:22
2011 (r38979)
@@ -1451,13 +1451,13 @@
#if EXPORT_in_THREAD && (QT_VERSION >= 0x040400)
// We are called with from_master == false by default, so we
// have to figure out whether that is the case or not.
- ErrorList & el = const_cast<ErrorList
&>(bv->buffer().errorList(error_type));
+ ErrorList & el = bv->buffer().errorList(error_type);
if (el.empty()) {
el = bv->buffer().masterBuffer()->errorList(error_type);
from_master = true;
}
#else
- ErrorList const & el = from_master ?
+ ErrorList & el = from_master ?
bv->buffer().masterBuffer()->errorList(error_type) :
bv->buffer().errorList(error_type);
#endif
Modified: lyx-devel/trunk/src/insets/InsetInclude.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetInclude.cpp Wed Jun 8 01:45:33 2011
(r38978)
+++ lyx-devel/trunk/src/insets/InsetInclude.cpp Wed Jun 8 01:52:22 2011
(r38979)
@@ -627,7 +627,7 @@
"was not exported correctly.\nWarning: "
"LaTeX export is probably incomplete."),
included_file.displayName());
- ErrorList const & el = tmp->errorList("Export");
+ ErrorList & el = tmp->errorList("Export");
if (!el.empty())
msg =
bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
msg, el.begin()->error,