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
+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);