Skip to content

Keep Set A (manual printtarg) and Set B (editor recipe layout) layout in sync #92

Description

@itsab1989

Split out from #89 (design fully settled there). Generators and patch count stay frozen; this is the layout-consistency layer so Set A and Set B can never disagree.

Background

A saved chart preset stores its layout in two places:

  • Set Adata.printtarg_*: the literal printtarg flags the Create Chart → Manual tab reads/writes (instrument, paper, -t, -a scale, -M/-m margin, -h, -L, -P).
  • Set Beditor_recipe: the New-Chart generator recipe (mode / colour-set checkboxes / sp params) plus a layout sub-block the editor / TI2-relayout path uses (patch_scale, margin, spacer_scale, spacer_mode, L, P, h, td, dpi, bit16, + instr/paper).

Nothing keeps the two in step. That's the root of the #89 confusion: a preset had editor_recipe.layout.td = true (Set B) while its printtarg block (Set A) read as plain -iCM — so the same preset rendered differently depending on which path read it. The functional break (Create Chart showing the wrong scale) is already fixed (beta.14 round-trips the effective TD layout into Set A). This issue is the robustness layer on top: make the two sets always carry the same layout so exported/shared .json files are self-consistent and any consumer reading Set A gets the right answer.

Goal

Set A and Set B always carry the same layout. Generators + count stay frozen.

Plan

1. Synced fields (option (a) — only the layout fields Set B already has):
patch_scale, margin, spacer_scale, spacer_mode, L, P, h, td, dpi, bit16 (+ instr / paper).
The td / h mode flags are included so a triple-density layout is unambiguous in Set A (triple density isn't a real printtarg flag — it expands to -ii1 -h only at render time — so td is the thing that actually marks it).

2. Sync points — all three write paths produce identical, consistent Set A + Set B:

  • Edit Layout → Apply/Save → Overwrite → transfer the synced layout to the Create Chart manual tab (Set A) and the recipe (Set B).
  • Edit Layout → Apply/Save → Save As → save a new preset carrying the synced effective layout in both Set A and Set B — exactly the same write path as Save Preset in the Create Chart manual tab (so the two routes produce identical preset files).
  • Manual-tab printtarg change → on Generate, update Set B's layout from the manual widgets (layout fields only). Last edit wins.

3. Generators / patch count frozen:
Manual targen edits never rewrite Set B's generators or count. Editing targen + Generate writes a fresh .ti1 (Set B still recoverable via the New Chart window). Patch count is driven by the loaded .ti1 / preset / New-Chart output, and is only editable once targen editing is enabled (which writes a new .ti1).

4. Export:
The Create Chart export writes the effective layout (incl. td) into its printtarg block, so shared .json files are self-consistent.

5. Not in scope here: -r / -R / Shuffle / RANDOM_START → tracked in #90; folds into this sync once it lands.

Acceptance

  • Editing scale/margin/density/etc. in the manual tab and generating updates Set B's layout to match (generators/count untouched).
  • Editor Overwrite and editor Save As both leave Set A and Set B carrying identical layout; Save As produces a preset byte-equivalent to the manual-tab Save Preset for the same state.
  • A triple-density preset is unambiguous from Set A alone (td present).
  • Exported .json carries the effective layout in its printtarg block.
  • New Chart window unaffected (no existing Set A to sync from at creation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions