Repository navigation
Save Scale/Key Highlighting, and Many More Editor Options. - #7854
Conversation
|
Tested, works well. |
|
Also, currently I am saving the values as attributes of the editor's xml element. However, this means that any automation connections will not be saved. Are we okay with this? Or should I try to save each model using their own saveSettings/loadSettings functions? If so, I may need to edit them to add a way to specify a default value, since currently that's not possible (and we probably want that so that old projects get loaded with reasonable values. |
|
Scale highlights are a good idea. For all the other stuff like zoom, scroll mode and stuff it seems like a more sensible solution would be saving currently used settings in something like lmmsrc.xml instead. Saving them per project doesn't make much sense because old projects will have to be adjusted one by one. These defaults are entirely user preference anyways, and in case of something like a collaboration, it will present an additional step user has to do every time the project is passed back and forth |
After thinking about this, you're right. It doesn't make sense to save those kind of ui things per-project. I've changed it in the latest commit to save it in the lmmsrc file, so now whatever zoom/snap/quantization/notelength you have last will be restored when you open lmms again. |
Wait, maybe these kind of settings should be project specific.
Currently just the scale, key, and chord are project specific. Are you saying you also want the zoom/snap/note length/quantization settings to be saved in the project? |
Imo user preferences should not be project specific for reasons I outlined above. In an ideal world we would just have defaults in settings, but saving these in config does achieve this in the meantime |
Tested, works!
So, that's all the items left of the scale/key/chord and that one item to the right, correct? Tested. These properties seem to be saved globally, which is odd to me. Like, I run the PR, and the same properties are loaded.
Tested. This also seems to be saved globally.
There we go, okay! I'd think you want to set a different snap level for different projects; "1/4 bar" for electronic music and "1 bar" for slower, orchestral pieces, for example. Or maybe someone wants 1/192 for music in odd time signatures and 1/8 for simple electronic music, etc. So I'd vote for making everything per-project, and if you want it as default for your projects, just add it to your default template! |
That also sounds reasonable, I could see how it would be useful to keep snap sizes per-project. I know Jernemies is in favor saving most of the things per-user rather than per-project, which is why I have it implemented the way it is currently. I suppose we could also add an option in the settings window for whether to use per-project or per-use snap sizes etc. Unfortunately, I don't really have time at the moment to make any major code changes 😅, so it would either have to wait a little while for me to find time to do it, or we could merge this now and deal with it in another PR. |
|
Nicely noticed! Maybe outside the scope of the PR as of now and could be followed up. @regulus79 be the judge! |
I don't believe this PR saves individually marked semitones, if you are referring to the the ones marked via rightclicking -> "Mark/unmark current semitone". That would require saving a list of which ones have been manually marked/unmarked, which is totally doable, but this PR is more about just saving the current index of a few drop-down menus.
That's also an interesting bug. Given that this PR doesn't save which key in particular the user rightclicked and used to mark the scale, perhaps that should be left for a future PR. |
|
Yeah, leave the PR as-is, and I'll try following it up with 2 PRs; one for the marked notes and one for the right click setting affecting the Piano Roll option. |
|
To clarify, the current behaviour on the latest nightly is to save/load marked semitones, but not the scale/key dropdowns (saving/loading marked semitones was added in #5146): Video of the behaviour on the latest nightly: nightly.mp4With this PR, the scale/key dropdowns are saved, but the marked semitones are now overridden by the selected scale. This means you can't modify a built-in scale and save those modifications like you can on master. Moving the call to void PianoRollWindow::loadSettings( const QDomElement & de )
{
m_editor->loadGhostNotes( de.firstChildElement("ghostnotes") );
- m_editor->loadMarkedSemiTones(de.firstChildElement("markedSemiTones"));
MainWindow::restoreWidgetState( this, de );
Engine::getSong()->getTimeline(Song::PlayMode::MidiClip).setStopBehaviour(
static_cast<Timeline::StopBehaviour>(de.attribute("stopbehaviour").toInt()));
m_editor->m_keyModel.setValue(de.attribute("key").toInt());
m_editor->m_chordModel.setValue(de.attribute("chord").toInt());
m_editor->m_scaleModel.setValue(de.attribute("scale").toInt());
+ m_editor->loadMarkedSemiTones(de.firstChildElement("markedSemiTones")); |
OH I completely neglected to test it, you're right, it does save the marked keys. I've moved the loading order in the most recent commit, as you have suggested. |
This PR makes it so that the scale/key/chord in the Piano Roll is saved with the project. Also, while I was at it, I made it so that the zoom, vertical zoom, snap settings, quantization, and note lengths are saved too. Aaand I also decided to save the zoom and snap size in the Song Editor because why not :D However, the zoom/snap/etc are saved in the lmmsrc file, since it doesn't really make sense to save them per-project.
When #7854 was merged, the line for setting the default zoom of the piano roll was copy-pasted to also set the default vertical zoom and quantization. That way if no previous default had been saved, it would default to 100% horizontal zoom, 100% vertical zoom, and 1/16 quantization (which was the default behavior before the PR). Unfortunately, the variable in expression it used to find the correct index of "100%" or "1/16" in the list was not correctly updated after copy-pasting, which caused the wrong defaults to be set. For example, in the vertical zoom dropdown, "100%" is index 2, but in the horizontal zoom, it's index 3. This caused the default vertical zoom to be 150%, not 100%. Likewise, since the horizontal zoom list doesn't contain "1/16", the quantization defaulted to index 0, which was "Note Lock". This PR fixes those issues by correcting the variables names in those two lines.
This PR makes it so that the scale/key/chord in the Piano Roll is saved with the project.
Also, while I was at it, I made it so that the zoom, vertical zoom, snap settings, quantization, and note lengths are saved too.
Aaand I also decided to save the zoom and snap size in the Song Editor because why not :D
However, the zoom/snap/etc are saved in the lmmsrc file, since it doesn't really make sense to save them per-project.
Note
It seems odd that the song editor is saved as a
<trackcontainer>in the xml, since it's theEditorwhich does the saving, not the editor window. This means that I cannot save the state of the proportional zoom option, since that is not accessible from the editor object, only the window. However, the piano roll does it via the editor window. It feels like we should be doing it that way via the gui, since saving isn't something which should be in the core(?) (or should it? idk)