* removed volumeKnob-class and added volumeKnob-property to knob-class instead
* reduced header-dependencies and various cleanups * removed obsolete settings git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1158 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "automatable_model.h"
|
||||
#include "automation_pattern.h"
|
||||
#include "automation_editor.h"
|
||||
#include "controller_connection.h"
|
||||
|
||||
|
||||
float automatableModel::__copiedValue = 0;
|
||||
@@ -410,11 +411,28 @@ void automatableModel::unlinkModels( automatableModel * _model1,
|
||||
|
||||
|
||||
|
||||
|
||||
void automatableModel::initAutomationPattern( void )
|
||||
{
|
||||
m_automationPattern = new automationPattern( NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automatableModel::setControllerConnection( controllerConnection * _c )
|
||||
{
|
||||
m_controllerConnection = _c;
|
||||
if( _c )
|
||||
{
|
||||
m_automationPattern = new automationPattern( NULL, this );
|
||||
QObject::connect( m_controllerConnection,
|
||||
SIGNAL( valueChanged() ),
|
||||
this, SIGNAL( dataChanged() ) );
|
||||
emit dataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
automationPattern * automatableModel::getAutomationPattern( void )
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
#include "instrument_sound_shaping.h"
|
||||
#include "basic_filters.h"
|
||||
#include "embed.h"
|
||||
#include "engine.h"
|
||||
#include "envelope_and_lfo_parameters.h"
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QTranslator>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QBitmap>
|
||||
#include <QtGui/QDesktopWidget>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QSplashScreen>
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "config_mgr.h"
|
||||
#include "project_renderer.h"
|
||||
#include "song.h"
|
||||
#include "gui_templates.h"
|
||||
#include "lmms_style.h"
|
||||
|
||||
#warning TODO: move somewhere else
|
||||
@@ -351,7 +350,8 @@ int main( int argc, char * * argv )
|
||||
p.end();
|
||||
|
||||
QSplashScreen * ss = new QSplashScreen( pm );
|
||||
ss->setMask( splash.alphaChannel().createMaskFromColor( QColor( 0, 0, 0 ) ) );
|
||||
ss->setMask( splash.alphaChannel().createMaskFromColor(
|
||||
QColor( 0, 0, 0 ) ) );
|
||||
ss->show();
|
||||
qApp->processEvents();
|
||||
|
||||
@@ -368,19 +368,7 @@ int main( int argc, char * * argv )
|
||||
engine::getSong()->createNewProject();
|
||||
}
|
||||
|
||||
// MDI-mode?
|
||||
if( engine::getMainWindow()->workspace() != NULL )
|
||||
{
|
||||
// then maximize
|
||||
engine::getMainWindow()->showMaximized();
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise arrange at top-left edge of screen
|
||||
engine::getMainWindow()->show();
|
||||
engine::getMainWindow()->move( 0, 0 );
|
||||
engine::getMainWindow()->resize( 200, 500 );
|
||||
}
|
||||
engine::getMainWindow()->showMaximized();
|
||||
|
||||
delete ss;
|
||||
}
|
||||
@@ -392,10 +380,11 @@ int main( int argc, char * * argv )
|
||||
|
||||
// create renderer
|
||||
projectRenderer * r = new projectRenderer( qs, os, eff,
|
||||
render_out + QString( ( eff == projectRenderer::WaveFile ) ?
|
||||
"wav" : "ogg" ) );
|
||||
render_out +
|
||||
QString( ( eff == projectRenderer::WaveFile ) ?
|
||||
"wav" : "ogg" ) );
|
||||
QCoreApplication::instance()->connect( r, SIGNAL( finished() ),
|
||||
SLOT( quit() ) );
|
||||
SLOT( quit() ) );
|
||||
|
||||
// timer for progress-updates
|
||||
QTimer * t = new QTimer( r );
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include "note_play_handle.h"
|
||||
#include "basic_filters.h"
|
||||
#include "config_mgr.h"
|
||||
#include "detuning_helper.h"
|
||||
#include "instrument_sound_shaping.h"
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
|
||||
#include "automation_pattern.h"
|
||||
#include "caption_menu.h"
|
||||
#include "embed.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
QPixmap * surroundArea::s_backgroundArtwork = NULL;
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ void surroundArea::mouseReleaseEvent( QMouseEvent * )
|
||||
model()->addJournalEntryFromOldToCurVal();
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,21 +24,16 @@
|
||||
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMdiArea>
|
||||
|
||||
#include "bb_editor.h"
|
||||
#include "bb_track_container.h"
|
||||
#include "bb_track.h"
|
||||
#include "combobox.h"
|
||||
#include "embed.h"
|
||||
#include "engine.h"
|
||||
#include "main_window.h"
|
||||
#include "name_label.h"
|
||||
#include "song.h"
|
||||
#include "templates.h"
|
||||
#include "tool_button.h"
|
||||
#include "tooltip.h"
|
||||
|
||||
|
||||
|
||||
@@ -109,27 +104,12 @@ bbEditor::bbEditor( bbTrackContainer * _tc ) :
|
||||
tb_layout->addWidget( l );
|
||||
tb_layout->addSpacing( 15 );
|
||||
|
||||
if( engine::getMainWindow()->workspace() != NULL )
|
||||
{
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
parentWidget()->layout()->setSizeConstraint(
|
||||
QLayout::SetMinimumSize );
|
||||
}
|
||||
|
||||
QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this;
|
||||
if( engine::getMainWindow()->workspace() != NULL )
|
||||
{
|
||||
w->resize( minimumWidth(), 300 );
|
||||
w->move( 10, 340 );
|
||||
}
|
||||
else
|
||||
{
|
||||
resize( minimumWidth(), 300 );
|
||||
w->move( 210, 340 );
|
||||
}
|
||||
|
||||
w->show();
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
parentWidget()->layout()->setSizeConstraint( QLayout::SetMinimumSize );
|
||||
parentWidget()->resize( minimumWidth(), 300 );
|
||||
parentWidget()->move( 10, 340 );
|
||||
parentWidget()->show();
|
||||
|
||||
|
||||
setModel( _tc );
|
||||
|
||||
@@ -61,12 +61,6 @@ public:
|
||||
{
|
||||
QPainter p( this );
|
||||
p.fillRect( rect(), QColor( 72, 76, 88 ) );
|
||||
/* p.setPen( QColor( 144, 152, 176 ) );
|
||||
p.drawLine( 0, 0, width()-1, 0 );
|
||||
p.drawLine( 0, 0, 0, height()-1 );
|
||||
p.setPen( QColor( 36, 38, 44 ) );
|
||||
p.drawLine( 0, height()-1, width()-1, height()-1 );
|
||||
p.drawLine( width()-1, 0, width()-1, height()-1 );*/
|
||||
p.setPen( QColor( 40, 42, 48 ) );
|
||||
p.drawRect( 0, 0, width()-2, height()-2 );
|
||||
p.setPen( QColor( 108, 114, 132 ) );
|
||||
@@ -222,6 +216,7 @@ fxMixerView::fxMixerView() :
|
||||
// add ourself to workspace
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
parentWidget()->move( 10, 200 );
|
||||
|
||||
// we want to receive dataChanged-signals in order to update
|
||||
setModel( m );
|
||||
|
||||
@@ -71,9 +71,6 @@ mainWindow::mainWindow( void ) :
|
||||
{
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
|
||||
bool no_mdi = configManager::inst()->value( "app", "gimplikewindows"
|
||||
).toInt();
|
||||
|
||||
QWidget * main_widget = new QWidget( this );
|
||||
QVBoxLayout * vbox = new QVBoxLayout( main_widget );
|
||||
vbox->setSpacing( 0 );
|
||||
@@ -131,15 +128,10 @@ mainWindow::mainWindow( void ) :
|
||||
embed::getIconPixmap( "root" ),
|
||||
splitter ), ++id );
|
||||
|
||||
if( no_mdi == FALSE )
|
||||
{
|
||||
m_workspace = new QMdiArea( splitter );
|
||||
m_workspace->setBackground( Qt::NoBrush );
|
||||
m_workspace->setHorizontalScrollBarPolicy(
|
||||
Qt::ScrollBarAsNeeded );
|
||||
m_workspace->setVerticalScrollBarPolicy(
|
||||
Qt::ScrollBarAsNeeded );
|
||||
}
|
||||
m_workspace = new QMdiArea( splitter );
|
||||
m_workspace->setBackground( Qt::NoBrush );
|
||||
m_workspace->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
|
||||
m_workspace->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
|
||||
|
||||
hbox->addWidget( side_bar );
|
||||
hbox->addWidget( splitter );
|
||||
@@ -733,31 +725,16 @@ void mainWindow::help( void )
|
||||
|
||||
void mainWindow::toggleWindow( QWidget * _w )
|
||||
{
|
||||
if( m_workspace )
|
||||
if( m_workspace->activeSubWindow() != _w->parentWidget()
|
||||
|| _w->parentWidget()->isHidden() )
|
||||
{
|
||||
if( m_workspace->activeSubWindow() != _w->parentWidget()
|
||||
|| _w->parentWidget()->isHidden() )
|
||||
{
|
||||
_w->parentWidget()->show();
|
||||
_w->show();
|
||||
_w->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
_w->parentWidget()->hide();
|
||||
}
|
||||
_w->parentWidget()->show();
|
||||
_w->show();
|
||||
_w->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( _w->isHidden() )
|
||||
{
|
||||
_w->show();
|
||||
_w->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
_w->hide();
|
||||
}
|
||||
_w->parentWidget()->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -926,10 +903,7 @@ void mainWindow::showTool( QAction * _idx )
|
||||
{
|
||||
pluginView * p = m_tools[m_toolsMenu->actions().indexOf( _idx )];
|
||||
p->show();
|
||||
if( m_workspace )
|
||||
{
|
||||
p->parentWidget()->show();
|
||||
}
|
||||
p->parentWidget()->show();
|
||||
p->setFocus();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,11 +89,6 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
"framesperaudiobuffer" ).toInt() ),
|
||||
m_toolTips( !configManager::inst()->value( "tooltips",
|
||||
"disabled" ).toInt() ),
|
||||
m_classicalKnobUsability( configManager::inst()->value( "knobs",
|
||||
"classicalusability" ).toInt() ),
|
||||
m_MDI( !configManager::inst()->value( "app",
|
||||
"gimplikewindows" ).toInt() ),
|
||||
m_wizard( !configManager::inst()->value( "app", "nowizard" ).toInt() ),
|
||||
m_warnAfterSetup( !configManager::inst()->value( "app",
|
||||
"nomsgaftersetup" ).toInt() ),
|
||||
m_displaydBV( configManager::inst()->value( "app",
|
||||
@@ -178,7 +173,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
|
||||
|
||||
tabWidget * misc_tw = new tabWidget( tr( "MISC" ), general );
|
||||
misc_tw->setFixedHeight( 164 );
|
||||
misc_tw->setFixedHeight( 120 );
|
||||
|
||||
ledCheckBox * enable_tooltips = new ledCheckBox(
|
||||
tr( "Enable tooltips" ),
|
||||
@@ -189,38 +184,10 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
this, SLOT( toggleToolTips( bool ) ) );
|
||||
|
||||
|
||||
ledCheckBox * classical_knob_usability = new ledCheckBox(
|
||||
tr( "Classical knob usability (move "
|
||||
"cursor around knob to change "
|
||||
"value)" ), misc_tw );
|
||||
classical_knob_usability->move( 10, 36 );
|
||||
classical_knob_usability->setChecked( m_classicalKnobUsability );
|
||||
connect( classical_knob_usability, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleKnobUsability( bool ) ) );
|
||||
|
||||
|
||||
ledCheckBox * mdi_windows = new ledCheckBox(
|
||||
tr( "Multiple Document Interface" ),
|
||||
misc_tw );
|
||||
mdi_windows->move( 10, 54 );
|
||||
mdi_windows->setChecked( m_MDI );
|
||||
connect( mdi_windows, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleMdiWindows( bool ) ) );
|
||||
|
||||
|
||||
ledCheckBox * wizard = new ledCheckBox(
|
||||
tr( "Show wizard after up-/downgrade" ),
|
||||
misc_tw );
|
||||
wizard->move( 10, 72 );
|
||||
wizard->setChecked( m_wizard );
|
||||
connect( wizard, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleWizard( bool ) ) );
|
||||
|
||||
|
||||
ledCheckBox * restart_msg = new ledCheckBox(
|
||||
tr( "Show restart warning after changing settings" ),
|
||||
misc_tw );
|
||||
restart_msg->move( 10, 90 );
|
||||
restart_msg->move( 10, 36 );
|
||||
restart_msg->setChecked( m_warnAfterSetup );
|
||||
connect( restart_msg, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleWarnAfterSetup( bool ) ) );
|
||||
@@ -228,7 +195,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
|
||||
ledCheckBox * dbv = new ledCheckBox( tr( "Display volume as dBV " ),
|
||||
misc_tw );
|
||||
dbv->move( 10, 108 );
|
||||
dbv->move( 10, 54 );
|
||||
dbv->setChecked( m_displaydBV );
|
||||
connect( dbv, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleDisplaydBV( bool ) ) );
|
||||
@@ -237,7 +204,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
ledCheckBox * mmpz = new ledCheckBox(
|
||||
tr( "Compress project files per default" ),
|
||||
misc_tw );
|
||||
mmpz->move( 10, 126 );
|
||||
mmpz->move( 10, 72 );
|
||||
mmpz->setChecked( m_MMPZ );
|
||||
connect( mmpz, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleMMPZ( bool ) ) );
|
||||
@@ -245,7 +212,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
ledCheckBox * hqaudio = new ledCheckBox(
|
||||
tr( "HQ-mode for output audio-device" ),
|
||||
misc_tw );
|
||||
hqaudio->move( 10, 144 );
|
||||
hqaudio->move( 10, 90 );
|
||||
hqaudio->setChecked( m_hqAudioDev );
|
||||
connect( hqaudio, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleHQAudioDev( bool ) ) );
|
||||
@@ -436,13 +403,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
|
||||
|
||||
|
||||
tabWidget * smp_supp_tw = new tabWidget( tr( "SMP support" ).toUpper(),
|
||||
performance );
|
||||
smp_supp_tw->setFixedHeight( 200 );
|
||||
|
||||
perf_layout->addWidget( ui_fx_tw );
|
||||
perf_layout->addSpacing( 15 );
|
||||
perf_layout->addWidget( smp_supp_tw );
|
||||
perf_layout->addStretch();
|
||||
|
||||
|
||||
@@ -683,12 +644,6 @@ void setupDialog::accept( void )
|
||||
m_midiIfaceNames[m_midiInterfaces->currentText()] );
|
||||
configManager::inst()->setValue( "tooltips", "disabled",
|
||||
QString::number( !m_toolTips ) );
|
||||
configManager::inst()->setValue( "knobs", "classicalusability",
|
||||
QString::number( m_classicalKnobUsability ) );
|
||||
configManager::inst()->setValue( "app", "gimplikewindows",
|
||||
QString::number( !m_MDI ) );
|
||||
configManager::inst()->setValue( "app", "nowizard",
|
||||
QString::number( !m_wizard ) );
|
||||
configManager::inst()->setValue( "app", "nomsgaftersetup",
|
||||
QString::number( !m_warnAfterSetup ) );
|
||||
configManager::inst()->setValue( "app", "displaydbv",
|
||||
@@ -805,30 +760,6 @@ void setupDialog::toggleToolTips( bool _enabled )
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleKnobUsability( bool _classical )
|
||||
{
|
||||
m_classicalKnobUsability = _classical;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleMdiWindows( bool _enabled )
|
||||
{
|
||||
m_MDI = _enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleWizard( bool _enabled )
|
||||
{
|
||||
m_wizard = _enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleWarnAfterSetup( bool _enabled )
|
||||
{
|
||||
m_warnAfterSetup = _enabled;
|
||||
|
||||
@@ -25,44 +25,23 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QScrollBar>
|
||||
#include <QtGui/QStatusBar>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "song_editor.h"
|
||||
#include "automatable_slider.h"
|
||||
#include "bb_editor.h"
|
||||
#include "bb_track.h"
|
||||
#include "combobox.h"
|
||||
#include "config_mgr.h"
|
||||
#include "cpuload_widget.h"
|
||||
#include "embed.h"
|
||||
#include "envelope_and_lfo_parameters.h"
|
||||
#include "import_filter.h"
|
||||
#include "instrument_track.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "combobox.h"
|
||||
#include "main_window.h"
|
||||
#include "meter_dialog.h"
|
||||
#include "midi_client.h"
|
||||
#include "mmp.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "pattern.h"
|
||||
#include "piano_roll.h"
|
||||
#include "project_journal.h"
|
||||
#include "project_notes.h"
|
||||
#include "rename_dialog.h"
|
||||
#include "templates.h"
|
||||
#include "text_float.h"
|
||||
#include "timeline.h"
|
||||
#include "tool_button.h"
|
||||
@@ -351,25 +330,11 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
this, SLOT( scrolled( int ) ) );
|
||||
|
||||
|
||||
if( engine::getMainWindow()->workspace() != NULL )
|
||||
{
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
}
|
||||
|
||||
QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this;
|
||||
if( engine::getMainWindow()->workspace() != NULL )
|
||||
{
|
||||
w->resize( 680, 300 );
|
||||
w->move( 10, 10 );
|
||||
}
|
||||
else
|
||||
{
|
||||
resize( 580, 300 );
|
||||
w->move( 210, 10 );
|
||||
}
|
||||
|
||||
w->show();
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
parentWidget()->resize( 680, 300 );
|
||||
parentWidget()->move( 10, 10 );
|
||||
parentWidget()->show();
|
||||
|
||||
m_updateTimer.start( 1000 / 20, this ); // 20 fps
|
||||
}
|
||||
|
||||
@@ -71,16 +71,13 @@ controllerRackView::controllerRackView( ) :
|
||||
|
||||
setModel( engine::getSong() );
|
||||
|
||||
if( engine::getMainWindow()->workspace() != NULL )
|
||||
{
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
}
|
||||
|
||||
engine::getMainWindow()->workspace()->addSubWindow( this );
|
||||
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
controllerRackView::~controllerRackView()
|
||||
{
|
||||
clear();
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
/*
|
||||
* knob.cpp - powerful knob-widget
|
||||
*
|
||||
* This file is partly based on the knob-widget of the Qwt Widget Library by
|
||||
* Josef Wilgen.
|
||||
*
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
@@ -63,13 +60,14 @@ textFloat * knob::s_textFloat = NULL;
|
||||
knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
floatModelView( new knobModel( 0, 0, 0, 1, NULL, _name, TRUE ) ),
|
||||
m_knobNum( _knob_num ),
|
||||
m_label( "" ),
|
||||
m_knobPixmap( NULL ),
|
||||
m_volumeKnob( FALSE ),
|
||||
m_mouseOffset( 0.0f ),
|
||||
m_buttonPressed( FALSE ),
|
||||
m_knobPixmap( NULL ),
|
||||
m_outerColor( NULL ),
|
||||
m_angle( -10 ),
|
||||
m_knobNum( _knob_num ),
|
||||
m_label( "" )
|
||||
m_outerColor( NULL )
|
||||
{
|
||||
if( s_textFloat == NULL )
|
||||
{
|
||||
@@ -373,40 +371,6 @@ void knob::drawKnob( QPainter * _p )
|
||||
|
||||
float knob::getValue( const QPoint & _p )
|
||||
{
|
||||
if( configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
const float dx = float( ( rect().x() + rect().width() / 2 ) -
|
||||
_p.x() );
|
||||
const float dy = float( ( rect().y() + rect().height() / 2 ) -
|
||||
_p.y() );
|
||||
|
||||
const float arc = atan2( -dx, dy ) * 180.0 / M_PI;
|
||||
|
||||
float new_value = 0.5 * ( model()->minValue() +
|
||||
model()->maxValue() ) +
|
||||
arc * ( model()->maxValue() -
|
||||
model()->minValue() ) /
|
||||
m_totalAngle;
|
||||
|
||||
const float oneTurn = tAbs<float>( model()->maxValue() -
|
||||
model()->minValue() ) *
|
||||
360.0 / m_totalAngle;
|
||||
const float eqValue = model()->value() + m_mouseOffset;
|
||||
|
||||
if( tAbs<float>( new_value - eqValue ) > 0.5 * oneTurn )
|
||||
{
|
||||
if( new_value < eqValue )
|
||||
{
|
||||
new_value += oneTurn;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_value -= oneTurn;
|
||||
}
|
||||
}
|
||||
return( new_value );
|
||||
}
|
||||
if( engine::getMainWindow()->isShiftPressed() )
|
||||
{
|
||||
return( ( _p.y() - m_origMousePos.y() ) * model()->step<float>() );
|
||||
@@ -476,23 +440,10 @@ void knob::mousePressEvent( QMouseEvent * _me )
|
||||
const QPoint & p = _me->pos();
|
||||
m_origMousePos = p;
|
||||
|
||||
if( configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
m_mouseOffset = getValue( p ) - model()->value();
|
||||
}
|
||||
emit sliderPressed();
|
||||
|
||||
if( !configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::BlankCursor );
|
||||
}
|
||||
// s_textFloat->reparent( this );
|
||||
s_textFloat->setText( m_description +
|
||||
QString::number(
|
||||
model()->value() ) +
|
||||
m_unit );
|
||||
QApplication::setOverrideCursor( Qt::BlankCursor );
|
||||
s_textFloat->setText( displayValue() );
|
||||
s_textFloat->moveGlobal( this,
|
||||
QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->show();
|
||||
@@ -531,17 +482,10 @@ void knob::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
setPosition( _me->pos() );
|
||||
emit sliderMoved( model()->value() );
|
||||
// emit valueChanged();
|
||||
if( !configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
QCursor::setPos( mapToGlobal( m_origMousePos ) );
|
||||
}
|
||||
QCursor::setPos( mapToGlobal( m_origMousePos ) );
|
||||
}
|
||||
|
||||
s_textFloat->setText( m_description +
|
||||
QString::number( model()->value() ) +
|
||||
m_unit );
|
||||
s_textFloat->setText( displayValue() );
|
||||
}
|
||||
|
||||
|
||||
@@ -554,17 +498,12 @@ void knob::mouseReleaseEvent( QMouseEvent * /* _me*/ )
|
||||
if( m_buttonPressed )
|
||||
{
|
||||
m_buttonPressed = TRUE;
|
||||
buttonReleased();
|
||||
}
|
||||
|
||||
m_mouseOffset = 0;
|
||||
emit sliderReleased();
|
||||
|
||||
if( !configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
s_textFloat->hide();
|
||||
}
|
||||
@@ -609,23 +548,11 @@ void knob::wheelEvent( QWheelEvent * _we )
|
||||
model()->incValue( inc );
|
||||
|
||||
|
||||
s_textFloat->setText( m_description +
|
||||
QString::number( model()->value() ) +
|
||||
m_unit );
|
||||
s_textFloat->setText( displayValue() );
|
||||
s_textFloat->moveGlobal( this, QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->setVisibilityTimeOut( 1000 );
|
||||
|
||||
emit sliderMoved( model()->value() );
|
||||
// emit valueChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::buttonReleased( void )
|
||||
{
|
||||
// emit valueChanged( model()->value() );
|
||||
// emit valueChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -633,71 +560,47 @@ void knob::buttonReleased( void )
|
||||
|
||||
void knob::setPosition( const QPoint & _p )
|
||||
{
|
||||
if( configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
model()->setValue( getValue( _p ) - m_mouseOffset );
|
||||
}
|
||||
else
|
||||
{
|
||||
model()->setValue( model()->value() - getValue( _p ) );
|
||||
}
|
||||
model()->setValue( model()->value() - getValue( _p ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*void knob::reset( void )
|
||||
{
|
||||
model()->setValue( model()->initValue() );
|
||||
s_textFloat->setText( m_description +
|
||||
QString::number( model()->value() ) +
|
||||
m_unit );
|
||||
s_textFloat->moveGlobal( this, QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->setVisibilityTimeOut( 1000 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::copyValue( void )
|
||||
{
|
||||
s_copiedValue = model()->value();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::pasteValue( void )
|
||||
{
|
||||
model()->setValue( s_copiedValue );
|
||||
s_textFloat->setText( m_description +
|
||||
QString::number( model()->value() ) +
|
||||
m_unit );
|
||||
s_textFloat->moveGlobal( this, QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->setVisibilityTimeOut( 1000 );
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::enterValue( void )
|
||||
{
|
||||
bool ok;
|
||||
float new_val = QInputDialog::getDouble(
|
||||
this,
|
||||
accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
float new_val;
|
||||
if( isVolumeKnob() &&
|
||||
configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
new_val = QInputDialog::getDouble(
|
||||
this, accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
"-96.0 dBV and 6.0 dBV:" ),
|
||||
20.0 * log10( model()->value() / 100.0 ),
|
||||
-96.0, 6.0, 4, &ok );
|
||||
if( new_val <= -96.0 )
|
||||
{
|
||||
new_val = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_val = pow( 10.0, ( new_val / 20.0 ) ) * 100.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_val = QInputDialog::getDouble(
|
||||
this, accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
"%1 and %2:" ).
|
||||
arg( model()->minValue() ).
|
||||
arg( model()->maxValue() ),
|
||||
model()->value(),
|
||||
model()->minValue(),
|
||||
model()->maxValue(),
|
||||
4, &ok );
|
||||
model()->maxValue(), 4, &ok );
|
||||
}
|
||||
|
||||
if( ok )
|
||||
{
|
||||
model()->setValue( new_val );
|
||||
@@ -719,6 +622,22 @@ void knob::friendlyUpdate( void )
|
||||
|
||||
|
||||
|
||||
QString knob::displayValue( void ) const
|
||||
{
|
||||
if( isVolumeKnob() &&
|
||||
configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
return( m_description + QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( model()->value() / 100.0 ),
|
||||
3, 'f', 2 ) );
|
||||
}
|
||||
return( m_description + QString( " %1%" ).arg(
|
||||
model()->value(), 3, 'f', 0 ) + m_unit );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::doConnections( void )
|
||||
{
|
||||
if( model() != NULL )
|
||||
|
||||
@@ -120,7 +120,7 @@ void tempoSyncKnobModel::calculateTempoSyncTime( bpm_t _bpm )
|
||||
setValue( 60000.0 / ( _bpm * conversionFactor * m_scale ) );
|
||||
setJournalling( journalling );
|
||||
}
|
||||
|
||||
|
||||
if( m_tempoSyncMode != m_tempoLastSyncMode )
|
||||
{
|
||||
emit syncModeChanged( m_tempoSyncMode );
|
||||
@@ -225,7 +225,6 @@ tempoSyncKnob::~tempoSyncKnob()
|
||||
{
|
||||
if( m_custom )
|
||||
{
|
||||
// m_custom->deleteLater();
|
||||
delete m_custom->parentWidget();
|
||||
}
|
||||
}
|
||||
@@ -242,6 +241,8 @@ void tempoSyncKnob::modelChanged( void )
|
||||
m_custom->setModel( &model()->m_custom );
|
||||
connect( model(), SIGNAL( syncModeChanged( tempoSyncMode ) ),
|
||||
this, SLOT( updateDescAndIcon() ) );
|
||||
connect( this, SIGNAL( sliderMoved( float ) ),
|
||||
model(), SLOT( disableSync() ) );
|
||||
updateDescAndIcon();
|
||||
}
|
||||
|
||||
@@ -327,24 +328,6 @@ void tempoSyncKnob::contextMenuEvent( QContextMenuEvent * )
|
||||
|
||||
|
||||
|
||||
void tempoSyncKnob::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
knob::mouseMoveEvent( _me );
|
||||
model()->setSyncMode( tempoSyncKnobModel::SyncNone );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void tempoSyncKnob::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
knob::wheelEvent( _we );
|
||||
model()->setSyncMode( tempoSyncKnobModel::SyncNone );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void tempoSyncKnob::updateDescAndIcon( void )
|
||||
{
|
||||
if( model()->m_tempoSyncMode )
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* volume_knob.cpp - defines a knob that display it's value as either a
|
||||
* percentage or in dBV.
|
||||
*
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QMouseEvent>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "volume_knob.h"
|
||||
#include "main_window.h"
|
||||
#include "config_mgr.h"
|
||||
#include "engine.h"
|
||||
#include "text_float.h"
|
||||
#include "string_pair_drag.h"
|
||||
|
||||
|
||||
|
||||
volumeKnob::volumeKnob( int _knob_num, QWidget * _parent,
|
||||
const QString & _name ) :
|
||||
knob( _knob_num, _parent, _name )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
volumeKnob::~volumeKnob()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//! Mouse press event handler
|
||||
void volumeKnob::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
engine::getMainWindow()->isCtrlPressed() == FALSE )
|
||||
{
|
||||
model()->prepareJournalEntryFromOldVal();
|
||||
|
||||
const QPoint & p = _me->pos();
|
||||
m_origMousePos = p;
|
||||
|
||||
if( configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
m_mouseOffset = getValue( p ) - model()->value();
|
||||
}
|
||||
emit sliderPressed();
|
||||
|
||||
if( !configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::BlankCursor );
|
||||
}
|
||||
|
||||
QString val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
val = QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( model()->value() / 100.0 ),
|
||||
3, 'f', 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
val = QString( " %1%" ).arg( model()->value(), 3, 'f', 0 );
|
||||
}
|
||||
s_textFloat->setText( m_description + val );
|
||||
|
||||
s_textFloat->moveGlobal( this,
|
||||
QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->show();
|
||||
m_buttonPressed = TRUE;
|
||||
}
|
||||
else if( _me->button() == Qt::LeftButton &&
|
||||
engine::getMainWindow()->isCtrlPressed() == TRUE )
|
||||
{
|
||||
new stringPairDrag( "float_value", QString::number( model()->value() ),
|
||||
QPixmap(), this );
|
||||
}
|
||||
else if( _me->button() == Qt::MidButton )
|
||||
{
|
||||
model()->reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void volumeKnob::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
// TODO: merge code with knob::mouseMoveEvent
|
||||
if( m_buttonPressed == TRUE )
|
||||
{
|
||||
setPosition( _me->pos() );
|
||||
emit sliderMoved( model()->value() );
|
||||
// emit valueChanged();
|
||||
if( !configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
QCursor::setPos( mapToGlobal( m_origMousePos ) );
|
||||
}
|
||||
}
|
||||
|
||||
QString val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
val = QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( model()->value() / 100.0 ),
|
||||
3, 'f', 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
val = QString( " %1%" ).arg( model()->value(), 3, 'f', 0 );
|
||||
}
|
||||
s_textFloat->setText( m_description + val );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void volumeKnob::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
// TODO: merge code with knob::mouseMoveEvent
|
||||
_we->accept();
|
||||
const int inc = ( _we->delta() > 0 ) ? 1 : -1;
|
||||
model()->incValue( inc );
|
||||
|
||||
|
||||
QString val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
val = QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( model()->value() / 100.0 ),
|
||||
3, 'f', 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
val = QString( " %1%" ).arg( model()->value(), 3, 'f', 0 );
|
||||
}
|
||||
s_textFloat->setText( m_description + val );
|
||||
|
||||
s_textFloat->moveGlobal( this, QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->setVisibilityTimeOut( 1000 );
|
||||
|
||||
emit sliderMoved( model()->value() );
|
||||
// emit valueChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void volumeKnob::enterValue( void )
|
||||
{
|
||||
bool ok;
|
||||
float new_val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
new_val = QInputDialog::getDouble(
|
||||
this, accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
"-96.0 dBV and 6.0 dBV:" ),
|
||||
20.0 * log10( model()->value() / 100.0 ),
|
||||
-96.0, 6.0, 4, &ok );
|
||||
if( new_val <= -96.0 )
|
||||
{
|
||||
new_val = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_val = pow( 10.0, ( new_val / 20.0 ) ) * 100.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_val = QInputDialog::getDouble(
|
||||
this, accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
"%1 and %2:" ).
|
||||
arg( model()->minValue() ).
|
||||
arg( model()->maxValue() ),
|
||||
model()->value(),
|
||||
model()->minValue(),
|
||||
model()->maxValue(), 4, &ok );
|
||||
}
|
||||
|
||||
if( ok )
|
||||
{
|
||||
model()->setValue( new_val );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "volume_knob.moc"
|
||||
|
||||
#endif
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
#include "audio_port.h"
|
||||
#include "automation_pattern.h"
|
||||
#include "bb_track.h"
|
||||
#include "config_mgr.h"
|
||||
#include "debug.h"
|
||||
#include "effect_chain.h"
|
||||
@@ -75,7 +76,6 @@
|
||||
#include "surround_area.h"
|
||||
#include "tab_widget.h"
|
||||
#include "tooltip.h"
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
|
||||
@@ -847,8 +847,8 @@ instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
|
||||
setFixedHeight( 32 );
|
||||
|
||||
// creation of widgets for track-settings-widget
|
||||
m_tswVolumeKnob = new volumeKnob( knobSmall_17,
|
||||
getTrackSettingsWidget() );
|
||||
m_tswVolumeKnob = new knob( knobSmall_17, getTrackSettingsWidget() );
|
||||
m_tswVolumeKnob->setVolumeKnob( TRUE );
|
||||
m_tswVolumeKnob->setModel( &_it->m_volumeModel );
|
||||
m_tswVolumeKnob->setHintText( tr( "Volume:" ) + " ", "%" );
|
||||
m_tswVolumeKnob->move( 4, 4 );
|
||||
@@ -1112,8 +1112,9 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
|
||||
|
||||
|
||||
// setup volume-knob
|
||||
m_volumeKnob = new volumeKnob( knobBright_26, m_generalSettingsWidget,
|
||||
m_volumeKnob = new knob( knobBright_26, m_generalSettingsWidget,
|
||||
tr( "Instrument volume" ) );
|
||||
m_volumeKnob->setVolumeKnob( TRUE );
|
||||
m_volumeKnob->move( 10, 44 );
|
||||
m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" );
|
||||
m_volumeKnob->setLabel( tr( "VOL" ) );
|
||||
|
||||
Reference in New Issue
Block a user