Subversion Repositories svn.mios

Rev

Rev 628 | Rev 662 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 628 Rev 641
Line 109... Line 109...
109
    private JButton connectButton;
109
    private JButton connectButton;
110
110
111
    private JButton disconnectButton;
111
    private JButton disconnectButton;
112
112
113
    private JButton disconnectallButton;
113
    private JButton disconnectallButton;
114
-
 
115
    private JButton midiDeviceManagerButton;
-
 
116
-
 
117
    private JButton midiRouterButton;
-
 
118
-
 
119
    private JButton filterButton;
-
 
120
-
 
121
    /*
-
 
122
     * private JButton mapButton;
-
 
123
     */
-
 
124
114
125
    private JToggleButton releaseButton;
115
    private JToggleButton releaseButton;
126
116
127
    private JPanel wirePanel;
117
    private JPanel wirePanel;
128
-
 
129
    private JDialog midiDeviceManagerDialog;
-
 
130
-
 
131
    private JDialog midiRouterManagerGUI;
-
 
132
-
 
133
    private JDialog midiFilterManagerDialog;
-
 
134
118
135
    /*
119
    /*
136
     * private JDialog midiMapManagerDialog;
120
     * private JDialog midiMapManagerDialog;
137
     */
121
     */
138
122
Line 335... Line 319...
335
        gbc.gridx = 0;
319
        gbc.gridx = 0;
336
        gbc.gridy = 0;
320
        gbc.gridy = 0;
337
        gbc.gridwidth = 1;
321
        gbc.gridwidth = 1;
338
        gbc.fill = GridBagConstraints.BOTH;
322
        gbc.fill = GridBagConstraints.BOTH;
339
323
340
        gbc.insets = new Insets(5, 5, 5, 5);
324
        gbc.insets = new Insets(5, 5, 10, 5);
341
325
342
        connectButton = new JButton("Connect");
326
        connectButton = new JButton("Connect");
343
        connectButton.setToolTipText("Connect Selected Devices");
327
        connectButton.setToolTipText("Connect Selected Devices");
344
        connectButton.addActionListener(this);
328
        connectButton.addActionListener(this);
345
        buttonPane.add(connectButton, gbc);
329
        buttonPane.add(connectButton, gbc);
346
        gbc.gridy++;
-
 
347
-
 
348
        gbc.insets = new Insets(5, 5, 10, 5);
-
 
349
-
 
350
        midiDeviceManagerButton = new JButton("Select Devices");
-
 
351
        midiDeviceManagerButton.setToolTipText("Select Hardware Devices");
-
 
352
        midiDeviceManagerButton.addActionListener(this);
-
 
353
        buttonPane.add(midiDeviceManagerButton, gbc);
-
 
354
        gbc.gridx++;
330
        gbc.gridx++;
355
        gbc.gridy--;
-
 
356
331
357
        gbc.insets = new Insets(5, 5, 5, 5);
-
 
358
-
 
359
        gbc.gridwidth = 2;
-
 
360
        disconnectButton = new JButton("Disconnect");
332
        disconnectButton = new JButton("Disconnect");
361
        disconnectButton.setToolTipText("Disconnect Selected Devices");
333
        disconnectButton.setToolTipText("Disconnect Selected Devices");
362
        disconnectButton.addActionListener(this);
334
        disconnectButton.addActionListener(this);
363
        buttonPane.add(disconnectButton, gbc);
335
        buttonPane.add(disconnectButton, gbc);
364
        gbc.gridy++;
-
 
365
-
 
366
        gbc.insets = new Insets(5, 5, 10, 5);
-
 
367
-
 
368
        gbc.gridwidth = 1;
-
 
369
        midiRouterButton = new JButton(ImageLoader
-
 
370
                .getImageIcon("virtualMidiDevice.png"));
-
 
371
        midiRouterButton.setToolTipText("Add/Remove Virtual Ports");
-
 
372
        midiRouterButton.addActionListener(this);
-
 
373
        buttonPane.add(midiRouterButton, gbc);
-
 
374
        gbc.gridx++;
336
        gbc.gridx++;
375
-
 
376
        filterButton = new JButton(ImageLoader.getImageIcon("filter.png"));
-
 
377
        filterButton.setToolTipText("Add/Remove Filters");
-
 
378
        filterButton.addActionListener(this);
-
 
379
        buttonPane.add(filterButton, gbc);
-
 
380
        gbc.gridx++;
-
 
381
-
 
