From 6b1097edbecfb6cd53966d41e1831d1f9f4e0219 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Fri, 8 Feb 2013 20:35:19 +0200 Subject: [PATCH 1/2] Movie editor: Handle scrolling when rewinding --- src/platform/wxwidgets/editor-movie.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/platform/wxwidgets/editor-movie.cpp b/src/platform/wxwidgets/editor-movie.cpp index 1f0d536f..8619f277 100644 --- a/src/platform/wxwidgets/editor-movie.cpp +++ b/src/platform/wxwidgets/editor-movie.cpp @@ -1095,6 +1095,9 @@ void wxeditor_movie::_moviepanel::signal_repaint() int lines, width, height; wxeditor_movie* m2 = m; uint64_t old_cached_cffs = cached_cffs; + int prev_width, prev_height; + bool done_again = false; +do_again: runemufn([&lines, &width, &height, m2, this]() { lines = this->get_lines(); if(lines < lines_to_display) @@ -1106,13 +1109,16 @@ void wxeditor_movie::_moviepanel::signal_repaint() width = x.first; height = x.second; }); - int prev_width = new_width; - int prev_height = new_height; + if(old_cached_cffs != cached_cffs && position_locked && !done_again) { + moviepos = cached_cffs; + done_again = true; + goto do_again; + } + prev_width = new_width; + prev_height = new_height; new_width = width; new_height = height; movielines = lines; - if(old_cached_cffs != cached_cffs && position_locked) - moviepos = cached_cffs; if(s) s->SetScrollbar(moviepos, lines_to_display, lines, lines_to_display - 1); auto size = fb.get_pixels(); From ac954193c66c8dbd3f5da29141b70c0c93ad1677 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Fri, 8 Feb 2013 20:55:31 +0200 Subject: [PATCH 2/2] Movie editor: Tweak colors --- src/platform/wxwidgets/editor-movie.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/platform/wxwidgets/editor-movie.cpp b/src/platform/wxwidgets/editor-movie.cpp index 8619f277..2069dde0 100644 --- a/src/platform/wxwidgets/editor-movie.cpp +++ b/src/platform/wxwidgets/editor-movie.cpp @@ -564,29 +564,44 @@ void wxeditor_movie::_moviepanel::render_linen(text_framebuffer& fb, controller_ else if(subframe_to_frame[sfn] > curframe) past = 0; bool now = (subframe_to_frame[sfn] == curframe); + int xcord = -32768; + if(pressed) + xcord = press_x; + for(auto i : ctrlinfo) { int rpast = past; + unsigned off = divcnt + 1; + unsigned idx = i.index; + frame_controls* _fcontrols = &fcontrols; + bool cselected = (xcord >= i.position_left + off && xcord < i.position_left + i.reserved + off); if(rpast == -1) { unsigned polls = fcontrols.read_pollcount(pv, i.index); rpast = ((cffs + polls) > sfn) ? 1 : 0; } + uint32_t bgc = 0xC0C0C0; + if(rpast) + bgc |= 0x0000FF; + if(now) + bgc |= 0xFF0000; + if(cselected) + bgc |= 0x00FF00; + if(bgc == 0xC0C0C0) + bgc = 0xFFFFFF; if(i.type == -1) { //Separator. - fb.write(i.title, 0, divcnt + 1 + i.position_left, y, 0x000000, now ? 0xFFC0C0 : 0xFFFFFF); + fb.write(i.title, 0, divcnt + 1 + i.position_left, y, 0x000000, 0xFFFFFF); } else if(i.type == 0) { //Button. char c[2]; bool v = (fcontrols.read_index(f, i.index) != 0); c[0] = v ? i.ch : ' '; c[1] = 0; - fb.write(c, 0, divcnt + 1 + i.position_left, y, rpast ? 0x808080 : 0x000000, - now ? 0xFFC0C0 : 0xFFFFFF); + fb.write(c, 0, divcnt + 1 + i.position_left, y, 0x000000, bgc); } else if(i.type == 1) { //Axis. char c[7]; sprintf(c, "%6d", fcontrols.read_index(f, i.index)); - fb.write(c, 0, divcnt + 1 + i.position_left, y, rpast ? 0x808080 : 0x000000, - now ? 0xFFC0C0 : 0xFFFFFF); + fb.write(c, 0, divcnt + 1 + i.position_left, y, 0x000000, bgc); } } }