IDEABKL-6053 IDE buttons Tooltip delay

This commit is contained in:
Vassiliy Kudryashov
2013-02-08 21:20:54 +04:00
parent b9506e420e
commit da7003f1b6
2 changed files with 58 additions and 4 deletions
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.util.ui.UIUtil;
@@ -66,6 +67,20 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels()));
myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer());
Dictionary<Integer, JLabel> delayDictionary = new Hashtable<Integer, JLabel>();
delayDictionary.put(new Integer(0), new JLabel("0"));
delayDictionary.put(new Integer(1200), new JLabel("1200"));
//delayDictionary.put(new Integer(2400), new JLabel("2400"));
myComponent.myInitialTooltipDelaySlider.setLabelTable(delayDictionary);
UIUtil.setSliderIsFilled(myComponent.myInitialTooltipDelaySlider, Boolean.TRUE);
myComponent.myInitialTooltipDelaySlider.setMinimum(0);
myComponent.myInitialTooltipDelaySlider.setMaximum(1200);
myComponent.myInitialTooltipDelaySlider.setPaintLabels(true);
myComponent.myInitialTooltipDelaySlider.setPaintTicks(true);
myComponent.myInitialTooltipDelaySlider.setPaintTrack(true);
myComponent.myInitialTooltipDelaySlider.setMajorTickSpacing(1200);
myComponent.myInitialTooltipDelaySlider.setMinorTickSpacing(100);
myComponent.myEnableAlphaModeCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected();
@@ -196,6 +211,11 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
settings.ALPHA_MODE_RATIO = ratio;
}
}
int tooltipDelay = Math.min(myComponent.myInitialTooltipDelaySlider.getValue(), 5000);
if (tooltipDelay != Registry.intValue("ide.tooltip.initialDelay")) {
update = true;
Registry.get("ide.tooltip.initialDelay").setValue(tooltipDelay);
}
if (update) {
settings.fireUISettingsChanged();
@@ -240,6 +260,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
myComponent.myAlphaModeRatioSlider.setValue(ratio);
myComponent.myAlphaModeRatioSlider.setToolTipText(ratio + "%");
myComponent.myAlphaModeRatioSlider.setEnabled(alphaModeEnabled && settings.ENABLE_ALPHA_MODE);
myComponent.myInitialTooltipDelaySlider.setValue(Registry.intValue("ide.tooltip.initialDelay"));
myComponent.updateCombo();
}
@@ -284,6 +305,9 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f;
isModified |= ratio != settings.ALPHA_MODE_RATIO;
}
int tooltipDelay = -1;
tooltipDelay = myComponent.myInitialTooltipDelaySlider.getValue();
isModified |= tooltipDelay != Registry.intValue("ide.tooltip.initialDelay");
return isModified;
}
@@ -320,9 +344,10 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
private JCheckBox myCbDisplayIconsInMenu;
private JCheckBox myDisableMnemonics;
private JCheckBox myDisableMnemonicInControlsCheckBox;
private JBCheckBox myHideNavigationPopupsCheckBox;
private JCheckBox myHideNavigationPopupsCheckBox;
private JCheckBox myAllowMergeButtons;
private JBCheckBox myUseSmallLabelsOnTabs;
private JSlider myInitialTooltipDelaySlider;
public MyComponent() {
myOverrideLAFFonts.addActionListener( new ActionListener() {
@@ -16,7 +16,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="d992b" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="d992b" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
@@ -147,6 +147,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
<text resource-bundle="messages/IdeBundle" key="checkbox.override.default.laf.fonts"/>
</properties>
</component>
@@ -161,14 +162,42 @@
<text resource-bundle="messages/IdeBundle" key="checkbox.show.icons.in.quick.navigation"/>
</properties>
</component>
<component id="fdf33" class="com.intellij.ui.components.JBCheckBox" binding="myHideNavigationPopupsCheckBox">
<component id="9327f" class="javax.swing.JCheckBox" binding="myHideNavigationPopupsCheckBox">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
<text value="Hide navigation popups on focus loss"/>
</properties>
</component>
<grid id="372a6" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="6061e" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Tooltip initial delay (ms):"/>
</properties>
</component>
<component id="6ec4c" class="javax.swing.JSlider" binding="myInitialTooltipDelaySlider">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<paintTrack value="true"/>
<value value="1200"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="26e1c" binding="myTransparencyPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">