한국어로 읽기

[Easy Score dev note] Nine Buttons Down to Four Menus, T for Ties, and Save As

Easy Score's toolbar had nine file and song buttons; now it has four menus. Plus why S then T made a triplet instead of a tie, and how Save As works in the browser.

Easy Score's toolbar with the Open menu down: Open file (Ctrl+O) and Import MIDI, next to Save, Print / Export and Song info · Transpose

Easy Score’s toolbar grew one button at a time. By this week its left end held nine: New, Open, Save, Save as, Export, Print / PDF, Song info, Transpose and Import MIDI. The feedback was simple: too many buttons, and “Song info” doesn’t say what it does. This update tidies that up, and fixes two smaller things that came in the same message.

Nine buttons, four menus

The left end is now New and four menus:

Menu What’s inside
Open ▾ Open file… (Ctrl+O) · Import MIDI…
Save ▾ Save (Ctrl+S) · Save as… (Ctrl+Shift+S)
Print / Export ▾ Print / PDF (Ctrl+P) · MusicXML · MIDI · Audio (.wav)
Song info · Transpose ▾ Edit song info… · Transpose…

I grouped them by direction rather than by file type. Everything that brings music in sits under Open, so Import MIDI moved there, even though it adds notes to the open score instead of opening a new one. Everything that sends music out sits under Print / Export, and printing became its first item, since a PDF is just another way out.

“Song info” became Edit song info: the old label read like something to look at, not something to change. Transpose sits beside it, and the menu’s own label says “Transpose” too. Worship teams transpose every week, and a feature people use that often shouldn’t hide behind a vaguer word.

The keyboard shortcuts didn’t change, so if you work from the keyboard, nothing moved.

The Save menu open under the toolbar: Save (Ctrl+S), which saves to the open file, and Save as (Ctrl+Shift+S), which saves a copy under a new name
Every menu item shows its shortcut and what it does in one line.

All four menus are one small component: a button that toggles a list and closes when you click anywhere else.

function MenuButton({ label, children }: { label: string; children: (close: () => void) => ReactNode }) {
  const [open, setOpen] = useState(false);
  const ref = useRef<HTMLDivElement>(null);
  useEffect(() => {
    if (!open) return;
    const away = (e: PointerEvent) => {
      if (!ref.current?.contains(e.target as Node)) setOpen(false);
    };
    document.addEventListener('pointerdown', away);
    return () => document.removeEventListener('pointerdown', away);
  }, [open]);
  return (
    <div className="menu" ref={ref}>
      <button onClick={() => setOpen(!open)} aria-haspopup="menu" aria-expanded={open}>
        {label} ▾
      </button>
      {open && <div role="menu">{children(() => setOpen(false))}</div>}
    </div>
  );
}

Why S then T made a triplet

The second report: select two notes, press S for a slur, then T to turn it into a tie, and you get a triplet instead.

Each key did exactly what it was built to do. S made the slur but left the two notes selected. T has two jobs: with a curve selected it switches between tie and slur, and with notes selected it makes a tuplet. After S, notes were selected, so T made a tuplet.

The fix remembers the slur S just made, for one key press only:

slurSelected() {
  const c = this.edit((s) => ops.slurSelection(s, ids) ?? false);
  if (c) this.slurJust = c.id; // the slur S just made
}

tieJustSlurred(): boolean {
  const id = this.slurJust;
  this.slurJust = null; // one shot
  if (!id) return false;
  this.makeTie(id); // tie it, and give the second note the first one's pitch
  return true;
}

The T key asks first, if (!store.tieJustSlurred()) store.toggleTuplet();, and every other edit or selection clears slurJust, so a T pressed later is the tuplet key again. A tie joins two notes of the same pitch, so turning the slur into a tie also gives the second note the first note’s pitch. If you meant a tie from the start, + still ties the selected note to the next one in one step.

Save as

The last request was Save as. Easy Score saves through the browser’s File System Access API: the first Save asks where to put the file and keeps a handle to it, and every later Save writes to that handle. Save as simply ignores the stored handle, asks again, and keeps the new one:

let h = as ? null : handle; // Save as never reuses the old file
if (!h && window.showSaveFilePicker) {
  h = await window.showSaveFilePicker({ suggestedName: as?.name ?? `${score.title}.easyscore.json` });
}
// …write to h, and remember it for the next Save

The name it suggests is the file you have open, so a copy for a second arrangement or a different key is one rename away. Safari and Firefox don’t have showSaveFilePicker yet, so there Save as asks for a name and downloads the file under it.

Try it

Open Easy Score and click Open. If something you use every day got harder to find, write to me at inyourcareallen@gmail.com.

Written by

Allen

Independent app developer in South Korea. I write about the apps I make, the piano I practice, the anime I watch, and a fantasy world I'm building.

More from Practical Trivia