Skip to content

Conversation

@Bentroen
Copy link
Member

No description provided.

Bentroen and others added 30 commits January 1, 2020 03:42
Since there are two fewer menu items on the key edit mode, the actions following 'Decrease key' were all incorrect. The code now makes up for that by adding 2 to 'sel' (the number of the menu item clicked) when it is greater than that value and when editing the key.
When layer panning is mono, note panning does not average.
Due to the sandbox, using the built-in functions won't work in most of these cases (e.g. the song and pattern folders were always reported as non-existing).
Fixes part of #106
It was loading the value from the 'Show key numbers' entry instead.
Fixes #106
If the selection was cleared between clicking a macro and its window opening, the window and title would be drawn, but not the rest, leaving you locked in it.
Fixes part of #107
Commit e5d94df was causing the dragging code for layer volume and stereo to be executed as many layers as there were on the screen, making it too sensitive (moving the mouse just a little bit would apply the intended difference many times over).

Fixes #104.
Also fixed: data pack export and stereo drag were using the same window ID
Previously, clicking 'Select all note blocks in this layer' would always clear the selection prior to the operation
- Layer volume and stereo can now be changed in increments of 1, not only 10
- Made normal control (without holding Shift) a bit less sensitive
The MIDI import code was passing a `true` parameter as the note pitch, which should be the value for something else. Since true = 1, all notes generated by it were receiving that pitch.

Also fixed descriptions of some functions missing parameters.

Discovered while testing #108
The function which previously only checked if an update was available (control_http) was split into two different functions, check_updates (previous functionality) and get_update, which will attempt to download the file.

draw_loading, an obsolete function to draw a loading bar to the screen, was repurposed and now shows, in MB, how much is left for the download to complete (as well as the percentage).

The program version was temporarily changed to 3.6.0 in order for it to detect updates (remember to revert this later, lol).

Currently, if the connection is interrupted during the download, the program will still think the download was successful, even though the file was only partially downloaded. This happens because both the download status and HTTP status return the same value (0 and 200, respectively) both when the file is downloaded completely, and when it fails. A way for detecting if the download didn't complete is being investigated.
The update system now detects if the download failed by comparing the file size against the total size sent by the server. This is done as soon as the "success" status is received and triggers either the success message, which closes the program and opens the installer, or an error message which asks if the user wants to open the website to update manually.

Renamed the installer to 'Minecraft Note Block Studio Installer.exe' (more user-friendly in the User Account Control popup).
Restored the original loading bar drawing code for historical reasons (despite unused, it's still mentioned in a few places in the code). Moved the download progress bar drawing code to a new script called draw_downloadprogress().
- Add quotation marks to the shell command to allow spaces in the filename
- Draw a placeholder in the download progress bar while the file size isn't retrieved (-.-- instead of 0.00)
- Restore original draw_loading() code (for sure this time)
- Change "Setup" to "Installer" in the filename
- Delete old installers on startup
- Shift some stuff in the startup code
- Restore version number to current version
Auto-updater/Download new versions automatically
On undo/redo, add_block was passing a wrong argument that was causing the program to crash.

Fixes #115
- Add a new string_truncate function that automatically adds ellipses (...) when necessary
- Replace in-place check for the string width in three different places of the code (datapack preview, song/pattern folder)
- Truncate recent file names in the greeting window + menu (the latter is still not fixed, there's something wrong with the menu width calculation)
- Width of the 'Song info' window now adapts to the MIDI file name as well
- Layers without a name now display the default text in gray (as in light mode)
- Changed link colors in greeting window to a lighter blue (better contrast in dark mode and still readable in light mode)
- Changed green text to be lime in dark mode. Affects: up to date text in greeting window, "Compatible" indicator, reports in the Compatibility window.
In ec445fe, the variable song_midi wasn't initialized properly when the greeting window was disabled, causing the program to crash. It's now defined both on startup and in the reset code.

What caused this whole business is the fact that MIDI import happens in two steps: open_midi (parses all the info in the file) and import_midi (converts the data into note blocks after you've picked instruments, etc.) Before the latter occurs, all the song data is reset, which also resets the MIDI filename that was stored on the first step. That made it necessary to remove it from the reset script and, instead, reset the name on unusual places, like in the greeting window and in the call for creating a new song.

Applied solution:
The first variable, midifile, stores the name on the first step. Every reset copies its value to a second variable, song_midi, used only for display. midifile is then set to "". With that, song_midi holds the song name for that session and displays it properly. When a song is created or loaded, a reset will occur and "" will be copied into song_midi, effectively clearing the display.

This also fixes an unintended side effect of how the name was being handled: if you loaded a MIDI but clicked 'Cancel' in the MIDI settings window, the name would still be displayed in song info. To prevent that from happening, the first variable (midifile) is reset when the user clicks 'Cancel', to prevent it from being copied over to the display variable (song_midi) on the next reset.
The height was being defined inside the Preferences window, once the 'Show piano' toggle was changed. Moved that to the drawing code, which updates in real time.
Also made the hover text for the stereo icon a bit more centered
This is for a future addition in the Compatibility window to transpose notes inside the ±100 pitch range.
Updated to be compatible with all NBS versions up to date, which no longer crashes the program.
The time that each emitter will remain active for now depends on the pitch of the sound -- lower sounds will remain for longer, and vice-versa.
No longer per-song, it's now a global setting.
@Bentroen Bentroen merged commit d0fa783 into master Jan 20, 2020
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.

2 participants