Commit Graph

62 Commits

Author SHA1 Message Date
saker
b451e40b51 clang-tidy: Apply modernize-use-using everywhere (#6453) 2022-07-07 10:54:34 +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
Alex
dc73911391 Rename Beat/Bassline to Pattern (#6284)
- BB* -> Pattern*
- BBTrackContainer -> PatternStore
- BBTrackContainerView -> PatternEditor
- BBEditor -> PatternEditorWindow

Does not touch save files
2022-02-13 09:03:37 +01:00
Alexandre Almeida
55d361fb65 Rename TCO and related to Clip (#6226)
This PR renames

    TCO -> Clip
    Pattern -> MidiClip
    *TCO and *TCOView -> *Clip and *ClipView

The savefiles are not yet modified by this PR.
2022-01-14 05:45:21 +01:00
Lior Merkel
98786dd84f Make preset saving oblivious to mute/solo/muteBeforeSolo states (#6214) 2021-12-27 11:23:19 +09:00
Alex
96369405b4 Color submenu, undoable colors, renaming signals (#6165)
* 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
2021-09-24 21:53:25 +02:00
Alexandre Almeida
b701e82e3b Split Track.cpp and Track.h (#5806) (Fixes #5592) 2020-12-04 02:47:16 +01:00
Alexandre Almeida
6e081265ba Rename MidiTime to TimePos (#5684)
Fixes #4866
2020-11-29 19:46:13 +01: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
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
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
Stefano Bonicatti
dc3e8cab45 Avoid leaking the track grip QPixmap at each paintEvent (#5590) 2020-07-24 10:33:46 +09:00
Lukas W
b8a3765cb1 Merge branch 'stable-1.2' into master 2020-06-01 15:19:20 +02:00
Johannes Lorenz
3a985ff1fc Fix #4201: BB editor: adjust cursor position (#5489)
This fixes an offset for cursors whose pointer position varies between
different themes.
2020-05-24 13:20:05 +02:00
Spekular
9ed5f80fe0 Refactor palette update on un/mute 2020-05-01 20:03:27 +02:00
Spekular
ae2af96c9a Use nullptr instead of NULL
Requested by Veratil <veratil@gmail.com>
2020-04-30 18:06:06 +02:00
Spekular
7c2c77cc89 Mergefix 2020-04-29 17:49:28 +02:00
Hyunjin Song
044c88c271 Merge branch 'stable-1.2'
# Conflicts:
#	.gitmodules
#	.travis.yml
#	.travis/linux..before_install.sh
#	.travis/linux..install.sh
#	CMakeLists.txt
#	cmake/linux/package_linux.sh.in
#	cmake/modules/BuildPlugin.cmake
#	include/AutomatableModel.h
#	plugins/MidiImport/MidiImport.cpp
#	plugins/carlapatchbay/CMakeLists.txt
#	plugins/carlarack/CMakeLists.txt
#	src/core/Song.cpp
#	src/core/Track.cpp
#	src/gui/editors/SongEditor.cpp
#	tests/src/core/AutomatableModelTest.cpp
2020-04-04 12:08:55 +09:00
Cyp
d849cc179c Only filter out <>:"/\|?* while exporting tracks. 2019-12-23 20:05:26 +01:00
Andres
caaeb62a95 Moved the activity indicator mute code to parent class 2019-11-07 20:53:05 -03: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
53e6b645c8 Use "bar" instead of "tact"
Closes #4865
2019-10-31 15:13:25 +01:00
Lukas W
d9f1383ca9 Remove remaining usages of QSignalMapper 2019-10-30 12:13:27 +01:00
Hyunjin Song
7ebaa0e211 Merge branch 'stable-1.2'
# Conflicts:
#	data/locale/pl.ts
#	include/SongEditor.h
#	plugins/vst_base/CMakeLists.txt
#	src/core/Song.cpp
#	src/gui/editors/SongEditor.cpp
2019-10-21 11:18:39 +09:00
Hyunjin Song
f1831ffdc6 Export TrackContentObject class
Fix a build error introduced in #5223.
2019-10-17 08:54:51 +09:00
Steffen Baranowsky
5aa87886c9 Rubberband fix for selecting large area in Songeditor (#5003) 2019-10-07 18:13:44 +02:00
Spekular
1c715bc335 Enhanced snapping in song editor (#4973)
* 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.
2019-07-27 17:14:49 +08:00
Hyunjin Song
7984bb9db6 Merge branch 'stable-1.2'
# Conflicts:
#	.travis.yml
#	.travis/linux..script.sh
#	.travis/linux.win.download.sh
#	.travis/linux.win32.script.sh
#	.travis/linux.win64.script.sh
#	.travis/osx..script.sh
#	include/VstSyncController.h
#	plugins/audio_file_processor/audio_file_processor.cpp
#	plugins/zynaddsubfx/zynaddsubfx
#	plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.cpp
#	plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.h
#	src/gui/SetupDialog.cpp
#	src/gui/editors/SongEditor.cpp
2019-03-26 09:53:33 +09:00
Lukas W
e1adfc3952 TCO drag: Fix Ctrl+Drag crash
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
2019-03-18 12:38:54 +01:00
Hyunjin Song
61c3f87ee6 Support FX Mixer for sample tracks and add controls to sample track window (#3866)
This work is based on https://github.com/LMMS/lmms/pull/3632 by @grejppi.
2019-03-11 17:06:39 +09:00
Lukas W
966bf1c6de Use CMake GenerateExportHeader 2018-07-07 11:20:54 +02:00
Hyunin Song
8a41def616 Merge branch 'stable-1.2'
# Conflicts:
#       .circleci/config.yml
#       .travis/osx..install.sh
#       CMakeLists.txt
#       plugins/zynaddsubfx/zynaddsubfx
#       plugins/zynaddsubfx/zynaddsubfx/src/DSP/FFTwrapper.h
#       plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp
#       plugins/zynaddsubfx/zynaddsubfx/src/Params/PADnoteParameters.cpp
#       plugins/zynaddsubfx/zynaddsubfx/src/Synth/OscilGen.cpp
#       src/CMakeLists.txt
#       src/core/Track.cpp
#       src/tracks/Pattern.cpp
2018-05-01 09:59:07 +09:00
Lukas W
d42a685007 Refactoring: Remove duplicate code (#4310) 2018-04-25 18:49:39 +02:00
Hussam Eddin Alhomsi
e554a4c4b0 Better behavior when left-clicking a TCO (#4290)
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
2018-04-11 13:39:43 +03:00
Steffen Baranowsky
c765249723 Sampletrack - resize from left (#3487)
Sampletrack - resize from left
2017-11-01 14:43:39 -04:00
Steffen Baranowsky
9b5d3790b0 shortcut refactor for songeditor (#3649)
* shortcut refactor for songeditor

* Ctrl-modifier for copy Tcos

* QAction()::trigger methode qt4 compatible
2017-08-27 12:23:08 +02:00
Michael Gregorius
f15fe18360 Expose the background color of the text labels in the style sheet
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.
2017-07-20 19:53:02 +02:00
Michael Gregorius
a23e344886 Make text rendering consistent for TrackContentObjectViews
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.
2017-07-20 19:53:02 +02:00
Lukas W
6004edae5c Include past automation patterns in processing (#3382)
Fixes #662

* Include past automation tracks in processing
* Track::getTCOsInRange: Use binary search, fix doc
* Automation refactorings
* Add automation tests
2017-03-26 12:27:15 +02:00
grejppi
9e85d7c66e update all copyright headers to the proper url (#3326) 2017-02-06 02:41:15 +02:00
BaraMGB
43a77a0219 Let sample tracks play from any song position (#3133)
* 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
2017-01-05 22:31:52 +01:00
Javier Serrano Polo
703a42e77c Create BB-related TCOs along with BB-related tracks (#2981) 2016-08-25 05:11:43 +02:00
Umcaruje
b8f5f21177 Make the background of BB patterns themeable (#2942)
* Make the background of BB patterns themeable

* Lighten up the color, make the BB background borderless
2016-08-02 14:45:45 +02:00
Michael Gregorius
c6863060bf Enables style sheets for knob line colors for all knob types
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.
2016-03-15 19:47:33 +01:00
Umcaruje
f136ba3097 Refactor the drawing of TCO's; Get rid of hardcoded colors in TCOs; Make TCO gradient configurable; Even out the color scheme
Thanks to @Fastigium for helping with the BB Pattern redraw problem
2016-03-02 21:58:27 +01:00
Tres Finocchiaro
aaa798c746 Remove hard-coded grid from SongEditor 2015-11-13 21:21:19 -05:00
Umcaruje
96c435b81f Fix LED's in Compact Track buttons 2015-09-15 23:57:41 +02:00
Amadeus Folego
33893e51c4 Move cloned tracks under the original 2015-03-07 12:00:20 -03:00