Merge branch 'rr1-maint'

This commit is contained in:
Ilari Liusvaara 2013-02-08 20:55:53 +02:00
commit aa1e6f184a

View file

@ -542,29 +542,44 @@ void wxeditor_movie::_moviepanel::render_linen(text_framebuffer& fb, controller_
else if(subframe_to_frame[sfn] > curframe) else if(subframe_to_frame[sfn] > curframe)
past = 0; past = 0;
bool now = (subframe_to_frame[sfn] == curframe); bool now = (subframe_to_frame[sfn] == curframe);
int xcord = -32768;
if(pressed)
xcord = press_x;
for(auto i : ctrlinfo) { for(auto i : ctrlinfo) {
int rpast = past; 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) { if(rpast == -1) {
unsigned polls = fcontrols.read_pollcount(pv, i.index); unsigned polls = fcontrols.read_pollcount(pv, i.index);
rpast = ((cffs + polls) > sfn) ? 1 : 0; 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) { if(i.type == -1) {
//Separator. //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) { } else if(i.type == 0) {
//Button. //Button.
char c[2]; char c[2];
bool v = (fcontrols.read_index(f, i.index) != 0); bool v = (fcontrols.read_index(f, i.index) != 0);
c[0] = v ? i.ch : ' '; c[0] = v ? i.ch : ' ';
c[1] = 0; c[1] = 0;
fb.write(c, 0, divcnt + 1 + i.position_left, y, rpast ? 0x808080 : 0x000000, fb.write(c, 0, divcnt + 1 + i.position_left, y, 0x000000, bgc);
now ? 0xFFC0C0 : 0xFFFFFF);
} else if(i.type == 1) { } else if(i.type == 1) {
//Axis. //Axis.
char c[7]; char c[7];
sprintf(c, "%6d", fcontrols.read_index(f, i.index)); sprintf(c, "%6d", fcontrols.read_index(f, i.index));
fb.write(c, 0, divcnt + 1 + i.position_left, y, rpast ? 0x808080 : 0x000000, fb.write(c, 0, divcnt + 1 + i.position_left, y, 0x000000, bgc);
now ? 0xFFC0C0 : 0xFFFFFF);
} }
} }
} }
@ -1073,6 +1088,9 @@ void wxeditor_movie::_moviepanel::signal_repaint()
int lines, width, height; int lines, width, height;
wxeditor_movie* m2 = m; wxeditor_movie* m2 = m;
uint64_t old_cached_cffs = cached_cffs; uint64_t old_cached_cffs = cached_cffs;
int prev_width, prev_height;
bool done_again = false;
do_again:
runemufn([&lines, &width, &height, m2, this]() { runemufn([&lines, &width, &height, m2, this]() {
lines = this->get_lines(); lines = this->get_lines();
if(lines < lines_to_display) if(lines < lines_to_display)
@ -1084,13 +1102,16 @@ void wxeditor_movie::_moviepanel::signal_repaint()
width = x.first; width = x.first;
height = x.second; height = x.second;
}); });
int prev_width = new_width; if(old_cached_cffs != cached_cffs && position_locked && !done_again) {
int prev_height = new_height; moviepos = cached_cffs;
done_again = true;
goto do_again;
}
prev_width = new_width;
prev_height = new_height;
new_width = width; new_width = width;
new_height = height; new_height = height;
movielines = lines; movielines = lines;
if(old_cached_cffs != cached_cffs && position_locked)
moviepos = cached_cffs;
if(s) if(s)
s->SetScrollbar(moviepos, lines_to_display, lines, lines_to_display - 1); s->SetScrollbar(moviepos, lines_to_display, lines, lines_to_display - 1);
auto size = fb.get_pixels(); auto size = fb.get_pixels();