OSDN Git Service

ffmpegオプションパネルのイベント処理
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
index 2a058c0..082b46a 100644 (file)
@@ -330,6 +330,19 @@ public class MainFrame extends JFrame {
         pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(false);
         pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(false);
         pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(false);
+        pnlInputFfmpeg.cmbFfmpegOptionFile.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                final boolean notFile = !pnlInputFfmpeg.mdlFfmpegOption.isFile();
+                pnlInputFfmpeg.fldFfmpegOptionExtension.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionMain.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionIn.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionOut.setEnabled(notFile);
+                pnlInputFfmpeg.fldFfmpegOptionAv.setEnabled(notFile);
+                pnlInputFfmpeg.cbFfmpegOptionResize.setEnabled(notFile);
+            }
+        });
         pnlInputFfmpeg.cbFfmpegOptionResize.addItemListener(new ItemListener() {
 
             @Override
@@ -340,6 +353,17 @@ public class MainFrame extends JFrame {
                 pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(selected);
             }
         });
+        pnlInputFfmpeg.cbFfmpegOptionResize.addPropertyChangeListener("enabled", new PropertyChangeListener() {
+
+            @Override
+            public void propertyChange(PropertyChangeEvent evt) {
+                final boolean enabled = ((Boolean) evt.getNewValue()).booleanValue();
+                final boolean fldEnabled = enabled ? pnlInputFfmpeg.cbFfmpegOptionResize.isSelected() : false;
+                pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(fldEnabled);
+                pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(fldEnabled);
+                pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(fldEnabled);
+            }
+        });
 
 
         tbpInput.add("メイン", pnlInputMain);