mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07: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:
@@ -197,6 +197,11 @@ void StylingEditor::showStylesheet(const StyleSheetP& stylesheet) {
|
||||
setStyles(stylesheet, stylesheet->styling_style);
|
||||
setData(set->stylingDataFor(*stylesheet));
|
||||
}
|
||||
void StylingEditor::showCard(const CardP& card) {
|
||||
StyleSheetP stylesheet = set->stylesheetForP(card);
|
||||
setStyles(stylesheet, stylesheet->styling_style);
|
||||
setData(set->stylingDataFor(card));
|
||||
}
|
||||
|
||||
void StylingEditor::onChangeSet() {
|
||||
showStylesheet(set->stylesheet);
|
||||
|
||||
@@ -68,8 +68,10 @@ class StylingEditor : public NativeLookEditor {
|
||||
public:
|
||||
StylingEditor(Window* parent, int id, long style = 0);
|
||||
|
||||
/// Show the styling for given stylesheet in the editor
|
||||
/// Show the styling for given stylesheet in the editor
|
||||
void showStylesheet(const StyleSheetP& stylesheet);
|
||||
/// Show the styling for given card
|
||||
void showCard(const CardP& card);
|
||||
|
||||
protected:
|
||||
virtual void onChangeSet();
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -36,10 +36,12 @@ class StylePanel : public SetWindowPanel {
|
||||
PackageList* list; ///< List of stylesheets
|
||||
StylingEditor* editor; ///< Editor for styling information
|
||||
wxButton* use_for_all;
|
||||
wxCheckBox* use_custom_options;
|
||||
CardP card; ///< Card we are working on
|
||||
|
||||
void onStyleSelect(wxCommandEvent&);
|
||||
void onUseForAll(wxCommandEvent&);
|
||||
void onUseCustom(wxCommandEvent&);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
Reference in New Issue
Block a user