final Preferences prefs = AbstractApplication.getApplication().getUserPrefs();
final CatchAction actionCatch;
final EditModeAction actionEditMode;
final AbstractButton button;
final BlendingAction actionBlending;
ToolAction toolAction;
JToggleButton toggle;
ButtonGroup bg;
Enumeration en;
actionCatch = new CatchAction( prefs ); // .node( PrefsUtil.NODE_SHARED ));
toggle = actionCatch.getButton();
// root.menuFactory.addGlobalKeyCommand( new DoClickAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_V, 0 )));
GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_V, 0 ));
// HelpGlassPane.setHelp( toggle, "ToolCatch" );
addToggleButton( toggle, 2 );
addSeparator();
actionEditMode = new EditModeAction( doc );
bg = actionEditMode.getButtons();
en = bg.getElements();
for( int i = 0; en.hasMoreElements(); i++ ) {
toggle = (JToggleButton) en.nextElement();
GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F1 + i, 0 ));
addToggleButton( toggle, 3 );
}
addSeparator();
toolAction = new ToolAction( ToolAction.POINTER );
toggle = new JToggleButton( toolAction );
toolAction.setIcons( toggle );
GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F5, 0 ));
// HelpGlassPane.setHelp( toggle, "TimelineToolPointer" );
addToggleButton( toggle, 0 );
mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
// toolAction = new ToolAction( ToolAction.LINE );
// toggle = new JToggleButton( toolAction );
// toolAction.setIcons( toggle );
// GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F6, 0 ));
//// HelpGlassPane.setHelp( toggle, "TimelineToolLine" );
//toolAction.setEnabled( false ); // XXX not yet implemented
// addToggleButton( toggle, 0 );
// mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
//
// toolAction = new ToolAction( ToolAction.PENCIL );
// toggle = new JToggleButton( toolAction );
// toolAction.setIcons( toggle );
// GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F7, 0 ));
//// HelpGlassPane.setHelp( toggle, "TimelineToolPencil" );
//toolAction.setEnabled( false ); // XXX not yet implemented
// addToggleButton( toggle, 0 );
// mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
toolAction = new ToolAction( ToolAction.ZOOM );
toggle = new JToggleButton( toolAction );
toolAction.setIcons( toggle );
GUIUtil.createKeyAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_F6, 0 ));
// HelpGlassPane.setHelp( toggle, "TimelineToolZoom" );
addToggleButton( toggle, 0 );
mapToolButtons.put( new Integer( toolAction.getID() ), toggle );
addSeparator();
actionBlending = doc.getBlendingAction();
button = actionBlending.getButton();
// root.menuFactory.addGlobalKeyCommand( new DoClickAction( toggle, KeyStroke.getKeyStroke( KeyEvent.VK_CAPS_LOCK, 0 )));
GUIUtil.createKeyAction( button, KeyStroke.getKeyStroke( KeyEvent.VK_CAPS_LOCK, 0 ));
// ... DOESN'T WORK
// try {
// final Robot r = new Robot();
// button.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW ).put( KeyStroke.getKeyStroke( KeyEvent.VK_CAPS_LOCK, 0 ), "shortcut" );
// button.getActionMap().put( "shortcut", new DoClickAction( button ) {
// public void validActionPerformed( ActionEvent e )
// {
// super.validActionPerformed( e );
// r.keyRelease( KeyEvent.VK_CAPS_LOCK );
// r.keyPress( KeyEvent.VK_CAPS_LOCK );
// r.keyRelease( KeyEvent.VK_CAPS_LOCK );
// }
// });
// }
// catch( AWTException e1 ) { /* ignored */ }
//final JComboBox ggCombo = new JComboBox() {
// public void setBackground( Color c )
// {
// setOpaque( (c != null) && (c.getAlpha() == 0xFF) );
// super.setBackground( c );
// }
//
// public void paintComponent( Graphics g )
// {
//// final Color bg = getBackground();
// final Color bg = Color.red;
//// getParent().paint( g );
//// ((JComponent) getParent()).paintComponent( g );
// if( (bg != null) && (bg.getAlpha() > 0) ) {
// g.setColor( bg );
// g.fillRect( 0, 0, getWidth(), getHeight() );
// }
// super.paintComponent( g );
// }
//};
//final JComboBox ggCombo = new JComboBox();
add( actionBlending.getComboBox() );
// final MultiStateButton ggBlendHisto = new MultiStateButton();
// ggBlendHisto.setNumColumns( 3 );
//// ggBlendHisto.addItem( "V", Color.black, new Color( 0xA3, 0xB6, 0xCC )); // Hue: 0.5952 = graphite