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 "bcsignals.h"
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;
59 void MButtons::create_objects()
62 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
63 transport = new MainTransport(mwindow, this, x, y);
64 transport->create_objects();
65 transport->set_engine(mwindow->cwindow->playback_engine);
66 x += transport->get_w();
67 x += mwindow->theme->mtransport_margin;
69 edit_panel = new MainEditing(mwindow, this, x, y);
71 edit_panel->create_objects();
73 x += edit_panel->get_w();
74 ffmpeg_toggle = new MainFFMpegToggle(mwindow, this, get_w(), 0);
75 add_subwindow(ffmpeg_toggle);
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());
86 ffmpeg_toggle->reposition_window(get_w()-30, 0);
91 int MButtons::keypress_event()
97 result = transport->keypress_event();
103 void MButtons::update()
105 edit_panel->update();
123 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
124 : PlayTransport(mwindow, mbuttons, x, y)
128 void MainTransport::goto_start()
130 mwindow->gui->unlock_window();
131 handle_transport(REWIND, 1);
132 mwindow->gui->lock_window();
133 mwindow->goto_start();
137 void MainTransport::goto_end()
139 mwindow->gui->unlock_window();
140 handle_transport(GOTO_END, 1);
141 mwindow->gui->lock_window();
145 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
150 mwindow->edl->session->editing_mode,
166 mwindow->has_commercials())
168 this->mwindow = mwindow;
169 this->mbuttons = mbuttons;
173 MainFFMpegToggle::MainFFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y)
174 : BC_Toggle(x - mwindow->theme->ffmpeg_toggle[0]->get_w(), y,
175 mwindow->theme->ffmpeg_toggle, mwindow->preferences->ffmpeg_early_probe)
177 this->mwindow = mwindow;
178 this->mbuttons = mbuttons;
179 set_tooltip(_("FFMpeg early probe"));
182 MainFFMpegToggle::~MainFFMpegToggle()
186 int MainFFMpegToggle::handle_event()
188 mwindow->preferences->ffmpeg_early_probe = get_value();
189 mwindow->show_warning(&mwindow->preferences->warn_indecies,
190 _("Changing the base codecs may require rebuilding indecies."));