vicon placement tweak, bclistbox select fixes, new ctrl-a/s shortcuts
[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,
39         mwindow->session->lwindow_y,
40         mwindow->session->lwindow_w,
41         mwindow->session->lwindow_h,
42         10,
43         10,
44         1,
45         0,
46         1)
47 {
48         this->thread = thread;
49         this->mwindow = mwindow;
50 }
51
52 LevelWindowGUI::~LevelWindowGUI()
53 {
54         delete panel;
55 }
56
57 void LevelWindowGUI::create_objects()
58 {
59         int border = mwindow->theme->widget_border;
60         lock_window("LevelWindowGUI::create_objects");
61         mwindow->theme->draw_lwindow_bg(this);
62         panel = new MeterPanel(mwindow,
63                 this,
64                 border,
65                 border,
66                 get_w() - border * 2,
67                 get_h() - border * 2,
68                 mwindow->edl->session->audio_channels,
69                 1,
70                 0,
71                 1);
72         panel->create_objects();
73         unlock_window();
74 }
75
76
77 int LevelWindowGUI::resize_event(int w, int h)
78 {
79         int border = mwindow->theme->widget_border;
80         mwindow->session->lwindow_x = get_x();
81         mwindow->session->lwindow_y = get_y();
82         mwindow->session->lwindow_w = w;
83         mwindow->session->lwindow_h = h;
84
85         mwindow->theme->draw_lwindow_bg(this);
86
87         panel->reposition_window(panel->x,
88                 panel->y,
89                 w - border * 2,
90                 h - border * 2);
91
92         BC_WindowBase::resize_event(w, h);
93         return 1;
94 }
95
96 int LevelWindowGUI::translation_event()
97 {
98         mwindow->session->lwindow_x = get_x();
99         mwindow->session->lwindow_y = get_y();
100         return 0;
101 }
102
103 int LevelWindowGUI::close_event()
104 {
105         hide_window();
106         mwindow->session->show_lwindow = 0;
107         mwindow->gui->lock_window();
108         mwindow->gui->mainmenu->show_lwindow->set_checked(0);
109         mwindow->gui->unlock_window();
110         mwindow->save_defaults();
111         return 1;
112 }
113
114 int LevelWindowGUI::keypress_event()
115 {
116         switch( get_keypress() ) {
117         case 'w':
118         case 'W':
119                 close_event();
120                 return 1;
121         case KEY_F1:
122         case KEY_F2:
123         case KEY_F3:
124         case KEY_F4:
125                 if( ctrl_down() && shift_down() ) {
126                         resend_event(mwindow->gui);
127                         return 1;
128                 }
129         }
130         return 0;
131 }
132
133 int LevelWindowGUI::reset_over()
134 {
135         return 0;
136 }
137