prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / cinelerra / mbuttons.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #include "bcsignals.h"
23 #include "cplayback.h"
24 #include "cwindow.h"
25 #include "editpanel.h"
26 #include "edl.h"
27 #include "edlsession.h"
28 #include "filexml.h"
29 #include "keys.h"
30 #include "localsession.h"
31 #include "mbuttons.h"
32 #include "mainundo.h"
33 #include "mwindow.h"
34 #include "mwindowgui.h"
35 #include "playbackengine.h"
36 #include "playtransport.h"
37 #include "preferences.h"
38 #include "record.h"
39 #include "mainsession.h"
40 #include "theme.h"
41 #include "tracks.h"
42
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)
48 {
49         this->gui = gui;
50         this->mwindow = mwindow; 
51 }
52
53 MButtons::~MButtons()
54 {
55         delete transport;
56         delete edit_panel;
57 }
58
59 void MButtons::create_objects()
60 {
61         int x = 3, y = 0;
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;
68
69         edit_panel = new MainEditing(mwindow, this, x, y);
70
71         edit_panel->create_objects();
72         
73         x += edit_panel->get_w();
74         flash(0);
75 }
76
77 int MButtons::resize_event()
78 {
79         reposition_window(mwindow->theme->mbuttons_x, 
80                 mwindow->theme->mbuttons_y, 
81                 mwindow->theme->mbuttons_w, 
82                 mwindow->theme->mbuttons_h);
83         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
84         flash(0);
85         return 0;
86 }
87
88 int MButtons::keypress_event()
89 {
90         int result = 0;
91
92         if(!result)
93         {
94                 result = transport->keypress_event();
95         }
96
97         return result;
98 }
99
100 void MButtons::update()
101 {
102         edit_panel->update();
103 }
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
121  : PlayTransport(mwindow, mbuttons, x, y)
122 {
123 }
124
125 void MainTransport::goto_start()
126 {
127         mwindow->gui->unlock_window();
128         handle_transport(REWIND, 1);
129         mwindow->gui->lock_window();
130         mwindow->goto_start();
131 }
132
133
134 void MainTransport::goto_end()
135 {
136         mwindow->gui->unlock_window();
137         handle_transport(GOTO_END, 1);
138         mwindow->gui->lock_window();
139         mwindow->goto_end();
140 }
141
142 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
143  : EditPanel(mwindow, 
144                 mbuttons, 
145                 x, 
146                 y,
147                 mwindow->edl->session->editing_mode,
148                 1,
149                 1,
150                 0, 
151                 0, 
152                 1, 
153                 1,
154                 1,
155                 1,
156                 1,
157                 1,
158                 1,
159                 1,
160                 0,
161                 1,
162                 1,
163                 mwindow->has_commercials())
164 {
165         this->mwindow = mwindow;
166         this->mbuttons = mbuttons;
167 }
168
169