Skip to content

Commit

Permalink
Add VST always-on-top config option
Browse files Browse the repository at this point in the history
  • Loading branch information
DomClark authored and PhysSong committed Mar 14, 2019
1 parent 295b899 commit 17f6235
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
5 changes: 5 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ private slots:
void toggleDisplayWaveform( bool en );
void toggleDisableAutoquit( bool en );

void vstEmbedMethodChanged();
void toggleVSTAlwaysOnTop( bool en );

void setLanguage( int lang );


Expand Down Expand Up @@ -207,6 +210,8 @@ private slots:

QComboBox* m_vstEmbedComboBox;
QString m_vstEmbedMethod;
LedCheckBox * m_vstAlwaysOnTopCheckBox;
bool m_vstAlwaysOnTop;
} ;


Expand Down
4 changes: 3 additions & 1 deletion plugins/vst_base/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ bool VstPlugin::processMessage( const message & _m )

case IdVstPluginWindowID:
m_pluginWindowID = _m.getInt();
if( m_embedMethod == "none" )
if( m_embedMethod == "none"
&& ConfigManager::inst()->value(
"ui", "vstalwaysontop" ).toInt() )
{
#ifdef LMMS_BUILD_WIN32
// We're changing the owner, not the parent,
Expand Down
44 changes: 37 additions & 7 deletions src/gui/SetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
"displaywaveform").toInt() ),
m_disableAutoQuit(ConfigManager::inst()->value( "ui",
"disableautoquit", "1" ).toInt() ),
m_vstEmbedMethod( ConfigManager::inst()->vstEmbedMethod() )
m_vstEmbedMethod( ConfigManager::inst()->vstEmbedMethod() ),
m_vstAlwaysOnTop( ConfigManager::inst()->value( "ui",
"vstalwaysontop" ).toInt() )
{
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
setWindowTitle( tr( "Setup LMMS" ) );
Expand Down Expand Up @@ -346,7 +348,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
}

TabWidget* embed_tw = new TabWidget( tr( "PLUGIN EMBEDDING" ), general);
embed_tw->setFixedHeight( 48 );
embed_tw->setFixedHeight( 66 );
m_vstEmbedComboBox = new QComboBox( embed_tw );
m_vstEmbedComboBox->move( XDelta, YDelta );

Expand All @@ -365,6 +367,17 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
m_vstEmbedComboBox->addItem( tr( "Embed using XEmbed protocol" ), "xembed" );
}
m_vstEmbedComboBox->setCurrentIndex( m_vstEmbedComboBox->findData( m_vstEmbedMethod ) );
connect( m_vstEmbedComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( vstEmbedMethodChanged() ) );

m_vstAlwaysOnTopCheckBox = new LedCheckBox(
tr( "Keep plugin windows on top when not embedded" ),
embed_tw );
m_vstAlwaysOnTopCheckBox->move( 20, 44 );
m_vstAlwaysOnTopCheckBox->setChecked( m_vstAlwaysOnTop );
m_vstAlwaysOnTopCheckBox->setVisible( m_vstEmbedMethod == "none" );
connect( m_vstAlwaysOnTopCheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( toggleVSTAlwaysOnTop( bool ) ) );

TabWidget * lang_tw = new TabWidget( tr( "LANGUAGE" ), general );
lang_tw->setFixedHeight( 48 );
Expand Down Expand Up @@ -1094,11 +1107,9 @@ void SetupDialog::accept()
QString::number( m_disableAutoQuit ) );
ConfigManager::inst()->setValue( "app", "language", m_lang );
ConfigManager::inst()->setValue( "ui", "vstembedmethod",
#if QT_VERSION >= 0x050000
m_vstEmbedComboBox->currentData().toString() );
#else
m_vstEmbedComboBox->itemData(m_vstEmbedComboBox->currentIndex()).toString() );
#endif
m_vstEmbedMethod );
ConfigManager::inst()->setValue( "ui", "vstalwaysontop",
QString::number( m_vstAlwaysOnTop ) );


ConfigManager::inst()->setWorkingDir(QDir::fromNativeSeparators(m_workingDir));
Expand Down Expand Up @@ -1316,6 +1327,25 @@ void SetupDialog::toggleOneInstrumentTrackWindow( bool _enabled )
m_oneInstrumentTrackWindow = _enabled;
}


void SetupDialog::vstEmbedMethodChanged()
{
#if QT_VERSION >= 0x050000
m_vstEmbedMethod = m_vstEmbedComboBox->currentData().toString();
#else
m_vstEmbedMethod = m_vstEmbedComboBox->itemData(
m_vstEmbedComboBox->currentIndex()).toString();
#endif
m_vstAlwaysOnTopCheckBox->setVisible( m_vstEmbedMethod == "none" );
}


void SetupDialog::toggleVSTAlwaysOnTop( bool en )
{
m_vstAlwaysOnTop = en;
}


void SetupDialog::setLanguage( int lang )
{
m_lang = m_languages[lang];
Expand Down

0 comments on commit 17f6235

Please sign in to comment.