Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IJPL-43725: New UI: allow showing expanded menu and other toolbar wid… #2889

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,21 @@ internal class ExpandableMenu(
updateBounds()
}
})
if (isSticky()) {
SwingUtilities.invokeLater {
switchState();
}
}
}

fun isEnabled(): Boolean {
return !SystemInfoRt.isMac && Registry.`is`("ide.main.menu.expand.horizontal")
}

fun isSticky(): Boolean {
return isEnabled() && !SystemInfoRt.isMac && Registry.`is`("ide.main.menu.expand.horizontal.sticky")
}

private fun isShowing(): Boolean {
return expandedMenuBar != null
}
Expand Down Expand Up @@ -112,9 +121,12 @@ internal class ExpandableMenu(
updateColor()
layeredPane.add(expandedMenuBar!!, (JLayeredPane.DEFAULT_LAYER - 2) as Any)

// The first menu usage has no selection in the menu. Fix it by invokeLater
ApplicationManager.getApplication().invokeLater {
selectMenu(actionMenuToShow)
if (!isSticky()) {
// Keep original behavior
// The first menu usage has no selection in the menu. Fix it by invokeLater
ApplicationManager.getApplication().invokeLater {
selectMenu(actionMenuToShow)
}
}
}

Expand Down Expand Up @@ -167,11 +179,13 @@ internal class ExpandableMenu(

private fun hideExpandedMenuBar() {
if (isShowing()) {
rootPane?.layeredPane?.remove(expandedMenuBar)
expandedMenuBar = null
headerColorfulPanel = null
if (!isSticky()) {
rootPane?.layeredPane?.remove(expandedMenuBar)
expandedMenuBar = null
headerColorfulPanel = null

rootPane?.repaint()
rootPane?.repaint()
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions platform/util/resources/misc/registry.properties
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ ide.tree.show.expand.with.single.click.setting.description=Adds a global Expand
ide.main.menu.expand.horizontal=true
ide.main.menu.expand.horizontal.description=Expands hamburger menu horizontally (Windows and Linux only)

ide.main.menu.expand.horizontal.sticky=false
ide.main.menu.expand.horizontal.sticky.description=Leave Expands hamburger menu horizontally (Windows and Linux only) expanded (Opt-in)

ide.macos.main.menu.alignment.options=[Native*|Aligned|Aligned in group|No icons]
ide.macos.main.menu.alignment.options.description=Native - align menu items as macOS does, Aligned - align menu items vertically inside a group, No icons - hide icons
ide.splitter.mouseZone=6
Expand Down