default smart pointer type switched to intrusive_ptr

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@337 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-11 21:34:53 +00:00
parent 3b6743b110
commit 33fd2b5e18
103 changed files with 368 additions and 256 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ ValueViewerP DataEditor::makeViewer(const StyleP& style) {
bool DataEditor::drawBorders() const {
return !nativeLook() &&
settings.stylesheetSettingsFor(*set->stylesheetFor(card)).card_borders();
settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_borders();
}
bool DataEditor::drawEditing() const {
return true;
+3 -1
View File
@@ -11,6 +11,7 @@
#include <util/prec.hpp>
#include <gui/control/item_list.hpp>
#include <data/card.hpp>
#include <data/set.hpp>
DECLARE_POINTER_TYPE(ChoiceField);
@@ -27,10 +28,11 @@ DECLARE_EVENT_TYPE(EVENT_CARD_SELECT, <not used>)
/// The event of selecting a card
struct CardSelectEvent : public wxCommandEvent {
CardP card; ///< The selected card
inline CardSelectEvent(const CardP& card)
: wxCommandEvent(EVENT_CARD_SELECT), card(card)
{}
CardP card; ///< The selected card
};
// ----------------------------------------------------------------------------- : CardListBase
+1 -1
View File
@@ -17,7 +17,7 @@ DECLARE_POINTER_TYPE(CardListFilter);
// ----------------------------------------------------------------------------- : CardListFilter
/// A filter function to determine which items are shown in a card list
class CardListFilter {
class CardListFilter : public IntrusivePtrVirtualBase {
public:
virtual ~CardListFilter() {}
/// Should a card be shown in the list?
+8 -8
View File
@@ -367,19 +367,19 @@ GraphControl::GraphControl(Window* parent, int id)
: wxControl(parent, id)
{
//*
shared_ptr<GraphContainer> combined(new GraphContainer());
combined->add(new_shared1<GraphValueAxis>(0));
combined->add(new_shared1<BarGraph>(0));
graph = new_shared6<GraphWithMargins>(combined, 23,8,7,20, true);
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(new_intrusive1<GraphValueAxis>(0));
combined->add(new_intrusive1<BarGraph>(0));
graph = new_intrusive6<GraphWithMargins>(combined, 23,8,7,20, true);
/*/
shared_ptr<GraphContainer> combined(new GraphContainer());
combined->add(new_shared1<PieGraph>(0));
graph = new_shared6<GraphWithMargins>(combined, 20,20,20,20, false);
intrusive_ptr<GraphContainer> combined(new GraphContainer());
combined->add(new_intrusive1<PieGraph>(0));
graph = new_intrusive6<GraphWithMargins>(combined, 20,20,20,20, false);
//*/
}
void GraphControl::setData(const GraphDataPre& data) {
setData(new_shared1<GraphData>(data));
setData(new_intrusive1<GraphData>(data));
}
void GraphControl::setData(const GraphDataP& data) {
if (graph) {
+5 -6
View File
@@ -28,7 +28,7 @@ DECLARE_EVENT_TYPE(EVENT_GRAPH_SELECT, <not used>)
/// A group in a table or graph
/** A group is rendered as a single bar or pie slice */
class GraphGroup {
class GraphGroup : public IntrusivePtrBase<GraphGroup> {
public:
GraphGroup(const String& name, UInt size, const Color& color = *wxBLACK)
: name(name), color(color), size(size)
@@ -48,7 +48,7 @@ enum AutoColor
/// An axis in a graph, consists of a list of groups
/** The sum of groups.sum = sum of all elements in the data */
class GraphAxis {
class GraphAxis : public IntrusivePtrBase<GraphAxis> {
public:
GraphAxis(const String& name, AutoColor auto_color = AUTO_COLOR_EVEN, bool numeric = false, const map<String,Color>* colors = nullptr)
: name(name)
@@ -69,7 +69,7 @@ class GraphAxis {
};
/// A single data point of a graph
class GraphElement {
class GraphElement : public IntrusivePtrBase<GraphElement> {
public:
GraphElement() {}
GraphElement(const String& v1);
@@ -86,7 +86,7 @@ class GraphDataPre {
};
/// Data to be displayed in a graph
class GraphData {
class GraphData : public IntrusivePtrBase<GraphData> {
public:
GraphData(const GraphDataPre&);
@@ -108,9 +108,8 @@ enum DrawLayer
/// A type of graph
/** It is rendered into a sub-rectangle of the screen */
class Graph {
class Graph : public IntrusivePtrVirtualBase {
public:
virtual ~Graph() {}
/// Draw this graph, filling the internalRect() of the dc.
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const = 0;
/// Find the item at the given position, the rectangle gives the screen size
+1 -1
View File
@@ -98,7 +98,7 @@ int ImageCardList::OnGetItemImage(long pos) const {
return it->second;
} else {
// request a thumbnail
thumbnail_thread.request(new_shared2<CardThumbnailRequest>(const_cast<ImageCardList*>(this), val.filename));
thumbnail_thread.request(new_intrusive2<CardThumbnailRequest>(const_cast<ImageCardList*>(this), val.filename));
}
}
return -1;
+1 -1
View File
@@ -12,7 +12,7 @@
#include <util/prec.hpp>
#include <wx/listctrl.h>
typedef shared_ptr<void> VoidP;
typedef intrusive_ptr<IntrusivePtrVirtualBase> VoidP;
// ----------------------------------------------------------------------------- : ItemList
+2 -2
View File
@@ -38,8 +38,8 @@ class PackageList : public GalleryList {
/** @pre hasSelection()
* Throws if the selection is not of type T */
template <typename T>
shared_ptr<T> getSelection() const {
shared_ptr<T> ret = dynamic_pointer_cast<T>(packages.at(selection).package);
intrusive_ptr<T> getSelection() const {
intrusive_ptr<T> ret = dynamic_pointer_cast<T>(packages.at(selection).package);
if (!ret) throw InternalError(_("PackageList: Selected package has the wrong type"));
ret->loadFully();
return ret;
+2
View File
@@ -8,6 +8,7 @@
#include <gui/control/select_card_list.hpp>
#include <gui/util.hpp>
#include <data/card.hpp>
DECLARE_TYPEOF_COLLECTION(CardP);
@@ -24,6 +25,7 @@ SelectCardList::SelectCardList(Window* parent, int id, long additional_style)
il->Add(load_resource_image(_("selected")));
AssignImageList(il, wxIMAGE_LIST_SMALL);
}
SelectCardList::~SelectCardList() {}
void SelectCardList::selectAll() {
FOR_EACH_CONST(c, set->cards) {
+1
View File
@@ -19,6 +19,7 @@
class SelectCardList : public CardListBase {
public:
SelectCardList(Window* parent, int id, long additional_style = 0);
~SelectCardList();
/// Select all cards
void selectAll();
/// Deselect all cards
+2 -1
View File
@@ -21,6 +21,7 @@ TextCtrl::TextCtrl(Window* parent, int id, bool multi_line, long style)
, value(nullptr)
, multi_line(multi_line)
{}
TextCtrl::~TextCtrl() {}
Rotation TextCtrl::getRotation() const {
return Rotation(0, RealRect(RealPoint(0,0),GetClientSize()));
@@ -57,7 +58,7 @@ void TextCtrl::updateSize() {
}
void TextCtrl::setValue(String* value, bool untagged) {
setValue(new_shared4<FakeTextValue>(getFieldP(), value, true, untagged));
setValue(new_intrusive4<FakeTextValue>(getFieldP(), value, true, untagged));
}
void TextCtrl::setValue(const FakeTextValueP& value) {
value->retrieve();
+1
View File
@@ -30,6 +30,7 @@ DECLARE_POINTER_TYPE(FakeTextValue);
class TextCtrl : public DataEditor {
public:
TextCtrl(Window* parent, int id, bool multi_line, long style = 0);
~TextCtrl();
/// Set the value that is being edited
/** value can be a nullptr*/