22 |
|
|
23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
|
import java.awt.Container; |
26 |
import java.awt.Cursor; |
import java.awt.Cursor; |
27 |
import java.awt.Dimension; |
import java.awt.Dimension; |
28 |
import java.awt.Graphics; |
import java.awt.Graphics; |
29 |
import java.awt.Insets; |
import java.awt.Insets; |
30 |
|
import java.awt.Rectangle; |
31 |
|
|
32 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
33 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
52 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
53 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
54 |
import javax.swing.JPopupMenu; |
import javax.swing.JPopupMenu; |
55 |
|
import javax.swing.JScrollPane; |
56 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
57 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
58 |
import javax.swing.SwingConstants; |
import javax.swing.SwingConstants; |
274 |
public void |
public void |
275 |
propertyChange(PropertyChangeEvent e) { |
propertyChange(PropertyChangeEvent e) { |
276 |
if(e.getNewValue() == "expanded") { |
if(e.getNewValue() == "expanded") { |
277 |
|
// TODO: this should be done regardles the listener != null? |
278 |
mainPane.removePropertyChangeListener(s, this); |
mainPane.removePropertyChangeListener(s, this); |
279 |
|
/////// |
280 |
listener.actionPerformed(null); |
listener.actionPerformed(null); |
281 |
|
ensureChannelIsVisible(); |
282 |
|
} else if(e.getNewValue() == "expanding/collapsing") { |
283 |
|
ensureChannelIsVisible(); |
284 |
} |
} |
285 |
} |
} |
286 |
}); |
}); |
308 |
CC.getSamplerModel().addSamplerChannelListListener(getHandler()); |
CC.getSamplerModel().addSamplerChannelListListener(getHandler()); |
309 |
} |
} |
310 |
|
|
311 |
|
private void |
312 |
|
ensureChannelIsVisible() { |
313 |
|
Container p = getParent(); |
314 |
|
JScrollPane sp = null; |
315 |
|
while(p != null) { |
316 |
|
if(p instanceof JScrollPane) { |
317 |
|
sp = (JScrollPane)p; |
318 |
|
break; |
319 |
|
} |
320 |
|
p = p.getParent(); |
321 |
|
} |
322 |
|
if(sp == null) return; |
323 |
|
int h = sp.getViewport().getView().getHeight(); |
324 |
|
sp.getViewport().scrollRectToVisible(new Rectangle(0, h - 2, 1, 1)); |
325 |
|
} |
326 |
|
|
327 |
private JPanel |
private JPanel |
328 |
createVSeparator() { |
createVSeparator() { |
329 |
PixmapPane p = new PixmapPane(Res.gfxVLine); |
PixmapPane p = new PixmapPane(Res.gfxVLine); |