Commit Graph

22 Commits

Author SHA1 Message Date
Kartik K. Agaram 2f09322d49 greatly simplify slider implementation
It now looks a lot like button.lua.
2023-12-16 23:41:49 -08:00
Kartik K. Agaram 50d8bd364b use the obvious name for the font global
I should perhaps namespace things somehow to keep from colliding with
other people's scripts, but I don't have a plan for that yet so I'm not
going to carve out a singl exception just for one case I ran into
myself. For now, it's a sharp edge that scripts might conflict with
internal Carousel variables. A single space of definitions has many
advantages, but also some disadvantages.
2023-12-14 19:05:08 -08:00
Kartik K. Agaram 9ce1f1660f handle scripts that change the font 2023-12-13 18:24:29 -08:00
Kartik K. Agaram 8e17a56232 clean up some debug drawing 2023-12-03 15:53:39 -08:00
Kartik K. Agaram 42cc608d06 bugfix: only check for settings menu when open
Scenario I was seeing:
* on an Android phone
* when font size is small
* if I scrolled down a bit
* and then tapped on the editor

Then before this commit, the scrollbar would move. Even though I was
tapping nowhere near the scrollbar. Or even the settings area!

I carefully bisected this down to commit 7ca2006145 and this code in
on.mouse_release:

  if on_area(Settings_menu_area, x,y) then
    return
  end

What was actually going on in the above scenario:
* on a device with a small screen
* after I open the settings menu once
* the scrollbar overlaps the erstwhile setting menu, so that dragging
  the scrollbar doesn't trigger on.mouse_receive
* as a result the scrollbar is still active when I tap the editor.

Holy smokes!
2023-12-03 15:43:27 -08:00
Kartik K. Agaram 19be6bcaf6 isolate editor UI from some app changes
There will probably more such things to add.
2023-12-02 12:54:09 -08:00
Kartik K. Agaram 83ebcaa5c4 first draft of load/save buttons
Some considerations in the design so far:
* Desired flows:
  * start typing into a new pane, then save to a filename
  * load from a filename, then continue typing/running
  * save as a second file

* Should we autosave? I think not yet, because my editor's undo/redo
  functionality is not accessible yet on mobile. Android devices can't
  press 'ctrl', and the hotkeys aren't very discoverable.

  (I considered menu options for 'undo' and 'redo', but they won't be
  very ergonomic because my undo/redo functionality is primitive and
  doesn't support grouping similar operations. Now you're stuck tapping
  '>>', then 'undo' and losing one character. Then the menu closes and
  you have to do it all over again.)

  Another knock against autosave on mobile: autosave on quit is
  unreliable. At least on my Android devices, LÖVE doesn't trigger
  love.quit when you swipe away an app. iOS of course has no such notion
  in the first place.

* Menu buttons take up space, and I'm loath to expend 2 more buttons.
  However, I don't see a good alternative:

  * We can't use a single button to bind a filename to a pane until we
    get autosave.

  * Save on run? It doesn't save a button, but maybe we can keep 'save'
    up top because we'll want to keep hitting it in the absence of
    autosave. However, I don't want to lose data just because I started
    typing out a long program that never got to a runnable point.

* I'd like to keep 'save' always up. But newcomers might have more
  trouble finding things if load and save are separated from each other.
  Seems like the sort of thing Mike complained about before the current
  button organization.

==> conclusion: no autosave, 2 buttons, load and save

* I want to follow MiniIDE and only save to a single directory (no
  subdirectories, even). Simplifies the file dialog.

* Where should this directory live? Source base risks growing really
  large and unwieldy over time as we share files between lots of LÖVE
  apps. At least, Mike has that problem. Save dir is utterly
  inaccessible to other apps -- including later versions of this one.
  Once you delete one version of an app (say before installing a new
  version) the only way to find your files is to wade through lots of
  cryptic directories inside source dir. And you'd need a new LÖVE app
  to do that.

==> conclusion: save to a fixed subdir of source base dir. That way only
Lua Carousel will save there, but different versions share a common
space.

* Should examples be savable? If yes, we could have conflicts. If no,
  it feels like a gotcha when someone starts editing an example.

==> conclusion: allow examples to be saved, but that creates a new copy
of them on restart. It'll be weird that the order changes, but seems
like the best option.

* Where to show the current filename? I don't want to further reduce
  space for buttons. A smaller font seems necessary here to squeeze the
  filename into an interstitial of the UI.

Still to do: providing a non-existing file to load/save. I plan a
command palette UI for filtering or selecting a new file.
2023-11-25 23:40:28 -08:00
Kartik K. Agaram d98bc8cc7d lay out buttons based on device dimensions 2023-11-22 12:38:16 -08:00
Kartik K. Agaram 2e66d2f0fd send errors from event handlers to output editor 2023-11-21 21:22:52 -08:00
Kartik K. Agaram fc3cb96171 support event handlers
I've agonized over conflicts between editor and script handlers for a
while, but finally the solution occurred to me: to use the script's
handlers, hide the editor. To use the editor's handlers, show the
editor. The menu and settings are always active. This seems nice and
consistent, easy to explain.

Mike Stein would prefer we just supported love.* handlers in scripts to
minimize special cases and cognitive load for people. But I'd rather
err on the side of being transparent about what's going on inside. As a
compromise I'm supporting love.* names at least in addition to my
rephrasings (which came about mostly because love.keychordpressed is
just too much of a mouthful)
2023-11-21 19:17:49 -08:00
Kartik K. Agaram 9b18e35aaa bring back syntax highlighting (but so ugly) 2023-11-21 08:53:19 -08:00
Kartik K. Agaram 3d5a116ddf ahh, got the background color sliders working
And I don't even need to rerun to update.
2023-11-21 02:31:17 -08:00
Kartik K. Agaram 76bfcba47e sliders for font size and color settings 2023-11-21 02:19:56 -08:00
Kartik K. Agaram f580e2efca add lots of buttons to the toolbar 2023-11-20 22:23:09 -08:00
Kartik K. Agaram f298483c7d hide file numbers in output editor 2023-11-19 21:32:40 -08:00
Kartik K. Agaram 47d38eabf2 starting to experiment with animated pane transitions 2023-11-19 17:33:22 -08:00
Kartik K. Agaram e38191fc4f aggregate global state inside a 'pane' object
We're soon going to start juggling multiple of these.
2023-11-19 13:15:06 -08:00
Kartik K. Agaram 809a980213 implement second, 'output' editor
Also its scrollbar.
2023-11-18 21:18:09 -08:00
Kartik K. Agaram e53245e62d implement 'Run' button
Error flow is still klunky. We'll need to implement the output region
for that.
2023-11-18 19:42:26 -08:00
Kartik K. Agaram 3717d7868a start sketching out a scrollbar
Not quite ideal: the scrollbar computation only considers
screen_bottom1.line and not screen_bottom1.pos, and so it always assumes
the final line is at the bottom of the screen.

I'm making a deeper change here that I might come to regret. I want to
avoid creating new book-keeping for editor mutations, so I'm putting the
work of computing scrollbar data into clear_screen_line_cache. But that
implies the editor should never clear before updating data, and I caught
one place that wasn't true before. A better name helps avoid this in
future. Let's see how much toil this causes in resolving conflicts.
2023-11-18 04:25:31 -08:00
Kartik K. Agaram 28f1e113a4 start of the visual skeleton 2023-11-15 07:04:34 -08:00
Kartik K. Agaram 01a8e0bb9f new fork: carousel shell 2023-11-15 06:06:56 -08:00