Added highlightRowStep

This is used to change the the highlighted row number in the UI which might be useful depending on if the music has a non-regular BPM or similar issue.

Right now it's not possible to change it in the UI so the best way to change it right now is to save a .rocket file, open it in a text editor and change the "highlightRowStep" on the <tracks tag

Closes #85
This commit is contained in:
Daniel Collin 2013-03-25 11:38:45 +01:00
parent 3533af8de7
commit aeddba394f
4 changed files with 16 additions and 5 deletions

View File

@ -260,6 +260,7 @@ void Editor_create()
s_editorData.trackViewInfo.smallFontId = id;
s_editorData.trackData.startRow = 0;
s_editorData.trackData.endRow = 10000;
s_editorData.trackData.highlightRowStep = 8;
Emgui_setDefaultFont();
}
@ -1363,6 +1364,8 @@ static void onTab()
void Editor_menuEvent(int menuItem)
{
int highlightRowStep = getTrackData()->highlightRowStep;
switch (menuItem)
{
case EDITOR_MENU_ENTER_CURRENT_V :
@ -1438,8 +1441,8 @@ void Editor_menuEvent(int menuItem)
// View
case EDITOR_MENU_PLAY : onPlay(); break;
case EDITOR_MENU_ROWS_UP : onRowStep(-8, NO_SELECTION); break;
case EDITOR_MENU_ROWS_DOWN : onRowStep(8, NO_SELECTION); break;
case EDITOR_MENU_ROWS_UP : onRowStep(-highlightRowStep , NO_SELECTION); break;
case EDITOR_MENU_ROWS_DOWN : onRowStep(highlightRowStep , 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;
@ -1505,6 +1508,7 @@ static bool doEditing(int key)
bool Editor_keyDown(int key, int keyCode, int modifiers)
{
enum Selection selection = modifiers & EMGUI_KEY_SHIFT ? DO_SELECTION : NO_SELECTION;
int highlightRowStep = getTrackData()->highlightRowStep;
if (Emgui_hasKeyboardFocus())
{
@ -1556,7 +1560,7 @@ bool Editor_keyDown(int key, int keyCode, int modifiers)
else if (modifiers & EMGUI_KEY_COMMAND)
onBookmarkDir(ARROW_UP, selection);
else if (modifiers & EMGUI_KEY_ALT)
onRowStep(-8, selection);
onRowStep(-highlightRowStep , selection);
else
onRowStep(-1, selection);
@ -1570,7 +1574,7 @@ bool Editor_keyDown(int key, int keyCode, int modifiers)
else if (modifiers & EMGUI_KEY_COMMAND)
onBookmarkDir(ARROW_DOWN, selection);
else if (modifiers & EMGUI_KEY_ALT)
onRowStep(8, selection);
onRowStep(highlightRowStep, selection);
else
onRowStep(1, selection);
break;

View File

@ -73,6 +73,7 @@ typedef struct TrackData
int trackCount;
int startRow;
int endRow;
int highlightRowStep;
char* editText;
} TrackData;

View File

@ -598,7 +598,7 @@ bool TrackView_render(TrackViewInfo* viewInfo, TrackData* trackData)
x_pos = TrackView_getStartOffset() + -viewInfo->startPixel;
printRowNumbers(2, adjust_top_size, end_row, y_pos_row, font_size, 8, y_end_border);
printRowNumbers(2, adjust_top_size, end_row, y_pos_row, font_size, trackData->highlightRowStep, y_end_border);
Emgui_drawBorder(border_color, border_color, 48, info.startY - font_size * 4, viewInfo->windowSizeX - 80, (info.endSizeY - info.startY) + 40);
Emgui_setLayer(1);

View File

@ -22,6 +22,7 @@ static void parseXml(mxml_node_t* rootNode, TrackData* trackData)
free(trackData->bookmarks);
trackData->bookmarkCount = 0;
trackData->highlightRowStep = 8;
// Traverse the tracks node data
@ -55,12 +56,16 @@ static void parseXml(mxml_node_t* rootNode, TrackData* trackData)
{
const char* start_row = mxmlElementGetAttr(node, "startRow");
const char* end_row = mxmlElementGetAttr(node, "endRow");
const char* hlrow_step = mxmlElementGetAttr(node, "highlightRowStep");
if (start_row)
trackData->startRow = atoi(start_row);
if (end_row)
trackData->endRow = atoi(end_row);
if (hlrow_step)
trackData->highlightRowStep = atoi(hlrow_step);
}
if (!strcmp("track", element_name))
@ -312,6 +317,7 @@ int LoadSave_saveRocketXML(const text_t* path, TrackData* trackData)
mxmlElementSetAttr(tracks, "rows", "10000");
setElementInt(tracks, "startRow", "%d", trackData->startRow);
setElementInt(tracks, "endRow", "%d", trackData->endRow);
setElementInt(tracks, "highlightRowStep", "%d", trackData->highlightRowStep);
for (p = 0; p < sync_data->num_tracks; ++p)
{