upgrade libx265 to 3.1.2, tweak menupopup placement
[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"),
28                                 x - 160,
29                                 y - 75,
30                                 320,
31                                 150,
32                                 320,
33                                 150,
34                                 0,
35                                 0,
36                                 1)
37 {
38 }
39
40 NormalizeWindow::~NormalizeWindow()
41 {
42 }
43
44 void NormalizeWindow::create_objects(float *db_over, int *separate_tracks)
45 {
46         int x = 10, y = 10;
47         this->db_over = db_over;
48         this->separate_tracks = separate_tracks;
49
50         lock_window("NormalizeWindow::create_objects");
51         add_subwindow(new BC_Title(x, y, _("Enter the DB to overload by:")));
52         y += 20;
53         add_subwindow(new NormalizeWindowOverload(x, y, this->db_over));
54         y += 30;
55         add_subwindow(new NormalizeWindowSeparate(x, y, this->separate_tracks));
56         add_subwindow(new BC_OKButton(this));
57         add_subwindow(new BC_CancelButton(this));
58         show_window();
59         unlock_window();
60 }
61
62 int NormalizeWindow::close_event()
63 {
64         set_done(1);
65         return 1;
66 }
67
68 NormalizeWindowOverload::NormalizeWindowOverload(int x, int y, float *db_over)
69  : BC_TextBox(x, y, 200, 1, *db_over)
70 {
71         this->db_over = db_over;
72 }
73
74 NormalizeWindowOverload::~NormalizeWindowOverload()
75 {
76 }
77
78 int NormalizeWindowOverload::handle_event()
79 {
80         *db_over = atof(get_text());
81         return 1;
82 }
83
84
85 NormalizeWindowSeparate::NormalizeWindowSeparate(int x, int y, int *separate_tracks)
86  : BC_CheckBox(x, y, *separate_tracks, _("Treat tracks independantly"))
87 {
88         this->separate_tracks = separate_tracks;
89 }
90
91 NormalizeWindowSeparate::~NormalizeWindowSeparate()
92 {
93 }
94
95 int NormalizeWindowSeparate::handle_event()
96 {
97         *separate_tracks = get_value();
98         return 1;
99 }