--- jsampler/trunk/src/org/jsampler/view/fantasia/NormalChannelView.java 2008/05/04 18:58:16 1735 +++ jsampler/trunk/src/org/jsampler/view/fantasia/NormalChannelView.java 2008/05/31 23:04:01 1743 @@ -74,7 +74,7 @@ */ public class NormalChannelView extends PixmapPane implements ChannelView { private final Channel channel; - private final ChannelOptionsView channelOptionsView; + private ChannelOptionsView channelOptionsView = null; private final EnhancedDial dialVolume = new EnhancedDial(); private final ChannelScreen screen; @@ -90,19 +90,12 @@ /** Creates a new instance of NormalChannelView */ public NormalChannelView(Channel channel) { - this(channel, new NormalChannelOptionsView(channel)); - } - - /** Creates a new instance of NormalChannelView */ - public - NormalChannelView(Channel channel, ChannelOptionsView channelOptionsView) { super(Res.gfxChannel); setPixmapInsets(new Insets(3, 3, 3, 3)); components.add(this); this.channel = channel; - this.channelOptionsView = channelOptionsView; btnPower = new Channel.PowerButton(channel); components.add(btnPower); @@ -246,9 +239,27 @@ public void uninstallView() { screen.onDestroy(); + btnOptions.onDestroy(); + uninstallChannelOptionsView(); //removeEnhancedMouseListener(channel.getContextMenu()); } + public void + installChannelOptionsView() { + if(channelOptionsView != null) return; + + channelOptionsView = new NormalChannelOptionsView(channel); + channelOptionsView.installView(); + + } + + public void + uninstallChannelOptionsView() { + if(channelOptionsView == null) return; + channelOptionsView.uninstallView(); + channelOptionsView = null; + } + public ChannelOptionsView getChannelOptionsView() { return channelOptionsView; } @@ -269,6 +280,8 @@ dialVolume.setEnabled(b); btnSolo.setEnabled(b); btnMute.setEnabled(b); + + if(getChannelOptionsView() != null) getChannelOptionsView().updateChannelInfo(); } public void @@ -519,6 +532,8 @@ components.add(instrumentPane); add(instrumentPane); + add(Box.createRigidArea(new Dimension(0, 3))); + JPanel p = new JPanel(); components.add(p); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); @@ -647,22 +662,29 @@ protected void updateScreenInfo(SamplerChannel sc) { + String s = btnInstr.getToolTipText(); + int status = sc.getInstrumentStatus(); if(status >= 0 && status < 100) { btnInstr.setText(i18n.getLabel("ChannelScreen.loadingInstrument", status)); + if(s != null) btnInstr.setToolTipText(null); } else if(status == -1) { btnInstr.setText(i18n.getButtonLabel("ChannelScreen.btnInstr")); + if(s != null) btnInstr.setToolTipText(null); } else if(status < -1) { btnInstr.setText(i18n.getLabel("ChannelScreen.errorLoadingInstrument")); + if(s != null) btnInstr.setToolTipText(null); } else { if(sc.getInstrumentName() != null) btnInstr.setText(sc.getInstrumentName()); else btnInstr.setText(i18n.getButtonLabel("ChannelScreen.btnInstr")); + + btnInstr.setToolTipText(sc.getInstrumentName()); } instrumentPane.update(); if(sc.getEngine() != null) { - String s = sc.getEngine().getName(); + s = sc.getEngine().getName(); s += " engine"; if(!s.equals(btnEngine.getText())) { btnEngine.setText(s);