prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / plugins / cdripper / cdripwindow.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 "cdripwindow.h"
23 #include "language.h"
24 #include "mwindow.inc"
25
26 #include <string.h>
27
28 CDRipWindow::CDRipWindow(CDRipMain *cdripper, int x, int y)
29  : BC_Window(_(PROGRAM_NAME ": CD Ripper"), 
30         x,
31         y,
32         450, 
33         230, 
34         450, 
35         230,
36         0,
37         0,
38         1)
39
40         this->cdripper = cdripper; 
41 }
42
43 CDRipWindow::~CDRipWindow()
44 {
45 }
46
47 void CDRipWindow::create_objects()
48 {
49         int y = 10, x = 10;
50         add_tool(new BC_Title(x, y, _("Select the range to transfer:"))); y += 25;
51         add_tool(new BC_Title(x, y, _("Track"))); x += 70;
52         add_tool(new BC_Title(x, y, _("Min"))); x += 70;
53         add_tool(new BC_Title(x, y, _("Sec"))); x += 100;
54
55         add_tool(new BC_Title(x, y, _("Track"))); x += 70;
56         add_tool(new BC_Title(x, y, _("Min"))); x += 70;
57         add_tool(new BC_Title(x, y, _("Sec"))); x += 100;
58         
59         x = 10;  y += 25;
60         add_tool(track1 = new CDRipTextValue(this, &(cdripper->track1), x, y, 50));
61         x += 70;
62         add_tool(min1 = new CDRipTextValue(this, &(cdripper->min1), x, y, 50));
63         x += 70;
64         add_tool(sec1 = new CDRipTextValue(this, &(cdripper->sec1), x, y, 50));
65         x += 100;
66         
67         add_tool(track2 = new CDRipTextValue(this, &(cdripper->track2), x, y, 50));
68         x += 70;
69         add_tool(min2 = new CDRipTextValue(this, &(cdripper->min2), x, y, 50));
70         x += 70;
71         add_tool(sec2 = new CDRipTextValue(this, &(cdripper->sec2), x, y, 50));
72
73         x = 10;   y += 30;
74         add_tool(new BC_Title(x, y, _("From"), LARGEFONT, RED));
75         x += 240;
76         add_tool(new BC_Title(x, y, _("To"), LARGEFONT, RED));
77
78         x = 10;   y += 35;
79         add_tool(new BC_Title(x, y, _("CD Device:")));
80         x += 100;
81         add_tool(device = new CDRipWindowDevice(this, cdripper->device, x, y, 200));
82
83         x = 10;   y += 35;
84         add_tool(new BC_OKButton(this));
85         x += 300;
86         add_tool(new BC_CancelButton(this));
87         show_window();
88         flush();
89 }
90
91
92
93
94
95
96
97
98 CDRipTextValue::CDRipTextValue(CDRipWindow *window, int *output, int x, int y, int w)
99  : BC_TextBox(x, y, w, 1, *output)
100 {
101         this->output = output;
102         this->window = window;
103 }
104
105 CDRipTextValue::~CDRipTextValue()
106 {
107 }
108         
109 int CDRipTextValue::handle_event()
110 {
111         *output = atol(get_text());
112         return 1;
113 }
114
115 CDRipWindowDevice::CDRipWindowDevice(CDRipWindow *window, char *device, int x, int y, int w)
116  : BC_TextBox(x, y, w, 1, device)
117 {
118         this->window = window;
119         this->device = device;
120 }
121
122 CDRipWindowDevice::~CDRipWindowDevice()
123 {
124 }
125
126 int CDRipWindowDevice::handle_event()
127 {
128         strcpy(device, get_text());
129         return 1;
130 }