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':
- if( canvas->get_fullscreen() )
- canvas->stop_fullscreen();
- else
- canvas->start_fullscreen();
- break;
+ case 'f': {
+ int on = canvas->get_fullscreen() ? 0 : 1;
+ canvas->set_fullscreen(on, 1);
+ break; }
case ESC:
- if( canvas->get_fullscreen() )
- canvas->stop_fullscreen();
+ 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;
}
return 1;
}
+
+ZWindowCanvasTileMixers::ZWindowCanvasTileMixers(ZWindowCanvas *canvas)
+ : BC_MenuItem(_("Tile Mixers"))
+{
+ this->canvas = canvas;
+}
+int ZWindowCanvasTileMixers::handle_event()
+{
+ canvas->mwindow->tile_mixers();
+ return 1;
+}
+
ZWindowCanvas::ZWindowCanvas(MWindow *mwindow, ZWindowGUI *gui,
int x, int y, int w, int h)
: Canvas(mwindow, gui, x,y, w,h, 0,0,0)
this->gui = gui;
}
+void ZWindowCanvas::create_objects(EDL *edl)
+{
+ Canvas::create_objects(edl);
+ canvas_menu->add_item(new ZWindowCanvasTileMixers(this));
+}
+
void ZWindowCanvas::close_source()
{
gui->unlock_window();
}
}
-
void ZWindowCanvas::draw_refresh(int flush)
{
EDL *edl = gui->zwindow->edl;
cvs->flash(flush);
}
+float ZWindowCanvas::get_auto_zoom()
+{
+ EDL *edl = gui->zwindow->edl;
+ if( !edl ) edl = mwindow->edl;
+ float conformed_w, conformed_h;
+ edl->calculate_conformed_dimensions(0, conformed_w, conformed_h);
+ BC_WindowBase *window = get_canvas();
+ int cw = window ? window->get_w() : w;
+ int ch = window ? window->get_h() : h;
+ float zoom_x = cw / conformed_w;
+ float zoom_y = ch / conformed_h;
+ 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);
+}