Skip to content

Commit 17f6235

Browse files
DomClarkPhysSong
authored andcommitted
Add VST always-on-top config option
1 parent 295b899 commit 17f6235

3 files changed

Lines changed: 45 additions & 8 deletions

File tree

‎include/SetupDialog.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ private slots:
126126
void toggleDisplayWaveform( bool en );
127127
void toggleDisableAutoquit( bool en );
128128

129+
void vstEmbedMethodChanged();
130+
void toggleVSTAlwaysOnTop( bool en );
131+
129132
void setLanguage( int lang );
130133

131134

@@ -207,6 +210,8 @@ private slots:
207210

208211
QComboBox* m_vstEmbedComboBox;
209212
QString m_vstEmbedMethod;
213+
LedCheckBox * m_vstAlwaysOnTopCheckBox;
214+
bool m_vstAlwaysOnTop;
210215
} ;
211216

212217

‎plugins/vst_base/VstPlugin.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ bool VstPlugin::processMessage( const message & _m )
329329

330330
case IdVstPluginWindowID:
331331
m_pluginWindowID = _m.getInt();
332-
if( m_embedMethod == "none" )
332+
if( m_embedMethod == "none"
333+
&& ConfigManager::inst()->value(
334+
"ui", "vstalwaysontop" ).toInt() )
333335
{
334336
#ifdef LMMS_BUILD_WIN32
335337
// We're changing the owner, not the parent,

‎src/gui/SetupDialog.cpp‎

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
138138
"displaywaveform").toInt() ),
139139
m_disableAutoQuit(ConfigManager::inst()->value( "ui",
140140
"disableautoquit", "1" ).toInt() ),
141-
m_vstEmbedMethod( ConfigManager::inst()->vstEmbedMethod() )
141+
m_vstEmbedMethod( ConfigManager::inst()->vstEmbedMethod() ),
142+
m_vstAlwaysOnTop( ConfigManager::inst()->value( "ui",
143+
"vstalwaysontop" ).toInt() )
142144
{
143145
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
144146
setWindowTitle( tr( "Setup LMMS" ) );
@@ -346,7 +348,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
346348
}
347349

348350
TabWidget* embed_tw = new TabWidget( tr( "PLUGIN EMBEDDING" ), general);
349-
embed_tw->setFixedHeight( 48 );
351+
embed_tw->setFixedHeight( 66 );
350352
m_vstEmbedComboBox = new QComboBox( embed_tw );
351353
m_vstEmbedComboBox->move( XDelta, YDelta );
352354

@@ -365,6 +367,17 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
365367
m_vstEmbedComboBox->addItem( tr( "Embed using XEmbed protocol" ), "xembed" );
366368
}
367369
m_vstEmbedComboBox->setCurrentIndex( m_vstEmbedComboBox->findData( m_vstEmbedMethod ) );
370+
connect( m_vstEmbedComboBox, SIGNAL( currentIndexChanged( int ) ),
371+
this, SLOT( vstEmbedMethodChanged() ) );
372+
373+
m_vstAlwaysOnTopCheckBox = new LedCheckBox(
374+
tr( "Keep plugin windows on top when not embedded" ),
375+
embed_tw );
376+
m_vstAlwaysOnTopCheckBox->move( 20, 44 );
377+
m_vstAlwaysOnTopCheckBox->setChecked( m_vstAlwaysOnTop );
378+
m_vstAlwaysOnTopCheckBox->setVisible( m_vstEmbedMethod == "none" );
379+
connect( m_vstAlwaysOnTopCheckBox, SIGNAL( toggled( bool ) ),
380+
this, SLOT( toggleVSTAlwaysOnTop( bool ) ) );
368381

369382
TabWidget * lang_tw = new TabWidget( tr( "LANGUAGE" ), general );
370383
lang_tw->setFixedHeight( 48 );
@@ -1094,11 +1107,9 @@ void SetupDialog::accept()
10941107
QString::number( m_disableAutoQuit ) );
10951108
ConfigManager::inst()->setValue( "app", "language", m_lang );
10961109
ConfigManager::inst()->setValue( "ui", "vstembedmethod",
1097-
#if QT_VERSION >= 0x050000
1098-
m_vstEmbedComboBox->currentData().toString() );
1099-
#else
1100-
m_vstEmbedComboBox->itemData(m_vstEmbedComboBox->currentIndex()).toString() );
1101-
#endif
1110+
m_vstEmbedMethod );
1111+
ConfigManager::inst()->setValue( "ui", "vstalwaysontop",
1112+
QString::number( m_vstAlwaysOnTop ) );
11021113

11031114

11041115
ConfigManager::inst()->setWorkingDir(QDir::fromNativeSeparators(m_workingDir));
@@ -1316,6 +1327,25 @@ void SetupDialog::toggleOneInstrumentTrackWindow( bool _enabled )
13161327
m_oneInstrumentTrackWindow = _enabled;
13171328
}
13181329

1330+
1331+
void SetupDialog::vstEmbedMethodChanged()
1332+
{
1333+
#if QT_VERSION >= 0x050000
1334+
m_vstEmbedMethod = m_vstEmbedComboBox->currentData().toString();
1335+
#else
1336+
m_vstEmbedMethod = m_vstEmbedComboBox->itemData(
1337+
m_vstEmbedComboBox->currentIndex()).toString();
1338+
#endif
1339+
m_vstAlwaysOnTopCheckBox->setVisible( m_vstEmbedMethod == "none" );
1340+
}
1341+
1342+
1343+
void SetupDialog::toggleVSTAlwaysOnTop( bool en )
1344+
{
1345+
m_vstAlwaysOnTop = en;
1346+
}
1347+
1348+
13191349
void SetupDialog::setLanguage( int lang )
13201350
{
13211351
m_lang = m_languages[lang];

0 commit comments

Comments
 (0)