7 #include "cwindowgui.h"
8 #include "cwindowtool.h"
11 #include "edlsession.h"
12 #include "localsession.h"
14 #include "mainsession.h"
15 #include "mwindowgui.h"
16 #include "playbackengine.h"
17 #include "playtransport.h"
18 #include "preferences.h"
21 #include "trackcanvas.h"
23 #include "transportque.h"
32 CWindow::CWindow(MWindow *mwindow)
35 this->mwindow = mwindow;
41 delete playback_engine;
42 delete playback_cursor;
45 int CWindow::create_objects()
47 destination = mwindow->defaults->get("CWINDOW_DESTINATION", 0);
49 gui = new CWindowGUI(mwindow, this);
50 gui->create_objects();
52 playback_engine = new CPlayback(mwindow, this, gui->canvas);
55 playback_engine->create_objects();
56 gui->transport->set_engine(playback_engine);
57 playback_cursor = new CTracking(mwindow, this);
58 playback_cursor->create_objects();
63 void CWindow::show_window()
65 gui->lock_window("CWindow::show_cwindow");
71 gui->tool_panel->show_tool();
74 void CWindow::hide_window()
77 gui->mwindow->session->show_cwindow = 0;
78 // Unlock in case MWindow is waiting for it.
81 gui->tool_panel->hide_tool();
83 mwindow->gui->lock_window("CWindowGUI::close_event");
84 mwindow->gui->mainmenu->show_cwindow->set_checked(0);
85 mwindow->gui->unlock_window();
86 mwindow->save_defaults();
88 gui->lock_window("CWindow::hide_window");
92 Track* CWindow::calculate_affected_track()
94 Track* affected_track = 0;
95 for(Track *track = mwindow->edl->tracks->first;
99 if(track->data_type == TRACK_VIDEO &&
102 affected_track = track;
106 return affected_track;
109 Auto* CWindow::calculate_affected_auto(Autos *autos,
114 Auto* affected_auto = 0;
115 if(created) *created = 0;
119 int total = autos->total();
120 affected_auto = autos->get_auto_for_editing();
123 if(total != autos->total())
125 if(created) *created = 1;
128 mwindow->gui->lock_window("CWindow::calculate_affected_auto");
129 mwindow->gui->canvas->draw_overlays();
130 mwindow->gui->canvas->flash();
131 mwindow->gui->unlock_window();
137 affected_auto = autos->get_prev_auto(PLAY_FORWARD, affected_auto);
140 return affected_auto;
145 void CWindow::calculate_affected_autos(FloatAuto **x_auto,
154 if(x_auto) (*x_auto) = 0;
155 if(y_auto) (*y_auto) = 0;
156 if(z_auto) (*z_auto) = 0;
162 if(x_auto) (*x_auto) = (FloatAuto*)calculate_affected_auto(
163 track->automation->autos[AUTOMATION_CAMERA_X], create_x);
164 if(y_auto) (*y_auto) = (FloatAuto*)calculate_affected_auto(
165 track->automation->autos[AUTOMATION_CAMERA_Y], create_y);
166 if(z_auto) (*z_auto) = (FloatAuto*)calculate_affected_auto(
167 track->automation->autos[AUTOMATION_CAMERA_Z], create_z);
171 if(x_auto) (*x_auto) = (FloatAuto*)calculate_affected_auto(
172 track->automation->autos[AUTOMATION_PROJECTOR_X], create_x);
173 if(y_auto) (*y_auto) = (FloatAuto*)calculate_affected_auto(
174 track->automation->autos[AUTOMATION_PROJECTOR_Y], create_y);
175 if(z_auto) (*z_auto) = (FloatAuto*)calculate_affected_auto(
176 track->automation->autos[AUTOMATION_PROJECTOR_Z], create_z);
189 void CWindow::update(int position,
198 gui->lock_window("CWindow::update 1");
199 gui->slider->set_position();
200 gui->unlock_window();
202 playback_engine->que->send_command(CURRENT_FRAME,
208 gui->lock_window("CWindow::update 2");
211 // Create tool window
214 gui->set_operation(mwindow->edl->session->cwindow_operation);
218 // Updated by video device.
219 if(overlays && !position)
221 gui->canvas->draw_refresh();
224 // Update tool parameters
225 // Never updated by someone else
226 if(tool_window || position)
233 gui->timebar->update(1, 1);
236 if(!mwindow->edl->session->cwindow_scrollbars)
237 gui->zoom_panel->update(AUTO_ZOOM);
239 gui->zoom_panel->update(mwindow->edl->session->cwindow_zoom);
241 gui->canvas->update_zoom(mwindow->edl->session->cwindow_xscroll,
242 mwindow->edl->session->cwindow_yscroll,
243 mwindow->edl->session->cwindow_zoom);
244 gui->canvas->reposition_window(mwindow->edl,
245 mwindow->theme->ccanvas_x,
246 mwindow->theme->ccanvas_y,
247 mwindow->theme->ccanvas_w,
248 mwindow->theme->ccanvas_h);
253 gui->unlock_window();