Index Tab selected feedback, no-op guard, page-zero block, and auto-page creation#370
Conversation
…-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.
|
Building and using any hospitality menu begins with the Index Page because it lists the Food and Beverage categories, or Families, which are the framework of the menu. ViewTouch provides special buttons for the Index Page - Index Tabs, which are repeated on every Menu Item Page. The Index Page and Index Tab buttons make it possible for users to navigate to any Page in the Menu with a single touch, no matter where the user might be in the Menu. There are also 'time of day' Index Pages and Index Tabs which allow Menu Pages to be either restricted to certain times of the day or, to put it another way, to be allowed to be available at certain times of the day. The strength of ViewTouch is the versatility of tools available to ViewTouch Editors for building Menu interfaces that perfectly match the thoughts and words which guests use to express their menu selections. This is a unique requirement of point of sale software which I recognized even in 1979 when I first began developing my order entry program for my restaurant, Gene Mosher's Old Canal Cafe in Syracuse, New York, using the Apple II computer I had purchased in the Summer of 1977. I must mention that Ariel has used AI to extend and modify the code to implement these newly integrated Editing features. Anyone is invited to follow his example to similarly improve the usability and value of the ViewTouch point of sale code base ! |
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'sjump_id. BecauseZone::Draw()already uses theState()result to pickframe[state],texture[state], andcolor[state], the tab for the page you're on renders automatically in its configured selected appearance (edge, texture, font color). No new fields onTerminalare needed.No-op guard — tapping your current tab does nothing
IndexTabZone::Touch()returnsSIGNAL_IGNOREDwhen 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 withid == 0with aReportError. 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 fromstart_iduntil it finds an unused page ID.In
Terminal::ReadZone(), when a brand-newZONE_INDEX_TABis saved with no jump target yet (JUMP_NONE), the system automatically:PAGE_ITEMmenu page named after the button.JUMP_NORMALtargeting the new page.Editing an existing Index Tab that already has a configured jump is completely unaffected.
Files changed
State()andTouch()overrides toIndexTabZoneZoneDB::NextAvailablePageID()ZoneDB::Add(); implementNextAvailablePageID()Terminal::ReadZone()[Unreleased] → Added6 files changed, 73 insertions(+), 1 deletion(-)