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

Make the steps in the Pattern Editor scalable #7175

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

Conversation

michaelgregorius
Copy link
Contributor

This pull request makes the steps in the Pattern Editor scalable and renders them with SVGs instead of PNGs. That way they look more "crisp" than with the current bitmap based implementation.

Here's a pattern with the changes in this pull request (click images to view in full size):

BnBRe-FinalWideCropped

Here's how the same pattern looks without the changes, i.e. in master:

BnBRe-MasterWideCropped

This fixes #3683.

Replace the pngs of the step buttons with the svgs from the previous branch.

Adjust the code so they are rendered with the maximum available height.
Ensure minimal height of 24 pixels like the pngs. Take border offsets into account.
Fix the method `mousePressEvent` so that it also works with the larger step buttons. The main change is the adjusted check for the y coordinate.

All other changes are just refactoring and reformatting of the method's code.
@Z3R0C
Copy link
Contributor

Z3R0C commented Apr 20, 2024

Error loading icon pixmap "step_btn_on_0": Datei nicht gefunden Error loading icon pixmap "step_btn_on_200": Datei nicht gefunden Error loading icon pixmap "step_btn_off": Datei nicht gefunden Error loading icon pixmap "step_btn_off_light": Datei nicht gefunden
Bildschirmfoto vom 2024-04-21 01-19-01

update:

I copied the 4 files manually to /usr/local/share/lmms/themes/default/. If I now change the size, I can no longer change the velocity with the mouse wheel. If I reset it to the original size, it works again.

Extract the computation of the selected step into a dedicated method in `MidiClipView`. The removes duplicated code in the mouse press and wheel event handling code.

The method `getStep` returns an `std::optional` which contains the value of the step if the calculation was successful. It also contains the check for the height.

The calculation with floats was removed in `getStep` as it should not be necessary.

Adjust `MidiClipView::wheelEvent` so that it now computes the step in the same way as the mouse event handler. This reinstates the functionality to set the note velocities with the mouse wheel even if the beat pattern is enlarged.
Adjust `data/themes/CMakeLists.txt` so that SVGs in the theme directories are also installed.
@michaelgregorius
Copy link
Contributor Author

@Z3R0C, the mouse wheel functionality is reinstated with commit 0959b6d which removes some duplicated code and ensures that the mouse and wheel events determine the steps in the same way.

Commit eb80173 fixes the problem with the SVGs in the theme folders not being installed.

Can you please check again?

@Z3R0C
Copy link
Contributor

Z3R0C commented Apr 21, 2024

Now everything works fine. Nearly. There is another problem.

screen01-2024-04-22_01.29.51.mp4
screen01-2024-04-22_02.04.46.mp4

@michaelgregorius
Copy link
Contributor Author

Thanks for testing @Z3R0C! I was able to reproduce a weird rendering bug:

3683-WeirdRenderBug

It seems like some of the elements are rendered scaled with the correct height and some are not. I'll have to check...

Fix artifacts that occur when Qt is requested to render SVGs into very small pixmaps. This is done by making sure that the SVG is always rendered into pixmaps that are at least 24x24 in size (the size of the original PNG pixmap).

Adjust the pixmap drawing code so that a potentially larger source pixmap is drawn into a smaller target pixmap.
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.

Beats and Basslines patterns look off when the height of their track is increased
2 participants