canvas = 0;
playback_engine = 0;
highlighted = 0;
+ playable = zwindow->playable;
}
ZWindowGUI::~ZWindowGUI()
int ZWindowGUI::close_event()
{
- set_done(0);
+ set_done(1);
return 1;
}
close_event();
return 1;
}
- unlock_window();
int result = 1;
switch( key ) {
- case 'f':
- canvas->use_fullscreen(canvas->get_fullscreen() ? 0 : 1);
- break;
+ case 'f': {
+ int on = canvas->get_fullscreen() ? 0 : 1;
+ canvas->set_fullscreen(on, 1);
+ break; }
case ESC:
- canvas->use_fullscreen(0);
+ canvas->set_fullscreen(0, 1);
break;
default:
+ unlock_window();
mwindow->gui->lock_window("ZWindowGUI::keypress_event");
result = mwindow->gui->mbuttons->transport->do_keypress(key);
mwindow->gui->unlock_window();
+ lock_window("ZWindowGUI::keypress_event 1");
}
- lock_window("ZWindowGUI::keypress_event 1");
return result;
}
{
BC_WindowBase *cvs = canvas->get_canvas();
if( !cvs || cvs->get_video_on() ) return 0;
- if( highlighted != zwindow->highlighted ) {
- highlighted = zwindow->highlighted;
- cvs->set_color(WHITE);
- cvs->set_inverse();
- cvs->draw_rectangle(0, 0, cvs->get_w(), cvs->get_h());
- cvs->draw_rectangle(1, 1, cvs->get_w() - 2, cvs->get_h() - 2);
- cvs->set_opaque();
- }
+ set_highlighted(zwindow->highlighted);
+ if( !playable ) set_playable(-1);
+ return 1;
+}
+
+void ZWindowGUI::set_highlighted(int v)
+{
+ if( highlighted == v ) return;
+ highlighted = v;
+ BC_WindowBase *cvs = canvas->get_canvas();
+ cvs->set_color(WHITE);
+ cvs->set_inverse();
+ cvs->draw_rectangle(0, 0, cvs->get_w(), cvs->get_h());
+ cvs->draw_rectangle(1, 1, cvs->get_w() - 2, cvs->get_h() - 2);
+ cvs->set_opaque();
+}
+
+void ZWindowGUI::set_playable(int v)
+{
+ if( playable == v ) return;
+ playable = v>0 ? 1 : 0;
+ zwindow->playable = playable;
+ BC_WindowBase *cvs = canvas->get_canvas();
+ cvs->set_color(WHITE);
+ cvs->set_inverse();
+ int dx = cvs->get_w()/16+1, dy = cvs->get_h()/16+1;
+ int x = xS(5), y = yS(5), lw = (dx + dy)/16+1;
+ cvs->set_line_width(lw);
+ cvs->draw_line(x, y, x+dx, y+dy);
+ cvs->draw_line(x, y+dy, x+dx, y);
+ cvs->set_opaque();
+ cvs->set_line_width(1);
+}
+
+
+ZWindowCanvasTileMixers::ZWindowCanvasTileMixers(ZWindowCanvas *canvas)
+ : BC_MenuItem(_("Tile Mixers"))
+{
+ this->canvas = canvas;
+}
+int ZWindowCanvasTileMixers::handle_event()
+{
+ canvas->mwindow->tile_mixers();
+ return 1;
+}
+
+ZWindowCanvasPlayable::ZWindowCanvasPlayable(ZWindowCanvas *canvas)
+ : BC_MenuItem(_("Playable"))
+{
+ this->canvas = canvas;
+ set_checked(canvas->gui->zwindow->playable);
+}
+int ZWindowCanvasPlayable::handle_event()
+{
+ int v = !get_checked() ? 1 : 0;
+ set_checked(v);
+ canvas->gui->set_playable(v);
+ canvas->get_canvas()->flash(1);
return 1;
}
this->gui = gui;
}
+void ZWindowCanvas::create_objects(EDL *edl)
+{
+ Canvas::create_objects(edl);
+ canvas_menu->add_item(new ZWindowCanvasTileMixers(this));
+ canvas_menu->add_item(new ZWindowCanvasPlayable(this));
+}
+
void ZWindowCanvas::close_source()
{
gui->unlock_window();
}
}
-
void ZWindowCanvas::draw_refresh(int flush)
{
EDL *edl = gui->zwindow->edl;
if( gui->draw_overlays() )
dirty = 1;
-
if( dirty )
cvs->flash(flush);
}
return zoom_x < zoom_y ? zoom_x : zoom_y;
}
+float ZWindowCanvas::get_zoom()
+{
+ return gui->zwindow->zoom;
+}
+void ZWindowCanvas::update_zoom(int x, int y, float zoom)
+{
+ gui->zwindow->zoom = zoom;
+}
+
+void ZWindowCanvas::zoom_auto()
+{
+ EDL *edl = gui->zwindow->edl;
+ if( !edl ) edl = mwindow->edl;
+ set_zoom(edl, 0);
+}
+
+void ZWindowCanvas::zoom_resize_window(float zoom)
+{
+ if( !zoom ) zoom = get_auto_zoom();
+ EDL *edl = gui->zwindow->edl;
+ if( !edl ) edl = mwindow->edl;
+ int ow = edl->session->output_w, oh = edl->session->output_h;
+ int canvas_w, canvas_h;
+ calculate_sizes(mwindow->edl->get_aspect_ratio(), ow, oh,
+ zoom, canvas_w, canvas_h);
+ int new_w = canvas_w + xS(20);
+ int new_h = canvas_h + yS(20);
+ gui->resize_window(new_w, new_h);
+ gui->resize_event(new_w, new_h);
+}
+