mirror of
https://github.com/LMMS/lmms.git
synced 2025-12-23 22:58:33 -05:00
* Rebase against master Co-authored-by: michaelgregorius <michael.gregorius.git@arcor.de> Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> * Fix Qt6 DMG on Apple (#7240) - Fix linking issues with Qt Framework files - Fix qmake detection * Fixes after rebase * Fix embed.cpp compilation Fix implicit conversion from int when using QString.arg(...) * Fix Qt6 signature change for nativeEventFilter (#7254) * Adds win32EventFilter a wrapper for nativeEventFilter on Windows * win32EventFilter is currently used to intercept top-level Window events (currently, to avoid VSTs setting transparency of the parent application) * fix broken signal slot connections (#7274) QComboBox activated() replaced with textActivated() since Qt 5.14 * Enabled VSTs on Qt 6 (#7273) * enabled VST support for Qt 6 builds * Note : Embedding on QT6 will be buggy on linux as a result of using qt embedding, which unfortunately is a qt bug which hasn't been resolved. * Changed bar lines to follow snap size (#7034) * Added lines in between bars * Changed bar lines to follow snap size * Changed default zoom and quantization value * Added constants for line widths * Added QSS configuration for new grid line colors * Tied line widths to QSS properties * Changed default quantization to 1/4 * Removed clear() from destructor model * Removed destructor in ComboBoxModel.h * Changed member set/get functions to pass by value * Updated signal connection with newer syntax * Fix compilation * Fix MSVC builds * fix nullptr deref in AudioFileProcessor (qt6 branch) (#7532) * ensured mouse event != nullptr before deref * separation of concerns: AFP WaveView updateCursor extract check to pointerCloseToStartEndOrLoop() * marked some function parameters as const * Remove Core5Compat usage * Fix bad merge * Fixes after rebase * Simplify QTX_WRAP_CPP call * Remove comments that are obvious to a developer * Whitespace * Try using Qt 6 for MSVC CI I chose Qt 6.5 because it's the last Qt LTS release with declared support for Visual Studio 2019. Once we upgrade to Visual Studio 2022, we could upgrade Qt as well. * Fix MSVC build Also fixes two memory leaks in MidiWinMM * Fix GuiApplication on MSVC * Fix interpolateInRgb * Try building with patched Calf * Fix submodule * Fix OpulenZ build * Try to fix zyn * Fix comment * Ty to fix zyn (again) * Ty to fix RemotePluginBase * Revert "Ty to fix RemotePluginBase" This reverts commit 92dac44ffb11e19d1d5a21d9155369f017bd59e9. * Update plugins/ZynAddSubFx/CMakeLists.txt Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com> * Fix vertical & horizontal scroll wheel in SongEditor * AppImage: Fix finding of Qt6 libs * Fix implicit QString --> QFileInfo conversion * Point submodule to lmms * Fix multiple deprecation warnings * Fix for Clang compiler * Build with latest Qt LTS version now that we use MSVC 2022 * Update jurplel/install-qt-action to v4.3.0 * Bump minimum Qt6 version for MSVC * Fix incorrect Qt version checks Some comparisons were using ">" rather than ">=" * `QSize()` != `QSize(0, 0)` * Fix more deprecation warnings * Fix style * Simplify Spectrum Analyzer mouse events The Qt bug that used to be present appears to have been fixed, so the workaround can be removed * Minor changes * Fix deprecated QCheckBox signal * Fix setContent helper functions * Remove QMultiMap usage from ControlLayout * Remove SIGNAL and SLOT macros * Revert TrackView.cpp changes * Remove Q_DISABLE_MOVE usage since it does not seem to be available in Qt6 --------- Co-authored-by: michaelgregorius <michael.gregorius.git@arcor.de> Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> Co-authored-by: BoredGuy1 <66702733+BoredGuy1@users.noreply.github.com> Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com> Co-authored-by: Lisa Magdalena Riedler <git@riedler.wien> Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
223 lines
7.0 KiB
C++
223 lines
7.0 KiB
C++
/*
|
|
* LadspaMatrixControlDialog.h - Dialog for displaying and editing control port
|
|
* values for LADSPA plugins in a matrix display
|
|
*
|
|
* Copyright (c) 2015 Michael Gregorius <michaelgregorius/at/web[dot]de>
|
|
*
|
|
* This file is part of LMMS - http://lmms.io
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public
|
|
* License along with this program (see COPYING); if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
* Boston, MA 02110-1301 USA.
|
|
*
|
|
*/
|
|
|
|
|
|
#include <QLabel>
|
|
#include <QScrollArea>
|
|
#include <QScrollBar>
|
|
#include <QSpacerItem>
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
#include "LadspaControl.h"
|
|
#include "LadspaControls.h"
|
|
#include "LadspaMatrixControlDialog.h"
|
|
#include "LadspaWidgetFactory.h"
|
|
#include "LedCheckBox.h"
|
|
|
|
|
|
namespace lmms::gui
|
|
{
|
|
|
|
LadspaMatrixControlDialog::LadspaMatrixControlDialog(LadspaControls * ladspaControls) :
|
|
EffectControlDialog(ladspaControls),
|
|
m_scrollArea(nullptr),
|
|
m_stereoLink(nullptr)
|
|
{
|
|
QVBoxLayout * mainLayout = new QVBoxLayout(this);
|
|
|
|
m_scrollArea = new QScrollArea(this);
|
|
m_scrollArea->setWidgetResizable(true);
|
|
m_scrollArea->setFrameShape(QFrame::NoFrame);
|
|
// Set to always on so that the elements do not move around when the
|
|
// scroll bar is hidden or shown.
|
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
|
|
|
// Add a scroll area that grows
|
|
mainLayout->addWidget(m_scrollArea, 1);
|
|
|
|
// Populate the parameter matrix and put it into the scroll area
|
|
updateEffectView(ladspaControls);
|
|
|
|
// Add button to link all channels if there's more than one channel
|
|
if (getChannelCount() > 1)
|
|
{
|
|
mainLayout->addSpacing(3);
|
|
|
|
m_stereoLink = new LedCheckBox(tr("Link Channels"), this, QString(), LedCheckBox::LedColor::Green, false);
|
|
m_stereoLink->setModel(&ladspaControls->m_stereoLinkModel);
|
|
mainLayout->addWidget(m_stereoLink, 0, Qt::AlignCenter);
|
|
}
|
|
}
|
|
|
|
bool LadspaMatrixControlDialog::isResizable() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool LadspaMatrixControlDialog::needsLinkColumn() const
|
|
{
|
|
LadspaControls * ladspaControls = getLadspaControls();
|
|
|
|
ch_cnt_t const channelCount = getChannelCount();
|
|
for (ch_cnt_t i = 0; i < channelCount; ++i)
|
|
{
|
|
// Create a const reference so that the C++11 based for loop does not detach the Qt container
|
|
auto const & currentControls = ladspaControls->m_controls[i];
|
|
for (auto ladspaControl : currentControls)
|
|
{
|
|
if (ladspaControl->m_link)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void LadspaMatrixControlDialog::arrangeControls(QWidget * parent, QGridLayout* gridLayout)
|
|
{
|
|
LadspaControls * ladspaControls = getLadspaControls();
|
|
|
|
int const headerRow = 0;
|
|
int const linkColumn = 0;
|
|
|
|
bool const linkColumnNeeded = needsLinkColumn();
|
|
if (linkColumnNeeded)
|
|
{
|
|
gridLayout->addWidget(new QLabel("<b>" + tr("Link") + "</b>", parent), headerRow, linkColumn, Qt::AlignHCenter);
|
|
|
|
// If there's a link column then it should not stretch
|
|
gridLayout->setColumnStretch(linkColumn, 0);
|
|
}
|
|
|
|
int const channelStartColumn = linkColumnNeeded ? 1 : 0;
|
|
|
|
// The header row should not grow vertically
|
|
gridLayout->setRowStretch(0, 0);
|
|
|
|
// Records the maximum row with parameters so that we can add a vertical spacer after that row
|
|
int maxRow = 0;
|
|
|
|
// Iterate the channels and add widgets for each control
|
|
// Note: the code assumes that all channels have the same structure, i.e. that all channels
|
|
// have the same number of parameters which are in the same order.
|
|
ch_cnt_t const numberOfChannels = getChannelCount();
|
|
for (ch_cnt_t i = 0; i < numberOfChannels; ++i)
|
|
{
|
|
int currentChannelColumn = channelStartColumn + i;
|
|
gridLayout->setColumnStretch(currentChannelColumn, 1);
|
|
|
|
// First add the channel header with the channel number
|
|
gridLayout->addWidget(new QLabel("<b>" + tr("Channel %1").arg(QString::number(i + 1)) + "</b>", parent), headerRow, currentChannelColumn, Qt::AlignHCenter);
|
|
|
|
int currentRow = 1;
|
|
|
|
if (i == 0)
|
|
{
|
|
// Configure the current parameter row to not stretch.
|
|
// Only do this once, i.e. when working with the first channel.
|
|
gridLayout->setRowStretch(currentRow, 0);
|
|
}
|
|
|
|
// Create a const reference so that the C++11 based for loop does not detach the Qt container
|
|
auto const & currentControls = ladspaControls->m_controls[i];
|
|
for (auto ladspaControl : currentControls)
|
|
{
|
|
// Only use the first channel to determine if we need to add link controls
|
|
if (i == 0 && ladspaControl->m_link)
|
|
{
|
|
LedCheckBox * linkCheckBox = new LedCheckBox("", parent, "", LedCheckBox::LedColor::Green);
|
|
linkCheckBox->setModel(&ladspaControl->m_linkEnabledModel);
|
|
linkCheckBox->setToolTip(tr("Link channels"));
|
|
gridLayout->addWidget(linkCheckBox, currentRow, linkColumn, Qt::AlignHCenter);
|
|
}
|
|
|
|
QWidget * controlWidget = LadspaWidgetFactory::createWidget(ladspaControl, this);
|
|
if (controlWidget)
|
|
{
|
|
gridLayout->addWidget(controlWidget, currentRow, currentChannelColumn);
|
|
}
|
|
|
|
// Record the maximum row so that we add a vertical spacer after that row
|
|
maxRow = std::max(maxRow, currentRow);
|
|
|
|
++currentRow;
|
|
}
|
|
}
|
|
|
|
// Add a spacer item after the maximum row
|
|
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
gridLayout->addItem(spacer, maxRow + 1, 0);
|
|
}
|
|
|
|
QWidget * LadspaMatrixControlDialog::createMatrixWidget()
|
|
{
|
|
QWidget *widget = new QWidget(this);
|
|
QGridLayout *gridLayout = new QGridLayout(widget);
|
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
widget->setLayout(gridLayout);
|
|
|
|
arrangeControls(widget, gridLayout);
|
|
|
|
return widget;
|
|
}
|
|
|
|
void LadspaMatrixControlDialog::updateEffectView(LadspaControls * ladspaControls)
|
|
{
|
|
m_effectControls = ladspaControls;
|
|
|
|
// No need to delete the existing widget as it's deleted
|
|
// by the scroll view when we replace it.
|
|
QWidget * matrixWidget = createMatrixWidget();
|
|
m_scrollArea->setWidget(matrixWidget);
|
|
|
|
// Make sure that the horizontal scroll bar does not show
|
|
// From: https://forum.qt.io/topic/13374/solved-qscrollarea-vertical-scroll-only/4
|
|
m_scrollArea->setMinimumWidth(matrixWidget->minimumSizeHint().width() + m_scrollArea->verticalScrollBar()->width());
|
|
|
|
if (getChannelCount() > 1 && m_stereoLink != nullptr)
|
|
{
|
|
m_stereoLink->setModel(&ladspaControls->m_stereoLinkModel);
|
|
}
|
|
|
|
connect(ladspaControls, &LadspaControls::effectModelChanged,
|
|
this, &LadspaMatrixControlDialog::updateEffectView,
|
|
Qt::DirectConnection);
|
|
}
|
|
|
|
LadspaControls * LadspaMatrixControlDialog::getLadspaControls() const
|
|
{
|
|
return dynamic_cast<LadspaControls *>(m_effectControls);
|
|
}
|
|
|
|
ch_cnt_t LadspaMatrixControlDialog::getChannelCount() const
|
|
{
|
|
return getLadspaControls()->m_processors;
|
|
}
|
|
|
|
} // namespace lmms::gui
|