mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-123086 Show pinned tabs in a separate row
GitOrigin-RevId: f5ca8f9d1ae68e474728289a72c7ec1a22fe9ab4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
55eaf93f36
commit
245594bfc1
@@ -94,6 +94,8 @@ class UISettingsState : BaseState() {
|
||||
var scrollTabLayoutInEditor by property(true)
|
||||
@get:OptionTag("HIDE_TABS_IF_NEED")
|
||||
var hideTabsIfNeeded by property(true)
|
||||
@get:OptionTag("SHOW_PINNED_TABS_IN_A_SEPARATE_ROW")
|
||||
var showPinnedTabsInASeparateRow by property(false)
|
||||
@get:OptionTag("SHOW_CLOSE_BUTTON")
|
||||
var showCloseButton by property(true)
|
||||
@get:OptionTag("CLOSE_TAB_BUTTON_ON_THE_RIGHT")
|
||||
|
||||
@@ -288,6 +288,7 @@ combobox.editor.tab.placement=Tab placement
|
||||
checkbox.editor.tabs.in.single.row=Show tabs in one row
|
||||
tabs.close.button.placement=Close button position
|
||||
checkbox.editor.scroll.if.need=Hide tabs if there is no space
|
||||
checkbox.show.pinned.tabs.in.a.separate.row=Show pinned tabs in a separate row
|
||||
checkbox.show.file.icon.in.editor.tabs=Show file icon
|
||||
checkbox.show.file.extension.in.editor.tabs=Show file extension
|
||||
checkbox.show.directory.for.non.unique.files=Show directory for non-unique file names
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ui.tabs.impl.table;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ui.tabs.TabInfo;
|
||||
import com.intellij.ui.tabs.TabsUtil;
|
||||
import com.intellij.ui.tabs.impl.JBTabsImpl;
|
||||
@@ -38,12 +39,13 @@ public class TableLayout extends TabLayout {
|
||||
final int maxX = data.toFitRec.x + data.toFitRec.width;
|
||||
|
||||
int hGap = myTabs.getTabHGap();
|
||||
boolean showPinnedTabsSeparately = UISettings.getInstance().getState().getShowPinnedTabsInASeparateRow();
|
||||
for (TabInfo eachInfo : data.myVisibleInfos) {
|
||||
final TabLabel eachLabel = myTabs.myInfo2Label.get(eachInfo);
|
||||
boolean pinned = eachLabel.isPinned();
|
||||
final Dimension size = eachLabel.getNotStrictPreferredSize();
|
||||
int width = size.width + hGap;
|
||||
if (pinned) {
|
||||
if (pinned && showPinnedTabsSeparately) {
|
||||
if (eachXPinned + width >= maxX) {
|
||||
requiredRowsPinned++;
|
||||
eachXPinned = data.toFitRec.x;
|
||||
@@ -75,7 +77,7 @@ public class TableLayout extends TabLayout {
|
||||
final Dimension size = eachLabel.getNotStrictPreferredSize();
|
||||
boolean pinned = eachLabel.isPinned();
|
||||
int width = size.width + hGap;
|
||||
if (pinned) {
|
||||
if (pinned && showPinnedTabsSeparately) {
|
||||
if (eachXPinned + width <= maxX) {
|
||||
eachTableRow.add(eachInfo, width);
|
||||
eachXPinned += width;
|
||||
@@ -86,7 +88,7 @@ public class TableLayout extends TabLayout {
|
||||
eachTableRow.add(eachInfo, width);
|
||||
}
|
||||
} else {
|
||||
if (eachXUnpinned + size.width + hGap <= maxX && !eachLabel.isNextToLastPinned()) {
|
||||
if (eachXUnpinned + size.width + hGap <= maxX && (!showPinnedTabsSeparately || !eachLabel.isNextToLastPinned())) {
|
||||
eachTableRow.add(eachInfo, width);
|
||||
eachXUnpinned += width;
|
||||
} else {
|
||||
@@ -118,6 +120,7 @@ public class TableLayout extends TabLayout {
|
||||
Insets insets = myTabs.getLayoutInsets();
|
||||
int eachY = insets.top;
|
||||
TablePassInfo data = new TablePassInfo(myTabs, visibleInfos);
|
||||
boolean showPinnedTabsSeparately = UISettings.getInstance().getState().getShowPinnedTabsInASeparateRow();
|
||||
|
||||
if (!myTabs.isHideTabs()) {
|
||||
data = computeLayoutTable(visibleInfos);
|
||||
@@ -142,7 +145,7 @@ public class TableLayout extends TabLayout {
|
||||
label.putClientProperty(JBTabsImpl.STRETCHED_BY_WIDTH, Boolean.valueOf(toAjust));
|
||||
|
||||
int width;
|
||||
if (label.isPinned()) {
|
||||
if (label.isPinned() && showPinnedTabsSeparately) {
|
||||
width = label.getNotStrictPreferredSize().width;
|
||||
}
|
||||
else if (i < eachRow.myColumns.size() - 1 || !toAjust) {
|
||||
|
||||
+5
@@ -67,6 +67,11 @@ class EditorTabsConfigurable : BoundSearchableConfigurable(
|
||||
myEditorTabPlacement.selectedValueMatches { it == SwingConstants.TOP || it == SwingConstants.BOTTOM }
|
||||
and myScrollTabLayoutInEditorCheckBox.selected).component
|
||||
}
|
||||
row {
|
||||
checkBox(showPinnedTabsInASeparateRow).enableIf(
|
||||
myEditorTabPlacement.selectedValueIs(SwingConstants.TOP)
|
||||
and myScrollTabLayoutInEditorCheckBox.selected.not()).component
|
||||
}
|
||||
}
|
||||
}
|
||||
row { checkBox(useSmallFont).enableIfTabsVisible() }
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ internal val showTabsTooltips get() = CheckboxDescriptor(mess
|
||||
internal val showFileIcon get() = CheckboxDescriptor(message("checkbox.show.file.icon.in.editor.tabs"), ui::showFileIconInTabs)
|
||||
internal val showFileExtension get() = CheckboxDescriptor(message("checkbox.show.file.extension.in.editor.tabs"), PropertyBinding({ !ui.hideKnownExtensionInTabs }, { ui.hideKnownExtensionInTabs = !it }))
|
||||
internal val hideTabsIfNeeded get() = CheckboxDescriptor(message("checkbox.editor.scroll.if.need"), ui::hideTabsIfNeeded)
|
||||
internal val showPinnedTabsInASeparateRow get() = CheckboxDescriptor(message("checkbox.show.pinned.tabs.in.a.separate.row"), ui::showPinnedTabsInASeparateRow)
|
||||
internal val sortTabsAlphabetically get() = CheckboxDescriptor(message("checkbox.sort.tabs.alphabetically"), ui::sortTabsAlphabetically)
|
||||
internal val openTabsAtTheEnd get() = CheckboxDescriptor(message("checkbox.open.new.tabs.at.the.end"), ui::openTabsAtTheEnd)
|
||||
internal val reuseNotModifiedTabs get() = CheckboxDescriptor(message("checkbox.smart.tab.reuse"), ui::reuseNotModifiedTabs, message("checkbox.smart.tab.reuse.inline.help"))
|
||||
|
||||
Reference in New Issue
Block a user