Commit Graph

2145 Commits

Author SHA1 Message Date
Alexandre Almeida
83e51ffc45 Remove unused stuff (#5685) 2020-11-20 15:49:15 +00:00
Kumar
a42d2d2d70 Color mixer channels if they are made by a colored track (#5780)
Color mixer channels if they are made by a coloured track using the “Assign to new FX channel option.”
2020-11-16 23:02:57 +05:30
Johannes Lorenz
3a74bad0c9 Lv2Ports: Smash plugins with out-of-bounds defaults 2020-11-15 20:10:51 +01:00
Johannes Lorenz
1c2107f4c6 Fix missing support for lv2core#sampleRate (Fixes #5767)
This multiplies port's min/max value with the processing sample rate
that is used for the plugin. This fixes damaged audio in GLAME
Butterworth High-/Lowpass from #5767.
2020-11-15 20:10:51 +01:00
Johannes Lorenz
01f2fa5c29 Introduce blacklisted plugins to Lv2 interface 2020-11-15 20:10:20 +01:00
Johannes Lorenz
7dd6a39366 Introduce blacklisted plugins to core 2020-11-15 20:10:20 +01:00
DigArtRoks
4fb66542a0 Fix for the font of truncated sidebar items (#5714). (#5777)
* Fix for the font of truncated sidebar items (#5714).

For windows platforms, retrieve the system font and set it for the FileBrowserTreeWidget. This makes sure that truncated items will use the font as non-truncated items.

* Add TODO to remove the fix when all builds use a recent enough version of qt.

* Add check on QT version and conditionally include the fix.
2020-11-14 16:45:49 +01:00
Pause for Affliction
e1d1878108 Fix memory leak that the rpmalloc assert warns of (#5776) (Fixes #5733)
Hack to take care of the assertion sent by the rpmalloc memory manager. Creates a static "free" function for NotePlayHandleManager and then shoves it right before the program ends.

Co-authored-by: Pause for Affliction <47124830+Epsilon-13@users.noreply.github.com>
2020-11-10 12:40:53 +01:00
Spekular
437172a542 Stop sample previews on mouse release or browser focus loss (#5764)
Stop previews on mouse up and focus loss.
2020-11-08 14:09:58 +01:00
DigArtRoks
a6e3958c93 Fix EffectRackView appearance (GUI). (#5766)
* Fix EffectRackView appearance (GUI).

* Elide the name of the effect when it tends to be too big. (#5752)
* Evenly space the controls (W/D, Decay Gate). (#5750)
* Show the scrollbar in the default theme to close the gap. (#5752)
* Reduce the gap between the effect and the scrollbar. (#5757)
* Use always the same width for the EffectRackview (InstrumentTrack and SampleTrack) to avoid gaps or cutoffs of the background.
* Widen the background in the default theme.
* Widen the embossed space in the background in the classic theme to fit the controls.

* Changes for improving the EffectRackView after reviews.

* Reduce the background for the default theme by 1 pixel.
* Reduce the background for the classic theme by 2 pixels and remove the darker line at the bottom right.
* Reduce the width of long names of the plugin also by 2 pixels.
* Put the controls 2 pixels closer to each other.
2020-11-07 15:52:32 +01:00
IanCaio
e2bb606341 Fixes createTCO method on some classes (#5699)
* Fixes createTCO method on some classes

	Classes that inherit from "Track", also inherit the createTCO method. That method takes a MidiTime position as an argument, but except on the class SampleTrack that argument was ignored. That lead to unnecessary calls to TCO->movePosition after creating a TCO in many parts of the codebase (making the argument completely redundant) and even to a bug on the BBEditor, caused by a call to createTCO that expected the position to be set on the constructor (see issue #5673).

	That PR adds code to move the TCO to the appropriate position inside the constructor of the classes that didn't have it, fixes the code style on the SampleTrack createTCO method and removes the now unneeded calls to movePosition from source files on src/ and plugins/. On Track::loadSettings there was a call to saveJournallingState(false) followed immediately by restoreJournallingState() which was deleted because it's redundant (probably a left over from copying the code from pasteSelection?).

* Fix code style issues

	Fixes code style issues on some files (except for ones where the current statements already had a different code style. In those the used code style was kept for consistency).

* Fixes more code style issues

* Fixes code style issues on the parameter name

	Fixes code style issue on the parameter name of createTCO, where _pos was supposed to be just pos. The existing code had the old style and I ended up replicating it on the other methods.

* Code style fixes

	Fixes code style in the changed lines.

* Fixes bug with dragging to negative positions

	There was a bug (already present before this PR) where dragging
a selection before MidiTime 0 would result in some TCOs being placed on
negative positions. This PR fixes this bug by applying the following
changes:

	1) TrackContentObject::movePosition now moves the TCO to
positions equal or above 0 only.
	2) Because of the previous change, I removed the line that
calculated the max value between 0 and the new position on
TrackContentObjectView::mouseMoveEvent when dragging a single TCO (and
added a line updating the value to the real new position of the TCO so
the label displays the position correctly).
	3) Unrelated to this bug, but removed an unnecessary call to
TrackContentWidget::changePosition on the left resize of sample TCOs
because it will already be called when movePosition triggers the
positionChanged signal.
	4) Added some logic to the TrackContentWidget::pasteSelection
method to find the left most TCO being pasted and make sure that the
offset is corrected so it doesn't end up on a negative position (similar
to the logic for the MoveSelection action).
	5) Removed another line that calculated the max between 0 and
the new position on Track::removeBar since it's now safe to call
movePosition with negative values.

* Uses std::max instead of a conditional statement

	As suggested by Spekular, we use std::max instead of a
conditional statement to correct the value of offset if it positions a
TCO on a negative position.
2020-11-07 13:54:04 +01:00
Dominic Clark
615d36b08b Support LV2 with MSVC (#5730) 2020-10-31 13:28:18 +00:00
thmueller64
2d51eaef3d Theming of disabled knobs (#5549)
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
2020-10-30 21:52:32 +01:00
firewall1110
435dbc5e00 Fix crash/freezing after rendering when using soundio/JACK (#5681) 2020-10-30 13:16:27 +09:00
Johannes Lorenz
5d0340f6ae Fix undefined Lv2Ports::Audio::m_optional after 3fa4b98 2020-10-24 17:28:37 +02:00
Kumar
f5d0524b16 Enable track-wide color coding (#5573)
* 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)
2020-10-20 19:26:22 +02:00
Johannes Lorenz
8b2902c27a Enable Lv2 Atom ports
All Atom ports are now being created and connected. Currently only MIDI
input ports are supplied with data.

Major contribution to #562 ("lv2 support").
2020-10-20 10:36:22 +02:00
Oskar Wallgren
acd0e4d430 Feature: Glue notes (#5721)
Tool to glue selected notes together. Selected notes that are
adjacent to each other or overlapping are transformed into one note
stretching over the combined notes on/off times.

Key command: <Shift> + G

Partially fixes: #746 which is part of #4877

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
Co-authored-by: Spekular <Spekularr@gmail.com>
Co-authored-by: Kevin Zander <veratil@gmail.com>
Co-authored-by: Oskar Wallgren <oskar.wallgren13@gmail.com>
2020-10-19 22:18:21 +02:00
Johannes Lorenz
0d89d64f49 Implement unused Lv2UridCache 2020-10-18 15:09:18 +02:00
Johannes Lorenz
9db671c7ae Refactor writing MIDI events to buffers
This moves out the code from the carla plugin into the core, because
this code will be re-used for Lv2 MIDI handling soon.
2020-10-17 20:56:05 +02:00
IanCaio
b64fe8e7c0 Refactor Clipboard methods (#5627)
* 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
2020-10-10 15:17:25 +09:00
Johannes Lorenz
3fa4b98a9e Remove redundant LV2Ports::Audio::m_optional
The same info is already stored in the `Lv2Ports::Meta` base class.
2020-10-04 21:59:27 +02:00
Johannes Lorenz
b558865ca4 PluginIssue: Add too MIDI in/out channels 2020-10-04 21:59:15 +02:00
allejok96
8939b149e3 Add insert/remove bar buttons in Song editor (fix #5602) 2020-10-04 16:01:35 +02:00
Johannes Lorenz
783db3e457 Remove unused make_shared from stdshims.h 2020-10-04 15:25:41 +02:00
Spekular
109a7c4735 Keyboard shortcuts to preview/add sounds from sidebar (#5427)
- Extract file item preview start and end into new methods `previewFileItem` and `stopPreview`.
- Add event handlers:
  - `keyPressEvent` to allow auto preview (on up/down arrow navigation), manual preview (space), and send to editors (enter)
  - `keyReleaseEvent` to end previews when preview key is released
  - `hideEvent` to end previews when switching sidebar tab or hiding sidebar
- Functions that operate on a `FileItem` now take it as an argument instead of using a member variable
- `getContextActions` provides menu items for sending clips to the song editor and BB editor with minimal duplicate code
- Some formatting changes in affected code
- Replace many instances of `NULL` with `nullptr`
2020-10-03 21:31:13 +02:00
Veratil
31f79a2263 Add auto-highlight scale and key selection 2020-09-29 21:55:07 -05:00
Johannes Lorenz
c3c80159fd Add missing include 2020-09-24 17:59:07 +02:00
Spekular
9e401828aa Don't give clips a hidden default name (Fix #5528) (#5621)
* Automatic formatting changes

* Give clips an empty name by default, display all names

- Stop giving clips the same name as their parent track on creation
- Stop hiding clip names that match the parent track name
- Never rename clips on track rename
- Never clear clip name when a clip is copied to another track
- Create an upgrade routine to clear default names from old projects (< 1.3.0-alpha-1)
- Bump version to 1.3.0-alpha-1

* Revert now-unnecessary version bump

* Merge with master and fix conflicts

* Formatting changes from review

* Change weird for loop conditions

* Properly revert AutomationPatter.h changes

* Only clear names that match our parent track, be more generous with use of legacyFileVersion

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
2020-09-21 16:50:55 +02:00
Johannes Lorenz
6d160fd773 basics: Change sampleFrame to use std::array (#5536)
... in order to make standard containers be able to store it. Required for
#5532 (#4899) and the recording PR.

This includes:

* removing the `LocklessRingBuffer<sampleFrame>` specialization
* passing samplerame in `StereoDelay::tick` as a reference

Additional cleanups:

* removing already unused typedef `sampleFrameA`
* add some `const_cast` to make code more readable
2020-09-21 09:04:44 +02:00
DigArtRoks
2f37281d02 Fix for Mixer volume percentage labels are off by a factor of 100 (#5661)
Add m_conversionFactor to the AutomatableModelView. This factor will be applied to the model->value when displaying
it in the contextmenu of the control for the reset and copy actions. The factor will be applied when copying the value to
the clipboard. When pasting from the clipboard, the value will be divided by the factor.

Remove the model->displayValue() calls when updating the reset/copy/paste action text labels as this gives e.g. in the
Equalizer the wrong action text for the Frequency knobs.

In the Fader class, remove the m_displayConversion variable but rather use the new m_conversionFactor variable.
Rewire the setDisplayConversion() function to set the m_conversionFactor to 1.0 or 100.0.

Faders in FxMixer show now the correct context menu. Copying and pasting values between faders or even volume knobs
in tracks shows consistent behavior. Other faders (like in Eq) show the old behavior.
2020-09-21 09:55:46 +09:00
IanCaio
1dab416c6c Improvements to the upgrade routines (#5660)
* First commit

This commit starts the improvements on the upgrade methods. We are going to change both the DataFile and ConfigManager to use separate version values from LMMS release versions, so we can easily bump those versions for new upgrade routines. This first commit starts implementing a new version value for the ConfigManager.

* Change code as per requested on review

	As requested, the "configVersion" method was replaced by "legacyConfigVersion" instead, which is only used to return a configuration version if none is present in the configuration file.
	The configuration version of the current build is stored in a local variable called CONFIG_VERSION, making version bumping easier.
	Uses a switch statement instead of if-else to be able to make use of case-cascading.

TODO:
	- Change the CONFIG_VERSION variable to a unsigned int?
	- Start working on the DataFile.cpp.

* Changes the upgrade logic on DataFile.cpp

	Starts refactoring the upgrade logic on DataFile.cpp. Now the "version" attribute is used to indicate which fileVersion we are loading. If the value of version is "1.0", we have a legacy file and use the legacyFileVersion method to retrieve the integer version using the LMMS version. If the value of version is an integer, we just read it. The integer indicates the position in a list of upgrade methods where we should start from and run the upgrade methods. The file version of the build is held in the FILE_VERSION const on DataFile.h. It HAS TO match the number of upgrade methods that we have on our list.
	One of the versions had 2 upgrade routines (upgrade_1_2_0_rc3 and upgrade_1_2_0_rc2_42). They were merged into a single one (upgrade_1_2_0_rc3) because they were both called from a single version check, meaning that they are both part of a single fileVersion.
	Two fatal errors were added (which can later be improved to show an error messagebox): One if the version attribute doesn't exist, and another one if we are using a FILE_VERSION that doesn't match the number of upgrade methods (to avoid mistakes while coding new upgrades later).

	The configVersion variables and methods were changed to use unsigned int instead of int.

TODO:
	- Make the list of upgrade methods static.
	- Add debug messages for each upgrade routine for testing purposes.

* Make method vector a static const variable

	On DataFile.cpp, we now use the vector list of upgrade methods as a static const variable, so it only has to be constructed once.

* Reorganize vector lists

	Reorganize vector lists so they are more easily readable.

	Revert changes on upgrade method names from ConfigManager.cpp.

* Makes the file version bumping automatic

	The file version bumping on DataFile.cpp is now automatic (using the size of the m_upgradeMethods vector as a reference). FILE_VERSION constant was removed, and with it the qFatal error when it doesn't match the size of the methods vector.

* Improve formatting of version and upgrades lists

	Improves the formatting of the vector lists of upgrade routines and LMMS versions (2 upgrade routines per line and 3 LMMS versions per line).
	Adds a qWarning for every upgrade routine for testing purposes, plus a qWarning that tells the current fileVersion/configVersion when upgrade is called.
	Removes extra space characters after the opening bracket of ConfigManager::upgrade_1_1_91.

* Changes ConfigManager to use a vector of methods

	Changes ConfigManager to use a vector of upgrade methods, just like DataFile. The new Config Version can be calculated automatically now, so the CONFIG_VERSION constant was removed.
	Corrects a small comment on Datafile.h.

* Addresses Dom's review requests

	- Changes legacyConfigVersion and legacyFileVersion from const unsigned int to just unsigned int, since the const is irrelevant in this context.
	- Changes the type alias for upgrade methods to start with an uppercase as per the code style guidelines. Moves the aliasing of the type to the class declaration so it can be used on both the method and on the vector list declaration.
	- Changes the vector list names from m_upgradeMethods to UPGRADE_METHODS, so it's more visible they are a static constant.
	- Move the upgradeVersions list from the legacyFileVersion method to the DataFile class, as an static const called UPGRADE_VERSIONS.
	- Uses std::upper_bound instead of std::find_if for the legacyFileVersion method.

* Uses type alias on vector assignment

	Uses the UpgradeMethod type alias when defining the upgrade methods vector from both ConfigManager and DataFile.

* Removes debugging warnings

	Removes the qWarning() calls that were placed for debugging purposes.
2020-09-18 00:45:46 +02:00
Spekular
af328003a0 Use valid Semver versions for pre-releases (#5636)
* Fix ProjectVersion handling of pre-releases

* Add workaround for old, non-standard version

* Attempt to fix versioning

* More consistent comments

* Apply suggestions from code review

- Set CompareType's underlying type to int and revert change to ProjectVersion::compare's parameters
- Add "None" and "All" as names elements of CompareType enum
- Preserve hyphens in prerelease identifiers
- Pad invalid (too short) versions to prevent crashes or nasty behavior
- Compare numeric identifiers to non-numeric ones correctly
- Don't interpret identifiers of form "-#" as numeric (where '#' is any number of digits)
- Add tests to ensure fixes in this commit work and won't regress in the future

* CMAKE fixes from code review

Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>

* Remove unnecessary changes to CMake logic

* More const, more reference

* Apply suggestions from code review

Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
2020-09-17 17:23:35 +02:00
Dat Ng
3d8b31039f Qt deprecation fix (#5619)
Qt6 TODO: Orientation check by comparing angleDelta().x() and y() won't make sense
because the direction is arbitrary in Qt 6.
2020-09-13 11:09:46 +09:00
Johannes Lorenz
8a19c2d25e Fix spelling in Lv2 classes 2020-09-12 09:36:38 +02:00
DigArtRoks
5f4d0cab9b Fix for issue #3816 - FM or heavy PM in TripleOscillator makes outputs odd for some target waveforms. (#5651)
The internal waveforms of the class Oscillator produces the wrong amplitude when the input is a
negative phase. When doing PM or FM, negative phases may occur. When a negative phase is e.g. passed
to the the saw sample, it produces values less than -1.0, hence going out of range.

Converted all fraction calls to absFraction calls.

Removed the +2 in the function Oscillator::recalcPhase. The comment here was that it was needed to avoid
negative phases in case of PM. But by converting fraction to absFraction in the waveforms, negative phases
are not an issue anymore. On top of that the m_phase variable gains about 2 extra bits in precision.
As side effect of that, it improves the behaviour of the issue #2047 - TripleOscillator: Oscillators are getting out of sync.
Though I did not investigate it thoroughly over different notes and samplerates.

Add documentation to the fraction and absFraction functions in lmms_math.h as it was not immediately clear by the name what the
functions do. Correct the implementation of the functions in case the flag __INTEL_COMPILER is set. (floorf rounds always down).
2020-09-10 22:47:06 +02:00
Dominic Clark
5efb3a19cb Fix use of translation functions (#5629) 2020-08-30 19:27:17 +01:00
DigArtRoks
9ed41c4927 Fix for Icons and comboboxes mismatch in arpeggiator in Instrument Editor #5494 (#5623)
* Fix for Icons and comboboxes mismatch in arpeggiator in Instrument Editor #5494
(https://github.com/LMMS/lmms/issues/5494)

Introduce a static const int variable for the default height of a ComboBox.
Set this height already in the constructor of the ComboBox object.
Update all modules setting the height of a ComboBox object to make use of the new constant.

* Replace 'const int' by 'constexpr int' after review.
2020-08-17 10:12:49 -04:00
Kevin Zander
966f18423f Center vertical scroll position when opening the Automation Editor (#5123)
* Center vertical scroll position when opening the Automation Editor
2020-08-11 10:18:34 -05:00
Kumar
1bb8d12e99 Enable mixer color-coding (#5589)
* Enable mixer color-coding

* Cleanup

* Fix warnings

* Improvements

* Improvements

* Use ColorChooser instead of QColorDialog

* Fix default palette being out of range

* Remove a redundant function

* Rename and make stuff efficient

* Comment on the code

* Make things more efficient

* Fix breaking builds

* Improvements

* Improvements pt. 2

* Improvements pt. 3

* Improvements pt. 4

* Improvements pt. 5

* Apply suggestions from code review

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
2020-08-11 11:01:58 +02:00
IanCaio
f2887bda68 Improve the context menu actions when multiple TCOs are selected (#5601)
* 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
2020-08-10 17:16:00 +02:00
Kevin Zander
ef961e53de Refactor PianoRoll (#5253)
* Rework PianoRoll paintEvent + some extras
* Split out PositionLine class to own file
* Refactor PianoRoll Q_PROPERTYs
* Reduce code by using Q_PROPERTY's MEMBER function and removing getter/setter functions
  After looking at the getters and setters, they did nothing different than what direct
  access would allow. Nothing outside of PianoRoll used the public functions as well.
  Considering these factors we can reduce the number of functions by 2x the number of
  Q_PROPERTIES, and go with direct access instead.
* Remove need for keyboard pixmaps
  With the recent change to allow zooming vertically, aligning pixmaps is a PITA. Since
  we have themes which can take brushes and colors, it would be simpler to take a solid
  color or a gradient with some extra style properties to resize the keys and text colors.
  While it will slightly be a downgrade from pixmaps since they can be anything really,
  this will allow us to customize the piano roll further moving forward.
* Added the ability to update margins for TimeLineWidget and StepRecorderWidget
  These take a X coordinate, which was hardcoded to WHITE_KEY_WIDTH, and never looked
  back. Now we can adjust on the fly if we need to. Currently this just allows us to
  shift the left margin to the style-defined white key width.
* Fix phantom pixmaps when PianoRoll not focused
* Update PositionLine class changes related to #5543
2020-08-09 18:01:35 -05:00
Johannes Lorenz
7a9b33627d Implement Lv2 Urid feature (#5517)
This includes implementing general feature handling, since this is the first supported feature.
2020-08-09 22:59:37 +02:00
IanCaio
639f3a49a3 Changes the behavior of "solo" so it doesn't mute Automation Tracks (#5547)
* Changes the toggleSolo method

- Changes the toggleSolo method so it doesn't mute automation tracks (keeps their original state)

* Stop restoring Automation Track's mute values

- Since Automation Tracks are not affected by enabling solo on other tracks, there's no need (and it's even counter intuitive) to restore their previous mute value.
- Reduces a line by using "else if".

* Saves two lines merging 2 conditionals in 1

* Adds the new solo behavior as a new LED button

To allow the user choosing between the old solo behavior and the new one, a new LED button was added which will be used to enable the solo keeping the automation tracks states, while the red LED will enable the solo with the current behavior.

Changes to the code:
	- Added a purple LED image that will be used on the new button.
	- Increased the default width of the widget that holds the mute and solo buttons so the third one fits.
	- Changed the positioning of the LEDs on both the standard and compact track modes to accomodate them.
	- Added a new model called m_soloAutomationsModel, which is connected to the new LED button (m_soloAutomationsBtn). This will dictate the behavior of the toggleSolo method.
	- The red LED calls the toggleSolo method as before. The purple LED will change the m_soloAutomationsModel value and toggle the red LED, which will then call toggleSolo. But since the value of m_soloAutomationsModel will be different, the new behavior will be used on the method.

* Revert "Adds the new solo behavior as a new LED button"

This reverts commit fdbc8b2712.

After consulting fellow users and devs about this change to the PR, it was decided that adding a third button for the new solo behavior was not the best approach. This reverts the commit so we go back to just changing the solo behavior. Later an option can be added on LMMS settings to choose between the old and new behaviors.

* Adds an option to use the legacy solo behavior

This commit adds an option on LMMS settings (saved to the config file) to go back to the legacy behavior of the track solo button. The option can be found on Settings>General>"Use solo legacy behavior"

Changes to the code:
	- Since there's a change to the configuration file, an upgrade method was created (upgrade_1_3_0) to add the value to the config XML if it isn't already present (safety check).
	- An attribute is added to the DOM structure of the app configuration under the "app" tag, called "sololegacybehavior", which can be either 0 or 1.
	- Changes were made to include/SetupDialog.h, include/ConfigManager.h and src/core/ConfigManager.cpp to implement this new configuration option.
	- The toggleSolo method was changed to behave according to the value of the "sololegacybehavior" configuration.

* Changes the description of the solo setting

Changes the description of the solo setting on the Setup Dialog from "Use solo legacy behavior" to "Mute automation tracks during solo" since the latter is more descriptive and new users wouldn't be confused about what the legacy behavior was.

* Merges "if"s and "if-else"s where possible

A conditional could be merged by using the "||" logical operator and there was a "if" nested inside an "else" that could be merged into a single "if-else".

Very small code format change (keeping code block curly braces in separate lines).

* Uses default value instead of upgrading ConfigFile

Instead of using an upgrade method on the ConfigManager class to set a value to the sololegacybehavior parameter, we now use a default value on every call to ConfigManager::value that requests it.

* Removes repetitive method call

To make the loop more efficient, a local variable was created to hold the behavior of the solo selected in the setup dialog, instead of calling the ConfigManager::value method repeated times.

Observation:

Since no code was added/removed from ConfigManager.cpp, it was restored to its original state. There's however a TAB character in a blank line on line 145, which was there at the beginning of this PR but removed during it. It was written again in this commit to remove ConfigManager.cpp from the "Files changed" list.

* Saves one line of code and adds a comment
2020-08-01 20:03:23 +02:00
Kevin Zander
e37f3793f3 Fix validPattern to check if hasAutomation as well (#5124) 2020-07-29 20:26:20 +02:00
Spekular
17565caf53 Improved relative paths (#5117)
* Create PathUtils

* Replace old SampleBuffer calls

* Fix automatic track names

* Fix things

* Remove accidental duplicate file

* Add includes

* More incldues

* PhysSong's code review + style

* Fix vestige loading?

Seems more reasonable to convert from relative on load and to relative on save than vice versa.

* Typo fix

* More Bases

* Enable more bases

* Add missing semicolons in prefixes

* Nicer sample track tooltip

* Use correct directories

"userXDir" gives the default dir for ladspa, sf2, and gig. "xDir" gives the user dir.

* Make relative to both default and custom locations

Part 1

* Make relative to both default and custom locations

Part 2

* Typofix

* Typofix

* Fix upgrade function after base renaming

* Fix Tests

* Update tests/src/core/RelativePathsTest.cpp

Co-Authored-By: Hyunjin Song <tteu.ingog@gmail.com>

* Choose UserXBase over DefaultXBase if identical

toShortestRelative sticks with the first base found if two bases give the same path length. By placing UserXBase Bases before DefaultXBase Bases in the relativeBases vector, toShortestRelative will prioritize them.

* Ensure baseLocation always has trailing slash

Otherwise, a user configuring a path without one will break things.

* Move loc declaration out of switch

* Semicolon

* Apply suggestions from code review...

* Include PathUtil and sort includes

* More granular includes

* Apply suggestions from code review

Co-Authored-By: Hyunjin Song <tteu.ingog@gmail.com>

* Update include/PathUtil.h

* Leave empty paths alone

* Fix stupid merge

* Really fix merge. Hopefully

* Switch Base from enum to class enum

* Don't pass Base by reference

* Use QStringLiteral for static QString allocation in basePrefix method

* Make VST loading more similar to previous implementation

* Fix tests after enum change

* Attempt to fix VST loading, nicer name for sample clips

* Fix last review comment

Don't append a "/" that will be removed by cleanPath later

* Apply suggestions from code review

Co-authored-by: Dominic Clark <mrdomclark@gmail.com>

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
2020-07-28 17:07:35 +02:00
Kumar
86306042f5 Set default behaviour of playhead to << instead of |<< (#5591)
* Set default behaviour, correct spelling

* Set default behaviour, correct spelling

* Store stop behaviour in project

* Change how state is saved & loaded

* Change to use enum
2020-07-24 09:03:25 +02:00
Stefano Bonicatti
dc3e8cab45 Avoid leaking the track grip QPixmap at each paintEvent (#5590) 2020-07-24 10:33:46 +09:00
Cyp
04d8c0db06 Add missing ¹⁄₉₆ quantization (#5304) 2020-07-24 10:33:15 +09:00
LAMCILAK Theo
37d85ef24a Implement portable mode (#5561)
Adds portable mode by creating a file named portable_mode.txt next to lmms
and fixed a typo in the name of the function
2020-07-20 11:39:53 +09:00