382
        /*
-
 
383
         * gbc.insets = new Insets(5, 4, 10, 5);
-
 
384
         *
-
 
385
         * mapButton = new JButton(ImageLoader.getImageIcon("map.png"));
-
 
386
         * mapButton.setToolTipText("Add/Remove Maps");
-
 
387
         * mapButton.addActionListener(this); mapButton.setMargin(new Insets(2,
-
 
388
         * 8, 2, 8)); buttonPane.add(mapButton, gbc); gbc.gridx++;
-
 
389
         */
-
 
390
-
 
391
        gbc.gridy--;
-
 
392
-
 
393
        gbc.insets = new Insets(5, 5, 5, 5);
-
 
394
337
395
        disconnectallButton = new JButton("Disconnect All");
338
        disconnectallButton = new JButton("Disconnect All");
396
        disconnectallButton.setToolTipText("Disconnect All Devices");
339
        disconnectallButton.setToolTipText("Disconnect All Devices");
397
        disconnectallButton.addActionListener(this);
340
        disconnectallButton.addActionListener(this);
398
        buttonPane.add(disconnectallButton, gbc);
341
        buttonPane.add(disconnectallButton, gbc);
399
        gbc.gridy++;
342
        gbc.gridx++;
400
-
 
401
        gbc.insets = new Insets(5, 5, 10, 5);
-
 
402
343
403
        releaseButton = new JToggleButton("Release Ports", midiDeviceRouting
344
        releaseButton = new JToggleButton("Release Ports", midiDeviceRouting
404
                .getPortsReleased());
345
                .getPortsReleased());
405
        releaseButton.setToolTipText("Release MIDI Ports");
346
        releaseButton.setToolTipText("Release MIDI Ports");
406
        releaseButton.addActionListener(this);
347
        releaseButton.addActionListener(this);
Line 528... Line 469...
528
                }
469
                }
529
            });
470
            });
530
        }
471
        }
531
        ((JDialog) midiDevicePropertiesDialogs.get(midiDevice)).requestFocus();
472
        ((JDialog) midiDevicePropertiesDialogs.get(midiDevice)).requestFocus();
532
    }
473
    }
533
-
 
534
    private void showMidiDeviceManagerDialog() {
-
 
535
        if (midiDeviceManagerDialog == null) {
-
 
536
            final MidiDeviceManagerGUI midiDeviceManagerGUI = new MidiDeviceManagerGUI(
-
 
537
                    midiDeviceRouting.getMidiDeviceManager());
-
 
538
-
 
539
            midiDeviceManagerDialog = new JDialog(DialogOwner.getFrame(),
-
 
540
                    "MIDI Devices", false);
-
 
541
            midiDeviceManagerDialog.setContentPane(midiDeviceManagerGUI);
-
 
542
            midiDeviceManagerDialog.pack();
-
 
543
            midiDeviceManagerDialog.setLocationRelativeTo(this);
-
 
544
            midiDeviceManagerDialog.setVisible(true);
-
 
545
-
 
546
            midiDeviceManagerDialog.addWindowListener(new WindowAdapter() {
-
 
547
                public void windowClosing(WindowEvent we) {
-
 
548
                    midiDeviceRouting.getMidiDeviceManager().deleteObserver(
-
 
549
                            midiDeviceManagerGUI);
-
 
550
                    midiDeviceManagerDialog = null;
-
 
551
                }
-
 
552
            });
-
 
553
        }
-
 
554
        midiDeviceManagerDialog.requestFocus();
-
 
555
    }
-
 
556
-
 
557
    private void showMidiRouterManagerDialog() {
-
 
558
        if (midiRouterManagerGUI == null) {
-
 
559
            final MidiRouterDeviceManagerGUI midiRouterDeviceManagerGUI = new MidiRouterDeviceManagerGUI(
-
 
560
                    midiDeviceRouting.getMidiRouterDeviceManager());
-
 
561
-
 
562
            midiRouterManagerGUI = new JDialog(DialogOwner.getFrame(),
-
 
563
                    "Virtual Ports", false);
-
 
564
            midiRouterManagerGUI.setContentPane(midiRouterDeviceManagerGUI);
-
 
565
            midiRouterManagerGUI.pack();
-
 
566
            midiRouterManagerGUI.setLocationRelativeTo(this);
-
 
567
            midiRouterManagerGUI.setVisible(true);
-
 
568
-
 
569
            midiRouterManagerGUI.addWindowListener(new WindowAdapter() {
-
 
570
                public void windowClosing(WindowEvent we) {
-
 
571
                    midiDeviceRouting.getMidiRouterDeviceManager()
-
 
572
                            .deleteObserver(midiRouterDeviceManagerGUI);
-
 
573
                    midiRouterManagerGUI = null;
-
 
574
                }
-
 
575
            });
-
 
576
        }
-
 
577
        midiRouterManagerGUI.requestFocus();
-
 
578
    }
