mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added clone() function to Value.
Added support for per-card styling git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@430 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+24
-2
@@ -12,6 +12,8 @@
|
||||
#include <data/stylesheet.hpp>
|
||||
#include <util/error.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(IndexMap<FieldP COMMA ValueP>);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Add card
|
||||
|
||||
AddCardAction::AddCardAction(Set& set)
|
||||
@@ -91,13 +93,15 @@ void DisplayChangeAction::perform(bool to_undo) {
|
||||
|
||||
|
||||
ChangeCardStyleAction::ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet)
|
||||
: card(card), stylesheet(stylesheet)
|
||||
: card(card), stylesheet(stylesheet), has_styling(false) // styling_data(empty)
|
||||
{}
|
||||
String ChangeCardStyleAction::getName(bool to_undo) const {
|
||||
return _("Change style");
|
||||
}
|
||||
void ChangeCardStyleAction::perform(bool to_undo) {
|
||||
swap(card->stylesheet, stylesheet);
|
||||
swap(card->stylesheet, stylesheet);
|
||||
swap(card->has_styling, has_styling);
|
||||
swap(card->styling_data, styling_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,3 +121,21 @@ void ChangeSetStyleAction::perform(bool to_undo) {
|
||||
set.stylesheet = stylesheet;
|
||||
}
|
||||
}
|
||||
|
||||
ChangeCardHasStylingAction::ChangeCardHasStylingAction(Set& set, const CardP& card)
|
||||
: set(set), card(card)
|
||||
{
|
||||
if (!card->has_styling) {
|
||||
// copy of the set's styling data
|
||||
styling_data.cloneFrom( set.stylingDataFor(set.stylesheetFor(card)) );
|
||||
} else {
|
||||
// the new styling data is empty
|
||||
}
|
||||
}
|
||||
String ChangeCardHasStylingAction::getName(bool to_undo) const {
|
||||
return _("Use custom style");
|
||||
}
|
||||
void ChangeCardHasStylingAction::perform(bool to_undo) {
|
||||
card->has_styling = !card->has_styling;
|
||||
swap(card->styling_data, styling_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user