Skip to content

Miscellaneous loadout should switch directly, without the base/Boxes subcategory popup #149

Description

@mrhunsaker

Problem

File StyleMenuBuilder.kt:247–267 (showLoadoutDialog)

Currently Miscellaneous goes through the generic subcategory-selector branch, which pops up a "Miscellaneous vs Boxes" dialog. The desired behavior: Miscellaneous should switch directly, like Basic/Heading/Notes/Plays, applying its own direct (non-Boxes) styles with Alt+1–8;

To fix ambiguity issues this may cause, Boxes can remain reachable as its own loadout via the Styles → Miscellaneous → Boxes submenu (see below).

Fix add shortcutId == MISCELLANEOUS_CATEGORY_NAME to the direct-switch condition`.

// before
if (shortcutId == "plays") {
    BBIni.propertyFileManager.save(CURRENT_STYLE_LOADOUT_CATEGORY, shortcutId)
    updateLabel()
} else {
    // set current style loadout
    var styleIds = getChildren(shortcutId)
    if (styleIds.isNotEmpty()) {
        BBIni.propertyFileManager.save(CURRENT_STYLE_LOADOUT_CATEGORY, shortcutId)
        updateLabel()
    }
    styleIds = getSubCategories(shortcutId)
    if (styleIds.isNotEmpty()) {
        //select subcategory
        styleIds = getSubCategories(shortcutId)
        val number = showStyleSelector(styleIds, shortcutId)
        if (number != -1) {
            BBIni.propertyFileManager.save(CURRENT_STYLE_LOADOUT_CATEGORY, styleIds[number])
            updateLabel()
        }
    }
}
// after
// Miscellaneous is switched directly (like Basic/Heading/Plays): the loadout is the
// base category and Alt+1-8 applies its direct (non-Boxes) styles, with no subcategory popup
if (shortcutId == "plays" || shortcutId == MISCELLANEOUS_CATEGORY_NAME) {
    BBIni.propertyFileManager.save(CURRENT_STYLE_LOADOUT_CATEGORY, shortcutId)
    updateLabel()
} else {
    // set current style loadout
    var styleIds = getChildren(shortcutId)
    if (styleIds.isNotEmpty()) {
        BBIni.propertyFileManager.save(CURRENT_STYLE_LOADOUT_CATEGORY, shortcutId)
        updateLabel()
    }
    styleIds = getSubCategories(shortcutId)
    if (styleIds.isNotEmpty()) {
        //select subcategory
        styleIds = getSubCategories(shortcutId)
        val number = showStyleSelector(styleIds, shortcutId)
        if (number != -1) {
            BBIni.propertyFileManager.save(CURRENT_STYLE_LOADOUT_CATEGORY, styleIds[number])
            updateLabel()
        }
    }
}

Boxes Submenu

Problem

Files Loadout.kt (new entry after Miscellaneous), programData/utd/shortcutDefs.xml (new entry between styles/notes and styles/applyStyle)

There's no dedicated loadout for the four box styles. Add one so Alt+1–4 applies Box, Colored Box, Full Box, Colored Full Box directly.

Fix use Ctrl+Shift+Z, not XCtrl+Shift+X is already bound to the debug-only XML viewer, and getShortcut returns the first matching entry, which would shadow a new binding on X. Z is otherwise unassigned (only plain Ctrl+Z = Undo). The id styles/miscellaneous/boxes resolves (after showLoadoutDialog strips the styles/ prefix) to the exact path whose getChildren returns the four box styles and whose getSubCategories is empty, so no popup appears — the existing else branch in showLoadoutDialog already handles it; no additional StyleMenuBuilder change is needed.

// Loadout.kt — new entry, added after Miscellaneous
list.add(Loadout("Miscellaneous", SWT.MOD1 + SWT.MOD2 + 'W'.code))
list.add(Loadout("Boxes", SWT.MOD1 + SWT.MOD2 + 'Z'.code))
<!-- shortcutDefs.xml — new entry -->
<shortcut>
    <id>styles/miscellaneous/boxes</id>
    <key-combination>Ctrl+Shift+Z</key-combination>
    <description>Set Boxes style loadout.</description>
</shortcut>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions