Skip to content

Commit

Permalink
Fix EffectRackView appearance (GUI). (#5766)
Browse files Browse the repository at this point in the history
* Fix EffectRackView appearance (GUI).

* Elide the name of the effect when it tends to be too big. (#5752)
* Evenly space the controls (W/D, Decay Gate). (#5750)
* Show the scrollbar in the default theme to close the gap. (#5752)
* Reduce the gap between the effect and the scrollbar. (#5757)
* Use always the same width for the EffectRackview (InstrumentTrack and SampleTrack) to avoid gaps or cutoffs of the background.
* Widen the background in the default theme.
* Widen the embossed space in the background in the classic theme to fit the controls.

* Changes for improving the EffectRackView after reviews.

* Reduce the background for the default theme by 1 pixel.
* Reduce the background for the classic theme by 2 pixels and remove the darker line at the bottom right.
* Reduce the width of long names of the plugin also by 2 pixels.
* Put the controls 2 pixels closer to each other.
  • Loading branch information
DigArtRoks authored Nov 7, 2020
1 parent e2bb606 commit a6e3958
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 13 deletions.
Binary file modified data/themes/classic/effect_plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/themes/default/effect_plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ QScrollBar::handle:horizontal:disabled, QScrollBar::handle:vertical:disabled {
border: none;
}

EffectRackView QScrollBar::handle:vertical:disabled {
background: #3f4750;
border: none;
border-radius: 4px;
}

/* arrow buttons */

QScrollBar::add-line, QScrollBar::sub-line {
Expand Down Expand Up @@ -349,6 +355,8 @@ QScrollBar::left-arrow:horizontal:disabled { background-image: url(resources:sba
QScrollBar::right-arrow:horizontal:disabled { background-image: url(resources:sbarrow_right_d.png);}
QScrollBar::up-arrow:vertical:disabled { background-image: url(resources:sbarrow_up_d.png);}
QScrollBar::down-arrow:vertical:disabled { background-image: url(resources:sbarrow_down_d.png);}
EffectRackView QScrollBar::up-arrow:vertical:disabled { background-image: url(resources:sbarrow_up.png);}
EffectRackView QScrollBar::down-arrow:vertical:disabled { background-image: url(resources:sbarrow_down.png);}

/* background for song editor and bb-editor */

Expand Down
1 change: 1 addition & 0 deletions include/EffectRackView.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class EffectRackView : public QWidget, public ModelView
EffectRackView( EffectChain* model, QWidget* parent = NULL );
virtual ~EffectRackView();

static constexpr int DEFAULT_WIDTH = 245;

public slots:
void clearViews();
Expand Down
1 change: 1 addition & 0 deletions include/EffectView.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class EffectView : public PluginView
return castModel<Effect>();
}

static constexpr int DEFAULT_WIDTH = 215;

public slots:
void editControls();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/FxMixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv,

// Create EffectRack for the channel
m_rackView = new EffectRackView( &fxChannel->m_fxChain, _mv->m_racksWidget );
m_rackView->setFixedSize( 245, FxLine::FxLineHeight );
m_rackView->setFixedSize( EffectRackView::DEFAULT_WIDTH, FxLine::FxLineHeight );
}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/EffectRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void EffectRackView::update()
}
}

w->setFixedSize( 210 + 2*EffectViewMargin, m_lastY );
w->setFixedSize( EffectView::DEFAULT_WIDTH + 2*EffectViewMargin, m_lastY);

QWidget::update();
}
Expand Down
16 changes: 9 additions & 7 deletions src/gui/widgets/EffectView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_subWindow( NULL ),
m_controlView( NULL )
{
setFixedSize( 210, 60 );
setFixedSize( EffectView::DEFAULT_WIDTH, 60 );

// Disable effects that are of type "DummyEffect"
bool isEnabled = !dynamic_cast<DummyEffect *>( effect() );
Expand All @@ -62,21 +62,21 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :

m_wetDry = new Knob( knobBright_26, this );
m_wetDry->setLabel( tr( "W/D" ) );
m_wetDry->move( 27, 5 );
m_wetDry->move( 40 - m_wetDry->width() / 2, 5 );
m_wetDry->setEnabled( isEnabled );
m_wetDry->setHintText( tr( "Wet Level:" ), "" );


m_autoQuit = new TempoSyncKnob( knobBright_26, this );
m_autoQuit->setLabel( tr( "DECAY" ) );
m_autoQuit->move( 60, 5 );
m_autoQuit->move( 78 - m_autoQuit->width() / 2, 5 );
m_autoQuit->setEnabled( isEnabled && !effect()->m_autoQuitDisabled );
m_autoQuit->setHintText( tr( "Time:" ), "ms" );


m_gate = new Knob( knobBright_26, this );
m_gate->setLabel( tr( "GATE" ) );
m_gate->move( 93, 5 );
m_gate->move( 116 - m_gate->width() / 2, 5 );
m_gate->setEnabled( isEnabled && !effect()->m_autoQuitDisabled );
m_gate->setHintText( tr( "Gate:" ), "" );

Expand All @@ -89,7 +89,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
this );
QFont f = ctls_btn->font();
ctls_btn->setFont( pointSize<8>( f ) );
ctls_btn->setGeometry( 140, 14, 50, 20 );
ctls_btn->setGeometry( 150, 14, 50, 20 );
connect( ctls_btn, SIGNAL( clicked() ),
this, SLOT( editControls() ) );

Expand Down Expand Up @@ -219,10 +219,12 @@ void EffectView::paintEvent( QPaintEvent * )
f.setBold( true );
p.setFont( f );

QString elidedText = p.fontMetrics().elidedText( model()->displayName(), Qt::ElideRight, width() - 22 );

p.setPen( palette().shadow().color() );
p.drawText( 6, 55, model()->displayName() );
p.drawText( 6, 55, elidedText );
p.setPen( palette().text().color() );
p.drawText( 5, 54, model()->displayName() );
p.drawText( 5, 54, elidedText );
}


Expand Down
4 changes: 1 addition & 3 deletions src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1508,9 +1508,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
m_tabWidget->addTab( m_miscView, tr( "Miscellaneous" ), "misc_tab", 5 );
adjustTabSize(m_ssView);
adjustTabSize(instrumentFunctions);
adjustTabSize(m_effectView);
// stupid bugfix, no one knows why
m_effectView->resize(INSTRUMENT_WIDTH - 4, INSTRUMENT_HEIGHT - 4 - 1);
m_effectView->resize(EffectRackView::DEFAULT_WIDTH, INSTRUMENT_HEIGHT - 4 - 1);
adjustTabSize(m_midiView);
adjustTabSize(m_miscView);

Expand Down
2 changes: 1 addition & 1 deletion src/tracks/SampleTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
generalSettingsLayout->addLayout(basicControlsLayout);

m_effectRack = new EffectRackView(tv->model()->audioPort()->effects());
m_effectRack->setFixedSize(240, 242);
m_effectRack->setFixedSize(EffectRackView::DEFAULT_WIDTH, 242);

vlayout->addWidget(generalSettingsWidget);
vlayout->addWidget(m_effectRack);
Expand Down

0 comments on commit a6e3958

Please sign in to comment.