track->automation->autos[aidx], 1);
if( !z_auto ) return 1;
z_auto->set_value(zoom);
- gui->subwindow->update_tool();
- mwindow->gui->lock_window("CPanelZoom::handle_event 1");
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
- mwindow->sync_parameters(CHANGE_PARAMS);
+ gui->subwindow->sync_parameters(CHANGE_PARAMS, 1, 1);
return 1;
}
void CWindow::update(int dir, int overlays, int tool_window, int operation, int timebar)
{
- if(dir)
+ if( dir )
refresh_frame(CHANGE_NONE, dir);
gui->lock_window("CWindow::update 2");
// Create tool window
- if(operation)
+ if( operation )
gui->set_operation(mwindow->edl->session->cwindow_operation);
// Updated by video device.
- if(overlays && !dir)
+ if( overlays && !dir )
gui->canvas->draw_refresh();
// Update tool parameters
// Never updated by someone else
- if(tool_window || dir)
+ if( tool_window || dir )
gui->update_tool();
- if(timebar)
+ if( timebar )
gui->timebar->update(1);
double zoom = !mwindow->edl->session->cwindow_scrollbars ?
// }
}
+void CWindowGUI::sync_parameters(int change_type, int tool, int overlay)
+{
+ if( tool ) update_tool();
+ if( change_type < 0 && !overlay ) return;
+ unlock_window();
+ if( change_type >= 0 ) {
+ mwindow->restart_brender();
+ mwindow->sync_parameters(CHANGE_PARAMS);
+ }
+ 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->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);
}
}
y_keyframe->set_value(y_value);
z_keyframe->set_value(z_value);
- mwindow->sync_parameters(CHANGE_PARAMS);
- gui->update_tool();
- mwindow->gui->lock_window("CWindow::camera_keyframe");
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
+ gui->sync_parameters(CHANGE_PARAMS, 1, 1);
}
}
y_keyframe->set_value(0);
z_keyframe->set_value(1);
- mwindow->sync_parameters(CHANGE_PARAMS);
- gui->update_tool();
- mwindow->gui->lock_window("CWindow::camera_keyframe");
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
+ gui->sync_parameters(CHANGE_PARAMS, 1, 1);
}
}
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_y = -center_y;
+ }
+ 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;
last_center_y = gui->affected_y->get_value();
float dx = cursor_x - gui->x_origin;
float dy = cursor_y - gui->y_origin;
+// follow image, not camera
if(gui->current_operation == CWINDOW_CAMERA ) {
dx = -dx; dy = -dy;
}
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();
-
+ int change_type = rerender ? CHANGE_PARAMS : -1;
+ gui->sync_parameters(change_type, redraw, redraw_canvas);
- 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();
-
- 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;
}
void keyboard_zoomout();
void update_meters();
void stop_transport(const char *lock_msg);
+ void sync_parameters(int change_type, int tool=0, int overlay=0);
MWindow *mwindow;
CWindow *cwindow;
void CWindowCameraGUI::update_preview()
{
- mwindow->gui->lock_window("CWindowCameraGUI::update_preview");
- mwindow->restart_brender();
- mwindow->gui->draw_overlays(1);
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->unlock_window();
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- mwindow->cwindow->gui->lock_window("CWindowCameraGUI::update_preview");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ cgui->lock_window("CWindowCameraGUI::update_preview");
+ cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
+ cgui->unlock_window();
}
void CWindowProjectorGUI::update_preview()
{
- mwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- mwindow->cwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ cgui->lock_window("CWindowProjectorGUI::update_preview");
+ cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
+ cgui->unlock_window();
}
void CWindowProjectorGUI::handle_event()
void CWindowMaskGUI::update_preview()
{
- mwindow->gui->lock_window("CWindowMaskGUI::update_preview");
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->gui->draw_overlays(1);
- mwindow->gui->unlock_window();
- mwindow->cwindow->refresh_frame(CHANGE_NONE);
- mwindow->cwindow->gui->lock_window("CWindowMaskGUI::update_preview");
- mwindow->cwindow->gui->canvas->draw_refresh();
- mwindow->cwindow->gui->unlock_window();
+ CWindowGUI *cgui = mwindow->cwindow->gui;
+ cgui->lock_window("CWindowMaskGUI::update_preview");
+ cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
+ cgui->unlock_window();
}
stop_command->realtime = 1;
sent_command = new TransportCommand();
sent_command->command = -1;
- sent_lock = new Mutex("PlaybackEngine::sent");
tracking_lock = new Mutex("PlaybackEngine::tracking_lock");
renderengine_lock = new Mutex("PlaybackEngine::renderengine_lock");
tracking_done = new Condition(1, "PlaybackEngine::tracking_done");
delete next_command;
delete stop_command;
delete sent_command;
- delete sent_lock;
delete input_lock;
delete output_lock;
}
// Wait for current command to finish
output_lock->lock("PlaybackEngine::run");
if( done ) break;
-
-// Read the new command
- sent_lock->lock("PlaybackEngine::run");
- int command = sent_command->command;
- if( command >= 0 ) {
- this->command->copy_from(sent_command);
//printf("sent command=%d\n", sent_command->command);
- sent_command->command = -1;
- if( sent_command->locked )
- input_lock->unlock();
- }
- sent_lock->unlock();
- if( command < 0 ) continue;
+// Read the new command
+ command->copy_from(sent_command);
+ input_lock->unlock();
interrupt_playback(0);
wait_render_engine();
-//printf("PlaybackEngine::run 1 %d\n", command->command);
-
- switch( command ) {
+ switch( command->command ) {
// Parameter change only
case COMMAND_NONE:
perform_change();
int do_stop = 0, do_resume = 0;
int curr_command = this->command->command;
int curr_single_frame = TransportCommand::single_frame(curr_command);
- int curr_direction = TransportCommand::get_direction(curr_command);
int curr_audio = this->command->toggle_audio ?
!curr_single_frame : curr_single_frame;
int single_frame = TransportCommand::single_frame(command);
- int direction = TransportCommand::get_direction(command);
int next_audio = next_command->toggle_audio ? !single_frame : single_frame;
// Dispatch command
// Resume or change direction
switch( curr_command ) {
default:
- transport_stop(curr_direction != direction ? 1 : 0);
+ transport_stop(0);
do_resume = 1;
// fall through
case STOP:
{
interrupt_playback(0);
input_lock->lock("PlaybackEngine::transport_stop");
- sent_lock->lock("PlaybackEngine::transport_stop");
sent_command->copy_from(stop_command);
- sent_command->locked = wait_tracking ? 1 : 0;
- if( !sent_command->locked )
- input_lock->unlock();
- sent_lock->unlock();
output_lock->unlock();
if( wait_tracking ) {
tracking_done->lock("PlaybackEngine::transport_stop");
preferences->forward_render_displacement);
}
+ interrupt_playback(0);
input_lock->lock("PlaybackEngine::transport_command");
- next_command->locked =
- next_command->change_type == CHANGE_NONE ||
- next_command->change_type == CHANGE_PARAMS ? 0 : 1;
- sent_lock->lock("PlaybackEngine::transport_command");
sent_command->copy_from(next_command);
- if( !sent_command->locked )
- input_lock->unlock();
next_command->reset();
- sent_lock->unlock();
output_lock->unlock();
+
//static const char *types[] = { "NONE",
// "FRAME_FWD", "NORMAL_FWD", "FAST_FWD", "FRAME_REV", "NORMAL_REV", "FAST_REV",
// "STOP", "PAUSE", "SLOW_FWD", "SLOW_REV", "REWIND", "GOTO_END", "CURRENT_FRAME",
EDL *new_edl=0, int use_inout=0);
Condition *input_lock, *output_lock;
- Mutex *sent_lock;
// active command, stop command
TransportCommand *command, *stop_command;
// next command under construction, last sent command
<td align="left"><font face="Liberation Serif" size=4>'Shift'</font></td>
<td align="left"><font face="Liberation Serif" size=4>Toggle on/off all XYZ of projector</font></td>
</tr>
+ <tr>
+ <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+ <td align="left"><font face="Liberation Serif" size=4>F11</font></td>
+ <td align="left"><font face="Liberation Serif" size=4>'Shift'</font></td>
+ <td align="left"><font face="Liberation Serif" size=4>Create identity camera keyframe</font></td>
+ </tr>
+ <tr>
+ <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+ <td align="left"><font face="Liberation Serif" size=4>F12</font></td>
+ <td align="left"><font face="Liberation Serif" size=4>'Shift'</font></td>
+ <td align="left"><font face="Liberation Serif" size=4>Create identity projector keyframe</font></td>
+ </tr>
<tr>
<td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
<td align="left"><font face="Liberation Serif" size=4>F1</font></td>
void booby();
#else
#define BT
+#define booby(s) do {} while(0)
#endif
class BC_Trace
if(display_name && display_name[0] == 0) display_name = NULL;
if((display = XOpenDisplay(display_name)) == NULL) {
- printf("BC_WindowBase::init_display: cannot connect to X server %s\n",
+ printf("BC_WindowBase::init_display: cannot connect to X server %s\n",
display_name);
- if(getenv("DISPLAY") == NULL) {
+ if(getenv("DISPLAY") == NULL) {
printf(_("'DISPLAY' environment variable not set.\n"));
- exit(1);
+ exit(1);
}
- else {
// Try again with default display.
- if((display = XOpenDisplay(0)) == NULL) {
- printf("BC_WindowBase::init_display: cannot connect to default X server.\n");
- exit(1);
- }
+ if((display = XOpenDisplay(0)) == NULL) {
+ printf("BC_WindowBase::init_display: cannot connect to default X server.\n");
+ exit(1);
}
}
// wkey_string[0], wkey_string[1], wkey_string[2], wkey_string[3]);
Status stat;
- int ret = Xutf8LookupString(input_context, (XKeyEvent*)event,
+ int ret = Xutf8LookupString(input_context, (XKeyEvent*)event,
keys_return, KEYPRESSLEN, &keysym, &stat);
//printf("keysym_lookup 2 %d %d %lx %x %x\n", ret, stat, keysym, keys_return[0], keys_return[1]);
if( stat == XLookupBoth ) return ret;
//printf("BC_WindowBase::dispatch_event %d %d\n", __LINE__, button_number);
event_win = event->xany.window;
- if (button_number < 6)
- {
+ if (button_number < 6) {
if(button_number < 4)
button_down = 1;
button_pressed = event->xbutton.button;
switch(color_model)
{
case BC_RGB8:
- if(private_color)
- {
- cmap = XCreateColormap(display, rootwin, vis, AllocNone);
+ if(private_color) {
+ cmap = XCreateColormap(display, rootwin, vis, AllocNone);
create_private_colors();
}
- else
- {
+ else {
cmap = DefaultColormap(display, screen);
create_shared_colors();
}
if(top_level)
{
UNSET_LOCK(this);
-
-// if(!top_level->window_lock)
-// {
-// printf("BC_WindowBase::unlock_window %d %s already unlocked\n",
-// __LINE__,
-// title);
-// }
+ if( !top_level->window_lock ) {
+ printf("BC_WindowBase::unlock_window %s not locked\n", title);
+ booby();
+ }
if( top_level->window_lock > 0 )
if( --top_level->window_lock == 0 )
top_level->display_lock_owner = 0;
}
void BC_WindowBase::ungrab_cursor()
{
- XUngrabPointer(top_level->display, CurrentTime);
+ XUngrabPointer(top_level->display, CurrentTime);
}
// for get_root_w/h
#ifdef HAVE_LIBXXF86VM
void BC_WindowBase::closest_vm(int *vm, int *width, int *height)
{
- int foo,bar;
- *vm = 0;
- if(XF86VidModeQueryExtension(top_level->display,&foo,&bar)) {
- int vm_count,i;
- XF86VidModeModeInfo **vm_modelines;
- XF86VidModeGetAllModeLines(top_level->display,XDefaultScreen(top_level->display),&vm_count,&vm_modelines);
- for (i = 0; i < vm_count; i++) {
- if (vm_modelines[i]->hdisplay < vm_modelines[*vm]->hdisplay && vm_modelines[i]->hdisplay >= *width)
- *vm = i;
- }
- display = top_level->display;
- if (vm_modelines[*vm]->hdisplay == *width)
- *vm = -1;
- else
- {
- *width = vm_modelines[*vm]->hdisplay;
- *height = vm_modelines[*vm]->vdisplay;
- }
- }
+ int foo,bar;
+ *vm = 0;
+ if(XF86VidModeQueryExtension(top_level->display,&foo,&bar)) {
+ int vm_count,i;
+ XF86VidModeModeInfo **vm_modelines;
+ XF86VidModeGetAllModeLines(top_level->display,
+ XDefaultScreen(top_level->display), &vm_count,&vm_modelines);
+ for( i = 0; i < vm_count; i++ ) {
+ if( vm_modelines[i]->hdisplay < vm_modelines[*vm]->hdisplay &&
+ vm_modelines[i]->hdisplay >= *width )
+ *vm = i;
+ }
+ display = top_level->display;
+ if( vm_modelines[*vm]->hdisplay == *width )
+ *vm = -1;
+ else {
+ *width = vm_modelines[*vm]->hdisplay;
+ *height = vm_modelines[*vm]->vdisplay;
+ }
+ }
}
void BC_WindowBase::scale_vm(int vm)
{
- int foo,bar,dotclock;
- if(XF86VidModeQueryExtension(top_level->display,&foo,&bar))
- {
- int vm_count;
- XF86VidModeModeInfo **vm_modelines;
- XF86VidModeModeLine vml;
- XF86VidModeGetAllModeLines(top_level->display,XDefaultScreen(top_level->display),&vm_count,&vm_modelines);
- XF86VidModeGetModeLine(top_level->display,XDefaultScreen(top_level->display),&dotclock,&vml);
- orig_modeline.dotclock = dotclock;
- orig_modeline.hdisplay = vml.hdisplay;
- orig_modeline.hsyncstart = vml.hsyncstart;
- orig_modeline.hsyncend = vml.hsyncend;
- orig_modeline.htotal = vml.htotal;
- orig_modeline.vdisplay = vml.vdisplay;
- orig_modeline.vsyncstart = vml.vsyncstart;
- orig_modeline.vsyncend = vml.vsyncend;
- orig_modeline.vtotal = vml.vtotal;
- orig_modeline.flags = vml.flags;
- orig_modeline.privsize = vml.privsize;
- // orig_modeline.private = vml.private;
- XF86VidModeSwitchToMode(top_level->display,XDefaultScreen(top_level->display),vm_modelines[vm]);
- XF86VidModeSetViewPort(top_level->display,XDefaultScreen(top_level->display),0,0);
- XFlush(top_level->display);
- }
+ int foo,bar,dotclock;
+ if( XF86VidModeQueryExtension(top_level->display,&foo,&bar) ) {
+ int vm_count;
+ XF86VidModeModeInfo **vm_modelines;
+ XF86VidModeModeLine vml;
+ XF86VidModeGetAllModeLines(top_level->display,
+ XDefaultScreen(top_level->display), &vm_count,&vm_modelines);
+ XF86VidModeGetModeLine(top_level->display,
+ XDefaultScreen(top_level->display), &dotclock,&vml);
+ orig_modeline.dotclock = dotclock;
+ orig_modeline.hdisplay = vml.hdisplay;
+ orig_modeline.hsyncstart = vml.hsyncstart;
+ orig_modeline.hsyncend = vml.hsyncend;
+ orig_modeline.htotal = vml.htotal;
+ orig_modeline.vdisplay = vml.vdisplay;
+ orig_modeline.vsyncstart = vml.vsyncstart;
+ orig_modeline.vsyncend = vml.vsyncend;
+ orig_modeline.vtotal = vml.vtotal;
+ orig_modeline.flags = vml.flags;
+ orig_modeline.privsize = vml.privsize;
+ // orig_modeline.private = vml.private;
+ XF86VidModeSwitchToMode(top_level->display,XDefaultScreen(top_level->display),vm_modelines[vm]);
+ XF86VidModeSetViewPort(top_level->display,XDefaultScreen(top_level->display),0,0);
+ XFlush(top_level->display);
+ }
}
void BC_WindowBase::restore_vm()
{
- XF86VidModeSwitchToMode(top_level->display,XDefaultScreen(top_level->display),&orig_modeline);
- XFlush(top_level->display);
+ XF86VidModeSwitchToMode(top_level->display,XDefaultScreen(top_level->display),&orig_modeline);
+ XFlush(top_level->display);
}
-
-
#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifndef SINGLE_THREAD
int BC_WindowBase::get_event_count()
{