From 7faddb9d9075ed8eff41cd5e9c106905d6ed9fe5 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 13 May 2007 22:19:08 +0000 Subject: [PATCH] cut/delete for image values git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@359 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/value/image.cpp | 17 +++++++++++++++++ src/gui/value/image.hpp | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gui/value/image.cpp b/src/gui/value/image.cpp index afba1420..b3c66e5a 100644 --- a/src/gui/value/image.cpp +++ b/src/gui/value/image.cpp @@ -85,3 +85,20 @@ bool ImageValueEditor::doPaste() { sliceImage(data.GetBitmap().ConvertToImage()); return true; } + +bool ImageValueEditor::doDelete() { + getSet().actions.add(value_action(valueP(), FileName())); + return true; +} + + +bool ImageValueEditor::onChar(wxKeyEvent& ev) { + if (ev.AltDown() || ev.ShiftDown() || ev.ControlDown()) return false; + switch (ev.GetKeyCode()) { + case WXK_DELETE: + doDelete(); + return true; + default: + return false; + } +} diff --git a/src/gui/value/image.hpp b/src/gui/value/image.hpp index 60f6aa9a..5231683d 100644 --- a/src/gui/value/image.hpp +++ b/src/gui/value/image.hpp @@ -25,10 +25,12 @@ class ImageValueEditor : public ImageValueViewer, public ValueEditor { // --------------------------------------------------- : Clipboard virtual bool canCopy() const; - virtual bool canCut() const { return false; } virtual bool canPaste() const; virtual bool doCopy(); virtual bool doPaste(); + virtual bool doDelete(); + + virtual bool onChar(wxKeyEvent&); private: // Open the image slice window showing the give image