Skip to content

Index Tab selected feedback, no-op guard, page-zero block, and auto-page creation#370

Merged
No0ne558 merged 1 commit into
ViewTouch:masterfrom
No0ne558:master
May 28, 2026
Merged

Index Tab selected feedback, no-op guard, page-zero block, and auto-page creation#370
No0ne558 merged 1 commit into
ViewTouch:masterfrom
No0ne558:master

Conversation

@No0ne558
Copy link
Copy Markdown
Contributor

Description:

This PR implements three quality-of-life improvements to Index Tab buttons that together make it dramatically easier to build and navigate multi-page interfaces.


What changed

Visual feedback — active tab highlights automatically

IndexTabZone::State() is overridden to return the selected state (1) whenever the terminal's current page matches the tab's jump_id. Because Zone::Draw() already uses the State() result to pick frame[state], texture[state], and color[state], the tab for the page you're on renders automatically in its configured selected appearance (edge, texture, font color). No new fields on Terminal are needed.

No-op guard — tapping your current tab does nothing

IndexTabZone::Touch() returns SIGNAL_IGNORED when the terminal is already on the tab's target page. This prevents a pointless re-jump and a screen flash when a user taps the tab for the page they're already viewing.

Block page number zero

ZoneDB::Add(Page*) — the single authoritative insertion point for all pages — now rejects any page with id == 0 with a ReportError. No page numbered zero can be created through any code path.

Auto-create a menu page when a new Index Tab button is saved

ZoneDB::NextAvailablePageID(int start_id, int page_size) is a new helper that walks up from start_id until it finds an unused page ID.

In Terminal::ReadZone(), when a brand-new ZONE_INDEX_TAB is saved with no jump target yet (JUMP_NONE), the system automatically:

  1. Finds the first available page ID ≥ 60.
  2. Creates a PAGE_ITEM menu page named after the button.
  3. Registers it in the zone database.
  4. Sets the button's jump to JUMP_NORMAL targeting the new page.

Editing an existing Index Tab that already has a configured jump is completely unaffected.


Files changed

File Change
button_zone.hh Add State() and Touch() overrides to IndexTabZone
button_zone.cc Implement both overrides
zone.hh Declare ZoneDB::NextAvailablePageID()
zone.cc Page-zero guard in ZoneDB::Add(); implement NextAvailablePageID()
terminal.cc Auto-page-creation block in Terminal::ReadZone()
changelog.md Entry under [Unreleased] → Added

6 files changed, 73 insertions(+), 1 deletion(-)

…-page creation

- IndexTabZone::State() returns selected state (1) when the terminal's
  current page matches the tab's jump_id, giving automatic visual feedback
  using the tab's configured selected-state edge, texture, and font color.

- IndexTabZone::Touch() returns SIGNAL_IGNORED when already on the target
  page, preventing a redundant jump.

- ZoneDB::Add() now rejects page id == 0 with a ReportError.

- ZoneDB::NextAvailablePageID(start_id, page_size) added: returns the first
  unused page ID >= start_id for the given screen size.

- Terminal::ReadZone(): when a brand-new ZONE_INDEX_TAB is saved with no
  jump target (JUMP_NONE), a PAGE_ITEM menu page is automatically created
  from the button name at the first available ID >= 60, and the button is
  wired to JUMP_NORMAL pointing at it.
@No0ne558 No0ne558 merged commit ac44a39 into ViewTouch:master May 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant