mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fixed: "Double click to select image" text now always shown when editing;
Correct control used for clipboard actions in CardsPanel git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@253 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -39,6 +39,9 @@ bool DataEditor::drawBorders() const {
|
||||
settings.stylesheetSettingsFor(*set->stylesheetFor(card)).card_borders();
|
||||
}
|
||||
bool DataEditor::drawEditing() const {
|
||||
return true;
|
||||
}
|
||||
bool DataEditor::drawFocus() const {
|
||||
return FindFocus() == this;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class DataEditor : public CardViewer {
|
||||
|
||||
virtual bool drawBorders() const;
|
||||
virtual bool drawEditing() const;
|
||||
virtual bool drawFocus() const;
|
||||
virtual wxPen borderPen(bool active) const;
|
||||
virtual ValueViewer* focusedViewer() const;
|
||||
|
||||
|
||||
@@ -249,12 +249,20 @@ bool CardsPanel::wantsToHandle(const Action&, bool undone) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Clipboard
|
||||
|
||||
bool CardsPanel::canCut() const { return focused_control(this) == ID_EDITOR ? editor->canCut() : card_list->canCut(); }
|
||||
bool CardsPanel::canCopy() const { return focused_control(this) == ID_EDITOR ? editor->canCopy() : card_list->canCopy(); }
|
||||
bool CardsPanel::canPaste() const { return focused_control(this) == ID_EDITOR ? editor->canPaste() : card_list->canPaste(); }
|
||||
void CardsPanel::doCut() { if (focused_control(this) == ID_EDITOR) editor->doCut(); else card_list->doCut(); }
|
||||
void CardsPanel::doCopy() { if (focused_control(this) == ID_EDITOR) editor->doCopy(); else card_list->doCopy(); }
|
||||
void CardsPanel::doPaste() { if (focused_control(this) == ID_EDITOR) editor->doPaste(); else card_list->doPaste(); }
|
||||
// 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 if (id == ID_CARD_LIST) { return card_list->op(); } \
|
||||
else if (id == ID_NOTES) { return notes->op(); } \
|
||||
else { return false; }
|
||||
|
||||
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, ;) }
|
||||
void CardsPanel::doCopy() { CUT_COPY_PASTE(doCopy, ;) }
|
||||
void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, ;) }
|
||||
|
||||
// ----------------------------------------------------------------------------- : Searching
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ void DataViewer::drawViewer(RotatedDC& dc, ValueViewer& v) {
|
||||
bool DataViewer::nativeLook() const { return false; }
|
||||
bool DataViewer::drawBorders() const { return false; }
|
||||
bool DataViewer::drawEditing() const { return false; }
|
||||
bool DataViewer::drawFocus() const { return false; }
|
||||
wxPen DataViewer::borderPen(bool) const { return wxPen(); }
|
||||
ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
|
||||
Context& DataViewer::getContext() const { return set->getContext(); }
|
||||
|
||||
@@ -42,6 +42,9 @@ class DataViewer : public SetView {
|
||||
/// Should editing specific things be drawn?
|
||||
/** false by default, can be overloaded */
|
||||
virtual bool drawEditing() const;
|
||||
/// Should focus only editing specific things be drawn?
|
||||
/** false by default, can be overloaded */
|
||||
virtual bool drawFocus() const;
|
||||
/// Pens for drawing field borders (only called if drawBorders())
|
||||
virtual wxPen borderPen(bool active) const;
|
||||
/// The viewer that is currently focused, may be null
|
||||
|
||||
@@ -25,8 +25,8 @@ void TextValueViewer::draw(RotatedDC& dc) {
|
||||
v.prepare(dc, value().value(), style(), viewer.getContext());
|
||||
v.draw(dc, style(), (DrawWhat)(
|
||||
DRAW_NORMAL
|
||||
| (viewer.drawBorders() ? DRAW_BORDERS : 0)
|
||||
| (viewer.drawEditing() && isCurrent() ? DRAW_ACTIVE : 0)
|
||||
| (viewer.drawBorders() ? DRAW_BORDERS : 0)
|
||||
| (viewer.drawFocus() && isCurrent() ? DRAW_ACTIVE : 0)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user