Skip to content

Commit

Permalink
Fix minimum size of LADSPA dialogs (#6982) (#7019)
Browse files Browse the repository at this point in the history
Remove the code which computes a minimum height for the LADSPA dialogs. It was intended to make sure that no scrollbar is shown in most cases. However, doing so came at the cost that the computed height was the minimum height as well. Therefore the dialogs took a lot of space on low-res displays and could not be made smaller.

After the removal the behavior is still sane. Small dialogs are shown in full and dialogs which are larger, e.g. "Calf Equalizer 12 Band LADSPA", seem to be sized around half the height of the workspace and show scrollbars.
  • Loading branch information
michaelgregorius committed Dec 31, 2023
1 parent 6b21dc7 commit bf4e57d
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions plugins/LadspaEffect/LadspaMatrixControlDialog.cpp
Expand Up @@ -41,9 +41,6 @@
#include "LadspaControlView.h"
#include "LedCheckBox.h"

#include "GuiApplication.h"
#include "MainWindow.h"


namespace lmms::gui
{
Expand Down Expand Up @@ -206,20 +203,6 @@ void LadspaMatrixControlDialog::updateEffectView(LadspaControls * ladspaControls
// From: https://forum.qt.io/topic/13374/solved-qscrollarea-vertical-scroll-only/4
m_scrollArea->setMinimumWidth(matrixWidget->minimumSizeHint().width() + m_scrollArea->verticalScrollBar()->width());


// Make sure that the widget is shown without a scrollbar whenever possible
// If the widget fits on the workspace we use the height of the widget as the minimum size of the scroll area.
// This will ensure that the scrollbar is not shown initially (and never will be).
// If the widget is larger than the workspace then we want it to mostly cover the workspace.
//
// This is somewhat ugly but I have no idea how to control the initial size of the scroll area otherwise
auto const workspaceSize = getGUI()->mainWindow()->workspace()->viewport()->size();
// Make sure that we always account a minumum height for the workspace, i.e. that we never compute
// something close to 0 if the LMMS window is very small
int workspaceHeight = qMax(200, static_cast<int>(workspaceSize.height() * 0.9));
int minOfWidgetAndWorkspace = qMin(matrixWidget->minimumSizeHint().height(), workspaceHeight);
m_scrollArea->setMinimumHeight(minOfWidgetAndWorkspace);

if (getChannelCount() > 1 && m_stereoLink != nullptr)
{
m_stereoLink->setModel(&ladspaControls->m_stereoLinkModel);
Expand Down

0 comments on commit bf4e57d

Please sign in to comment.