int result = 0;
int cwindow_operation = CWINDOW_NONE;
- switch(get_keypress())
- {
- case 'w':
- case 'W':
- close_event();
- result = 1;
- break;
- case '+':
- case '=':
- keyboard_zoomin();
- result = 1;
- break;
- case '-':
- keyboard_zoomout();
- result = 1;
- break;
- case 'f':
+ switch( get_keypress() ) {
+ case 'w':
+ case 'W':
+ close_event();
+ result = 1;
+ break;
+ case '+':
+ case '=':
+ keyboard_zoomin();
+ result = 1;
+ break;
+ case '-':
+ keyboard_zoomout();
+ result = 1;
+ break;
+ case 'f':
+ unlock_window();
+ if( canvas->get_fullscreen() )
+ canvas->stop_fullscreen();
+ else
+ canvas->start_fullscreen();
+ lock_window("CWindowGUI::keypress_event 1");
+ result = 1;
+ break;
+ case 'x':
+ if( ctrl_down() || shift_down() || alt_down() ) break;
+ unlock_window();
+ mwindow->gui->lock_window("CWindowGUI::keypress_event 2");
+ mwindow->cut();
+ mwindow->gui->unlock_window();
+ lock_window("CWindowGUI::keypress_event 2");
+ result = 1;
+ break;
+ case DELETE:
+ unlock_window();
+ mwindow->gui->lock_window("CWindowGUI::keypress_event 2");
+ mwindow->clear_entry();
+ mwindow->gui->unlock_window();
+ lock_window("CWindowGUI::keypress_event 3");
+ result = 1;
+ break;
+ case ESC:
+ unlock_window();
+ if( canvas->get_fullscreen() )
+ canvas->stop_fullscreen();
+ lock_window("CWindowGUI::keypress_event 4");
+ result = 1;
+ break;
+ case LEFT:
+ if( !ctrl_down() ) {
+ int alt_down = this->alt_down();
+ int shift_down = this->shift_down();
unlock_window();
- if(mwindow->session->cwindow_fullscreen)
- canvas->stop_fullscreen();
+ stop_transport(0);
+ mwindow->gui->lock_window("CWindowGUI::keypress_event 5");
+ if( alt_down )
+ mwindow->prev_edit_handle(shift_down);
else
- canvas->start_fullscreen();
- lock_window("CWindowGUI::keypress_event 1");
- break;
- case 'x':
- if( ctrl_down() || shift_down() || alt_down() ) break;
+ mwindow->move_left();
+ mwindow->gui->unlock_window();
+ lock_window("CWindowGUI::keypress_event 6");
+ result = 1;
+ }
+ break;
+
+ case ',':
+ if( !ctrl_down() && !alt_down() ) {
unlock_window();
- mwindow->gui->lock_window("CWindowGUI::keypress_event 2");
- mwindow->cut();
+ stop_transport(0);
+ mwindow->gui->lock_window("CWindowGUI::keypress_event 7");
+ mwindow->move_left();
mwindow->gui->unlock_window();
- lock_window("CWindowGUI::keypress_event 2");
- break;
- case DELETE:
+ lock_window("CWindowGUI::keypress_event 8");
+ result = 1;
+ }
+ break;
+
+ case RIGHT:
+ if( !ctrl_down() ) {
+ int alt_down = this->alt_down();
+ int shift_down = this->shift_down();
unlock_window();
- mwindow->gui->lock_window("CWindowGUI::keypress_event 2");
- mwindow->clear_entry();
+ stop_transport(0);
+ mwindow->gui->lock_window("CWindowGUI::keypress_event 8");
+ if( alt_down )
+ mwindow->next_edit_handle(shift_down);
+ else
+ mwindow->move_right();
mwindow->gui->unlock_window();
- lock_window("CWindowGUI::keypress_event 3");
- break;
- case ESC:
+ lock_window("CWindowGUI::keypress_event 9");
+ result = 1;
+ }
+ break;
+
+ case '.':
+ if( !ctrl_down() && !alt_down() ) {
unlock_window();
- if(mwindow->session->cwindow_fullscreen)
- canvas->stop_fullscreen();
- lock_window("CWindowGUI::keypress_event 4");
- break;
- case LEFT:
- if( !ctrl_down() ) {
- int alt_down = this->alt_down();
- int shift_down = this->shift_down();
- unlock_window();
- stop_transport(0);
- mwindow->gui->lock_window("CWindowGUI::keypress_event 5");
- if( alt_down )
- mwindow->prev_edit_handle(shift_down);
- else
- mwindow->move_left();
- mwindow->gui->unlock_window();
- lock_window("CWindowGUI::keypress_event 6");
- result = 1;
- }
- break;
+ stop_transport(0);
+ mwindow->gui->lock_window("CWindowGUI::keypress_event 10");
+ mwindow->move_right();
+ mwindow->gui->unlock_window();
+ lock_window("CWindowGUI::keypress_event 11");
+ result = 1;
+ }
+ break;
+ }
- case ',':
- if( !ctrl_down() && !alt_down() ) {
- unlock_window();
- stop_transport(0);
- mwindow->gui->lock_window("CWindowGUI::keypress_event 7");
- mwindow->move_left();
- mwindow->gui->unlock_window();
- lock_window("CWindowGUI::keypress_event 8");
- result = 1;
- }
+ if( !result && cwindow_operation < 0 && ctrl_down() && shift_down() ) {
+ switch( get_keypress() ) {
+ case KEY_F1 ... KEY_F4: // mainmenu, load layout
+ resend_event(mwindow->gui);
+ result = 1;
break;
-
- case RIGHT:
- if( !ctrl_down() ) {
- int alt_down = this->alt_down();
- int shift_down = this->shift_down();
- unlock_window();
- stop_transport(0);
- mwindow->gui->lock_window("CWindowGUI::keypress_event 8");
- if( alt_down )
- mwindow->next_edit_handle(shift_down);
- else
- mwindow->move_right();
- mwindow->gui->unlock_window();
- lock_window("CWindowGUI::keypress_event 9");
- result = 1;
+ }
+ }
+ if( !result && !ctrl_down() ) {
+ switch( get_keypress() ) {
+ case KEY_F1:
+ if( shift_down() ) {
+ mwindow->toggle_camera_xyz(); result = 1;
}
+ else
+ cwindow_operation = CWINDOW_PROTECT;
break;
-
- case '.':
- if( !ctrl_down() && !alt_down() ) {
- unlock_window();
- stop_transport(0);
- mwindow->gui->lock_window("CWindowGUI::keypress_event 10");
- mwindow->move_right();
- mwindow->gui->unlock_window();
- lock_window("CWindowGUI::keypress_event 11");
- result = 1;
+ case KEY_F2:
+ if( shift_down() ) {
+ mwindow->toggle_projector_xyz(); result = 1;
}
+ else
+ cwindow_operation = CWINDOW_ZOOM;
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;
+ }
+ }
+ if( !result && cwindow_operation < 0 && !ctrl_down() && !shift_down() ) {
+ switch( get_keypress() ) {
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_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( !result && cwindow_operation < 0 && !ctrl_down() ) {
+ switch( get_keypress() ) {
+ case KEY_F11:
+ if( !shift_down() )
+ canvas->reset_camera();
+ else
+ canvas->camera_keyframe();
+ result = 1;
+ break;
+ case KEY_F12:
+ if( !shift_down() )
+ canvas->reset_projector();
+ else
+ canvas->projector_keyframe();
+ result = 1;
+ break;
+ }
}
if( cwindow_operation >= 0 ) {
result = 1;
}
- if(!result) result = transport->keypress_event();
+ if( !result )
+ result = transport->keypress_event();
return result;
}
// }
}
+void CWindowGUI::sync_parameters(int change_type, int redraw, int overlay)
+{
+ if( redraw ) {
+ update_tool();
+ canvas->draw_refresh();
+ }
+ if( change_type < 0 && !overlay ) return;
+ unlock_window();
+ if( change_type >= 0 ) {
+ mwindow->restart_brender();
+ mwindow->sync_parameters(change_type);
+ }
+ if( overlay ) {
+ mwindow->gui->lock_window("CWindow::camera_keyframe");
+ mwindow->gui->draw_overlays(1);
+ mwindow->gui->unlock_window();
+ }
+ lock_window("CWindowGUI::sync_parameters");
+}
void CWindowGUI::drag_motion()
{
{
mwindow->save_backup();
mwindow->restart_brender();
- mwindow->gui->update(1, 1, 1, 1, 0, 1, 0);
+ mwindow->gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0);
mwindow->undo->update_undo_after(_("insert assets"), LOAD_ALL);
mwindow->gui->unlock_window();
- mwindow->sync_parameters(CHANGE_ALL);
+ sync_parameters(CHANGE_ALL);
}
}
1, // use_keyframe
0, // use_splice
0, // use_overwrite
- 1, // use_lift
- 1, // use_extract
1, // use_copy
1, // use_paste
1, // use_undo
this->cwindow = cwindow;
}
-#define CWrapper(fn) void CWindowEditing::fn() { \
- mwindow->gui->lock_window("CWrapper::" #fn); \
- EditPanel::fn(); \
- mwindow->gui->unlock_window(); \
-}
+#define relock_cm(s) \
+ cwindow->gui->unlock_window(); \
+ mwindow->gui->lock_window("CWindowEditing::" s)
+#define relock_mc(s) \
+ mwindow->gui->unlock_window(); \
+ cwindow->gui->lock_window("CWindowEditing::" s)
+#define panel_fn(fn, args, s) \
+ CWindowEditing::fn args { relock_cm(#fn); s; relock_mc(#fn); }
-CWrapper(copy_selection)
-CWrapper(splice_selection)
-CWrapper(overwrite_selection)
-CWrapper(set_inpoint)
-CWrapper(set_outpoint)
-CWrapper(unset_inoutpoint)
-CWrapper(toggle_label)
+// transmit lock to mwindow, and run mbutton->edit_panel->s
+#define panel_btn(fn, args, s) \
+ panel_fn(panel_##fn, args, mwindow->gui->mbuttons->edit_panel->panel_##s)
+
+
+double CWindowEditing::get_position()
+{
+ relock_cm("get_position");
+ double ret = mwindow->edl->local_session->get_selectionstart(1);
+ relock_mc("get_position");
+ return ret;
+}
-#define CWrapper_cut(fn) void CWindowEditing::fn(int cut) { \
- mwindow->gui->lock_window("CWrapper::" #fn); \
- EditPanel::fn(cut); \
- mwindow->gui->unlock_window(); \
+void CWindowEditing::set_position(double position)
+{
+ relock_cm("set_position");
+ mwindow->gui->mbuttons->edit_panel->set_position(position);
+ relock_mc("set_position");
}
-CWrapper_cut(prev_label)
-CWrapper_cut(next_label)
-CWrapper_cut(prev_edit)
-CWrapper_cut(next_edit)
-void CWindowEditing::to_clip()
+void CWindowEditing::set_click_to_play(int v)
{
- mwindow->to_clip(mwindow->edl, _("composer window: "), 0);
+ relock_cm("set_position");
+ mwindow->edl->session->cwindow_click2play = v;
+ relock_mc("set_position");
+ click2play->update(v);
}
+void panel_btn(stop_transport,(), stop_transport())
+void panel_btn(toggle_label,(), toggle_label())
+void panel_btn(next_label,(int cut), next_label(cut))
+void panel_btn(prev_label,(int cut), prev_label(cut))
+void panel_btn(next_edit,(int cut), next_edit(cut))
+void panel_btn(prev_edit,(int cut), prev_edit(cut))
+void panel_fn(panel_copy_selection,(), mwindow->copy())
+void CWindowEditing::panel_overwrite_selection() {} // not used
+void CWindowEditing::panel_splice_selection() {} // not used
+void panel_btn(set_inpoint,(), set_inpoint())
+void panel_btn(set_outpoint,(), set_outpoint())
+void panel_btn(unset_inoutpoint,(), unset_inoutpoint())
+void panel_fn(panel_to_clip,(), mwindow->to_clip(mwindow->edl, _("main window: "), 0))
+void panel_btn(cut,(), cut())
+void panel_btn(paste,(), paste())
+void panel_btn(fit_selection,(), fit_selection())
+void panel_btn(fit_autos,(int all), fit_autos(all))
+void panel_btn(set_editing_mode,(int mode), set_editing_mode(mode))
+void panel_btn(set_auto_keyframes,(int v), set_auto_keyframes(v))
+void panel_btn(set_labels_follow_edits,(int v), set_labels_follow_edits(v))
+
+
CWindowMeters::CWindowMeters(MWindow *mwindow,
- CWindowGUI *gui,
- int x,
- int y,
- int h)
- : MeterPanel(mwindow,
- gui,
- x,
- y,
- -1,
- h,
+ CWindowGUI *gui, int x, int y, int h)
+ : MeterPanel(mwindow, gui, x, y, -1, h,
mwindow->edl->session->audio_channels,
mwindow->edl->session->cwindow_meter,
- 0,
- 0)
+ 0, 0)
{
this->mwindow = mwindow;
this->gui = gui;
gui->draw_status(1);
}
-int CWindowCanvas::get_fullscreen()
-{
- return mwindow->session->cwindow_fullscreen;
-}
-
-void CWindowCanvas::set_fullscreen(int value)
-{
- mwindow->session->cwindow_fullscreen = value;
-}
-
-
void CWindowCanvas::update_zoom(int x, int y, float zoom)
{
use_scrollbars = mwindow->edl->session->cwindow_scrollbars;
get_canvas()->set_opaque();
}
-void CWindowCanvas::reset_keyframe(int do_camera)
-{
- FloatAuto *x_keyframe = 0;
- FloatAuto *y_keyframe = 0;
- FloatAuto *z_keyframe = 0;
- Track *affected_track = 0;
- affected_track = gui->cwindow->calculate_affected_track();
+void CWindowCanvas::create_keyframe(int do_camera)
+{
+ Track *affected_track = gui->cwindow->calculate_affected_track();
+ if( affected_track ) {
+ double pos = mwindow->edl->local_session->get_selectionstart(1);
+ int64_t position = affected_track->to_units(pos, 0);
+ int ix = do_camera ? AUTOMATION_CAMERA_X : AUTOMATION_PROJECTOR_X;
+ int iy = do_camera ? AUTOMATION_CAMERA_Y : AUTOMATION_PROJECTOR_Y;
+ int iz = do_camera ? AUTOMATION_CAMERA_Z : AUTOMATION_PROJECTOR_Z;
+ FloatAuto *prev, *next;
+ FloatAutos **autos = (FloatAutos**)affected_track->automation->autos;
+ FloatAutos *x_autos = autos[ix]; prev = 0; next = 0;
+ float x_value = x_autos->get_value(position, PLAY_FORWARD, prev, next);
+ FloatAutos *y_autos = autos[iy]; prev = 0; next = 0;
+ float y_value = y_autos->get_value(position, PLAY_FORWARD, prev, next);
+ FloatAutos *z_autos = autos[iz]; prev = 0; next = 0;
+ float z_value = z_autos->get_value(position, PLAY_FORWARD, prev, next);
+ FloatAuto *x_keyframe = 0, *y_keyframe = 0, *z_keyframe = 0;
+
+ gui->cwindow->calculate_affected_autos(affected_track,
+ &x_keyframe, &y_keyframe, &z_keyframe,
+ do_camera, -1, -1, -1, 0);
+ x_keyframe->set_value(x_value);
+ y_keyframe->set_value(y_value);
+ z_keyframe->set_value(z_value);
+
+ gui->sync_parameters(CHANGE_PARAMS, 1, 1);
+ }
+}
+
+void CWindowCanvas::camera_keyframe() { create_keyframe(1); }
+void CWindowCanvas::projector_keyframe() { create_keyframe(0); }
- if(affected_track)
- {
- gui->cwindow->calculate_affected_autos(&x_keyframe,
- &y_keyframe,
- &z_keyframe,
- affected_track,
- do_camera,
- 1,
- 1,
- 1);
+void CWindowCanvas::reset_keyframe(int do_camera)
+{
+ Track *affected_track = gui->cwindow->calculate_affected_track();
+ if( affected_track ) {
+ FloatAuto *x_keyframe = 0, *y_keyframe = 0, *z_keyframe = 0;
+ gui->cwindow->calculate_affected_autos(affected_track,
+ &x_keyframe, &y_keyframe, &z_keyframe,
+ do_camera, 1, 1, 1);
x_keyframe->set_value(0);
y_keyframe->set_value(0);
z_keyframe->set_value(1);
- mwindow->sync_parameters(CHANGE_PARAMS);
- gui->update_tool();
+ gui->sync_parameters(CHANGE_PARAMS, 1, 1);
}
}
-void CWindowCanvas::reset_camera()
-{
- reset_keyframe(1);
-}
+void CWindowCanvas::reset_camera() { reset_keyframe(1); }
+void CWindowCanvas::reset_projector() { reset_keyframe(0); }
-void CWindowCanvas::reset_projector()
-{
- reset_keyframe(0);
-}
int CWindowCanvas::test_crop(int button_press, int &redraw)
{
int64_t position = track->to_units(
mwindow->edl->local_session->get_selectionstart(1),
0);
-
- track->automation->get_projector(¢er_x,
- ¢er_y,
- ¢er_z,
- position,
- PLAY_FORWARD);
+ if( do_camera ) {
+ track->automation->get_camera(¢er_x,
+ ¢er_y, ¢er_z, position, PLAY_FORWARD);
+// follow image, not camera
+ center_x = -center_x * center_z; center_y = -center_y * center_z;
+ }
+ else
+ track->automation->get_projector(¢er_x,
+ ¢er_y, ¢er_z, position, PLAY_FORWARD);
// center_x += track->track_w / 2;
// center_y += track->track_h / 2;
// Processing drag operation.
// Create keyframe during first cursor motion.
- if(!button_press)
- {
+ if( !button_press ) {
float cursor_x = get_cursor_x();
float cursor_y = get_cursor_y();
canvas_to_output(mwindow->edl, 0, cursor_x, cursor_y);
- if(gui->current_operation == CWINDOW_CAMERA ||
- gui->current_operation == CWINDOW_PROJECTOR)
- {
- if(!gui->ctrl_down() && gui->shift_down() && !gui->translating_zoom)
- {
+ if( gui->current_operation == CWINDOW_CAMERA ||
+ gui->current_operation == CWINDOW_PROJECTOR ) {
+ if( !gui->ctrl_down() && gui->shift_down() && !gui->translating_zoom ) {
gui->translating_zoom = 1;
gui->reset_affected();
}
- else
- if(!gui->ctrl_down() && !gui->shift_down() && gui->translating_zoom)
- {
+ else if( !gui->ctrl_down() && !gui->shift_down() && gui->translating_zoom ) {
gui->translating_zoom = 0;
gui->reset_affected();
}
// Get target keyframe
- float last_center_x;
- float last_center_y;
- float last_center_z;
- int created;
-
- if(!gui->affected_x && !gui->affected_y && !gui->affected_z)
- {
- FloatAutos *affected_x_autos;
- FloatAutos *affected_y_autos;
- FloatAutos *affected_z_autos;
+ if( !gui->affected_x && !gui->affected_y && !gui->affected_z ) {
if(!gui->affected_track) return 0;
+ FloatAutos *affected_x_autos, *affected_y_autos, *affected_z_autos;
+ FloatAutos** autos = (FloatAutos**) gui->affected_track->automation->autos;
+ if( mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA ) {
+ affected_x_autos = autos[AUTOMATION_CAMERA_X];
+ affected_y_autos = autos[AUTOMATION_CAMERA_Y];
+ affected_z_autos = autos[AUTOMATION_CAMERA_Z];
+ }
+ else {
+ affected_x_autos = autos[AUTOMATION_PROJECTOR_X];
+ affected_y_autos = autos[AUTOMATION_PROJECTOR_Y];
+ affected_z_autos = autos[AUTOMATION_PROJECTOR_Z];
+ }
double position = mwindow->edl->local_session->get_selectionstart(1);
int64_t track_position = gui->affected_track->to_units(position, 0);
-
- if(mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA)
- {
- affected_x_autos = (FloatAutos*)gui->affected_track->automation->autos[AUTOMATION_CAMERA_X];
- affected_y_autos = (FloatAutos*)gui->affected_track->automation->autos[AUTOMATION_CAMERA_Y];
- affected_z_autos = (FloatAutos*)gui->affected_track->automation->autos[AUTOMATION_CAMERA_Z];
- }
- else
- {
- affected_x_autos = (FloatAutos*)gui->affected_track->automation->autos[AUTOMATION_PROJECTOR_X];
- affected_y_autos = (FloatAutos*)gui->affected_track->automation->autos[AUTOMATION_PROJECTOR_Y];
- affected_z_autos = (FloatAutos*)gui->affected_track->automation->autos[AUTOMATION_PROJECTOR_Z];
+ FloatAuto *prev_x = 0, *next_x = 0;
+ float new_x = affected_x_autos->get_value(track_position, PLAY_FORWARD, prev_x, next_x);
+ FloatAuto *prev_y = 0, *next_y = 0;
+ float new_y = affected_y_autos->get_value(track_position, PLAY_FORWARD, prev_y, next_y);
+ FloatAuto *prev_z = 0, *next_z = 0;
+ float new_z = affected_z_autos->get_value(track_position, PLAY_FORWARD, prev_z, next_z);
+ int zooming = gui->translating_zoom, created;
+ gui->affected_x = (FloatAuto*)gui->cwindow->calculate_affected_auto(
+ affected_x_autos, !zooming, &created, 0);
+ if( created ) {
+ gui->affected_x->set_value(new_x);
+ redraw_canvas = 1;
}
-
-
- if(gui->translating_zoom)
- {
- FloatAuto *previous = 0;
- FloatAuto *next = 0;
- float new_z = affected_z_autos->get_value(
- track_position,
- PLAY_FORWARD,
- previous,
- next);
- gui->affected_z =
- (FloatAuto*)gui->cwindow->calculate_affected_auto(
- affected_z_autos, 1, &created, 0);
- if(created) {
- gui->affected_z->set_value(new_z);
- redraw_canvas = 1;
- }
+ gui->affected_y = (FloatAuto*)gui->cwindow->calculate_affected_auto(
+ affected_y_autos, !zooming, &created, 0);
+ if( created ) {
+ gui->affected_y->set_value(new_y);
+ redraw_canvas = 1;
}
- else
- {
- FloatAuto *previous = 0;
- FloatAuto *next = 0;
- float new_x = affected_x_autos->get_value(
- track_position,
- PLAY_FORWARD,
- previous,
- next);
- previous = 0;
- next = 0;
- float new_y = affected_y_autos->get_value(
- track_position,
- PLAY_FORWARD,
- previous,
- next);
- gui->affected_x =
- (FloatAuto*)gui->cwindow->calculate_affected_auto(
- affected_x_autos, 1, &created, 0);
- if(created) {
- gui->affected_x->set_value(new_x);
- redraw_canvas = 1;
- }
- gui->affected_y =
- (FloatAuto*)gui->cwindow->calculate_affected_auto(
- affected_y_autos, 1, &created, 0);
- if(created) {
- gui->affected_y->set_value(new_y);
- redraw_canvas = 1;
- }
+ gui->affected_z = (FloatAuto*)gui->cwindow->calculate_affected_auto(
+ affected_z_autos, zooming, &created, 0);
+ if( created ) {
+ gui->affected_z->set_value(new_z);
+ redraw_canvas = 1;
}
-
calculate_origin();
- if(gui->translating_zoom)
- {
+ if( gui->translating_zoom ) {
gui->center_z = gui->affected_z->get_value();
}
- else
- {
+ else {
gui->center_x = gui->affected_x->get_value();
gui->center_y = gui->affected_y->get_value();
}
redraw = 1;
}
- if(gui->translating_zoom)
- {
- last_center_z = gui->affected_z->get_value();
+ float x_val = gui->affected_x->get_value();
+ float y_val = gui->affected_y->get_value();
+ float z_val = gui->affected_z->get_value();
+
+ if( gui->translating_zoom ) {
float z = gui->center_z + (cursor_y - gui->y_origin) / 128;
if( z < 0 ) z = 0;
- if(!EQUIV(last_center_z, z))
- {
+ if( !EQUIV(z_val, z) ) {
rerender = 1;
redraw = 1;
redraw_canvas = 1;
}
gui->affected_z->set_value(z);
}
- else
- {
- last_center_x = gui->affected_x->get_value();
- last_center_y = gui->affected_y->get_value();
+ else {
float dx = cursor_x - gui->x_origin;
float dy = cursor_y - gui->y_origin;
- if(gui->current_operation == CWINDOW_CAMERA ) {
- dx = -dx; dy = -dy;
+// follow image, not camera
+ if( gui->current_operation == CWINDOW_CAMERA ) {
+ dx = -dx / z_val; dy = -dy / z_val;
}
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) )
- {
+ if( !EQUIV(x_val, x) || !EQUIV(y_val, y) ) {
rerender = 1;
redraw = 1;
redraw_canvas = 1;
}
- gui->affected_x->set_value(x);
- gui->affected_y->set_value(y);
}
}
if(gui->affected_track)
{
- if(gui->current_operation == CWINDOW_CAMERA)
+ if( do_camera )
mwindow->undo->update_undo_before(_("camera"), this);
else
mwindow->undo->update_undo_before(_("projector"), this);
}
}
+ int change_type = rerender ? CHANGE_PARAMS : -1;
+ gui->sync_parameters(change_type, redraw, redraw_canvas);
-// If the window is never unlocked before calling send_command the
-// display shouldn't get stuck on the old video frame although it will
-// flicker between the old video frame and the new video frame.
-
- if(redraw)
- {
- draw_refresh();
- gui->update_tool();
- }
-
- if(redraw_canvas)
- {
- gui->unlock_window();
-
-
- mwindow->gui->lock_window("CWindowCanvas::cursor_motion_event 1");
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
-
- gui->lock_window("CWindowCanvas::cursor_motion_event 1");
- }
-
- if(rerender)
- {
- gui->unlock_window();
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- if(!redraw) gui->update_tool();
- gui->lock_window("CWindowCanvas::cursor_motion_event 2");
- }
return result;
}
}
}
- if(redraw)
- {
- draw_refresh();
- gui->unlock_window();
-
-
- mwindow->gui->lock_window("CWindowCanvas::button_press_event 1");
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
- gui->update_tool();
-
- gui->lock_window("CWindowCanvas::button_press_event 1");
- }
-
-// rerendering can also be caused by press event
- if(rerender)
- {
- gui->unlock_window();
+ int change_type = rerender ? CHANGE_PARAMS : -1;
+ gui->sync_parameters(change_type, redraw, redraw_canvas);
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- if(!redraw) gui->update_tool();
- gui->lock_window("CWindowCanvas::button_press_event 2");
- }
return result;
}