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>
* 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
* TCO coloring: submenu, randomize, undoable, renaming signals/slots
* Track coloring: submenu, undoable, renaming signals/slots
* FX color submenu
* Set modified on color change
* Use lambda to update TCOView after track color change
* More renaming, fix memory leak
Co-authored by DomClark
* Enable track-wide color coding
* Add support for automation tracks
* Allow saving & loading track colors
* Allow track color to be reset to default
* Partially migrate common settings to Track.cpp, fix bug
* Completely migrate local TCO color functions to TCO class, fix bug
* Set QColorDialog colors to better colors
* Color the side of the track according to TCO colors
* Disable color gradient when muted
* Change selection color to depend on TCO color
* Fix breaking builds
* Bug fix
* Fix another bug where BB track colors wouldn't load
* Restore changed demo to original state
* Fix BB Editor bug
* Fix breaking builds
* Allow random color picking
* Fix copy-paste bug
* Change how color is painted on a track
* Cleanup, and implement per-pattern colors
* Cleanup comments
* Migrate some functions
* Remove redundant function
* Rename some functions
* Migrate duplicates to superclass
* Use ColorChooser and reorder some includes
* Change how colors are saved
* Fix some formatting
* Fix some code
* Change how clip colors work
* Fix some unexpected behaviors
* Fix note border coloring being green on colored tracks
* Change name of an option
* Remove redundant code
* Fix ghost changes
* Remove colorRgb
* Rename backgroundColor, remove some variables we don't use
* Remove a redundant variable
* Migrate some duplicates to superclass
* Check for nullpointer
* Remove redundant variable
* Update some logic
* Change how muted colors are displayed
* Change how dark muted tracks become
* Place setModified() in appropriate places
* Make getColorForDisplay() function
* Change how colors are organised and saved
* Remove m_useStyleColor
* Remove a comment
* Quick changes
* Change how colors are saved
* Remove redundant stuff
* Remove redundant stuff pt. 2
* Change how colors are copied
* Fixes pt. 3
* Fixes pt. 4
* Change spaces to tabs
* Fix pseudochanges
* Remove s_lastTCOColor
* Fix pseudochanges pt. 2
* Fix breaking builds
* Add files via upload
* Add comments (again)
* Moves mimeType from StringPairDrag to Clipboard
* Simplifies decodeKey and decodeValue methods
* Adds method to copy a string to clipboard
* Adds method to copy a string pair to the Clipboard
* Adds convenience methods to Clipboard.h to retrieve the QMimeData from the clipboard and checking whether a particular mime type format is present on it
* Uses only the TCOV copy/paste methods on the song editor
To keep consistency on the behavior of the TCOV copy and paste operations, we now only use the TCOV::copy() and TCOV::paste() methods for copying both individual and multiple TCOs.
* Removes obsolete TrackContentObject::cut() and merge copy() and paste() methods to single function TrackContentObject::copyStateTo()
* Adds Clipboard::getString method to get data for particular mime type
* Makes AutomatableModelView.cpp use the Clipboard class instead of calling Qt clipboard directly
* Starts implementing the feature
The idea of this branch is to allow actions triggered through the context menu of a TCO on the song editor to affect all the selected TCOs. With this commit, only the "Mute/unmute" action affects all selected TCOs, while the others retain their old behavior (only affect the TCO that owns the context menu).
For that, a method was created that processes all actions (the triggered action is parsed as a parameter to the method). In the case of the "Mute" action, it checks if the song editor has selected TCOs, and if it does it mutes/unmutes all of them.
* Allows selected TCOs to be removed too
Now the "Remove" action from the context menu will remove all selected TCOs if there are any.
* Starts implementing selected TCO cut and copy
Now, when multiple TCOs are selected, the context menu actions Cut and Copy will write a DataFile to the clipboard containing the TCO information, so it can later be used to paste it.
The Paste action now checks if there's data in the QApplication clipboard. If there is, it will later paste the TCOs (for now it just prints the data with qWarning). If there's not, it uses the regular TCO paste method that uses the internal LMMS clipboard. Because it now have to decide between the QApplication clipboard and the LMMS internal clipboard, the Clipboard::copy() method now clears anything in the QApplication clipboard, making it empty so LMMS can know it should use the internal clipboard instead in that situation.
Adds safety checks for the selected TCO views.
* Overloads TCW paste selection methods
This commit is a step towards implementing the paste feature of the TCO context menu. It overloads the TrackContentWidget::canPasteSelection and TrackContentWidget::pasteSelection methods so they can be called without having a QDropEvent (only the QMimeData with the copied TCOs information). The overloaded canPasteSelection(MidiTime, QMimeData, bool) method required a third argument which says whether pasting over the same bar should be allowed or not, because it shouldn't when the QDropEvent comes from the same application but should when it doesn't. That is defined in the canPasteSelection(MidiTime, QDropEvent) method.
Also, the pasteSelection(MidiTime, QDropEvent) isn't optimal, since it calls canPasteSelection twice (more details in the comments, but it's basically because the two canPasteSelection methods can return different values depending on the origin of QDropEvent). This could later be fixed by calling canPasteSelection before pasteSelection and removing it from inside the method altogether.
Next step is to add the "tco_" key to the mimeData on the Copy/Cut operations and implementing the paste operation using those methods.
* Adds the TCO type to the clipboard
Adds the key with the TCO type ("tco_" + type number + ":" + TCO Data XML) to the clipboard, so it can be later used by the canPasteSelection and pasteSelection methods.
* Apply changes to "src/tracks/SampleTrack.cpp"
Change the SampleTCOView::contextMenuEvent() method so it behaves the same way as the TrackContentObjectView::contextMenuEvent() method. For that, I had to change the ContextMenuAction enum and the contextMenuAction methods to be protected instead of private, so SampleTCOView can access it.
* Implement the paste action
Now that the canPasteSelection and pasteSelection methods were overloaded, it was possible to implement the paste action using the same logic as the Drag&Drop copy/paste.
Other small changes:
- Removes the TCO views AFTER creating the TCO data file, instead of before (which probably resulted in an empty data file).
- Uses the StringPairDrag::mimeType() instead of Clipboard::mimeType() since that's the one the methods from StringPairDrag.cpp recognizes.
* Removes QDebug header
Forgot to remove the QDebug header on the last commit.
* Creates a Context Menu on the TCW for "paste"
Now it's possible to paste a selection of copied TCOs anywhere in the TCW, as long as the rules to paste are met (same rules as Drag&Drop copy/paste). If the rules are not met the "Paste" menu action shows but is disabled.
* Small code refactoring
Saving a few lines of code.
* Avoids double call to canPasteSelection
This commit adds a third parameter to the pasteSelection overloaded method, which will define whether we whould skip the canPasteSelection check. The only situation where we will want to skip it is if we are calling pasteSelection from inside the other pasteSelection method, which will already have checked it. Because of that the default value is false.
Organizes comments as well.
* Separates methods for the actions on selections
Now the remove, copy, cut, paste and toggle mute actions have a separate method for applying them to selections, which are then called from the contextMenuAction method. That made the code more organized and the contextMenuAction method smaller.
Also, the mouse shortcuts for muting and removing (CTRL+middle button, middle button, CTRL+right button) now apply the action on selections as well.
* Fixes small bug and reorganize code
Fixes a small bug where using a mouse shortcut or choosing an action on a TCO that is not selected while other TCOs were selected would result in the selection being affected.
Also reorganizes the code so the conditional for choosing between the selection action and the individual action stays inside the method.
* Move logic to the action methods
Since the methods that called the action+Selection() methods didn't need the list of selectableObjects, I moved it to the inside of the action+Selection() methods and removed the parameter from them.
* Changes logic structure and labels
As suggested by Spekular, the logic structure was changed. Now, the mousePressEvent and contextMenuAction methods determine whether the action should happen to a selection of TCOs or an individual TCO. The list of TCOs to be affected populate a QVector list called "active", which is parsed to the action method that will apply the action to each object in the list.
I changed the method names to removeActive, cutActive, copyActive and toggleMuteActive, since I believe that better describe the behavior. The paste method is still called pasteSelection for now, because the paste behavior isn't related to the active TCOs but to the content of the clipboard.
The contextMenuEvent method on both src/core/Track.cpp and src/tracks/SampleTrack.cpp were changed so they also check if the right-clicked TCO is part of a selection or an individual TCO, and the labels for the actions are changed to better describe the behavior (i.e.: "Delete" for individual TCO and "Delete selection" for multiple TCOs).
* Make removeActive and toggleMuteActive static
removeActive and toggleMuteActive methods are now static so they can be called from anywhere in the code since they don't require a TCO view instance to work. That makes it possible for them to be used in the future if any feature requires this type of action to be called from out of a TCO view instance.
The same couldn't be done for the copyActive and cutActive methods because those require an instance of the TCO view to call them, since when copying to the clipboard some metadata is written using information from the object instance.
* Renamed TCO View paste method
I renamed the TCO View paste method from pasteSelection to just paste, since the TCO view doesn't currently have a paste method (only the TCO class). It's also a name that accurately describes the action: it will paste either a group of TCOVs or a single TCOV on the current TCOV.
I also moved the logic for deciding between the multiple TCOV paste and single TCOV paste inside the paste method.
* Moves repeated code to a new method
This commit adds another method to TrackContentObjectView called getClickedTCOs, which will return a QVector with the TCO views that are supposed to be affected by a context menu action (either the individual right-clicked TCO or the selection of TCOs). Code was updated on the other methods to make use of this new method.
Method names for actions that affect multiple TCOs were changed. Instead of calling them copyActive, cutActive, toggleMuteActive and removeActive, they are just called copy, cut, toggleMute and remove, hence they are overloaded methods for those actions that affect multiple TCOs (their differenciation is the arguments list, which is a QVector list for those).
* Avoid unnecessary calls to getClickedTCOs()
We use a ternary operator inside TrackContentObjectView::mousePressEvent to avoid unnecessary calls to getClickedTCOs when the list is not going to be used.
The contextMenuEvent method on both Track.cpp and SampleTrack.cpp was reformated to use a more appropriate indentation and spacing between method calls.
* Fix indenting in a ternary operator assignment
* New default behavior: Preserves offsets when moving clips, resizes in fixed increments.
* Adds shift + drag: Snaps move start position (like current behavior) or end position (new),
based on which is closest to the real position. When moving a selection,
the grabbed clip snaps into position and the rest move relative to it.
* Adds alt + drag: Allows fine adjustment of a clip's position or size,
as an alternative to ctrl + drag.
* Adds a Q dropdown in the song editor to allow finer or coarser snapping (8 bars to 1/16th bar)
* Adds a proportional snap toggle. When enabled, snapping size/Q adjusts based on zoom,
and a label appears showing the current snap size. This is disabled by default.
Fix some assumptions that source and target of a drag actions are the same
track container. Instead of looking up necessary information (track name,
type and container id) by track index, add it to the metadata.
Refactor canPasteSelection to take QDropEvent instead of the drop event's
QMimeData. Coincidentally, this fixes the method to be consistent with its
documentation.
Fixes#4844
Instead of calling MouseMoveEvent(), the TCO's "text float" text and position are updated.
This prevents left-clicking the right edge of a resizable TCO from decreasing its size.
Also, removed an unused variable: m_oldTime
Add a new property "textBackgroundColor" to TrackContentObjectView to
expose the property to the style sheets. Use this property in the code
that renders the text labels.
Adjust the two existing style sheets.
Add the method paintTextLabel to TrackContentObjectView. This methods
implements the painting of a given text on a given painter. The new
implementation does not draw any text label in case the trimmed text
becomes empty.
Use the method paintTextLabel to paint the text for automation patterns,
BB patterns and instrument patterns.
Adjust the style sheet of the classic and default theme by moving the
font definition from PatternView into TrackContentObjectView so that it
can be used by all inheriting classes.
* play sampletracks from any song position
* take care of TCO length
* TCOs shouldn't be updated when SE window is resized
* take care of zooming level
* takes care on all song position changes and mute/solo tracks now
* playes the sample only within the buffer limits
* takes care of time signature changes
* some minor code improvements (zapashcanon)
* loopback one tick earlier
* minor code changes
* get rid off clicks by resize and scrolling song editor
* removes playhandle by remove TCO
* minor bugs on manipulating TCOs in Song Editor
* update on add sample by playing
* white spaces 1
The fix works as follows: until now the method Knob::drawKnob has used
hard coded palette colors to draw the knob lines for the different knob
types. These palette colors are now assigned to the line color property
in Knob::initUi. The method Knob::drawKnob in turn now uses the line
color property for almost all knob types. This means that all knobs
lines will be painted in the same color as before unless that property
is overridden by the stylesheet.
Also removes an unnecessary typedef from QWidget to trackSettingsWidget
in Track.h.