Subversion Repositories svn.mios

Rev

Rev 213 | Rev 666 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
213 tk 1
/*
2
 * @(#)SIDV2librarian.java  beta1   2008/01/21
3
 *
4
 * Copyright (C) 2008    Rutger Vlek (rutgervlek@hotmail.com)
5
 *
6
 * This application is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This application is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this application; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
20
 
21
package org.midibox.sidlibr.gui;
22
 
23
import java.util.Observable;
24
import java.util.Observer;
628 adamjking 25
 
213 tk 26
import javax.swing.JPanel;
27
import javax.swing.JTabbedPane;
628 adamjking 28
import javax.swing.event.ChangeListener;
29
 
213 tk 30
import org.midibox.sidlibr.SIDLibController;
31
 
628 adamjking 32
public class LibraryGUI extends JPanel implements ChangeListener, Observer {
213 tk 33
    private SIDLibController sidLibController;
34
    private JTabbedPane tabbedPane = new JTabbedPane();
35
    private BankTable[] bankTables = new BankTable[7];
628 adamjking 36
    // private EnsBankTable ensBankTable;
37
    private static String[] bankNames = { "A", "B", "C", "D", "E", "F", "G" };
38
 
39
    public LibraryGUI(SIDLibController sidLibController) {
213 tk 40
        this.sidLibController = sidLibController;
628 adamjking 41
        // ensBankTable = new EnsBankTable(sidLibController);
42
        // tabbedPane.addTab("ENS", ensBankTable);
213 tk 43
        for (int c = 0; c < 7; c++) {
628 adamjking 44
            bankTables[c] = new BankTable(sidLibController, c);
213 tk 45
            tabbedPane.addTab(bankNames[c], bankTables[c]);
46
        }
47
        add(tabbedPane);
48
        tabbedPane.addChangeListener(this);
49
    }
628 adamjking 50
 
213 tk 51
    public void stateChanged(javax.swing.event.ChangeEvent e) {
628 adamjking 52
        sidLibController.setCurrentBankNumber(tabbedPane.getSelectedIndex());
53
        int patchNumber = bankTables[tabbedPane.getSelectedIndex()]
54
                .getSelectedRow();
213 tk 55
        if (patchNumber < 0) {
56
            patchNumber = 0;
57
        }
58
        sidLibController.setCurrentPatchNumber(patchNumber);
59
    }
628 adamjking 60
 
213 tk 61
    public void update(Observable observable, Object object) {
628 adamjking 62
 
213 tk 63
    }
64
}