I had forgotten that gcc does not turn on concept checks by defalt, so I did that for builds where --enable-debug is on.
This showed a few problems, but mostly we are in _very_ good shape. I think we should apply the patch below (or something better if you have suggestions). This will help us stay honest. This patch makes _GLIBCPP_CONCEPT_CHECKS (or _GLIBCXX_CONCEPT_CHECKS for 3.4 and above) be defined if --enable-debug is on. Also I have done the neede changes to the code to make it pass compilation. In some cases this involves including some headers where we thought it not necessary, but where the CC thinks otherwise. Also some typedefs missing on ParIterator, and missing post-increment there. (I did'n fix ParConstIterator since the CC did not trigger there, because of where it is used surely.) The most intrusive changes was in the XForms dir since I had to use shared_ptr in several places to break up circular dependencies, but IMHO the code is acutally nicer now, with a lot less bald pointers. Unless I get strong objections, this is going in. I have not checked qt and gtk yet, but will do that as well. (but I don't expect the same problems there as with xforms.) config/lyxinclude.m4 | 4 + src/FloatList.h | 4 - src/ParagraphList_fwd.h | 8 +-- src/RowList_fwd.h | 4 - src/frontends/xforms/FormCharacter.C | 2 src/frontends/xforms/FormCharacter.h | 2 src/frontends/xforms/FormPreferences.h | 3 - src/frontends/xforms/LayoutEngine.C | 79 +++++++++++++++++---------------- src/frontends/xforms/LayoutEngine.h | 15 ++++-- src/frontends/xforms/XFormsMenubar.C | 15 +++--- src/frontends/xforms/XFormsMenubar.h | 2 src/frontends/xforms/XFormsToolbar.C | 16 +++--- src/frontends/xforms/XFormsToolbar.h | 2 src/frontends/xforms/XFormsView.C | 36 +++++++-------- src/frontends/xforms/XFormsView.h | 6 +- src/frontends/xforms/XMiniBuffer.C | 12 ++--- src/frontends/xforms/XMiniBuffer.h | 2 src/frontends/xforms/XWorkArea.C | 14 +++-- src/frontends/xforms/XWorkArea.h | 2 src/lyxtextclasslist.h | 3 - src/mathed/math_inset.h | 5 -- src/pariterator.C | 13 +++++ src/pariterator.h | 15 +++++- src/support/forkedcontr.C | 22 +++------ 24 files changed, 163 insertions(+), 123 deletions(-)
? Config ? concept-checks-1.diff ? gtkmm-2.4-1.diff Index: config/lyxinclude.m4 =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v retrieving revision 1.98 diff -u -p -w -r1.98 lyxinclude.m4 --- config/lyxinclude.m4 23 Oct 2004 09:06:28 -0000 1.98 +++ config/lyxinclude.m4 16 Nov 2004 16:45:09 -0000 @@ -220,7 +220,11 @@ if test x$GXX = xyes; then esac if test x$enable_debug = xyes ; then case $gxx_version in + 3.3*) CXXFLAGS="-g $CXXFLAGS" + AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking]) + ;; 3.4*|3.5*) CXXFLAGS="-g $CXXFLAGS" + AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking]) AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode]) AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode]) ;; Index: src/FloatList.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FloatList.h,v retrieving revision 1.16 diff -u -p -w -r1.16 FloatList.h --- src/FloatList.h 7 Oct 2003 06:45:24 -0000 1.16 +++ src/FloatList.h 16 Nov 2004 16:45:09 -0000 @@ -12,11 +12,11 @@ #ifndef FLOATLIST_H #define FLOATLIST_H +#include "Floating.h" + #include <map> #include <string> - -class Floating; /// class FloatList { Index: src/ParagraphList_fwd.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ParagraphList_fwd.h,v retrieving revision 1.3 diff -u -p -w -r1.3 ParagraphList_fwd.h --- src/ParagraphList_fwd.h 3 Apr 2004 08:36:54 -0000 1.3 +++ src/ParagraphList_fwd.h 16 Nov 2004 16:45:09 -0000 @@ -12,21 +12,21 @@ #ifndef PARAGRAPH_LIST_FWD_H #define PARAGRAPH_LIST_FWD_H -#include <vector> +#include "paragraph.h" -class Paragraph; +#include <vector> class ParagraphList : public std::vector<Paragraph> { public: /// - typedef std::vector<Paragraph> base_type; + typedef std::vector<Paragraph> BaseType; /// ParagraphList(); /// template <class Iter> ParagraphList(Iter beg, Iter end) - : base_type(beg, end) + : BaseType(beg, end) {} }; Index: src/RowList_fwd.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/RowList_fwd.h,v retrieving revision 1.4 diff -u -p -w -r1.4 RowList_fwd.h --- src/RowList_fwd.h 24 Oct 2003 08:33:51 -0000 1.4 +++ src/RowList_fwd.h 16 Nov 2004 16:45:09 -0000 @@ -12,9 +12,9 @@ #ifndef ROW_LIST_FWD_H #define ROW_LIST_FWD_H -#include <vector> +#include "lyxrow.h" -class Row; +#include <vector> typedef std::vector<Row> RowList; Index: src/lyxtextclasslist.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclasslist.h,v retrieving revision 1.10 diff -u -p -w -r1.10 lyxtextclasslist.h --- src/lyxtextclasslist.h 7 Oct 2003 06:45:24 -0000 1.10 +++ src/lyxtextclasslist.h 16 Nov 2004 16:45:09 -0000 @@ -12,6 +12,8 @@ #ifndef LYXTEXTCLASSLIST_H #define LYXTEXTCLASSLIST_H +#include "lyxtextclass.h" + #include "support/types.h" #include <boost/utility.hpp> @@ -19,7 +21,6 @@ #include <string> #include <vector> -class LyXTextClass; class LyXLayout; /// Reads the style files Index: src/pariterator.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/pariterator.C,v retrieving revision 1.7 diff -u -p -w -r1.7 pariterator.C --- src/pariterator.C 29 Apr 2004 14:48:59 -0000 1.7 +++ src/pariterator.C 16 Nov 2004 16:45:09 -0000 @@ -53,6 +53,18 @@ ParIterator & ParIterator::operator++() } +ParIterator ParIterator::operator++(int) +{ + ParIterator tmp(*this); + forwardPar(); + return tmp; +} + + +#if 0 +// Unused member functions. Also having this makes ParIterator not be +// an forward iterator anymore. So unless we change that, this function +// should not be compiled/used. (Lgb) ParIterator & ParIterator::operator--() { #ifdef WITH_WARNINGS @@ -61,6 +73,7 @@ ParIterator & ParIterator::operator--() // DocIterator::backwardPar(); return *this; } +#endif Paragraph & ParIterator::operator*() const Index: src/pariterator.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/pariterator.h,v retrieving revision 1.4 diff -u -p -w -r1.4 pariterator.h --- src/pariterator.h 31 Mar 2004 19:11:54 -0000 1.4 +++ src/pariterator.h 16 Nov 2004 16:45:09 -0000 @@ -31,6 +31,17 @@ class ParIterator : public std::iterator public DocIterator { public: + typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt; + + typedef StdIt::value_type value_type; + typedef StdIt::difference_type difference_type; + typedef StdIt::pointer pointer; + typedef StdIt::reference reference; + + /// + ParIterator() : DocIterator() {} + + /// ParIterator(InsetBase &, lyx::par_type pit); /// @@ -43,7 +54,9 @@ public: /// ParIterator & operator++(); /// - ParIterator & operator--(); + ParIterator operator++(int); + /// See comment in pariterator.C + //ParIterator & operator--(); /// Paragraph & operator*() const; /// Index: src/frontends/xforms/FormCharacter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormCharacter.C,v retrieving revision 1.51 diff -u -p -w -r1.51 FormCharacter.C --- src/frontends/xforms/FormCharacter.C 19 May 2004 15:11:35 -0000 1.51 +++ src/frontends/xforms/FormCharacter.C 16 Nov 2004 16:45:09 -0000 @@ -20,8 +20,6 @@ #include "controllers/frnt_lang.h" #include "controllers/helper_funcs.h" -#include "LColor.h" - #include "support/lstrings.h" #include "lyx_forms.h" Index: src/frontends/xforms/FormCharacter.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormCharacter.h,v retrieving revision 1.35 diff -u -p -w -r1.35 FormCharacter.h --- src/frontends/xforms/FormCharacter.h 19 May 2004 15:11:35 -0000 1.35 +++ src/frontends/xforms/FormCharacter.h 16 Nov 2004 16:45:10 -0000 @@ -16,7 +16,7 @@ #include "FormDialogView.h" #include "ControlCharacter.h" // for ControlCharacter enum -struct LColor_color; +#include "LColor.h" namespace lyx { namespace frontend { Index: src/frontends/xforms/FormPreferences.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormPreferences.h,v retrieving revision 1.83 diff -u -p -w -r1.83 FormPreferences.h --- src/frontends/xforms/FormPreferences.h 26 Oct 2004 18:39:11 -0000 1.83 +++ src/frontends/xforms/FormPreferences.h 16 Nov 2004 16:45:10 -0000 @@ -16,6 +16,7 @@ #include "FormDialogView.h" #include "lyx_forms.h" +#include "xforms_helpers.h" #include <boost/scoped_ptr.hpp> @@ -49,9 +50,7 @@ struct FD_preferences_screen_fonts; struct FD_preferences_spelloptions; class FormColorpicker; -class NamedColor; class RGBColor; -class XformsColor; /** This class provides an XForms implementation of the FormPreferences Dialog. * The preferences dialog allows users to set/save their preferences. Index: src/frontends/xforms/LayoutEngine.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/LayoutEngine.C,v retrieving revision 1.3 diff -u -p -w -r1.3 LayoutEngine.C --- src/frontends/xforms/LayoutEngine.C 1 Jun 2004 11:10:09 -0000 1.3 +++ src/frontends/xforms/LayoutEngine.C 16 Nov 2004 16:45:10 -0000 @@ -24,8 +24,14 @@ #include "LayoutEngine.h" #include "lyx_forms.h" + #include <boost/assert.hpp> +#include <boost/bind.hpp> + +using boost::bind; +using boost::shared_ptr; +using std::for_each; namespace lyx { namespace frontend { @@ -49,9 +55,9 @@ void BoxList::clear() } -Box & BoxList::push_back(Box const & box) +shared_ptr<Box> BoxList::push_back(Box const & box) { - data_.push_back(box); + data_.push_back(shared_ptr<Box>(new Box(box))); return data_.back(); } @@ -176,7 +182,7 @@ bool Box::expandable() const BoxList::const_iterator it = children_.begin(); BoxList::const_iterator const end = children_.end(); for (; it != end; ++it) { - if (it->visible() && it->packing() == Expand) + if ((*it)->visible() && (*it)->packing() == Expand) return true; } @@ -211,10 +217,8 @@ void Box::show() visible_ = true; - BoxList::iterator it = children_.begin(); - BoxList::iterator const end = children_.end(); - for (; it != end; ++it) - it->show(); + for_each(children_.begin(), children_.end(), + bind(&Box::show, _1)); } @@ -222,10 +226,8 @@ void Box::hide() { visible_ = false; - BoxList::iterator it = children_.begin(); - BoxList::iterator const end = children_.end(); - for (; it != end; ++it) - it->hide(); + for_each(children_.begin(), children_.end(), + bind(&Box::hide, _1)); } @@ -280,12 +282,12 @@ void Box::shrinkMetrics() BoxList::iterator it = children_.begin(); BoxList::iterator const end = children_.end(); for (; it != end; ++it) { - if (!it->visible()) + if (!(*it)->visible()) continue; - it->shrinkMetrics(); - dimension_t child_width = it->width(); - dimension_t child_height = it->height(); + (*it)->shrinkMetrics(); + dimension_t child_width = (*it)->width(); + dimension_t child_height = (*it)->height(); if (orientation_ == Horizontal) { width += child_width; @@ -326,12 +328,12 @@ void Box::expandHbox(dimension_t x_in, d BoxList::const_iterator cit = children_.begin(); BoxList::const_iterator const cend = children_.end(); for (; cit != cend; ++cit) { - if (cit->visible()) { + if ((*cit)->visible()) { nvisible_children += 1; - if (cit->expandable()) + if ((*cit)->expandable()) nexpanded_children += 1; else - w_fixed += cit->width(); + w_fixed += (*cit)->width(); } } @@ -352,11 +354,11 @@ void Box::expandHbox(dimension_t x_in, d BoxList::iterator it = children_.begin(); BoxList::iterator const end = children_.end(); for (; it != end; ++it) { - if (!it->visible()) + if (!(*it)->visible()) continue; - dimension_t w_child = it->width(); - if (it->expandable()) { + dimension_t w_child = (*it)->width(); + if ((*it)->expandable()) { if (nexpanded_children == 1) w_child = std::max(w_child, width); else @@ -366,7 +368,7 @@ void Box::expandHbox(dimension_t x_in, d width -= w_child; } - it->expandMetrics(x_child, y_child, w_child, h_child); + (*it)->expandMetrics(x_child, y_child, w_child, h_child); x_child += w_child; } } @@ -382,12 +384,12 @@ void Box::expandVbox(dimension_t x_in, d BoxList::const_iterator cit = children_.begin(); BoxList::const_iterator const cend = children_.end(); for (; cit != cend; ++cit) { - if (cit->visible()) { + if ((*cit)->visible()) { nvisible_children += 1; - if (cit->expandable()) + if ((*cit)->expandable()) nexpanded_children += 1; else - h_fixed += cit->height(); + h_fixed += (*cit)->height(); } } @@ -408,11 +410,11 @@ void Box::expandVbox(dimension_t x_in, d BoxList::iterator it = children_.begin(); BoxList::iterator const end = children_.end(); for (; it != end; ++it) { - if (!it->visible()) + if (!(*it)->visible()) continue; - dimension_t h_child = it->height(); - if (it->expandable()) { + dimension_t h_child = (*it)->height(); + if ((*it)->expandable()) { if (nexpanded_children == 1) h_child = std::max(h_child, height); else @@ -421,17 +423,17 @@ void Box::expandVbox(dimension_t x_in, d height -= h_child; } - it->expandMetrics(x_child, y_child, w_child, h_child); + (*it)->expandMetrics(x_child, y_child, w_child, h_child); y_child += h_child; } } -Box & WidgetMap::add(FL_OBJECT * ob, BoxList & container, +shared_ptr<Box> WidgetMap::add(FL_OBJECT * ob, BoxList & container, dimension_t min_w, dimension_t min_h) { - Box & box = container.push_back(Box(min_w, min_h)); - widgets_[ob] = &box; + shared_ptr<Box> box = container.push_back(Box(min_w, min_h)); + widgets_[ob] = box; return box; } @@ -458,16 +460,17 @@ void WidgetMap::updateMetrics() const } -Box & embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw) +shared_ptr<Box> +embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw) { container.push_back(Box(0, bw)); - Box & middle = container.push_back(Box(0, 0)); - middle.set(Box::Horizontal); + shared_ptr<Box> middle = container.push_back(Box(0, 0)); + middle->set(Box::Horizontal); container.push_back(Box(0, bw)); - middle.children().push_back(Box(bw, 0)); - Box & center = widgets.add(ob, middle.children(), 0, 0); - middle.children().push_back(Box(bw, 0)); + middle->children().push_back(Box(bw, 0)); + shared_ptr<Box> center = widgets.add(ob, middle->children(), 0, 0); + middle->children().push_back(Box(bw, 0)); return center; } Index: src/frontends/xforms/LayoutEngine.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/LayoutEngine.h,v retrieving revision 1.2 diff -u -p -w -r1.2 LayoutEngine.h --- src/frontends/xforms/LayoutEngine.h 29 Apr 2004 09:54:59 -0000 1.2 +++ src/frontends/xforms/LayoutEngine.h 16 Nov 2004 16:45:10 -0000 @@ -15,6 +15,9 @@ #define LAYOUT_ENGINE_H #include "forms_fwd.h" + +#include <boost/shared_ptr.hpp> + #include <list> #include <map> @@ -25,7 +28,7 @@ class Box; class BoxList { public: - typedef std::list<Box> Container; + typedef std::list<boost::shared_ptr<Box> > Container; typedef Container::size_type size_type; typedef Container::iterator iterator; typedef Container::const_iterator const_iterator; @@ -34,7 +37,7 @@ public: size_type size() const; void clear(); - Box & push_back(Box const &); + boost::shared_ptr<Box> push_back(Box const &); iterator begin(); iterator end(); @@ -167,12 +170,13 @@ public: typedef Box::dimension_t dimension_t; /// \returns the just-added Box. - Box & add(FL_OBJECT * widget, BoxList & container, + boost::shared_ptr<Box> + add(FL_OBJECT * widget, BoxList & container, dimension_t min_w, dimension_t min_h); void updateMetrics() const; private: - typedef std::map<FL_OBJECT *, Box *> DataMap; + typedef std::map<FL_OBJECT *, boost::shared_ptr<Box> > DataMap; DataMap widgets_; }; @@ -181,7 +185,8 @@ private: * Thereafter, hand control of its metrics to \c widgets. * \returns the Box containing \c ob. */ -Box & embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw); +boost::shared_ptr<Box> +embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw); } // namespace frontend } // namespace lyx Index: src/frontends/xforms/XFormsMenubar.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsMenubar.C,v retrieving revision 1.13 diff -u -p -w -r1.13 XFormsMenubar.C --- src/frontends/xforms/XFormsMenubar.C 8 Nov 2004 10:54:29 -0000 1.13 +++ src/frontends/xforms/XFormsMenubar.C 16 Nov 2004 16:45:10 -0000 @@ -27,6 +27,8 @@ #include "lyx_forms.h" +using boost::shared_ptr; + using std::distance; using std::endl; using std::for_each; @@ -88,8 +90,7 @@ extern "C" { XFormsMenubar::XFormsMenubar(LyXView * view, MenuBackend const & mb) : owner_(static_cast<XFormsView*>(view)), - menubackend_(&mb), - menubar_(0) + menubackend_(&mb) { owner_->metricsUpdated.connect(boost::bind(&WidgetMap::updateMetrics, &widgets_)); @@ -105,24 +106,24 @@ XFormsMenubar::~XFormsMenubar() void XFormsMenubar::makeMenubar(Menu const & menu) { // Draw a frame around the whole. - BoxList & boxlist = owner_->getBox(XFormsView::Top).children(); + BoxList & boxlist = owner_->getBox(XFormsView::Top)->children(); FL_OBJECT * frame = fl_add_frame(FL_UP_FRAME, 0, 0, 0, 0, ""); fl_set_object_resize(frame, FL_RESIZE_ALL); fl_set_object_gravity(frame, NorthWestGravity, NorthEastGravity); - menubar_ = &widgets_.add(frame, boxlist, 0, mheight); + menubar_ = widgets_.add(frame, boxlist, 0, mheight); // The menubar contains three vertically-aligned Boxes, // the center one of which is to contain the buttons, // aligned horizontally. // The other two provide some visual padding. menubar_->children().push_back(Box(0, yloc)); - Box & menubar_center = menubar_->children().push_back(Box(0,0)); - menubar_center.set(Box::Horizontal); + shared_ptr<Box> menubar_center = menubar_->children().push_back(Box(0,0)); + menubar_center->set(Box::Horizontal); menubar_->children().push_back(Box(0, yloc)); - BoxList & menubar_buttons = menubar_center.children(); + BoxList & menubar_buttons = menubar_center->children(); // Add the buttons. Menu::const_iterator i = menu.begin(); Index: src/frontends/xforms/XFormsMenubar.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsMenubar.h,v retrieving revision 1.8 diff -u -p -w -r1.8 XFormsMenubar.h --- src/frontends/xforms/XFormsMenubar.h 19 May 2004 15:11:37 -0000 1.8 +++ src/frontends/xforms/XFormsMenubar.h 16 Nov 2004 16:45:10 -0000 @@ -72,7 +72,7 @@ private: /// MenuBackend const * menubackend_; /// - Box * menubar_; + boost::shared_ptr<Box> menubar_; /// WidgetMap widgets_; /// Index: src/frontends/xforms/XFormsToolbar.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsToolbar.C,v retrieving revision 1.24 diff -u -p -w -r1.24 XFormsToolbar.C --- src/frontends/xforms/XFormsToolbar.C 9 Nov 2004 12:40:34 -0000 1.24 +++ src/frontends/xforms/XFormsToolbar.C 16 Nov 2004 16:45:10 -0000 @@ -38,6 +38,8 @@ #include <sstream> #include <vector> +using boost::shared_ptr; + using std::distance; using std::endl; using std::string; @@ -200,14 +202,13 @@ namespace frontend { XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb, LyXView & o) - : toolbar_(0), - toolbar_buttons_(0), + : toolbar_buttons_(0), owner_(static_cast<XFormsView &>(o)), tooltip_(new Tooltips) { position_ = getPosition(tbb.flags); - BoxList & boxlist = owner_.getBox(position_).children(); - toolbar_ = &boxlist.push_back(Box(0,0)); + BoxList & boxlist = owner_.getBox(position_)->children(); + toolbar_ = boxlist.push_back(Box(0,0)); // If the toolbar is horizontal, then it contains three // vertically-aligned Boxes,the center one of which is to @@ -235,9 +236,9 @@ XFormsToolbar::XFormsToolbar(ToolbarBack toolbar_->children().push_back(Box(padding, padding)); - Box & toolbar_center = toolbar_->children().push_back(Box(0,0)); - toolbar_center.set(toolbar_orientation); - toolbar_buttons_ = &toolbar_center.children(); + shared_ptr<Box> toolbar_center = toolbar_->children().push_back(Box(0,0)); + toolbar_center->set(toolbar_orientation); + toolbar_buttons_ = &toolbar_center->children(); toolbar_->children().push_back(Box(padding, padding)); @@ -249,7 +250,6 @@ XFormsToolbar::XFormsToolbar(ToolbarBack ToolbarBackend::item_iterator end = tbb.items.end(); for (; it != end; ++it) add(it->first, it->second); - } Index: src/frontends/xforms/XFormsToolbar.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsToolbar.h,v retrieving revision 1.12 diff -u -p -w -r1.12 XFormsToolbar.h --- src/frontends/xforms/XFormsToolbar.h 5 Oct 2004 10:11:40 -0000 1.12 +++ src/frontends/xforms/XFormsToolbar.h 16 Nov 2004 16:45:10 -0000 @@ -97,7 +97,7 @@ public: /// XFormsView::Position position_; /// - Box * toolbar_; + boost::shared_ptr<Box> toolbar_; /// BoxList * toolbar_buttons_; /// Index: src/frontends/xforms/XFormsView.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsView.C,v retrieving revision 1.48 diff -u -p -w -r1.48 XFormsView.C --- src/frontends/xforms/XFormsView.C 16 Nov 2004 10:46:22 -0000 1.48 +++ src/frontends/xforms/XFormsView.C 16 Nov 2004 16:45:10 -0000 @@ -27,6 +27,8 @@ #include <boost/bind.hpp> +using boost::shared_ptr; + using std::abs; using std::endl; using std::string; @@ -69,22 +71,22 @@ XFormsView::XFormsView(int width, int he int const air = 2; // Logical layout of the boxes making up the LyX window. - Box & top = window_.children().push_back(Box(0,0)); - Box & middle = window_.children().push_back(Box(0,0)); - middle.set(Box::Horizontal); - Box & bottom = window_.children().push_back(Box(0,0)); - - Box & left = middle.children().push_back(Box(air,0)); - Box & center = middle.children().push_back(Box(0,0)); - center.set(Box::Expand); - Box & right = middle.children().push_back(Box(air,0)); + shared_ptr<Box> top = window_.children().push_back(Box(0,0)); + shared_ptr<Box> middle = window_.children().push_back(Box(0,0)); + middle->set(Box::Horizontal); + shared_ptr<Box> bottom = window_.children().push_back(Box(0,0)); + + shared_ptr<Box> left = middle->children().push_back(Box(air,0)); + shared_ptr<Box> center = middle->children().push_back(Box(0,0)); + center->set(Box::Expand); + shared_ptr<Box> right = middle->children().push_back(Box(air,0)); // Define accessors to the various boxes. - box_map_[Top] = ⊤ - box_map_[Bottom] = ⊥ - box_map_[Left] = &left; - box_map_[Center] = ¢er; - box_map_[Right] = &right; + box_map_[Top] = top; + box_map_[Bottom] = bottom; + box_map_[Left] = left; + box_map_[Center] = center; + box_map_[Right] = right; // Define the XForms components making up the window. // Each uses the layout engine defined above to control its @@ -145,11 +147,11 @@ XFormsView::~XFormsView() } -Box & XFormsView::getBox(Position pos) const +shared_ptr<Box> XFormsView::getBox(Position pos) const { - std::map<Position, Box *>::const_iterator it = box_map_.find(pos); + BoxMap::const_iterator it = box_map_.find(pos); BOOST_ASSERT(it != box_map_.end()); - return *it->second; + return it->second; } Index: src/frontends/xforms/XFormsView.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsView.h,v retrieving revision 1.25 diff -u -p -w -r1.25 XFormsView.h --- src/frontends/xforms/XFormsView.h 16 Nov 2004 10:46:23 -0000 1.25 +++ src/frontends/xforms/XFormsView.h 16 Nov 2004 16:45:10 -0000 @@ -48,7 +48,7 @@ public: ~XFormsView(); /// Accessor to the appropriate layout Box. - Box & getBox(Position pos) const; + boost::shared_ptr<Box> getBox(Position pos) const; /** * show - display the top-level window @@ -96,8 +96,10 @@ private: /// The top-most box of the layout engine containing all other boxes. Box window_; + typedef std::map<Position, boost::shared_ptr<Box> > BoxMap; + // Accessors to the various Boxes. - std::map<Position, Box *> box_map_; + BoxMap box_map_; /// the minibuffer boost::scoped_ptr<XMiniBuffer> minibuffer_; Index: src/frontends/xforms/XMiniBuffer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XMiniBuffer.C,v retrieving revision 1.23 diff -u -p -w -r1.23 XMiniBuffer.C --- src/frontends/xforms/XMiniBuffer.C 19 May 2004 15:11:37 -0000 1.23 +++ src/frontends/xforms/XMiniBuffer.C 16 Nov 2004 16:45:10 -0000 @@ -25,6 +25,8 @@ #include <boost/bind.hpp> +using boost::shared_ptr; + using std::vector; using std::string; @@ -53,11 +55,11 @@ XMiniBuffer::XMiniBuffer(XFormsView & ow // 2 pixel deep frame. int const air = 2; - BoxList & boxlist = owner.getBox(XFormsView::Bottom).children(); - minibuffer_ = &boxlist.push_back(Box(0,0)); - Box & center = embed(input_, minibuffer_->children(), widgets_, air); - center.set(Box::Expand); - center.setMinimumDimensions(0, 25); + BoxList & boxlist = owner.getBox(XFormsView::Bottom)->children(); + minibuffer_ = boxlist.push_back(Box(0,0)); + shared_ptr<Box> center = embed(input_, minibuffer_->children(), widgets_, air); + center->set(Box::Expand); + center->setMinimumDimensions(0, 25); owner.metricsUpdated.connect(boost::bind(&WidgetMap::updateMetrics, &widgets_)); Index: src/frontends/xforms/XMiniBuffer.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XMiniBuffer.h,v retrieving revision 1.18 diff -u -p -w -r1.18 XMiniBuffer.h --- src/frontends/xforms/XMiniBuffer.h 19 May 2004 15:11:37 -0000 1.18 +++ src/frontends/xforms/XMiniBuffer.h 16 Nov 2004 16:45:10 -0000 @@ -109,7 +109,7 @@ private: /// are we showing an informational temporary message ? bool info_shown_; /// - Box * minibuffer_; + boost::shared_ptr<Box> minibuffer_; /// WidgetMap widgets_; }; Index: src/frontends/xforms/XWorkArea.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XWorkArea.C,v retrieving revision 1.49 diff -u -p -w -r1.49 XWorkArea.C --- src/frontends/xforms/XWorkArea.C 14 Aug 2004 14:03:40 -0000 1.49 +++ src/frontends/xforms/XWorkArea.C 16 Nov 2004 16:45:10 -0000 @@ -24,6 +24,8 @@ #include <boost/bind.hpp> +using boost::shared_ptr; + using std::abs; using std::dec; using std::endl; @@ -147,17 +149,17 @@ XWorkArea::XWorkArea(LyXView & owner, in // Hand control of the layout of these widgets to the // Layout Engine. XFormsView & xview = dynamic_cast<XFormsView &>(owner); - BoxList & boxlist = xview.getBox(XFormsView::Center).children(); + BoxList & boxlist = xview.getBox(XFormsView::Center)->children(); - wa_box_ = &boxlist.push_back(Box(0,0)); + wa_box_ = boxlist.push_back(Box(0,0)); wa_box_->set(Box::Horizontal); - Box & frame_box = widgets_.add(frame, wa_box_->children(), 0, 0); - frame_box.set(Box::Expand); + shared_ptr<Box> frame_box = widgets_.add(frame, wa_box_->children(), 0, 0); + frame_box->set(Box::Expand); int const bw = int(abs(fl_get_border_width())); - Box & wa_box = embed(work_area, frame_box.children(), widgets_, bw); - wa_box.set(Box::Expand); + shared_ptr<Box> wa_box = embed(work_area, frame_box->children(), widgets_, bw); + wa_box->set(Box::Expand); widgets_.add(scrollbar, wa_box_->children(), 17, 0); Index: src/frontends/xforms/XWorkArea.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XWorkArea.h,v retrieving revision 1.27 diff -u -p -w -r1.27 XWorkArea.h --- src/frontends/xforms/XWorkArea.h 19 May 2004 15:11:37 -0000 1.27 +++ src/frontends/xforms/XWorkArea.h 16 Nov 2004 16:45:10 -0000 @@ -88,7 +88,7 @@ private: /// the current document's height (for scrollbar) int doc_height_; /// - Box * wa_box_; + boost::shared_ptr<Box> wa_box_; /// WidgetMap widgets_; }; Index: src/mathed/math_inset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_inset.h,v retrieving revision 1.184 diff -u -p -w -r1.184 math_inset.h --- src/mathed/math_inset.h 5 Oct 2004 10:11:41 -0000 1.184 +++ src/mathed/math_inset.h 16 Nov 2004 16:45:10 -0000 @@ -13,6 +13,8 @@ #ifndef MATH_INSET_H #define MATH_INSET_H +#include "math_data.h" + #include "insets/insetbase.h" #include <string> @@ -51,9 +53,6 @@ class MathSymbolInset; class MathUnknownInset; class RefInset; - -class MathArray; -class MathAtom; class NormalStream; class OctaveStream; Index: src/support/forkedcontr.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcontr.C,v retrieving revision 1.24 diff -u -p -w -r1.24 forkedcontr.C --- src/support/forkedcontr.C 7 Nov 2004 13:22:51 -0000 1.24 +++ src/support/forkedcontr.C 16 Nov 2004 16:45:10 -0000 @@ -225,17 +225,13 @@ void ForkedcallsController::addCall(Fork } -ForkedcallsController::iterator ForkedcallsController::find_pid(pid_t pid) +ForkedcallsController::iterator + ForkedcallsController::find_pid(pid_t pid) { - typedef boost::indirect_iterator<ListType::iterator> iterator; - - iterator begin = boost::make_indirect_iterator(forkedCalls.begin()); - iterator end = boost::make_indirect_iterator(forkedCalls.end()); - iterator it = find_if(begin, end, + return find_if(forkedCalls.begin(), forkedCalls.end(), bind(equal_to<pid_t>(), bind(&Forkedcall::pid, _1), pid)); - return it.base(); } @@ -278,17 +274,17 @@ void ForkedcallsController::handleComple // Eg, child was run in blocking mode continue; - ForkedProcess & child = *it->get(); + ListType::value_type child = (*it); bool remove_it = false; if (WIFEXITED(store.status)) { // Ok, the return value goes into retval. - child.setRetValue(WEXITSTATUS(store.status)); + child->setRetValue(WEXITSTATUS(store.status)); remove_it = true; } else if (WIFSIGNALED(store.status)) { // Child died, so pretend it returned 1 - child.setRetValue(1); + child->setRetValue(1); remove_it = true; } else if (WIFSTOPPED(store.status)) { @@ -299,15 +295,15 @@ void ForkedcallsController::handleComple } else { lyxerr << "LyX: Something rotten happened while " - "waiting for child " << store.pid << endl; + << "waiting for child " << store.pid << endl; // Child died, so pretend it returned 1 - child.setRetValue(1); + child->setRetValue(1); remove_it = true; } if (remove_it) { - child.emitSignal(); + child->emitSignal(); forkedCalls.erase(it); } }
-- Lgb