r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / mbuttons.C
blob03d0cd62112e5d3edb9459bf043e91e26ff184d0
1 #include "cplayback.h"
2 #include "cwindow.h"
3 #include "editpanel.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "filexml.h"
7 #include "keys.h"
8 #include "localsession.h"
9 #include "mbuttons.h"
10 #include "mainundo.h"
11 #include "mwindow.h"
12 #include "mwindowgui.h"
13 #include "playbackengine.h"
14 #include "playtransport.h"
15 #include "preferences.h"
16 #include "record.h"
17 #include "mainsession.h"
18 #include "theme.h"
19 #include "tracks.h"
21 MButtons::MButtons(MWindow *mwindow, MWindowGUI *gui)
22  : BC_SubWindow(mwindow->theme->mbuttons_x, 
23         mwindow->theme->mbuttons_y, 
24         mwindow->theme->mbuttons_w, 
25         mwindow->theme->mbuttons_h)
27         this->gui = gui;
28         this->mwindow = mwindow; 
31 MButtons::~MButtons()
33         delete transport;
34         delete edit_panel;
37 int MButtons::create_objects()
39         int x = 3, y = 0;
40         BC_SubWindow *button;
42         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
43         transport = new MainTransport(mwindow, this, x, y);
44         transport->create_objects();
45         transport->set_engine(mwindow->cwindow->playback_engine);
46         x += transport->get_w();
47         x += mwindow->theme->mtransport_margin;
49         edit_panel = new MainEditing(mwindow, this, x, y);
51         edit_panel->create_objects();
52         
53         x += edit_panel->get_w();
54         flash();
55         return 0;
58 int MButtons::resize_event()
60         reposition_window(mwindow->theme->mbuttons_x, 
61                 mwindow->theme->mbuttons_y, 
62                 mwindow->theme->mbuttons_w, 
63                 mwindow->theme->mbuttons_h);
64         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
65         flash();
68 int MButtons::keypress_event()
70         int result = 0;
72         if(!result)
73         {
74                 result = transport->keypress_event();
75         }
77         return result;
80 void MButtons::update()
82         edit_panel->update();
100 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
101  : PlayTransport(mwindow, mbuttons, x, y)
105 void MainTransport::goto_start()
107         mwindow->gui->unlock_window();
108         handle_transport(REWIND, 1);
109         mwindow->gui->lock_window();
110         mwindow->goto_start();
114 void MainTransport::goto_end()
116         mwindow->gui->unlock_window();
117         handle_transport(GOTO_END, 1);
118         mwindow->gui->lock_window();
119         mwindow->goto_end();
122 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
123  : EditPanel(mwindow, 
124                 mbuttons, 
125                 x, 
126                 y,
127                 mwindow->edl->session->editing_mode,
128                 1,
129                 1,
130                 0, 
131                 0, 
132                 1, 
133                 1,
134                 1,
135                 1,
136                 1,
137                 1,
138                 1,
139                 1,
140                 0,
141                 1,
142                 1)
144         this->mwindow = mwindow;
145         this->mbuttons = mbuttons;