-
 
579
-
 
580
    private void showFilterManagerDialog() {
-
 
581
        if (midiFilterManagerDialog == null) {
-
 
582
            final MidiFilterDeviceManagerGUI midiFilterManagerGUI = new MidiFilterDeviceManagerGUI(
-
 
583
                    midiDeviceRouting.getMidiFilterManager());
-
 
584
-
 
585
            midiFilterManagerDialog = new JDialog(DialogOwner.getFrame(),
-
 
586
                    "Filters", false);
-
 
587
            midiFilterManagerDialog.setContentPane(midiFilterManagerGUI);
-
 
588
            midiFilterManagerDialog.pack();
-
 
589
            midiFilterManagerDialog.setLocationRelativeTo(this);
-
 
590
            midiFilterManagerDialog.setVisible(true);
-
 
591
-
 
592
            midiFilterManagerDialog.addWindowListener(new WindowAdapter() {
-
 
593
                public void windowClosing(WindowEvent we) {
-
 
594
                    midiDeviceRouting.getMidiFilterManager().deleteObserver(
-
 
595
                            midiFilterManagerGUI);
-
 
596
                    midiFilterManagerDialog = null;
-
 
597
                }
-
 
598
            });
-
 
599
        }
-
 
600
        midiFilterManagerDialog.requestFocus();
-
 
601
    }
-
 
602
-
 
603
    /*
-
 
604
     * private void showMapManagerDialog() { if (midiMapManagerDialog == null) {
-
 
605
     * final MidiMapDeviceManagerGUI midiMapManagerGUI = new
-
 
606
     * MidiMapDeviceManagerGUI( midiDeviceRouting.getMidiMapManager());
-
 
607
     *
-
 
608
     * midiMapManagerDialog = new JDialog();
-
 
609
     * midiMapManagerDialog.setModal(false);
-
 
610
     * midiMapManagerDialog.setTitle("Maps");
-
 
611
     * midiMapManagerDialog.setContentPane(midiMapManagerGUI);
-
 
612
     * midiMapManagerDialog.pack();
-
 
613
     * midiMapManagerDialog.setLocationRelativeTo(this);
-
 
614
     * midiMapManagerDialog.setVisible(true);
-
 
615
     *
-
 
616
     * midiMapManagerDialog.addWindowListener(new WindowAdapter() { public void
-
 
617
     * windowClosing(WindowEvent we) {
-
 
618
     * midiDeviceRouting.getMidiMapManager().deleteObserver( midiMapManagerGUI);
-
 
619
     * midiMapManagerDialog = null; } }); } midiMapManagerDialog.requestFocus();
-
 
620
     * }
-
 
621
     */
-
 
622
474
623
    private void populateTrees() {
475
    private void populateTrees() {
624
476
625
        midiReadDevicesListModel.removeAllElements();
477
        midiReadDevicesListModel.removeAllElements();
626
478
Line 779... Line 631...
779
                            receivingDevice);
631
                            receivingDevice);
780
                }
632
                }
781
            }
633
            }
782
        } else if (source == disconnectallButton) {
634
        } else if (source == disconnectallButton) {
783
            midiDeviceRouting.disconnectAll();
635
            midiDeviceRouting.disconnectAll();
784
        } else if (source == midiDeviceManagerButton) {
-
 
785
            showMidiDeviceManagerDialog();
-
 
786
        } else if (source == midiRouterButton) {
-
 
787
            showMidiRouterManagerDialog();
-
 
788
        } else if (source == filterButton) {
-
 
789
            showFilterManagerDialog();
-
 
790
        } /*
-
 
791
         * else if (source == mapButton) { showMapManagerDialog(); }
-
 
792
         */
-
 
793
        else if (source == releaseButton) {
636
        } else if (source == releaseButton) {
794
            midiDeviceRouting.setPortsReleased(releaseButton.isSelected());
637
            midiDeviceRouting.setPortsReleased(releaseButton.isSelected());
795
        }
638
        }
796
    }
639
    }
797
640
798
    public class MyListCellRenderer extends DefaultListCellRenderer {
641
    public class MyListCellRenderer extends DefaultListCellRenderer {