improve delays created by vicon drawing locks, reset_cache segv fix, gang track toolt...
[goodguy/cinelerra.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 "keys.h"
25 #include "language.h"
26 #include "levelwindow.h"
27 #include "levelwindowgui.h"
28 #include "mainmenu.h"
29 #include "mainsession.h"
30 #include "meterpanel.h"
31 #include "mwindow.h"
32 #include "mwindowgui.h"
33 #include "preferences.h"
34 #include "theme.h"
35
36 LevelWindowGUI::LevelWindowGUI(MWindow *mwindow, LevelWindow *thread)
37  : BC_Window(_(PROGRAM_NAME ": Levels"),
38         mwindow->session->lwindow_x, mwindow->session->lwindow_y,
39         mwindow->session->lwindow_w, mwindow->session->lwindow_h,
40         xS(10), yS(10), 1, 0, 1)
41 {
42         this->thread = thread;
43         this->mwindow = mwindow;
44 }
45
46 LevelWindowGUI::~LevelWindowGUI()
47 {
48         delete panel;
49 }
50
51 void LevelWindowGUI::create_objects()
52 {
53         int border = mwindow->theme->widget_border;
54         lock_window("LevelWindowGUI::create_objects");
55         mwindow->theme->draw_lwindow_bg(this);
56         panel = new MeterPanel(mwindow,
57                 this,
58                 border,
59                 border,
60                 get_w() - border * 2,
61                 get_h() - border * 2,
62                 mwindow->edl->session->audio_channels,
63                 1,
64                 0,
65                 1);
66         panel->create_objects();
67         unlock_window();
68 }
69
70
71 int LevelWindowGUI::resize_event(int w, int h)
72 {
73         int border = mwindow->theme->widget_border;
74         mwindow->session->lwindow_x = get_x();
75         mwindow->session->lwindow_y = get_y();
76         mwindow->session->lwindow_w = w;
77         mwindow->session->lwindow_h = h;
78
79         mwindow->theme->draw_lwindow_bg(this);
80
81         panel->reposition_window(panel->x,
82                 panel->y,
83                 w - border * 2,
84                 h - border * 2);
85
86         BC_WindowBase::resize_event(w, h);
87         return 1;
88 }
89
90 int LevelWindowGUI::translation_event()
91 {
92         mwindow->session->lwindow_x = get_x();
93         mwindow->session->lwindow_y = get_y();
94         return 0;
95 }
96
97 int LevelWindowGUI::close_event()
98 {
99         hide_window();
100         mwindow->session->show_lwindow = 0;
101         mwindow->gui->lock_window();
102         mwindow->gui->mainmenu->show_lwindow->set_checked(0);
103         mwindow->gui->unlock_window();
104         mwindow->save_defaults();
105         return 1;
106 }
107
108 int LevelWindowGUI::keypress_event()
109 {
110         switch( get_keypress() ) {
111         case 'w':
112         case 'W':
113                 close_event();
114                 return 1;
115         case KEY_F1:
116         case KEY_F2:
117         case KEY_F3:
118         case KEY_F4:
119                 if( ctrl_down() && shift_down() ) {
120                         resend_event(mwindow->gui);
121                         return 1;
122                 }
123         }
124         return 0;
125 }
126
127 int LevelWindowGUI::reset_over()
128 {
129         return 0;
130 }
131