IDEA-95058 An option to set regular font size on editor's tab titles

This commit is contained in:
Konstantin Bulenkov
2013-01-22 17:03:05 +01:00
parent 715a98b41e
commit 95a19cce11
5 changed files with 26 additions and 2 deletions
@@ -91,6 +91,7 @@ public class UISettings implements PersistentStateComponent<UISettings>, Exporta
public boolean SHOW_ICONS_IN_MENUS = true;
public boolean DISABLE_MNEMONICS = SystemInfo.isMac; // IDEADEV-33409, should be disabled by default on MacOS
public boolean DISABLE_MNEMONICS_IN_CONTROLS = false;
public boolean USE_SMALL_LABELS_ON_TABS = SystemInfo.isMac;
public boolean SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = false;
public int MAX_LOOKUP_WIDTH2 = 500;
public int MAX_LOOKUP_LIST_HEIGHT = 11;
@@ -15,6 +15,7 @@
*/
package com.intellij.ui.tabs.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.application.ApplicationManager;
@@ -76,7 +77,7 @@ public class JBEditorTabs extends JBTabsImpl {
@Override
public boolean useSmallLabels() {
return SystemInfo.isMac;
return UISettings.getInstance().USE_SMALL_LABELS_ON_TABS;
}
@Override
@@ -52,6 +52,14 @@ public class TabLabel extends JPanel {
protected boolean shouldDrawDimmed() {
return myTabs.getSelectedInfo() != myInfo || myTabs.useBoldLabels();
}
@Override
public Font getFont() {
if (isFontSet() || !myTabs.useSmallLabels()) {
return super.getFont();
}
return UIUtil.getLabelFont(UIUtil.FontSize.SMALL);
}
};
private final LayeredIcon myIcon;
@@ -77,7 +85,6 @@ public class TabLabel extends JPanel {
myLabel.setIconTextGap(tabs.isEditorTabs() ? 2 : new JLabel().getIconTextGap());
myLabel.setIconOpaque(false);
myLabel.setIpad(new Insets(0, 0, 0, 0));
if (myTabs.useSmallLabels() || UIUtil.isUnderDarcula()) myLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
setOpaque(false);
setLayout(new BorderLayout());
@@ -148,6 +148,9 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
update |= settings.DISABLE_MNEMONICS != myComponent.myDisableMnemonics.isSelected();
settings.DISABLE_MNEMONICS = myComponent.myDisableMnemonics.isSelected();
update |= settings.USE_SMALL_LABELS_ON_TABS != myComponent.myUseSmallLabelsOnTabs.isSelected();
settings.USE_SMALL_LABELS_ON_TABS = myComponent.myUseSmallLabelsOnTabs.isSelected();
update |= settings.DISABLE_MNEMONICS_IN_CONTROLS != myComponent.myDisableMnemonicInControlsCheckBox.isSelected();
settings.DISABLE_MNEMONICS_IN_CONTROLS = myComponent.myDisableMnemonicInControlsCheckBox.isSelected();
@@ -221,6 +224,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
myComponent.myLafComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel());
myComponent.myOverrideLAFFonts.setSelected(settings.OVERRIDE_NONIDEA_LAF_FONTS);
myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS);
myComponent.myUseSmallLabelsOnTabs.setSelected(settings.USE_SMALL_LABELS_ON_TABS);
myComponent.myDisableMnemonicInControlsCheckBox.setSelected(settings.DISABLE_MNEMONICS_IN_CONTROLS);
boolean alphaModeEnabled = WindowManagerEx.getInstanceEx().isAlphaModeSupported();
@@ -260,6 +264,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
isModified |= myComponent.myDisableMnemonics.isSelected() != settings.DISABLE_MNEMONICS;
isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.DISABLE_MNEMONICS_IN_CONTROLS;
isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.USE_SMALL_LABELS_ON_TABS;
isModified |= myComponent.myHideIconsInQuickNavigation.isSelected() != settings.SHOW_ICONS_IN_QUICK_NAVIGATION;
isModified |= myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected() != settings.MOVE_MOUSE_ON_DEFAULT_BUTTON;
@@ -332,6 +338,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
private JCheckBox myDisableMnemonicInControlsCheckBox;
private JBCheckBox myHideNavigationPopupsCheckBox;
private JCheckBox myAllowMergeButtons;
private JBCheckBox myUseSmallLabelsOnTabs;
public MyComponent() {
myOverrideLAFFonts.addActionListener( new ActionListener() {
@@ -315,6 +315,14 @@
<text value="Allow merging buttons on dialogs"/>
</properties>
</component>
<component id="6d38a" class="com.intellij.ui.components.JBCheckBox" binding="myUseSmallLabelsOnTabs">
<constraints>
<grid row="3" column="1" 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="Small labels in editor tabs"/>
</properties>
</component>
</children>
</grid>
</children>