r602: Fix baver's code... don't insert timecode when show_tc is not set
[cinelerra_cv/mob.git] / cinelerra / mbuttons.C
blob1465f33f08ed660d29b5e97409335c0dd7505d31
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 "labelnavigate.h"
9 #include "localsession.h"
10 #include "mbuttons.h"
11 #include "mainundo.h"
12 #include "mwindow.h"
13 #include "mwindowgui.h"
14 #include "playbackengine.h"
15 #include "playtransport.h"
16 #include "preferences.h"
17 #include "record.h"
18 #include "mainsession.h"
19 #include "theme.h"
20 #include "tracks.h"
22 MButtons::MButtons(MWindow *mwindow, MWindowGUI *gui)
23  : BC_SubWindow(mwindow->theme->mbuttons_x, 
24         mwindow->theme->mbuttons_y, 
25         mwindow->theme->mbuttons_w, 
26         mwindow->theme->mbuttons_h)
28         this->gui = gui;
29         this->mwindow = mwindow; 
32 MButtons::~MButtons()
34         delete transport;
35         delete edit_panel;
38 int MButtons::create_objects()
40         int x = 3, y = 0;
41         BC_SubWindow *button;
43         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
44         transport = new MainTransport(mwindow, this, x, y);
45         transport->create_objects();
46         transport->set_engine(mwindow->cwindow->playback_engine);
47         x += transport->get_w();
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 //      switch(get_keypress())
73 //      {
74 //              case END:
75 //                      mwindow->goto_start();
76 //                      result = 1;
77 //                      break;
78 //              case HOME:
79 //                      mwindow->goto_end();
80 //                      result = 1;
81 //                      break;
82 //      }
84         if(!result)
85         {
86                 result = transport->keypress_event();
87         }
89         if(!result)
90         {
91         }
93 //printf("MButtons::keypress_event %d\n", result);
94         return result;
97 void MButtons::update()
99         edit_panel->update();
117 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
118  : PlayTransport(mwindow, mbuttons, x, y)
122 void MainTransport::goto_start()
124         mwindow->gui->unlock_window();
125         handle_transport(REWIND, 1);
126         mwindow->gui->lock_window();
127         mwindow->goto_start();
131 void MainTransport::goto_end()
133         mwindow->gui->unlock_window();
134         handle_transport(GOTO_END, 1);
135         mwindow->gui->lock_window();
136         mwindow->goto_end();
139 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
140  : EditPanel(mwindow, 
141                 mbuttons, 
142                 x, 
143                 y,
144                 mwindow->edl->session->editing_mode,
145                 1,
146                 1,
147                 0, 
148                 0, 
149                 1, 
150                 1,
151                 1,
152                 1,
153                 1,
154                 1,
155                 1,
156                 1,
157                 0,
158                 1,
159                 1)
161         this->mwindow = mwindow;
162         this->mbuttons = mbuttons;
173 RecButton::RecButton(int x, int y, MWindow *mwindow)
174  : BC_Button(x, y, mwindow->theme->rec_data) 
175 { this->mwindow = mwindow; }
176 int RecButton::handle_event()
178 //printf("Rec pressed\n");
180 int RecButton::keypress_event()
182         if(get_keypress() == 18) { handle_event(); return 1; }
183         return 0;
187 ExpandX::ExpandX(int x, int y, MWindow *mwindow)
188  : BC_Button(x, y, mwindow->theme->rec_data) 
189 { this->mwindow = mwindow; }
190 int ExpandX::handle_event()
192         mwindow->expand_sample(); 
194 int ExpandX::keypress_event()
196         if(get_keypress() == UP && !ctrl_down()) { handle_event(); return 1; }
197         return 0;
201 ZoomX::ZoomX(int x, int y, MWindow *mwindow)
202  : BC_Button(x, y, mwindow->theme->rec_data)
203 { this->mwindow = mwindow; }
204 int ZoomX::handle_event()
206         mwindow->zoom_in_sample(); 
208 int ZoomX::keypress_event()
210         if(get_keypress() == DOWN && !ctrl_down()) { handle_event(); return 1; }
211         return 0;
215 ExpandY::ExpandY(int x, int y, MWindow *mwindow)
216  : BC_Button(x, y, mwindow->theme->rec_data) 
217 { this->mwindow = mwindow; }
218 int ExpandY::handle_event()
220         mwindow->expand_y();
222 int ExpandY::keypress_event()
224         if(get_keypress() == UP && ctrl_down()) { handle_event(); return 1; }
225         return 0;
229 ZoomY::ZoomY(int x, int y, MWindow *mwindow)
230  : BC_Button(x, y, mwindow->theme->rec_data) 
231 { this->mwindow = mwindow; }
232 int ZoomY::handle_event()
234         mwindow->zoom_in_y();
236 int ZoomY::keypress_event()
238         if(get_keypress() == DOWN && ctrl_down()) { handle_event(); return 1; }
239         return 0;
243 ExpandTrack::ExpandTrack(int x, int y, MWindow *mwindow)
244  : BC_Button(x, y, mwindow->theme->rec_data) 
245 { this->mwindow = mwindow; }
246 int ExpandTrack::handle_event()
247 {       
248         mwindow->expand_t();
250 int ExpandTrack::keypress_event()
252         if(get_keypress() == PGUP && ctrl_down()) { handle_event(); return 1; }
253         return 0;
257 ZoomTrack::ZoomTrack(int x, int y, MWindow *mwindow)
258  : BC_Button(x, y, mwindow->theme->rec_data) 
260         this->mwindow = mwindow; 
262 int ZoomTrack::handle_event()
264         mwindow->zoom_in_t();
266 int ZoomTrack::keypress_event()
268         if(get_keypress() == PGDN && ctrl_down()) { handle_event(); return 1; }
269         return 0;