rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.git] / cinelerra-5.1 / 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 "cplayback.h"
23 #include "cwindow.h"
24 #include "editpanel.h"
25 #include "edl.h"
26 #include "edlsession.h"
27 #include "filexml.h"
28 #include "keys.h"
29 #include "localsession.h"
30 #include "mbuttons.h"
31 #include "mainundo.h"
32 #include "mwindow.h"
33 #include "mwindowgui.h"
34 #include "playbackengine.h"
35 #include "playtransport.h"
36 #include "preferences.h"
37 #include "record.h"
38 #include "mainsession.h"
39 #include "theme.h"
40 #include "tracks.h"
41
42 MButtons::MButtons(MWindow *mwindow, MWindowGUI *gui)
43  : BC_SubWindow(mwindow->theme->mbuttons_x,
44         mwindow->theme->mbuttons_y,
45         mwindow->theme->mbuttons_w,
46         mwindow->theme->mbuttons_h)
47 {
48         this->gui = gui;
49         this->mwindow = mwindow;
50 }
51
52 MButtons::~MButtons()
53 {
54         delete transport;
55         delete edit_panel;
56 }
57
58 void MButtons::create_objects()
59 {
60         int x = 3, y = 0;
61         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
62         transport = new MainTransport(mwindow, this, x, y);
63         transport->create_objects();
64         transport->set_engine(mwindow->cwindow->playback_engine);
65         x += transport->get_w();
66         x += mwindow->theme->mtransport_margin;
67
68         edit_panel = new MainEditing(mwindow, this, x, y);
69
70         edit_panel->create_objects();
71
72         x += edit_panel->get_w();
73         flash(0);
74 }
75
76 int MButtons::resize_event()
77 {
78         reposition_window(mwindow->theme->mbuttons_x,
79                 mwindow->theme->mbuttons_y,
80                 mwindow->theme->mbuttons_w,
81                 mwindow->theme->mbuttons_h);
82         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
83         flash(0);
84         return 1;
85 }
86
87 int MButtons::keypress_event()
88 {
89         int result = 0;
90
91         if(!result)
92         {
93                 result = transport->keypress_event();
94         }
95
96         return result;
97 }
98
99 void MButtons::update()
100 {
101         edit_panel->update();
102 }
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 MainTransport::MainTransport(MWindow *mwindow, MButtons *mbuttons, int x, int y)
120  : PlayTransport(mwindow, mbuttons, x, y)
121 {
122 }
123
124 void MainTransport::goto_start()
125 {
126         mwindow->gui->unlock_window();
127         handle_transport(REWIND, 1);
128         mwindow->gui->lock_window();
129         mwindow->goto_start();
130 }
131
132
133 void MainTransport::goto_end()
134 {
135         mwindow->gui->unlock_window();
136         handle_transport(GOTO_END, 1);
137         mwindow->gui->lock_window();
138         mwindow->goto_end();
139 }
140
141 MainEditing::MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y)
142  : EditPanel(mwindow,
143                 mbuttons,
144                 x,
145                 y,
146                 mwindow->edl->session->editing_mode,
147                 1,
148                 1,
149                 0,
150                 0,
151                 1,
152                 1,
153                 1,
154                 1,
155                 1,
156                 1,
157                 1, // locklabels
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