Implemented 2x highlight row jump with PageUp/Down

Closes #77
This commit is contained in:
Daniel Collin 2013-10-18 19:45:40 +02:00
parent c5e2a5076a
commit 54cbacc963
7 changed files with 40 additions and 20 deletions

View File

@ -24,6 +24,9 @@ enum EmguiSpecialKey
EMGUI_KEY_ARROW_RIGHT,
EMGUI_KEY_ARROW_LEFT,
EMGUI_KEY_PAGE_UP,
EMGUI_KEY_PAGE_DOWN,
EMGUI_KEY_ESC,
EMGUI_KEY_TAB,
EMGUI_KEY_BACKSPACE,

View File

@ -22,6 +22,9 @@ enum EmguiSpecialKey
EMGUI_KEY_ARROW_RIGHT,
EMGUI_KEY_ARROW_LEFT,
EMGUI_KEY_PAGE_DOWN,
EMGUI_KEY_PAGE_UP,
EMGUI_KEY_ESC,
EMGUI_KEY_TAB,
EMGUI_KEY_BACKSPACE,

View File

@ -1475,6 +1475,8 @@ void Editor_menuEvent(int menuItem)
case EDITOR_MENU_PLAY : onPlay(); break;
case EDITOR_MENU_ROWS_UP : onRowStep(-highlightRowStep , NO_SELECTION); break;
case EDITOR_MENU_ROWS_DOWN : onRowStep(highlightRowStep , NO_SELECTION); break;
case EDITOR_MENU_ROWS_2X_UP : onRowStep(-highlightRowStep * 2 , NO_SELECTION); break;
case EDITOR_MENU_ROWS_2X_DOWN : onRowStep(highlightRowStep * 2 , NO_SELECTION); break;
case EDITOR_MENU_PREV_BOOKMARK : onBookmarkDir(ARROW_UP, NO_SELECTION); break;
case EDITOR_MENU_NEXT_BOOKMARK : onBookmarkDir(ARROW_DOWN, NO_SELECTION); break;
case EDITOR_MENU_FIRST_TRACK : onTrackSide(ARROW_LEFT, true, NO_SELECTION); break;

View File

@ -55,6 +55,8 @@ MenuDescriptor g_viewMenu[] =
{ _T(""), EDITOR_MENU_SEPARATOR, 0, 0, 0 },
{ _T("Jump 8 rows up"), EDITOR_MENU_ROWS_UP, EMGUI_KEY_ARROW_UP, EMGUI_KEY_ALT, EMGUI_KEY_ALT },
{ _T("Jump 8 rows down"), EDITOR_MENU_ROWS_DOWN, EMGUI_KEY_ARROW_DOWN, EMGUI_KEY_ALT, EMGUI_KEY_ALT },
{ _T("Jump 16 rows up"), EDITOR_MENU_ROWS_2X_UP, EMGUI_KEY_PAGE_UP, 0, 0 },
{ _T("Jump 16 rows down"), EDITOR_MENU_ROWS_2X_DOWN, EMGUI_KEY_PAGE_DOWN, 0, 0 },
{ _T("Jump to previous bookmark"), EDITOR_MENU_PREV_BOOKMARK, EMGUI_KEY_ARROW_UP, EMGUI_KEY_COMMAND, EMGUI_KEY_ALT | EMGUI_KEY_CTRL },
{ _T("Jump to next bookmark"), EDITOR_MENU_NEXT_BOOKMARK, EMGUI_KEY_ARROW_DOWN, EMGUI_KEY_COMMAND, EMGUI_KEY_ALT | EMGUI_KEY_CTRL },
{ _T("Jump to first track"), EDITOR_MENU_FIRST_TRACK, EMGUI_KEY_ARROW_LEFT, EMGUI_KEY_COMMAND, EMGUI_KEY_CTRL },

View File

@ -61,6 +61,8 @@ enum
EDITOR_MENU_TRACK_RIGHT,
EDITOR_MENU_ROWS_DOWN,
EDITOR_MENU_ROWS_UP,
EDITOR_MENU_ROWS_2X_DOWN,
EDITOR_MENU_ROWS_2X_UP,
EDITOR_MENU_PREV_BOOKMARK,
EDITOR_MENU_NEXT_BOOKMARK,
EDITOR_MENU_FIRST_TRACK,

