Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding file/folder drop support #91

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jmelovich
Copy link

I wanted a good first issue to acquaint myself with this project, and since one of the frustrating parts of the build/install process was figuring out how to load presets, I figured adding good drag & drop support would be useful (as per issue #84).

SDL provides the drop event, so the implementation was fairly straightforward. The user can either drag & drop a preset file (or collection of preset files), or a folder containing presets. Preset files are files that end with '.milk' or '.prjm' (haven't seen or used prjm files but they are listed as supported in the projectM code). Dragging a file will immediately enqueue it on the next spot in the playlist, and dragging a folder will enqueue all presets in the folder (searched recursively).

I also added two configuration options to give more control to the user (split into a separate commit, as I had to add an additional include on the RenderLoop to access the configuration settings). There are now two additional UI/CLI settings:

skipToDropped (default: true)
When enabled, any dropped presets will be immediately skipped to. (They are always enqueued next after the current preset at the moment, but when this is true it will automatically skip to this next preset. This also accounts for shuffle being enabled, and will always make sure that the preset you dropped is immediately switched to.)
droppedFolderOverride (default: false)
When enabled, and a folder is dropped onto the window, the current playlist will be cleared and replaced with the contents of the folder. So if you have a playlist going and you drop a folder onto the window, the visualizer will switch and only iterate through the presets in that folder (recursively).

Resolves #84
(This issue mentions that behavior should be different depending on if the playlist editor is open or not, but unless I'm missing something I couldn't find a GUI playlist editor, so I instead added the configuration options to determine the behavior for now).

- dragging a preset file loads that preset into your current playlist and skips to it
- dragging a directory of presets will load all of them into the current playlist and skip to the first
- added two new settings: 'skipToDropped' & 'droppedFolderOverride' to provide more user control over the drag & drop functionality.
@kblaschke
Copy link
Member

Looks like a great addition! Can surely reuse this for the playlist editor, as it's probably easy enough to check whether the cursor is within the playlist editor window or not and change the behavior accordingly. ImGui only supports a basic drag & drop of items between UI elements, so this requires additional code anyways.

As with the other PR, I'll review this thoroughly when I'm back home in about ten days from now.

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.

[FEATURE] Add file drop support
2 participants