IDEA-82242 Scroll the tabs with mouse wheel

This commit is contained in:
Vassiliy Kudryashov
2013-05-06 23:18:22 +04:00
parent be9e2fa9f7
commit 4886c2eda9
3 changed files with 12 additions and 5 deletions
@@ -51,7 +51,7 @@ public class JBEditorTabs extends JBTabsImpl {
@Override
protected SingleRowLayout createSingleRowLayout() {
if (ApplicationManager.getApplication().isInternal()) {
if (ApplicationManager.getApplication().isInternal() || Registry.is("editor.use.scrollable.tabs")) {
return new ScrollableSingleRowLayout(this);
}
return super.createSingleRowLayout();
@@ -48,10 +48,13 @@ public class SingleRowLayout extends TabLayout {
@Override
protected int getIconY(Rectangle iconRec) {
return super.getIconY(iconRec) +
(myTabs.getTabsPosition() == JBTabsPosition.bottom
? TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT
: -(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT / 2));
final int shift;
switch (myTabs.getTabsPosition()) {
case bottom: shift = TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; break;
case top: shift = -(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT / 2); break;
default: shift = 0;
}
return super.getIconY(iconRec) + shift;
}
};
public JPopupMenu myMorePopup;
@@ -352,6 +355,9 @@ public class SingleRowLayout extends TabLayout {
protected void calculateRequiredLength(SingleRowPassInfo data) {
for (TabInfo eachInfo : data.myVisibleInfos) {
data.requiredLength += getRequiredLength(eachInfo);
if (myTabs.getTabsPosition() == JBTabsPosition.left || myTabs.getTabsPosition() == JBTabsPosition.right) {
data.requiredLength -= 1;
}
data.toLayout.add(eachInfo);
}
}
@@ -105,6 +105,7 @@ editor.balloonHints=true
editor.mouseSelectionStateResetTimeout=1000
editor.mouseSelectionStateResetDeadZone=4
editor.use.new.tabs=true
editor.use.scrollable.tabs=true
editor.smarterSelectionQuoting=true
editor.skip.copy.and.cut.for.empty.selection=false