tool_panel = new CWindowTool(mwindow, this);
tool_panel->Thread::start();
-
set_operation(mwindow->edl->session->cwindow_operation);
-
-
-
- canvas->draw_refresh(0);
-
-
draw_status(0);
unlock_window();
}
{
if( current_operation == CWINDOW_NONE &&
mwindow->edl != 0 && canvas->get_canvas() &&
+ mwindow->edl->session->cwindow_click2play &&
canvas->get_canvas()->get_cursor_over_window() ) {
switch( get_buttonpress() ) {
case LEFT_BUTTON:
{
float x = 0, y = 0;
float zoom = !value ? get_auto_zoom() : value;
- mwindow->edl->session->cwindow_scrollbars = !value ? 0 : 1;
+ EDL *edl = mwindow->edl;
+ edl->session->cwindow_scrollbars = !value ? 0 : 1;
if( value ) {
- float cx = canvas->get_xscroll() + 0.5f*canvas->w_visible;
- float cy = canvas->get_yscroll() + 0.5f*canvas->h_visible;
- float output_x = cx, output_y = cy;
- canvas->output_to_canvas(mwindow->edl, 0, cx, cy);
- x = output_x - cx / zoom;
- y = output_y - cy / zoom;
+ float cx = 0.5f * canvas->w; x = cx;
+ float cy = 0.5f * canvas->h; y = cy;
+ canvas->canvas_to_output(edl, 0, x, y);
+ canvas->update_zoom(0, 0, zoom);
+ float zoom_x, zoom_y, conformed_w, conformed_h;
+ canvas->get_zooms(edl, 0, zoom_x, zoom_y, conformed_w, conformed_h);
+ x -= cx / zoom_x;
+ y -= cy / zoom_y;
+
}
canvas->update_zoom((int)(x+0.5), (int)(y+0.5), zoom);
canvas->draw_refresh();
}
-
-
void CWindowGUI::set_operation(int value)
{
- mwindow->edl->session->cwindow_operation = value;
+ switch( value ) {
+ case CWINDOW_TOOL_WINDOW:
+ mwindow->edl->session->tool_window = !mwindow->edl->session->tool_window;
+ composite_panel->operation[CWINDOW_TOOL_WINDOW]->update(mwindow->edl->session->tool_window);
+ tool_panel->update_show_window();
+ return;
+ case CWINDOW_TITLESAFE:
+ mwindow->edl->session->safe_regions = !mwindow->edl->session->safe_regions;
+ composite_panel->operation[CWINDOW_TITLESAFE]->update(mwindow->edl->session->safe_regions);
+ value = mwindow->edl->session->cwindow_operation;
+ break;
+ default:
+ mwindow->edl->session->cwindow_operation = value;
+ composite_panel->set_operation(value);
+ break;
+ }
- composite_panel->set_operation(value);
edit_panel->update();
-
tool_panel->start_tool(value);
canvas->draw_refresh();
}
int CWindowGUI::keypress_event()
{
int result = 0;
+ int cwindow_operation = CWINDOW_NONE;
switch(get_keypress())
{
lock_window("CWindowGUI::keypress_event 1");
break;
case 'x':
+ if( ctrl_down() || shift_down() || alt_down() ) break;
unlock_window();
mwindow->gui->lock_window("CWindowGUI::keypress_event 2");
mwindow->cut();
}
break;
+ case KEY_F1: if( shift_down() ) { mwindow->toggle_camera_xyz(); break; }
+ cwindow_operation = CWINDOW_PROTECT; break;
+ case KEY_F2: if( shift_down() ) { mwindow->toggle_projector_xyz(); break; }
+ cwindow_operation = CWINDOW_ZOOM; break;
+ case KEY_F3: cwindow_operation = CWINDOW_MASK; break;
+ case KEY_F4: cwindow_operation = CWINDOW_RULER; break;
+ case KEY_F5: cwindow_operation = CWINDOW_CAMERA; break;
+ case KEY_F6: cwindow_operation = CWINDOW_PROJECTOR; break;
+ case KEY_F7: cwindow_operation = CWINDOW_CROP; break;
+ case KEY_F8: cwindow_operation = CWINDOW_EYEDROP; break;
+ case KEY_F9: cwindow_operation = CWINDOW_TOOL_WINDOW; break;
+ case KEY_F10: cwindow_operation = CWINDOW_TITLESAFE; break;
+ case KEY_F11: canvas->reset_camera(); break;
+ case KEY_F12: canvas->reset_projector(); break;
+ }
+
+ if( cwindow_operation >= 0 ) {
+ set_operation(cwindow_operation);
+ result = 1;
}
if(!result) result = transport->keypress_event();
if(mwindow->session->drag_assets->total ||
mwindow->session->drag_clips->total)
{
- mwindow->gui->lock_window("CWindowGUI::drag_stop 5");
+ mwindow->gui->lock_window("CWindowGUI::drag_stop 1");
mwindow->undo->update_undo_before(_("insert assets"), 0);
- mwindow->gui->unlock_window();
}
if(mwindow->session->drag_assets->total)
{
- mwindow->gui->lock_window("CWindowGUI::drag_stop 1");
mwindow->clear(0);
mwindow->load_assets(mwindow->session->drag_assets,
mwindow->edl->local_session->get_selectionstart(),
if(mwindow->session->drag_clips->total)
{
- mwindow->gui->lock_window("CWindowGUI::drag_stop 2");
mwindow->clear(0);
mwindow->paste_edls(mwindow->session->drag_clips,
LOADMODE_PASTE,
mwindow->gui->update(1, 1, 1, 1, 0, 1, 0);
mwindow->undo->update_undo_after(_("insert assets"), LOAD_ALL);
mwindow->gui->unlock_window();
- mwindow->sync_parameters(LOAD_ALL);
+ mwindow->sync_parameters(CHANGE_ALL);
}
}
CWindowEditing::CWindowEditing(MWindow *mwindow, CWindow *cwindow)
- : EditPanel(mwindow,
- cwindow->gui,
- mwindow->theme->cedit_x,
- mwindow->theme->cedit_y,
+ : EditPanel(mwindow, cwindow->gui, CWINDOW_ID,
+ mwindow->theme->cedit_x, mwindow->theme->cedit_y,
mwindow->edl->session->editing_mode,
- 0,
- 1,
- 0,
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 0,
+ 0, // use_editing_mode
+ 1, // use_keyframe
+ 0, // use_splice
+ 0, // use_overwrite
+ 1, // use_lift
+ 1, // use_extract
+ 1, // use_copy
+ 1, // use_paste
+ 1, // use_undo
+ 0, // use_fit
0, // locklabels
- 1,
- 1,
- 1,
- 0,
- 1,
- 0)
+ 1, // use_labels
+ 1, // use_toclip
+ 1, // use_meters
+ 1, // use_cut
+ 0, // use_commerical
+ 0, // use_goto
+ 1) // use_clk2play
{
this->mwindow = mwindow;
this->cwindow = cwindow;
void CWindowEditing::to_clip()
{
- mwindow->to_clip(mwindow->edl, _("composer window: "));
+ mwindow->to_clip(mwindow->edl, _("composer window: "), 0);
}
void CWindowSlider::set_position()
{
double new_length = mwindow->edl->tracks->total_length();
-// if(mwindow->edl->local_session->preview_end <= 0 ||
-// mwindow->edl->local_session->preview_end > new_length)
-// mwindow->edl->local_session->preview_end = new_length;
-// if(mwindow->edl->local_session->preview_start >
-// mwindow->edl->local_session->preview_end)
-// mwindow->edl->local_session->preview_start = 0;
-
-
update(mwindow->theme->cslider_w,
mwindow->edl->local_session->get_selectionstart(1),
- 0,
- new_length);
-// mwindow->edl->local_session->preview_start,
-// mwindow->edl->local_session->preview_end);
+ 0, new_length);
}
in_x2 > in_x1 &&
in_y2 > in_y1)
{
+// input scaled from session to refresh frame coordinates
+ int ow = get_output_w(mwindow->edl);
+ int oh = get_output_h(mwindow->edl);
+ int rw = refresh_frame->get_w();
+ int rh = refresh_frame->get_h();
+ float xs = (float)rw / ow;
+ float ys = (float)rh / oh;
+ in_x1 *= xs; in_x2 *= xs;
+ in_y1 *= ys; in_y2 *= ys;
// Can't use OpenGL here because it is called asynchronously of the
// playback operation.
get_canvas()->draw_vframe(refresh_frame,
}
draw_overlays();
+// allow last opengl write to complete before redraw
+// tried sync_display, glFlush, glxMake*Current(0..)
+usleep(20000);
get_canvas()->flash(flush);
}
//printf("CWindowCanvas::draw_refresh 10\n");
return result;
}
+int CWindowCanvas::need_overlays()
+{
+ if( mwindow->edl->session->safe_regions ) return 1;
+ if( mwindow->edl->session->cwindow_scrollbars ) return 1;
+ if( gui->highlighted ) return 1;
+ switch( mwindow->edl->session->cwindow_operation ) {
+ case CWINDOW_EYEDROP:
+ if( ! gui->eyedrop_visible ) break;
+ case CWINDOW_CAMERA:
+ case CWINDOW_PROJECTOR:
+ case CWINDOW_CROP:
+ case CWINDOW_MASK:
+ case CWINDOW_RULER:
+ return 1;
+ }
+ return 0;
+}
+
void CWindowCanvas::draw_overlays()
{
if(mwindow->edl->session->safe_regions)
redraw = 1;
}
}
- else
+ else
// Translate all 4 points
if(gui->current_operation == CWINDOW_CROP && gui->crop_translate)
{
{
last_center_x = gui->affected_x->get_value();
last_center_y = gui->affected_y->get_value();
- float x = gui->center_x + cursor_x - gui->x_origin;
- float y = gui->center_y + cursor_y - gui->y_origin;
+ float dx = cursor_x - gui->x_origin;
+ float dy = cursor_y - gui->y_origin;
+ if(gui->current_operation == CWINDOW_CAMERA ) {
+ dx = -dx; dy = -dy;
+ }
+ float x = gui->center_x + dx;
+ float y = gui->center_y + dy;
gui->affected_x->set_value(x);
gui->affected_y->set_value(y);
if( !EQUIV(last_center_x, x) || !EQUIV(last_center_y, y) )