7 #include "cwindowgui.h"
8 #include "cwindowtool.h"
11 #include "edlsession.h"
13 #include "mainsession.h"
14 #include "mwindowgui.h"
15 #include "playbackengine.h"
16 #include "playtransport.h"
17 #include "preferences.h"
20 #include "trackcanvas.h"
22 #include "transportque.h"
31 CWindow::CWindow(MWindow *mwindow)
34 this->mwindow = mwindow;
40 delete playback_engine;
41 delete playback_cursor;
44 int CWindow::create_objects()
46 destination = mwindow->defaults->get("CWINDOW_DESTINATION", 0);
48 gui = new CWindowGUI(mwindow, this);
49 gui->create_objects();
51 playback_engine = new CPlayback(mwindow, this, gui->canvas);
54 playback_engine->create_objects();
55 gui->transport->set_engine(playback_engine);
56 playback_cursor = new CTracking(mwindow, this);
57 playback_cursor->create_objects();
62 void CWindow::show_window()
64 gui->lock_window("CWindow::show_cwindow");
70 gui->tool_panel->show_tool();
73 void CWindow::hide_window()
76 gui->mwindow->session->show_cwindow = 0;
77 // Unlock in case MWindow is waiting for it.
80 gui->tool_panel->hide_tool();
82 mwindow->gui->lock_window("CWindowGUI::close_event");
83 mwindow->gui->mainmenu->show_cwindow->set_checked(0);
84 mwindow->gui->unlock_window();
85 mwindow->save_defaults();
87 gui->lock_window("CWindow::hide_window");
91 Track* CWindow::calculate_affected_track()
93 Track* affected_track = 0;
94 for(Track *track = mwindow->edl->tracks->first;
98 if(track->data_type == TRACK_VIDEO &&
101 affected_track = track;
105 return affected_track;
108 Auto* CWindow::calculate_affected_auto(Autos *autos, int create)
110 Auto* affected_auto = 0;
114 int total = autos->total();
115 affected_auto = autos->get_auto_for_editing();
118 if(total != autos->total())
120 mwindow->gui->lock_window("CWindow::calculate_affected_auto");
121 mwindow->gui->canvas->draw_overlays();
122 mwindow->gui->canvas->flash();
123 mwindow->gui->unlock_window();
128 affected_auto = autos->get_prev_auto(PLAY_FORWARD, affected_auto);
131 return affected_auto;
136 void CWindow::calculate_affected_autos(FloatAuto **x_auto,
145 if(x_auto) (*x_auto) = 0;
146 if(y_auto) (*y_auto) = 0;
147 if(z_auto) (*z_auto) = 0;
153 if(x_auto) (*x_auto) = (FloatAuto*)calculate_affected_auto(
154 track->automation->autos[AUTOMATION_CAMERA_X], create_x);
155 if(y_auto) (*y_auto) = (FloatAuto*)calculate_affected_auto(
156 track->automation->autos[AUTOMATION_CAMERA_Y], create_y);
157 if(z_auto) (*z_auto) = (FloatAuto*)calculate_affected_auto(
158 track->automation->autos[AUTOMATION_CAMERA_Z], create_z);
162 if(x_auto) (*x_auto) = (FloatAuto*)calculate_affected_auto(
163 track->automation->autos[AUTOMATION_PROJECTOR_X], create_x);
164 if(y_auto) (*y_auto) = (FloatAuto*)calculate_affected_auto(
165 track->automation->autos[AUTOMATION_PROJECTOR_Y], create_y);
166 if(z_auto) (*z_auto) = (FloatAuto*)calculate_affected_auto(
167 track->automation->autos[AUTOMATION_PROJECTOR_Z], create_z);
180 void CWindow::update(int position,
186 //TRACE("CWindow::update 1");
190 //printf("CWindow::update 2\n");
191 gui->lock_window("CWindow::update 1");
192 gui->slider->set_position();
193 gui->unlock_window();
194 //printf("CWindow::update 2\n");
195 playback_engine->que->send_command(CURRENT_FRAME,
199 //printf("CWindow::update 3\n");
201 //TRACE("CWindow::update 4");
203 gui->lock_window("CWindow::update 2");
206 // Create tool window
209 gui->set_operation(mwindow->edl->session->cwindow_operation);
212 //TRACE("CWindow::update 5");
214 // Updated by video device.
215 if(overlays && !position)
217 gui->canvas->draw_refresh();
220 //TRACE("CWindow::update 5");
221 // Update tool parameters
222 // Never updated by someone else
223 if(tool_window || position)
230 gui->timebar->update(1, 1);
233 //TRACE("CWindow::update 6");
234 if(!mwindow->edl->session->cwindow_scrollbars)
235 gui->zoom_panel->update(AUTO_ZOOM);
237 gui->zoom_panel->update(mwindow->edl->session->cwindow_zoom);
238 //printf("CWindow::update 6\n");
240 gui->canvas->update_zoom(mwindow->edl->session->cwindow_xscroll,
241 mwindow->edl->session->cwindow_yscroll,
242 mwindow->edl->session->cwindow_zoom);
243 //printf("CWindow::update 6\n");
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);
250 //printf("CWindow::update 6\n");
254 gui->unlock_window();
259 //printf("CWindow::update 7\n");