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:
twanvl
2007-06-24 01:30:34 +00:00
parent df9bb78e51
commit f0628317a3
25 changed files with 147 additions and 21 deletions
+24 -7
View File
@@ -23,10 +23,11 @@ StylePanel::StylePanel(Window* parent, int id)
: SetWindowPanel(parent, id)
{
// init controls
preview = new CardViewer (this, wxID_ANY);
editor = new StylingEditor(this, wxID_ANY, wxNO_BORDER);
list = new PackageList (this, wxID_ANY);
use_for_all = new wxButton (this, ID_STYLE_USE_FOR_ALL, _BUTTON_("use for all cards"));
preview = new CardViewer (this, wxID_ANY);
editor = new StylingEditor(this, wxID_ANY, wxNO_BORDER);
list = new PackageList (this, wxID_ANY);
use_for_all = new wxButton (this, ID_STYLE_USE_FOR_ALL, _BUTTON_("use for all cards"));
use_custom_options = new wxCheckBox(this, ID_STYLE_USE_CUSTOM, _BUTTON_("use custom styling options"));
// init sizer
wxSizer* s = new wxBoxSizer(wxHORIZONTAL);
s->Add(preview, 0, wxRIGHT, 2);
@@ -34,7 +35,8 @@ StylePanel::StylePanel(Window* parent, int id)
s2->Add(list, 0, wxEXPAND | wxBOTTOM, 4);
s2->Add(use_for_all, 0, wxRIGHT | wxBOTTOM | wxALIGN_RIGHT, 4);
wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("styling options"));
s3->Add(editor, 2, wxEXPAND, 0);
s3->Add(use_custom_options, 0, wxEXPAND, 0);
s3->Add(editor, 2, wxEXPAND, 0);
s2->Add(s3, 1, wxEXPAND | wxALL, 2);
s->Add(s2, 1, wxEXPAND, 8);
s->SetSizeHints(this);
@@ -53,15 +55,22 @@ void StylePanel::onChangeSet() {
void StylePanel::onAction(const Action& action, bool undone) {
TYPE_CASE_(action, ChangeSetStyleAction) {
list->select(set->stylesheetFor(card).name(), false);
editor->showStylesheet(set->stylesheetForP(card));
editor->showCard(card);
}
TYPE_CASE(action, ChangeCardStyleAction) {
if (action.card == card) {
list->select(set->stylesheetFor(card).name(), false);
editor->showStylesheet(set->stylesheetForP(card));
editor->showCard(card);
}
}
TYPE_CASE(action, ChangeCardHasStylingAction) {
if (action.card == card) {
editor->showCard(card);
}
}
use_for_all->Enable(card && card->stylesheet);
use_custom_options->Enable(card);
use_custom_options->SetValue(card->has_styling);
}
// ----------------------------------------------------------------------------- : Selection
@@ -70,8 +79,11 @@ void StylePanel::selectCard(const CardP& card) {
this->card = card;
preview->setCard(card);
editor->showStylesheet(set->stylesheetForP(card));
editor->showCard(card);
list->select(set->stylesheetFor(card).name(), false);
use_for_all->Enable(card && card->stylesheet);
use_custom_options->Enable(card);
use_custom_options->SetValue(card->has_styling);
}
// ----------------------------------------------------------------------------- : Events
@@ -93,7 +105,12 @@ void StylePanel::onUseForAll(wxCommandEvent&) {
Layout();
}
void StylePanel::onUseCustom(wxCommandEvent&) {
set->actions.add(new ChangeCardHasStylingAction(*set, card));
}
BEGIN_EVENT_TABLE(StylePanel, wxPanel)
EVT_GALLERY_SELECT(wxID_ANY, StylePanel::onStyleSelect)
EVT_BUTTON (ID_STYLE_USE_FOR_ALL, StylePanel::onUseForAll)
EVT_CHECKBOX (ID_STYLE_USE_CUSTOM, StylePanel::onUseCustom)
END_EVENT_TABLE()