LMMS
Loading...
Searching...
No Matches
LOMMControlDialog.h
Go to the documentation of this file.
1/*
2 * LOMMControlDialog.h
3 *
4 * Copyright (c) 2023 Lost Robot <r94231/at/gmail/dot/com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_GUI_LOMM_CONTROL_DIALOG_H
26#define LMMS_GUI_LOMM_CONTROL_DIALOG_H
27
28#include "EffectControlDialog.h"
29
30
31#include "embed.h"
32#include "Knob.h"
33#include "LcdFloatSpinBox.h"
34#include "PixmapButton.h"
35
36namespace lmms
37{
38
39inline constexpr float LOMM_DISPLAY_MIN = -72;
40inline constexpr float LOMM_DISPLAY_MAX = 0;
41inline constexpr float LOMM_DISPLAY_X = 125;
42inline constexpr float LOMM_DISPLAY_Y[6] = {24, 41, 106, 123, 186, 203};
43inline constexpr float LOMM_DISPLAY_WIDTH = 150;
44inline constexpr float LOMM_DISPLAY_HEIGHT = 13;
46
47class LOMMControls;
48
49
50namespace gui
51{
52
54{
55 Q_OBJECT
56public:
58 ~LOMMControlDialog() override = default;
59
60 int dbfsToX(float dbfs);
61 float xToDbfs(int x);
62
63 Knob* createKnob(KnobType knobType, QWidget* parent, int x, int y, FloatModel* model, const QString& hintText, const QString& unit, const QString& toolTip)
64 {
65 Knob* knob = new Knob(knobType, parent);
66 knob->move(x, y);
67 knob->setModel(model);
68 knob->setHintText(hintText, unit);
69 knob->setToolTip(toolTip);
70 return knob;
71 }
72
73 LcdFloatSpinBox* createLcdFloatSpinBox(int integerDigits, int decimalDigits, const QString& color, const QString& unit, QWidget* parent, int x, int y, FloatModel* model, const QString& toolTip)
74 {
75 LcdFloatSpinBox* spinBox = new LcdFloatSpinBox(integerDigits, decimalDigits, color, unit, parent);
76 spinBox->move(x, y);
77 spinBox->setModel(model);
78 spinBox->setSeamless(true, true);
79 spinBox->setToolTip(toolTip);
80 return spinBox;
81 }
82
83 PixmapButton* createPixmapButton(const QString& text, QWidget* parent, int x, int y, BoolModel* model,
84 std::string_view activeIcon, std::string_view inactiveIcon, const QString& tooltip)
85 {
86 PixmapButton* button = new PixmapButton(parent, text);
87 button->move(x, y);
88 button->setCheckable(true);
89 if (model) { button->setModel(model); }
90 button->setActiveGraphic(PLUGIN_NAME::getIconPixmap(activeIcon));
91 button->setInactiveGraphic(PLUGIN_NAME::getIconPixmap(inactiveIcon));
92 button->setToolTip(tooltip);
93 return button;
94 }
95
96protected:
97 void paintEvent(QPaintEvent *event) override;
98 void mousePressEvent(QMouseEvent* event) override;
99 void mouseReleaseEvent(QMouseEvent* event) override;
100 void mouseMoveEvent(QMouseEvent* event) override;
101
102private:
104
106 bool m_buttonPressed = false;
107 int m_bandDrag = 0;
108 int m_dragType = -1;
109
112
113private slots:
116 void updateDisplay();
117};
118
119
120} // namespace gui
121
122} // namespace lmms
123
124#endif // LMMS_GUI_LOMM_CONTROL_DIALOG_H
Definition AutomatableModel.h:497
Definition AutomatableModel.h:463
Definition LOMMControls.h:36
void setModel(Model *model, bool isOldModelValid=true) override
Definition AutomatableModelView.cpp:128
EffectControlDialog(EffectControls *controls)
Definition EffectControlDialog.cpp:33
void setHintText(const QString &txt_before, const QString &txt_after)
Definition FloatModelEditorBase.h:59
Definition Knob.h:47
Knob * createKnob(KnobType knobType, QWidget *parent, int x, int y, FloatModel *model, const QString &hintText, const QString &unit, const QString &toolTip)
Definition LOMMControlDialog.h:63
int m_dragType
Definition LOMMControlDialog.h:108
int m_bandDrag
Definition LOMMControlDialog.h:107
int dbfsToX(float dbfs)
Definition LOMMControlDialog.cpp:193
LcdFloatSpinBox * createLcdFloatSpinBox(int integerDigits, int decimalDigits, const QString &color, const QString &unit, QWidget *parent, int x, int y, FloatModel *model, const QString &toolTip)
Definition LOMMControlDialog.h:73
void updateFeedbackVisibility()
Definition LOMMControlDialog.cpp:129
PixmapButton * m_lowSideUpwardSuppressButton
Definition LOMMControlDialog.h:111
QPoint m_lastMousePos
Definition LOMMControlDialog.h:105
void paintEvent(QPaintEvent *event) override
Definition LOMMControlDialog.cpp:144
LOMMControls * m_controls
Definition LOMMControlDialog.h:103
PixmapButton * createPixmapButton(const QString &text, QWidget *parent, int x, int y, BoolModel *model, std::string_view activeIcon, std::string_view inactiveIcon, const QString &tooltip)
Definition LOMMControlDialog.h:83
PixmapButton * m_feedbackButton
Definition LOMMControlDialog.h:110
bool m_buttonPressed
Definition LOMMControlDialog.h:106
void mousePressEvent(QMouseEvent *event) override
Definition LOMMControlDialog.cpp:207
LOMMControlDialog(LOMMControls *controls)
Definition LOMMControlDialog.cpp:40
float xToDbfs(int x)
Definition LOMMControlDialog.cpp:200
void mouseReleaseEvent(QMouseEvent *event) override
Definition LOMMControlDialog.cpp:273
void updateDisplay()
Definition LOMMControlDialog.cpp:139
void mouseMoveEvent(QMouseEvent *event) override
Definition LOMMControlDialog.cpp:242
void updateLowSideUpwardSuppressVisibility()
Definition LOMMControlDialog.cpp:134
~LOMMControlDialog() override=default
Definition LcdFloatSpinBox.h:39
void setSeamless(bool left, bool right)
Definition LcdFloatSpinBox.h:53
Model * model()
Definition ModelView.h:43
Definition PixmapButton.h:37
int y
Definition inflate.c:1588
unsigned x[BMAX+1]
Definition inflate.c:1586
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:223
KnobType
Definition Knob.h:39
Definition AudioAlsa.cpp:35
constexpr float LOMM_DISPLAY_Y[6]
Definition LOMMControlDialog.h:42
constexpr float LOMM_DISPLAY_X
Definition LOMMControlDialog.h:41
constexpr float LOMM_DISPLAY_HEIGHT
Definition LOMMControlDialog.h:44
constexpr float LOMM_DISPLAY_MIN
Definition LOMMControlDialog.h:39
constexpr float LOMM_DISPLAY_WIDTH
Definition LOMMControlDialog.h:43
constexpr float LOMM_DISPLAY_MAX
Definition LOMMControlDialog.h:40
constexpr float LOMM_DISPLAY_DB_PER_PIXEL
Definition LOMMControlDialog.h:45
png_const_structrp png_const_inforp int * unit
Definition png.h:2161
const char * text
Definition swell-functions.h:167