Adding support for the "media" play/pause/stop/next/prev buttons

available on many keyboards these days, so that they can be used for
animation playback (giving more options over alt-a and alt-a ad-
infinitum).

Currently, this is Windows only as I don't have a Linux/Mac system to
test on (it should compile with both mingw and msvc, at least using
scons). Maintainers for those systems can probably easily add this in
once they find out the relevant mappings for those systems.
This commit is contained in:
Joshua Leung
2011-02-18 22:42:03 +00:00
parent 65aac7c506
commit 346f749a57
7 changed files with 54 additions and 3 deletions

View File

@@ -353,7 +353,13 @@ typedef enum {
GHOST_kKeyF21,
GHOST_kKeyF22,
GHOST_kKeyF23,
GHOST_kKeyF24
GHOST_kKeyF24,
// Multimedia keypad buttons
GHOST_kKeyMediaPlay,
GHOST_kKeyMediaStop,
GHOST_kKeyMediaFirst,
GHOST_kKeyMediaLast
} GHOST_TKey;
typedef enum {

View File

@@ -325,6 +325,18 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, STR_String& str) const
case GHOST_kKeyNumpadSlash:
str = "NumpadSlash";
break;
case GHOST_kKeyMediaPlay:
str = "MediaPlayPause";
break;
case GHOST_kKeyMediaStop:
str = "MediaStop";
break;
case GHOST_kKeyMediaFirst:
str = "MediaFirst";
break;
case GHOST_kKeyMediaLast:
str = "MediaLast";
break;
default:
str = "unknown";
break;

View File

@@ -136,6 +136,19 @@
#define VK_GR_LESS 0xE2
#endif // VK_GR_LESS
#ifndef VK_MEDIA_NEXT_TRACK
#define VK_MEDIA_NEXT_TRACK 0xB0
#endif // VK_MEDIA_NEXT_TRACK
#ifndef VK_MEDIA_PREV_TRACK
#define VK_MEDIA_PREV_TRACK 0xB1
#endif // VK_MEDIA_PREV_TRACK
#ifndef VK_MEDIA_STOP
#define VK_MEDIA_STOP 0xB2
#endif // VK_MEDIA_STOP
#ifndef VK_MEDIA_PLAY_PAUSE
#define VK_MEDIA_PLAY_PAUSE 0xB3
#endif // VK_MEDIA_PLAY_PAUSE
GHOST_SystemWin32::GHOST_SystemWin32()
: m_hasPerformanceCounter(false), m_freq(0), m_start(0)
@@ -640,6 +653,10 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, L
case VK_OEM_8:
key = ((GHOST_SystemWin32*)getSystem())->processSpecialKey(window, wParam, lParam);
break;
case VK_MEDIA_PLAY_PAUSE: key = GHOST_kKeyMediaPlay; break;
case VK_MEDIA_STOP: key = GHOST_kKeyMediaStop; break;
case VK_MEDIA_PREV_TRACK: key = GHOST_kKeyMediaFirst; break;
case VK_MEDIA_NEXT_TRACK: key = GHOST_kKeyMediaLast; break;
default:
key = GHOST_kKeyUnknown;
break;

View File

@@ -331,7 +331,7 @@ static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *
int rna_Object_is_visible(Object *ob, Scene *sce)
{
return !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->lay & sce->lay;
return !(ob->restrictflag & OB_RESTRICT_VIEW) && (ob->lay & sce->lay);
}
/*

View File

@@ -241,6 +241,11 @@ EnumPropertyItem event_type_items[] = {
{PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", ""},
{ENDKEY, "END", 0, "End", ""},
{0, "", 0, NULL, NULL},
{MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ""},
{MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", ""},
{MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", ""},
{MEDIALAST, "MEDIA_LAST", 0, "Media Last", ""},
{0, "", 0, NULL, NULL},
{WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""},
{TIMER, "TIMER", 0, "Timer", ""},
{TIMER0, "TIMER0", 0, "Timer 0", ""},

View File

@@ -2197,6 +2197,11 @@ static int convert_key(GHOST_TKey key)
case GHOST_kKeyGrLess: return GRLESSKEY;
case GHOST_kKeyMediaPlay: return MEDIAPLAY;
case GHOST_kKeyMediaStop: return MEDIASTOP;
case GHOST_kKeyMediaFirst: return MEDIAFIRST;
case GHOST_kKeyMediaLast: return MEDIALAST;
default:
return UNKNOWNKEY; /* GHOST_kKeyUnknown */
}

View File

@@ -207,6 +207,12 @@
#define OSKEY 172
#define GRLESSKEY 173
// XXX: are these codes ok?
#define MEDIAPLAY 174
#define MEDIASTOP 175
#define MEDIAFIRST 176
#define MEDIALAST 177
/* for event checks */
/* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
#define ISTEXTINPUT(event) (event >=' ' && event <=255)