From 77799725e89b396398bdc002d0e2770da53676fe Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Sun, 30 Dec 2012 11:04:02 +0100 Subject: [PATCH] Can now use arrow keys during playback Also fixed that selection was reset when doing jump prev/next keyframe. Closes #41 --- ogl_editor/src/Editor.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/ogl_editor/src/Editor.c b/ogl_editor/src/Editor.c index c0320e9..75fc632 100644 --- a/ogl_editor/src/Editor.c +++ b/ogl_editor/src/Editor.c @@ -559,19 +559,6 @@ bool Editor_keyDown(int key, int keyCode, int modifiers) const int selectTop = mini(viewInfo->selectStartRow, viewInfo->selectStopRow); const int selectBottom = maxi(viewInfo->selectStartRow, viewInfo->selectStopRow); - if (key == ' ') - { - // TODO: Don't start playing if we are in edit mode (but space shouldn't be added in edit mode but we still - // shouldn't start playing if we do - - RemoteConnection_sendPauseCommand(!paused); - Editor_update(); - return true; - } - - if (!paused) - return false; - // If some emgui control has focus let it do its thing until its done if (Emgui_hasKeyboardFocus()) @@ -617,7 +604,8 @@ bool Editor_keyDown(int key, int keyCode, int modifiers) row = t->keys[idx + 1].row; viewInfo->rowPos = row; - viewInfo->selectStartRow = viewInfo->selectStopRow = row; + viewInfo->selectStopRow = row; + RemoteConnection_sendSetRowCommand(row); } break; @@ -658,7 +646,9 @@ bool Editor_keyDown(int key, int keyCode, int modifiers) if (idx < 0) idx = -idx - 1; - viewInfo->rowPos = t->keys[emaxi(idx - 1, 0)].row; + viewInfo->rowPos = row = t->keys[emaxi(idx - 1, 0)].row; + viewInfo->selectStartRow = row; + RemoteConnection_sendSetRowCommand(row); } break; @@ -801,6 +791,19 @@ bool Editor_keyDown(int key, int keyCode, int modifiers) default : handled_key = false; break; } + if (key == ' ') + { + // TODO: Don't start playing if we are in edit mode (but space shouldn't be added in edit mode but we still + // shouldn't start playing if we do + + RemoteConnection_sendPauseCommand(!paused); + Editor_update(); + return true; + } + + if (!paused) + return true; + // handle copy of tracks/values if (key == 'c' && (modifiers & EMGUI_KEY_COMMAND))