17 Commits

Author SHA1 Message Date
Dominic Clark
95e5f97150 Revamp resource embedding (#7241) 2024-05-12 17:38:14 +01:00
Michael Gregorius
04ecf73395 Fix missing icons for some instruments (#7132)
Revert some of the changes made in commit 88e0e94dcd. The underlying idea was that the `InstrumentTrackView` should be responsible for assigning the icon that's shown by its `TrackLabelButton`. However, this does not work because in some cases the `InstrumentTrack` that's passed into `InstrumentTrackView::determinePixmap` does not have an `Instrument` assigned. This in turn seems to be caused due to initalizations that are running in parallel in different threads.

Here are the steps to reproduce the threading problem (line numbers refer to commit 360254f):
1. Set a break point in line 1054 of `InstrumentTrack`, i.e. the line in `InstrumentTrack::loadInstrument` where `m_instrument` is being assigned to.
2. Set a break point in `InstrumentTrackView::determinePixmap`, e.g. inside of the first if statement.
3. Drop an instance of "Sf2 Player" onto the Song Editor.
4. The first break point in `InstrumentTrack` is hit in a thread called "lmms::Instrumen" (shown like that in my debugger). Try to step over it.
5. The second break point in `InstrumentTrackView` now gets hit before the code is stepped over. This time we are in the thread called "lmms". I guess this is the GUI main thread.
6. Continue execution.

If you now switch to the application then the icon is shown. I guess the debugger is halted long enough in the main thread so that the InstrumentTrack gets an instrument assigned in another thread.

If you delete/disable the break point in `InstrumentTrack::determinePixmap` and follow the coarse steps above then the icon is not shown because the track has no instrument.

The current fix still delegates to the `InstrumentTrackView` to determine the pixmap in hopes that one day there will be a better solution where the parent component can be fully responsible for its child component.

Fixes #7116.
2024-03-13 20:00:58 +01:00
Michael Gregorius
a81666a9f5 Track resizing behavior (#7114)
* Simplify TrackLabelButton

Remove the dependency to `Instrument` and `InstrumentTrack` from `TrackLabelButton`. The icon of an `InstrumentTrackView` is now determined in the class `InstrumentTrackView` itself using the new static method `determinePixmap`. This enables the removal of the overridden `paintEvent` method from `TrackLabelButton`.

It was also attempted to keep a non-static member function version and to use the `InstrumentTrackView`'s model with a cast. However, this did not work because 'setModel' is executed as the very last step in the constructor, i.e. the model is not already set when `determinePixmap` is called. Pulling it to the top is too risky right now.

* Add helper method isInCompactMode

Add the helper method `isInCompactMode` which knows how to use the `ConfigManager` to determine if the option for compact track buttons is enabled. This removes duplicate code with intricate knowledge of the keys under which compact mode is stored.

* Set song as modified when track name changes

Extend `Track::setName` to set the song as modified whenever the track name changes. This moves the update into a core class and enables the removal of the dependencies to `Engine` and `Song` from the GUI class `TrackLabelButton`.

Also add a check if the name is really changed and only perform the actions if that's the case.

To make this work the implementation of `setName` had to be moved from the header into the implementation file.

* Keep instrument and sample content at top on resize

Keep the content of the instrument and sample track at the top of the widget if the widget is resized. This is also fixes a bug where the `TrackLabelButton` does not react anymore when the size is increased.

Technically the layout with the actual widgets is put into another vertical layout with a spacer that consumes all remaining space at the bottom.

* Vertical track resizing via mouse wheel

Enable to vertically resize tracks using the mouse wheel. Scrolling the mouse wheel over the track view with the control key pressed will increase/decrease the height by one pixel per wheel event. Pressing the shift key will increase/decrease in steps of five pixels.

Extract code that can be shared between the existing and the new way to resize the track into the private helper method `resizeToHeight`.

* Render beat pattern step buttons at the top

Render the step buttons of beat patterns at the top instead of at the bottom so that they stay aligned with the other elements to the left of them (buttons, knobs, etc).

Set the y offset to 4 so that the step buttons are vertically aligned with the other elements. The previous calculation lead to a minimum offset of 6 which always made the step buttons look misaligned.

Introduce the new static variable `BeatStepButtonOffset` which ensures that the rendering and the evaluation of mouse clicks do not go out of sync.
2024-02-18 21:22:22 +01:00
Dalton Messmer
2c6d88f799 Add GUARD_H closing comments 2023-01-05 17:58:49 -05:00
Dalton Messmer
fe6df8dbaf Add namespace prefix to include guards 2023-01-02 19:51:32 -05:00
Levin Oehlmann
28ec71f91a clang-tidy: Apply modernize-use-equals-default everywhere (#6450) 2022-06-26 08:48:24 +02:00
Levin Oehlmann
5904b249c0 clang-tidy: Apply modernize-use-override everywhere (#6439)
... to mark overriding functions `override` instead of `virtual`.
2022-06-19 23:03:55 +02:00
Levin Oehlmann
7227c89847 Namespace lmms (#6174)
This PR places all LMMS symbols into namespaces to eliminate any potential future name collisions between LMMS and third-party modules.

Also, this PR changes back `LmmsCore` to `Engine`, reverting c519921306 .

Co-authored-by: allejok96 <allejok96@gmail.com>
2022-06-19 20:08:46 +02:00
Johannes Lorenz
7db3fa94a1 Improve includes (#6320)
* Update ringbuffer submodule to fix includes

* Remove cyclic includes

* Remove Qt include prefixes

* Include C++ versions of C headers

E.g.: assert.h -> cassert

* Move CLIP_BORDER_WIDTH into ClipView

This allows to remove includes to TrackView.h in ClipView cpp files.

* Elliminate useless includes

This improves the include structure by elliminating includes that are
not used. Most of this was done by using `include-what-you-use` with
`CMAKE_C_INCLUDE_WHAT_YOU_USE` and `CMAKE_CXX_INCLUDE_WHAT_YOU_USE`
set to (broken down here):

```
include-what-you-use;
    -Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
    -Xiwyu;--keep=*/xmmintrin.h;
    -Xiwyu;--keep=*/lmmsconfig.h;
    -Xiwyu;--keep=*/weak_libjack.h;
    -Xiwyu;--keep=*/sys/*;
    -Xiwyu;--keep=*/debug.h;
    -Xiwyu;--keep=*/SDL/*;
    -Xiwyu;--keep=*/alsa/*;
    -Xiwyu;--keep=*/FL/x.h;
    -Xiwyu;--keep=*/MidiApple.h;
    -Xiwyu;--keep=*/MidiWinMM.h;
    -Xiwyu;--keep=*/AudioSoundIo.h
```

* Fixup: Remove empty #if-#ifdef pairs

* Remove LMMS_HAVE_STD(LIB|INT)_H
2022-03-02 13:30:43 +01:00
David CARLIER
dac59a5fa0 C++11 inheritance updates
Add `override` and remove `virtual` where applicable
2019-10-31 20:05:33 +01:00
Alexandre Almeida
aa6d528c98 Cancel track rename with Escape key 2017-07-08 19:42:13 -03:00
Steffen Baranowsky
5863752988 elide the text on track button if it's too lon... (#3328)
* Elide the text on track button if it's too long
* Remove setText() from paintEvent
* Dynamic trackLabelButton width
2017-02-20 11:44:21 -05:00
grejppi
9e85d7c66e update all copyright headers to the proper url (#3326) 2017-02-06 02:41:15 +02:00
Steffen Baranowsky
c5aa22663e allow drag track label button for moving track (#3271)
* allow drag track label button for moving track

* improve mouseclick

* improve click 2
2017-01-23 09:35:43 +01:00
Steffen Baranowsky
06726f6204 rename tracks directly on TrackLableButton in a QLineEdit 2016-07-20 21:16:26 +02:00
Lukas W
6d4a6ed9cd Rename bbTrack, trackContentObject and friends 2014-11-26 10:53:47 +01:00
Lukas W
1bbf7455a4 Rename a lot… 2014-11-26 10:09:49 +01:00