initial commit
[goodguy/history.git] / cinelerra-5.0 / 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 "mwindow.inc"
23 #include "normalizewindow.h"
24
25 #include <libintl.h>
26 #define _(String) gettext(String)
27 #define gettext_noop(String) String
28 #define N_(String) gettext_noop (String)
29
30 NormalizeWindow::NormalizeWindow(int x, int y)
31  : BC_Window(PROGRAM_NAME ": Normalize",
32                                 x - 160,
33                                 y - 75,
34                                 320,
35                                 150,
36                                 320,
37                                 150,
38                                 0,
39                                 0,
40                                 1)
41 {
42 }
43
44 NormalizeWindow::~NormalizeWindow()
45 {
46 }
47
48 void NormalizeWindow::create_objects(float *db_over, int *separate_tracks)
49 {
50         int x = 10, y = 10;
51         this->db_over = db_over;
52         this->separate_tracks = separate_tracks;
53
54         lock_window("NormalizeWindow::create_objects");
55         add_subwindow(new BC_Title(x, y, _("Enter the DB to overload by:")));
56         y += 20;
57         add_subwindow(new NormalizeWindowOverload(x, y, this->db_over));
58         y += 30;
59         add_subwindow(new NormalizeWindowSeparate(x, y, this->separate_tracks));
60         add_subwindow(new BC_OKButton(this));
61         add_subwindow(new BC_CancelButton(this));
62         show_window();
63         unlock_window();
64 }
65
66 int NormalizeWindow::close_event()
67 {
68         set_done(1);
69         return 1;
70 }
71
72 NormalizeWindowOverload::NormalizeWindowOverload(int x, int y, float *db_over)
73  : BC_TextBox(x, y, 200, 1, *db_over)
74 {
75         this->db_over = db_over;
76 }
77
78 NormalizeWindowOverload::~NormalizeWindowOverload()
79 {
80 }
81
82 int NormalizeWindowOverload::handle_event()
83 {
84         *db_over = atof(get_text());
85         return 1;
86 }
87
88
89 NormalizeWindowSeparate::NormalizeWindowSeparate(int x, int y, int *separate_tracks)
90  : BC_CheckBox(x, y, *separate_tracks, _("Treat tracks independantly"))
91 {
92         this->separate_tracks = separate_tracks;
93 }
94
95 NormalizeWindowSeparate::~NormalizeWindowSeparate()
96 {
97 }
98
99 int NormalizeWindowSeparate::handle_event()
100 {
101         *separate_tracks = get_value();
102         return 1;
103 }