Exciting new Alt/h help key provided by sge (Georgy) with many thanks!
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / normalize / normalizewindow.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 "language.h"
23 #include "mwindow.inc"
24 #include "normalizewindow.h"
25
26 NormalizeWindow::NormalizeWindow(int x, int y)
27  : BC_Window(_(PROGRAM_NAME ": Normalize"), x - xS(160), y - yS(75),
28                 xS(320), yS(150), xS(320), yS(150), 0, 0, 1)
29 {
30 // *** CONTEXT_HELP ***
31         context_help_set_keyword("Rendered Audio Effects");
32 }
33
34 NormalizeWindow::~NormalizeWindow()
35 {
36 }
37
38 void NormalizeWindow::create_objects(float *db_over, int *separate_tracks)
39 {
40         int xs10 = xS(10);
41         int ys10 = yS(10), ys20 = yS(20), ys30 = yS(30);
42         int x = xs10, y = ys10;
43         this->db_over = db_over;
44         this->separate_tracks = separate_tracks;
45
46         lock_window("NormalizeWindow::create_objects");
47         add_subwindow(new BC_Title(x, y, _("Enter the DB to overload by:")));
48         y += ys20;
49         add_subwindow(new NormalizeWindowOverload(x, y, this->db_over));
50         y += ys30;
51         add_subwindow(new NormalizeWindowSeparate(x, y, this->separate_tracks));
52         add_subwindow(new BC_OKButton(this));
53         add_subwindow(new BC_CancelButton(this));
54         show_window();
55         unlock_window();
56 }
57
58 int NormalizeWindow::close_event()
59 {
60         set_done(1);
61         return 1;
62 }
63
64 NormalizeWindowOverload::NormalizeWindowOverload(int x, int y, float *db_over)
65  : BC_TextBox(x, y, xS(200), 1, *db_over)
66 {
67         this->db_over = db_over;
68 }
69
70 NormalizeWindowOverload::~NormalizeWindowOverload()
71 {
72 }
73
74 int NormalizeWindowOverload::handle_event()
75 {
76         *db_over = atof(get_text());
77         return 1;
78 }
79
80
81 NormalizeWindowSeparate::NormalizeWindowSeparate(int x, int y, int *separate_tracks)
82  : BC_CheckBox(x, y, *separate_tracks, _("Treat tracks independantly"))
83 {
84         this->separate_tracks = separate_tracks;
85 }
86
87 NormalizeWindowSeparate::~NormalizeWindowSeparate()
88 {
89 }
90
91 int NormalizeWindowSeparate::handle_event()
92 {
93         *separate_tracks = get_value();
94         return 1;
95 }