diff --git a/src/data/action/set.cpp b/src/data/action/set.cpp index 7b06a499..1f91ea8c 100644 --- a/src/data/action/set.cpp +++ b/src/data/action/set.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include // ----------------------------------------------------------------------------- : Add card @@ -89,6 +90,9 @@ void DisplayChangeAction::perform(bool to_undo) { } +ChangeCardStyleAction::ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet) + : card(card), stylesheet(stylesheet) +{} String ChangeCardStyleAction::getName(bool to_undo) const { return _("Change style"); } @@ -97,6 +101,9 @@ void ChangeCardStyleAction::perform(bool to_undo) { } +ChangeSetStyleAction::ChangeSetStyleAction(Set& set, const CardP& card) + : set(set), card(card) +{} String ChangeSetStyleAction::getName(bool to_undo) const { return _("Change style (all cards)"); } diff --git a/src/data/action/set.hpp b/src/data/action/set.hpp index 7c36110a..2811655e 100644 --- a/src/data/action/set.hpp +++ b/src/data/action/set.hpp @@ -87,8 +87,7 @@ class DisplayChangeAction : public Action { /// Changing the style of a a card class ChangeCardStyleAction : public DisplayChangeAction { public: - ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet) - : card(card), stylesheet(stylesheet) {} + ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet); virtual String getName(bool to_undo) const; virtual void perform(bool to_undo); @@ -101,8 +100,7 @@ class ChangeCardStyleAction : public DisplayChangeAction { /// Changing the style of a set to that of a card class ChangeSetStyleAction : public DisplayChangeAction { public: - ChangeSetStyleAction(Set& set, const CardP& card) - : set(set), card(card) {} + ChangeSetStyleAction(Set& set, const CardP& card); virtual String getName(bool to_undo) const; virtual void perform(bool to_undo); diff --git a/src/data/action/symbol_part.cpp b/src/data/action/symbol_part.cpp index 8999d778..e612dc66 100644 --- a/src/data/action/symbol_part.cpp +++ b/src/data/action/symbol_part.cpp @@ -289,7 +289,7 @@ double ssqrt(double x) { } // Remove a single control point -class SinglePointRemoveAction : public Action { +class SinglePointRemoveAction : public Action, public IntrusivePtrBase { public: SinglePointRemoveAction(const SymbolPartP& part, UInt position); @@ -393,7 +393,7 @@ ControlPointRemoveAction::ControlPointRemoveAction(const SymbolPartP& part, cons FOR_EACH(point, part->points) { if (toDelete.find(point) != toDelete.end()) { // remove this point - removals.push_back(new_shared2(part, index)); + removals.push_back(new_intrusive2(part, index)); } ++index; } @@ -417,7 +417,7 @@ void ControlPointRemoveAction::perform(bool to_undo) { Action* controlPointRemoveAction(const SymbolPartP& part, const set& toDelete) { if (part->points.size() - toDelete.size() < 2) { // TODO : remove part? - //new_shared(part); + //new_intrusive(part); return 0; // no action } else { return new ControlPointRemoveAction(part, toDelete); diff --git a/src/data/action/value.cpp b/src/data/action/value.cpp index 62769352..5be3361b 100644 --- a/src/data/action/value.cpp +++ b/src/data/action/value.cpp @@ -36,7 +36,7 @@ inline void swap_value(TextValue& a, TextValue ::ValueType& b template class SimpleValueAction : public ValueAction { public: - inline SimpleValueAction(const shared_ptr& value, const typename T::ValueType& new_value) + inline SimpleValueAction(const intrusive_ptr& value, const typename T::ValueType& new_value) : ValueAction(value), new_value(new_value) {} diff --git a/src/data/card.cpp b/src/data/card.cpp index d6824356..c9882286 100644 --- a/src/data/card.cpp +++ b/src/data/card.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/src/data/card.hpp b/src/data/card.hpp index 287438ba..6076cbc9 100644 --- a/src/data/card.hpp +++ b/src/data/card.hpp @@ -24,7 +24,7 @@ DECLARE_POINTER_TYPE(StyleSheet); // ----------------------------------------------------------------------------- : Card /// A card from a card Set -class Card { +class Card : public IntrusivePtrVirtualBase { public: /// Default constructor, uses game_for_new_cards to make the game Card(); diff --git a/src/data/field.cpp b/src/data/field.cpp index c1a41791..eb09cf6c 100644 --- a/src/data/field.cpp +++ b/src/data/field.cpp @@ -61,18 +61,18 @@ IMPLEMENT_REFLECTION(Field) { } template <> -shared_ptr read_new(Reader& reader) { +intrusive_ptr read_new(Reader& reader) { // there must be a type specified String type; reader.handle(_("type"), type); - if (type == _("text")) return new_shared(); - else if (type == _("choice")) return new_shared(); - else if (type == _("multiple choice")) return new_shared(); - else if (type == _("boolean")) return new_shared(); - else if (type == _("image")) return new_shared(); - else if (type == _("symbol")) return new_shared(); - else if (type == _("color")) return new_shared(); - else if (type == _("info")) return new_shared(); + if (type == _("text")) return new_intrusive(); + else if (type == _("choice")) return new_intrusive(); + else if (type == _("multiple choice")) return new_intrusive(); + else if (type == _("boolean")) return new_intrusive(); + else if (type == _("image")) return new_intrusive(); + else if (type == _("symbol")) return new_intrusive(); + else if (type == _("color")) return new_intrusive(); + else if (type == _("info")) return new_intrusive(); else { throw ParseError(_("Unsupported field type: '") + type + _("'")); } diff --git a/src/data/field.hpp b/src/data/field.hpp index 096a1049..97a6ad8b 100644 --- a/src/data/field.hpp +++ b/src/data/field.hpp @@ -32,7 +32,7 @@ DECLARE_POINTER_TYPE(ValueEditor); // ----------------------------------------------------------------------------- : Field /// Information on how to store a value -class Field { +class Field : public IntrusivePtrVirtualBase { public: Field(); virtual ~Field(); @@ -71,7 +71,7 @@ class Field { }; template <> -shared_ptr read_new(Reader& reader); +intrusive_ptr read_new(Reader& reader); inline void update_index(FieldP& f, size_t index) { f->index = index; } @@ -79,7 +79,7 @@ inline void update_index(FieldP& f, size_t index) { // ----------------------------------------------------------------------------- : Style /// Style information needed to display a Value in a Field. -class Style { +class Style : public IntrusivePtrVirtualBase { public: Style(const FieldP&); virtual ~Style(); @@ -134,7 +134,7 @@ template <> StyleP read_new