added undo/redo-system and other features

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@104 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-03-14 13:30:28 +00:00
parent a6d0f95bb4
commit fe9d017e02
63 changed files with 2402 additions and 2476 deletions

View File

@@ -459,7 +459,7 @@ audioALSA::setupWidget::setupWidget( QWidget * _parent ) :
dev_lbl->setGeometry( 10, 40, 160, 10 );
m_channels = new lcdSpinBox( DEFAULT_CHANNELS, SURROUND_CHANNELS, 1,
this );
this, NULL );
m_channels->setStep( 2 );
m_channels->setLabel( tr( "CHANNELS" ) );
m_channels->setValue( configManager::inst()->value( "audioalsa",

View File

@@ -450,7 +450,7 @@ audioJACK::setupWidget::setupWidget( QWidget * _parent ) :
cn_lbl->setGeometry( 10, 40, 160, 10 );
m_channels = new lcdSpinBox( DEFAULT_CHANNELS, SURROUND_CHANNELS, 1,
this );
this, NULL );
m_channels->setStep( 2 );
m_channels->setLabel( tr( "CHANNELS" ) );
m_channels->setValue( configManager::inst()->value( "audiojack",

View File

@@ -354,7 +354,7 @@ audioOSS::setupWidget::setupWidget( QWidget * _parent ) :
dev_lbl->setGeometry( 10, 40, 160, 10 );
m_channels = new lcdSpinBox( DEFAULT_CHANNELS, SURROUND_CHANNELS, 1,
this );
this, NULL );
m_channels->setStep( 2 );
m_channels->setLabel( tr( "CHANNELS" ) );
m_channels->setValue( configManager::inst()->value( "audiooss",

View File

@@ -31,12 +31,10 @@
#ifdef QT4
#include <Qt/QtXml>
#include <QButtonGroup>
#include <QLabel>
#else
#include <qbuttongroup.h>
#include <qdom.h>
#include <qlabel.h>
#include <qwhatsthis.h>
@@ -199,15 +197,14 @@ const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y;
arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
QWidget( _channel_track->tabWidgetParent() ),
settings(),
engineObject( _channel_track->eng() ),
m_arpDirection( UP )
engineObject( _channel_track->eng() )
{
m_chordsGroupBox = new groupBox( tr( "CHORDS" ), this );
m_chordsGroupBox = new groupBox( tr( "CHORDS" ), this, eng() );
m_chordsGroupBox->setGeometry( CHORDS_GROUPBOX_X, CHORDS_GROUPBOX_Y,
CHORDS_GROUPBOX_WIDTH,
CHORDS_GROUPBOX_HEIGHT );
m_chordsComboBox = new comboBox( m_chordsGroupBox );
m_chordsComboBox = new comboBox( m_chordsGroupBox, eng() );
m_chordsComboBox->setFont( pointSize<8>( m_chordsComboBox->font() ) );
m_chordsComboBox->setGeometry( 10, 25, 140, 22 );
@@ -240,7 +237,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
m_arpGroupBox = new groupBox( tr( "ARPEGGIO" ), this );
m_arpGroupBox = new groupBox( tr( "ARPEGGIO" ), this, eng() );
m_arpGroupBox->setGeometry( ARP_GROUPBOX_X, ARP_GROUPBOX_Y,
ARP_GROUPBOX_WIDTH,
ARP_GROUPBOX_HEIGHT );
@@ -258,7 +255,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
"not played at the same time. Typical arpeggios are "
"major or minor triads. But there're a lot of other "
"possible chords, you can select." ) );
m_arpComboBox = new comboBox( m_arpGroupBox );
m_arpComboBox = new comboBox( m_arpGroupBox, eng() );
m_arpComboBox->setFont( pointSize<8>( m_arpComboBox->font() ) );
m_arpComboBox->setGeometry( 10, 25, 140, 22 );
@@ -329,72 +326,67 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
m_arpUpBtn = new pixmapButton( m_arpGroupBox );
m_arpUpBtn->move( 10, 74 );
m_arpUpBtn->setActiveGraphic( embed::getIconPixmap( "arp_up_on" ) );
m_arpUpBtn->setInactiveGraphic( embed::getIconPixmap( "arp_up_off" ) );
m_arpUpBtn->setChecked( TRUE );
pixmapButton * arp_up_btn = new pixmapButton( m_arpGroupBox, eng() );
arp_up_btn->move( 10, 74 );
arp_up_btn->setActiveGraphic( embed::getIconPixmap( "arp_up_on" ) );
arp_up_btn->setInactiveGraphic( embed::getIconPixmap( "arp_up_off" ) );
#ifdef QT3
m_arpUpBtn->setBackgroundMode( Qt::PaletteBackground );
arp_up_btn->setBackgroundMode( Qt::PaletteBackground );
#endif
toolTip::add( m_arpUpBtn, tr( "arpeggio direction = up" ) );
connect( m_arpUpBtn, SIGNAL( toggled( bool ) ), this,
SLOT( arpUpToggled( bool ) ) );
toolTip::add( arp_up_btn, tr( "arpeggio direction = up" ) );
m_arpDownBtn = new pixmapButton( m_arpGroupBox );
m_arpDownBtn->move( 30, 74 );
m_arpDownBtn->setActiveGraphic( embed::getIconPixmap( "arp_down_on" ) );
m_arpDownBtn->setInactiveGraphic( embed::getIconPixmap(
pixmapButton * arp_down_btn = new pixmapButton( m_arpGroupBox, eng() );
arp_down_btn->move( 30, 74 );
arp_down_btn->setActiveGraphic( embed::getIconPixmap( "arp_down_on" ) );
arp_down_btn->setInactiveGraphic( embed::getIconPixmap(
"arp_down_off" ) );
#ifdef QT3
m_arpDownBtn->setBackgroundMode( Qt::PaletteBackground );
arp_down_btn->setBackgroundMode( Qt::PaletteBackground );
#endif
toolTip::add( m_arpDownBtn, tr( "arpeggio direction = down" ) );
connect( m_arpDownBtn, SIGNAL( toggled( bool ) ), this,
SLOT( arpDownToggled( bool ) ) );
toolTip::add( arp_down_btn, tr( "arpeggio direction = down" ) );
m_arpUpAndDownBtn = new pixmapButton( m_arpGroupBox );
m_arpUpAndDownBtn->move( 50, 74 );
m_arpUpAndDownBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * arp_up_and_down_btn = new pixmapButton( m_arpGroupBox,
eng() );
arp_up_and_down_btn->move( 50, 74 );
arp_up_and_down_btn->setActiveGraphic( embed::getIconPixmap(
"arp_up_and_down_on" ) );
m_arpUpAndDownBtn->setInactiveGraphic( embed::getIconPixmap(
arp_up_and_down_btn->setInactiveGraphic( embed::getIconPixmap(
"arp_up_and_down_off" ) );
#ifdef QT3
m_arpUpAndDownBtn->setBackgroundMode( Qt::PaletteBackground );
arp_up_and_down_btn->setBackgroundMode( Qt::PaletteBackground );
#endif
toolTip::add( m_arpUpAndDownBtn,
toolTip::add( arp_up_and_down_btn,
tr( "arpeggio direction = up and down" ) );
connect( m_arpUpAndDownBtn, SIGNAL( toggled( bool ) ), this,
SLOT( arpUpAndDownToggled( bool ) ) );
m_arpRandomBtn = new pixmapButton( m_arpGroupBox );
m_arpRandomBtn->move( 70, 74 );
m_arpRandomBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * arp_random_btn = new pixmapButton( m_arpGroupBox,
eng() );
arp_random_btn->move( 70, 74 );
arp_random_btn->setActiveGraphic( embed::getIconPixmap(
"arp_random_on" ) );
m_arpRandomBtn->setInactiveGraphic( embed::getIconPixmap(
arp_random_btn->setInactiveGraphic( embed::getIconPixmap(
"arp_random_off" ) );
#ifdef QT3
m_arpRandomBtn->setBackgroundMode( Qt::PaletteBackground );
arp_random_btn->setBackgroundMode( Qt::PaletteBackground );
#endif
toolTip::add( m_arpRandomBtn, tr( "arpeggio direction = random" ) );
connect( m_arpRandomBtn, SIGNAL( toggled( bool ) ), this,
SLOT( arpRandomToggled( bool ) ) );
toolTip::add( arp_random_btn, tr( "arpeggio direction = random" ) );
m_arpDirectionBtnGrp = new automatableButtonGroup( this, eng() );
m_arpDirectionBtnGrp->addButton( arp_up_btn );
m_arpDirectionBtnGrp->addButton( arp_down_btn );
m_arpDirectionBtnGrp->addButton( arp_up_and_down_btn );
m_arpDirectionBtnGrp->addButton( arp_random_btn );
m_arpDirectionBtnGrp->setInitValue( UP - 1 );
QButtonGroup * m_arpDirections_group = new QButtonGroup( this );
m_arpDirections_group->addButton( m_arpUpBtn );
m_arpDirections_group->addButton( m_arpDownBtn );
m_arpDirections_group->addButton( m_arpUpAndDownBtn );
m_arpDirections_group->addButton( m_arpRandomBtn );
m_arpDirections_group->setExclusive( TRUE );
#ifdef QT3
m_arpDirections_group->hide();
#endif
QLabel * mode_lbl = new QLabel( tr( "Mode:" ), m_arpGroupBox );
mode_lbl->setGeometry( 10, 104, 64, 10 );
mode_lbl->setFont( pointSize<7>( mode_lbl->font() ) );
m_arpModeComboBox = new comboBox( m_arpGroupBox );
m_arpModeComboBox = new comboBox( m_arpGroupBox, eng() );
m_arpModeComboBox->setFont( pointSize<8>( m_arpModeComboBox->font() ) );
m_arpModeComboBox->setGeometry( 10, 118, 128, 22 );
@@ -404,7 +396,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
embed::getIconPixmap( "arp_sort" ) );
m_arpModeComboBox->addItem( tr( "Sync" ),
embed::getIconPixmap( "arp_sync" ) );
m_arpModeComboBox->setCurrentIndex( 0 );
//m_arpModeComboBox->setValue( 0 );
}
@@ -431,7 +423,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
m_chordsGroupBox->isActive() == TRUE )
{
// then insert sub-notes for chord
const int selected_chord = m_chordsComboBox->currentIndex();
const int selected_chord = m_chordsComboBox->value();
for( int octave_cnt = 0;
octave_cnt < m_chordRangeKnob->value(); ++octave_cnt )
@@ -480,7 +472,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// now follows code for arpeggio
if( _n->baseNote() == FALSE || m_arpDirection == OFF ||
if( _n->baseNote() == FALSE || m_arpDirectionBtnGrp->value() == OFF ||
!m_arpGroupBox->isActive() ||
( _n->released() && _n->releaseFramesDone() >=
_n->actualReleaseFramesToDo() ) )
@@ -489,11 +481,11 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
}
const int selected_arp = m_arpComboBox->currentIndex();
const int selected_arp = m_arpComboBox->value();
constNotePlayHandleVector cnphv = notePlayHandle::nphsOfChannelTrack(
_n->getChannelTrack() );
if( m_arpModeComboBox->currentIndex() != FREE && cnphv.size() == 0 )
if( m_arpModeComboBox->value() != FREE && cnphv.size() == 0 )
{
// maybe we're playing only a preset-preview-note?
cnphv = presetPreviewPlayHandle::nphsOfChannelTrack(
@@ -519,7 +511,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// used for calculating remaining frames for arp-note, we have to add
// arp_frames-1, otherwise the first arp-note will not be setup
// correctly... -> arp_frames frames silence at the start of every note!
int cur_frame = ( ( m_arpModeComboBox->currentIndex() != FREE ) ?
int cur_frame = ( ( m_arpModeComboBox->value() != FREE ) ?
cnphv.first()->totalFramesPlayed() :
_n->totalFramesPlayed() )
+ arp_frames - 1;
@@ -543,7 +535,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// init with zero
int cur_arp_idx = 0;
if( m_arpModeComboBox->currentIndex() == SORT &&
if( m_arpModeComboBox->value() == SORT &&
( ( cur_frame / arp_frames ) % total_range ) /
range != (Uint32) _n->index() )
{
@@ -553,17 +545,19 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
continue;
}
arpDirections dir = static_cast<arpDirections>(
m_arpDirectionBtnGrp->value() + 1 );
// process according to arpeggio-direction...
if( m_arpDirection == UP )
if( dir == UP )
{
cur_arp_idx = ( cur_frame / arp_frames ) % range;
}
else if( m_arpDirection == DOWN )
else if( dir == DOWN )
{
cur_arp_idx = range - ( cur_frame / arp_frames ) %
range - 1;
}
else if( m_arpDirection == UP_AND_DOWN && range > 1 )
else if( dir == UP_AND_DOWN && range > 1 )
{
// imagine, we had to play the arp once up and then
// once down -> makes 2 * range possible notes...
@@ -579,7 +573,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
( range - 1 ) - 1;
}
}
else if( m_arpDirection == RANDOM )
else if( dir == RANDOM )
{
// just pick a random chord-index
cur_arp_idx = (int)( range * ( (float) rand() /
@@ -619,7 +613,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// and is_arp_note=TRUE
notePlayHandle * note_play_handle = new notePlayHandle(
_n->getChannelTrack(),
( ( m_arpModeComboBox->currentIndex() !=
( ( m_arpModeComboBox->value() !=
FREE ) ?
cnphv.first()->framesAhead() :
_n->framesAhead() ) +
@@ -639,7 +633,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// make sure, note is handled as arp-base-note, even if we didn't add a
// sub-note so far
if( m_arpModeComboBox->currentIndex() != FREE )
if( m_arpModeComboBox->value() != FREE )
{
_n->setArpNote( TRUE );
}
@@ -653,19 +647,19 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
{
QDomElement act_de = _doc.createElement( nodeName() );
act_de.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
act_de.setAttribute( "chord", m_chordsComboBox->currentIndex() );
act_de.setAttribute( "chord", m_chordsComboBox->value() );
act_de.setAttribute( "chordrange", m_chordRangeKnob->value() );
act_de.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
act_de.setAttribute( "arp", m_arpComboBox->currentIndex() );
act_de.setAttribute( "arp", m_arpComboBox->value() );
act_de.setAttribute( "arprange", m_arpRangeKnob->value() );
act_de.setAttribute( "arptime", m_arpTimeKnob->value() );
act_de.setAttribute( "arpgate", m_arpGateKnob->value() );
act_de.setAttribute( "arpdir", m_arpDirection );
act_de.setAttribute( "arpdir", m_arpDirectionBtnGrp->value() );
act_de.setAttribute( "arpsyncmode",
( int ) m_arpTimeKnob->getSyncMode() );
act_de.setAttribute( "arpmode", m_arpModeComboBox->currentIndex() );
act_de.setAttribute( "arpmode", m_arpModeComboBox->value() );
_parent.appendChild( act_de );
}
@@ -676,91 +670,27 @@ void arpAndChordsTabWidget::loadSettings( const QDomElement & _this )
{
m_chordsGroupBox->setState( !_this.attribute
( "chorddisabled" ).toInt() );
m_chordsComboBox->setCurrentIndex( _this.attribute( "chord" ).toInt() );
m_chordsComboBox->setValue( _this.attribute( "chord" ).toInt() );
m_chordRangeKnob->setValue( _this.attribute( "chordrange" ).toFloat() );
m_arpComboBox->setCurrentIndex( _this.attribute( "arp" ).toInt() );
m_arpComboBox->setValue( _this.attribute( "arp" ).toInt() );
m_arpRangeKnob->setValue( _this.attribute( "arprange" ).toFloat() );
m_arpTimeKnob->setValue( _this.attribute( "arptime" ).toFloat() );
m_arpGateKnob->setValue( _this.attribute( "arpgate" ).toFloat() );
m_arpDirection = static_cast<arpDirections>(
m_arpDirectionBtnGrp->setInitValue(
_this.attribute( "arpdir" ).toInt() );
m_arpTimeKnob->setSyncMode(
( tempoSyncKnob::tempoSyncMode ) _this.attribute(
"arpsyncmode" ).toInt() );
m_arpModeComboBox->setCurrentIndex( _this.attribute( "arpmode"
).toInt() );
m_arpModeComboBox->setValue( _this.attribute( "arpmode" ).toInt() );
m_arpGroupBox->setState( m_arpDirection != OFF &&
m_arpGroupBox->setState( m_arpDirectionBtnGrp->value() != OFF &&
!_this.attribute( "arpdisabled" ).toInt() );
switch( m_arpDirection )
{
case DOWN:
m_arpDownBtn->setChecked( TRUE );
break;
case UP_AND_DOWN:
m_arpUpAndDownBtn->setChecked( TRUE );
break;
case RANDOM:
m_arpRandomBtn->setChecked( TRUE );
break;
case UP:
default:
m_arpUpBtn->setChecked( TRUE );
m_arpDirection = UP;
break;
}
}
void arpAndChordsTabWidget::arpUpToggled( bool _on )
{
if( _on )
{
m_arpDirection = UP;
}
eng()->getSongEditor()->setModified();
}
void arpAndChordsTabWidget::arpDownToggled( bool _on )
{
if( _on )
{
m_arpDirection = DOWN;
}
eng()->getSongEditor()->setModified();
}
void arpAndChordsTabWidget::arpUpAndDownToggled( bool _on )
{
if( _on )
{
m_arpDirection = UP_AND_DOWN;
}
eng()->getSongEditor()->setModified();
}
void arpAndChordsTabWidget::arpRandomToggled( bool _on )
{
if( _on )
{
m_arpDirection = RANDOM;
}
eng()->getSongEditor()->setModified();
}
#include "arp_and_chords_tab_widget.moc"

View File

@@ -129,9 +129,9 @@ bbEditor::bbEditor( engine * _engine ) :
QLabel * l = new QLabel( m_toolBar );
l->setPixmap( embed::getIconPixmap( "drum" ) );
m_bbComboBox = new comboBox( m_toolBar );
m_bbComboBox = new comboBox( m_toolBar, eng() );
m_bbComboBox->setFixedSize( 200, 22 );
connect( m_bbComboBox, SIGNAL( currentIndexChanged( int ) ),
connect( m_bbComboBox, SIGNAL( valueChanged( int ) ),
this, SLOT( setCurrentBB( int ) ) );
tb_layout->addSpacing( 5 );
@@ -166,9 +166,9 @@ csize bbEditor::currentBB( void ) const
void bbEditor::setCurrentBB( int _bb )
{
if( m_bbComboBox->currentIndex() != _bb )
if( m_bbComboBox->value() != _bb )
{
m_bbComboBox->setCurrentIndex( _bb );
m_bbComboBox->setValue( _bb );
}
// first make sure, all channels have a TCO at current BB
@@ -295,7 +295,7 @@ void bbEditor::updateComboBox( void )
m_bbComboBox->addItem( bbt->trackLabel()->text(),
bbt->trackLabel()->pixmap() );
}
m_bbComboBox->setCurrentIndex( currentBB() );
m_bbComboBox->setValue( currentBB() );
}

View File

@@ -62,6 +62,7 @@
#include <qapplication.h>
#define absolutePath absPath
#define addButton insert
#ifndef __USE_XOPEN_EXTENDED
#define __USE_XOPEN_EXTENDED
@@ -955,6 +956,7 @@ void configManager::processFilesRecursively( const QString & _src_dir,
#include "config_mgr.moc"
#undef absolutePath
#undef addButton
#endif

View File

@@ -26,6 +26,7 @@
#include "bb_editor.h"
#include "edit_history.h"
#include "engine.h"
#include "main_window.h"
#include "mixer.h"
@@ -41,8 +42,10 @@ engine::engine( const bool _has_gui ) :
m_mainWindow( NULL ),
m_songEditor( NULL ),
m_bbEditor( NULL ),
m_pianoRoll( NULL )
m_pianoRoll( NULL ),
m_editHistory( NULL )
{
m_editHistory = new editHistory( this );
m_mainWindow = new mainWindow( this );
m_mixer = new mixer( this );
m_songEditor = new songEditor( this );
@@ -63,6 +66,7 @@ engine::engine( const bool _has_gui ) :
engine::~engine()
{
m_mixer->stopProcessing();
delete m_projectNotes;
delete m_songEditor;
delete m_bbEditor;

View File

@@ -32,14 +32,12 @@
#include <QPainter>
#include <QPaintEvent>
#include <QButtonGroup>
#include <QWhatsThis>
#include <Qt/QtXml>
#include <QLabel>
#else
#include <qbuttongroup.h>
#include <qwhatsthis.h>
#include <qpainter.h>
#include <qpen.h>
@@ -353,101 +351,90 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount,
SLOT( updateAfterKnobChange( float ) ) );
m_sinLfoBtn = new pixmapButton( this );
m_sinLfoBtn->move( LFO_SHAPES_X, LFO_SHAPES_Y );
m_sinLfoBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * sin_lfo_btn = new pixmapButton( this, eng() );
sin_lfo_btn->move( LFO_SHAPES_X, LFO_SHAPES_Y );
sin_lfo_btn->setActiveGraphic( embed::getIconPixmap(
"sin_wave_active" ) );
m_sinLfoBtn->setInactiveGraphic( embed::getIconPixmap(
sin_lfo_btn->setInactiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
m_sinLfoBtn->setChecked( TRUE );
#ifdef QT4
m_sinLfoBtn->setWhatsThis(
sin_lfo_btn->setWhatsThis(
#else
QWhatsThis::add( m_sinLfoBtn,
QWhatsThis::add( sin_lfo_btn,
#endif
tr( "Click here if you want a sine-wave for current "
"oscillator." ) );
m_triangleLfoBtn = new pixmapButton( this );
m_triangleLfoBtn->move( LFO_SHAPES_X+15, LFO_SHAPES_Y );
m_triangleLfoBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * triangle_lfo_btn = new pixmapButton( this, eng() );
triangle_lfo_btn->move( LFO_SHAPES_X+15, LFO_SHAPES_Y );
triangle_lfo_btn->setActiveGraphic( embed::getIconPixmap(
"triangle_wave_active" ) );
m_triangleLfoBtn->setInactiveGraphic( embed::getIconPixmap(
triangle_lfo_btn->setInactiveGraphic( embed::getIconPixmap(
"triangle_wave_inactive" ) );
#ifdef QT4
m_triangleLfoBtn->setWhatsThis(
triangle_lfo_btn->setWhatsThis(
#else
QWhatsThis::add( m_triangleLfoBtn,
QWhatsThis::add( triangle_lfo_btn,
#endif
tr( "Click here if you want a triangle-wave for current "
"oscillator." ) );
m_sawLfoBtn = new pixmapButton( this );
m_sawLfoBtn->move( LFO_SHAPES_X+30, LFO_SHAPES_Y );
m_sawLfoBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * saw_lfo_btn = new pixmapButton( this, eng() );
saw_lfo_btn->move( LFO_SHAPES_X+30, LFO_SHAPES_Y );
saw_lfo_btn->setActiveGraphic( embed::getIconPixmap(
"saw_wave_active" ) );
m_sawLfoBtn->setInactiveGraphic( embed::getIconPixmap(
saw_lfo_btn->setInactiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
#ifdef QT4
m_sawLfoBtn->setWhatsThis(
saw_lfo_btn->setWhatsThis(
#else
QWhatsThis::add( m_sawLfoBtn,
QWhatsThis::add( saw_lfo_btn,
#endif
tr( "Click here if you want a saw-wave for current "
"oscillator." ) );
m_sqrLfoBtn = new pixmapButton( this );
m_sqrLfoBtn->move( LFO_SHAPES_X+45, LFO_SHAPES_Y );
m_sqrLfoBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * sqr_lfo_btn = new pixmapButton( this, eng() );
sqr_lfo_btn->move( LFO_SHAPES_X+45, LFO_SHAPES_Y );
sqr_lfo_btn->setActiveGraphic( embed::getIconPixmap(
"square_wave_active" ) );
m_sqrLfoBtn->setInactiveGraphic( embed::getIconPixmap(
sqr_lfo_btn->setInactiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
#ifdef QT4
m_sqrLfoBtn->setWhatsThis(
sqr_lfo_btn->setWhatsThis(
#else
QWhatsThis::add( m_sqrLfoBtn,
QWhatsThis::add( sqr_lfo_btn,
#endif
tr( "Click here if you want a square-wave for current "
"oscillator." ) );
m_usrLfoBtn = new pixmapButton( this );
m_usrLfoBtn->move( LFO_SHAPES_X+60, LFO_SHAPES_Y );
m_usrLfoBtn->setActiveGraphic( embed::getIconPixmap(
m_userLfoBtn = new pixmapButton( this, eng() );
m_userLfoBtn->move( LFO_SHAPES_X+60, LFO_SHAPES_Y );
m_userLfoBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
m_usrLfoBtn->setInactiveGraphic( embed::getIconPixmap(
m_userLfoBtn->setInactiveGraphic( embed::getIconPixmap(
"usr_wave_inactive" ) );
#ifdef QT4
m_usrLfoBtn->setWhatsThis(
m_userLfoBtn->setWhatsThis(
#else
QWhatsThis::add( m_usrLfoBtn,
QWhatsThis::add( m_userLfoBtn,
#endif
tr( "Click here if you want a user-defined wave for current "
"oscillator. Afterwards drag an according sample-"
"file into LFO-graph." ) );
connect( m_sinLfoBtn, SIGNAL( toggled( bool ) ), this,
SLOT( lfoSinWaveCh( bool ) ) );
connect( m_triangleLfoBtn, SIGNAL( toggled( bool ) ), this,
SLOT( lfoTriangleWaveCh( bool ) ) );
connect( m_sawLfoBtn, SIGNAL( toggled( bool ) ), this,
SLOT( lfoSawWaveCh( bool ) ) );
connect( m_sqrLfoBtn, SIGNAL( toggled( bool ) ), this,
SLOT( lfoSquareWaveCh( bool ) ) );
connect( m_usrLfoBtn, SIGNAL( toggled( bool ) ), this,
connect( m_userLfoBtn, SIGNAL( toggled( bool ) ), this,
SLOT( lfoUserWaveCh( bool ) ) );
QButtonGroup * lfo_shapes_algo_group = new QButtonGroup( this );
lfo_shapes_algo_group->addButton( m_sinLfoBtn );
lfo_shapes_algo_group->addButton( m_triangleLfoBtn );
lfo_shapes_algo_group->addButton( m_sawLfoBtn );
lfo_shapes_algo_group->addButton( m_sqrLfoBtn );
lfo_shapes_algo_group->addButton( m_usrLfoBtn );
lfo_shapes_algo_group->setExclusive( TRUE );
#ifndef QT4
lfo_shapes_algo_group->hide();
#endif
m_lfoWaveBtnGrp = new automatableButtonGroup( this, eng() );
m_lfoWaveBtnGrp->addButton( sin_lfo_btn );
m_lfoWaveBtnGrp->addButton( triangle_lfo_btn );
m_lfoWaveBtnGrp->addButton( saw_lfo_btn );
m_lfoWaveBtnGrp->addButton( sqr_lfo_btn );
m_lfoWaveBtnGrp->addButton( m_userLfoBtn );
m_lfoWaveBtnGrp->setInitValue( SIN );
m_x100Cb = new ledCheckBox( tr( "FREQ x 100" ), this );
m_x100Cb = new ledCheckBox( tr( "FREQ x 100" ), this, eng() );
m_x100Cb->setFont( pointSize<6>( m_x100Cb->font() ) );
m_x100Cb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 36 );
#ifdef QT4
@@ -463,7 +450,7 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount,
m_controlEnvAmountCb = new ledCheckBox( tr( "MODULATE ENV-AMOUNT" ),
this );
this, eng() );
m_controlEnvAmountCb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 54 );
m_controlEnvAmountCb->setFont( pointSize<6>(
m_controlEnvAmountCb->font() ) );
@@ -649,8 +636,11 @@ void envelopeAndLFOWidget::loadSettings( const QDomElement & _this )
m_sustainKnob->setValue( _this.attribute( "sus" ).toFloat() );
m_releaseKnob->setValue( _this.attribute( "rel" ).toFloat() );
m_amountKnob->setValue( _this.attribute( "amt" ).toFloat() );
m_lfoShape = static_cast<lfoShapes>( _this.attribute(
"lshp" ).toInt() );
m_lfoWaveBtnGrp->setValue( m_lfoShape );
m_lfoPredelayKnob->setValue( _this.attribute( "lpdel" ).toFloat() );
m_lfoAttackKnob->setValue( _this.attribute( "latt" ).toFloat() );
m_lfoSpeedKnob->setValue( _this.attribute( "lspd" ).toFloat() );
@@ -663,29 +653,6 @@ void envelopeAndLFOWidget::loadSettings( const QDomElement & _this )
"lfosyncmode" ).toInt() );
m_userWave.setAudioFile( _this.attribute( "userwavefile" ) );
switch( m_lfoShape )
{
case SIN:
m_sinLfoBtn->setChecked( TRUE );
break;
case TRIANGLE:
m_triangleLfoBtn->setChecked( TRUE );
break;
case SAW:
m_sawLfoBtn->setChecked( TRUE );
break;
case SQUARE:
m_sqrLfoBtn->setChecked( TRUE );
break;
case USER:
m_usrLfoBtn->setChecked( TRUE );
break;
}
m_busy = FALSE;
updateSampleVars();
@@ -750,7 +717,7 @@ void envelopeAndLFOWidget::dropEvent( QDropEvent * _de )
if( type == "samplefile" )
{
m_userWave.setAudioFile( stringPairDrag::decodeValue( _de ) );
m_usrLfoBtn->setChecked( TRUE );
m_userLfoBtn->setChecked( TRUE );
lfoUserWaveCh( TRUE );
_de->accept();
}
@@ -759,7 +726,7 @@ void envelopeAndLFOWidget::dropEvent( QDropEvent * _de )
multimediaProject mmp( value, FALSE );
m_userWave.setAudioFile( mmp.content().firstChild().toElement().
attribute( "src" ) );
m_usrLfoBtn->setChecked( TRUE );
m_userLfoBtn->setChecked( TRUE );
lfoUserWaveCh( TRUE );
_de->accept();
}
@@ -1140,56 +1107,9 @@ void envelopeAndLFOWidget::updateAfterKnobChange( float )
void envelopeAndLFOWidget::lfoSinWaveCh( bool _on )
void envelopeAndLFOWidget::lfoWaveCh( int _val )
{
if( _on )
{
m_lfoShape = SIN;
}
eng()->getSongEditor()->setModified();
update();
}
void envelopeAndLFOWidget::lfoTriangleWaveCh( bool _on )
{
if( _on )
{
m_lfoShape = TRIANGLE;
}
eng()->getSongEditor()->setModified();
update();
}
void envelopeAndLFOWidget::lfoSawWaveCh( bool _on )
{
if( _on )
{
m_lfoShape = SAW;
}
eng()->getSongEditor()->setModified();
update();
}
void envelopeAndLFOWidget::lfoSquareWaveCh( bool _on )
{
if( _on )
{
m_lfoShape = SQUARE;
}
eng()->getSongEditor()->setModified();
m_lfoShape = static_cast<lfoShapes>( _val );
update();
}

View File

@@ -138,12 +138,12 @@ envelopeTabWidget::envelopeTabWidget( channelTrack * _channel_track ) :
}
m_filterGroupBox = new groupBox( tr( "FILTER" ), this );
m_filterGroupBox = new groupBox( tr( "FILTER" ), this, eng() );
m_filterGroupBox->setGeometry( FILTER_GROUPBOX_X, FILTER_GROUPBOX_Y,
FILTER_GROUPBOX_WIDTH,
FILTER_GROUPBOX_HEIGHT );
m_filterComboBox = new comboBox( m_filterGroupBox );
m_filterComboBox = new comboBox( m_filterGroupBox, eng() );
m_filterComboBox->setGeometry( 14, 22, 120, 22 );
m_filterComboBox->setFont( pointSize<8>( m_filterComboBox->font() ) );
@@ -281,7 +281,7 @@ void envelopeTabWidget::processAudioBuffer( sampleFrame * _ab,
basicFilters<>::filterTypes filter =
basicFilters<>::getFilterType(
m_filterComboBox->currentIndex() );
m_filterComboBox->value() );
if( m_envLFOWidgets[VOLUME]->used() &&
m_envLFOWidgets[CUT]->used() &&
@@ -498,7 +498,7 @@ void envelopeTabWidget::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
{
QDomElement etw_de = _doc.createElement( nodeName() );
etw_de.setAttribute( "ftype", m_filterComboBox->currentIndex() );
etw_de.setAttribute( "ftype", m_filterComboBox->value() );
etw_de.setAttribute( "fcut", m_filterCutKnob->value() );
etw_de.setAttribute( "fres", m_filterResKnob->value() );
etw_de.setAttribute( "fwet", m_filterGroupBox->isActive() );
@@ -520,7 +520,7 @@ void envelopeTabWidget::saveSettings( QDomDocument & _doc,
void envelopeTabWidget::loadSettings( const QDomElement & _this )
{
m_filterComboBox->setCurrentIndex( _this.attribute( "ftype" ).toInt() );
m_filterComboBox->setValue( _this.attribute( "ftype" ).toInt() );
m_filterCutKnob->setValue( _this.attribute( "fcut" ).toFloat() );
m_filterResKnob->setValue( _this.attribute( "fres" ).toFloat() );
/* m_filterState->setChecked( _this.attribute( "fwet" ).toInt() );*/

View File

@@ -153,7 +153,7 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name,
m_typeLbl->setGeometry( LABEL_X, TYPE_STUFF_Y, LABEL_WIDTH,
TYPE_HEIGHT );
m_typeCombo = new comboBox( this );
m_typeCombo = new comboBox( this, eng() );
m_typeCombo->setGeometry( LABEL_X + LABEL_WIDTH+LABEL_MARGIN,
TYPE_STUFF_Y, TYPE_COMBO_WIDTH,
TYPE_HEIGHT );
@@ -167,7 +167,7 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name,
tr( fileEncodeDevices[idx].m_description ) );
++idx;
}
m_typeCombo->setCurrentIndex( m_typeCombo->findText( tr(
m_typeCombo->setValue( m_typeCombo->findText( tr(
fileEncodeDevices[m_fileType].m_description ) ) );
@@ -176,7 +176,7 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name,
m_kbpsLbl->setGeometry( LABEL_X, KBPS_STUFF_Y, LABEL_WIDTH,
KBPS_HEIGHT );
m_kbpsCombo = new comboBox( this );
m_kbpsCombo = new comboBox( this, eng() );
m_kbpsCombo->setGeometry( LABEL_X + LABEL_WIDTH + LABEL_MARGIN,
KBPS_STUFF_Y, KBPS_COMBO_WIDTH,
KBPS_HEIGHT );
@@ -188,18 +188,18 @@ exportProjectDialog::exportProjectDialog( const QString & _file_name,
s_availableBitrates[idx] ) );
++idx;
}
m_typeCombo->setCurrentIndex( m_typeCombo->findText(
m_typeCombo->setValue( m_typeCombo->findText(
QString::number( 128 ) ) );
m_vbrCb = new ledCheckBox( tr( "variable bitrate" ), this );
m_vbrCb = new ledCheckBox( tr( "variable bitrate" ), this, eng() );
m_vbrCb->setGeometry( LABEL_X + LABEL_WIDTH + 3 * LABEL_MARGIN +
KBPS_COMBO_WIDTH, KBPS_STUFF_Y + 3, 190, 20 );
m_vbrCb->setChecked( TRUE );
m_hqmCb = new ledCheckBox( tr( "use high-quality-mode (recommened)" ),
this );
this, eng() );
m_hqmCb->setGeometry( LABEL_X, HQ_MODE_CB_Y + 3, HQ_MODE_CB_WIDTH,
HQ_MODE_CB_HEIGHT );
m_hqmCb->setChecked( TRUE );

144
src/core/import_filter.cpp Normal file
View File

@@ -0,0 +1,144 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* import_filter.cpp - base-class for all import-filters (MIDI, FLP etc)
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include "import_filter.h"
#include "track_container.h"
#ifdef QT4
#include <QMessageBox>
#else
#include <qmessagebox.h>
#define fileName name
#endif
importFilter::importFilter( const QString & _file_name,
const descriptor * _descriptor,
engine * _eng ) :
plugin( _descriptor, _eng ),
m_file( _file_name )
{
}
importFilter::~importFilter()
{
}
void importFilter::import( const QString & _file_to_import,
trackContainer * _tc )
{
vvector<descriptor> d;
plugin::getDescriptorsOfAvailPlugins( d );
bool successful = FALSE;
char * s = qstrdup( _file_to_import.
#ifndef QT3
toAscii().constData()
#else
ascii()
#endif
);
for( vvector<plugin::descriptor>::iterator it = d.begin();
it != d.end(); ++it )
{
if( it->type == plugin::IMPORT_FILTER )
{
plugin * p = plugin::instantiate( it->name, s );
if( dynamic_cast<importFilter *>( p ) != NULL &&
dynamic_cast<importFilter *>( p )->tryImport(
_tc ) == TRUE )
{
delete p;
successful = TRUE;
break;
}
delete p;
}
}
delete[] s;
if( successful == FALSE )
{
QMessageBox::information( NULL,
trackContainer::tr( "Couldn't import file" ),
trackContainer::tr( "Couldn't find a filter for "
"importing file %1.\n"
"You should convert this file "
"into a format supported by "
"LMMS using another software. "
).arg( _file_to_import ),
QMessageBox::Ok,
QMessageBox::NoButton );
}
}
bool importFilter::openFile( void )
{
#ifdef QT4
if( m_file.open( QFile::ReadOnly ) == FALSE )
#else
if( m_file.open( IO_ReadOnly ) == FALSE )
#endif
{
QMessageBox::critical( NULL,
trackContainer::tr( "Couldn't open file" ),
trackContainer::tr( "Couldn't open file %1 "
"for reading.\nPlease make "
"sure you have read-"
"permission to the file and "
"the directory containing the "
"file and try again!" ).arg(
m_file.fileName() ),
QMessageBox::Ok,
QMessageBox::NoButton );
return( FALSE );
}
return( TRUE );
}
#undef fileName
#endif

View File

@@ -36,6 +36,7 @@
#include <QSplashScreen>
#include <QMessageBox>
#include <QMenuBar>
#include <Qt/QtXml>
#else
@@ -46,6 +47,7 @@
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qmenubar.h>
#include <qdom.h>
#if QT_VERSION >= 0x030200
#include <qsplashscreen.h>
@@ -74,6 +76,7 @@
#include "setup_dialog.h"
#include "audio_dummy.h"
#include "tool_button.h"
#include "edit_history.h"
#if QT_VERSION >= 0x030100
@@ -464,9 +467,25 @@ void mainWindow::finalize( void )
#endif
project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ),
qApp, SLOT( closeAllWindows() ),
Qt::CTRL+Qt::Key_Q );
Qt::CTRL + Qt::Key_Q );
QMenu * edit_menu = new QMenu( this );
#ifdef QT4
menuBar()->addMenu( edit_menu )->setText( tr( "&Edit" ) );
#else
menuBar()->insertItem( tr( "&Edit" ), edit_menu );
#endif
edit_menu->addAction( embed::getIconPixmap( "edit_undo" ),
tr( "Undo" ),
this, SLOT( undo() ),
Qt::CTRL + Qt::Key_Z );
edit_menu->addAction( embed::getIconPixmap( "edit_redo" ),
tr( "Redo" ),
this, SLOT( redo() ),
Qt::CTRL + Qt::Key_R );
QMenu * settings_menu = new QMenu( this );
#ifdef QT4
menuBar()->addMenu( settings_menu )->setText( tr( "&Settings" ) );
@@ -583,6 +602,34 @@ void mainWindow::clearKeyModifiers( void )
void mainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
{
_de.setAttribute( "x", _w->parentWidget()->x() );
_de.setAttribute( "y", _w->parentWidget()->y() );
_de.setAttribute( "width", _w->width() );
_de.setAttribute( "height", _w->height() );
_de.setAttribute( "visible", _w->isVisible() );
}
void mainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
{
QRect r( _de.attribute( "x" ).toInt(), _de.attribute( "y" ).toInt(),
_de.attribute( "width" ).toInt(),
_de.attribute( "height" ).toInt() );
if( !r.isNull() )
{
_w->setShown( _de.attribute( "visible" ).toInt() );
_w->parentWidget()->move( r.topLeft() );
_w->resize( r.size() );
}
}
void mainWindow::createNewProject( void )
{
if( eng()->getSongEditor()->mayChangeProject() == TRUE )
@@ -808,6 +855,22 @@ void mainWindow::togglePianoRollWin( void )
void mainWindow::undo( void )
{
eng()->getEditHistory()->undo();
}
void mainWindow::redo( void )
{
eng()->getEditHistory()->redo();
}
void mainWindow::closeEvent( QCloseEvent * _ce )
{
if( eng()->getSongEditor()->mayChangeProject() == TRUE )

View File

@@ -76,7 +76,7 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
m_inputChannelSpinBox = new lcdSpinBox( 0, MIDI_CHANNEL_COUNT, 3,
m_setupTabWidget );
m_setupTabWidget, eng() );
m_inputChannelSpinBox->addTextForValue( 0, "---" );
m_inputChannelSpinBox->setValue( m_midiPort->inputChannel() + 1 );
m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
@@ -86,7 +86,7 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
inputChannelChanged( m_inputChannelSpinBox->value() );
m_outputChannelSpinBox = new lcdSpinBox( 1, MIDI_CHANNEL_COUNT, 3,
m_setupTabWidget );
m_setupTabWidget, eng() );
m_outputChannelSpinBox->setValue( m_midiPort->outputChannel() + 1 );
//m_outputChannelSpinBox->addTextForValue( 0, "---" );
m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
@@ -97,7 +97,7 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
m_receiveCheckBox = new ledCheckBox( tr( "Receive MIDI-events" ),
m_setupTabWidget );
m_setupTabWidget, eng() );
m_receiveCheckBox->move( 10, 34 );
connect( m_receiveCheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( midiPortModeToggled( bool ) ) );
@@ -106,7 +106,7 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
m_sendCheckBox = new ledCheckBox( tr( "Send MIDI-events" ),
m_setupTabWidget );
m_setupTabWidget, eng() );
m_sendCheckBox->move( 10, 94 );
connect( m_sendCheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( midiPortModeToggled( bool ) ) );

View File

@@ -37,6 +37,7 @@
#include <QWheelEvent>
#include <QLayout>
#include <QLabel>
#include <Qt/QtXml>
#else
@@ -45,6 +46,9 @@
#include <qpainter.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qdom.h>
#define addButton insert
#endif
@@ -391,7 +395,7 @@ pianoRoll::pianoRoll( engine * _engine ) :
zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) );
// setup zooming-stuff
m_zoomingComboBox = new comboBox( m_toolBar );
m_zoomingComboBox = new comboBox( m_toolBar, eng() );
m_zoomingComboBox->setFixedSize( 80, 22 );
for( int i = 0; i < 6; ++i )
{
@@ -399,7 +403,7 @@ pianoRoll::pianoRoll( engine * _engine ) :
static_cast<int>( powf( 2.0f, i ) ) ) +
"%" );
}
m_zoomingComboBox->setCurrentIndex( m_zoomingComboBox->findText(
m_zoomingComboBox->setValue( m_zoomingComboBox->findText(
"100%" ) );
connect( m_zoomingComboBox, SIGNAL( activated( const QString & ) ),
this, SLOT( zoomingChanged( const QString & ) ) );
@@ -409,21 +413,21 @@ pianoRoll::pianoRoll( engine * _engine ) :
QLabel * quantize_lbl = new QLabel( m_toolBar );
quantize_lbl->setPixmap( embed::getIconPixmap( "quantize" ) );
m_quantizeComboBox = new comboBox( m_toolBar );
m_quantizeComboBox = new comboBox( m_toolBar, eng() );
m_quantizeComboBox->setFixedSize( 60, 22 );
for( int i = 0; i < 7; ++i )
{
m_quantizeComboBox->addItem( "1/" + QString::number(
static_cast<int>( powf( 2.0f, i ) ) ) );
}
m_quantizeComboBox->setCurrentIndex( m_quantizeComboBox->findText(
m_quantizeComboBox->setValue( m_quantizeComboBox->findText(
"1/16" ) );
// setup note-len-stuff
QLabel * note_len_lbl = new QLabel( m_toolBar );
note_len_lbl->setPixmap( embed::getIconPixmap( "note" ) );
m_noteLenComboBox = new comboBox( m_toolBar );
m_noteLenComboBox = new comboBox( m_toolBar, eng() );
m_noteLenComboBox->setFixedSize( 120, 22 );
m_noteLenComboBox->addItem( tr( "Last note" ),
embed::getIconPixmap( "edit_draw" ) );
@@ -435,7 +439,7 @@ pianoRoll::pianoRoll( engine * _engine ) :
static_cast<int>( powf( 2.0f, i ) ) ),
embed::getIconPixmap( "note_" + pixmaps[i] ) );
}
m_noteLenComboBox->setCurrentIndex( 0 );
m_noteLenComboBox->setValue( 0 );
tb_layout->addSpacing( 5 );
@@ -553,6 +557,24 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
void pianoRoll::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
QDomElement pr_de = _doc.createElement( nodeName() );
mainWindow::saveWidgetState( this, pr_de );
_parent.appendChild( pr_de );
}
void pianoRoll::loadSettings( const QDomElement & _this )
{
mainWindow::restoreWidgetState( this, _this );
}
inline void pianoRoll::drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
Sint16 _width, const bool _is_selected,
const bool _is_step_note )
@@ -1996,7 +2018,7 @@ void pianoRoll::wheelEvent( QWheelEvent * _we )
m_ppt /= 2;
}
// update combobox with zooming-factor
m_zoomingComboBox->setCurrentIndex(
m_zoomingComboBox->setValue(
m_zoomingComboBox->findText( QString::number(
static_cast<int>( m_ppt * 100 /
DEFAULT_PR_PPT ) ) +"%" ) );
@@ -2486,7 +2508,7 @@ int pianoRoll::quantization( void ) const
midiTime pianoRoll::newNoteLen( void ) const
{
if( m_noteLenComboBox->currentIndex() == 0 )
if( m_noteLenComboBox->value() == 0 )
{
return( m_lenOfNewNotes );
}
@@ -2500,4 +2522,9 @@ midiTime pianoRoll::newNoteLen( void ) const
#include "piano_roll.moc"
#ifdef QT3
#undef addButton
#endif
#endif

View File

@@ -87,10 +87,13 @@ pluginBrowser::pluginBrowser( QWidget * _parent, engine * _engine ) :
m_pluginDescriptors.begin();
it != m_pluginDescriptors.end(); ++it )
{
pluginDescWidget * p = new pluginDescWidget( *it, m_view,
eng() );
p->show();
view_layout->addWidget( p );
if( it->type == plugin::INSTRUMENT )
{
pluginDescWidget * p = new pluginDescWidget( *it,
m_view, eng() );
p->show();
view_layout->addWidget( p );
}
}
view_layout->addStretch();
show();

View File

@@ -191,7 +191,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
ledCheckBox * disable_tooltips = new ledCheckBox(
tr( "Disable tooltips (no spurious "
"interrupts while playing)" ),
misc_tw );
misc_tw, eng() );
disable_tooltips->move( 10, 18 );
disable_tooltips->setChecked( m_disableToolTips );
connect( disable_tooltips, SIGNAL( toggled( bool ) ),
@@ -202,7 +202,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
tr( "Classical knob usability (move "
"cursor around knob to change "
"value)" ),
misc_tw );
misc_tw, eng() );
classical_knob_usability->move( 10, 36 );
classical_knob_usability->setChecked( m_classicalKnobUsability );
connect( classical_knob_usability, SIGNAL( toggled( bool ) ),
@@ -211,7 +211,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
ledCheckBox * gimp_like_windows = new ledCheckBox(
tr( "GIMP-like windows (no MDI)" ),
misc_tw );
misc_tw, eng() );
gimp_like_windows->move( 10, 54 );
gimp_like_windows->setChecked( m_gimpLikeWindows );
connect( gimp_like_windows, SIGNAL( toggled( bool ) ),
@@ -219,8 +219,8 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
ledCheckBox * no_wizard = new ledCheckBox(
tr( "Do not show wizard after "
"up-/downgrade" ), misc_tw );
tr( "Do not show wizard after "
"up-/downgrade" ), misc_tw, eng() );
no_wizard->move( 10, 72 );
no_wizard->setChecked( m_noWizard );
connect( no_wizard, SIGNAL( toggled( bool ) ),
@@ -230,7 +230,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
ledCheckBox * no_msg = new ledCheckBox(
tr( "Do not show message after "
"closing this dialog" ),
misc_tw );
misc_tw, eng() );
no_msg->move( 10, 90 );
no_msg->setChecked( m_noMsgAfterSetup );
connect( no_msg, SIGNAL( toggled( bool ) ),
@@ -336,7 +336,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
ledCheckBox * disable_ch_act_ind = new ledCheckBox(
tr( "Disable channel activity indicators" ),
ui_fx_tw );
ui_fx_tw, eng() );
disable_ch_act_ind->move( 10, 20 );
disable_ch_act_ind->setChecked( m_disableChActInd );
connect( disable_ch_act_ind, SIGNAL( toggled( bool ) ),
@@ -345,7 +345,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
ledCheckBox * manual_ch_piano = new ledCheckBox(
tr( "Only press keys on channel-piano manually" ),
ui_fx_tw );
ui_fx_tw, eng() );
manual_ch_piano->move( 10, 40 );
manual_ch_piano->setChecked( m_manualChPiano );
connect( manual_ch_piano, SIGNAL( toggled( bool ) ),

View File

@@ -64,6 +64,8 @@
#include <qlayout.h>
#include <qbuttongroup.h>
#define addButton insert
#endif
@@ -84,7 +86,6 @@
#include "visualization_widget.h"
#include "project_notes.h"
#include "config_mgr.h"
#include "midi_file.h"
#include "lcd_spinbox.h"
#include "tooltip.h"
#include "tool_button.h"
@@ -92,6 +93,8 @@
#include "text_float.h"
#include "combobox.h"
#include "main_window.h"
#include "import_filter.h"
#include "edit_history.h"
#include "debug.h"
@@ -151,7 +154,7 @@ songEditor::songEditor( engine * _engine ) :
eng()->getMainWindow()->addSpacingToToolBar( 10 );
m_bpmSpinBox = new lcdSpinBox( MIN_BPM, MAX_BPM, 3, tb );
m_bpmSpinBox = new lcdSpinBox( MIN_BPM, MAX_BPM, 3, tb, eng() );
m_bpmSpinBox->setLabel( tr( "TEMPO/BPM" ) );
connect( m_bpmSpinBox, SIGNAL( valueChanged( int ) ), this,
SLOT( setTempo( int ) ) );
@@ -370,7 +373,7 @@ songEditor::songEditor( engine * _engine ) :
zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) );
// setup zooming-stuff
m_zoomingComboBox = new comboBox( m_toolBar );
m_zoomingComboBox = new comboBox( m_toolBar, eng() );
m_zoomingComboBox->setFixedSize( 80, 22 );
m_zoomingComboBox->move( 580, 4 );
for( int i = 0; i < 7; ++i )
@@ -379,7 +382,7 @@ songEditor::songEditor( engine * _engine ) :
static_cast<int>( powf( 2.0f, i ) ) ) +
"%" );
}
m_zoomingComboBox->setCurrentIndex( m_zoomingComboBox->findText(
m_zoomingComboBox->setValue( m_zoomingComboBox->findText(
"100%" ) );
connect( m_zoomingComboBox, SIGNAL( activated( const QString & ) ),
this, SLOT( zoomingChanged( const QString & ) ) );
@@ -566,7 +569,7 @@ void songEditor::wheelEvent( QWheelEvent * _we )
setPixelsPerTact( (int) pixelsPerTact() / 2 );
}
// update combobox with zooming-factor
m_zoomingComboBox->setCurrentIndex(
m_zoomingComboBox->setValue(
m_zoomingComboBox->findText( QString::number(
static_cast<int>( pixelsPerTact() *
100 / DEFAULT_PIXELS_PER_TACT ) ) + "%" ) );
@@ -1336,6 +1339,8 @@ bool songEditor::mayChangeProject( void )
void songEditor::clearProject( void )
{
eng()->getEditHistory()->setGlobalStepRecording( FALSE );
if( m_playing )
{
// stop play, because it's dangerous that play-routines try to
@@ -1360,6 +1365,8 @@ void songEditor::clearProject( void )
eng()->getBBEditor()->clearAllTracks();
eng()->getProjectNotes()->clear();
eng()->getEditHistory()->setGlobalStepRecording( TRUE );
}
@@ -1371,6 +1378,8 @@ void songEditor::createNewProject( void )
{
clearProject();
eng()->getEditHistory()->setGlobalStepRecording( FALSE );
track * t;
t = track::create( track::CHANNEL_TRACK, this );
dynamic_cast< channelTrack * >( t )->loadInstrument(
@@ -1392,6 +1401,9 @@ void songEditor::createNewProject( void )
m_modified = FALSE;
eng()->getMainWindow()->resetWindowTitle( "" );
eng()->getEditHistory()->setGlobalStepRecording( TRUE );
}
@@ -1414,6 +1426,8 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
{
clearProject();
eng()->getEditHistory()->setGlobalStepRecording( FALSE );
m_fileName = _file_name;
m_oldFileName = _file_name;
@@ -1473,12 +1487,24 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
{
loadSettings( node.toElement() );
}
else if( node.nodeName() ==
eng()->getPianoRoll()->nodeName() )
{
eng()->getPianoRoll()->loadSettings(
node.toElement() );
}
else if( node.nodeName() ==
eng()->getProjectNotes()->nodeName() )
{
eng()->getProjectNotes()->loadSettings(
node.toElement() );
}
else if( node.nodeName() ==
m_playPos[PLAY_SONG].m_timeLine->nodeName() )
{
m_playPos[PLAY_SONG].m_timeLine->loadSettings(
node.toElement() );
}
}
node = node.nextSibling();
}
@@ -1489,6 +1515,8 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
m_loadingProject = FALSE;
eng()->getMainWindow()->resetWindowTitle( "" );
eng()->getEditHistory()->setGlobalStepRecording( TRUE );
}
@@ -1513,7 +1541,10 @@ bool songEditor::saveProject( void )
saveSettings( mmp, mmp.content() );
eng()->getPianoRoll()->saveSettings( mmp, mmp.content() );
eng()->getProjectNotes()->saveSettings( mmp, mmp.content() );
m_playPos[PLAY_SONG].m_timeLine->saveSettings( mmp, mmp.content() );
if( mmp.writeFile( m_fileName, m_oldFileName == "" ||
m_fileName != m_oldFileName ) == TRUE )
@@ -1574,8 +1605,7 @@ void songEditor::importProject( void )
ofd.setFileMode( QFileDialog::ExistingFiles );
if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() )
{
midiFile mf( ofd.selectedFiles()[0] );
mf.importToTrackContainer( this );
importFilter::import( ofd.selectedFiles()[0], this );
}
}
@@ -1676,4 +1706,9 @@ void songEditor::loadSettings( const QDomElement & _this )
#include "song_editor.moc"
#ifdef QT3
#undef addButton
#endif
#endif

View File

@@ -34,6 +34,7 @@
#include <QMouseEvent>
#include <QLayout>
#include <QTimer>
#include <Qt/QtXml>
#else
@@ -41,6 +42,7 @@
#include <qapplication.h>
#include <qlayout.h>
#include <qtimer.h>
#include <qdom.h>
#endif
@@ -174,6 +176,30 @@ void timeLine::addToolButtons( QWidget * _tool_bar )
void timeLine::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
QDomElement tl_de = _doc.createElement( nodeName() );
tl_de.setAttribute( "lp0pos", (int) loopBegin() );
tl_de.setAttribute( "lp1pos", (int) loopEnd() );
tl_de.setAttribute( "lpstate", m_loopPoints );
_parent.appendChild( tl_de );
}
void timeLine::loadSettings( const QDomElement & _this )
{
m_loopPos[0] = _this.attribute( "lp0pos" ).toInt();
m_loopPos[1] = _this.attribute( "lp1pos" ).toInt();
m_loopPoints = static_cast<loopPointStates>(
_this.attribute( "lpstate" ).toInt() );
update();
}
void timeLine::updatePosition( const midiTime & )
{
const int new_x = markerX( m_pos );
@@ -295,8 +321,6 @@ void timeLine::mousePressEvent( QMouseEvent * _me )
{
const midiTime t = m_begin +
static_cast<Sint32>( _me->x() * 64 / m_ppt );
Uint8 pmin = 0;
Uint8 pmax = 1;
m_action = MOVE_LOOP_BEGIN;
if( m_loopPos[0] > m_loopPos[1] )
{

View File

@@ -863,7 +863,7 @@ trackOperationsWidget::trackOperationsWidget( trackWidget * _parent ) :
toolTip::add( m_trackOps, tr( "Actions for this track" ) );
m_muteBtn = new pixmapButton( this );
m_muteBtn = new pixmapButton( this, m_trackWidget->getTrack()->eng() );
m_muteBtn->setActiveGraphic( embed::getIconPixmap( "mute_on" ) );
m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "mute_off" ) );
m_muteBtn->move( 44, 4 );

View File

@@ -58,7 +58,7 @@
#include "channel_track.h"
#include "mmp.h"
#include "config_mgr.h"
#include "midi_file.h"
#include "import_filter.h"
#include "instrument.h"
#include "rubberband.h"
@@ -109,6 +109,7 @@ void trackContainer::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
QDomElement tc_de = _doc.createElement( "trackcontainer" );
tc_de.setAttribute( "type", nodeName() );
mainWindow::saveWidgetState( this, tc_de );
_parent.appendChild( tc_de );
// save settings of each track
@@ -176,6 +177,8 @@ void trackContainer::loadSettings( const QDomElement & _this )
node = node.nextSibling();
}
mainWindow::restoreWidgetState( this, _this );
pd->setValue( start_val + _this.childNodes().count() );
if( was_null )
@@ -463,8 +466,7 @@ void trackContainer::dropEvent( QDropEvent * _de )
}
else if( type == "midifile" )
{
midiFile mf( value );
mf.importToTrackContainer( this );
importFilter::import( value, this );
_de->accept();
}
else if( type.left( 6 ) == "track_" )

View File

@@ -2,6 +2,7 @@
#undef SINGLE_SOURCE_COMPILE
#include "src/lib/string_pair_drag.cpp"
#include "src/lib/buffer_allocator.cpp"
#include "src/lib/edit_history.cpp"
#include "src/lib/embed.cpp"
#include "src/lib/base64.cpp"
#include "src/lib/mmp.cpp"
@@ -9,6 +10,7 @@
#include "src/lib/oscillator.cpp"
#include "src/lib/clipboard.cpp"
#include "src/lib/sample_buffer.cpp"
#include "src/core/import_filter.cpp"
#include "src/core/config_mgr.cpp"
#include "src/core/envelope_and_lfo_widget.cpp"
#include "src/core/song_editor.cpp"
@@ -40,7 +42,6 @@
#include "src/core/midi_tab_widget.cpp"
#include "src/midi/midi_alsa_seq.cpp"
#include "src/midi/midi_oss.cpp"
#include "src/midi/midi_file.cpp"
#include "src/midi/midi_port.cpp"
#include "src/midi/midi_client.cpp"
#include "src/midi/midi_mapper.cpp"
@@ -82,4 +83,5 @@
#include "src/widgets/tooltip.cpp"
#include "src/widgets/nstate_button.cpp"
#include "src/widgets/lcd_spinbox.cpp"
#include "src/widgets/automatable_button.cpp"
#endif

View File

@@ -0,0 +1,205 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* automatable_button.cpp - implementation of class automatableButton and
* automatableButtonGroup
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include "automatable_button.h"
automatableButton::automatableButton( QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
automatableObject<bool>( _engine, FALSE, TRUE, FALSE ),
m_group( NULL ),
m_toggleButton( FALSE )
{
}
automatableButton::~automatableButton()
{
if( m_group != NULL )
{
m_group->removeButton( this );
}
}
void automatableButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton )
{
if( m_toggleButton == FALSE )
{
setChecked( TRUE );
}
else
{
toggle();
}
_me->accept();
}
else
{
QWidget::mousePressEvent( _me );
}
}
void automatableButton::mouseReleaseEvent( QMouseEvent * _me )
{
if( m_toggleButton == FALSE )
{
setChecked( FALSE );
}
emit clicked();
}
void automatableButton::toggle( void )
{
if( m_toggleButton == TRUE && m_group != NULL )
{
if( value() == FALSE )
{
m_group->activateButton( this );
}
}
else
{
setValue( !value() );
update();
emit( toggled( value() ) );
}
}
void automatableButton::setChecked( bool _on )
{
if( _on != isChecked() )
{
setValue( _on );
update();
emit( toggled( value() ) );
}
}
automatableButtonGroup::automatableButtonGroup( QObject * _parent,
engine * _engine ) :
QObject( _parent ),
automatableObject<int>( _engine )
{
}
automatableButtonGroup::~automatableButtonGroup()
{
while( m_buttons.empty() == FALSE )
{
removeButton( m_buttons.front() );
}
}
void automatableButtonGroup::addButton( automatableButton * _btn )
{
_btn->m_group = this;
_btn->setToggleButton( TRUE );
_btn->setChecked( FALSE );
// disable step-recording as we're recording changes of states of
// button-group members on our own
_btn->setStepRecording( FALSE );
m_buttons.push_back( _btn );
setRange( 0, m_buttons.size() - 1 );
}
void automatableButtonGroup::removeButton( automatableButton * _btn )
{
m_buttons.erase( qFind( m_buttons.begin(), m_buttons.end(), _btn ) );
_btn->m_group = NULL;
setRange( 0, m_buttons.size() - 1 );
}
void automatableButtonGroup::activateButton( automatableButton * _btn )
{
if( _btn != m_buttons[value()] && m_buttons.findIndex( _btn ) != -1 )
{
setValue( m_buttons.findIndex( _btn ) );
}
}
void automatableButtonGroup::setValue( const int _value )
{
if( m_buttons.empty() == FALSE )
{
// range not updated yet?
if( value() == fittedValue( value() ) )
{
m_buttons[value()]->setChecked( FALSE );
}
automatableObject<int>::setValue( _value );
m_buttons[value()]->setChecked( TRUE );
}
emit valueChanged( value() );
}
#include "automatable_button.moc"
#endif

View File

@@ -54,10 +54,10 @@ QPixmap * comboBox::s_arrow = NULL;
const int CB_ARROW_BTN_WIDTH = 20;
comboBox::comboBox( QWidget * _parent ) :
comboBox::comboBox( QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
automatableObject<int>( _engine ),
m_menu( this ),
m_currentIndex( 0 ),
m_pressed( FALSE )
{
if( s_background == NULL )
@@ -124,6 +124,7 @@ void comboBox::addItem( const QString & _item, const QPixmap & _pixmap )
#endif
);
}
setRange( 0, m_items.size() - 1 );
}
@@ -145,13 +146,14 @@ int comboBox::findText( const QString & _txt ) const
void comboBox::setCurrentIndex( int _idx )
void comboBox::setValue( const int _idx )
{
m_currentIndex = tLimit<int>( _idx, 0, ( m_items.size() > 0 ) ?
m_items.size() - 1 : 0 );
emit( currentIndexChanged( m_currentIndex ) );
automatableObject<int>::setValue( _idx );
/* m_value = tLimit<int>( _idx, 0, ( m_items.size() > 0 ) ?
m_items.size() - 1 : 0 );*/
emit( valueChanged( value() ) );
emit( activated( ( m_items.size() > 0 ) ?
m_items[m_currentIndex].first : "" ) );
m_items[value()].first : "" ) );
update();
}
@@ -180,11 +182,11 @@ void comboBox::mousePressEvent( QMouseEvent * _me )
}
else if( _me->button() == Qt::LeftButton )
{
setCurrentIndex( currentIndex() + 1 );
setValue( value() + 1 );
}
else if( _me->button() == Qt::RightButton )
{
setCurrentIndex( currentIndex() - 1 );
setValue( value() - 1 );
}
}
@@ -235,7 +237,7 @@ void comboBox::paintEvent( QPaintEvent * _pe )
p.setFont( font() );
p.setClipRect( QRect( 5, 2, width() - CB_ARROW_BTN_WIDTH - 8,
height() - 2 ) );
const QPixmap & item_pm = m_items[currentIndex()].second;
const QPixmap & item_pm = m_items[value()].second;
int tx = 4;
if( item_pm.isNull() == FALSE )
{
@@ -244,10 +246,10 @@ void comboBox::paintEvent( QPaintEvent * _pe )
}
p.setPen( QColor( 64, 64, 64 ) );
p.drawText( tx+1, p.fontMetrics().height()+1,
m_items[currentIndex()].first );
m_items[value()].first );
p.setPen( QColor( 224, 224, 224 ) );
p.drawText( tx, p.fontMetrics().height(),
m_items[currentIndex()].first );
m_items[value()].first );
}
#ifdef QT3
@@ -261,7 +263,7 @@ void comboBox::paintEvent( QPaintEvent * _pe )
void comboBox::wheelEvent( QWheelEvent * _we )
{
setCurrentIndex( currentIndex() + ( ( _we->delta() < 0 ) ? 1 : -1 ) );
setValue( value() + ( ( _we->delta() < 0 ) ? 1 : -1 ) );
_we->accept();
}
@@ -271,7 +273,7 @@ void comboBox::wheelEvent( QWheelEvent * _we )
void comboBox::setItem( QAction * _item )
{
setCurrentIndex( findText( _item->text() ) );
setValue( findText( _item->text() ) );
}
@@ -288,7 +290,7 @@ void comboBox::setItem( QAction * )
void comboBox::setItem( int _item )
{
setCurrentIndex( _item );
setValue( _item );
}

View File

@@ -39,8 +39,6 @@
#include <qtimer.h>
#include <qobjectlist.h>
#define setChecked setOn
#endif
#ifndef __USE_XOPEN
@@ -59,8 +57,10 @@
QPixmap * groupBox::s_ledBg = NULL;
groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
groupBox::groupBox( const QString & _caption, QWidget * _parent,
engine * _engine ) :
QWidget( _parent ),
engineObject( _engine ),
m_caption( _caption ),
m_origHeight( height() ),
m_animating( FALSE )
@@ -73,7 +73,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
updatePixmap();
m_led = new pixmapButton( this );
m_led = new pixmapButton( this, eng() );
m_led->move( 2, 3 );
m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) );
m_led->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
@@ -238,8 +238,6 @@ void groupBox::updatePixmap( void )
#undef setChecked
#include "group_box.moc"

View File

@@ -68,7 +68,6 @@
#include <math.h>
#include "knob.h"
#include "song_editor.h"
/*#include "midi_client.h"*/
#include "embed.h"
#include "spc_bg_hndl_widget.h"
@@ -95,8 +94,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name,
, _name.ascii()
#endif
),
engineObject( _engine ),
automatableObject<float>(),
automatableObject<float>( _engine ),
m_mouseOffset( 0.0f ),
m_buttonPressed( FALSE ),
m_angle( 0.0f ),
@@ -413,6 +411,9 @@ void knob::mousePressEvent( QMouseEvent * _me )
if( _me->button() == Qt::LeftButton &&
eng()->getMainWindow()->isCtrlPressed() == FALSE )
{
setStepRecording( FALSE );
m_oldValue = value();
const QPoint & p = _me->pos();
m_origMousePos = p;
@@ -464,7 +465,6 @@ void knob::mouseMoveEvent( QMouseEvent * _me )
{
QCursor::setPos( mapToGlobal( m_origMousePos ) );
}
eng()->getSongEditor()->setModified();
}
s_textFloat->setText( m_hintTextBeforeValue +
@@ -478,6 +478,9 @@ void knob::mouseMoveEvent( QMouseEvent * _me )
//! Mouse Release Event handler
void knob::mouseReleaseEvent( QMouseEvent * /* _me*/ )
{
setStepRecording( TRUE );
addStepFromOldToCurVal();
if( m_buttonPressed )
{
m_buttonPressed = TRUE;
@@ -560,7 +563,6 @@ void knob::wheelEvent( QWheelEvent * _we )
_we->accept();
const int inc = ( _we->delta() > 0 ) ? 1 : -1;
incValue( inc );
eng()->getSongEditor()->setModified();
s_textFloat->reparent( this );
@@ -730,7 +732,6 @@ void knob::setStep( float _vstep )
void knob::reset( void )
{
setValue( m_initValue );
eng()->getSongEditor()->setModified();
s_textFloat->reparent( this );
s_textFloat->setText( m_hintTextBeforeValue +
QString::number( value() ) +
@@ -754,7 +755,6 @@ void knob::copyValue( void )
void knob::pasteValue( void )
{
setValue( s_copiedValue );
eng()->getSongEditor()->setModified();
s_textFloat->reparent( this );
s_textFloat->setText( m_hintTextBeforeValue +
QString::number( value() ) +

View File

@@ -49,9 +49,9 @@
lcdSpinBox::lcdSpinBox( int _min, int _max, int _num_digits,
QWidget * _parent ) :
QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
automatableObject<int>( 0, _min, _max ),
automatableObject<int>( _engine, 0, _min, _max ),
m_label( NULL ),
m_origMousePos()
{
@@ -62,7 +62,7 @@ lcdSpinBox::lcdSpinBox( int _min, int _max, int _num_digits,
setEnabled( TRUE );
// value is automatically limited to given range
setValue( 0 );
setInitValue( 0 );
m_number->setFixedSize( m_number->sizeHint() * 0.9 );
setFixedSize( m_number->size() );
@@ -152,6 +152,7 @@ void lcdSpinBox::mousePressEvent( QMouseEvent * _me )
{
m_origMousePos = _me->globalPos();
QApplication::setOverrideCursor( Qt::BlankCursor );
m_oldValue = value();
}
}
@@ -169,8 +170,10 @@ void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me )
int dy = _me->globalY() - m_origMousePos.y();
if( dy > 1 || dy < -1 )
{
setValue( value() - dy / 2 * step() );
setStepRecording( FALSE );// why is this neccessary?!
setInitValue( value() - dy / 2 * step() );
emit valueChanged( value() );
setStepRecording( TRUE );
QCursor::setPos( m_origMousePos );
}
}
@@ -181,6 +184,8 @@ void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me )
void lcdSpinBox::mouseReleaseEvent( QMouseEvent * _me )
{
addStepFromOldToCurVal();
QCursor::setPos( m_origMousePos );
QApplication::restoreOverrideCursor();
}

View File

@@ -55,11 +55,12 @@ static const QString names[ledCheckBox::TOTAL_COLORS] =
ledCheckBox::ledCheckBox( const QString & _text, QWidget * _parent,
ledColors _color ) :
QWidget( _parent ),
automatableObject<bool>( FALSE, TRUE, FALSE ),
engine * _engine, ledColors _color ) :
automatableButton( _parent, _engine ),
m_text( _text )
{
setToggleButton( TRUE );
if( _color >= TOTAL_COLORS || _color < YELLOW )
{
_color = YELLOW;
@@ -93,42 +94,6 @@ ledCheckBox::~ledCheckBox()
void ledCheckBox::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton )
{
toggle();
}
}
void ledCheckBox::toggle( void )
{
setValue( !value() );
update();
emit( toggled( value() ) );
}
void ledCheckBox::setChecked( bool _on )
{
if( _on != isChecked() )
{
toggle();
}
else
{
emit( toggled( value() ) );
}
}
void ledCheckBox::paintEvent( QPaintEvent * )
{
#ifdef QT4

View File

@@ -45,11 +45,11 @@
pixmapButton::pixmapButton( QWidget * _parent ) :
QPushButton( _parent ),
m_activePixmap( NULL ),
m_inactivePixmap( NULL ),
m_bgPixmap( NULL )
pixmapButton::pixmapButton( QWidget * _parent, engine * _engine ) :
automatableButton( _parent, _engine ),
m_activePixmap(),
m_inactivePixmap(),
m_bgPixmap()
{
setActiveGraphic( embed::getIconPixmap( "led_yellow" ) );
setInactiveGraphic( embed::getIconPixmap( "led_off" ), FALSE );
@@ -58,7 +58,7 @@ pixmapButton::pixmapButton( QWidget * _parent ) :
setBackgroundMode( Qt::NoBackground );
#endif
setCheckable( TRUE );
//setCheckable( TRUE );
}
@@ -66,9 +66,6 @@ pixmapButton::pixmapButton( QWidget * _parent ) :
pixmapButton::~pixmapButton()
{
delete m_activePixmap;
delete m_inactivePixmap;
delete m_bgPixmap;
}
@@ -85,25 +82,23 @@ void pixmapButton::paintEvent( QPaintEvent * )
QPainter p( &draw_pm, this );
#endif
if( m_bgPixmap != NULL )
if( !m_bgPixmap.isNull() )
{
p.drawPixmap( 0, 0, *m_bgPixmap );
p.drawPixmap( 0, 0, m_bgPixmap );
}
if( isChecked() || isDown() )
if( isChecked() )
{
if( m_activePixmap != NULL )
if( !m_activePixmap.isNull() )
{
p.drawPixmap( 0, 0, *m_activePixmap );
p.drawPixmap( 0, 0, m_activePixmap );
}
}
else
else if( !m_inactivePixmap.isNull() )
{
if( m_inactivePixmap != NULL )
{
p.drawPixmap( 0, 0, *m_inactivePixmap );
}
p.drawPixmap( 0, 0, m_inactivePixmap );
}
#ifndef QT4
// and blit all the drawn stuff on the screen...
bitBlt( this, rect().topLeft(), &draw_pm );
@@ -114,24 +109,26 @@ void pixmapButton::paintEvent( QPaintEvent * )
void pixmapButton::mousePressEvent( QMouseEvent * _me)
void pixmapButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::RightButton )
{
emit( clickedRight() );
_me->accept();
}
else
{
QPushButton::mousePressEvent( _me );
automatableButton::mousePressEvent( _me );
}
}
void pixmapButton::mouseDoubleClickEvent( QMouseEvent * )
void pixmapButton::mouseDoubleClickEvent( QMouseEvent * _me )
{
emit doubleClicked();
_me->accept();
}
@@ -139,10 +136,8 @@ void pixmapButton::mouseDoubleClickEvent( QMouseEvent * )
void pixmapButton::setActiveGraphic( const QPixmap & _pm )
{
delete m_activePixmap;
m_activePixmap = new QPixmap( _pm );
resize( m_activePixmap->width(), m_activePixmap->height() );
m_activePixmap = _pm;
resize( m_activePixmap.width(), m_activePixmap.height() );
}
@@ -150,9 +145,7 @@ void pixmapButton::setActiveGraphic( const QPixmap & _pm )
void pixmapButton::setInactiveGraphic( const QPixmap & _pm, bool _update )
{
delete m_inactivePixmap;
m_inactivePixmap = new QPixmap( _pm );
m_inactivePixmap = _pm;
if( _update )
{
update();
@@ -164,9 +157,7 @@ void pixmapButton::setInactiveGraphic( const QPixmap & _pm, bool _update )
void pixmapButton::setBgGraphic( const QPixmap & _pm )
{
delete m_bgPixmap;
m_bgPixmap = new QPixmap( _pm );
m_bgPixmap = _pm;
}

View File

@@ -573,8 +573,11 @@ void projectNotes::alignmentChanged( int _a )
void projectNotes::saveSettings( QDomDocument & _doc, QDomElement & _parent )
{
QDomElement pn_de = _doc.createElement( nodeName() );
mainWindow::saveWidgetState( this, pn_de );
QDomCDATASection ds = _doc.createCDATASection( m_edit->toHtml() );
pn_de.appendChild( ds );
_parent.appendChild( pn_de );
}
@@ -583,6 +586,7 @@ void projectNotes::saveSettings( QDomDocument & _doc, QDomElement & _parent )
void projectNotes::loadSettings( const QDomElement & _this )
{
mainWindow::restoreWidgetState( this, _this );
m_edit->setHtml( _this.text() );
}