OSDN Git Service

faf7552d337d0e5b351b1fbe03151c7ee565664a
[coroid/inqubus.git] / frontend / src / saccubus / MainFrame.java
1 package saccubus;
2
3 import java.io.IOException;
4 import saccubus.converter.Converter;
5 import java.awt.BorderLayout;
6 import java.awt.Dimension;
7 import java.awt.GridBagConstraints;
8 import java.awt.GridBagLayout;
9 import java.awt.GridLayout;
10 import java.awt.Image;
11 import java.awt.Insets;
12 import java.awt.Toolkit;
13 import java.awt.dnd.DnDConstants;
14 import java.awt.dnd.DropTarget;
15 import java.awt.event.ActionEvent;
16 import java.awt.event.ActionListener;
17 import java.awt.event.KeyEvent;
18 import java.awt.event.WindowAdapter;
19 import java.awt.event.WindowEvent;
20 import java.io.File;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import javax.swing.BorderFactory;
24 import javax.swing.ButtonGroup;
25 import javax.swing.GroupLayout;
26 import javax.swing.JButton;
27 import javax.swing.JCheckBox;
28 import javax.swing.JComboBox;
29 import javax.swing.JFileChooser;
30 import javax.swing.JFrame;
31 import javax.swing.JLabel;
32 import javax.swing.JMenu;
33 import javax.swing.JMenuBar;
34 import javax.swing.JMenuItem;
35 import javax.swing.JOptionPane;
36 import javax.swing.JPanel;
37 import javax.swing.JPasswordField;
38 import javax.swing.JRadioButton;
39 import javax.swing.JTabbedPane;
40 import javax.swing.JTextField;
41 import javax.swing.LayoutStyle.ComponentPlacement;
42 import javax.swing.SwingUtilities;
43 import nicobrowser.entity.NicoContent;
44 import nicobrowser.main.Main;
45 import org.apache.commons.lang.StringUtils;
46 import saccubus.ConvertStopFlag.State;
47 import saccubus.converter.profile.FfmpegOption;
48 import saccubus.converter.profile.NgSetting;
49 import saccubus.net.TextProgressListener;
50 import saccubus.properties.BasicSetting;
51 import saccubus.properties.ConvertSetting;
52 import saccubus.properties.InputCommentSetting;
53 import saccubus.properties.InputVideoSetting;
54 import saccubus.properties.SProperties;
55 import saccubus.properties.InputTcommentSetting;
56 import saccubus.properties.MovieSetting;
57 import saccubus.properties.OutputVideoSetting;
58 import saccubus.util.FileDropTarget;
59 import saccubus.util.PopupRightClick;
60 import yukihane.nicovideo.NicoDBFinder;
61
62 /**
63  * <p>
64  * タイトル: さきゅばす
65  * </p>
66  *
67  * <p>
68  * 説明: ニコニコ動画の動画をコメントつきで保存
69  * </p>
70  *
71  * <p>
72  * 著作権: Copyright (c) 2007 PSI
73  * </p>
74  *
75  * <p>
76  * 会社名:
77  * </p>
78  *
79  * @author 未入力
80  * @version 1.0
81  */
82 public class MainFrame extends JFrame {
83
84     private static final long serialVersionUID = 2564486741331062989L;
85     public static final String PRODUCT_NAME = "いんきゅばす";
86     public static final String VERSION = "1.7.1 (NicoBrowser" + Main.VERSION + ")";
87     public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
88             "icon32.png"));
89     // TODO GUIが無いためフィールドに保持.
90     private File tempDir;
91     JPanel contentPane;
92     BorderLayout borderLayout1 = new BorderLayout();
93     JMenuBar jMenuBar1 = new JMenuBar();
94     JMenu jMenuFile = new JMenu();
95     JMenuItem jMenuFileExit = new JMenuItem();
96     JMenu jMenuHelp = new JMenu();
97     JMenuItem jMenuHelpAbout = new JMenuItem();
98     JLabel statusBar = new JLabel();
99     JTabbedPane mainTabbedPane = new JTabbedPane();
100     JPanel SavingInfoTabPanel = new JPanel();
101     JPanel FFMpegTabPanel = new JPanel();
102     // メインウィンドウ
103     private JPanel videoInfoPanel = new JPanel();
104     private JPanel opPanel = new JPanel();
105     private JLabel videoIdLabel = new JLabel();
106     private JTextField videoIdField = new JTextField();
107     private JLabel wayBackLabel = new JLabel();
108     private JTextField wayBackField = new JTextField();
109     JButton DoButton = new JButton();
110     public static final String DoButtonDefString = "変換";
111     public static final String DoButtonStopString = "停止";
112     public static final String DoButtonWaitString = "待機";
113     JPanel UserInfoPanel = new JPanel();
114     GridBagLayout gridBagLayout3 = new GridBagLayout();
115     // ユーザ設定
116     JLabel mailAddressLabel = new JLabel();
117     JTextField mailAddressField = new JTextField();
118     JLabel passwordLabel = new JLabel();
119     JPasswordField passwordField = new JPasswordField();
120     GridBagLayout gridBagLayout4 = new GridBagLayout();
121     GridBagLayout gridBagLayout6 = new GridBagLayout();
122     ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
123     ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
124
125     private class FfmpegOptionCheckBoxListener implements ActionListener{
126
127         @Override
128         public void actionPerformed(ActionEvent e) {
129             setFFMpegOptionCheckbox();
130         }
131     }
132     private final FfmpegOptionCheckBoxListener ffmpegOptionCheckBoxListener = new FfmpegOptionCheckBoxListener();
133
134     private void setFFMpegOptionCheckbox() {
135         boolean resizable = (resizeCheckBox.isEnabled() && resizeCheckBox.isSelected());
136         resizeWidthField.setEnabled(resizable);
137         resizeHeigitField.setEnabled(resizable);
138         adjustRatioCheckBox.setEnabled(resizable);
139
140     }
141
142     private void setNames() {
143         mainTabbedPane.setName("mainTabbedPane");
144
145         mailAddressField.setName("mailAddressField");
146         passwordField.setName("passwordField");
147
148         ffmpegPathField.setName("ffmpegPathField");
149         vhookPathField.setName("vhookPathField");
150
151         mainOptionField.setName("mainOptionField");
152         inputOptionField.setName("inputOptionField");
153         outputOptionField.setName("outputOptionField");
154
155         fontPathField.setName("fontPathField");
156         fontIndexField.setName("fontIndexField");
157         showConvVideoCheckBox.setName("showConvVideoCheckBox");
158     }
159
160     public MainFrame() {
161         setNames();
162
163         videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel();
164
165         try {
166             setDefaultCloseOperation(EXIT_ON_CLOSE);
167             jbInit();
168             setPopup();
169             setDropTarget();
170             SProperties setting = SProperties.loadSetting(null,
171                     null);
172             this.setSetting(setting);
173         } catch (Exception exception) {
174             exception.printStackTrace();
175         }
176     }
177
178     /**
179      * コンポーネントの初期化。
180      *
181      * @throws java.lang.Exception
182      */
183     private void jbInit() throws Exception {
184         GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
185                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
186         gridBagConstraints74.gridwidth = 2;
187         GridBagConstraints gridBagConstraints73 = new GridBagConstraints();
188         gridBagConstraints73.fill = GridBagConstraints.HORIZONTAL;
189         gridBagConstraints73.gridy = 6;
190         gridBagConstraints73.weightx = 1.0;
191         gridBagConstraints73.gridwidth = 4;
192         gridBagConstraints73.insets = new Insets(0, 0, 0, 5);
193         gridBagConstraints73.gridx = 1;
194         GridBagConstraints gridBagConstraints72 = new GridBagConstraints();
195         gridBagConstraints72.gridx = 0;
196         gridBagConstraints72.anchor = GridBagConstraints.WEST;
197         gridBagConstraints72.insets = new Insets(0, 5, 0, 5);
198         gridBagConstraints72.fill = GridBagConstraints.NONE;
199         gridBagConstraints72.gridwidth = 1;
200         gridBagConstraints72.gridy = 6;
201         ShadowKindLabel = new JLabel();
202         ShadowKindLabel.setText("影の種類");
203         ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
204         GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
205                 GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6);
206         gridBagConstraints71.fill = GridBagConstraints.BOTH;
207         gridBagConstraints71.ipady = 0;
208         GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
209         gridBagConstraints66.gridx = 0;
210         gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
211         gridBagConstraints66.anchor = GridBagConstraints.WEST;
212         gridBagConstraints66.gridwidth = 2;
213         gridBagConstraints66.gridy = 1;
214         ViewCommentLabel = new JLabel();
215         ViewCommentLabel.setText("表示コメント数");
216         GridBagConstraints gridBagConstraints65 = new GridBagConstraints();
217         gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL;
218         gridBagConstraints65.gridy = 1;
219         gridBagConstraints65.weightx = 1.0;
220         gridBagConstraints65.gridwidth = 6;
221         gridBagConstraints65.insets = new Insets(0, 5, 5, 5);
222         gridBagConstraints65.gridx = 3;
223         GridBagConstraints gridBagConstraints64 = new GridBagConstraints(1, 1,
224                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
225                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
226         gridBagConstraints64.gridy = 3;
227         gridBagConstraints64.fill = GridBagConstraints.HORIZONTAL;
228         gridBagConstraints64.gridx = 4;
229         GridBagConstraints gridBagConstraints63 = new GridBagConstraints(0, 4,
230                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
231                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
232         gridBagConstraints63.gridy = 7;
233         gridBagConstraints63.gridx = 0;
234         gridBagConstraints63.gridwidth = 5;
235         GridBagConstraints gridBagConstraints62 = new GridBagConstraints(0, 3,
236                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
237                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
238         gridBagConstraints62.gridy = 5;
239         gridBagConstraints62.gridx = 1;
240         gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
241         gridBagConstraints62.insets = new Insets(0, 0, 5, 5);
242         gridBagConstraints62.gridwidth = 4;
243         GridBagConstraints gridBagConstraints61 = new GridBagConstraints(0, 2,
244                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
245                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
246         gridBagConstraints61.gridy = 5;
247         gridBagConstraints61.gridx = 0;
248         gridBagConstraints61.fill = GridBagConstraints.VERTICAL;
249         gridBagConstraints61.anchor = GridBagConstraints.WEST;
250         gridBagConstraints61.gridwidth = 1;
251         GridBagConstraints gridBagConstraints60 = new GridBagConstraints(0, 1,
252                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
253                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0);
254         gridBagConstraints60.gridy = 3;
255         gridBagConstraints60.gridx = 1;
256         gridBagConstraints60.fill = GridBagConstraints.HORIZONTAL;
257         gridBagConstraints60.insets = new Insets(0, 0, 0, 5);
258         gridBagConstraints60.gridwidth = 3;
259         GridBagConstraints gridBagConstraints59 = new GridBagConstraints(0, 0,
260                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
261                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);
262         gridBagConstraints59.gridy = 3;
263         gridBagConstraints59.insets = new Insets(5, 5, 5, 5);
264         gridBagConstraints59.gridx = 0;
265         gridBagConstraints59.fill = GridBagConstraints.NONE;
266         gridBagConstraints59.anchor = GridBagConstraints.WEST;
267         gridBagConstraints59.weightx = 0.0;
268         gridBagConstraints59.gridwidth = 1;
269         GridBagConstraints gridBagConstraints58 = new GridBagConstraints();
270         gridBagConstraints58.gridx = 0;
271         gridBagConstraints58.anchor = GridBagConstraints.WEST;
272         gridBagConstraints58.insets = new Insets(0, 5, 5, 5);
273         gridBagConstraints58.gridwidth = 5;
274         gridBagConstraints58.weightx = 1.0;
275         gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
276         gridBagConstraints58.gridy = 0;
277
278         GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
279                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
280         gridBagConstraints54.gridwidth = 3;
281
282         GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
283         gridBagConstraints33.gridx = 0;
284         gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
285         gridBagConstraints33.weightx = 1.0;
286         gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
287         gridBagConstraints33.gridwidth = 5;
288         gridBagConstraints33.gridy = 9;
289
290         GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
291         gridBagConstraints14.gridx = 0;
292         gridBagConstraints14.anchor = GridBagConstraints.WEST;
293         gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
294         gridBagConstraints14.weightx = 1.0;
295         gridBagConstraints14.gridwidth = 5;
296         gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
297         gridBagConstraints14.gridy = 8;
298         GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
299                 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
300                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
301         gridBagConstraints7.weighty = 0.0;
302         GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
303         gridBagConstraints6.gridx = 0;
304         gridBagConstraints6.weighty = 1.0;
305         gridBagConstraints6.weightx = 1.0;
306         gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
307         gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
308         gridBagConstraints6.anchor = GridBagConstraints.NORTH;
309         gridBagConstraints6.gridy = 1;
310         GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
311                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
312                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
313         gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
314         gridBagConstraints1.anchor = GridBagConstraints.NORTH;
315         gridBagConstraints1.weighty = 1.0;
316
317         this.setIconImage(WinIcon);
318         contentPane = (JPanel) this.getContentPane();
319         contentPane.setLayout(borderLayout1);
320         setSize(new Dimension(400, 450));
321         setTitle(PRODUCT_NAME + " " + VERSION);
322         this.addWindowListener(new MainFrame_this_windowAdapter(this));
323         statusBar.setText(" ");
324         jMenuFile.setText("ファイル");
325         jMenuFileExit.setText("終了");
326         jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
327                 this));
328         jMenuHelp.setText("ヘルプ");
329         jMenuHelpAbout.setText("バージョン情報");
330         jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
331                 this));
332         videoInfoPanel.setLayout(gridBagLayout1);
333         SavingInfoTabPanel.setLayout(new GridLayout());
334         UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
335         UserInfoPanel.setLayout(gridBagLayout3);
336         mailAddressLabel.setText("メールアドレス");
337         passwordLabel.setText("パスワード");
338
339         setListenerToSavePanelButton();
340
341         FFMpegTabPanel.setLayout(gridBagLayout6);
342         PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
343                 BorderFactory.createEtchedBorder(), "プログラムの位置の設定"));
344         PathSettingPanel.setLayout(gridBagLayout7);
345         FFmpegPathLabel.setText("FFmpeg");
346         SettingFFmpegPathButton.setText("参照");
347         SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
348                 this));
349         VhookPathLabel.setText("拡張vhookライブラリ");
350         SettingVhookPathButton.setText("参照");
351         SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
352                 this));
353         VhookSettingPanel.setLayout(gridBagLayout8);
354         VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
355                 BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定"));
356         FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
357                 BorderFactory.createEtchedBorder(), "FFmpegの設定"));
358         FFmpegSettingPanel.setLayout(gblFFmpegSettingPanel);
359         FontPathLabel.setText("フォントパス");
360         SettingFontPathButton.setText("参照");
361         SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
362                 this));
363         showConvVideoCheckBox.setText("変換中の画像を表示する");
364
365         extOptionLabel.setText("出力動画の拡張子");
366         inputOptionLabel.setText("入力オプション");
367         outputOptionLabel.setText("出力オプション");
368         mainOptionLabel.setText("メインオプション");
369         avfilterOptionLabel.setText("avfilterオプション");
370
371         FontIndexLabel.setText("フォント番号");
372
373         BasicInfoTabPanel.setLayout(gridBagLayout12);
374         jMenuBar1.add(jMenuFile);
375         jMenuFile.add(jMenuFileExit);
376         jMenuBar1.add(jMenuHelp);
377         jMenuHelp.add(jMenuHelpAbout);
378         setJMenuBar(jMenuBar1);
379
380         contentPane.add(statusBar, BorderLayout.SOUTH);
381         contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER);
382         contentPane.add(videoInfoPanel, java.awt.BorderLayout.NORTH);
383         UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1,
384                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
385                 new Insets(0, 5, 5, 5), 0, 0));
386         UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1,
387                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
388                 new Insets(0, 5, 5, 5), 0, 0));
389         UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1,
390                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
391                 new Insets(0, 5, 5, 0), 0, 0));
392         UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1,
393                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
394                 new Insets(0, 5, 5, 0), 0, 0));
395         PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1,
396                 1, 1.0, 0.0, GridBagConstraints.CENTER,
397                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
398         PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
399         PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
400                 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
401                 new Insets(0, 5, 5, 5), 0, 0));
402         PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1,
403                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
404                 new Insets(0, 5, 5, 5), 0, 0));
405         PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
406                 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
407                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
408         PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
409
410
411         final GroupLayout layout = new GroupLayout(FFmpegSettingPanel);
412         FFmpegSettingPanel.setLayout(layout);
413
414         layout.setHorizontalGroup(layout.createParallelGroup()
415                 .addComponent(getFFmpegOptionComboBoxPanel())
416                 .addGroup(layout.createSequentialGroup()
417                     .addGroup(layout.createParallelGroup()
418                         .addComponent(extOptionLabel)
419                         .addComponent(mainOptionLabel)
420                         .addComponent(inputOptionLabel)
421                         .addComponent(outputOptionLabel)
422                         .addComponent(avfilterOptionLabel)
423                     )
424                     .addPreferredGap(ComponentPlacement.RELATED)
425                     .addGroup(layout.createParallelGroup()
426                         .addComponent(extOptionField)
427                         .addComponent(mainOptionField)
428                         .addComponent(inputOptionField)
429                         .addComponent(outputOptionField)
430                         .addComponent(avfilterOptionField)
431                     )
432                 )
433                 .addGroup(layout.createParallelGroup()
434                     .addGroup(layout.createSequentialGroup()
435                         .addComponent(resizeCheckBox)
436                         .addPreferredGap(ComponentPlacement.UNRELATED)
437                         .addComponent(resizeWidthLabel)
438                         .addPreferredGap(ComponentPlacement.RELATED)
439                         .addComponent(resizeWidthField)
440                         .addPreferredGap(ComponentPlacement.UNRELATED)
441                         .addComponent(resizeHeightLabel)
442                         .addPreferredGap(ComponentPlacement.RELATED)
443                         .addComponent(resizeHeigitField)
444                     )
445                 )
446                 .addGroup(layout.createSequentialGroup()
447                     .addGap(10)
448                     .addComponent(adjustRatioCheckBox))
449                 .addGroup(layout.createSequentialGroup()
450                     .addGap(20)
451                 )
452             );
453
454         layout.setVerticalGroup(layout.createSequentialGroup()
455             .addComponent(getFFmpegOptionComboBoxPanel())
456             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
457                 .addComponent(extOptionLabel)
458                 .addComponent(extOptionField))
459             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
460                 .addComponent(mainOptionLabel)
461                 .addComponent(mainOptionField))
462             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
463                 .addComponent(inputOptionLabel)
464                 .addComponent(inputOptionField))
465             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
466                 .addComponent(outputOptionLabel)
467                 .addComponent(outputOptionField))
468             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
469                 .addComponent(avfilterOptionLabel)
470                 .addComponent(avfilterOptionField))
471             .addGroup(layout.createSequentialGroup()
472                 .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
473                     .addComponent(resizeCheckBox)
474                     .addComponent(resizeWidthLabel)
475                     .addComponent(resizeWidthField)
476                     .addComponent(resizeHeightLabel)
477                     .addComponent(resizeHeigitField))
478                 .addComponent(adjustRatioCheckBox)
479                 )
480             );
481
482         resizeCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
483         adjustRatioCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
484         setFFMpegOptionCheckbox();
485
486
487         videoInfoPanel.add(DoButton, gridBagConstraints71);
488
489         videoIdLabel.setText("URL/ID");
490         wayBackLabel.setText("過去ログ");
491         videoIdField.setText("http://www.nicovideo.jp/watch/");
492         DoButton.setText(DoButtonDefString);
493         DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
494
495         final GroupLayout oppLayout = new GroupLayout(opPanel);
496         opPanel.setLayout(oppLayout);
497
498         oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup()
499                 .addGroup(oppLayout.createParallelGroup()
500                     .addComponent(videoIdLabel)
501                     .addComponent(wayBackLabel))
502                 .addGroup(oppLayout.createParallelGroup()
503                     .addComponent(videoIdField)
504                     .addGroup(oppLayout.createSequentialGroup()
505                         .addComponent(wayBackField)))
506                 );
507
508         oppLayout.setVerticalGroup(oppLayout.createSequentialGroup()
509                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
510                         .addComponent(videoIdLabel)
511                         .addComponent(videoIdField))
512                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
513                         .addComponent(wayBackLabel)
514                         .addComponent(wayBackField))
515                 );
516
517
518         videoInfoPanel.add(opPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
519                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
520                 new Insets(0, 0, 0, 0), 0, 0));
521
522         mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
523         mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
524         mainTabbedPane.add(FFMpegTabPanel, "動画設定");
525         mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
526         SavingInfoTabPanel.add(savePanel);
527         BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
528         BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
529         VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
530         VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
531         VhookSettingPanel.add(fontPathField, gridBagConstraints60);
532         VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
533         VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
534         VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
535         VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
536         VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
537         VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
538         VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
539         VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
540         VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
541         VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
542
543         FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
544                 1.0, 0.0, GridBagConstraints.NORTHEAST,
545                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
546         FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
547     }
548
549     /**
550      * 保存設定パネル内のボタンにアクションリスナを割り当てる.
551      */
552     private void setListenerToSavePanelButton() {
553         ActionListener al;
554         al = new InputVideoPanelButtonListener();
555         videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
556         videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
557         videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
558
559         al = new VideoUseRadioButtonListener();
560         videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
561         videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
562         videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
563
564         al = new InputCommentPanelButtonListener();
565         savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
566         savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
567
568         al = new OutputVideoPanelButtonListener();
569         savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
570         savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
571     }
572
573     private void setPopup() {
574         mainOptionField.addMouseListener(new PopupRightClick(
575                 this.mainOptionField));
576         inputOptionField.addMouseListener(new PopupRightClick(
577                 this.inputOptionField));
578         outputOptionField.addMouseListener(new PopupRightClick(
579                 this.outputOptionField));
580         savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
581                 savePanel.getCommentNumField()));
582
583         savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
584                 savePanel.getCommentSavedFileField()));
585         savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
586                 savePanel.getCommentSavedFolderField()));
587
588         savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
589                 savePanel.getConvertedVideoSavedFileField()));
590         savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
591                 savePanel.getConvertedVideoSavedFolderField()));
592
593         videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
594                 videoSaveInfoPanel.getVideoSavedFileField()));
595         videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
596                 videoSaveInfoPanel.getVideoSavedFolderField()));
597         videoSaveInfoPanel.getNibrFileField().addMouseListener(
598                 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
599
600         ffmpegPathField.addMouseListener(new PopupRightClick(
601                 this.ffmpegPathField));
602         vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
603         videoIdField.addMouseListener(new PopupRightClick(
604                 this.videoIdField));
605         viewCommentField.addMouseListener(new PopupRightClick(
606                 this.viewCommentField));
607         fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
608         mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
609         passwordField.addMouseListener(new PopupRightClick(this.passwordField));
610         wayBackField.addMouseListener(new PopupRightClick(this.wayBackField));
611
612         proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
613         proxyPortTextField.addMouseListener(new PopupRightClick(
614                 this.proxyPortTextField));
615
616         fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
617
618         ngWordTextField.addMouseListener(new PopupRightClick(
619                 this.ngWordTextField));
620         ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
621     }
622
623     private void setDropTarget() {
624         addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
625         addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
626         addTarget(videoSaveInfoPanel.getNibrFileField(), false);
627
628         addTarget(savePanel.getCommentSavedFileField(), false);
629         addTarget(savePanel.getCommentSavedFolderField(), true);
630
631         addTarget(savePanel.getConvertedVideoSavedFileField(), false);
632         addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
633
634         addTarget(ffmpegPathField, false);
635         addTarget(vhookPathField, false);
636         addTarget(fontPathField, false);
637
638     }
639
640     /**
641      * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
642      * @param c 設定対象のテキストフィールドオブジェクト.
643      * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
644      * @return ドロップターゲット(用途無し).
645      */
646     private DropTarget addTarget(JTextField c, boolean isDir) {
647         return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
648                 c, isDir), true);
649     }
650     private File CurrentDir = new File(".");
651     private JPanel PathSettingPanel = new JPanel();
652     private JLabel FFmpegPathLabel = new JLabel();
653     private GridBagLayout gridBagLayout7 = new GridBagLayout();
654     private JTextField ffmpegPathField = new JTextField();
655     private JButton SettingFFmpegPathButton = new JButton();
656     private JLabel VhookPathLabel = new JLabel();
657     private JTextField vhookPathField = new JTextField();
658     private JButton SettingVhookPathButton = new JButton();
659     private JPanel VhookSettingPanel = new JPanel();
660     private GridBagLayout gridBagLayout8 = new GridBagLayout();
661     private JPanel FFmpegSettingPanel = new JPanel();
662     private GridBagLayout gblFFmpegSettingPanel = new GridBagLayout();
663     private JLabel FontPathLabel = new JLabel();
664     private JTextField fontPathField = new JTextField();
665     private JButton SettingFontPathButton = new JButton();
666     private JCheckBox showConvVideoCheckBox = new JCheckBox();
667
668     private void showSaveDialog(String title, JTextField field, boolean isSave,
669             boolean isDir) {
670         JFileChooser chooser = new JFileChooser(CurrentDir);
671         chooser.setDialogTitle(title);
672         int code = 0;
673         if (isDir) {
674             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
675         }
676         if (isSave) {
677             code = chooser.showSaveDialog(this);
678         } else {
679             code = chooser.showOpenDialog(this);
680         }
681         if (code == JFileChooser.APPROVE_OPTION) {
682             if (isDir) {
683                 CurrentDir = chooser.getSelectedFile();
684                 field.setText(CurrentDir.getAbsolutePath());
685             } else {
686                 File selected = chooser.getSelectedFile();
687                 CurrentDir = chooser.getCurrentDirectory();
688                 field.setText(selected.getAbsolutePath());
689             }
690         }
691     }
692
693     private SProperties getSetting() {
694         SProperties setting = new SProperties(
695                 getBasicSetting(),
696                 getInputVideoSetting(),
697                 getInputCommentSetting(),
698                 getTcommentSetting(),
699                 getOutputVideoSetting(),
700                 getMovieSetting(),
701                 getConvertSetting());
702         return setting;
703     }
704
705     /**
706      * 設定を画面に反映する.
707      * @param setting 反映する設定.
708      */
709     private void setSetting(SProperties setting) {
710         // 基本設定
711         final BasicSetting basic = setting.getBasicSetting();
712         tempDir = basic.getTempDir();
713         mailAddressField.setText(basic.getUser().getMail());
714         passwordField.setText(basic.getUser().getPassword());
715         // プロキシ関連
716         useProxyCheckBox.setSelected(basic.isProxyUse());
717         proxyTextField.setText(basic.getProxyHost());
718         int proxy_port = basic.getProxyPort();
719         if (proxy_port >= 0 && proxy_port <= 65535) {
720             proxyPortTextField.setText(Integer.toString(proxy_port));
721         } else {
722             proxyPortTextField.setText("");
723         }
724
725         // 保存設定 - 入力動画
726         final InputVideoSetting inVideo = setting.getInputVideoSetting();
727         JRadioButton activeButton;
728         switch (inVideo.getProcessKind()) {
729             case NO_SAVE:
730                 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
731                 break;
732             case NICOBROWSER:
733                 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
734                 break;
735             case SAVE:
736             default:
737                 activeButton = videoSaveInfoPanel.getVideoSaveButton();
738                 break;
739         }
740         activeButton.doClick();
741
742         videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
743         videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
744         videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
745         final boolean videoFixName = inVideo.isAutoNaming();
746         videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
747         videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
748         videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
749
750         // 保存設定 - 入力コメント
751         final InputCommentSetting inputComment = setting.getInputCommentSetting();
752         savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
753         savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
754         savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
755         savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
756         savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
757         savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
758         boolean commentFixName = inputComment.isAutoNaming();
759         savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
760         savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
761
762         // 投稿者コメント
763         InputTcommentSetting tcom = setting.getInputTcommentSetting();
764         savePanel.setTcommentDownload(tcom.getProcessKind());
765         savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
766         savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
767         savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
768         savePanel.setTcommentFileName(tcom.getFile().getPath());
769
770         // 保存設定 - 出力コメント付き動画
771         final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
772         savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
773         savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
774         savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
775         savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
776         savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
777         savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
778         boolean convFixName = outputVideo.isAutoNaming();
779         savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
780         savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
781
782         // 動画設定
783         final MovieSetting movie = setting.getMovieSetting();
784         ffmpegPathField.setText(movie.getFfmpeg().toString());
785         vhookPathField.setText(movie.getVhook().toString());
786         extOptionField.setText(movie.getFfmpegOption().getExtOption());
787         mainOptionField.setText(movie.getFfmpegOption().getMainOption());
788         inputOptionField.setText(movie.getFfmpegOption().getInOption());
789         outputOptionField.setText(movie.getFfmpegOption().getOutOption());
790         avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption());
791         resizeCheckBox.setSelected(movie.getFfmpegOption().isResize());
792         resizeWidthField.setText(Integer.toString(movie.getFfmpegOption().getResizeWidth()));
793         resizeHeigitField.setText(Integer.toString(movie.getFfmpegOption().getResizeHeight()));
794         adjustRatioCheckBox.setSelected(movie.getFfmpegOption().isAdjustRatio());
795         FFmpegOptionModel.reload(movie.getOptionFile());
796
797         // 変換設定
798         final ConvertSetting conv = setting.getConvertSetting();
799         disableVhookCheckBox.setSelected(conv.isVhookDisabled());
800         viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
801         fontPathField.setText(conv.getFont().toString());
802         fontIndexField.setText(Integer.toString(conv.getFontIndex()));
803         shadowComboBox.setSelectedIndex(conv.getShadowIndex());
804         showConvVideoCheckBox.setSelected(conv.isShowConverting());
805         fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
806         opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
807         ngWordTextField.setText(conv.getNgSetting().getWord());
808         ngIdTextField.setText(conv.getNgSetting().getId());
809     }
810
811     /**
812      * [ファイル|終了] アクションが実行されました。
813      *
814      * @param actionEvent
815      *            ActionEvent
816      */
817     void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
818         try {
819             SProperties setting = getSetting();
820             SProperties.saveSetting(setting);
821         } catch (Throwable t) {
822             Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "設定保存に失敗", t);
823         }
824         System.exit(0);
825     }
826
827     /**
828      * [ヘルプ|バージョン情報] アクションが実行されました。
829      *
830      * @param actionEvent
831      *            ActionEvent
832      */
833     void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
834         MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
835         dlg.pack();
836         dlg.setLocationRelativeTo(this);
837         dlg.setVisible(true);
838     }
839
840     /* 変換・保存する */
841     private Converter Converter = null;
842     // FFmpegの設定 ここから
843     private final JLabel extOptionLabel = new JLabel();
844     private final JTextField extOptionField = new JTextField();
845     private JLabel mainOptionLabel = new JLabel();
846     private JTextField mainOptionField = new JTextField();
847     private JLabel inputOptionLabel = new JLabel();
848     private JTextField inputOptionField = new JTextField();
849     private JLabel outputOptionLabel = new JLabel();
850     private JTextField outputOptionField = new JTextField();
851     private final JLabel avfilterOptionLabel = new JLabel();
852     private final JTextField avfilterOptionField = new JTextField();
853     private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるよう縮小(-s)");
854     private final JLabel resizeWidthLabel = new JLabel("横");
855     private final JTextField resizeWidthField = new NumberFormattedTextField();
856     private final JLabel resizeHeightLabel = new JLabel("縦");
857     private final JTextField resizeHeigitField = new NumberFormattedTextField();
858     private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
859     // FFmpegの設定 ここまで
860     private JLabel FontIndexLabel = new JLabel();
861     private JTextField fontIndexField = new JTextField();
862     private GridBagLayout gridBagLayout1 = new GridBagLayout();
863     private JPanel BasicInfoTabPanel = new JPanel();
864     private GridBagLayout gridBagLayout12 = new GridBagLayout();
865     private JPanel ConvertingSettingPanel = null;
866     private JPanel NGWordSettingPanel = null;
867     private JLabel NGWordLabel = null;
868     private JTextField ngWordTextField = null;
869     private JLabel NGIDLabel = null;
870     private JTextField ngIdTextField = null;
871     // プロキシ設定
872     private JPanel ProxyInfoPanel = null;
873     private JCheckBox useProxyCheckBox = null;
874     private JLabel proxyLabel = null;
875     private JTextField proxyTextField = null;
876     private JLabel proxyPortLabel = null;
877     private JTextField proxyPortTextField = null;
878     //
879     private JCheckBox fixFontSizeCheckBox = null;
880     private JCheckBox opaqueCommentCheckBox = null;
881     private final SavePanel savePanel = new SavePanel();
882     private final VideoSaveInfoPanel videoSaveInfoPanel;
883     private JComboBox FFmpegOptionComboBox = null;
884     private JButton FFmpegOptionReloadButton = null;
885     private JPanel FFmpegOptionComboBoxPanel = null;
886
887     public void DoButton_actionPerformed(ActionEvent e) {
888         if (Converter == null || Converter.isConverted()) {
889             try {
890                 executeConvert();
891             } catch (Exception ex) {
892                 String text = ex.getMessage();
893                 if (StringUtils.isEmpty(text)) {
894                     text = "予期しないエラーのため中断しました。";
895                 }
896                 ex.printStackTrace();
897                 statusBar.setText(text);
898             }
899         } else { /* 開始しているので、ストップする。 */
900             final ConvertStopFlag flag = Converter.getStopFlag();
901             if (!flag.needStop()) { /* まだストップしていない。 */
902                 flag.requestStop();
903             }
904         }
905     }
906
907     private void executeConvert() throws IOException {
908         String url;
909
910         // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
911         if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
912             try {
913                 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
914                 NicoDBFinder finder = NicoDBFinder.getInstance();
915                 NicoContent info = finder.findNicoContent(fileName);
916                 if (info != null) {
917                     url = info.getNicoId();
918                 } else {
919                     url = "";
920                 }
921             } catch (Exception ex) {
922                 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
923                 return;
924             }
925         } else {
926             url = videoIdField.getText();
927         }
928
929         TextProgressListener sl = new TextProgressListener() {
930
931             public void setText(final String text) {
932                 SwingUtilities.invokeLater(new Runnable() {
933
934                     public void run() {
935                         statusBar.setText(text);
936                     }
937                 });
938             }
939         };
940
941         ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
942
943             public void changeState(final State s) {
944                 SwingUtilities.invokeLater(new Runnable() {
945
946                     public void run() {
947                         switch (s) {
948                             case STOPPING:
949                                 DoButton.setText(DoButtonWaitString);
950                                 break;
951                             case FINISHED:
952                                 DoButton.setText(DoButtonDefString);
953                         }
954                     }
955                 });
956             }
957         };
958
959         Converter = new Converter(url, wayBackField.getText(), getSetting().toProfile(), sl,
960                 new ConvertStopFlag(scl));
961         DoButton.setText(DoButtonStopString);
962         new Thread(Converter).start();
963
964     }
965
966     /* FFmpegへのパス */
967     public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
968         showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
969     }
970
971     public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
972         showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
973     }
974
975     public void SettingFontPathButton_actionPerformed(ActionEvent e) {
976         showSaveDialog("フォントへのパス", fontPathField, false, false);
977     }
978
979     public void this_windowClosing(WindowEvent e) {
980         this.jMenuFileExit_actionPerformed(null);
981     }
982
983     /**
984      * This method initializes ConvertingSettingPanel
985      *
986      * @return javax.swing.JPanel
987      */
988     private JPanel getConvertingSettingPanel() {
989         if (ConvertingSettingPanel == null) {
990             GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
991             gridBagConstraints11.weighty = 1.0;
992             gridBagConstraints11.weightx = 1.0;
993             gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
994             gridBagConstraints11.gridy = 1;
995             gridBagConstraints11.gridx = 0;
996             gridBagConstraints11.anchor = GridBagConstraints.NORTH;
997             gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
998             GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
999                     2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
1000                     GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
1001             gridBagConstraints.gridx = 0;
1002             gridBagConstraints.anchor = GridBagConstraints.CENTER;
1003             gridBagConstraints.weighty = 0.0;
1004             gridBagConstraints.gridy = 0;
1005             ConvertingSettingPanel = new JPanel();
1006             ConvertingSettingPanel.setLayout(new GridBagLayout());
1007             ConvertingSettingPanel.add(getNGWordSettingPanel(),
1008                     gridBagConstraints11);
1009             ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
1010         }
1011         return ConvertingSettingPanel;
1012     }
1013
1014     /**
1015      * This method initializes NGWordSettingPanel
1016      *
1017      * @return javax.swing.JPanel
1018      */
1019     private JPanel getNGWordSettingPanel() {
1020         if (NGWordSettingPanel == null) {
1021             GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
1022             gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
1023             gridBagConstraints5.gridy = 1;
1024             gridBagConstraints5.weightx = 1.0;
1025             gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
1026             gridBagConstraints5.gridx = 1;
1027             GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
1028             gridBagConstraints4.gridx = 0;
1029             gridBagConstraints4.anchor = GridBagConstraints.WEST;
1030             gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
1031             gridBagConstraints4.gridy = 1;
1032             NGIDLabel = new JLabel();
1033             NGIDLabel.setText("NG ID");
1034             GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
1035             gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
1036             gridBagConstraints3.gridy = 0;
1037             gridBagConstraints3.weightx = 1.0;
1038             gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
1039             gridBagConstraints3.gridx = 1;
1040             GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
1041             gridBagConstraints2.gridx = 0;
1042             gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
1043             gridBagConstraints2.gridy = 0;
1044             NGWordLabel = new JLabel();
1045             NGWordLabel.setText("NGワード");
1046             NGWordSettingPanel = new JPanel();
1047             NGWordSettingPanel.setLayout(new GridBagLayout());
1048             NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
1049                     "NGワード・ID設定(半角スペース区切りで複数入力)"));
1050             NGWordSettingPanel.add(NGWordLabel, gridBagConstraints2);
1051             NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
1052             NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
1053             NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
1054         }
1055         return NGWordSettingPanel;
1056     }
1057
1058     /**
1059      * This method initializes NGWordTextField
1060      *
1061      * @return javax.swing.JTextField
1062      */
1063     private JTextField getNGWordTextField() {
1064         if (ngWordTextField == null) {
1065             ngWordTextField = new JTextField();
1066             ngWordTextField.setName("ngWordTextField");
1067         }
1068         return ngWordTextField;
1069     }
1070
1071     /**
1072      * This method initializes NGIDTextField
1073      *
1074      * @return javax.swing.JTextField
1075      */
1076     private JTextField getNGIDTextField() {
1077         if (ngIdTextField == null) {
1078             ngIdTextField = new JTextField();
1079             ngIdTextField.setName("ngIdTextField");
1080         }
1081         return ngIdTextField;
1082     }
1083
1084     /**
1085      * This method initializes ProxyInfoPanel
1086      *
1087      * @return javax.swing.JPanel
1088      */
1089     private JPanel getProxyInfoPanel() {
1090         if (ProxyInfoPanel == null) {
1091             GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1092             gridBagConstraints13.gridx = 0;
1093             gridBagConstraints13.gridwidth = 2;
1094             gridBagConstraints13.weightx = 1.0;
1095             gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1096             gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1097             gridBagConstraints13.gridy = 0;
1098             GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1099             gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1100             gridBagConstraints12.gridy = 2;
1101             gridBagConstraints12.weightx = 1.0;
1102             gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1103             gridBagConstraints12.gridx = 1;
1104             GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1105             gridBagConstraints10.gridx = 0;
1106             gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1107             gridBagConstraints10.gridy = 2;
1108             proxyPortLabel = new JLabel();
1109             proxyPortLabel.setText("ポート番号");
1110             GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1111             gridBagConstraints9.fill = GridBagConstraints.BOTH;
1112             gridBagConstraints9.gridy = 1;
1113             gridBagConstraints9.weightx = 1.0;
1114             gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1115             gridBagConstraints9.gridx = 1;
1116             GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1117             gridBagConstraints8.gridx = 0;
1118             gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1119             gridBagConstraints8.fill = GridBagConstraints.NONE;
1120             gridBagConstraints8.anchor = GridBagConstraints.EAST;
1121             gridBagConstraints8.gridy = 1;
1122             proxyLabel = new JLabel();
1123             proxyLabel.setText("プロキシ");
1124             ProxyInfoPanel = new JPanel();
1125             ProxyInfoPanel.setLayout(new GridBagLayout());
1126             ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1127                     "プロキシ設定"));
1128             ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1129             ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1130             ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1131             ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1132             ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1133         }
1134         return ProxyInfoPanel;
1135     }
1136
1137     /**
1138      * This method initializes ProxyTextField
1139      *
1140      * @return javax.swing.JTextField
1141      */
1142     private JTextField getProxyTextField() {
1143         if (proxyTextField == null) {
1144             proxyTextField = new JTextField();
1145             proxyTextField.setName("proxyTextField");
1146         }
1147         return proxyTextField;
1148     }
1149
1150     /**
1151      * This method initializes ProxyPortTextField
1152      *
1153      * @return javax.swing.JTextField
1154      */
1155     private JTextField getProxyPortTextField() {
1156         if (proxyPortTextField == null) {
1157             proxyPortTextField = new JTextField();
1158             proxyPortTextField.setName("proxyPortTextField");
1159         }
1160         return proxyPortTextField;
1161     }
1162
1163     /**
1164      * This method initializes UseProxyCheckBox
1165      *
1166      * @return javax.swing.JCheckBox
1167      */
1168     private JCheckBox getUseProxyCheckBox() {
1169         if (useProxyCheckBox == null) {
1170             useProxyCheckBox = new JCheckBox();
1171             useProxyCheckBox.setText("プロキシを使う");
1172             useProxyCheckBox.setName("useProxyCheckBox");
1173         }
1174         return useProxyCheckBox;
1175     }
1176
1177     /**
1178      * This method initializes FixFontSizeCheckBox
1179      *
1180      * @return javax.swing.JCheckBox
1181      */
1182     private JCheckBox getFixFontSizeCheckBox() {
1183         if (fixFontSizeCheckBox == null) {
1184             fixFontSizeCheckBox = new JCheckBox();
1185             fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1186             fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1187         }
1188         return fixFontSizeCheckBox;
1189     }
1190
1191     /**
1192      * This method initializes OpaqueCommentCheckBox
1193      *
1194      * @return javax.swing.JCheckBox
1195      */
1196     private JCheckBox getOpaqueCommentCheckBox() {
1197         if (opaqueCommentCheckBox == null) {
1198             opaqueCommentCheckBox = new JCheckBox();
1199             opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1200             opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1201         }
1202         return opaqueCommentCheckBox;
1203     }
1204     /**
1205      * This method initializes FFmpegOptionComboBox
1206      *
1207      * @return javax.swing.JComboBox
1208      */
1209     private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1210     private JCheckBox disableVhookCheckBox = null;
1211     private JTextField viewCommentField = null;
1212     private JLabel ViewCommentLabel = null;
1213     private JLabel ShadowKindLabel = null;
1214     private JComboBox shadowComboBox = null;
1215
1216     private JComboBox getFFmpegOptionComboBox() {
1217         if (FFmpegOptionComboBox == null) {
1218             FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1219             FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1220
1221                 public void actionPerformed(java.awt.event.ActionEvent e) {
1222                     if (FFmpegOptionModel.isFile()) {// ファイル
1223                         setFFMpegOptionEnabled(false);
1224                     } else {// ファイルでない
1225                         setFFMpegOptionEnabled(true);
1226                         setFFMpegOptionCheckbox();
1227                     }
1228                 }
1229
1230                 private void setFFMpegOptionEnabled(boolean enable) {
1231                     extOptionField.setEnabled(enable);
1232                     mainOptionField.setEnabled(enable);
1233                     inputOptionField.setEnabled(enable);
1234                     outputOptionField.setEnabled(enable);
1235                     avfilterOptionField.setEnabled(enable);
1236                     resizeCheckBox.setEnabled(enable);
1237                     resizeWidthField.setEnabled(enable);
1238                     resizeHeigitField.setEditable(enable);
1239                     adjustRatioCheckBox.setEnabled(enable);
1240                 }
1241             });
1242         }
1243         return FFmpegOptionComboBox;
1244     }
1245
1246     /**
1247      * This method initializes FFmpegOptionReloadButton
1248      *
1249      * @return javax.swing.JButton
1250      */
1251     private JButton getFFmpegOptionReloadButton() {
1252         if (FFmpegOptionReloadButton == null) {
1253             FFmpegOptionReloadButton = new JButton();
1254             FFmpegOptionReloadButton.setText("更新");
1255             FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1256
1257                 public void actionPerformed(java.awt.event.ActionEvent e) {
1258                     FFmpegOptionModel.reload();
1259                 }
1260             });
1261         }
1262         return FFmpegOptionReloadButton;
1263     }
1264
1265     /**
1266      * This method initializes FFmpegOptionComboBoxPanel
1267      *
1268      * @return javax.swing.JPanel
1269      */
1270     private JPanel getFFmpegOptionComboBoxPanel() {
1271         if (FFmpegOptionComboBoxPanel == null) {
1272             GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1273             gridBagConstraints47.fill = GridBagConstraints.BOTH;
1274             gridBagConstraints47.gridx = -1;
1275             gridBagConstraints47.gridy = -1;
1276             gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1277             GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1278             gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1279             gridBagConstraints46.gridwidth = 3;
1280             gridBagConstraints46.gridx = -1;
1281             gridBagConstraints46.gridy = -1;
1282             gridBagConstraints46.weightx = 1.0;
1283             gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1284             FFmpegOptionComboBoxPanel = new JPanel();
1285             FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1286             FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1287                     gridBagConstraints46);
1288             FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1289                     gridBagConstraints47);
1290         }
1291         return FFmpegOptionComboBoxPanel;
1292     }
1293
1294     /**
1295      * This method initializes NotUseVhookCheckBox
1296      *
1297      * @return javax.swing.JCheckBox
1298      */
1299     private JCheckBox getNotUseVhookCheckBox() {
1300         if (disableVhookCheckBox == null) {
1301             disableVhookCheckBox = new JCheckBox();
1302             disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1303             disableVhookCheckBox.setName("disableVhookCheckBox");
1304         }
1305         return disableVhookCheckBox;
1306     }
1307
1308     /**
1309      * This method initializes ViewCommentField
1310      *
1311      * @return javax.swing.JTextField
1312      */
1313     private JTextField getViewCommentField() {
1314         if (viewCommentField == null) {
1315             viewCommentField = new JTextField();
1316             viewCommentField.setName("viewCommentField");
1317         }
1318         return viewCommentField;
1319     }
1320
1321     /**
1322      * This method initializes ShadowComboBox
1323      *
1324      * @return javax.swing.JComboBox
1325      */
1326     private JComboBox getShadowComboBox() {
1327         if (shadowComboBox == null) {
1328             shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1329             shadowComboBox.setName("shadowComboBox");
1330         }
1331         return shadowComboBox;
1332     }
1333
1334     private BasicSetting getBasicSetting() {
1335         String mail = mailAddressField.getText();
1336         String pass = String.valueOf(passwordField.getPassword());
1337         boolean proxyUse = useProxyCheckBox.isSelected();
1338         String proxyHost = proxyTextField.getText();
1339         int proxyPort;
1340         try {
1341             proxyPort = Integer.parseInt(proxyPortTextField.getText());
1342         } catch (NumberFormatException e) {
1343             proxyPort = -1;
1344         }
1345         // TODO 作業用ディレクトリの設定GUI無し
1346         return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1347     }
1348
1349     private InputVideoSetting getInputVideoSetting() {
1350         VideoSaveKind kind;
1351         if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1352             kind = VideoSaveKind.NO_SAVE;
1353         } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1354             kind = VideoSaveKind.NICOBROWSER;
1355         } else {
1356             kind = VideoSaveKind.SAVE;
1357         }
1358         boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1359         String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1360         String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1361         boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1362         String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1363
1364         return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1365     }
1366
1367     private InputCommentSetting getInputCommentSetting() {
1368         boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1369         String file = savePanel.getCommentSavedFileField().getText();
1370         int back_comment;
1371         try {
1372             back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1373         } catch (NumberFormatException ex) {
1374             back_comment = 500;
1375         }
1376         boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1377         boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1378         String folder = savePanel.getCommentSavedFolderField().getText();
1379         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1380
1381         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1382                 back_comment);
1383     }
1384
1385     /**
1386      * 画面入力値から投稿者コメント設定を作成する.
1387      * @return 作成した投稿者コメント設定.
1388      */
1389     private InputTcommentSetting getTcommentSetting() {
1390         boolean down = savePanel.isTcommentDownload();
1391         boolean del = savePanel.isTcommentDelete();
1392         boolean naming = savePanel.isTcommentAutoFileName();
1393         String dir = savePanel.getTcommentDirectoryName();
1394         String f = savePanel.getTcommentFileName();
1395         return new InputTcommentSetting(down, naming, dir, f, del);
1396     }
1397
1398     private OutputVideoSetting getOutputVideoSetting() {
1399         boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1400         boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1401         boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1402         String file = savePanel.getConvertedVideoSavedFileField().getText();
1403         boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1404         boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1405         String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1406
1407         return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1408                 addTcomment);
1409     }
1410
1411     private MovieSetting getMovieSetting() {
1412         String ffmpeg = ffmpegPathField.getText();
1413         String vhook = vhookPathField.getText();
1414         String ext = extOptionField.getText();
1415         String main = mainOptionField.getText();
1416         String in = inputOptionField.getText();
1417         String out = outputOptionField.getText();
1418         String avfilter = avfilterOptionField.getText();
1419         boolean resize = resizeCheckBox.isSelected();
1420         String width = resizeWidthField.getText();
1421         String height = resizeHeigitField.getText();
1422         boolean adjust = adjustRatioCheckBox.isSelected();
1423         File optionFile = FFmpegOptionModel.getSelectedFile();
1424
1425         FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust);
1426         return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1427     }
1428
1429     private ConvertSetting getConvertSetting() {
1430         boolean vhookDisabled = disableVhookCheckBox.isSelected();
1431         int maxComment = 30;
1432         try {
1433             maxComment = Integer.parseInt(viewCommentField.getText());
1434         } catch (NumberFormatException ex) {
1435         }
1436         File font = new File(fontPathField.getText());
1437         int fontIndex = Integer.parseInt(fontIndexField.getText());
1438         int shadowIndex = shadowComboBox.getSelectedIndex();
1439         boolean showConv = showConvVideoCheckBox.isSelected();
1440         boolean adjustFont = fixFontSizeCheckBox.isSelected();
1441         boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1442         NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1443
1444         return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1445                 commentOpaque, ngSetting);
1446     }
1447
1448     private class InputVideoPanelButtonListener implements ActionListener {
1449
1450         public void actionPerformed(ActionEvent e) {
1451             final Object source = e.getSource();
1452             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1453             String title;
1454             JTextField field;
1455             boolean isSave;
1456             boolean isDir;
1457
1458             if (source == panel.getShowSavingVideoFolderDialogButton()) {
1459                 title = "動画の保存先(フォルダ)";
1460                 field = panel.getVideoSavedFolderField();
1461                 isSave = true;
1462                 isDir = true;
1463             } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1464                 title = "動画の保存先(ファイル)";
1465                 field = panel.getVideoSavedFileField();
1466                 isSave = true;
1467                 isDir = false;
1468             } else if (source == panel.getNibrFileChooserButton()) {
1469                 title = "NicoBrowserファイル選択";
1470                 field = panel.getNibrFileField();
1471                 isSave = false;
1472                 isDir = false;
1473             } else {
1474                 return;
1475             }
1476             showSaveDialog(title, field, isSave, isDir);
1477         }
1478     }
1479
1480     private class InputCommentPanelButtonListener implements ActionListener {
1481
1482         public void actionPerformed(ActionEvent e) {
1483             final Object source = e.getSource();
1484             String title;
1485             JTextField field;
1486             boolean isSave;
1487             boolean isDir;
1488             if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1489                 title = "コメントの保存先(フォルダ)";
1490                 field = savePanel.getCommentSavedFolderField();
1491                 isSave = true;
1492                 isDir = true;
1493             } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1494                 title = "コメントの保存先(ファイル)";
1495                 field = savePanel.getCommentSavedFileField();
1496                 isSave = true;
1497                 isDir = false;
1498             } else {
1499                 return;
1500             }
1501             showSaveDialog(title, field, isSave, isDir);
1502         }
1503     }
1504
1505     private class OutputVideoPanelButtonListener implements ActionListener {
1506
1507         public void actionPerformed(ActionEvent e) {
1508             final Object source = e.getSource();
1509             String title;
1510             JTextField field;
1511             boolean isSave;
1512             boolean isDir;
1513             if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1514                 title = "コメント付き動画の保存先(フォルダ)";
1515                 field = savePanel.getConvertedVideoSavedFolderField();
1516                 isSave = true;
1517                 isDir = true;
1518             } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1519                 title = "コメント付き動画の保存先(ファイル)";
1520                 field = savePanel.getConvertedVideoSavedFileField();
1521                 isSave = true;
1522                 isDir = false;
1523             } else {
1524                 return;
1525             }
1526             showSaveDialog(title, field, isSave, isDir);
1527         }
1528     }
1529
1530     private class VideoUseRadioButtonListener implements ActionListener {
1531
1532         public void actionPerformed(ActionEvent e) {
1533             Object source = e.getSource();
1534             if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1535                 maskExt();
1536             } else {
1537                 maskBase();
1538             }
1539         }
1540
1541         private void maskBase() {
1542             mask(true);
1543         }
1544
1545         private void maskExt() {
1546             mask(false);
1547         }
1548
1549         private void mask(boolean b) {
1550             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1551             videoIdField.setEditable(b);
1552             panel.getDelVideoCheckBox().setEnabled(b);
1553
1554             panel.getSaveFolderRadioButton().setEnabled(b);
1555             panel.getVideoSavedFolderField().setEnabled(b);
1556             panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1557
1558             panel.getSaveFileRadioButton().setEnabled(b);
1559             panel.getVideoSavedFileField().setEnabled(b);
1560             panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1561
1562             panel.getNibrFileField().setEnabled(!b);
1563             panel.getNibrFileChooserButton().setEnabled(!b);
1564         }
1565     }
1566 }
1567
1568 class MainFrame_this_windowAdapter extends WindowAdapter {
1569
1570     private MainFrame adaptee;
1571
1572     MainFrame_this_windowAdapter(MainFrame adaptee) {
1573         this.adaptee = adaptee;
1574     }
1575
1576     @Override
1577     public void windowClosing(WindowEvent e) {
1578         adaptee.this_windowClosing(e);
1579     }
1580 }
1581
1582 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1583
1584     private MainFrame adaptee;
1585
1586     MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1587         this.adaptee = adaptee;
1588     }
1589
1590     public void actionPerformed(ActionEvent e) {
1591         adaptee.SettingFontPathButton_actionPerformed(e);
1592     }
1593 }
1594
1595 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1596
1597     private MainFrame adaptee;
1598
1599     MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1600         this.adaptee = adaptee;
1601     }
1602
1603     public void actionPerformed(ActionEvent e) {
1604         adaptee.SettingVhookPathButton_actionPerformed(e);
1605     }
1606 }
1607
1608 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1609
1610     private MainFrame adaptee;
1611
1612     MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1613         this.adaptee = adaptee;
1614     }
1615
1616     public void actionPerformed(ActionEvent e) {
1617         adaptee.SettingFFmpegPathButton_actionPerformed(e);
1618     }
1619 }
1620
1621 class MainFrame_DoButton_actionAdapter implements ActionListener {
1622
1623     private MainFrame adaptee;
1624
1625     MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1626         this.adaptee = adaptee;
1627     }
1628
1629     public void actionPerformed(ActionEvent e) {
1630         adaptee.DoButton_actionPerformed(e);
1631     }
1632 }
1633
1634 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1635
1636     MainFrame adaptee;
1637
1638     MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1639         this.adaptee = adaptee;
1640     }
1641
1642     public void actionPerformed(ActionEvent actionEvent) {
1643         adaptee.jMenuFileExit_actionPerformed(actionEvent);
1644     }
1645 }
1646
1647 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1648
1649     MainFrame adaptee;
1650
1651     MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1652         this.adaptee = adaptee;
1653     }
1654
1655     public void actionPerformed(ActionEvent actionEvent) {
1656         adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
1657     }
1658 }