4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "cplayback.h"
24 #include "editpanel.h"
26 #include "edlsession.h"
29 #include "localsession.h"
33 #include "mwindowgui.h"
34 #include "playbackengine.h"
35 #include "playtransport.h"
36 #include "preferences.h"
38 #include "mainsession.h"
42 MButtons::MButtons(MWindow *mwindow, MWindowGUI *gui)
43 : BC_SubWindow(mwindow->theme->mbuttons_x,
44 mwindow->theme->mbuttons_y,
45 mwindow->theme->mbuttons_w,
46 mwindow->theme->mbuttons_h)
49 this->mwindow = mwindow;
58 void MButtons::create_objects()
61 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
62 transport = new MainTransport(mwindow, this, x, y);
63 transport->create_objects();
64 transport->set_engine(mwindow->cwindow->playback_engine);
65 x += transport->get_w();
66 x += mwindow->theme->mtransport_margin;
68 edit_panel = new MainEditing(mwindow, this, x, y);
70 edit_panel->create_objects();
72 x += edit_panel->get_w();
76 int MButtons::resize_event()
78 reposition_window(mwindow->theme->mbuttons_x,
79 mwindow->theme->mbuttons_y,
80 mwindow->theme->mbuttons_w,
81 mwindow->theme->mbuttons_h);
82 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
87 int MButtons::keypress_event()
93 result = transport->keypress_event();
99 void MButtons::update()
101 edit_panel->update();
105 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
106 : PlayTransport(mwindow, mbuttons, x, y)
110 void MainTransport::goto_start()
112 mwindow->gui->unlock_window();
113 handle_transport(REWIND, 1);
114 mwindow->gui->lock_window();
115 mwindow->goto_start();
119 void MainTransport::goto_end()
121 mwindow->gui->unlock_window();
122 handle_transport(GOTO_END, 1);
123 mwindow->gui->lock_window();
127 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
128 : EditPanel(mwindow, mbuttons, MWINDOW_ID, x, y,
129 mwindow->edl->session->editing_mode,
130 1, // use_editing_mode
143 mwindow->has_commercials(), // use_commerical
148 this->mwindow = mwindow;
149 this->mbuttons = mbuttons;
152 double MainEditing::get_position()
154 return mwindow->get_position();
157 void MainEditing::set_position(double position)
159 mwindow->set_position(position);
162 void MainEditing::set_click_to_play(int v)
167 void MainEditing::panel_stop_transport()
169 mwindow->gui->stop_transport("MainEditing::stop_transport");
172 void MainEditing::panel_toggle_label()
174 mwindow->toggle_label();
177 void MainEditing::panel_next_label(int cut)
179 int shift_down = mwindow->gui->shift_down();
180 panel_stop_transport();
182 mwindow->cut_right_label();
184 mwindow->next_label(shift_down);
187 void MainEditing::panel_prev_label(int cut)
189 int shift_down = mwindow->gui->shift_down();
190 panel_stop_transport();
192 mwindow->cut_left_label();
194 mwindow->prev_label(shift_down);
197 void MainEditing::panel_prev_edit(int cut)
199 int shift_down = subwindow->shift_down();
200 panel_stop_transport();
202 mwindow->cut_left_edit();
204 mwindow->prev_edit_handle(shift_down);
207 void MainEditing::panel_next_edit(int cut)
209 int shift_down = subwindow->shift_down();
210 panel_stop_transport();
212 mwindow->cut_right_edit();
214 mwindow->next_edit_handle(shift_down);
217 void MainEditing::panel_copy_selection()
222 void MainEditing::panel_overwrite_selection() {} // not used
223 void MainEditing::panel_splice_selection() {} // not used
225 void MainEditing::panel_set_inpoint()
227 mwindow->set_inpoint();
230 void MainEditing::panel_set_outpoint()
232 mwindow->set_outpoint();
235 void MainEditing::panel_unset_inoutpoint()
237 mwindow->unset_inoutpoint();
240 void MainEditing::panel_to_clip()
242 MWindowGUI *gui = mwindow->gui;
243 gui->unlock_window();
244 mwindow->to_clip(mwindow->edl, _("main window: "), 0);
245 gui->lock_window("MainEditing::to_clip");
249 void MainEditing::panel_cut()
254 void MainEditing::panel_paste()
259 void MainEditing::panel_fit_selection()
261 mwindow->fit_selection();
264 void MainEditing::panel_fit_autos(int all)
266 mwindow->fit_autos(all);
269 void MainEditing::panel_set_editing_mode(int mode)
271 mwindow->set_editing_mode(mode);
274 void MainEditing::panel_set_auto_keyframes(int v)
276 mwindow->set_auto_keyframes(v);
279 void MainEditing::panel_set_span_keyframes(int v)
281 mwindow->set_span_keyframes(v);
284 void MainEditing::panel_set_labels_follow_edits(int v)
286 mwindow->set_labels_follow_edits(v);