View File

@ -48,17 +48,17 @@ void Window_setTitle(const char* title);
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self == nil)
return nil;
self = [super initWithFrame:frame];
if (self == nil)
return nil;
NSOpenGLPixelFormatAttribute attributes[4];
NSOpenGLPixelFormatAttribute attributes[4];
attributes[0] = NSOpenGLPFADoubleBuffer;
attributes[1] = 0;
attributes[0] = NSOpenGLPFADoubleBuffer;
attributes[1] = 0;
NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
oglContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
oglContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
[oglContext makeCurrentContext];
g_context = oglContext;
@ -71,8 +71,8 @@ void Window_setTitle(const char* title);
const float framerate = 60;
const float frequency = 1.0f/framerate;
[NSTimer scheduledTimerWithTimeInterval:frequency
target:self selector:@selector(updateEditor)
userInfo:nil repeats:YES];
target:self selector:@selector(updateEditor)
userInfo:nil repeats:YES];
return self;
}
@ -81,26 +81,26 @@ void Window_setTitle(const char* title);
- (void)lockFocus
{
NSOpenGLContext* context = oglContext;
[super lockFocus];
if ([context view] != self)
[context setView:self];
[context makeCurrentContext];
NSOpenGLContext* context = oglContext;
[super lockFocus];
if ([context view] != self)
[context setView:self];
[context makeCurrentContext];
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)drawRect:(NSRect)frameRect
{
[oglContext update];
[oglContext update];
g_window = [self window];
EMGFXBackend_updateViewPort((int)frameRect.size.width, (int)frameRect.size.height);
Editor_setWindowSize((int)frameRect.size.width, (int)frameRect.size.height);
Editor_update();
Editor_update();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -156,6 +156,8 @@ static int getModifierFlags(int flags)
case KEY_DELETE : keyCode = EMGUI_KEY_BACKSPACE; break;
case KEY_RETURN : keyCode = EMGUI_KEY_ENTER; break;
case KEY_ESCAPE : keyCode = EMGUI_KEY_ESC; break;
case NSPageDownFunctionKey: keyCode = EMGUI_KEY_PAGE_DOWN; break;
case NSPageUpFunctionKey: keyCode = EMGUI_KEY_PAGE_UP; break;
}
}
@ -381,6 +383,8 @@ NSString* convertKeyCodeToString(int key)
case EMGUI_KEY_SPACE : return @" ";
case EMGUI_KEY_BACKSPACE : return [NSString stringWithFormat:@"%C",(uint16_t)0x232b];
case EMGUI_KEY_TAB : return [NSString stringWithFormat:@"%C",(uint16_t)0x21e4];
case EMGUI_KEY_PAGE_UP : return [NSString stringWithFormat:@"%C",(uint16_t)0x21de];
case EMGUI_KEY_PAGE_DOWN : return [NSString stringWithFormat:@"%C",(uint16_t)0x21df];
}
}

View File

@ -219,6 +219,8 @@ static void formatName(wchar_t* outName, int keyMod, int key, const wchar_t* nam
case EMGUI_KEY_BACKSPACE: wcscpy_s(keyName, sizeof(keyName), L"Delete"); break;
case EMGUI_KEY_ENTER: wcscpy_s(keyName, sizeof(keyName), L"Enter"); break;
case EMGUI_KEY_SPACE: wcscpy_s(keyName, sizeof(keyName), L"Space"); break;
case EMGUI_KEY_PAGE_UP: wcscpy_s(keyName, sizeof(keyName), L"Page Up"); break;
case EMGUI_KEY_PAGE_DOWN: wcscpy_s(keyName, sizeof(keyName), L"Page Down"); break;
}
}
@ -268,6 +270,8 @@ static void addAccelarator(const MenuDescriptor* desc)
case EMGUI_KEY_BACKSPACE: accel->key = VK_BACK; break;
case EMGUI_KEY_ENTER: accel->key = VK_RETURN; break;
case EMGUI_KEY_SPACE: accel->key = VK_SPACE; break;
case EMGUI_KEY_PAGE_DOWN: accel->key = VK_PAGE_DOWN; break;
case EMGUI_KEY_PAGE_UP: accel->key = VK_PAGE_UP; break;
}
}