OSDN Git Service

e431d0fecc0eed87511090e9209255fb17986d3c
[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     private 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
488         videoIdLabel.setText("URL/ID");
489         wayBackLabel.setText("過去ログ");
490         videoIdField.setText("http://www.nicovideo.jp/watch/");
491
492         final GroupLayout oppLayout = new GroupLayout(opPanel);
493         opPanel.setLayout(oppLayout);
494
495         oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup()
496                 .addGroup(oppLayout.createParallelGroup()
497                     .addComponent(videoIdLabel)
498                     .addComponent(wayBackLabel))
499                 .addGroup(oppLayout.createParallelGroup()
500                     .addComponent(videoIdField)
501                     .addGroup(oppLayout.createSequentialGroup()
502                         .addComponent(wayBackField)))
503                 );
504
505         oppLayout.setVerticalGroup(oppLayout.createSequentialGroup()
506                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
507                         .addComponent(videoIdLabel)
508                         .addComponent(videoIdField))
509                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
510                         .addComponent(wayBackLabel)
511                         .addComponent(wayBackField))
512                 );
513
514         doButton.setText(DoButtonDefString);
515         doButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
516
517         videoInfoPanel.add(opPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
518                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
519                 new Insets(0, 0, 0, 0), 0, 0));
520         videoInfoPanel.add(doButton, gridBagConstraints71);
521
522         
523         mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
524         mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
525         mainTabbedPane.add(FFMpegTabPanel, "動画設定");
526         mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
527         SavingInfoTabPanel.add(savePanel);
528         BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
529         BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
530         VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
531         VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
532         VhookSettingPanel.add(fontPathField, gridBagConstraints60);
533         VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
534         VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
535         VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
536         VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
537         VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
538         VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
539         VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
540         VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
541         VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
542         VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
543
544         FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
545                 1.0, 0.0, GridBagConstraints.NORTHEAST,
546                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
547         FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
548     }
549
550     /**
551      * 保存設定パネル内のボタンにアクションリスナを割り当てる.
552      */
553     private void setListenerToSavePanelButton() {
554         ActionListener al;
555         al = new InputVideoPanelButtonListener();
556         videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
557         videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
558         videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
559
560         al = new VideoUseRadioButtonListener();
561         videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
562         videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
563         videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
564
565         al = new InputCommentPanelButtonListener();
566         savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
567         savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
568
569         al = new OutputVideoPanelButtonListener();
570         savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
571         savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
572     }
573
574     private void setPopup() {
575         mainOptionField.addMouseListener(new PopupRightClick(
576                 this.mainOptionField));
577         inputOptionField.addMouseListener(new PopupRightClick(
578                 this.inputOptionField));
579         outputOptionField.addMouseListener(new PopupRightClick(
580                 this.outputOptionField));
581         savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
582                 savePanel.getCommentNumField()));
583
584         savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
585                 savePanel.getCommentSavedFileField()));
586         savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
587                 savePanel.getCommentSavedFolderField()));
588
589         savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
590                 savePanel.getConvertedVideoSavedFileField()));
591         savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
592                 savePanel.getConvertedVideoSavedFolderField()));
593
594         videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
595                 videoSaveInfoPanel.getVideoSavedFileField()));
596         videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
597                 videoSaveInfoPanel.getVideoSavedFolderField()));
598         videoSaveInfoPanel.getNibrFileField().addMouseListener(
599                 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
600
601         ffmpegPathField.addMouseListener(new PopupRightClick(
602                 this.ffmpegPathField));
603         vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
604         videoIdField.addMouseListener(new PopupRightClick(
605                 this.videoIdField));
606         viewCommentField.addMouseListener(new PopupRightClick(
607                 this.viewCommentField));
608         fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
609         mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
610         passwordField.addMouseListener(new PopupRightClick(this.passwordField));
611         wayBackField.addMouseListener(new PopupRightClick(this.wayBackField));
612
613         proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
614         proxyPortTextField.addMouseListener(new PopupRightClick(
615                 this.proxyPortTextField));
616
617         fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
618
619         ngWordTextField.addMouseListener(new PopupRightClick(
620                 this.ngWordTextField));
621         ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
622     }
623
624     private void setDropTarget() {
625         addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
626         addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
627         addTarget(videoSaveInfoPanel.getNibrFileField(), false);
628
629         addTarget(savePanel.getCommentSavedFileField(), false);
630         addTarget(savePanel.getCommentSavedFolderField(), true);
631
632         addTarget(savePanel.getConvertedVideoSavedFileField(), false);
633         addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
634
635         addTarget(ffmpegPathField, false);
636         addTarget(vhookPathField, false);
637         addTarget(fontPathField, false);
638
639     }
640
641     /**
642      * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
643      * @param c 設定対象のテキストフィールドオブジェクト.
644      * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
645      * @return ドロップターゲット(用途無し).
646      */
647     private DropTarget addTarget(JTextField c, boolean isDir) {
648         return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
649                 c, isDir), true);
650     }
651     private File CurrentDir = new File(".");
652     private JPanel PathSettingPanel = new JPanel();
653     private JLabel FFmpegPathLabel = new JLabel();
654     private GridBagLayout gridBagLayout7 = new GridBagLayout();
655     private JTextField ffmpegPathField = new JTextField();
656     private JButton SettingFFmpegPathButton = new JButton();
657     private JLabel VhookPathLabel = new JLabel();
658     private JTextField vhookPathField = new JTextField();
659     private JButton SettingVhookPathButton = new JButton();
660     private JPanel VhookSettingPanel = new JPanel();
661     private GridBagLayout gridBagLayout8 = new GridBagLayout();
662     private JPanel FFmpegSettingPanel = new JPanel();
663     private GridBagLayout gblFFmpegSettingPanel = new GridBagLayout();
664     private JLabel FontPathLabel = new JLabel();
665     private JTextField fontPathField = new JTextField();
666     private JButton SettingFontPathButton = new JButton();
667     private JCheckBox showConvVideoCheckBox = new JCheckBox();
668
669     private void showSaveDialog(String title, JTextField field, boolean isSave,
670             boolean isDir) {
671         JFileChooser chooser = new JFileChooser(CurrentDir);
672         chooser.setDialogTitle(title);
673         int code = 0;
674         if (isDir) {
675             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
676         }
677         if (isSave) {
678             code = chooser.showSaveDialog(this);
679         } else {
680             code = chooser.showOpenDialog(this);
681         }
682         if (code == JFileChooser.APPROVE_OPTION) {
683             if (isDir) {
684                 CurrentDir = chooser.getSelectedFile();
685                 field.setText(CurrentDir.getAbsolutePath());
686             } else {
687                 File selected = chooser.getSelectedFile();
688                 CurrentDir = chooser.getCurrentDirectory();
689                 field.setText(selected.getAbsolutePath());
690             }
691         }
692     }
693
694     private SProperties getSetting() {
695         SProperties setting = new SProperties(
696                 getBasicSetting(),
697                 getInputVideoSetting(),
698                 getInputCommentSetting(),
699                 getTcommentSetting(),
700                 getOutputVideoSetting(),
701                 getMovieSetting(),
702                 getConvertSetting());
703         return setting;
704     }
705
706     /**
707      * 設定を画面に反映する.
708      * @param setting 反映する設定.
709      */
710     private void setSetting(SProperties setting) {
711         // 基本設定
712         final BasicSetting basic = setting.getBasicSetting();
713         tempDir = basic.getTempDir();
714         mailAddressField.setText(basic.getUser().getMail());
715         passwordField.setText(basic.getUser().getPassword());
716         // プロキシ関連
717         useProxyCheckBox.setSelected(basic.isProxyUse());
718         proxyTextField.setText(basic.getProxyHost());
719         int proxy_port = basic.getProxyPort();
720         if (proxy_port >= 0 && proxy_port <= 65535) {
721             proxyPortTextField.setText(Integer.toString(proxy_port));
722         } else {
723             proxyPortTextField.setText("");
724         }
725
726         // 保存設定 - 入力動画
727         final InputVideoSetting inVideo = setting.getInputVideoSetting();
728         JRadioButton activeButton;
729         switch (inVideo.getProcessKind()) {
730             case NO_SAVE:
731                 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
732                 break;
733             case NICOBROWSER:
734                 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
735                 break;
736             case SAVE:
737             default:
738                 activeButton = videoSaveInfoPanel.getVideoSaveButton();
739                 break;
740         }
741         activeButton.doClick();
742
743         videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
744         videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
745         videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
746         final boolean videoFixName = inVideo.isAutoNaming();
747         videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
748         videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
749         videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
750
751         // 保存設定 - 入力コメント
752         final InputCommentSetting inputComment = setting.getInputCommentSetting();
753         savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
754         savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
755         savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
756         savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
757         savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
758         savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
759         boolean commentFixName = inputComment.isAutoNaming();
760         savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
761         savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
762
763         // 投稿者コメント
764         InputTcommentSetting tcom = setting.getInputTcommentSetting();
765         savePanel.setTcommentDownload(tcom.getProcessKind());
766         savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
767         savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
768         savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
769         savePanel.setTcommentFileName(tcom.getFile().getPath());
770
771         // 保存設定 - 出力コメント付き動画
772         final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
773         savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
774         savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
775         savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
776         savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
777         savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
778         savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
779         boolean convFixName = outputVideo.isAutoNaming();
780         savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
781         savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
782
783         // 動画設定
784         final MovieSetting movie = setting.getMovieSetting();
785         ffmpegPathField.setText(movie.getFfmpeg().toString());
786         vhookPathField.setText(movie.getVhook().toString());
787         extOptionField.setText(movie.getFfmpegOption().getExtOption());
788         mainOptionField.setText(movie.getFfmpegOption().getMainOption());
789         inputOptionField.setText(movie.getFfmpegOption().getInOption());
790         outputOptionField.setText(movie.getFfmpegOption().getOutOption());
791         avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption());
792         resizeCheckBox.setSelected(movie.getFfmpegOption().isResize());
793         resizeWidthField.setText(Integer.toString(movie.getFfmpegOption().getResizeWidth()));
794         resizeHeigitField.setText(Integer.toString(movie.getFfmpegOption().getResizeHeight()));
795         adjustRatioCheckBox.setSelected(movie.getFfmpegOption().isAdjustRatio());
796         FFmpegOptionModel.reload(movie.getOptionFile());
797
798         // 変換設定
799         final ConvertSetting conv = setting.getConvertSetting();
800         disableVhookCheckBox.setSelected(conv.isVhookDisabled());
801         viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
802         fontPathField.setText(conv.getFont().toString());
803         fontIndexField.setText(Integer.toString(conv.getFontIndex()));
804         shadowComboBox.setSelectedIndex(conv.getShadowIndex());
805         showConvVideoCheckBox.setSelected(conv.isShowConverting());
806         fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
807         opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
808         ngWordTextField.setText(conv.getNgSetting().getWord());
809         ngIdTextField.setText(conv.getNgSetting().getId());
810     }
811
812     /**
813      * [ファイル|終了] アクションが実行されました。
814      *
815      * @param actionEvent
816      *            ActionEvent
817      */
818     void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
819         try {
820             SProperties setting = getSetting();
821             SProperties.saveSetting(setting);
822         } catch (Throwable t) {
823             Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "設定保存に失敗", t);
824         }
825         System.exit(0);
826     }
827
828     /**
829      * [ヘルプ|バージョン情報] アクションが実行されました。
830      *
831      * @param actionEvent
832      *            ActionEvent
833      */
834     void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
835         MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
836         dlg.pack();
837         dlg.setLocationRelativeTo(this);
838         dlg.setVisible(true);
839     }
840
841     /* 変換・保存する */
842     private Converter Converter = null;
843     // FFmpegの設定 ここから
844     private final JLabel extOptionLabel = new JLabel();
845     private final JTextField extOptionField = new JTextField();
846     private JLabel mainOptionLabel = new JLabel();
847     private JTextField mainOptionField = new JTextField();
848     private JLabel inputOptionLabel = new JLabel();
849     private JTextField inputOptionField = new JTextField();
850     private JLabel outputOptionLabel = new JLabel();
851     private JTextField outputOptionField = new JTextField();
852     private final JLabel avfilterOptionLabel = new JLabel();
853     private final JTextField avfilterOptionField = new JTextField();
854     private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるよう縮小(-s)");
855     private final JLabel resizeWidthLabel = new JLabel("横");
856     private final JTextField resizeWidthField = new NumberFormattedTextField();
857     private final JLabel resizeHeightLabel = new JLabel("縦");
858     private final JTextField resizeHeigitField = new NumberFormattedTextField();
859     private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
860     // FFmpegの設定 ここまで
861     private JLabel FontIndexLabel = new JLabel();
862     private JTextField fontIndexField = new JTextField();
863     private GridBagLayout gridBagLayout1 = new GridBagLayout();
864     private JPanel BasicInfoTabPanel = new JPanel();
865     private GridBagLayout gridBagLayout12 = new GridBagLayout();
866     private JPanel ConvertingSettingPanel = null;
867     private JPanel NGWordSettingPanel = null;
868     private JLabel NGWordLabel = null;
869     private JTextField ngWordTextField = null;
870     private JLabel NGIDLabel = null;
871     private JTextField ngIdTextField = null;
872     // プロキシ設定
873     private JPanel ProxyInfoPanel = null;
874     private JCheckBox useProxyCheckBox = null;
875     private JLabel proxyLabel = null;
876     private JTextField proxyTextField = null;
877     private JLabel proxyPortLabel = null;
878     private JTextField proxyPortTextField = null;
879     //
880     private JCheckBox fixFontSizeCheckBox = null;
881     private JCheckBox opaqueCommentCheckBox = null;
882     private final SavePanel savePanel = new SavePanel();
883     private final VideoSaveInfoPanel videoSaveInfoPanel;
884     private JComboBox FFmpegOptionComboBox = null;
885     private JButton FFmpegOptionReloadButton = null;
886     private JPanel FFmpegOptionComboBoxPanel = null;
887
888     public void DoButton_actionPerformed(ActionEvent e) {
889         if (Converter == null || Converter.isConverted()) {
890             try {
891                 executeConvert();
892             } catch (Exception ex) {
893                 String text = ex.getMessage();
894                 if (StringUtils.isEmpty(text)) {
895                     text = "予期しないエラーのため中断しました。";
896                 }
897                 ex.printStackTrace();
898                 statusBar.setText(text);
899             }
900         } else { /* 開始しているので、ストップする。 */
901             final ConvertStopFlag flag = Converter.getStopFlag();
902             if (!flag.needStop()) { /* まだストップしていない。 */
903                 flag.requestStop();
904             }
905         }
906     }
907
908     private void executeConvert() throws IOException {
909         String url;
910
911         // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
912         if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
913             try {
914                 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
915                 NicoDBFinder finder = NicoDBFinder.getInstance();
916                 NicoContent info = finder.findNicoContent(fileName);
917                 if (info != null) {
918                     url = info.getNicoId();
919                 } else {
920                     url = "";
921                 }
922             } catch (Exception ex) {
923                 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
924                 return;
925             }
926         } else {
927             url = videoIdField.getText();
928         }
929
930         TextProgressListener sl = new TextProgressListener() {
931
932             public void setText(final String text) {
933                 SwingUtilities.invokeLater(new Runnable() {
934
935                     public void run() {
936                         statusBar.setText(text);
937                     }
938                 });
939             }
940         };
941
942         ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
943
944             public void changeState(final State s) {
945                 SwingUtilities.invokeLater(new Runnable() {
946
947                     public void run() {
948                         switch (s) {
949                             case STOPPING:
950                                 doButton.setText(DoButtonWaitString);
951                                 break;
952                             case FINISHED:
953                                 doButton.setText(DoButtonDefString);
954                         }
955                     }
956                 });
957             }
958         };
959
960         Converter = new Converter(url, wayBackField.getText(), getSetting().toProfile(), sl,
961                 new ConvertStopFlag(scl));
962         doButton.setText(DoButtonStopString);
963         new Thread(Converter).start();
964
965     }
966
967     /* FFmpegへのパス */
968     public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
969         showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
970     }
971
972     public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
973         showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
974     }
975
976     public void SettingFontPathButton_actionPerformed(ActionEvent e) {
977         showSaveDialog("フォントへのパス", fontPathField, false, false);
978     }
979
980     public void this_windowClosing(WindowEvent e) {
981         this.jMenuFileExit_actionPerformed(null);
982     }
983
984     /**
985      * This method initializes ConvertingSettingPanel
986      *
987      * @return javax.swing.JPanel
988      */
989     private JPanel getConvertingSettingPanel() {
990         if (ConvertingSettingPanel == null) {
991             GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
992             gridBagConstraints11.weighty = 1.0;
993             gridBagConstraints11.weightx = 1.0;
994             gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
995             gridBagConstraints11.gridy = 1;
996             gridBagConstraints11.gridx = 0;
997             gridBagConstraints11.anchor = GridBagConstraints.NORTH;
998             gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
999             GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
1000                     2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
1001                     GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
1002             gridBagConstraints.gridx = 0;
1003             gridBagConstraints.anchor = GridBagConstraints.CENTER;
1004             gridBagConstraints.weighty = 0.0;
1005             gridBagConstraints.gridy = 0;
1006             ConvertingSettingPanel = new JPanel();
1007             ConvertingSettingPanel.setLayout(new GridBagLayout());
1008             ConvertingSettingPanel.add(getNGWordSettingPanel(),
1009                     gridBagConstraints11);
1010             ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
1011         }
1012         return ConvertingSettingPanel;
1013     }
1014
1015     /**
1016      * This method initializes NGWordSettingPanel
1017      *
1018      * @return javax.swing.JPanel
1019      */
1020     private JPanel getNGWordSettingPanel() {
1021         if (NGWordSettingPanel == null) {
1022             GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
1023             gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
1024             gridBagConstraints5.gridy = 1;
1025             gridBagConstraints5.weightx = 1.0;
1026             gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
1027             gridBagConstraints5.gridx = 1;
1028             GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
1029             gridBagConstraints4.gridx = 0;
1030             gridBagConstraints4.anchor = GridBagConstraints.WEST;
1031             gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
1032             gridBagConstraints4.gridy = 1;
1033             NGIDLabel = new JLabel();
1034             NGIDLabel.setText("NG ID");
1035             GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
1036             gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
1037             gridBagConstraints3.gridy = 0;
1038             gridBagConstraints3.weightx = 1.0;
1039             gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
1040             gridBagConstraints3.gridx = 1;
1041             GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
1042             gridBagConstraints2.gridx = 0;
1043             gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
1044             gridBagConstraints2.gridy = 0;
1045             NGWordLabel = new JLabel();
1046             NGWordLabel.setText("NGワード");
1047             NGWordSettingPanel = new JPanel();
1048             NGWordSettingPanel.setLayout(new GridBagLayout());
1049             NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
1050                     "NGワード・ID設定(半角スペース区切りで複数入力)"));
1051             NGWordSettingPanel.add(NGWordLabel, gridBagConstraints2);
1052             NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
1053             NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
1054             NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
1055         }
1056         return NGWordSettingPanel;
1057     }
1058
1059     /**
1060      * This method initializes NGWordTextField
1061      *
1062      * @return javax.swing.JTextField
1063      */
1064     private JTextField getNGWordTextField() {
1065         if (ngWordTextField == null) {
1066             ngWordTextField = new JTextField();
1067             ngWordTextField.setName("ngWordTextField");
1068         }
1069         return ngWordTextField;
1070     }
1071
1072     /**
1073      * This method initializes NGIDTextField
1074      *
1075      * @return javax.swing.JTextField
1076      */
1077     private JTextField getNGIDTextField() {
1078         if (ngIdTextField == null) {
1079             ngIdTextField = new JTextField();
1080             ngIdTextField.setName("ngIdTextField");
1081         }
1082         return ngIdTextField;
1083     }
1084
1085     /**
1086      * This method initializes ProxyInfoPanel
1087      *
1088      * @return javax.swing.JPanel
1089      */
1090     private JPanel getProxyInfoPanel() {
1091         if (ProxyInfoPanel == null) {
1092             GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1093             gridBagConstraints13.gridx = 0;
1094             gridBagConstraints13.gridwidth = 2;
1095             gridBagConstraints13.weightx = 1.0;
1096             gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1097             gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1098             gridBagConstraints13.gridy = 0;
1099             GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1100             gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1101             gridBagConstraints12.gridy = 2;
1102             gridBagConstraints12.weightx = 1.0;
1103             gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1104             gridBagConstraints12.gridx = 1;
1105             GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1106             gridBagConstraints10.gridx = 0;
1107             gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1108             gridBagConstraints10.gridy = 2;
1109             proxyPortLabel = new JLabel();
1110             proxyPortLabel.setText("ポート番号");
1111             GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1112             gridBagConstraints9.fill = GridBagConstraints.BOTH;
1113             gridBagConstraints9.gridy = 1;
1114             gridBagConstraints9.weightx = 1.0;
1115             gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1116             gridBagConstraints9.gridx = 1;
1117             GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1118             gridBagConstraints8.gridx = 0;
1119             gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1120             gridBagConstraints8.fill = GridBagConstraints.NONE;
1121             gridBagConstraints8.anchor = GridBagConstraints.EAST;
1122             gridBagConstraints8.gridy = 1;
1123             proxyLabel = new JLabel();
1124             proxyLabel.setText("プロキシ");
1125             ProxyInfoPanel = new JPanel();
1126             ProxyInfoPanel.setLayout(new GridBagLayout());
1127             ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1128                     "プロキシ設定"));
1129             ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1130             ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1131             ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1132             ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1133             ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1134         }
1135         return ProxyInfoPanel;
1136     }
1137
1138     /**
1139      * This method initializes ProxyTextField
1140      *
1141      * @return javax.swing.JTextField
1142      */
1143     private JTextField getProxyTextField() {
1144         if (proxyTextField == null) {
1145             proxyTextField = new JTextField();
1146             proxyTextField.setName("proxyTextField");
1147         }
1148         return proxyTextField;
1149     }
1150
1151     /**
1152      * This method initializes ProxyPortTextField
1153      *
1154      * @return javax.swing.JTextField
1155      */
1156     private JTextField getProxyPortTextField() {
1157         if (proxyPortTextField == null) {
1158             proxyPortTextField = new JTextField();
1159             proxyPortTextField.setName("proxyPortTextField");
1160         }
1161         return proxyPortTextField;
1162     }
1163
1164     /**
1165      * This method initializes UseProxyCheckBox
1166      *
1167      * @return javax.swing.JCheckBox
1168      */
1169     private JCheckBox getUseProxyCheckBox() {
1170         if (useProxyCheckBox == null) {
1171             useProxyCheckBox = new JCheckBox();
1172             useProxyCheckBox.setText("プロキシを使う");
1173             useProxyCheckBox.setName("useProxyCheckBox");
1174         }
1175         return useProxyCheckBox;
1176     }
1177
1178     /**
1179      * This method initializes FixFontSizeCheckBox
1180      *
1181      * @return javax.swing.JCheckBox
1182      */
1183     private JCheckBox getFixFontSizeCheckBox() {
1184         if (fixFontSizeCheckBox == null) {
1185             fixFontSizeCheckBox = new JCheckBox();
1186             fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1187             fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1188         }
1189         return fixFontSizeCheckBox;
1190     }
1191
1192     /**
1193      * This method initializes OpaqueCommentCheckBox
1194      *
1195      * @return javax.swing.JCheckBox
1196      */
1197     private JCheckBox getOpaqueCommentCheckBox() {
1198         if (opaqueCommentCheckBox == null) {
1199             opaqueCommentCheckBox = new JCheckBox();
1200             opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1201             opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1202         }
1203         return opaqueCommentCheckBox;
1204     }
1205     /**
1206      * This method initializes FFmpegOptionComboBox
1207      *
1208      * @return javax.swing.JComboBox
1209      */
1210     private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1211     private JCheckBox disableVhookCheckBox = null;
1212     private JTextField viewCommentField = null;
1213     private JLabel ViewCommentLabel = null;
1214     private JLabel ShadowKindLabel = null;
1215     private JComboBox shadowComboBox = null;
1216
1217     private JComboBox getFFmpegOptionComboBox() {
1218         if (FFmpegOptionComboBox == null) {
1219             FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1220             FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1221
1222                 public void actionPerformed(java.awt.event.ActionEvent e) {
1223                     if (FFmpegOptionModel.isFile()) {// ファイル
1224                         setFFMpegOptionEnabled(false);
1225                     } else {// ファイルでない
1226                         setFFMpegOptionEnabled(true);
1227                         setFFMpegOptionCheckbox();
1228                     }
1229                 }
1230
1231                 private void setFFMpegOptionEnabled(boolean enable) {
1232                     extOptionField.setEnabled(enable);
1233                     mainOptionField.setEnabled(enable);
1234                     inputOptionField.setEnabled(enable);
1235                     outputOptionField.setEnabled(enable);
1236                     avfilterOptionField.setEnabled(enable);
1237                     resizeCheckBox.setEnabled(enable);
1238                     resizeWidthField.setEnabled(enable);
1239                     resizeHeigitField.setEditable(enable);
1240                     adjustRatioCheckBox.setEnabled(enable);
1241                 }
1242             });
1243         }
1244         return FFmpegOptionComboBox;
1245     }
1246
1247     /**
1248      * This method initializes FFmpegOptionReloadButton
1249      *
1250      * @return javax.swing.JButton
1251      */
1252     private JButton getFFmpegOptionReloadButton() {
1253         if (FFmpegOptionReloadButton == null) {
1254             FFmpegOptionReloadButton = new JButton();
1255             FFmpegOptionReloadButton.setText("更新");
1256             FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1257
1258                 public void actionPerformed(java.awt.event.ActionEvent e) {
1259                     FFmpegOptionModel.reload();
1260                 }
1261             });
1262         }
1263         return FFmpegOptionReloadButton;
1264     }
1265
1266     /**
1267      * This method initializes FFmpegOptionComboBoxPanel
1268      *
1269      * @return javax.swing.JPanel
1270      */
1271     private JPanel getFFmpegOptionComboBoxPanel() {
1272         if (FFmpegOptionComboBoxPanel == null) {
1273             GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1274             gridBagConstraints47.fill = GridBagConstraints.BOTH;
1275             gridBagConstraints47.gridx = -1;
1276             gridBagConstraints47.gridy = -1;
1277             gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1278             GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1279             gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1280             gridBagConstraints46.gridwidth = 3;
1281             gridBagConstraints46.gridx = -1;
1282             gridBagConstraints46.gridy = -1;
1283             gridBagConstraints46.weightx = 1.0;
1284             gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1285             FFmpegOptionComboBoxPanel = new JPanel();
1286             FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1287             FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1288                     gridBagConstraints46);
1289             FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1290                     gridBagConstraints47);
1291         }
1292         return FFmpegOptionComboBoxPanel;
1293     }
1294
1295     /**
1296      * This method initializes NotUseVhookCheckBox
1297      *
1298      * @return javax.swing.JCheckBox
1299      */
1300     private JCheckBox getNotUseVhookCheckBox() {
1301         if (disableVhookCheckBox == null) {
1302             disableVhookCheckBox = new JCheckBox();
1303             disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1304             disableVhookCheckBox.setName("disableVhookCheckBox");
1305         }
1306         return disableVhookCheckBox;
1307     }
1308
1309     /**
1310      * This method initializes ViewCommentField
1311      *
1312      * @return javax.swing.JTextField
1313      */
1314     private JTextField getViewCommentField() {
1315         if (viewCommentField == null) {
1316             viewCommentField = new JTextField();
1317             viewCommentField.setName("viewCommentField");
1318         }
1319         return viewCommentField;
1320     }
1321
1322     /**
1323      * This method initializes ShadowComboBox
1324      *
1325      * @return javax.swing.JComboBox
1326      */
1327     private JComboBox getShadowComboBox() {
1328         if (shadowComboBox == null) {
1329             shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1330             shadowComboBox.setName("shadowComboBox");
1331         }
1332         return shadowComboBox;
1333     }
1334
1335     private BasicSetting getBasicSetting() {
1336         String mail = mailAddressField.getText();
1337         String pass = String.valueOf(passwordField.getPassword());
1338         boolean proxyUse = useProxyCheckBox.isSelected();
1339         String proxyHost = proxyTextField.getText();
1340         int proxyPort;
1341         try {
1342             proxyPort = Integer.parseInt(proxyPortTextField.getText());
1343         } catch (NumberFormatException e) {
1344             proxyPort = -1;
1345         }
1346         // TODO 作業用ディレクトリの設定GUI無し
1347         return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1348     }
1349
1350     private InputVideoSetting getInputVideoSetting() {
1351         VideoSaveKind kind;
1352         if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1353             kind = VideoSaveKind.NO_SAVE;
1354         } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1355             kind = VideoSaveKind.NICOBROWSER;
1356         } else {
1357             kind = VideoSaveKind.SAVE;
1358         }
1359         boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1360         String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1361         String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1362         boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1363         String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1364
1365         return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1366     }
1367
1368     private InputCommentSetting getInputCommentSetting() {
1369         boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1370         String file = savePanel.getCommentSavedFileField().getText();
1371         int back_comment;
1372         try {
1373             back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1374         } catch (NumberFormatException ex) {
1375             back_comment = 500;
1376         }
1377         boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1378         boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1379         String folder = savePanel.getCommentSavedFolderField().getText();
1380         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1381
1382         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1383                 back_comment);
1384     }
1385
1386     /**
1387      * 画面入力値から投稿者コメント設定を作成する.
1388      * @return 作成した投稿者コメント設定.
1389      */
1390     private InputTcommentSetting getTcommentSetting() {
1391         boolean down = savePanel.isTcommentDownload();
1392         boolean del = savePanel.isTcommentDelete();
1393         boolean naming = savePanel.isTcommentAutoFileName();
1394         String dir = savePanel.getTcommentDirectoryName();
1395         String f = savePanel.getTcommentFileName();
1396         return new InputTcommentSetting(down, naming, dir, f, del);
1397     }
1398
1399     private OutputVideoSetting getOutputVideoSetting() {
1400         boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1401         boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1402         boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1403         String file = savePanel.getConvertedVideoSavedFileField().getText();
1404         boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1405         boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1406         String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1407
1408         return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1409                 addTcomment);
1410     }
1411
1412     private MovieSetting getMovieSetting() {
1413         String ffmpeg = ffmpegPathField.getText();
1414         String vhook = vhookPathField.getText();
1415         String ext = extOptionField.getText();
1416         String main = mainOptionField.getText();
1417         String in = inputOptionField.getText();
1418         String out = outputOptionField.getText();
1419         String avfilter = avfilterOptionField.getText();
1420         boolean resize = resizeCheckBox.isSelected();
1421         String width = resizeWidthField.getText();
1422         String height = resizeHeigitField.getText();
1423         boolean adjust = adjustRatioCheckBox.isSelected();
1424         File optionFile = FFmpegOptionModel.getSelectedFile();
1425
1426         FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust);
1427         return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1428     }
1429
1430     private ConvertSetting getConvertSetting() {
1431         boolean vhookDisabled = disableVhookCheckBox.isSelected();
1432         int maxComment = 30;
1433         try {
1434             maxComment = Integer.parseInt(viewCommentField.getText());
1435         } catch (NumberFormatException ex) {
1436         }
1437         File font = new File(fontPathField.getText());
1438         int fontIndex = Integer.parseInt(fontIndexField.getText());
1439         int shadowIndex = shadowComboBox.getSelectedIndex();
1440         boolean showConv = showConvVideoCheckBox.isSelected();
1441         boolean adjustFont = fixFontSizeCheckBox.isSelected();
1442         boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1443         NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1444
1445         return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1446                 commentOpaque, ngSetting);
1447     }
1448
1449     private class InputVideoPanelButtonListener implements ActionListener {
1450
1451         public void actionPerformed(ActionEvent e) {
1452             final Object source = e.getSource();
1453             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1454             String title;
1455             JTextField field;
1456             boolean isSave;
1457             boolean isDir;
1458
1459             if (source == panel.getShowSavingVideoFolderDialogButton()) {
1460                 title = "動画の保存先(フォルダ)";
1461                 field = panel.getVideoSavedFolderField();
1462                 isSave = true;
1463                 isDir = true;
1464             } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1465                 title = "動画の保存先(ファイル)";
1466                 field = panel.getVideoSavedFileField();
1467                 isSave = true;
1468                 isDir = false;
1469             } else if (source == panel.getNibrFileChooserButton()) {
1470                 title = "NicoBrowserファイル選択";
1471                 field = panel.getNibrFileField();
1472                 isSave = false;
1473                 isDir = false;
1474             } else {
1475                 return;
1476             }
1477             showSaveDialog(title, field, isSave, isDir);
1478         }
1479     }
1480
1481     private class InputCommentPanelButtonListener implements ActionListener {
1482
1483         public void actionPerformed(ActionEvent e) {
1484             final Object source = e.getSource();
1485             String title;
1486             JTextField field;
1487             boolean isSave;
1488             boolean isDir;
1489             if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1490                 title = "コメントの保存先(フォルダ)";
1491                 field = savePanel.getCommentSavedFolderField();
1492                 isSave = true;
1493                 isDir = true;
1494             } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1495                 title = "コメントの保存先(ファイル)";
1496                 field = savePanel.getCommentSavedFileField();
1497                 isSave = true;
1498                 isDir = false;
1499             } else {
1500                 return;
1501             }
1502             showSaveDialog(title, field, isSave, isDir);
1503         }
1504     }
1505
1506     private class OutputVideoPanelButtonListener implements ActionListener {
1507
1508         public void actionPerformed(ActionEvent e) {
1509             final Object source = e.getSource();
1510             String title;
1511             JTextField field;
1512             boolean isSave;
1513             boolean isDir;
1514             if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1515                 title = "コメント付き動画の保存先(フォルダ)";
1516                 field = savePanel.getConvertedVideoSavedFolderField();
1517                 isSave = true;
1518                 isDir = true;
1519             } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1520                 title = "コメント付き動画の保存先(ファイル)";
1521                 field = savePanel.getConvertedVideoSavedFileField();
1522                 isSave = true;
1523                 isDir = false;
1524             } else {
1525                 return;
1526             }
1527             showSaveDialog(title, field, isSave, isDir);
1528         }
1529     }
1530
1531     private class VideoUseRadioButtonListener implements ActionListener {
1532
1533         public void actionPerformed(ActionEvent e) {
1534             Object source = e.getSource();
1535             if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1536                 maskExt();
1537             } else {
1538                 maskBase();
1539             }
1540         }
1541
1542         private void maskBase() {
1543             mask(true);
1544         }
1545
1546         private void maskExt() {
1547             mask(false);
1548         }
1549
1550         private void mask(boolean b) {
1551             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1552             videoIdField.setEditable(b);
1553             panel.getDelVideoCheckBox().setEnabled(b);
1554
1555             panel.getSaveFolderRadioButton().setEnabled(b);
1556             panel.getVideoSavedFolderField().setEnabled(b);
1557             panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1558
1559             panel.getSaveFileRadioButton().setEnabled(b);
1560             panel.getVideoSavedFileField().setEnabled(b);
1561             panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1562
1563             panel.getNibrFileField().setEnabled(!b);
1564             panel.getNibrFileChooserButton().setEnabled(!b);
1565         }
1566     }
1567 }
1568
1569 class MainFrame_this_windowAdapter extends WindowAdapter {
1570
1571     private MainFrame adaptee;
1572
1573     MainFrame_this_windowAdapter(MainFrame adaptee) {
1574         this.adaptee = adaptee;
1575     }
1576
1577     @Override
1578     public void windowClosing(WindowEvent e) {
1579         adaptee.this_windowClosing(e);
1580     }
1581 }
1582
1583 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1584
1585     private MainFrame adaptee;
1586
1587     MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1588         this.adaptee = adaptee;
1589     }
1590
1591     public void actionPerformed(ActionEvent e) {
1592         adaptee.SettingFontPathButton_actionPerformed(e);
1593     }
1594 }
1595
1596 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1597
1598     private MainFrame adaptee;
1599
1600     MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1601         this.adaptee = adaptee;
1602     }
1603
1604     public void actionPerformed(ActionEvent e) {
1605         adaptee.SettingVhookPathButton_actionPerformed(e);
1606     }
1607 }
1608
1609 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1610
1611     private MainFrame adaptee;
1612
1613     MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1614         this.adaptee = adaptee;
1615     }
1616
1617     public void actionPerformed(ActionEvent e) {
1618         adaptee.SettingFFmpegPathButton_actionPerformed(e);
1619     }
1620 }
1621
1622 class MainFrame_DoButton_actionAdapter implements ActionListener {
1623
1624     private MainFrame adaptee;
1625
1626     MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1627         this.adaptee = adaptee;
1628     }
1629
1630     public void actionPerformed(ActionEvent e) {
1631         adaptee.DoButton_actionPerformed(e);
1632     }
1633 }
1634
1635 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1636
1637     MainFrame adaptee;
1638
1639     MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1640         this.adaptee = adaptee;
1641     }
1642
1643     public void actionPerformed(ActionEvent actionEvent) {
1644         adaptee.jMenuFileExit_actionPerformed(actionEvent);
1645     }
1646 }
1647
1648 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1649
1650     MainFrame adaptee;
1651
1652     MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1653         this.adaptee = adaptee;
1654     }
1655
1656     public void actionPerformed(ActionEvent actionEvent) {
1657         adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
1658     }
1659 }