diff --git a/src/gui/set/style_panel.cpp b/src/gui/set/style_panel.cpp index bd5a7e99..4f1770a2 100644 --- a/src/gui/set/style_panel.cpp +++ b/src/gui/set/style_panel.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,7 @@ StylePanel::StylePanel(Window* parent, int id) 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")); - editor = new StylingEditor(this, wxID_ANY, wxNO_BORDER); + editor = new StylingEditor(this, ID_EDITOR, wxNO_BORDER); // init sizer wxSizer* s = new wxBoxSizer(wxHORIZONTAL); s->Add(preview, 0, wxRIGHT, 2); @@ -103,6 +104,21 @@ void StylePanel::selectCard(const CardP& card) { use_custom_options->SetValue(card ? card->has_styling : false); } +// ----------------------------------------------------------------------------- : Clipboard + +// determine what control to use for clipboard actions +#define CUT_COPY_PASTE(op,return) \ + int id = focused_control(this); \ + if (id == ID_EDITOR) { return editor->op(); } \ + else { return false; } + +bool StylePanel::canCopy() const { CUT_COPY_PASTE(canCopy, return) } +bool StylePanel::canCut() const { CUT_COPY_PASTE(canCut, return) } +bool StylePanel::canPaste() const { CUT_COPY_PASTE(canPaste, return) } +void StylePanel::doCopy() { CUT_COPY_PASTE(doCopy, return (void)) } +void StylePanel::doCut() { CUT_COPY_PASTE(doCut, return (void)) } +void StylePanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void)) } + // ----------------------------------------------------------------------------- : Events void StylePanel::onStyleSelect(wxCommandEvent&) { diff --git a/src/gui/set/style_panel.hpp b/src/gui/set/style_panel.hpp index 2aa6c9d0..8bb3a52a 100644 --- a/src/gui/set/style_panel.hpp +++ b/src/gui/set/style_panel.hpp @@ -26,6 +26,14 @@ class StylePanel : public SetWindowPanel { virtual void onChangeSet(); virtual void onAction(const Action&, bool undone); + // --------------------------------------------------- : Clipboard + virtual bool canCut() const; + virtual bool canCopy() const; + virtual bool canPaste() const; + virtual void doCut(); + virtual void doCopy(); + virtual void doPaste(); + // --------------------------------------------------- : Selection virtual void selectCard(const CardP& card);