splashgui text clr, faders/speed keyframe popup slider rework, reticle rework
[goodguy/history.git] / cinelerra-5.1 / cinelerra / levelwindowgui.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2011 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 "edl.h"
23 #include "edlsession.h"
24 #include "language.h"
25 #include "levelwindow.h"
26 #include "levelwindowgui.h"
27 #include "mainmenu.h"
28 #include "mainsession.h"
29 #include "meterpanel.h"
30 #include "mwindow.h"
31 #include "mwindowgui.h"
32 #include "preferences.h"
33 #include "theme.h"
34
35 LevelWindowGUI::LevelWindowGUI(MWindow *mwindow, LevelWindow *thread)
36  : BC_Window(_(PROGRAM_NAME ": Levels"),
37         mwindow->session->lwindow_x,
38         mwindow->session->lwindow_y,
39         mwindow->session->lwindow_w,
40         mwindow->session->lwindow_h,
41         10,
42         10,
43         1,
44         0,
45         1)
46 {
47         this->thread = thread;
48         this->mwindow = mwindow;
49 }
50
51 LevelWindowGUI::~LevelWindowGUI()
52 {
53         delete panel;
54 }
55
56 void LevelWindowGUI::create_objects()
57 {
58         int border = mwindow->theme->widget_border;
59         lock_window("LevelWindowGUI::create_objects");
60         mwindow->theme->draw_lwindow_bg(this);
61         panel = new MeterPanel(mwindow,
62                 this,
63                 border,
64                 border,
65                 get_w() - border * 2,
66                 get_h() - border * 2,
67                 mwindow->edl->session->audio_channels,
68                 1,
69                 0,
70                 1);
71         panel->create_objects();
72         unlock_window();
73 }
74
75
76 int LevelWindowGUI::resize_event(int w, int h)
77 {
78         int border = mwindow->theme->widget_border;
79         mwindow->session->lwindow_x = get_x();
80         mwindow->session->lwindow_y = get_y();
81         mwindow->session->lwindow_w = w;
82         mwindow->session->lwindow_h = h;
83
84         mwindow->theme->draw_lwindow_bg(this);
85
86         panel->reposition_window(panel->x,
87                 panel->y,
88                 w - border * 2,
89                 h - border * 2);
90
91         BC_WindowBase::resize_event(w, h);
92         return 1;
93 }
94
95 int LevelWindowGUI::translation_event()
96 {
97         mwindow->session->lwindow_x = get_x();
98         mwindow->session->lwindow_y = get_y();
99         return 0;
100 }
101
102 int LevelWindowGUI::close_event()
103 {
104         hide_window();
105         mwindow->session->show_lwindow = 0;
106         mwindow->gui->lock_window();
107         mwindow->gui->mainmenu->show_lwindow->set_checked(0);
108         mwindow->gui->unlock_window();
109         mwindow->save_defaults();
110         return 1;
111 }
112
113 int LevelWindowGUI::keypress_event()
114 {
115         if(get_keypress() == 'w' || get_keypress() == 'W')
116         {
117                 close_event();
118                 return 1;
119         }
120         return 0;
121 }
122
123
124 int LevelWindowGUI::reset_over()
125 {
126         return 0;
127 }
128