From e9667142d037433d19c20145cea8fa103c648b08 Mon Sep 17 00:00:00 2001 From: frauzufall Date: Fri, 24 Jan 2020 14:47:55 +0100 Subject: [PATCH 1/5] Generalize options card, adjust icons --- src/main/java/bdv/ui/BdvDefaultCards.java | 30 +- .../ui/iconcards/options/BdvIconOptions.java | 152 +++++++++++ .../options/DefaultIconOptionsCard.java | 148 ++++++++++ .../ui/iconcards/options/IconOptionsCard.java | 22 ++ .../ui/viewermodepanel/ViewerModesModel.java | 9 +- .../ui/viewermodepanel/ViewerModesPanel.java | 256 ------------------ src/main/java/bdv/viewer/ViewerFrame.java | 3 +- .../bdv/ui/viewermodepanel/fusion_mode.png | Bin 2244 -> 708 bytes .../bdv/ui/viewermodepanel/fusion_mode.svg | 100 +++---- .../bdv/ui/viewermodepanel/grouping_mode.png | Bin 2652 -> 1356 bytes .../bdv/ui/viewermodepanel/grouping_mode.svg | 91 ++----- .../bdv/ui/viewermodepanel/linear.png | Bin 696 -> 430 bytes .../bdv/ui/viewermodepanel/linear.svg | 51 ++-- .../bdv/ui/viewermodepanel/nearest.png | Bin 674 -> 382 bytes .../bdv/ui/viewermodepanel/nearest.svg | 74 ++--- .../bdv/ui/viewermodepanel/rotation_off.png | Bin 754 -> 969 bytes .../bdv/ui/viewermodepanel/rotation_off.svg | 16 +- .../bdv/ui/viewermodepanel/rotation_on.png | Bin 823 -> 957 bytes .../bdv/ui/viewermodepanel/rotation_on.svg | 14 +- .../bdv/ui/viewermodepanel/single_mode.png | Bin 1972 -> 803 bytes .../bdv/ui/viewermodepanel/single_mode.svg | 65 ++--- .../bdv/ui/viewermodepanel/source_mode.png | Bin 2257 -> 1462 bytes .../bdv/ui/viewermodepanel/source_mode.svg | 85 +++--- .../ui/viewermodepanel/translation_off.png | Bin 747 -> 635 bytes .../ui/viewermodepanel/translation_off.svg | 20 +- .../bdv/ui/viewermodepanel/translation_on.png | Bin 480 -> 619 bytes .../bdv/ui/viewermodepanel/translation_on.svg | 20 +- 27 files changed, 542 insertions(+), 614 deletions(-) create mode 100644 src/main/java/bdv/ui/iconcards/options/BdvIconOptions.java create mode 100644 src/main/java/bdv/ui/iconcards/options/DefaultIconOptionsCard.java create mode 100644 src/main/java/bdv/ui/iconcards/options/IconOptionsCard.java delete mode 100644 src/main/java/bdv/ui/viewermodepanel/ViewerModesPanel.java diff --git a/src/main/java/bdv/ui/BdvDefaultCards.java b/src/main/java/bdv/ui/BdvDefaultCards.java index ff64041c5..e39eb88fd 100644 --- a/src/main/java/bdv/ui/BdvDefaultCards.java +++ b/src/main/java/bdv/ui/BdvDefaultCards.java @@ -1,25 +1,21 @@ package bdv.ui; import bdv.ui.convertersetupeditor.ConverterSetupEditPanel; +import bdv.ui.iconcards.options.BdvIconOptions; +import bdv.ui.iconcards.options.DefaultIconOptionsCard; import bdv.ui.sourcegrouptree.SourceGroupTree; import bdv.ui.sourcetable.SourceTable; -import bdv.ui.viewermodepanel.ViewerModesPanel; import bdv.viewer.ConverterSetups; import bdv.viewer.SynchronizedViewerState; import bdv.viewer.ViewerPanel; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Insets; -import java.awt.KeyboardFocusManager; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JScrollPane; +import org.scijava.ui.behaviour.util.TriggerBehaviourBindings; + +import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.tree.TreeSelectionModel; -import org.scijava.ui.behaviour.util.TriggerBehaviourBindings; +import java.awt.*; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; /** * Default cards added to the card panel. @@ -38,7 +34,7 @@ public class BdvDefaultCards public static final String DEFAULT_VIEWERMODES_CARD = "default bdv viewer modes card"; - public static void setup( final CardPanel cards, final ViewerPanel viewer, final ConverterSetups converterSetups, final TriggerBehaviourBindings triggerbindings ) + public static void addSourcesAndGroups(final CardPanel cards, final ViewerPanel viewer, final ConverterSetups converterSetups, final TriggerBehaviourBindings triggerbindings ) { final SynchronizedViewerState state = viewer.state(); @@ -130,8 +126,14 @@ else if ( component == tablePanel ) } } ); - cards.addCard( DEFAULT_VIEWERMODES_CARD, "Viewer Modes", new ViewerModesPanel( viewer.state(), triggerbindings ), true, new Insets( 0, 4, 0, 0 ) ); cards.addCard( DEFAULT_SOURCES_CARD, "Sources", tablePanel, true, new Insets( 0, 4, 0, 0 ) ); cards.addCard( DEFAULT_SOURCEGROUPS_CARD, "Groups", treePanel, true, new Insets( 0, 4, 0, 0 ) ); } + + public static void addOptions( CardPanel cards, ViewerPanel viewer, TriggerBehaviourBindings triggerbindings ) + { + DefaultIconOptionsCard optionsCard = new DefaultIconOptionsCard(); + BdvIconOptions.addToCard( viewer.state(), triggerbindings, optionsCard ); + cards.addCard( DEFAULT_VIEWERMODES_CARD, "Options", optionsCard, true, new Insets( 0, 4, 0, 0 ) ); + } } diff --git a/src/main/java/bdv/ui/iconcards/options/BdvIconOptions.java b/src/main/java/bdv/ui/iconcards/options/BdvIconOptions.java new file mode 100644 index 000000000..12330ce8c --- /dev/null +++ b/src/main/java/bdv/ui/iconcards/options/BdvIconOptions.java @@ -0,0 +1,152 @@ +package bdv.ui.iconcards.options; + +import bdv.ui.viewermodepanel.ViewerModesModel; +import bdv.viewer.Interpolation; +import bdv.viewer.SynchronizedViewerState; +import bdv.viewer.ViewerState; +import org.scijava.ui.behaviour.util.TriggerBehaviourBindings; + +import java.net.URL; + +/** + * @author Tim-Oliver Buchholz, CSBD/MPI-CBG, Dresden + * @author Deborah Schmidt, CSBD/MPI-CBG, Dresden + */ +public class BdvIconOptions implements ViewerModesModel.ViewerModeListener +{ + + private final ViewerModesModel viewerModesModel; + + private final IconOptionsCard card; + + public final static String OPTIONS_GROUP_DISPLAYMODES = "Display Modes"; + + public final static String OPTIONS_GROUP_NAVIGATION = "Navigation"; + + private static String OPTIONS_FUSION = "fusion"; + + private static String OPTIONS_FUSION_SINGLE = "Single"; + + private static String OPTIONS_FUSION_FUSED = "Fused"; + + private static String OPTIONS_GROUPING = "grouping"; + + private static String OPTIONS_GROUPING_GROUPED = "Group"; + + private static String OPTIONS_GROUPING_SOURCE = "Source"; + + private static String OPTIONS_INTERPOLATION = "interpolation"; + + private static String OPTIONS_INTERPOLATION_NEAREST = "Nearest"; + + private static String OPTIONS_INTERPOLATION_LINEAR = "Linear"; + + private static String OPTIONS_TRANSLATION = "translation"; + + private static String OPTIONS_TRANSLATION_ON = "translation on"; + + private static String OPTIONS_TRANSLATION_OFF = "translation off"; + + private static String OPTIONS_ROTATION = "rotation"; + + private static String OPTIONS_ROTATION_ON = "rotation on"; + + private static String OPTIONS_ROTATION_OFF = "rotation off"; + + public BdvIconOptions( final ViewerState state, final TriggerBehaviourBindings triggerBindings, final IconOptionsCard card ) + { + viewerModesModel = new ViewerModesModel( state, triggerBindings ); + viewerModesModel.addViewerModeListener( this ); + this.card = card; + createFusionChoices(); + createGroupingChoices(); + createInterpolationChoices(); + createTranslationChoices(); + createRotationChoices(); + } + + public static void addToCard( SynchronizedViewerState state, TriggerBehaviourBindings triggerbindings, DefaultIconOptionsCard card ) + { + new BdvIconOptions( state, triggerbindings, card ); + } + + private void createRotationChoices() + { + final URL rotation_on = this.getClass().getResource( "/bdv/ui/viewermodepanel/rotation_on.png" ); + final URL rotation_off = this.getClass().getResource( "/bdv/ui/viewermodepanel/rotation_off.png" ); + card.addOptionChoice( OPTIONS_GROUP_NAVIGATION, OPTIONS_ROTATION, OPTIONS_ROTATION_OFF, viewerModesModel::blockRotation, rotation_off ); + card.addOptionChoice( OPTIONS_GROUP_NAVIGATION, OPTIONS_ROTATION, OPTIONS_ROTATION_ON, viewerModesModel::unblockRotation, rotation_on ); + card.setSelected( OPTIONS_GROUP_NAVIGATION, OPTIONS_ROTATION, OPTIONS_ROTATION_ON ); + } + + private void createTranslationChoices() + { + final URL translation_on = this.getClass().getResource( "/bdv/ui/viewermodepanel/translation_on.png" ); + final URL translation_off = this.getClass().getResource( "/bdv/ui/viewermodepanel/translation_off.png" ); + card.addOptionChoice( OPTIONS_GROUP_NAVIGATION, OPTIONS_TRANSLATION, OPTIONS_TRANSLATION_OFF, viewerModesModel::blockTranslation, translation_off ); + card.addOptionChoice( OPTIONS_GROUP_NAVIGATION, OPTIONS_TRANSLATION, OPTIONS_TRANSLATION_ON, viewerModesModel::unblockTranslation, translation_on ); + card.setSelected( OPTIONS_GROUP_NAVIGATION, OPTIONS_TRANSLATION, OPTIONS_TRANSLATION_ON ); + } + + private void createInterpolationChoices() + { + final URL nearest_icon = this.getClass().getResource( "/bdv/ui/viewermodepanel/nearest.png" ); + final URL linear_icon = this.getClass().getResource( "/bdv/ui/viewermodepanel/linear.png" ); + Runnable linearAction = () -> viewerModesModel.setInterpolation( Interpolation.NLINEAR ); + Runnable nearestAction = () -> viewerModesModel.setInterpolation( Interpolation.NEARESTNEIGHBOR ); + card.addOptionChoice( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_INTERPOLATION, OPTIONS_INTERPOLATION_LINEAR, linearAction, linear_icon ); + card.addOptionChoice( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_INTERPOLATION, OPTIONS_INTERPOLATION_NEAREST, nearestAction, nearest_icon ); + interpolationMode( Interpolation.NLINEAR ); + } + + private void createGroupingChoices() + { + final URL grouping_icon = this.getClass().getResource( "/bdv/ui/viewermodepanel/grouping_mode.png" ); + final URL source_icon = this.getClass().getResource( "/bdv/ui/viewermodepanel/source_mode.png" ); + card.addOptionChoice( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_GROUPING, OPTIONS_GROUPING_SOURCE, () -> viewerModesModel.setGrouping( false ), source_icon ); + card.addOptionChoice( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_GROUPING, OPTIONS_GROUPING_GROUPED, () -> viewerModesModel.setGrouping( true ), grouping_icon ); + sourceMode(); + } + + private void createFusionChoices() + { + final URL fusion_icon = this.getClass().getResource( "/bdv/ui/viewermodepanel/fusion_mode.png" ); + final URL single_icon = this.getClass().getResource( "/bdv/ui/viewermodepanel/single_mode.png" ); + card.addOptionChoice( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_FUSION, OPTIONS_FUSION_SINGLE, () -> viewerModesModel.setFused( false ), single_icon ); + card.addOptionChoice( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_FUSION, OPTIONS_FUSION_FUSED, () -> viewerModesModel.setFused( true ), fusion_icon ); + singleMode(); + } + + @Override + public void fusedMode() + { + card.setSelected( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_FUSION, OPTIONS_FUSION_FUSED ); + } + + @Override + public void singleMode() + { + card.setSelected( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_FUSION, OPTIONS_FUSION_SINGLE ); + } + + @Override + public void sourceMode() + { + card.setSelected( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_GROUPING, OPTIONS_GROUPING_SOURCE ); + } + + @Override + public void groupMode() + { + card.setSelected( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_GROUPING, OPTIONS_GROUPING_GROUPED ); + } + + @Override + public void interpolationMode( Interpolation interpolation_mode ) + { + if ( interpolation_mode.equals( Interpolation.NLINEAR ) ) + card.setSelected( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_INTERPOLATION, OPTIONS_INTERPOLATION_LINEAR ); + if ( interpolation_mode.equals( Interpolation.NEARESTNEIGHBOR ) ) + card.setSelected( OPTIONS_GROUP_DISPLAYMODES, OPTIONS_INTERPOLATION, OPTIONS_INTERPOLATION_NEAREST ); + } +} diff --git a/src/main/java/bdv/ui/iconcards/options/DefaultIconOptionsCard.java b/src/main/java/bdv/ui/iconcards/options/DefaultIconOptionsCard.java new file mode 100644 index 000000000..4a6683f32 --- /dev/null +++ b/src/main/java/bdv/ui/iconcards/options/DefaultIconOptionsCard.java @@ -0,0 +1,148 @@ +package bdv.ui.iconcards.options; + +import net.miginfocom.swing.MigLayout; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Deborah Schmidt, CSBD/MPI-CBG, Dresden + */ +public class DefaultIconOptionsCard extends JPanel implements IconOptionsCard +{ + + int iconSize = 40; + + class OptionGroup + { + JPanel panel; + + final Map options = new HashMap<>(); + } + + class Option + { + final Map choices = new HashMap<>(); + + public JPopupMenu menu; + + JButton button; + } + + private final Map groups = new HashMap<>(); + + public DefaultIconOptionsCard() + { + setLayout( new MigLayout( "fillx, nogrid, ins n 0 n 0, gap 0" ) ); + setBackground( null ); + setOpaque( false ); + setForeground( Color.lightGray ); + } + + public void addGroup( String optionGroup ) + { + final JPanel panel = new JPanel( new MigLayout( "ins 0, fillx, filly", "", "top" ) ); + panel.setBackground( null ); + panel.setOpaque( false ); + panel.add( new JLabel( optionGroup ), "span 3, growx, center, wrap" ); + OptionGroup optionSet = new OptionGroup(); + optionSet.panel = panel; + groups.put( optionGroup, optionSet ); + add( panel ); + } + + @Override + public void removeGroup( String optionGroup ) + { + remove( groups.get( optionGroup ).panel ); + groups.remove( optionGroup ); + } + + @Override + public void addOptionChoice( String optionGroupName, String optionName, String choiceName, Runnable action, URL iconURL ) + { + if ( !groups.containsKey( optionGroupName ) ) + addGroup( optionGroupName ); + OptionGroup optionGroup = groups.get( optionGroupName ); + Option option = optionGroup.options.get( optionName ); + if ( option == null ) + option = addOption( optionName, optionGroup ); + ImageIcon icon = new ImageIcon( iconURL ); + option.choices.put( choiceName, icon ); + JMenuItem menuItem = new JMenuItem( new AbstractAction( choiceName ) + { + @Override + public void actionPerformed( ActionEvent actionEvent ) + { + action.run(); + } + } ); + Image newimg = icon.getImage().getScaledInstance( 20, 20, java.awt.Image.SCALE_SMOOTH ); + ImageIcon scaledIcon = new ImageIcon( newimg ); + menuItem.setIcon( scaledIcon ); + option.menu.add( menuItem ); + Option finalOption = option; + menuItem.addActionListener( actionEvent -> { + finalOption.button.setIcon( icon ); + finalOption.button.setToolTipText( createToolTipText( finalOption.choices, choiceName ) ); + } ); + } + + private Option addOption( String optionName, OptionGroup optionGroup ) + { + Option option; + option = new Option(); + optionGroup.options.put( optionName, option ); + JButton btn = new JButton(); + option.button = btn; + JPopupMenu menu = new JPopupMenu( optionName ); + option.menu = menu; + btn.addMouseListener( new MouseAdapter() + { + @Override + public void mouseClicked( MouseEvent mouseEvent ) + { + menu.show( btn, mouseEvent.getX(), mouseEvent.getY() ); + } + } ); + setLook( btn ); + optionGroup.panel.add( btn ); + return option; + } + + @Override + public void setSelected( String optionGroup, String optionName, String choiceName ) + { + Option option = groups.get( optionGroup ).options.get( optionName ); + ImageIcon choice = option.choices.get( choiceName ); + option.button.setIcon( choice ); + option.button.setToolTipText( createToolTipText( option.choices, choiceName ) ); + } + + private String createToolTipText( Map optionChoices, String currentChoice ) + { + return currentChoice; + } + + private void setLook( final JButton button ) + { + button.setMaximumSize( new Dimension( iconSize, iconSize ) ); + button.setBackground( Color.white ); + button.setBorderPainted( false ); + // button.setFocusPainted( false ); + // button.setContentAreaFilled( false ); + } + + @Override + public void removeOption( String optionGroup, String optionName ) + { + + } +} + diff --git a/src/main/java/bdv/ui/iconcards/options/IconOptionsCard.java b/src/main/java/bdv/ui/iconcards/options/IconOptionsCard.java new file mode 100644 index 000000000..a68d23fcd --- /dev/null +++ b/src/main/java/bdv/ui/iconcards/options/IconOptionsCard.java @@ -0,0 +1,22 @@ +package bdv.ui.iconcards.options; + +import java.net.URL; + +/** + * A card storing options in groups. + * Each option can have multiple choices, each choice linked to an action. + * + * @author Deborah Schmidt, CSBD/MPI-CBG, Dresden + */ +public interface IconOptionsCard +{ + + void addOptionChoice( String optionGroup, String optionName, String choiceName, Runnable action, URL iconURL ); + + void setSelected( String optionGroup, String optionName, String choiceName ); + + void removeOption( String optionGroup, String optionName ); + + void removeGroup( String optionGroup ); + +} diff --git a/src/main/java/bdv/ui/viewermodepanel/ViewerModesModel.java b/src/main/java/bdv/ui/viewermodepanel/ViewerModesModel.java index 7a062c3c7..9bb8e4d16 100644 --- a/src/main/java/bdv/ui/viewermodepanel/ViewerModesModel.java +++ b/src/main/java/bdv/ui/viewermodepanel/ViewerModesModel.java @@ -4,8 +4,10 @@ import bdv.viewer.Interpolation; import bdv.viewer.ViewerState; import bdv.viewer.ViewerStateChange; + import java.util.ArrayList; import java.util.List; + import org.scijava.ui.behaviour.Behaviour; import org.scijava.ui.behaviour.BehaviourMap; import org.scijava.ui.behaviour.util.TriggerBehaviourBindings; @@ -30,7 +32,7 @@ public class ViewerModesModel private BehaviourMap blockTranslationBehaviourMap; - private final List< ViewerModeListener > viewerModeListeners = new ArrayList<>(); + private final List viewerModeListeners = new ArrayList<>(); /** * Keeps track of the current viewer state and handles the transformation blocking. @@ -45,7 +47,8 @@ public ViewerModesModel( final ViewerState state, final TriggerBehaviourBindings if ( e == ViewerStateChange.DISPLAY_MODE_CHANGED ) { changeDisplayMode(); - } else if ( e == ViewerStateChange.INTERPOLATION_CHANGED ) + } + else if ( e == ViewerStateChange.INTERPOLATION_CHANGED ) { fireInterpolationMode( state.getInterpolation() ); } @@ -272,7 +275,7 @@ public void setInterpolation( final Interpolation interpolation_mode ) state.setInterpolation( interpolation_mode ); } - interface ViewerModeListener + public interface ViewerModeListener { void fusedMode(); diff --git a/src/main/java/bdv/ui/viewermodepanel/ViewerModesPanel.java b/src/main/java/bdv/ui/viewermodepanel/ViewerModesPanel.java deleted file mode 100644 index 471be26c9..000000000 --- a/src/main/java/bdv/ui/viewermodepanel/ViewerModesPanel.java +++ /dev/null @@ -1,256 +0,0 @@ -package bdv.ui.viewermodepanel; - -import bdv.viewer.Interpolation; -import bdv.viewer.ViewerState; -import java.awt.Color; -import java.awt.Dimension; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JToggleButton; -import net.miginfocom.swing.MigLayout; -import org.scijava.ui.behaviour.util.TriggerBehaviourBindings; - -/** - * This panel adds buttons to toggle fused- and grouped-mode. - * Additionally two button to block translation and rotation are - * added. - * - * @author Tim-Oliver Buchholz, CSBD/MPI-CBG, Dresden - */ -public class ViewerModesPanel extends JPanel implements ViewerModesModel.ViewerModeListener -{ - - private static final String SINGLE_MODE_TOOL_TIP = "Single/Fused"; - - private static final String FUSED_MODE_TOOL_TIP = "Single/Fused"; - - private static final String GROUP_MODE_TOOL_TIP = "Source/Group"; - - private static final String SOURCE_MODE_TOOL_TIP = "Source/Group"; - - private static final String NEAREST_INTERPOLATION_TOOL_TIP = "Nearest/Linear"; - - private static final String LINEAR_INTERPOLATION_TOOL_TIP = "Nearest/Linear"; - - private static final String TRANSLATION_ACTIVE_TOOL_TIP = "Translation"; - - private static final String TRANSLATION_INACTIVE_TOOL_TIP = "Translation"; - - private static final String ROTATION_ACTIVE_TOOL_TIP = "Rotation"; - - private static final String ROTATION_INACTIVE_TOOL_TIP = "Rotation { - if ( fusion.getModel().isSelected() ) - { - fusion.setIcon( fusion_icon ); - fusion.setToolTipText( FUSED_MODE_TOOL_TIP ); - } - else - { - fusion.setIcon( single_icon ); - fusion.setToolTipText( SINGLE_MODE_TOOL_TIP ); - } - } ); - fusion.addActionListener( e -> { - viewerModesModel.setFused( fusion.getModel().isSelected() ); - } ); - } - - private void setupGroupedModeButton() - { - final Icon grouping_icon = new ImageIcon( this.getClass().getResource( "grouping_mode.png" ) ); - final Icon source_icon = new ImageIcon( this.getClass().getResource( "source_mode.png" ) ); - - grouping.setIcon( source_icon ); - grouping.setToolTipText( SOURCE_MODE_TOOL_TIP ); - setLook( grouping ); - grouping.getModel().addChangeListener( e -> { - if ( grouping.getModel().isSelected() ) - { - grouping.setIcon( grouping_icon ); - grouping.setToolTipText( GROUP_MODE_TOOL_TIP ); - } - else - { - grouping.setIcon( source_icon ); - grouping.setToolTipText( SOURCE_MODE_TOOL_TIP ); - } - } ); - grouping.addActionListener( e -> { - viewerModesModel.setGrouping( grouping.getModel().isSelected() ); - } ); - } - - private void setupInterpolationModeButton() - { - final Icon nearest_icon = new ImageIcon( this.getClass().getResource( "nearest.png" ) ); - final Icon linear_icon = new ImageIcon( this.getClass().getResource( "linear.png" ) ); - - interpolation.setIcon( nearest_icon ); - interpolation.setToolTipText( NEAREST_INTERPOLATION_TOOL_TIP ); - setLook( interpolation ); - interpolation.getModel().addChangeListener( e -> { - if ( interpolation.getModel().isSelected() ) - { - interpolation.setIcon( linear_icon ); - interpolation.setToolTipText( LINEAR_INTERPOLATION_TOOL_TIP ); - viewerModesModel.setInterpolation( Interpolation.NLINEAR ); - } else - { - interpolation.setIcon( nearest_icon ); - interpolation.setToolTipText( NEAREST_INTERPOLATION_TOOL_TIP ); - viewerModesModel.setInterpolation( Interpolation.NEARESTNEIGHBOR ); - } - } ); - } - - private void setupTranslationBlockButton() - { - final Icon translation_on = new ImageIcon( this.getClass().getResource( "translation_on.png" ) ); - final Icon translation_off = new ImageIcon( this.getClass().getResource( "translation_off.png" ) ); - - translation.setIcon( translation_on ); - translation.setToolTipText( TRANSLATION_ACTIVE_TOOL_TIP ); - setLook( translation ); - translation.addActionListener( e -> { - if ( translation.getModel().isSelected() ) - { - translation.setIcon( translation_off ); - translation.setToolTipText( TRANSLATION_INACTIVE_TOOL_TIP ); - viewerModesModel.blockTranslation(); - } - else - { - translation.setIcon( translation_on ); - translation.setToolTipText( TRANSLATION_ACTIVE_TOOL_TIP ); - viewerModesModel.unblockTranslation(); - } - } ); - } - - private void setupRotationBlockButton() - { - final Icon rotation_on = new ImageIcon( this.getClass().getResource( "rotation_on.png" ) ); - final Icon rotation_off = new ImageIcon( this.getClass().getResource( "rotation_off.png" ) ); - - rotation.setIcon( rotation_on ); - rotation.setToolTipText( ROTATION_ACTIVE_TOOL_TIP ); - setLook( rotation ); - rotation.addActionListener( e -> { - if ( rotation.getModel().isSelected() ) - { - rotation.setIcon( rotation_off ); - rotation.setToolTipText( ROTATION_INACTIVE_TOOL_TIP ); - viewerModesModel.blockRotation(); - } - else - { - rotation.setIcon( rotation_on ); - rotation.setToolTipText( ROTATION_ACTIVE_TOOL_TIP ); - viewerModesModel.unblockRotation(); - } - } ); - } - - private void setLook( final JToggleButton button ) - { - button.setMaximumSize( new Dimension( button.getIcon().getIconWidth(), button.getIcon().getIconHeight() ) ); - button.setBackground( Color.white ); - button.setBorderPainted( false ); - button.setFocusPainted( false ); - button.setContentAreaFilled( false ); - } - - @Override - public void singleMode() - { - fusion.getModel().setSelected( false ); - } - - @Override - public void fusedMode() - { - fusion.getModel().setSelected( true ); - } - - @Override - public void sourceMode() - { - grouping.getModel().setSelected( false ); - } - - @Override - public void groupMode() - { - grouping.getModel().setSelected( true ); - } - - @Override - public void interpolationMode( final Interpolation interpolation_mode ) - { - interpolation.setSelected( interpolation_mode == Interpolation.NLINEAR ); - } -} diff --git a/src/main/java/bdv/viewer/ViewerFrame.java b/src/main/java/bdv/viewer/ViewerFrame.java index 9ebb282c4..7af647e3b 100644 --- a/src/main/java/bdv/viewer/ViewerFrame.java +++ b/src/main/java/bdv/viewer/ViewerFrame.java @@ -106,7 +106,8 @@ public ViewerFrame( triggerbindings = new TriggerBehaviourBindings(); cards = new CardPanel(); - BdvDefaultCards.setup( cards, viewer, setups, triggerbindings ); + BdvDefaultCards.addOptions(cards, viewer, triggerbindings); + BdvDefaultCards.addSourcesAndGroups( cards, viewer, setups, triggerbindings ); splitPanel = new SplitPanel( viewer, cards ); getRootPane().setDoubleBuffered( true ); diff --git a/src/main/resources/bdv/ui/viewermodepanel/fusion_mode.png b/src/main/resources/bdv/ui/viewermodepanel/fusion_mode.png index 54f269379a8e35963cec03f2fa77dac68925a4bd..cd2fd7e61e2e776c6b34e540a7720effca5664c9 100644 GIT binary patch delta 624 zcmV-$0+0Q~5yS!fkilS%~1i?>lb^xHYzK-L6 zn26}@`WU(-l2SH&%K-p{VR(;-H$`Jkg5bU-4h9hmbGr(j9O)9w%onrStZ*ro38hQ{ zz^*?RLU6TOO{A3ML-0x|^-)UMgvGKl^F_bk|K4h~mO;iCW@fYcVxH$0#+XW;=c^)? zh)j|sx1-Uh+Ua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ZSl%vzDDTYt|?S4jj;qkB@Vz`b&<9i3!H<_eU3ocqwDz&Ye4- zH#9Vi%kqpJk({2M4y)D5y4`LrMz>@b9v)T%K^RX)5CHg&j*hE;r%s)E84Lyi0F+W$ z6h)ciIMmeCuwJiM&-46zlKh;|)6?V7>2$tS1i`Yb*w@$BTvu1;^>{o009lqLAe8m3 zRx8zLH2Odwu%smW`};@LTcL#W$pD{zWZQI6d*sy_fI-Qz@613TDQ~mw@cVgx9TKEHj z!05$`7oXj}ecKxh2501&&6_uq9XodDTrQV(zT`SOI{5Z~_V%0Vy=-cQfhf>0-(?6;m9a1E>2@vmJkx+X*3#1ettf4@7_I{jHDn4 z=OgjO_H=J=?-Pf^@l2NG(J;BWwVzB$2$2*;nafI{jE#*wtFNyg3n%ml zd4*D{)YQ}%Dk>^U2qDI~5(5B9k`$uX>#tcXmV~!ge!u^F!C>%5(OHlJD_5>GA3uIP zbKSasb+hbm-MS^&Y_@Tp=K}!Xa=Ee;MR|ZY9t~f=olQw_Aut+^CC82(E8Dbb)2tY8 zYisj0H8ovT6lKzGw}0UG`>g>g)68&wp|E?%i35ckkZ4hP7+gZk=me z%XWnH`~7{5jg2>2TU&jxIr291#78^OB(3~}UhA{dMB z1GuRw{}{l<@cYLA9s>9+fWHH%3Cp(w_!^;){R+T|u$%?(PXK=dU{l%8Lb62tD*#8s z?|%jGpCq=`0DcYNno33hTmY~iz&8kgdFly(&jEad&=#vaYJC&Uw+|CvN|5C}@0L0zlBqJEW%ma-WW3P^#YvB%e1NbF? z9{~6R03T)t{}h0O0Mt7gE)j|O#NaT1_W-;DAPvCJRl4^9@L{5t5%Qc9q4@h}DMBCW z22h01|CP3|+=S3X`&pt+6M1kLz?&G^6oB6V_!7VuI~bP4WJP-Gs1URGW-u>)iQAd5*EJz0000 + inkscape:window-y="33" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -57,66 +61,26 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-282.97707)"> + transform="translate(-2.4093051e-8,-282.97707)"> - - - - - - - - + + + - Fused diff --git a/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.png b/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.png index 5625c974215f583ed4b9fe42842881c029e73446..69aebc0bdf841d0404c6b976aeb436978373c4ec 100644 GIT binary patch delta 1277 zcmVJt8)X>Bzwi6b&SWx~ zA8C@ZZk1NI2-|~gr3DWjyca7T6#Q`)JV?Fi!ILKuLD4@z1W#h?4~l|^fApPdRz$cxe(%i z69A7*Yr+&qYpxFd9&U+_HdhU>aFIp?xg ztNmu0W;2fCR{)$msLWmDJ=kfG>ytA;d@U?B* z{(g(IEHhSCR-VnWjHHxr0O;%oc+Pd*lShvp{cak%APDaBJg*Z3!6DD{HV?3GetmuY z86x^oO8E{3>XYwTyZ7_NisRVQbvxH1^mikN0uW-!L25MrXP002ZZ z2LM8dY%spIw)Wh1E8L|*fJu^nIIioCtv#g_kK@=PB2y{FIp>*_a?Y}>U~X;uziewF{zZ|0I<5c z`UHSW0Fs#jN-0H>B$YhRO#tAW_v`igjU-820MKYV`-s`BUT08aA+hexzyIpA&HQ=I7_H z42d(wSnfE^)&w3{US58Qh+Z6(-}{*UBBFCdw6C!c;$zo!+mk?y6X#qfB90MHZ|Zjv z#@Hf&l4V&FeN&^FEkGl(e0h_sfak|0ALNv6?!k`oO@Z8J?J>jts*{g9NWEKPX}=Q zKW7v%CZfwx6g^VJqt$91Pm<&`M*K($javXZL^QP5j#3zghdZ6l*?zx&OiGz6rGAl8 zUI6gNodASVYAcE&yHcqPom~3;zPY)%c`ARVihSh*HMbRU-NV nz{U*xXCe#0vAYd%Ps8*NnGi7~qCrkE00000NkvXXu0mjf**A8R delta 2584 zcmV+z3g`9A3fvTs7Ya291^@s6Gq$NHks(Zf3E4?RK~!jg?OAPXQ`Z@O?uW0xjU602 zxCYXElR!qBl0wTuHMJ;GHUy=uI##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e%H%rco@*l5$Gz?d?)~d;4_&_~@gL z>^7TimSx#4LduGlCCC#(zFSS92#(|a;&3>Bg0;1^dmIjjdr^f2uvjdtq9_c*FisRa zsg{#lc1 zs_G0345R{q!21Ahl%SF%Sp-4g0Zc3qza^Vl5;RSVYMQpk<#J6%qtT1!&Yg3*TrQ`_ zG;N6Uk)q`yP+y5>O}|)9Li8R4V1m<#J|4Q4#=-D~j?VO5*NzaVNIlhIpR; zc|M=F<#IVrRn?@bs)LH6yooYPZ^cK2Ot4pSIILDz>iAW&JtOdes2cQqRSRx z1Yjv?oAh5%-l$*eE0HOedi)f?w*gc-CNKa<0{BoT^GChYUjg_Mz_$SG1@MV}?Evr- zUH4U;)Gtx+NIMD{Rgp&@7M!1yTd3Orl9RTn=fJ3DMn~J!g^-_5CHJ8E`J`tp8=Fsf$sx& u2ZaH62fznq_}nubKw-42;v0YB{$GR15{pY@61@Nb002ovPDHK)LSTaYz0Ax2 diff --git a/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.svg b/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.svg index c7a4376a6..96e2a171f 100644 --- a/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.svg +++ b/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.svg @@ -10,13 +10,13 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="40" - height="53" - viewBox="0 0 10.583333 14.022918" + height="40" + viewBox="0 0 10.583333 10.583334" version="1.1" id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="grouping_mode.svg" - inkscape:export-filename="/home/tibuch/Gitrepos/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.png" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/grouping_mode.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96"> + inkscape:window-y="33" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -57,16 +61,21 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-282.97707)"> + transform="translate(-5.555898e-5,-282.97696)"> + - - - - - Group diff --git a/src/main/resources/bdv/ui/viewermodepanel/linear.png b/src/main/resources/bdv/ui/viewermodepanel/linear.png index 6569a6b59507cd0ec87a2b71264d4e7d34f6a802..05c16670bb2394bfb6c8690ad8b1f3f2569e3683 100644 GIT binary patch delta 344 zcmV-e0jK`B1+D{-7YZl{1^@s6jQ+T7ks(Zf0V_#FK~z|U?bktS!!Qtq;Wvtlm1tRl zPg3Zv^blJ4dX{aNY6U R?$F?L603agGD!@xPW6VXIw%NdIxbt0{f}0JzHEtGg z4cuhlTDVETHF4R%wQ*U%5;!%m6iy4=mcprkP1CqiI2G`CMJj?*154plKpZZZMR0%u z$jq)34p4q1rEoyT5u*SO&>gYGjc`Om^qpFh1d7Nffc+w(-!U`4q!y`uJNv$W5RoSU qo7t>G9AkV9A-pd%uU4zo{%k*qs~_U`s}r^v6_cV}kzo|~K5xo zmEgJsR)*^aSShYkVCA?@fVJR?0&Bw+0oICJ4p=*GDPR(~cEDtCdBCJ_t-$1PS>Uz; zsLF9oV6r$^l`^ggOcqD68LTy{<)fN^b?wQU!DMhOUV};DSU7{p;h3MnByofX^%sfa z2*A0z5i3a{TX3Xq1Of6lr+qK(S8T~mJK$jKBfK6r2^(w}8*|3*#IBt7-581YXl5-o z#LpNN9)16l9k^6RaT|wl7&q_{v$5?cUSlgJFoQMtiQ{qHJ*N5%wdV z|7r(mH-r1|EY@TA7BO%U*J6DYmonGg!pT?Hd|7{w$jwhM^hOqW7 @@ -43,7 +43,7 @@ x2="2.4347966" y2="284.99265" gradientUnits="userSpaceOnUse" - gradientTransform="matrix(0.82135526,0,0,0.82135526,2.0319129,52.584282)" /> + gradientTransform="matrix(0.82135529,0,0,0.82135529,2.0319136,52.584295)" /> + inkscape:window-y="33" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -73,7 +77,7 @@ image/svg+xml - + @@ -81,24 +85,15 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-282.97707)"> + transform="translate(-6.9485441e-7,-282.97708)"> - Linear + width="6.0729942" + height="6.0729942" + x="2.2551703" + y="285.23227" + rx="0.48999995" + ry="0.48999995" /> diff --git a/src/main/resources/bdv/ui/viewermodepanel/nearest.png b/src/main/resources/bdv/ui/viewermodepanel/nearest.png index ebf99b0a7fe7c8c699c1d6a28d3c904176b00156..40b4806a4adf1f8204adc9f8c16e0be8d700a691 100644 GIT binary patch delta 296 zcmV+@0oVSb1^xn%7YZl{1^@s6jQ+T7ks(Zf0Q*TqK~z|U?Ug~Q!Y~kq|9KRBXDAlY zm3u*4_6WL6pj&qys|CG_OI?cB5L3pj)k-YZY;PZC-ep-fvh58b$jo&~{TpMtAqa<73Kem;1)oIRh{&gZ zh*D}nL>mA-UuXKh!5%!y0pW(EH6rLrt076#G>YSRS+g{E^m(9_V3H*LvMjg0W$NgB z#3JZQ=LM}pqP3m^Slzxe#zYSP|CeYo#bewFhLQt5AYu`8#VW|m2LP8h)IJl@$@WpB uZdXc8h-l!fROMI{#nJPbf*=TA#}(ldY%cqOUn!md0000&Ol)0jj5gKNTrrgkYsz0GOXUazbPo7DwGd*}KPqetKi3~846TAMXX8q5d zzPqfJ%{*Fpef@9S`@etJ*3bWJdH?dytrC`5XYZJ#?FfAm#PSS|E*bHd&bF#ooRxaT zIs!@jlfL@NdRq+POGzz$9chwZ`NSG`ia=4Tlkk;-l}2%W*OiwnJ(s%0XoqK5(${#o z8BIqeZcmusm^vfmWbeT%9nTl*J_^%0*wQBTc9N!X@|`x`z}<77Jm9<2C0#EiYty#e zaP{*DiJ#0nx<6MmpPd-r@O?*fc0_kya%pZHBJAa2#*tWKh6+)+0 zGg*H;u;B9TLbFG!W_w?Z7yKdIon#}OzcjRg&!+3gzJ=lM78lgTsAO4m2^+4qik);- zJjq6~SUIls@yADX-$-ChCH8iNrAne z=iY$*ul||}D0%+t?&#cyOZL80ftUNj|vHVG$^^J;2G6xr)+QA-e$UXm~ zEz5*Ee*`}sT$my;l`xfT)P!mp=QZQExxf5X1G2OI5wzua + sodipodi:docname="nearest.svg" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/nearest.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> + inkscape:window-y="33" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -46,7 +53,7 @@ image/svg+xml - + @@ -54,46 +61,11 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-282.97707)"> - - - - - Nearest + transform="translate(-1.0335785e-4,-282.97696)"> + diff --git a/src/main/resources/bdv/ui/viewermodepanel/rotation_off.png b/src/main/resources/bdv/ui/viewermodepanel/rotation_off.png index c1e7271e3c8a155d9ac41ac8d399aaf42e4a5682..6e31598afe1c8ac13252d21500b2d360fe7dec47 100644 GIT binary patch delta 873 zcmV-v1D5>q1<41HZGQtsNklR zjfTg}OU(Qt5iJ0yOuibFN~MqX_V)hxUj*y*`h2xoeVdtYi3l@u>4IUWs`_cC)A{i# zf+lak`uh4U*LBy3s76F3BD!#!sH&*yGmDFhKOY_*o?ce)qF??*eBWO-#;gD+rxHXo z0`O2oMnrT|M1Mxid~A&Qw%u<3c3H99fMhn6h#ZnoUQ<@wI)fDcQ-dT zZ%&JyTE#?ENgJ_<@b2#JAg`dcb_sxM%((3`b7G9yZ@1fjO^coBS^Ol7F-HK-7gdr) z4#*(rIDgLLNi&9s=<4dKn^!Q7T-^bbIA}N>4 zpJ$Z=a@+^Ex3`}j4u>D8stb&pHW8hw>er=G>8G?R8;wTUb=~Jhgo{uh%=ulP|X*05qG;r;;RjAHW>W z{$iaAQPqTqh9dHDx7+~!Trg6US-)81Fnc15hh3W0wPF@Ghd=STRAAnpk&($89 z0HE1y&J6~G8>;H@m`BX~AnQp{P*6}%@bCN$2wXy0`^&?R00000NkvXXu0mjfU}~?& delta 657 zcmV;C0&e}u2l54wZGQr9NklqD9fBWl=&zR7Ne5RzaH}%Akdj1rfDt)t^v{=T7%(I(qevLimM& zbDnwbGrxQ9dCqgrFvlGK7i%$pwnY@HYr^~Nbfss!bTJ&+op@Pd4K=tQeI~^jar)UH+aS*2 zj&Rclqp=pe!;%btXUf##q>v#BF_;%hxBrJH!ZAm94S$z1UcU_M5`L?H&-$V~6*dQ< zlKGU4uD^8SS;Ftft~3ku;%LIZD^$x_F@SxMU4`$c$Z-8>(l99_X$h~7)7))`s0RS6}1bL8i+xzxhOVy93# r4Psd|whf015yANkvXXu0mjf=ru$d diff --git a/src/main/resources/bdv/ui/viewermodepanel/rotation_off.svg b/src/main/resources/bdv/ui/viewermodepanel/rotation_off.svg index e639c96b2..8305669a6 100644 --- a/src/main/resources/bdv/ui/viewermodepanel/rotation_off.svg +++ b/src/main/resources/bdv/ui/viewermodepanel/rotation_off.svg @@ -16,7 +16,7 @@ id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="rotation_off.svg" - inkscape:export-filename="/home/tibuch/Gitrepos/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/rotation_off.png" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/rotation_off.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96"> @@ -310,7 +310,7 @@ image/svg+xml - + @@ -320,8 +320,8 @@ id="layer1" transform="translate(0,-286.41665)"> diff --git a/src/main/resources/bdv/ui/viewermodepanel/rotation_on.png b/src/main/resources/bdv/ui/viewermodepanel/rotation_on.png index a88f9edae6ffa546bdeaee993baff1fcc77e7cdd..63bb0b45f35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_?jNZuvI3jp2Z{Un{cadJj6J$W?kdLcQ#WVRg?xqB{D-ruA&eRg9M;L~<{yS7B zT)Qwyl7Dq&O~-*%N~@WykbzpXQ1JF>6mM9ao4{GcdvYG~=p^HG;jLm{=gYUcD(~6C zStBl5^N^2)a(_H6!8wJqO58G7R}I9B37#*)gWStn63+$&pY{lo=%bL4)j9Z1VWFRu z=$FM_;mn+h+R=wE#y?_yRhsSOd8S{wOV(dC<4>fJwb @@ -320,8 +320,8 @@ id="layer1" transform="translate(0,-286.41665)"> diff --git a/src/main/resources/bdv/ui/viewermodepanel/single_mode.png b/src/main/resources/bdv/ui/viewermodepanel/single_mode.png index 27efb49d8f4c7ba2453d87f8c32d7ce10e6b1044..5004a50d23df51705b4a325befae3702b8752de2 100644 GIT binary patch delta 720 zcmV;>0x$iv52FT<7YZl{1^@s6jQ+T7ks(Zf0-#AmK~z|U?Uy}h6hRn3-^}c0?{eIa zS}0f;)HH%%r66Ju6|0Dam6lp5wl*Syg@uKkrIlbMC}I&o!A6M|f~cTiFd!JTFv%Ks zliizLi`;2)yNNq@6GgmN-F`Fs&AZw8h8gJ7r_ZV=!~Pq9tH20w2zU$lzzN_a&;%xb zf!)A4U3UJYi ziUB4wm;h62C9)E~o6<&sJ|;}B(sl*70HjNUPF_!?)TrY)r(M^bm-5#nr)esM5J|Uo zaU7STD7vY&zFqX4+}ZIw@6Pb>@ROx~u_Q?beBa;SXfz&nD+n+#F|jWU!(%y3>w&MG z!Mrsnlrr5Oi=&i^SuD6tGIC&0BvQ(_Uavpy(yIuk$oZlsRh$YTn)ZA$Y|9H47EF@F z^?iSjJ)aDB>8M~Zn?aEzN!6ZDhUa;~!h%AGX1QE`WzQ$WNM6uHF!4O^vpt`G3`gjt zNYXS_K@e=Ws14S@FGV7R&;tVllQxYy*qj$M5*!>Hd~eSu!&!P< zgK}YEVWU;0<;>>=O$41V40qb|$#9t-H|kVM`OThBF^moiwOZ}j8oFG|3+5hJS7UZ| zc5j-dUb$R;<9X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+*q=2AJs!`?27_U2({-QA<$Achyu3c4ugPRG z39YTIdmcP^P~r3WGEV3@0G4I@Xv!o{Pft(h#fujg;_>AA&1N&_&Yi2bTCHDE6eZht zPbR&SEe9zqESwR4MKPAf9-W?^b~v5Ry@w7R+NIO2FODcED4@N)-8elxT{}BFJDRGF z93pruYYwJ^OR&e6mzP}w0|R9(EiGlKCUl?AS2Hm&F)0W_(uAG^;NP+WdcEGyB#z`% z5(Gi<`FtaTgM-CZtM!Qq-EOxRhr{89v9YnF2|WiuT~edF1$KyE~3#M1%s@i8Zn~@|*jz*&efk41$wOWfyOG_;- zmuqEdY3bvkP^d8!3WYSlw}3B`ye;=8up|^07r$RuS9dE@gq~JLqtSNy^y$NPyIr^0 zcK!PG)vm68u1-Z!yyN5Jp9lm3r+{dRYJlu}GtVTS&o^-C(xn@>ZruuPwjDoyyu@O$ zwB=gYjsOA#0)f%XmoNY6+O=z|n{8&ZIp<~CjsXJ1VzHU-?(Xgj7cR`r%*+6A_wL=; z$jHb@u5~<-BRe2>e}DgbeSLjRsAX!i`~d)yZ=|BDu6vCPeq^9u05-E z0iW9n6hIx&kGePA3rqsdn(ZQRcnftm13g=!1AdQsF1IEl>bV=hhuGK=HKHC^#+piW`$0)Noj3~KERrFo!jRarv$$G|W0(dg6Y kr>GPCe}Qh)x6(7|e~NhW6?aiQY5)KL07*qoM6N<$g2AMbOaK4? diff --git a/src/main/resources/bdv/ui/viewermodepanel/single_mode.svg b/src/main/resources/bdv/ui/viewermodepanel/single_mode.svg index 11abe359c..3a639cba9 100644 --- a/src/main/resources/bdv/ui/viewermodepanel/single_mode.svg +++ b/src/main/resources/bdv/ui/viewermodepanel/single_mode.svg @@ -10,13 +10,13 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="40" - height="53" - viewBox="0 0 10.583333 14.022919" + height="40" + viewBox="0 0 10.583333 10.583336" version="1.1" id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="single_mode.svg" - inkscape:export-filename="/home/tibuch/Gitrepos/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/single_mode.png" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/single_mode.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96"> + inkscape:window-y="33" + inkscape:window-maximized="0" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -57,17 +61,17 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-282.97706)"> + transform="translate(-2.7536975e-5,-282.97592)"> - - Single diff --git a/src/main/resources/bdv/ui/viewermodepanel/source_mode.png b/src/main/resources/bdv/ui/viewermodepanel/source_mode.png index a7bcf8431060b5c473cc30c34e5ab4b1da7e0de1..0c4bc54bd33ae20c984aa0e7a3b3bf2d2463143d 100644 GIT binary patch delta 1384 zcmV-u1(*8K5w;7E7YZl{1^@s6jQ+T7ks(Zf1v5!RK~z|U?U+w!99100e{cTm%tT}?4;(>?`_`i_xrvN?>*k10l24o>QAzN zET2rL(-#cG_+FOf2mF*7qWpUdT%K@dF4Ie*6Y{aFBL?>nHPC~r(m zOk`83lp_d2n8{>p(=@s7`>%vyc!*Lu3jln-0F87y{r-Ui2TI+Ik|eQgHhW9g^dkE zEJvDer!Wk4RaK9Tj*k90Ffj1@cKMuhv0N^XHyVuw#`qloxV0VN=|Z7!#x%|A{Qy?0 z)iQ^<@;~nzWs~u`yWBq`V=!QczBosz@d${Jpo)_ zUq3T4GSYLQ?^IzJ3iWzD0RUGv+F}C|LQ)8!gXwhIitAM_mnS{X`v3s`S!S^TZQFjn zSS+r@^&y0)mStItvDxl+DUPXs<2YlQrs=Ax?s$4J#s&aDGMRL`+e@X=q~ka*Z_bYe z*lxE^O-@d(Zk0m_QEb~TI*yYM!w@AB35QZ@WV6}%bUM8b0MKf+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_A&hL!S7fz|)REdx2Mg1IXmNA35<~I&BXlcP~N(EOmq!0)BxsJuZ#`A8`IBkolOK zYY?y>2srf(4j(tYr#R(vz)w9q9!9=@7=R& zGpFgEr*!|m3pj*~454%YS0h#DS5CbVxk%Rt=yp2clnm1F{=i`x@GuV{Pq|gbqg=1N z&cS$v?;!IsKS%DGi^-ghHy-&2(1~332IMVq(h>Ry@I|NHYUGK35$ORhLO$el1eltw zEyp3?6O=Lu3z7PM5co85>qnjOCvOn%?0v`=%4X!upQEG;JAoe}S9TQn!k%@?BTm~v zr1HA~&=sVqa?y)?xqs4`%?n8WkcDwF*`YQ}#6+%1&U{<7ZB00000 LNkvXXu0mjfeTo~{ diff --git a/src/main/resources/bdv/ui/viewermodepanel/source_mode.svg b/src/main/resources/bdv/ui/viewermodepanel/source_mode.svg index c5fd6dbfe..6e967781c 100644 --- a/src/main/resources/bdv/ui/viewermodepanel/source_mode.svg +++ b/src/main/resources/bdv/ui/viewermodepanel/source_mode.svg @@ -10,13 +10,13 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="40" - height="53" - viewBox="0 0 10.583333 14.022918" + height="40" + viewBox="0 0 10.583333 10.583334" version="1.1" id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="source_mode.svg" - inkscape:export-filename="/home/tibuch/Gitrepos/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/source_mode.png" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/source_mode.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96"> + inkscape:window-y="33" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -57,7 +61,7 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(0,-282.97707)"> + transform="translate(1.9123157e-7,-282.97707)"> @@ -69,7 +73,7 @@ height="4.6323395" width="4.6327744" id="rect815" - style="opacity:1;fill:none;fill-opacity:0.4545455;fill-rule:nonzero;stroke:#000000;stroke-width:0.141;stroke-miterlimit:4;stroke-dasharray:0.564, 0.564;stroke-dashoffset:0;stroke-opacity:1" /> + style="opacity:1;fill:#2e2e2e;fill-opacity:0.19844358;fill-rule:nonzero;stroke:#000000;stroke-width:0.141;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> - - - - + style="opacity:1;fill:#484848;fill-opacity:0.45136186;fill-rule:nonzero;stroke:#000000;stroke-width:0.141;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + ry="0.27094325" + rx="0.27096879" + y="282.73801" + x="-72.2089" + height="4.6081691" + width="4.6086035" + id="rect815-3" + style="opacity:1;fill:none;fill-opacity:0.10894943;fill-rule:nonzero;stroke:#000000;stroke-width:0.14111109;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="rotate(-15.000005)" /> + - Source diff --git a/src/main/resources/bdv/ui/viewermodepanel/translation_off.png b/src/main/resources/bdv/ui/viewermodepanel/translation_off.png index 176b69fef1a48c2dd043949a479d7ef15b11f302..e34a4c02397d75b43ed04a2b7191568cb6af54db 100644 GIT binary patch delta 537 zcmV+!0_Oee1^Wb$ZGQpyNklVNf!th5rx>RnH2d0XNRNiJ~YvFU#_*EPuEKh|)o^kBQ)epeKQ7m+6bKtwNtAb79g zR(XO+k`&(i;^)2hzDSa!I2Lm%Y9Gm;;-4$fgkgB?oC~TZa?S-|7+zP+NvCcckH;4x z(gSc0z|vZKtAEG5_Ya7u3jiXrvetgwTMq#AiRcS}F)ARgAsRKz$}E&v*pO^2 zEG(uhG$j#h|A3k-$VP0HhZIR!*~vp57HZ65O5`DhSdd{XzUP`t>aob$VvF~+Eg`52#5a6(3{60T!me16Fxnlr$?cz=gREWyo;+9RffJ7|fk z4>Ri;(J(YrjJvQQhiHx?ZpXeDzraLH3+*TPJQDF70dB!69K<5WpNfpBfzZW3~)dCGwKzl9lHwnHLI;`?ZTR0 zIaS-isqwiEoqq)uJcE@|CU+F@@5D8%t~J00>9}sA70<983#0_NR&i~Ld(Ij95{oM4 zkA!V^h3#V4UWff5HsgTr+vTuK#y#|4df295S=?NTartTvpT!kE4HfhAV!oxqwj^v# zp)JA>oN^ZGW76|k3sr*~ zEsEB`KYz|iEYB^P^N8n4C8ubT6ym>no4JZN8TF9oM^l$nj!sFx;s)^+bFfiropq%h z&!v7_ri8mOHzIQE;7jQ(=c%DO*e&(((;4(fg)V>LUmu;)``@g32l6vYQbOFqxSXQ7 k7{H+z4`$RIi_@% diff --git a/src/main/resources/bdv/ui/viewermodepanel/translation_off.svg b/src/main/resources/bdv/ui/viewermodepanel/translation_off.svg index 0ea573eb9..6852b38e2 100644 --- a/src/main/resources/bdv/ui/viewermodepanel/translation_off.svg +++ b/src/main/resources/bdv/ui/viewermodepanel/translation_off.svg @@ -16,7 +16,7 @@ id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="translation_off.svg" - inkscape:export-filename="/home/tibuch/Gitrepos/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/translation_off.png" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/translation_off.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96"> @@ -194,7 +194,7 @@ image/svg+xml - + @@ -204,8 +204,8 @@ id="layer1" transform="translate(0,-286.41665)"> diff --git a/src/main/resources/bdv/ui/viewermodepanel/translation_on.png b/src/main/resources/bdv/ui/viewermodepanel/translation_on.png index 74a06b119858b694f150cdacb47039abff5390a3..5e989bd357de6b7db7c53465a451b4a18c816ecd 100644 GIT binary patch delta 520 zcmV+j0{8vk1M38kZhz=WL_t(oh3%IyixW{0$Nw|g6o+u(K7jZM7PU-az`HAL7qTx& zBb-{;3fd^zSlC+V6*fuU1_ZmS^e&*qRU(pn0L2d=x1fdD%vjtWgu|0tGD48|Yxcc) zyT6&;H#}G%5C{YUW+X|nmL$oVr8BaW)$8>~N6rb zSX@`ts{kI9(|@N#^y$?4CK25OFb1&Wz5i-bV6WG^P!z=zBD#s=b4~$#KjZfG@|vHq zzES4PRrOUAMGyP^{*S-qU-=%aw8a2+0c(CEX%UP#dxRF*%Fc0 z0Km-2a5&swTu;-qNknz;{rf8UDxdaM6P$4Rh0e>$_kZBZ7g)29IOnbdxB=iw8TuK= z@vq5b@?}}K$rohi0>E8nZZLDB92X{T3&~(G_yFLoh$sLhqIYF%Y0P?1MD7q#uB!Qb zKEG|{HR(YBm`#8@S2vr@9$WeXfj}St{08r1tu16=u*?7e002ov KPDHLkU;%;wc>)Ch delta 379 zcmV->0fheR1mFXZZhu`#L_t(oh3(isN&`U@$MKK<3K1Jou(Y!hPoWmMf{le2h&wss;|CW1!dKhR<)Cd4Fe*jaXk{lbHpx67L!yUd$6kBW+^*a=oj=5ZHn zzECA&IKmU2!?;wepoOnsEvy!*Xoz#X=?i=hzEZG-uD-aQb$`RNOw45sfEs47j>X`6 z#1%TYiLgc#n)+X_87t^)tU!5D3Cv0*Fe_;UZeu@(wf95piA)l>h6b*&8%fk4dy;f? z5!M>X%n09tFE9oN zxRfOG-Y#wj-$8-8e#rIO8H+Q&FYafBDjK5ntq-W{H;?KCYZ*x{?YEeHyiXhsj4LYA Z@C{sXfVP=~pR51?002ovPDHLkV1mYmuebmJ diff --git a/src/main/resources/bdv/ui/viewermodepanel/translation_on.svg b/src/main/resources/bdv/ui/viewermodepanel/translation_on.svg index 9635a96a8..92c29227d 100644 --- a/src/main/resources/bdv/ui/viewermodepanel/translation_on.svg +++ b/src/main/resources/bdv/ui/viewermodepanel/translation_on.svg @@ -16,7 +16,7 @@ id="svg8" inkscape:version="0.92.3 (2405546, 2018-03-11)" sodipodi:docname="translation_on.svg" - inkscape:export-filename="/home/tibuch/Gitrepos/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/translation_on.png" + inkscape:export-filename="/home/random/Development/imagej/bigdataviewer/bigdataviewer-core/src/main/resources/bdv/ui/viewermodepanel/translation_on.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96"> @@ -194,7 +194,7 @@ image/svg+xml - + @@ -204,8 +204,8 @@ id="layer1" transform="translate(0,-286.41665)"> From 97605ac18bd7ba6b3e3c1ba9e44999831c401897 Mon Sep 17 00:00:00 2001 From: tibuch Date: Wed, 11 Mar 2020 18:09:18 +0100 Subject: [PATCH 2/5] Add toggle group button and example --- .../iconcards/options/ToggleGroupButton.java | 74 +++++++++++++++++++ .../java/bdv/ui/ToggleGroupButtonExample.java | 37 ++++++++++ 2 files changed, 111 insertions(+) create mode 100644 src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java create mode 100644 src/test/java/bdv/ui/ToggleGroupButtonExample.java diff --git a/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java b/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java new file mode 100644 index 000000000..4603a5d56 --- /dev/null +++ b/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java @@ -0,0 +1,74 @@ +package bdv.ui.iconcards.options; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; + +public class ToggleGroupButton extends JButton +{ + private final Icon[] toggleIcons; + + private final Runnable[] toggleActions; + + private final JPopupMenu menu; + + private final String[] labels; + + private int current = 0; + + public ToggleGroupButton( final Icon[] toggleIcons, final String[] labels, final Runnable[] toggleActions ) + { + this.toggleIcons = toggleIcons; + this.labels = labels; + this.toggleActions = toggleActions; + this.menu = new JPopupMenu(); + + for ( int i = 0; i < this.toggleActions.length; i++ ) + { + final JMenuItem item = new JMenuItem( this.labels[ i ], this.toggleIcons[ i ] ); + final int index = i; + item.addActionListener( a -> { + current = index; + trigger(); + } ); + this.menu.add( item ); + } + + menu.setInvoker( this ); + this.addMouseListener( new MouseAdapter() + { + @Override + public void mouseClicked( MouseEvent mouseEvent ) + { + if ( SwingUtilities.isRightMouseButton( mouseEvent ) ) + menu.show( menu.getInvoker(), mouseEvent.getX(), mouseEvent.getY() ); + } + } ); + this.setContentAreaFilled( false ); + this.setFocusPainted( false ); + this.setBorderPainted( false ); + this.setIcon( toggleIcons[ current ] ); + this.setToolTipText( labels[ current ] ); + + addActionListener( a -> { + next(); + } ); + } + + public void next() + { + current = ( current + 1 ) % toggleActions.length; + trigger(); + } + + private void trigger() + { + this.setIcon( toggleIcons[ current ] ); + this.setToolTipText( labels[ current ] ); + toggleActions[ current ].run(); + } +} diff --git a/src/test/java/bdv/ui/ToggleGroupButtonExample.java b/src/test/java/bdv/ui/ToggleGroupButtonExample.java new file mode 100644 index 000000000..d4dc645b8 --- /dev/null +++ b/src/test/java/bdv/ui/ToggleGroupButtonExample.java @@ -0,0 +1,37 @@ +package bdv.ui; + +import bdv.ui.iconcards.options.ToggleGroupButton; +import java.awt.Dimension; +import java.awt.Image; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import net.miginfocom.swing.MigLayout; + +public class ToggleGroupButtonExample +{ + public static void main( String[] args ) + { + System.setProperty( "apple.laf.useScreenMenuBar", "true" ); + + final JFrame frame = new JFrame( "ToggleGroupButton Example" ); + frame.setLayout( new MigLayout( "ins 0, fillx, filly", "[grow]", "" ) ); + + final Image rotation_on = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/rotation_on.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + final Image rotation_off = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/rotation_off.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + final Image translation_on = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/translation_on.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + final Image translation_off = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/translation_off.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + + final ToggleGroupButton button = new ToggleGroupButton( new Icon[] { new ImageIcon( rotation_on ), new ImageIcon( rotation_off ), new ImageIcon( translation_on ), new ImageIcon( translation_off ) }, + new String[] { "Rotation On", "Rotation Off", "Translation On", "Translation Off" }, + new Runnable[] { () -> System.out.println( "Rotation On" ), () -> System.out.println( "Rotation Off" ), () -> System.out.println( "Translation On" ), () -> System.out.println( "Translation Off" ) } ); + + button.setPreferredSize( new Dimension( 40, 40 ) ); + frame.add( button, "growx, growy" ); + frame.pack(); + frame.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE ); + frame.setVisible( true ); + } +} + From 8f0ce8bac65f5276bb47d614963cff3609c05bab Mon Sep 17 00:00:00 2001 From: tibuch Date: Thu, 12 Mar 2020 15:06:35 +0100 Subject: [PATCH 3/5] Add API to add/remove/select options and add documentation --- .../iconcards/options/ToggleGroupButton.java | 149 +++++++++++++++--- .../java/bdv/ui/ToggleGroupButtonExample.java | 21 ++- 2 files changed, 142 insertions(+), 28 deletions(-) diff --git a/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java b/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java index 4603a5d56..c787572af 100644 --- a/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java +++ b/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java @@ -2,43 +2,68 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.List; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; +/** + * A ToggleGroupButton holds a group of states, through which the user can toggle by left-clicking the button. + * If the user right-clicks on the button a popup menu will appear and the user can select one of the options + * directly. + * + * @author Tim-Oliver Buchholz, MPI-CBG, CSBD, Dresden, Germany + * @author Deborah Schmidt, MPI-CBG, CSBD, Dresden, Germany + */ public class ToggleGroupButton extends JButton { - private final Icon[] toggleIcons; + private final List< Icon > toggleIcons; - private final Runnable[] toggleActions; + private final List< Runnable > toggleActions; private final JPopupMenu menu; - private final String[] labels; + private final List< String > toggleLabels; private int current = 0; - public ToggleGroupButton( final Icon[] toggleIcons, final String[] labels, final Runnable[] toggleActions ) + /** + * Create a new ToggleGroupButton. + * + * @param toggleIcons displayed on the button and in the popup menu + * @param toggleLabels displayed in the popup menu and tooltip + * @param toggleActions executed if the button switches to this action + */ + public ToggleGroupButton( final List< Icon > toggleIcons, final List< String > toggleLabels, final List< Runnable > toggleActions ) { this.toggleIcons = toggleIcons; - this.labels = labels; + this.toggleLabels = toggleLabels; this.toggleActions = toggleActions; this.menu = new JPopupMenu(); + populatePopupMenu(); - for ( int i = 0; i < this.toggleActions.length; i++ ) + this.setContentAreaFilled( false ); + this.setFocusPainted( false ); + this.setBorderPainted( false ); + + this.setIcon( toggleIcons.get( current ) ); + this.setToolTipText( toggleLabels.get( current ) ); + addActionListener( a -> { + next(); + } ); + } + + private void populatePopupMenu() + { + menu.setInvoker( this ); + + for ( int i = 0; i < toggleActions.size(); i++ ) { - final JMenuItem item = new JMenuItem( this.labels[ i ], this.toggleIcons[ i ] ); - final int index = i; - item.addActionListener( a -> { - current = index; - trigger(); - } ); - this.menu.add( item ); + createMenuItem( i ); } - menu.setInvoker( this ); this.addMouseListener( new MouseAdapter() { @Override @@ -48,27 +73,101 @@ public void mouseClicked( MouseEvent mouseEvent ) menu.show( menu.getInvoker(), mouseEvent.getX(), mouseEvent.getY() ); } } ); - this.setContentAreaFilled( false ); - this.setFocusPainted( false ); - this.setBorderPainted( false ); - this.setIcon( toggleIcons[ current ] ); - this.setToolTipText( labels[ current ] ); + } - addActionListener( a -> { - next(); + private void createMenuItem( final int i ) + { + final JMenuItem item = new JMenuItem( toggleLabels.get( i ), toggleIcons.get( i ) ); + final int index = i; + item.addActionListener( a -> { + current = index; + trigger(); } ); + menu.add( item ); } + /** + * Toggle to the next action in the list. + */ public void next() { - current = ( current + 1 ) % toggleActions.length; + current = ( current + 1 ) % toggleActions.size(); + trigger(); + } + + /** + * Select a specific option. + * + * @param index modulo number-of-options is set. + */ + public void setCurrent( final int index ) + { + this.current = index % toggleActions.size(); trigger(); } + /** + * Select an option via name. + * + * @param label of the option + */ + public void setCurrent( final String label ) + { + if ( toggleLabels.contains( label ) ) + { + current = toggleLabels.indexOf( label ); + trigger(); + } + } + + /** + * Add a new option. + * + * @param icon of the option + * @param label of the option + * @param action triggered by this option + */ + public void addOption( final Icon icon, final String label, final Runnable action ) + { + toggleIcons.add( icon ); + toggleLabels.add( label ); + toggleActions.add( action ); + createMenuItem( toggleIcons.size() - 1 ); + } + + /** + * Removes the option. + * + * @param label of the option + */ + public void removeOption( final String label ) + { + if ( toggleLabels.contains( label ) ) + { + removeOption( toggleLabels.indexOf( label ) ); + } + } + + /** + * Remove option via index. + * + * @param index + */ + public void removeOption( final int index ) + { + if ( index < toggleLabels.size() ) + { + toggleIcons.remove( index ); + toggleLabels.remove( index ); + toggleActions.remove( index ); + menu.remove( index ); + } + } + private void trigger() { - this.setIcon( toggleIcons[ current ] ); - this.setToolTipText( labels[ current ] ); - toggleActions[ current ].run(); + this.setIcon( toggleIcons.get( current ) ); + this.setToolTipText( toggleLabels.get( current ) ); + toggleActions.get( current ).run(); } } diff --git a/src/test/java/bdv/ui/ToggleGroupButtonExample.java b/src/test/java/bdv/ui/ToggleGroupButtonExample.java index d4dc645b8..a40b40873 100644 --- a/src/test/java/bdv/ui/ToggleGroupButtonExample.java +++ b/src/test/java/bdv/ui/ToggleGroupButtonExample.java @@ -3,6 +3,8 @@ import bdv.ui.iconcards.options.ToggleGroupButton; import java.awt.Dimension; import java.awt.Image; +import java.util.ArrayList; +import java.util.List; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JFrame; @@ -23,9 +25,22 @@ public static void main( String[] args ) final Image translation_on = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/translation_on.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); final Image translation_off = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/translation_off.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); - final ToggleGroupButton button = new ToggleGroupButton( new Icon[] { new ImageIcon( rotation_on ), new ImageIcon( rotation_off ), new ImageIcon( translation_on ), new ImageIcon( translation_off ) }, - new String[] { "Rotation On", "Rotation Off", "Translation On", "Translation Off" }, - new Runnable[] { () -> System.out.println( "Rotation On" ), () -> System.out.println( "Rotation Off" ), () -> System.out.println( "Translation On" ), () -> System.out.println( "Translation Off" ) } ); + final List< Icon > icons = new ArrayList<>(); + icons.add( new ImageIcon( rotation_on ) ); + icons.add( new ImageIcon( rotation_off ) ); + final List< String > labels = new ArrayList<>(); + labels.add( "Rotation On" ); + labels.add( "Rotation Off" ); + final List< Runnable > actions = new ArrayList<>(); + actions.add( () -> System.out.println( "Rotation On" ) ); + actions.add( () -> System.out.println( "Rotation Off" ) ); + + final ToggleGroupButton button = new ToggleGroupButton( icons, labels, actions ); + + button.addOption( new ImageIcon( translation_on ), "Translation On", () -> System.out.println( "Translation On" ) ); + button.addOption( new ImageIcon( translation_off ), "Uups", () -> System.out.println( "uups" ) ); + button.removeOption( "Uups" ); + button.addOption( new ImageIcon( translation_off ), "Translation Off", () -> System.out.println( "Translation Off" ) ); button.setPreferredSize( new Dimension( 40, 40 ) ); frame.add( button, "growx, growy" ); From 1879be17181785e785432f70c1752e519694c4cd Mon Sep 17 00:00:00 2001 From: tibuch Date: Fri, 13 Mar 2020 16:44:03 +0100 Subject: [PATCH 4/5] Add AnnotatedToggleGroupButton --- .../options/AnnotatedToggleGroupButton.java | 88 +++++++++++++++++++ .../ui/AnnotatedToggleGroupButtonExample.java | 59 +++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java create mode 100644 src/test/java/bdv/ui/AnnotatedToggleGroupButtonExample.java diff --git a/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java b/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java new file mode 100644 index 000000000..bfb544878 --- /dev/null +++ b/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java @@ -0,0 +1,88 @@ +package bdv.ui.iconcards.options; + +import java.awt.Font; +import java.util.List; +import javax.swing.Icon; +import javax.swing.JLabel; +import javax.swing.JPanel; +import net.miginfocom.swing.MigLayout; + +public class AnnotatedToggleGroupButton extends JPanel +{ + + private final ToggleGroupButton button; + + private final JLabel annotation; + + private final List< String > annotations; + + public AnnotatedToggleGroupButton( final List< Icon > toggleIcons, final List< String > toggleLabels, final List< Runnable > toggleActions, final List< String > annotations ) + { + this.annotations = annotations; + + button = new ToggleGroupButton( toggleIcons, toggleLabels, toggleActions ); + annotation = new JLabel( annotations.get( button.getCurrent() ) ); + + this.setLayout( new MigLayout( "ins 0, fillx, filly", "[]", "[]0lp![]" ) ); + + this.add( button, "growx, center, wrap" ); + this.add( annotation, "center" ); + + button.addChangeListener( l -> { + updateAnnotation(); + } ); + } + + private void updateAnnotation() + { + annotation.setText( annotations.get( button.getCurrent() ) ); + annotation.repaint(); + } + + public void setAnnotationFont( final Font font ) + { + annotation.setFont( font ); + } + + public synchronized void next() + { + button.next(); + } + + public synchronized void setCurrent( final int index ) + { + button.setCurrent( index ); + } + + public synchronized void setCurrent( final String label ) + { + button.setCurrent( label ); + } + + public synchronized int getCurrent() + { + return button.getCurrent(); + } + + public synchronized int getIndexOfLabel( final String label ) + { + return button.getIndexOfLabel( label ); + } + + public synchronized void addOption( final Icon icon, final String label, final Runnable action, final String annotation ) + { + button.addOption( icon, label, action ); + annotations.add( annotation ); + } + + public synchronized void removeOption( final String label ) + { + removeOption( button.getIndexOfLabel( label ) ); + } + + public synchronized void removeOption( final int index ) + { + button.removeOption( index ); + annotations.remove( index ); + } +} diff --git a/src/test/java/bdv/ui/AnnotatedToggleGroupButtonExample.java b/src/test/java/bdv/ui/AnnotatedToggleGroupButtonExample.java new file mode 100644 index 000000000..d5b2a41a4 --- /dev/null +++ b/src/test/java/bdv/ui/AnnotatedToggleGroupButtonExample.java @@ -0,0 +1,59 @@ +package bdv.ui; + +import bdv.ui.iconcards.options.AnnotatedToggleGroupButton; +import bdv.ui.iconcards.options.ToggleGroupButton; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Image; +import java.util.ArrayList; +import java.util.List; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import net.miginfocom.swing.MigLayout; + +public class AnnotatedToggleGroupButtonExample +{ + public static void main( String[] args ) + { + System.setProperty( "apple.laf.useScreenMenuBar", "true" ); + + final JFrame frame = new JFrame( "ToggleGroupButton Example" ); + frame.setLayout( new MigLayout( "ins 0, fillx, filly", "[grow]", "" ) ); + + final Image rotation_on = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/rotation_on.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + final Image rotation_off = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/rotation_off.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + final Image translation_on = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/translation_on.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + final Image translation_off = new ImageIcon( frame.getClass().getResource( "/bdv/ui/viewermodepanel/translation_off.png" ) ).getImage().getScaledInstance( 40, 40, Image.SCALE_SMOOTH ); + + final List< Icon > icons = new ArrayList<>(); + icons.add( new ImageIcon( rotation_on ) ); + icons.add( new ImageIcon( rotation_off ) ); + final List< String > labels = new ArrayList<>(); + labels.add( "Rotation On" ); + labels.add( "Rotation Off" ); + final List< Runnable > actions = new ArrayList<>(); + actions.add( () -> System.out.println( "Rotation On" ) ); + actions.add( () -> System.out.println( "Rotation Off" ) ); + + final List< String > annotations = new ArrayList<>( ); + annotations.add( "Rot. On" ); + annotations.add( "Rot. Off" ); + + final AnnotatedToggleGroupButton button = new AnnotatedToggleGroupButton( icons, labels, actions, annotations ); + button.setAnnotationFont( new Font( button.getFont().getName(), Font.TRUETYPE_FONT, 9 ) ); + + button.addOption( new ImageIcon( translation_on ), "Translation On", () -> System.out.println( "Translation On" ), "Trans. On" ); + button.addOption( new ImageIcon( translation_off ), "Uups", () -> System.out.println( "uups" ), "Ups" ); + button.removeOption( "Uups" ); + button.addOption( new ImageIcon( translation_off ), "Translation Off", () -> System.out.println( "Translation Off" ), "Trans. Off" ); + + button.setPreferredSize( new Dimension( 40, 40 ) ); + frame.add( button, "growx, growy" ); + frame.pack(); + frame.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE ); + frame.setVisible( true ); + } +} + From ee85604e60097472cb98cb235470bf8bd125a594 Mon Sep 17 00:00:00 2001 From: tibuch Date: Tue, 17 Mar 2020 10:23:52 +0100 Subject: [PATCH 5/5] wip --- .../options/AnnotatedToggleGroupButton.java | 40 +++++++------------ .../iconcards/options/ToggleGroupButton.java | 30 ++++++++++---- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java b/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java index bfb544878..b9b044281 100644 --- a/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java +++ b/src/main/java/bdv/ui/iconcards/options/AnnotatedToggleGroupButton.java @@ -5,6 +5,7 @@ import javax.swing.Icon; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import net.miginfocom.swing.MigLayout; public class AnnotatedToggleGroupButton extends JPanel @@ -14,7 +15,7 @@ public class AnnotatedToggleGroupButton extends JPanel private final JLabel annotation; - private final List< String > annotations; + private final List< String> annotations; public AnnotatedToggleGroupButton( final List< Icon > toggleIcons, final List< String > toggleLabels, final List< Runnable > toggleActions, final List< String > annotations ) { @@ -28,60 +29,49 @@ public AnnotatedToggleGroupButton( final List< Icon > toggleIcons, final List< S this.add( button, "growx, center, wrap" ); this.add( annotation, "center" ); - button.addChangeListener( l -> { - updateAnnotation(); - } ); + button.addChangeListener( l -> {updateAnnotation();} ); } private void updateAnnotation() { annotation.setText( annotations.get( button.getCurrent() ) ); - annotation.repaint(); +// annotation.invalidate(); + this.update( annotation.getGraphics() ); } - public void setAnnotationFont( final Font font ) + public void setAnnotationFont(final Font font) { annotation.setFont( font ); } - public synchronized void next() - { + public synchronized void next() { button.next(); } - public synchronized void setCurrent( final int index ) - { + public synchronized void setCurrent(final int index) { button.setCurrent( index ); } - public synchronized void setCurrent( final String label ) - { + public synchronized void setCurrent(final String label) { button.setCurrent( label ); } - public synchronized int getCurrent() - { - return button.getCurrent(); - } + public synchronized int getCurrent() { return button.getCurrent(); } - public synchronized int getIndexOfLabel( final String label ) - { + public synchronized int getIndexOfLabel(final String label) { return button.getIndexOfLabel( label ); } - public synchronized void addOption( final Icon icon, final String label, final Runnable action, final String annotation ) - { + public synchronized void addOption( final Icon icon, final String label, final Runnable action, final String annotation) { button.addOption( icon, label, action ); - annotations.add( annotation ); + annotations.add(annotation); } - public synchronized void removeOption( final String label ) - { + public synchronized void removeOption(final String label) { removeOption( button.getIndexOfLabel( label ) ); } - public synchronized void removeOption( final int index ) - { + public synchronized void removeOption(final int index) { button.removeOption( index ); annotations.remove( index ); } diff --git a/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java b/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java index c787572af..926151465 100644 --- a/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java +++ b/src/main/java/bdv/ui/iconcards/options/ToggleGroupButton.java @@ -89,7 +89,7 @@ private void createMenuItem( final int i ) /** * Toggle to the next action in the list. */ - public void next() + public synchronized void next() { current = ( current + 1 ) % toggleActions.size(); trigger(); @@ -100,7 +100,7 @@ public void next() * * @param index modulo number-of-options is set. */ - public void setCurrent( final int index ) + public synchronized void setCurrent( final int index ) { this.current = index % toggleActions.size(); trigger(); @@ -111,7 +111,7 @@ public void setCurrent( final int index ) * * @param label of the option */ - public void setCurrent( final String label ) + public synchronized void setCurrent( final String label ) { if ( toggleLabels.contains( label ) ) { @@ -120,6 +120,20 @@ public void setCurrent( final String label ) } } + /** + * Get current selected option index. + * + * @return current index + */ + public synchronized int getCurrent() + { + return current; + } + + public synchronized int getIndexOfLabel(final String label) { + return toggleLabels.indexOf( label ); + } + /** * Add a new option. * @@ -127,7 +141,7 @@ public void setCurrent( final String label ) * @param label of the option * @param action triggered by this option */ - public void addOption( final Icon icon, final String label, final Runnable action ) + public synchronized void addOption( final Icon icon, final String label, final Runnable action ) { toggleIcons.add( icon ); toggleLabels.add( label ); @@ -140,7 +154,7 @@ public void addOption( final Icon icon, final String label, final Runnable actio * * @param label of the option */ - public void removeOption( final String label ) + public synchronized void removeOption( final String label ) { if ( toggleLabels.contains( label ) ) { @@ -150,10 +164,10 @@ public void removeOption( final String label ) /** * Remove option via index. - * + * * @param index */ - public void removeOption( final int index ) + public synchronized void removeOption( final int index ) { if ( index < toggleLabels.size() ) { @@ -168,6 +182,6 @@ private void trigger() { this.setIcon( toggleIcons.get( current ) ); this.setToolTipText( toggleLabels.get( current ) ); - toggleActions.get( current ).run(); + SwingUtilities.invokeLater( toggleActions.get( current ) ); } }