-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathProcessingPanel.java
279 lines (232 loc) · 11.1 KB
/
ProcessingPanel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
@SuppressWarnings("serial")
public class ProcessingPanel extends JPanel{
private BoxLayout boxLayout = new BoxLayout(this, BoxLayout.LINE_AXIS);
private JPanel panelProcess = new JPanel();
private BoxLayout boxLayoutProcess = new BoxLayout(panelProcess, BoxLayout.PAGE_AXIS);
private JPanel panelOptions = new JPanel();
private BoxLayout boxLayoutOptions = new BoxLayout(panelOptions, BoxLayout.PAGE_AXIS);
private JPanel panelAreas = new JPanel();
private BoxLayout boxLayoutAreas = new BoxLayout(panelAreas, BoxLayout.PAGE_AXIS);
private GuiControl guiControl;
// Radio buttons for process selection
private ButtonGroup buttonGroup_process = new ButtonGroup();
private JRadioButton radButtonDSF = new JRadioButton("DSF");
private JRadioButton radButtonDSDIFF = new JRadioButton("DSDIFF");
private JRadioButton radButtonDSDIFFEM = new JRadioButton("DSDIFF edit master");
private JRadioButton radButtonISO = new JRadioButton("ISO");
private JRadioButton radButtonISO_DSF = new JRadioButton("ISO+DSF");
private JRadioButton radButtonISO_DSDIFF = new JRadioButton("ISO+DSDIFF");
private JRadioButton radButtonNone = new JRadioButton("none");
private JCheckBox checkBoxPrint = new JCheckBox("Print disc summary");
private JCheckBox checkBoxDecompress = new JCheckBox("DST decompression");
private JCheckBox checkBoxSelectTracks = new JCheckBox("Select tracks (ex: 1,4,5)");
private JTextField textFieldTracks = new JTextField();
private JCheckBox checkBoxNoPad = new JCheckBox("Padding-less DSF");
private JCheckBox checkBoxCue= new JCheckBox("Cue sheet");
private JCheckBox checkBoxStereo = new JCheckBox("Stereo");
private JCheckBox checkBoxMulti = new JCheckBox("Multi-channel");
private JRadioButton radButtons[] = new JRadioButton[7];
private JCheckBox checkBoxes[] = new JCheckBox[7];
public static final int PROCESS_DSF = 0;
public static final int PROCESS_DSDIFF = 1;
public static final int PROCESS_DSDIFFEM = 2;
public static final int PROCESS_ISO = 3;
public static final int PROCESS_ISO_DSF = 4;
public static final int PROCESS_ISO_DSDIFF = 5;
public static final int PROCESS_NONE = 6;
public static final int OPTION_STEREO = 0;
public static final int OPTION_MULTI = 1;
public static final int OPTION_DECOMPRESS = 2;
public static final int OPTION_SELECTTRACKS = 3;
public static final int OPTION_NOPAD = 4;
public static final int OPTION_CUE = 5;
public static final int OPTION_PRINT = 6;
public ProcessingPanel(){
setupGui();
}
public void setProcess(int process){
radButtons[process].setSelected(true);
}
public void clickOption(int option, boolean s){
checkBoxes[option].setSelected(s);
}
public void setSelectedOptionIfEnabled(int option, boolean s){
if(checkBoxes[option].isEnabled()){
checkBoxes[option].setSelected(s);
}
}
public void doClickOptionIfEnabled(int option, boolean s){
if(checkBoxes[option].isEnabled()){
checkBoxes[option].doClick();
}
}
public void setSelectedOptionIfEnabledByClick(int option, boolean s){
if(checkBoxes[option].isEnabled() && (checkBoxes[option].isSelected() == false) && s){
checkBoxes[option].doClick();
}
}
public void setOption(int option, CheckBoxState s){
checkBoxes[option].setEnabled(s.enabled);
checkBoxes[option].setSelected(s.selected);
}
public boolean getRadButtonState(int process){
return radButtons[process].isSelected();
}
public CheckBoxState getOption(int option){
CheckBoxState s = new CheckBoxState();
s.selected = checkBoxes[option].isSelected();
s.enabled = checkBoxes[option].isEnabled();
return s;
}
public void setSelectedCheckBoxCue(CheckBoxState s){
checkBoxCue.setEnabled(s.enabled);
checkBoxCue.setSelected(s.selected);
}
public void setSelectedCheckBoxPrint(CheckBoxState s){
checkBoxPrint.setEnabled(s.enabled);
checkBoxPrint.setSelected(s.selected);
}
public void setControl(GuiControl c){
guiControl = c;
}
public void setEnabledTextFieldTracks(boolean e){
textFieldTracks.setEnabled(e);
}
public void setTextTextFieldTracks(String s){
textFieldTracks.setText(s);
}
public String getTextTextFieldTracks(){
return textFieldTracks.getText();
}
public void clickProcess(int p){
radButtons[p].doClick();
}
private void setupGui(){
this.setBorder(BorderFactory.createTitledBorder("Processing"));
this.setLayout(boxLayout);
// Process button group
buttonGroup_process.add(radButtonDSF);
buttonGroup_process.add(radButtonDSDIFF);
buttonGroup_process.add(radButtonDSDIFFEM);
buttonGroup_process.add(radButtonISO);
buttonGroup_process.add(radButtonISO_DSF);
buttonGroup_process.add(radButtonISO_DSDIFF);
buttonGroup_process.add(radButtonNone);
radButtons[PROCESS_DSF] = radButtonDSF;
radButtons[PROCESS_DSDIFF] = radButtonDSDIFF;
radButtons[PROCESS_DSDIFFEM] = radButtonDSDIFFEM;
radButtons[PROCESS_ISO] = radButtonISO;
radButtons[PROCESS_ISO_DSF] = radButtonISO_DSF;
radButtons[PROCESS_ISO_DSDIFF] = radButtonISO_DSDIFF;
radButtons[PROCESS_NONE] = radButtonNone;
checkBoxes[OPTION_STEREO] = checkBoxStereo;
checkBoxes[OPTION_MULTI] = checkBoxMulti;
checkBoxes[OPTION_DECOMPRESS] = checkBoxDecompress;
checkBoxes[OPTION_SELECTTRACKS] = checkBoxSelectTracks;
checkBoxes[OPTION_NOPAD] = checkBoxNoPad;
checkBoxes[OPTION_CUE] = checkBoxCue;
checkBoxes[OPTION_PRINT] = checkBoxPrint;
radButtonISO.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonISO();}}});
radButtonDSF.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonDSF();}}});
radButtonDSDIFF.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonDSDIFF();}}});
radButtonDSDIFFEM.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonDSDIFFEM();}}});
radButtonISO_DSF.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonISO_DSF();}}});
radButtonISO_DSDIFF.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonISO_DSDIFF();}}});
radButtonNone.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JRadioButton s = (JRadioButton) e.getSource(); if(s.isSelected()){guiControl.radButtonNone();}}});
// Process panel
panelProcess.setLayout(boxLayoutProcess);
panelProcess.add(radButtonDSF);
panelProcess.add(radButtonDSDIFF);
panelProcess.add(radButtonDSDIFFEM);
panelProcess.add(radButtonISO);
panelProcess.add(radButtonISO_DSF);
panelProcess.add(radButtonISO_DSDIFF);
panelProcess.add(radButtonNone);
panelProcess.setAlignmentY(Component.TOP_ALIGNMENT);
this.add(panelProcess);
// Areas panel
panelAreas.setLayout(boxLayoutAreas);
panelAreas.add(checkBoxStereo);
panelAreas.add(checkBoxMulti);
panelAreas.setAlignmentY(Component.TOP_ALIGNMENT);
checkBoxStereo.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JCheckBox checkBox = (JCheckBox) e.getSource();
CheckBoxState s = new CheckBoxState(checkBox.isSelected(), checkBox.isEnabled());
guiControl.checkBoxStereo(s);
}
}
);
checkBoxMulti.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JCheckBox checkBox = (JCheckBox) e.getSource();
CheckBoxState s = new CheckBoxState(checkBox.isSelected(), checkBox.isEnabled());
guiControl.checkBoxMulti(s);
}
}
);
this.add(panelAreas);
// Options panel
panelOptions.setLayout(boxLayoutOptions);
panelOptions.add(checkBoxDecompress);
panelOptions.add(checkBoxSelectTracks);
textFieldTracks.setMaximumSize(new Dimension(Integer.MAX_VALUE, textFieldTracks.getPreferredSize().height));
textFieldTracks.setEnabled(false);
panelOptions.add(textFieldTracks);
panelOptions.add(checkBoxNoPad);
panelOptions.add(checkBoxCue);
panelOptions.add(checkBoxPrint);
panelOptions.setAlignmentY(Component.TOP_ALIGNMENT);
checkBoxSelectTracks.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JCheckBox checkBox = (JCheckBox) e.getSource();
CheckBoxState s = new CheckBoxState(checkBox.isSelected(), checkBox.isEnabled());
guiControl.checkBoxSelectTracks(s);
}
}
);
checkBoxNoPad.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JCheckBox checkBox = (JCheckBox) e.getSource();
CheckBoxState s = new CheckBoxState(checkBox.isSelected(), checkBox.isEnabled());
guiControl.checkBoxNoPad(s);
}
}
);
checkBoxCue.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JCheckBox checkBox = (JCheckBox) e.getSource();
CheckBoxState s = new CheckBoxState(checkBox.isSelected(), checkBox.isEnabled());
guiControl.checkBoxCue(s);
}
}
);
checkBoxPrint.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JCheckBox checkBox = (JCheckBox) e.getSource();
CheckBoxState s = new CheckBoxState(checkBox.isSelected(), checkBox.isEnabled());
guiControl.checkBoxPrint(s);
}
}
);
this.add(panelOptions);
}
}