Skip to content

Add the app icon and browser drag and drop for samples and instruments - #78

Merged
chrislaupama merged 2 commits into
mainfrom
icon-and-drops
Nov 15, 2026
Merged

chrislaupama merged 2 commits into
mainfrom
icon-and-drops

Conversation

@chrislaupama

@chrislaupama chrislaupama commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Chris · project thread

What

App icon. The mark (one sine cycle, white on the app's blue tile) becomes the app icon everywhere:

  • docs/art/icon/app-icon-macos.svg (macOS grid: 824 pt tile with a soft shadow on a 1024 pt canvas) and docs/art/icon/app-icon.svg (Windows and Linux) are the sources; node tools/art/make-icons.mjs renders them into crates/dstudio-app/icons/ (device.icns, device.ico, device-256.png, device-macos-512.png).
  • macOS: tools/macos-bundle.sh puts device.icns in Device.app (CFBundleIconFile). Run outside the bundle (cargo run), the Dock gets the icon at start-up (appmenu::set_dock_icon).
  • Windows: build.rs builds device.ico into device-studio.exe (embed-resource, Windows hosts only); the installer uses it as SetupIconFile.
  • Linux: the package installs share/icons/hicolor/256x256/apps/device-studio.png and the desktop entry names it; the window uses device-256.png as its title bar and taskbar icon.

Samples dragged onto the arrangement land where you drop them, with a preview.

  • Bug: a file dropped from Browser › Files measured its beat from the Timeline panel's left edge instead of the lanes, so the clip landed a track-header width (191 pt) to the right of the pointer. Drops now use the lane origin (Layout::lanes_x) and the arrangement's snap grid (when snap is on).
  • While a sample or MIDI clip is dragged over the lanes, a clip preview shows exactly where it will land: the file's length (measured on a worker thread when the drag starts, a bar until then), in the colour of the track that gets it, or the next track colour below the tracks. Letting go places the clip there.

Samples onto a sampler; instruments.

  • A sample dragged from Files onto the Devices panel loads into the selected track's Sampler (first file) or Pad Sampler (the shown pad, as a new layer), the same as a Finder drop. The panel is outlined while it would take the drop.
  • An instrument dragged onto an instrument track replaces its instrument (as before); dropped in the empty area below the tracks it now gets a new instrument track named after it.
  • Double-clicking an instrument with no instrument track selected (nothing selected, or an audio track) adds a new instrument track playing it instead of asking to select a track. With an instrument track selected it still replaces that track's instrument.
  • The new track and its instrument are one undo step ("Add Instrument Track").

Screenshots

App icon (macOS 512 px with its shadow; Windows/Linux 256, 64, 32 and 16 px). Before: no icon (generic app icon in the Dock, Explorer and the Linux launcher).

App icon

Drop preview, after: dragging kick.wav over the first audio track at bar 3 (the clip starts under the pointer, snapped to the grid). Before: the whole track was outlined, with no position shown, and the clip landed 191 pt to the right.

Preview on a track

Below the tracks: the preview in the new track's colour.

Preview below the tracks

Tests

New self-test section drop: drives each case with real pointer events (8 checks): the preview at beat 8 in the track's colour while the drag is held, the clip landing at exactly beat 8 on release (the regression), a sample below the tracks, a sample onto a Sampler; double-click of Sampler with an audio track selected; Sampler dragged onto an instrument track and below the tracks. Full self-test 698/698 on Linux at the first commit.

Benchmarks

No hot path changes: drop targets and the preview are computed on pointer events during a drag only; measuring a file's length decodes it once on a worker thread per file per session.

Docs

  • README.md is still accurate
  • CHANGELOG (Unreleased › Added) and docs/art/README.md (the app icon) updated

Generated by Claude Code

- App icon: rendered from docs/art/icon by tools/art/make-icons.mjs into
  crates/dstudio-app/icons; Device.app carries device.icns, device-studio.exe
  and the installer device.ico, the Linux package and window device-256.png.
- A sample dragged from the browser onto the Devices panel loads into the
  selected track's Sampler or Pad Sampler.
- An instrument dropped below the tracks, or double-clicked with no instrument
  track selected, gets a new instrument track named after it (one undo step).
- Self-test: real pointer drags for each drop, and the double-click.
@chrislaupama chrislaupama self-assigned this Nov 15, 2026
Browser file drops measured the beat from the Timeline panel's left edge
instead of the lanes, so a dropped clip landed a track-header width to the
right of the pointer. Drops now use the lane origin and the arrangement's
snap grid, and while dragging over the lanes a clip preview (the file's
length, in the colour of the track that gets it) shows where it lands.
@chrislaupama
chrislaupama marked this pull request as ready for review November 15, 2026 07:38
@chrislaupama
chrislaupama merged commit 958a776 into main Nov 15, 2026
26 checks passed
@chrislaupama
chrislaupama deleted the icon-and-drops branch November 15, 2026 08:16
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