4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "cplayback.h"
25 #include "editpanel.h"
27 #include "edlsession.h"
30 #include "localsession.h"
34 #include "mwindowgui.h"
35 #include "playbackengine.h"
36 #include "playtransport.h"
37 #include "preferences.h"
39 #include "mainsession.h"
43 MButtons::MButtons(MWindow *mwindow, MWindowGUI *gui)
44 : BC_SubWindow(mwindow->theme->mbuttons_x,
45 mwindow->theme->mbuttons_y,
46 mwindow->theme->mbuttons_w,
47 mwindow->theme->mbuttons_h)
50 this->mwindow = mwindow;
51 // *** CONTEXT_HELP ***
52 context_help_set_keyword("Transport and Buttons Bar");
61 void MButtons::create_objects()
64 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
65 transport = new MainTransport(mwindow, this, x, y);
66 transport->create_objects();
67 transport->set_engine(mwindow->cwindow->playback_engine);
68 x += transport->get_w();
69 x += mwindow->theme->mtransport_margin;
71 edit_panel = new MainEditing(mwindow, this, x, y);
73 edit_panel->create_objects();
75 x += edit_panel->get_w();
79 int MButtons::resize_event()
81 reposition_window(mwindow->theme->mbuttons_x,
82 mwindow->theme->mbuttons_y,
83 mwindow->theme->mbuttons_w,
84 mwindow->theme->mbuttons_h);
85 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
90 int MButtons::keypress_event()
96 result = transport->keypress_event();
101 result = context_help_check_and_show();
107 void MButtons::update()
109 edit_panel->update();
113 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
114 : PlayTransport(mwindow, mbuttons, x, y)
118 void MainTransport::goto_start()
120 mwindow->gui->unlock_window();
121 handle_transport(REWIND, 1);
122 mwindow->gui->lock_window();
123 mwindow->goto_start();
127 void MainTransport::goto_end()
129 mwindow->gui->unlock_window();
130 handle_transport(GOTO_END, 1);
131 mwindow->gui->lock_window();
135 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
136 : EditPanel(mwindow, mbuttons, MWINDOW_ID, x, y,
137 mwindow->edl->session->editing_mode,
138 1, // use_editing_mode
151 mwindow->has_commercials(), // use_commerical
155 1, // use_gang_tracks
158 this->mwindow = mwindow;
159 this->mbuttons = mbuttons;
162 double MainEditing::get_position()
164 return mwindow->get_position();
167 void MainEditing::set_position(double position)
169 mwindow->set_position(position);
172 void MainEditing::set_click_to_play(int v)
177 void MainEditing::panel_stop_transport()
179 mwindow->gui->stop_transport("MainEditing::stop_transport");
182 void MainEditing::panel_toggle_label()
184 mwindow->toggle_label();
187 void MainEditing::panel_next_label(int cut)
189 int shift_down = mwindow->gui->shift_down();
190 panel_stop_transport();
192 mwindow->cut_right_label();
194 mwindow->next_label(shift_down);
197 void MainEditing::panel_prev_label(int cut)
199 int shift_down = mwindow->gui->shift_down();
200 panel_stop_transport();
202 mwindow->cut_left_label();
204 mwindow->prev_label(shift_down);
207 void MainEditing::panel_prev_edit(int cut)
209 int shift_down = subwindow->shift_down();
210 panel_stop_transport();
212 mwindow->cut_left_edit();
214 mwindow->prev_edit_handle(shift_down);
217 void MainEditing::panel_next_edit(int cut)
219 int shift_down = subwindow->shift_down();
220 panel_stop_transport();
222 mwindow->cut_right_edit();
224 mwindow->next_edit_handle(shift_down);
227 void MainEditing::panel_copy_selection()
232 void MainEditing::panel_overwrite_selection() {} // not used
233 void MainEditing::panel_splice_selection() {} // not used
235 void MainEditing::panel_set_inpoint()
237 mwindow->set_inpoint();
240 void MainEditing::panel_set_outpoint()
242 mwindow->set_outpoint();
245 void MainEditing::panel_unset_inoutpoint()
247 mwindow->unset_inoutpoint();
250 void MainEditing::panel_to_clip()
252 MWindowGUI *gui = mwindow->gui;
253 gui->unlock_window();
254 mwindow->to_clip(mwindow->edl, _("main window: "), 0);
255 gui->lock_window("MainEditing::to_clip");
259 void MainEditing::panel_cut()
264 void MainEditing::panel_paste()
269 void MainEditing::panel_fit_selection()
271 mwindow->fit_selection();
274 void MainEditing::panel_fit_autos(int all)
276 mwindow->fit_autos(all);
279 void MainEditing::panel_set_editing_mode(int mode)
281 mwindow->set_editing_mode(mode);
284 void MainEditing::panel_set_auto_keyframes(int v)
286 mwindow->set_auto_keyframes(v);
289 void MainEditing::panel_set_span_keyframes(int v)
291 mwindow->set_span_keyframes(v);
294 void MainEditing::panel_set_labels_follow_edits(int v)
296 mwindow->set_labels_follow_edits(v);
299 void MainEditing::panel_set_gang_tracks(int v)
301 mwindow->set_gang_tracks(v);