From 7e60aab6034178883af05071c3169968de359cb9 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 31 Aug 2008 00:15:22 +0000 Subject: [PATCH] Allow cards to be pasted when another control is selected. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1185 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/set/cards_panel.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index 4e78d465..5f0ac7ed 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -329,10 +329,26 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const { bool CardsPanel::canCut() const { CUT_COPY_PASTE(canCut, return) } bool CardsPanel::canCopy() const { CUT_COPY_PASTE(canCopy, return) } -bool CardsPanel::canPaste() const { CUT_COPY_PASTE(canPaste, return) } void CardsPanel::doCut() { CUT_COPY_PASTE(doCut, return (void)) } void CardsPanel::doCopy() { CUT_COPY_PASTE(doCopy, return (void)) } -void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, return (void)) } + +// always alow pasting cards, even if something else is selected +bool CardsPanel::canPaste() const { + if (card_list->canPaste()) return true; + int id = focused_control(this); + if (id == ID_EDITOR) return editor->canPaste(); + else if (id == ID_NOTES) return notes->canPaste(); + else return false; +} +void CardsPanel::doPaste() { + if (card_list->canPaste()) { + card_list->doPaste(); + } else { + int id = focused_control(this); + if (id == ID_EDITOR) editor->doPaste(); + else if (id == ID_NOTES) notes->doPaste(); + } +} // ----------------------------------------------------------------------------- : Searching