diff --git a/include/PluginView.h b/include/PluginView.h index 15c1589ec4b..a85b0b9e185 100644 --- a/include/PluginView.h +++ b/include/PluginView.h @@ -27,24 +27,26 @@ #include -#include "Plugin.h" #include "ModelView.h" +#include "Plugin.h" -namespace lmms::gui -{ +namespace lmms::gui { -class LMMS_EXPORT PluginView : public QWidget, public ModelView +class LMMS_EXPORT PluginView : public QWidget, public ModelView { public: - PluginView( Plugin * _plugin, QWidget * _parent ) : - QWidget( _parent ), - ModelView( _plugin, this ) + PluginView(Plugin* _plugin, QWidget* _parent) + : QWidget(_parent) + , ModelView(_plugin, this) { } - bool m_isResizable = false; -} ; + void setResizable(bool resizable) { m_isResizable = resizable; } + bool isResizable() { return m_isResizable; } +private: + bool m_isResizable = false; +}; } // namespace lmms::gui diff --git a/plugins/SlicerT/SlicerT.cpp b/plugins/SlicerT/SlicerT.cpp index 1aa6047c89b..9e2d5f6e33d 100644 --- a/plugins/SlicerT/SlicerT.cpp +++ b/plugins/SlicerT/SlicerT.cpp @@ -247,7 +247,7 @@ void SlicerT::findSlices() if (noteSnap == 0) { sliceLock = 1; } for (float& sliceValue : m_slicePoints) { - sliceValue += sliceLock / 2; + sliceValue += sliceLock / 2.; sliceValue -= static_cast(sliceValue) % sliceLock; } diff --git a/plugins/SlicerT/SlicerT.h b/plugins/SlicerT/SlicerT.h index 010985dfce1..44d1d00dde1 100644 --- a/plugins/SlicerT/SlicerT.h +++ b/plugins/SlicerT/SlicerT.h @@ -84,6 +84,8 @@ public slots: void findSlices(); void findBPM(); + QString getSampleName() { return m_originalSample.sampleFile(); } + QString nodeName() const override; gui::PluginView* instantiateView(QWidget* parent) override; diff --git a/plugins/SlicerT/SlicerTView.cpp b/plugins/SlicerT/SlicerTView.cpp index 2b7f7081cec..2668018c816 100644 --- a/plugins/SlicerT/SlicerTView.cpp +++ b/plugins/SlicerT/SlicerTView.cpp @@ -26,7 +26,10 @@ #include #include +#include #include +#include +#include #include #include @@ -48,29 +51,29 @@ namespace gui { SlicerTView::SlicerTView(SlicerT* instrument, QWidget* parent) : InstrumentView(instrument, parent) , m_slicerTParent(instrument) + , m_fullLogo(PLUGIN_NAME::getIconPixmap("full_logo")) + , m_background(PLUGIN_NAME::getIconPixmap("toolbox")) { // window settings setAcceptDrops(true); setAutoFillBackground(true); - setMaximumSize(QSize(500, 500)); - setMinimumSize(QSize(250, 250)); - m_isResizable = true; - - // render background - QPalette pal; - pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork")); - setPalette(pal); + setMaximumSize(QSize(10000, 10000)); + setMinimumSize(QSize(516, 400)); + setResizable(true); m_wf = new SlicerTWaveform(248, 128, instrument, this); - m_wf->move(2, 6); + m_wf->move(0, s_topBarHeight); m_snapSetting = new ComboBox(this, tr("Slice snap")); m_snapSetting->setGeometry(185, 200, 55, ComboBox::DEFAULT_HEIGHT); m_snapSetting->setToolTip(tr("Set slice snapping for detection")); m_snapSetting->setModel(&m_slicerTParent->m_sliceSnap); - m_syncToggle = new LedCheckBox("Sync", this, tr("SyncToggle"), LedCheckBox::LedColor::Green); + m_syncToggle = new PixmapButton(this, tr("Sync sample")); + m_syncToggle->setActiveGraphic(PLUGIN_NAME::getIconPixmap("sync_active")); + m_syncToggle->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("sync_inactive")); + m_syncToggle->setCheckable(true); m_syncToggle->setToolTip(tr("Enable BPM sync")); m_syncToggle->setModel(&m_slicerTParent->m_enableSync); @@ -91,9 +94,15 @@ SlicerTView::SlicerTView(SlicerT* instrument, QWidget* parent) m_midiExportButton->setToolTip(tr("Copy midi pattern to clipboard")); connect(m_midiExportButton, &PixmapButton::clicked, this, &SlicerTView::exportMidi); + m_folderButton = new PixmapButton(this); + m_folderButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("folder_icon")); + m_folderButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("folder_icon")); + m_folderButton->setToolTip(tr("Open sample selector")); + connect(m_folderButton, &PixmapButton::clicked, this, &SlicerTView::openFiles); + m_resetButton = new QPushButton(this); m_resetButton->setIcon(PLUGIN_NAME::getIconPixmap("reset_slices")); - m_resetButton->setToolTip(tr("Reset Slices")); + m_resetButton->setToolTip(tr("Reset slices")); connect(m_resetButton, &PixmapButton::clicked, m_slicerTParent, &SlicerT::updateSlices); update(); @@ -181,50 +190,101 @@ void SlicerTView::dropEvent(QDropEvent* de) void SlicerTView::paintEvent(QPaintEvent* pe) { QPainter brush(this); - brush.setPen(QColor(255, 255, 255)); brush.setFont(QFont(brush.font().family(), 7, -1, false)); - int y1_text = m_y1 + 22; - int y2_text = m_y2 + 22; + int boxTopY = height() - s_bottomBoxHeight; + + // --- backgrounds and limiters + brush.drawPixmap(QRect(0, boxTopY, s_leftBoxWidth, s_bottomBoxHeight), m_background); // left + brush.fillRect( + QRect(s_leftBoxWidth, boxTopY, width() - s_leftBoxWidth, s_bottomBoxHeight), QColor(23, 26, 31)); // right + brush.fillRect(QRect(0, 0, width(), s_topBarHeight), QColor(20, 23, 27)); // top + + // top bar dividers + brush.setPen(QColor(56, 58, 60)); + brush.drawLine(0, s_topBarHeight - 1, width(), s_topBarHeight - 1); + brush.drawLine(0, 0, width(), 0); - brush.drawText(m_x1 - 12, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Reset")); - brush.drawText(m_x4 - 12, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Midi")); + // sample name divider + brush.setPen(QColor(56, 58, 60)); + brush.drawLine(0, boxTopY, width(), boxTopY); - brush.drawText(m_x1 - 25, y2_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Threshold")); - brush.drawText(m_x2 - 25, y2_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Fade Out")); - brush.drawText(m_x3 - 16, y2_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("BPM")); - brush.drawText(m_x4 - 8, y2_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Snap")); + // boxes divider + brush.setPen(QColor(56, 24, 94)); + brush.drawLine(s_leftBoxWidth, boxTopY, s_leftBoxWidth, height()); + + // --- top bar + brush.drawPixmap( + QRect(10, (s_topBarHeight - m_fullLogo.height()) / 2, m_fullLogo.width(), m_fullLogo.height()), m_fullLogo); + + int y1_text = m_y1 + 27; + + // --- left box + brush.setPen(QColor(255, 255, 255)); + brush.drawText(s_x1 - 25, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Threshold")); + brush.drawText(s_x2 - 25, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Fade Out")); + brush.drawText(s_x3 - 25, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Reset")); + brush.drawText(s_x4 - 8, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Midi")); + brush.drawText(s_x5 - 16, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("BPM")); + brush.drawText(s_x6 - 8, y1_text, s_textBoxWidth, s_textBoxHeight, Qt::AlignCenter, tr("Snap")); + + int kor = 15; // knob outer radius + int kir = 9; // knob inner radius + + // draw knob backgrounds + brush.setRenderHint(QPainter::Antialiasing); + + // draw outer radius 2 times to make smooth + brush.setPen(QPen(QColor(159, 124, 223, 100), 4)); + brush.drawArc(QRect(s_x1 - kor, m_y1, kor * 2, kor * 2), -45 * 16, 270 * 16); + brush.drawArc(QRect(s_x2 - kor, m_y1, kor * 2, kor * 2), -45 * 16, 270 * 16); + + brush.setPen(QPen(QColor(159, 124, 223, 255), 2)); + brush.drawArc(QRect(s_x1 - kor, m_y1, kor * 2, kor * 2), -45 * 16, 270 * 16); + brush.drawArc(QRect(s_x2 - kor, m_y1, kor * 2, kor * 2), -45 * 16, 270 * 16); + + // inner knob circle + brush.setBrush(QColor(106, 90, 138)); + brush.setPen(QColor(0, 0, 0, 0)); + brush.drawEllipse(QPoint(s_x1, m_y1 + 15), kir, kir); + brush.drawEllipse(QPoint(s_x2, m_y1 + 15), kir, kir); + + // current sample bar + brush.fillRect(QRect(0, boxTopY - s_sampleBoxHeight, width(), s_sampleBoxHeight), QColor(5, 5, 5)); + + brush.setPen(QColor(56, 58, 60)); + brush.drawLine(width() - 24, boxTopY - s_sampleBoxHeight, width() - 24, boxTopY); + + brush.setPen(QColor(255, 255, 255, 180)); + brush.setFont(QFont(brush.font().family(), 8, -1, false)); + QString sampleName = m_slicerTParent->getSampleName(); + if (sampleName == "") { sampleName = "No sample loaded"; } + + brush.drawText(5, boxTopY - s_sampleBoxHeight, width(), s_sampleBoxHeight, Qt::AlignLeft, sampleName); } -void SlicerTView::resizeEvent(QResizeEvent * re) +void SlicerTView::resizeEvent(QResizeEvent* re) { - QPalette pal = palette(); - pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork").scaled(size(), Qt::IgnoreAspectRatio)); - setPalette(pal); + m_y1 = height() - s_bottomBoxOffset; + + // left box + m_noteThresholdKnob->move(s_x1 - 25, m_y1); + m_fadeOutKnob->move(s_x2 - 25, m_y1); - m_y1 = height() - 100; - m_y2 = height() - 50; + m_resetButton->move(s_x3 - 15, m_y1 + 3); + m_midiExportButton->move(s_x4 + 2, m_y1 + 3); - m_x1 = width() * 0.2f; - m_x2 = width() * 0.4f; - m_x3 = width() * 0.6f; - m_x4 = width() * 0.8f; + m_bpmBox->move(s_x5 - 13, m_y1 + 4); + m_snapSetting->move(s_x6 - 8, m_y1 + 3); - // first row - m_resetButton->move(m_x1 - 12, m_y1); - m_midiExportButton->move(m_x4 - 12, m_y1); + // right box + m_syncToggle->move((width() - 100), m_y1 + 5); - // second row - m_noteThresholdKnob->move(m_x1 - 25, m_y2); - m_fadeOutKnob->move(m_x2 - 25, m_y2); - - m_bpmBox->move(m_x3 - 16, m_y2); - m_syncToggle->move(m_x3 - 7, m_y2 - 16); + m_folderButton->move(width() - 20, height() - s_bottomBoxHeight - s_sampleBoxHeight + 1); - m_snapSetting->move(m_x4 - 8, m_y2); + int waveFormHeight = height() - s_bottomBoxHeight - s_topBarHeight - s_sampleBoxHeight; - m_wf->resize(width() - 2, height() - 125); - m_wf->updateSize(width() - 2, height() - 125); + m_wf->resize(width(), waveFormHeight); } } // namespace gui diff --git a/plugins/SlicerT/SlicerTView.h b/plugins/SlicerT/SlicerTView.h index 2ca29342dbc..d49243f5a77 100644 --- a/plugins/SlicerT/SlicerTView.h +++ b/plugins/SlicerT/SlicerTView.h @@ -26,12 +26,14 @@ #define LMMS_GUI_SLICERT_VIEW_H #include +#include #include "ComboBox.h" #include "InstrumentView.h" #include "Knob.h" #include "LcdSpinBox.h" #include "LedCheckBox.h" +#include "PixmapButton.h" #include "SlicerTWaveform.h" namespace lmms { @@ -53,9 +55,21 @@ public slots: static constexpr int s_textBoxHeight = 20; static constexpr int s_textBoxWidth = 50; - static constexpr int s_topTextY = 170; - static constexpr int s_bottomTextY = 220; + static constexpr int s_topBarHeight = 50; + static constexpr int s_bottomBoxHeight = 97; + static constexpr int s_bottomBoxOffset = 65; + static constexpr int s_sampleBoxHeight = 14; + static constexpr int s_folderButtonWidth = 15; + static constexpr int s_leftBoxWidth = 400; + + + static constexpr int s_x1 = 35; + static constexpr int s_x2 = 85; + static constexpr int s_x3 = 160; + static constexpr int s_x4 = 190; + static constexpr int s_x5 = 275; + static constexpr int s_x6 = 325; protected: virtual void dragEnterEvent(QDragEnterEvent* dee) override; virtual void dropEvent(QDropEvent* de) override; @@ -72,7 +86,8 @@ public slots: Knob* m_fadeOutKnob; LcdSpinBox* m_bpmBox; ComboBox* m_snapSetting; - LedCheckBox* m_syncToggle; + PixmapButton* m_syncToggle; + PixmapButton* m_folderButton; QPushButton* m_resetButton; QPushButton* m_midiExportButton; @@ -81,10 +96,9 @@ public slots: Knob* createStyledKnob(); - int m_x1; - int m_x2; - int m_x3; - int m_x4; + QPixmap m_fullLogo; + QPixmap m_background; + int m_y1; int m_y2; diff --git a/plugins/SlicerT/SlicerTWaveform.cpp b/plugins/SlicerT/SlicerTWaveform.cpp index 9b1db558fbc..37fb82c23fa 100644 --- a/plugins/SlicerT/SlicerTWaveform.cpp +++ b/plugins/SlicerT/SlicerTWaveform.cpp @@ -25,6 +25,7 @@ #include "SlicerTWaveform.h" #include +#include #include "SampleWaveform.h" #include "SlicerT.h" @@ -35,44 +36,52 @@ namespace lmms { namespace gui { +// waveform colors static QColor s_emptyColor = QColor(0, 0, 0, 0); -static QColor s_waveformColor = QColor(123, 49, 212); -static QColor s_waveformBgColor = QColor(0, 0, 0, 255); -static QColor s_waveformMaskColor = QColor(151, 65, 255); // update this if s_waveformColor changes -static QColor s_waveformInnerColor = QColor(183, 124, 255); - -static QColor s_playColor = QColor(255, 255, 255, 200); -static QColor s_playHighlightColor = QColor(255, 255, 255, 70); - -static QColor s_sliceColor = QColor(218, 193, 255); -static QColor s_sliceShadowColor = QColor(136, 120, 158); -static QColor s_sliceHighlightColor = QColor(255, 255, 255); - -static QColor s_seekerColor = QColor(178, 115, 255); -static QColor s_seekerHighlightColor = QColor(178, 115, 255, 100); -static QColor s_seekerShadowColor = QColor(0, 0, 0, 120); +static QColor s_waveformColor = QColor(123, 49, 212); // color of outer waveform +static QColor s_waveformSeekerBgColor = QColor(0, 0, 0, 255); +static QColor s_waveformEditorBgColor = QColor(15, 15, 15, 255); +static QColor s_waveformMaskColor = QColor(151, 65, 255); // update this if s_waveformColor changes +static QColor s_waveformInnerColor = QColor(183, 124, 255); // color of inner waveform + +// now playing colors +static QColor s_playColor = QColor(255, 255, 255, 200); // now playing line +static QColor s_playHighlightColor = QColor(255, 255, 255, 70); // now playing note marker + +// slice markers +static QColor s_sliceColor = QColor(218, 193, 255); // color of slice marker +static QColor s_sliceShadowColor = QColor(136, 120, 158); // color of dark side of slice marker +static QColor s_sliceHighlightColor = QColor(255, 255, 255); // color of highlighted slice marker + +// seeker rect colors +static QColor s_seekerColor = QColor(178, 115, 255); // outline of seeker +static QColor s_seekerHighlightColor = QColor(178, 115, 255, 100); // inside of seeker +static QColor s_seekerShadowColor = QColor(0, 0, 0, 120); // color used for darkening outside seeker + +// decor colors +static QColor s_editorBounding = QColor(53, 22, 90); // color of the editor bounding box +static QColor s_gradientEnd = QColor(29, 16, 47); // end color of the seeker gradient SlicerTWaveform::SlicerTWaveform(int totalWidth, int totalHeight, SlicerT* instrument, QWidget* parent) : QWidget(parent) , m_width(totalWidth) , m_height(totalHeight) - , m_seekerHeight(totalHeight * 0.33f) + , m_seekerHeight(40) , m_seekerWidth(totalWidth - s_seekerHorMargin * 2) - , m_editorHeight(totalHeight - m_seekerHeight - s_middleMargin) + , m_editorHeight(totalHeight - m_seekerHeight - s_middleMargin - s_seekerVerMargin) , m_editorWidth(totalWidth) , m_sliceArrow(PLUGIN_NAME::getIconPixmap("slice_indicator_arrow")) , m_seeker(QPixmap(m_seekerWidth, m_seekerHeight)) , m_seekerWaveform(QPixmap(m_seekerWidth, m_seekerHeight)) - , m_editorWaveform(QPixmap(m_editorWidth, m_editorHeight)) + , m_editorWaveform(QPixmap(m_editorWidth, m_editorHeight - s_arrowHeight)) , m_sliceEditor(QPixmap(totalWidth, m_editorHeight)) , m_emptySampleIcon(embed::getIconPixmap("sample_track")) , m_slicerTParent(instrument) { - resize(m_width, m_height); setMouseTracking(true); - m_seekerWaveform.fill(s_waveformBgColor); - m_editorWaveform.fill(s_waveformBgColor); + m_seekerWaveform.fill(s_waveformSeekerBgColor); + m_editorWaveform.fill(s_waveformEditorBgColor); connect(instrument, &SlicerT::isPlaying, this, &SlicerTWaveform::isPlaying); connect(instrument, &SlicerT::dataChanged, this, &SlicerTWaveform::updateUI); @@ -83,24 +92,24 @@ SlicerTWaveform::SlicerTWaveform(int totalWidth, int totalHeight, SlicerT* instr updateUI(); } -void SlicerTWaveform::updateSize(int newWidth, int newHeight) +void SlicerTWaveform::resizeEvent(QResizeEvent* event) { - m_width = newWidth; - m_height = newHeight; + m_width = width(); + m_height = height(); m_seekerWidth = m_width - s_seekerHorMargin * 2; - m_seekerHeight = m_height * 0.33f; + /* m_seekerHeight = m_height * 0.33f; */ m_editorWidth = m_width; - m_editorHeight = m_height - m_seekerHeight - s_middleMargin; + m_editorHeight = m_height - m_seekerHeight - s_middleMargin - s_seekerVerMargin; m_seeker = QPixmap(m_seekerWidth, m_seekerHeight); m_seekerWaveform = QPixmap(m_seekerWidth, m_seekerHeight); - m_editorWaveform = QPixmap(m_editorWidth, m_editorHeight); + m_editorWaveform = QPixmap(m_editorWidth, m_editorHeight - s_arrowHeight); m_sliceEditor = QPixmap(m_width, m_editorHeight); updateUI(); } void SlicerTWaveform::drawSeekerWaveform() { - m_seekerWaveform.fill(s_waveformBgColor); + m_seekerWaveform.fill(s_emptyColor); if (m_slicerTParent->m_originalSample.sampleSize() <= 1) { return; } QPainter brush(&m_seekerWaveform); brush.setPen(s_waveformColor); @@ -119,7 +128,7 @@ void SlicerTWaveform::drawSeekerWaveform() void SlicerTWaveform::drawSeeker() { - m_seeker.fill(s_waveformBgColor); + m_seeker.fill(s_waveformSeekerBgColor); if (m_slicerTParent->m_originalSample.sampleSize() <= 1) { return; } QPainter brush(&m_seeker); brush.drawPixmap(0, 0, m_seekerWaveform); @@ -149,7 +158,7 @@ void SlicerTWaveform::drawSeeker() brush.fillRect(seekerEndPosX - 1, 0, m_seekerWidth, m_seekerHeight, s_seekerShadowColor); brush.setPen(QPen(s_seekerColor, 1)); - brush.drawRect(seekerStartPosX, 0, seekerMiddleWidth - 1, m_seekerHeight - 1); // -1 needed + brush.drawRoundedRect(seekerStartPosX, 0, seekerMiddleWidth - 1, m_seekerHeight - 1, 2, 2); } void SlicerTWaveform::drawEditorWaveform() @@ -178,7 +187,7 @@ void SlicerTWaveform::drawEditorWaveform() void SlicerTWaveform::drawEditor() { - m_sliceEditor.fill(s_waveformBgColor); + m_sliceEditor.fill(s_waveformEditorBgColor); QPainter brush(&m_sliceEditor); // No sample loaded @@ -204,13 +213,16 @@ void SlicerTWaveform::drawEditor() float noteLength = (m_noteEnd - m_noteStart) / (m_seekerEnd - m_seekerStart) * m_editorWidth; brush.setPen(s_playHighlightColor); - brush.drawLine(0, m_editorHeight / 2, m_editorWidth, m_editorHeight / 2); + int middleY = m_editorHeight / 2 + s_arrowHeight; + brush.drawLine(0, middleY, m_editorWidth, middleY); - brush.drawPixmap(0, 0, m_editorWaveform); + brush.drawPixmap(0, s_arrowHeight, m_editorWaveform); + + brush.fillRect(0, 0, m_editorWidth, s_arrowHeight, s_waveformSeekerBgColor); brush.setPen(s_playColor); - brush.drawLine(noteCurrentPos, 0, noteCurrentPos, m_editorHeight); - brush.fillRect(noteStartPos, 0, noteLength, m_editorHeight, s_playHighlightColor); + brush.drawLine(noteCurrentPos, s_arrowHeight, noteCurrentPos, m_editorHeight); + brush.fillRect(noteStartPos, s_arrowHeight, noteLength, m_editorHeight, s_playHighlightColor); brush.setPen(QPen(s_sliceColor, 2)); @@ -234,6 +246,11 @@ void SlicerTWaveform::drawEditor() brush.drawPixmap(xPos - m_sliceArrow.width() / 2.0f, 0, m_sliceArrow); } } + + // decor + brush.setPen(s_editorBounding); + brush.drawLine(0, s_arrowHeight, m_editorWidth, s_arrowHeight); + brush.drawLine(0, m_editorHeight - 1, m_editorWidth, m_editorHeight - 1); } void SlicerTWaveform::isPlaying(float current, float start, float end) @@ -413,7 +430,7 @@ void SlicerTWaveform::mouseMoveEvent(QMouseEvent* me) void SlicerTWaveform::mouseDoubleClickEvent(QMouseEvent* me) { - if (me->button() != Qt::MouseButton::LeftButton) { return; } + if (me->button() != Qt::MouseButton::LeftButton || me->y() < m_seekerHeight) { return; } float normalizedClickEditor = static_cast(me->x()) / m_editorWidth; float startFrame = m_seekerStart; @@ -435,8 +452,27 @@ void SlicerTWaveform::wheelEvent(QWheelEvent* we) void SlicerTWaveform::paintEvent(QPaintEvent* pe) { QPainter p(this); - p.drawPixmap(s_seekerHorMargin, 0, m_seeker); - p.drawPixmap(0, m_seekerHeight + s_middleMargin, m_sliceEditor); + + // top gradient + QLinearGradient bgGrad(QPointF(0, 0), QPointF(width(), height() - m_editorHeight)); + bgGrad.setColorAt(0, s_waveformEditorBgColor); + bgGrad.setColorAt(1, s_gradientEnd); + + p.setBrush(bgGrad); + p.setPen(s_emptyColor); + p.drawRect(QRect(0, 0, width(), height())); + p.setBrush(QBrush()); + + // seeker + QPainterPath path; + path.addRoundedRect( + QRect(s_seekerHorMargin - 2, s_seekerVerMargin - 2, m_seekerWidth + 4, m_seekerHeight + 4), 4, 4); + p.fillPath(path, s_seekerShadowColor); + p.drawPixmap(s_seekerHorMargin, s_seekerVerMargin, m_seeker); + + // editor + p.setPen(QColor(s_waveformColor)); + p.drawPixmap(0, m_seekerHeight + s_middleMargin + s_seekerVerMargin, m_sliceEditor); } } // namespace gui } // namespace lmms diff --git a/plugins/SlicerT/SlicerTWaveform.h b/plugins/SlicerT/SlicerTWaveform.h index 41f3ea21f94..d22e83f5eaa 100644 --- a/plugins/SlicerT/SlicerTWaveform.h +++ b/plugins/SlicerT/SlicerTWaveform.h @@ -49,11 +49,11 @@ public slots: public: SlicerTWaveform(int totalWidth, int totalHeight, SlicerT* instrument, QWidget* parent); - void updateSize(int newWidth, int newHeight); - // predefined sizes static constexpr int s_seekerHorMargin = 5; + static constexpr int s_seekerVerMargin = 6; static constexpr int s_middleMargin = 6; + static constexpr int s_arrowHeight = 5; // interaction behavior values static constexpr float s_distanceForClick = 0.02f; @@ -78,6 +78,7 @@ public slots: void wheelEvent(QWheelEvent* we) override; void paintEvent(QPaintEvent* pe) override; + void resizeEvent(QResizeEvent* event) override; private: int m_width; diff --git a/plugins/SlicerT/artwork.png b/plugins/SlicerT/artwork.png deleted file mode 100644 index e166273c705..00000000000 Binary files a/plugins/SlicerT/artwork.png and /dev/null differ diff --git a/plugins/SlicerT/folder_icon.png b/plugins/SlicerT/folder_icon.png new file mode 100644 index 00000000000..4dd60c8ff26 Binary files /dev/null and b/plugins/SlicerT/folder_icon.png differ diff --git a/plugins/SlicerT/full_logo.png b/plugins/SlicerT/full_logo.png new file mode 100644 index 00000000000..aa8c1d26a00 Binary files /dev/null and b/plugins/SlicerT/full_logo.png differ diff --git a/plugins/SlicerT/sync_active.png b/plugins/SlicerT/sync_active.png new file mode 100644 index 00000000000..9db13c7944e Binary files /dev/null and b/plugins/SlicerT/sync_active.png differ diff --git a/plugins/SlicerT/sync_inactive.png b/plugins/SlicerT/sync_inactive.png new file mode 100644 index 00000000000..573958de0a0 Binary files /dev/null and b/plugins/SlicerT/sync_inactive.png differ diff --git a/plugins/SlicerT/toolbox.png b/plugins/SlicerT/toolbox.png new file mode 100644 index 00000000000..2b7c2a14c48 Binary files /dev/null and b/plugins/SlicerT/toolbox.png differ diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 1f3c7202896..eca53fcae85 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -263,11 +263,6 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget->addTab(m_effectView, tr("Effects"), "fx_tab", 3); m_tabWidget->addTab(m_midiView, tr("MIDI"), "midi_tab", 4); m_tabWidget->addTab(m_tuningView, tr("Tuning and transposition"), "tuning_tab", 5); - /* adjustTabSize(m_instrumentFunctionsView); */ - /* adjustTabSize(m_ssView); */ - /* adjustTabSize(m_effectView); */ - /* adjustTabSize(m_midiView); */ - /* adjustTabSize(m_tuningView); */ // setup piano-widget m_pianoView = new PianoView( this ); @@ -290,8 +285,12 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QMdiSubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget( this ); Qt::WindowFlags flags = subWin->windowFlags(); - if (!m_instrumentView->m_isResizable) { + if (!m_instrumentView->isResizable()) { flags |= Qt::MSWindowsFixedSizeDialogHint; + // any better way than this? + } else { + subWin->setMaximumSize(m_instrumentView->maximumHeight() + 12, m_instrumentView->maximumWidth() + 208); + subWin->setMinimumSize( m_instrumentView->minimumWidth() + 12, m_instrumentView->minimumHeight() + 208); } flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); @@ -304,12 +303,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : systemMenu->actions().at( 4 )->setVisible( false ); // Maximize subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) ); - printf("init window with size: %i : %i\n", subWin->width(), subWin->height()); - subWin->setMinimumSize(262, 458); // not nedded if updateInstrumentView is at the end - subWin->setMaximumWidth(m_instrumentView->maximumHeight() + 12); // is there a better way than this? - subWin->setMaximumHeight(m_instrumentView->maximumWidth() + 208); subWin->hide(); - printf("finished window init\n"); } void InstrumentTrackWindow::resizeEvent(QResizeEvent * event) { @@ -477,11 +471,9 @@ void InstrumentTrackWindow::updateName() void InstrumentTrackWindow::updateInstrumentView() { delete m_instrumentView; - printf("updating instrument vier\n"); if( m_track->m_instrument != nullptr ) { m_instrumentView = m_track->m_instrument->createView( m_tabWidget ); - printf("instrument init size -> %i : %i\n", m_instrumentView->width(), m_instrumentView->height()); m_tabWidget->addTab( m_instrumentView, tr( "Plugin" ), "plugin_tab", 0 ); m_tabWidget->setActiveTab( 0 ); @@ -693,7 +685,7 @@ void InstrumentTrackWindow::viewInstrumentInDirection(int d) Q_ASSERT(bringToFront); bringToFront->getInstrumentTrackWindow()->setFocus(); Qt::WindowFlags flags = windowFlags(); - if (!m_instrumentView->m_isResizable) { + if (!m_instrumentView->isResizable()) { flags |= Qt::MSWindowsFixedSizeDialogHint; } else { flags &= ~Qt::MSWindowsFixedSizeDialogHint;