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*/
+1 -1
View File
@@ -92,7 +92,7 @@ void NewSetWindow::OnOK(wxCommandEvent&) {
void NewSetWindow::done() {
StyleSheetP stylesheet = stylesheet_list->getSelection<StyleSheet>();
set = new_shared1<Set>(stylesheet);
set = new_intrusive1<Set>(stylesheet);
set->validate();
EndModal(wxID_OK);
}
+7 -6
View File
@@ -10,6 +10,7 @@
#include <gui/card_select_window.hpp>
#include <gui/util.hpp>
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/stylesheet.hpp>
#include <render/card/viewer.hpp>
#include <wx/print.h>
@@ -44,7 +45,7 @@ class TextBufferDC : public wxMemoryDC {
private:
// A call to DrawText
struct TextDraw {
struct TextDraw : public IntrusivePtrBase<TextDraw> {
wxFont font;
Color color;
int x, y;
@@ -57,7 +58,7 @@ class TextBufferDC : public wxMemoryDC {
{}
};
public:
typedef shared_ptr<TextDraw> TextDrawP;
typedef intrusive_ptr<TextDraw> TextDrawP;
private:
vector<TextDrawP> text;
Bitmap buffer;
@@ -73,12 +74,12 @@ TextBufferDC::TextBufferDC(int width, int height)
void TextBufferDC::DoDrawText(const String& str, int x, int y) {
double usx,usy;
GetUserScale(&usx, &usy);
text.push_back( new_shared7<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str) );
text.push_back( new_intrusive7<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str) );
}
void TextBufferDC::DoDrawRotatedText(const String& str, int x, int y, double angle) {
double usx,usy;
GetUserScale(&usx, &usy);
text.push_back( new_shared8<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) );
text.push_back( new_intrusive8<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) );
}
DECLARE_TYPEOF_COLLECTION(TextBufferDC::TextDrawP);
@@ -171,7 +172,7 @@ void CardsPrintout::OnPreparePrinting() {
int pw_mm, ph_mm;
GetPageSizeMM(&pw_mm, &ph_mm);
if (!layout) {
layout = new_shared2<PageLayout>(*set->stylesheet, RealSize(pw_mm, ph_mm));
layout = new_intrusive2<PageLayout>(*set->stylesheet, RealSize(pw_mm, ph_mm));
}
}
@@ -201,7 +202,7 @@ void CardsPrintout::drawCard(DC& dc, const CardP& card, int card_nr) {
RealPoint pos( layout->margin_left + (layout->card_size.width + layout->card_spacing.width) * col
, layout->margin_top + (layout->card_size.height + layout->card_spacing.height) * row);
// determine rotation
StyleSheet& stylesheet = *set->stylesheetFor(card);
const StyleSheet& stylesheet = set->stylesheetFor(card);
int rotation = 0;
if ((stylesheet.card_width > stylesheet.card_height) != layout->card_landscape) {
rotation = 90 - rotation;
+1 -1
View File
@@ -27,7 +27,7 @@ void print_set(Window* parent, const SetP& set);
// ----------------------------------------------------------------------------- : Layout
/// Layout of a page of cards
class PageLayout {
class PageLayout : public IntrusivePtrBase<PageLayout> {
public:
PageLayout();
PageLayout(const StyleSheet& stylesheet, const RealSize& page_size);
+2 -2
View File
@@ -150,7 +150,7 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
case ID_CARD_PREV: ev.Enable(card_list->canSelectPrevious()); break;
case ID_CARD_NEXT: ev.Enable(card_list->canSelectNext()); break;
case ID_CARD_ROTATE_0: case ID_CARD_ROTATE_90: case ID_CARD_ROTATE_180: case ID_CARD_ROTATE_270: {
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*set->stylesheetFor(card_list->getCard()));
StyleSheetSettings& ss = settings.stylesheetSettingsFor(set->stylesheetFor(card_list->getCard()));
int a = ev.GetId() == ID_CARD_ROTATE_0 ? 0
: ev.GetId() == ID_CARD_ROTATE_90 ? 90
: ev.GetId() == ID_CARD_ROTATE_180 ? 180
@@ -203,7 +203,7 @@ void CardsPanel::onCommand(int id) {
break;
case ID_CARD_ROTATE:
case ID_CARD_ROTATE_0: case ID_CARD_ROTATE_90: case ID_CARD_ROTATE_180: case ID_CARD_ROTATE_270: {
StyleSheetSettings& ss = settings.stylesheetSettingsFor(*set->stylesheetFor(card_list->getCard()));
StyleSheetSettings& ss = settings.stylesheetSettingsFor(set->stylesheetFor(card_list->getCard()));
ss.card_angle.assign(
id == ID_CARD_ROTATE ? (ss.card_angle() + 90) % 360
: id == ID_CARD_ROTATE_0 ? 0
+4 -4
View File
@@ -305,10 +305,10 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) {
if (ev.keyword) {
Keyword& kw = *ev.keyword;
sp->Show(fixed, kw.fixed);
keyword ->setValue(new_shared5<KeywordTextValue> (keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true));
match ->setValue(new_shared4<KeywordTextValue> (match->getFieldP(), &kw, &kw.match, !kw.fixed));
rules ->setValue(new_shared4<KeywordTextValue> (rules->getFieldP(), &kw, &kw.rules, !kw.fixed));
shared_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(reminder->getFieldP(), &kw, !kw.fixed));
keyword ->setValue(new_intrusive5<KeywordTextValue> (keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true));
match ->setValue(new_intrusive4<KeywordTextValue> (match->getFieldP(), &kw, &kw.match, !kw.fixed));
rules ->setValue(new_intrusive4<KeywordTextValue> (rules->getFieldP(), &kw, &kw.rules, !kw.fixed));
intrusive_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(reminder->getFieldP(), &kw, !kw.fixed));
reminder->setValue(reminder_value);
errors->SetLabel(reminder_value->errors);
add_param->Enable(!kw.fixed && !set->game->keyword_parameter_types.empty());
+5
View File
@@ -7,9 +7,14 @@
// ----------------------------------------------------------------------------- : Includes
#include <gui/set/panel.hpp>
#include <data/card.hpp>
// ----------------------------------------------------------------------------- : SetWindowPanel
SetWindowPanel::SetWindowPanel(Window* parent, int id, bool autoTabbing)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, autoTabbing ? wxTAB_TRAVERSAL : 0)
{}
CardP SetWindowPanel::selectedCard() const {
return CardP();
}
+2 -2
View File
@@ -22,7 +22,7 @@ class wxFindReplaceData;
class SetWindowPanel : public wxPanel, public SetView {
public:
SetWindowPanel(Window* parent, int id, bool autoTabbing = false);
/// We will probably want to respond to set changes
virtual void onSetChange() {}
@@ -66,7 +66,7 @@ class SetWindowPanel : public wxPanel, public SetView {
virtual bool doReplaceAll(wxFindReplaceData&) { return false; } ///< Replace all matches
// --------------------------------------------------- : Selection
virtual CardP selectedCard() const { return CardP(); } ///< Return the currently selected card, or CardP()
virtual CardP selectedCard() const; ///< Return the currently selected card, or CardP()
virtual void selectCard(const CardP& card) {} ///< Switch the view to another card
virtual void selectFirstCard() {} ///< Switch the view to the first card
};
+2 -2
View File
@@ -148,7 +148,7 @@ void StatsPanel::onCategorySelect() {
StatsCategory& cat = categories->getSelection();
GraphDataPre d;
FOR_EACH(dim, cat.dimensions) {
d.axes.push_back(new_shared4<GraphAxis>(
d.axes.push_back(new_intrusive4<GraphAxis>(
dim->name,
dim->colors.empty() ? AUTO_COLOR_EVEN : AUTO_COLOR_NO,
dim->numeric,
@@ -183,7 +183,7 @@ void StatsPanel::onGraphSelect(wxCommandEvent&) {
void StatsPanel::filterCards() {
if (!categories->hasSelection()) return;
shared_ptr<StatsFilter> filter(new StatsFilter(*set));
intrusive_ptr<StatsFilter> filter(new StatsFilter(*set));
StatsCategory& cat = categories->getSelection();
vector<pair<StatsDimensionP, String> > values;
int i = 0;
+7 -7
View File
@@ -46,19 +46,19 @@ void StylePanel::onChangeSet() {
list->select(set->stylesheet->name(), false);
editor->setSet(set);
preview->setSet(set);
card.reset();
card = CardP();
use_for_all->Enable(false);
}
void StylePanel::onAction(const Action& action, bool undone) {
TYPE_CASE_(action, ChangeSetStyleAction) {
list->select(set->stylesheetFor(card)->name(), false);
editor->showStylesheet(set->stylesheetFor(card));
list->select(set->stylesheetFor(card).name(), false);
editor->showStylesheet(set->stylesheetForP(card));
}
TYPE_CASE(action, ChangeCardStyleAction) {
if (action.card == card) {
list->select(set->stylesheetFor(card)->name(), false);
editor->showStylesheet(set->stylesheetFor(card));
list->select(set->stylesheetFor(card).name(), false);
editor->showStylesheet(set->stylesheetForP(card));
}
}
use_for_all->Enable(card && card->stylesheet);
@@ -69,8 +69,8 @@ void StylePanel::onAction(const Action& action, bool undone) {
void StylePanel::selectCard(const CardP& card) {
this->card = card;
preview->setCard(card);
editor->showStylesheet(set->stylesheetFor(card));
list->select(set->stylesheetFor(card)->name(), false);
editor->showStylesheet(set->stylesheetForP(card));
list->select(set->stylesheetFor(card).name(), false);
use_for_all->Enable(card && card->stylesheet);
}
+1 -1
View File
@@ -233,7 +233,7 @@ bool SetWindow::isOnlyWithSet() {
void SetWindow::onChangeSet() {
// make sure there is always at least one card
// some things need this
if (set->cards.empty()) set->cards.push_back(new_shared1<Card>(*set->game));
if (set->cards.empty()) set->cards.push_back(new_intrusive1<Card>(*set->game));
// all panels view the same set
FOR_EACH(p, panels) {
p->setSet(set);
+12 -12
View File
@@ -178,7 +178,7 @@ void SymbolBasicShapeEditor::makeShape(const Vector2D& a, const Vector2D& b, boo
// TODO : Move out of this class
void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bool constrained) {
shape = new_shared<SymbolPart>();
shape = new_intrusive<SymbolPart>();
// What shape to make?
switch (mode) {
case ID_SHAPE_CIRCLE: {
@@ -191,10 +191,10 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
// a circle has 4 control points, the first is: (x+r, y) db(0, kr) da(0, -kr)
// kr is a magic constant
const double kr = 0.5522847498f; // = 4/3 * (sqrt(2) - 1)
shape->points.push_back(new_shared7<ControlPoint>(c.x + r.x, c.y, 0, kr * r.y, 0, -kr * r.y, LOCK_SIZE));
shape->points.push_back(new_shared7<ControlPoint>(c.x, c.y - r.y, kr * r.x, 0, -kr * r.x, 0, LOCK_SIZE));
shape->points.push_back(new_shared7<ControlPoint>(c.x - r.x, c.y, 0, -kr * r.y, 0, kr * r.y, LOCK_SIZE));
shape->points.push_back(new_shared7<ControlPoint>(c.x, c.y + r.y, -kr * r.x, 0, kr * r.x, 0, LOCK_SIZE));
shape->points.push_back(new_intrusive7<ControlPoint>(c.x + r.x, c.y, 0, kr * r.y, 0, -kr * r.y, LOCK_SIZE));
shape->points.push_back(new_intrusive7<ControlPoint>(c.x, c.y - r.y, kr * r.x, 0, -kr * r.x, 0, LOCK_SIZE));
shape->points.push_back(new_intrusive7<ControlPoint>(c.x - r.x, c.y, 0, -kr * r.y, 0, kr * r.y, LOCK_SIZE));
shape->points.push_back(new_intrusive7<ControlPoint>(c.x, c.y + r.y, -kr * r.x, 0, kr * r.x, 0, LOCK_SIZE));
break;
} case ID_SHAPE_RECTANGLE: {
// A rectangle / square
@@ -204,10 +204,10 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
shape->name = capitalize(_TYPE_("rectangle"));
}
// a rectangle just has four corners
shape->points.push_back(new_shared2<ControlPoint>(c.x - r.x, c.y - r.y));
shape->points.push_back(new_shared2<ControlPoint>(c.x + r.x, c.y - r.y));
shape->points.push_back(new_shared2<ControlPoint>(c.x + r.x, c.y + r.y));
shape->points.push_back(new_shared2<ControlPoint>(c.x - r.x, c.y + r.y));
shape->points.push_back(new_intrusive2<ControlPoint>(c.x - r.x, c.y - r.y));
shape->points.push_back(new_intrusive2<ControlPoint>(c.x + r.x, c.y - r.y));
shape->points.push_back(new_intrusive2<ControlPoint>(c.x + r.x, c.y + r.y));
shape->points.push_back(new_intrusive2<ControlPoint>(c.x - r.x, c.y + r.y));
break;
} default: {
// A polygon or star
@@ -250,7 +250,7 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
// we can generate points
for(int i = 0 ; i < n ; ++i) {
double theta = alpha * i;
shape->points.push_back(new_shared2<ControlPoint>(
shape->points.push_back(new_intrusive2<ControlPoint>(
c.x + ra * r.x * sin(theta),
y - ra * r.y * cos(theta)
));
@@ -272,13 +272,13 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
for(int i = 0 ; i < n ; ++i) {
double theta = alpha * i;
// from a
shape->points.push_back(new_shared2<ControlPoint>(
shape->points.push_back(new_intrusive2<ControlPoint>(
c.x + ra * r.x * sin(theta),
y - ra * r.y * cos(theta)
));
// from b
theta = alpha * (i + 0.5);
shape->points.push_back(new_shared2<ControlPoint>(
shape->points.push_back(new_intrusive2<ControlPoint>(
c.x + rb * r.x * sin(theta),
y - rb * r.y * cos(theta)
));
+8 -8
View File
@@ -37,22 +37,22 @@ void SymbolControl::switchEditor(const SymbolEditorBaseP& e) {
void SymbolControl::onChangeSymbol() {
selected_parts.clear();
switchEditor(new_shared2<SymbolSelectEditor>(this, false));
switchEditor(new_intrusive2<SymbolSelectEditor>(this, false));
Refresh(false);
}
void SymbolControl::onModeChange(wxCommandEvent& ev) {
switch (ev.GetId()) {
case ID_MODE_SELECT:
switchEditor(new_shared2<SymbolSelectEditor>(this, false));
switchEditor(new_intrusive2<SymbolSelectEditor>(this, false));
break;
case ID_MODE_ROTATE:
switchEditor(new_shared2<SymbolSelectEditor>(this, true));
switchEditor(new_intrusive2<SymbolSelectEditor>(this, true));
break;
case ID_MODE_POINTS:
if (selected_parts.size() == 1) {
single_selection = *selected_parts.begin();
switchEditor(new_shared2<SymbolPointEditor>(this, single_selection));
switchEditor(new_intrusive2<SymbolPointEditor>(this, single_selection));
}
break;
case ID_MODE_SHAPES:
@@ -60,7 +60,7 @@ void SymbolControl::onModeChange(wxCommandEvent& ev) {
selected_parts.clear();
signalSelectionChange();
}
switchEditor(new_shared1<SymbolBasicShapeEditor>(this));
switchEditor(new_intrusive1<SymbolBasicShapeEditor>(this));
break;
}
}
@@ -102,7 +102,7 @@ void SymbolControl::onUpdateSelection() {
if (single_selection != *selected_parts.begin()) {
// begin editing another part
single_selection = *selected_parts.begin();
editor = new_shared2<SymbolPointEditor>(this, single_selection);
editor = new_intrusive2<SymbolPointEditor>(this, single_selection);
Refresh(false);
}
break;
@@ -122,14 +122,14 @@ void SymbolControl::onUpdateSelection() {
void SymbolControl::selectPart(const SymbolPartP& part) {
selected_parts.clear();
selected_parts.insert(part);
switchEditor(new_shared2<SymbolSelectEditor>(this, false));
switchEditor(new_intrusive2<SymbolSelectEditor>(this, false));
signalSelectionChange();
}
void SymbolControl::activatePart(const SymbolPartP& part) {
selected_parts.clear();
selected_parts.insert(part);
switchEditor(new_shared2<SymbolPointEditor>(this, part));
switchEditor(new_intrusive2<SymbolPointEditor>(this, part));
}
void SymbolControl::signalSelectionChange() {
+1 -1
View File
@@ -22,7 +22,7 @@ class SymbolControl;
* Differrent SymbolEditors represent different tools.
* NOTE : Do not confuse with SymbolEditor (a FieldEditor)
*/
class SymbolEditorBase {
class SymbolEditorBase : public IntrusivePtrVirtualBase {
protected:
/// The control for which we are editing
SymbolControl& control;
+1 -1
View File
@@ -84,7 +84,7 @@ wxThread::ExitCode ThumbnailThreadWorker::Entry() {
{
wxMutexLocker lock(parent->mutex);
parent->closed_requests.push_back(make_pair(current,img));
current.reset();
current = ThumbnailRequestP();
parent->completed.Signal();
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ class ThumbnailThreadWorker;
// ----------------------------------------------------------------------------- : ThumbnailRequest
/// A request for some kind of thumbnail
class ThumbnailRequest {
class ThumbnailRequest : public IntrusivePtrVirtualBase {
public:
ThumbnailRequest(void* owner, const String& cache_name, const wxDateTime& modified)
: owner(owner), cache_name(cache_name), modified(modified) {}
+2 -2
View File
@@ -21,7 +21,7 @@ DECLARE_POINTER_TYPE(VersionData);
// ----------------------------------------------------------------------------- : Update data
/// Information on available packages
class PackageVersionData {
class PackageVersionData : public IntrusivePtrBase<PackageVersionData> {
public:
PackageVersionData() : is_installer(true) {}
@@ -34,7 +34,7 @@ class PackageVersionData {
};
/// Information on the latest availible version
class VersionData {
class VersionData : public IntrusivePtrBase<VersionData> {
public:
Version version; ///< Latest version number of MSE
String description; ///< html description of the latest MSE release
+1 -1
View File
@@ -163,7 +163,7 @@ void DropDownChoiceListBase::generateThumbnailImages() {
ThumbnailStatus status = style().thumbnails_status[i];
if (i >= image_count || status != THUMB_OK) {
// request this thumbnail
thumbnail_thread.request( new_shared3<ChoiceThumbnailRequest>(&cve, i, status == THUMB_NOT_MADE) );
thumbnail_thread.request( new_intrusive3<ChoiceThumbnailRequest>(&cve, i, status == THUMB_NOT_MADE) );
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@
#include <gui/drop_down_list.hpp>
#include <render/value/choice.hpp>
DECLARE_POINTER_TYPE(DropDownList);
DECLARE_SHARED_POINTER_TYPE(DropDownList);
// ----------------------------------------------------------------------------- : ChoiceValueEditor
+1 -1
View File
@@ -13,7 +13,7 @@
#include <gui/value/editor.hpp>
#include <render/value/color.hpp>
DECLARE_POINTER_TYPE(DropDownList);
DECLARE_SHARED_POINTER_TYPE(DropDownList);
// ----------------------------------------------------------------------------- : ColorValueEditor
+1 -1
View File
@@ -37,7 +37,7 @@ void ImageValueEditor::sliceImage(const Image& image) {
if (mask_image.LoadFile(*image_file)) {
Image resampled(style().width, style().height);
resample(mask_image, resampled);
mask = new_shared1<AlphaMask>(resampled);
mask = new_intrusive1<AlphaMask>(resampled);
}
}
// slice
+2 -2
View File
@@ -89,8 +89,8 @@ void WelcomeWindow::onNewSet(wxCommandEvent&) {
// TODO: MOVEME
template <typename T>
shared_ptr<T> open_package(const String& filename) {
shared_ptr<T> package(new T);
intrusive_ptr<T> open_package(const String& filename) {
intrusive_ptr<T> package(new T);
package->open(filename);
return package;
}