diff --git a/docking-frames-common/pom.xml b/docking-frames-common/pom.xml index 70e2c305..a2685e29 100644 --- a/docking-frames-common/pom.xml +++ b/docking-frames-common/pom.xml @@ -5,7 +5,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c docking-frames-common diff --git a/docking-frames-core/changes.txt b/docking-frames-core/changes.txt index cccb20d6..ce5ba262 100644 --- a/docking-frames-core/changes.txt +++ b/docking-frames-core/changes.txt @@ -1118,4 +1118,9 @@ - Feature (provided by Nicolas Roduit): new and better translations for various languages [v1.1.2p19b] -- Bugfix: memory leak fixed, that was caused by a listener created by the "AbstractTabLayoutManagerPane". The listener was never removed properly. Thanks mattbru2 for finding the bug! \ No newline at end of file +- Bugfix: memory leak fixed, that was caused by a listener created by the "AbstractTabLayoutManagerPane". The listener was never removed properly. Thanks mattbru2 for finding the bug! + +[v1.1.2p19c] +- Bugfix: disabled icon of DockActions was converted to gray twice, making them hard to read and also overriding the (not gray) icon that might be set by the client. Thanks Thomas for finding this bug. +- Bugfix: disabled icon of DockActions was not painted in drop-down-menus + diff --git a/docking-frames-core/pom.xml b/docking-frames-core/pom.xml index c7346826..b20db34d 100644 --- a/docking-frames-core/pom.xml +++ b/docking-frames-core/pom.xml @@ -5,7 +5,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c docking-frames-core diff --git a/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/buttons/MiniButtonContent.java b/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/buttons/MiniButtonContent.java index 70921c8f..5fabec92 100644 --- a/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/buttons/MiniButtonContent.java +++ b/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/buttons/MiniButtonContent.java @@ -149,6 +149,9 @@ public void updateUI(){ label.setIconOffset( 0 ); label.setIconTextDistance( 2 ); + + // we already build our own disabled version of the icon + label.setPaintDisabledIcon( false ); } /** diff --git a/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/menu/AbstractMenuHandler.java b/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/menu/AbstractMenuHandler.java index 4b84a031..f2d5ced1 100644 --- a/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/menu/AbstractMenuHandler.java +++ b/docking-frames-core/src/bibliothek/gui/dock/themes/basic/action/menu/AbstractMenuHandler.java @@ -39,6 +39,7 @@ import bibliothek.gui.dock.action.DockAction; import bibliothek.gui.dock.action.StandardDockAction; import bibliothek.gui.dock.event.StandardDockActionListener; +import bibliothek.gui.dock.util.DockUtilities; /** * A handler that connects a {@link JMenuItem} with a {@link DockAction}. @@ -110,7 +111,7 @@ public void bind(){ if( item != null ){ item.setEnabled( action.isEnabled( dockable )); item.setIcon( getIcon( ActionContentModifier.NONE_HORIZONTAL ) ); - item.setDisabledIcon( action.getIcon( dockable, ActionContentModifier.DISABLED ) ); + updateDisabledIcon(); item.setText( action.getText( dockable )); item.setToolTipText( action.getTooltipText( dockable )); } @@ -120,23 +121,44 @@ public void bind(){ } } - private Icon getIcon( ActionContentModifier modifier ){ + private void updateDisabledIcon(){ + Icon icon = getIcon( ActionContentModifier.DISABLED_HORIZONTAL, ActionContentModifier.NONE_HORIZONTAL, ActionContentModifier.NONE ); + if( icon == null ){ + icon = getIcon( ActionContentModifier.NONE_HORIZONTAL ); + icon = DockUtilities.disabledIcon( getItem(), icon ); + } + + item.setDisabledIcon( icon ); + } + + private Icon getIcon( ActionContentModifier modifier, ActionContentModifier... limits ){ List modifiers = new LinkedList(); modifiers.add( modifier ); while( !modifiers.isEmpty() ){ modifier = modifiers.remove( 0 ); - Icon icon = action.getIcon( dockable, modifier ); - if( icon != null ){ - return icon; - } - for( ActionContentModifier backup : modifier.getBackup() ){ - modifiers.add( backup ); + if( !isLimited( modifier, limits )){ + Icon icon = action.getIcon( dockable, modifier ); + if( icon != null ){ + return icon; + } + for( ActionContentModifier backup : modifier.getBackup() ){ + modifiers.add( backup ); + } } } return null; } + private boolean isLimited( ActionContentModifier modifier, ActionContentModifier... limits ){ + for( ActionContentModifier limit : limits ){ + if( limit.equals( modifier )){ + return true; + } + } + return false; + } + /** * Disconnects this handler from its action */ @@ -172,8 +194,8 @@ public void actionIconChanged( StandardDockAction action, ActionContentModifier else if( modifier == null || modifier == ActionContentModifier.NONE ){ item.setIcon( getIcon( ActionContentModifier.NONE_HORIZONTAL ) ); } - if( modifier == null || modifier == ActionContentModifier.DISABLED ){ - item.setDisabledIcon( action.getIcon( dockable, ActionContentModifier.DISABLED ) ); + if( modifier == null || modifier == ActionContentModifier.DISABLED || modifier == ActionContentModifier.DISABLED_HORIZONTAL ){ + updateDisabledIcon(); } } } diff --git a/docking-frames-core/src/bibliothek/gui/dock/util/swing/OrientedLabel.java b/docking-frames-core/src/bibliothek/gui/dock/util/swing/OrientedLabel.java index 0f181b86..1ba402d1 100644 --- a/docking-frames-core/src/bibliothek/gui/dock/util/swing/OrientedLabel.java +++ b/docking-frames-core/src/bibliothek/gui/dock/util/swing/OrientedLabel.java @@ -32,6 +32,9 @@ public class OrientedLabel extends ConfiguredBackgroundPanel{ /** icon painted when this label is disabled */ private Icon disabledIcon; + /** whether to paint a special disabled version of {@link #icon} if disabled */ + private boolean paintDisabledIcon = true; + /** distance between icon and border */ private int iconOffset = 2; @@ -79,6 +82,23 @@ public Icon getIcon(){ return icon; } + /** + * Whether to build and paint a special disabled version of {@link #getIcon()} if this label is disabled. + * @param paintDisabledIcon whether to paint the special icon + */ + public void setPaintDisabledIcon( boolean paintDisabledIcon ) { + this.paintDisabledIcon = paintDisabledIcon; + revalidate(); + repaint(); + } + /** + * Whether a special disabled version of {@link #getIcon()} is painted if this label is disabled. + * @return true if an artificial icon is created + */ + public boolean isPaintDisabledIcon() { + return paintDisabledIcon; + } + /** * Sets the distance between icon and the three adjacent borders. * @param iconOffset the distance @@ -350,7 +370,7 @@ public void paintForeground( Graphics g ){ } else{ Icon icon = this.icon; - if( !isEnabled() ){ + if( !isEnabled() && paintDisabledIcon ){ if( disabledIcon == null ){ disabledIcon = DockUtilities.disabledIcon( this, icon ); } diff --git a/docking-frames-core/version b/docking-frames-core/version index 4c650a2b..b40a8d86 100644 --- a/docking-frames-core/version +++ b/docking-frames-core/version @@ -1 +1 @@ -1.1.2-P19b \ No newline at end of file +1.1.2-P19c \ No newline at end of file diff --git a/docking-frames-demo-tutorial/pom.xml b/docking-frames-demo-tutorial/pom.xml index dad94ef1..6e4b056d 100644 --- a/docking-frames-demo-tutorial/pom.xml +++ b/docking-frames-demo-tutorial/pom.xml @@ -5,7 +5,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c tutorial diff --git a/docking-frames-ext-glass/pom.xml b/docking-frames-ext-glass/pom.xml index b15e1b90..140a3efc 100644 --- a/docking-frames-ext-glass/pom.xml +++ b/docking-frames-ext-glass/pom.xml @@ -6,7 +6,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c docking-frames-ext-glass diff --git a/docking-frames-ext-toolbar-common/pom.xml b/docking-frames-ext-toolbar-common/pom.xml index 4937ddc6..52369028 100644 --- a/docking-frames-ext-toolbar-common/pom.xml +++ b/docking-frames-ext-toolbar-common/pom.xml @@ -5,7 +5,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c docking-frames-ext-toolbar-common diff --git a/docking-frames-ext-toolbar-tutorial/pom.xml b/docking-frames-ext-toolbar-tutorial/pom.xml index 4b5f9265..a8c17386 100644 --- a/docking-frames-ext-toolbar-tutorial/pom.xml +++ b/docking-frames-ext-toolbar-tutorial/pom.xml @@ -5,7 +5,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c tutorial-toolbar diff --git a/docking-frames-ext-toolbar/pom.xml b/docking-frames-ext-toolbar/pom.xml index 7ef1869a..0541ec89 100644 --- a/docking-frames-ext-toolbar/pom.xml +++ b/docking-frames-ext-toolbar/pom.xml @@ -5,7 +5,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c docking-frames-ext-toolbar diff --git a/pom.xml b/pom.xml index 7bd733c9..5248e235 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.dockingframes docking-frames-base - 1.1.2-P19b + 1.1.2-P19c pom