mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
added 'undone' parameter to onAction
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@43 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -39,12 +39,10 @@ void AddCardAction::perform(bool to_undo) {
|
||||
|
||||
RemoveCardAction::RemoveCardAction(Set& set, const CardP& card)
|
||||
: CardListAction(set), card(card)
|
||||
{
|
||||
// find the card_id of the card we want to remove
|
||||
vector<CardP>::iterator it = find(set.cards.begin(), set.cards.end(), card);
|
||||
if (it != set.cards.end()) {
|
||||
card_id = it - set.cards.begin();
|
||||
} else {
|
||||
, card_id(find(set.cards.begin(), set.cards.end(), card) - set.cards.begin())
|
||||
{
|
||||
if (card_id >= set.cards.size()) {
|
||||
throw InternalError(_("Card to remove not found in set"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ class AddCardAction : public CardListAction {
|
||||
virtual String getName(bool to_undo) const;
|
||||
virtual void perform(bool to_undo);
|
||||
|
||||
private:
|
||||
CardP card; ///< The new card
|
||||
//private:
|
||||
const CardP card; ///< The new card
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Remove card
|
||||
@@ -54,9 +54,9 @@ class RemoveCardAction : public CardListAction {
|
||||
virtual String getName(bool to_undo) const;
|
||||
virtual void perform(bool to_undo);
|
||||
|
||||
private:
|
||||
CardP card; ///< The removed card
|
||||
size_t card_id; ///< Position of the card in the set
|
||||
//private:
|
||||
const CardP card; ///< The removed card
|
||||
const size_t card_id; ///< Position of the card in the set
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Reorder cards
|
||||
@@ -69,8 +69,8 @@ class ReorderCardsAction : public CardListAction {
|
||||
virtual String getName(bool to_undo) const;
|
||||
virtual void perform(bool to_undo);
|
||||
|
||||
private:
|
||||
size_t card_id1, card_id2; ///< Positions of the two cards to swap
|
||||
//private:
|
||||
const size_t card_id1, card_id2; ///< Positions of the two cards to swap
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class Set : public Packaged {
|
||||
// ----------------------------------------------------------------------------- : SetView
|
||||
|
||||
/// A 'view' of a Set, is notified when the Set is updated
|
||||
/** To listen to events, derived classes should override onAction(const Action&)
|
||||
/** To listen to events, derived classes should override onAction(const Action&, bool undone)
|
||||
*/
|
||||
class SetView : public ActionListener {
|
||||
public:
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ class Symbol {
|
||||
// ----------------------------------------------------------------------------- : SymbolView
|
||||
|
||||
/// A 'view' of a symbol, is notified when the symbol is updated
|
||||
/** To listen to events, derived classes should override onAction(const Action&)
|
||||
/** To listen to events, derived classes should override onAction(const Action&, bool undone)
|
||||
*/
|
||||
class SymbolView : public ActionListener {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user