singerbot, automation editor and other improvements

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@462 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-02-25 19:12:26 +00:00
parent d5112c748a
commit deeca75b1f
17 changed files with 352 additions and 307 deletions

View File

@@ -4,7 +4,7 @@
* automation_editor.cpp - implementation of automationEditor which is used for
* actual setting of dynamic values
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -661,7 +661,7 @@ void automationEditor::updatePaintPixmap( void )
// setup selection-vars
int sel_pos_start = m_selectStartTact64th;
int sel_pos_end = m_selectStartTact64th+m_selectedTact64th;
int sel_pos_end = m_selectStartTact64th + m_selectedTact64th;
if( sel_pos_start > sel_pos_end )
{
qSwap<int>( sel_pos_start, sel_pos_end );
@@ -731,9 +731,8 @@ void automationEditor::updatePaintPixmap( void )
// selection because the user moved it...
if( m_editMode == MOVE )
{
if( qFind( m_selValuesForMove.begin(),
m_selValuesForMove.end(), *it )
!= m_selValuesForMove.end() )
if( m_selValuesForMove.contains(
it.key() ) )
{
is_selected = TRUE;
}
@@ -1439,18 +1438,24 @@ void automationEditor::mouseMoveEvent( QMouseEvent * _me )
for( timeMap::iterator it = m_selValuesForMove.begin();
it != m_selValuesForMove.end(); ++it )
{
int value_tact = ( -it.key() >> 6 ) + tact_diff;
int value_tact_64th = ( -it.key() & 63 ) +
tact_64th_diff;
// ensure value_tact_64th range
if( value_tact_64th >> 6 )
midiTime new_value_pos;
if( -it.key() )
{
value_tact += value_tact_64th >> 6;
value_tact_64th &= 63;
}
m_pattern->removeValue( -it.key() );
midiTime new_value_pos( value_tact,
int value_tact = ( -it.key() >> 6 )
+ tact_diff;
int value_tact_64th = ( -it.key() & 63 )
+ tact_64th_diff;
// ensure value_tact_64th range
if( value_tact_64th >> 6 )
{
value_tact += value_tact_64th
>> 6;
value_tact_64th &= 63;
}
m_pattern->removeValue( -it.key() );
new_value_pos = midiTime( value_tact,
value_tact_64th );
}
#ifdef QT3
new_selValuesForMove[
-m_pattern->putValue( new_value_pos,
@@ -1896,51 +1901,41 @@ void automationEditor::selectAll( void )
return;
}
//TODO: Add constant
int len_tact_64th = 4;
timeMap & time_map = m_pattern->getTimeMap();
// if first_time = TRUE, we HAVE to set the vars for select
bool first_time = TRUE;
timeMap::iterator it = time_map.begin();
m_selectStartTact64th = 0;
m_selectedTact64th = -it.key() + len_tact_64th;
#ifdef QT3
m_selectStartLevel = it.data();
#else
m_selectStartLevel = it.value();
#endif
m_selectedLevels = 1;
for( timeMap::iterator it = time_map.begin(); it != time_map.end();
++it )
while( ++it != time_map.end() )
{
//TODO: Add constant
Uint32 len_tact_64th = 4;
#ifdef QT3
const int level = it.data();
#else
const int level = it.value();
#endif
Uint32 pos_tact_64th = -it.key();
if( level <= m_selectStartLevel || first_time )
if( level < m_selectStartLevel )
{
// if we move start-level down, we have to add
// the difference between old and new start-level
// to m_selectedLevels, otherwise the selection
// is just moved down...
int diff = m_selectStartLevel - ( level - 1 );
m_selectStartLevel = level - 1;
m_selectedLevels += diff;
m_selectedLevels += m_selectStartLevel - level;
m_selectStartLevel = level;
}
if( level >= m_selectedLevels + m_selectStartLevel
|| first_time )
else if( level >= m_selectStartLevel + m_selectedLevels )
{
m_selectedLevels = level - m_selectStartLevel;
m_selectedLevels = level - m_selectStartLevel + 1;
}
if( pos_tact_64th < m_selectStartTact64th || first_time )
{
m_selectStartTact64th = pos_tact_64th;
}
if( pos_tact_64th + len_tact_64th >
m_selectStartTact64th + m_selectedTact64th ||
first_time )
{
m_selectedTact64th = pos_tact_64th + len_tact_64th -
m_selectStartTact64th;
}
first_time = FALSE;
}
}

View File

@@ -3,7 +3,7 @@
/*
* effect_select_dialog.cpp - dialog to choose effect plugin
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -34,8 +34,10 @@
#else
#include <qgroupbox.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qvbox.h>
#endif
@@ -165,9 +167,7 @@ void effectSelectDialog::selectPlugin( void )
effectList::effectList( QWidget * _parent, engine * _engine ) :
QWidget( _parent ),
engineObject( _engine ),
m_descriptionWidgetParent( new QWidget( this ) ),
m_descriptionWidget( NULL )
engineObject( _engine )
{
plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
@@ -214,13 +214,26 @@ effectList::effectList( QWidget * _parent, engine * _engine ) :
SLOT( onHighlighted( int ) ) );
connect( m_pluginList, SIGNAL( doubleClicked( QListBoxItem * ) ),
SLOT( onDoubleClicked( QListBoxItem * ) ) );
#ifndef QT3
QGroupBox * groupbox = new QGroupBox( tr( "Description" ), this );
#else
QGroupBox * groupbox = new QGroupBox( 1, Qt::Vertical,
tr( "Description" ), this );
#endif
groupbox->setFixedHeight( 200 );
groupbox->setInsideMargin( 2 );
QScrollView * scrollView = new QScrollView( groupbox );
scrollView->setFrameStyle( 0 );
scrollView->setMargin( 10 );
m_descriptionWidget = new QVBox( scrollView->viewport() );
scrollView->addChild( m_descriptionWidget );
QVBoxLayout * vboxl = new QVBoxLayout( this );
vboxl->setMargin( 0 );
vboxl->setSpacing( 10 );
vboxl->addWidget( m_pluginList );
vboxl->addWidget( m_descriptionWidgetParent );
new QVBoxLayout( m_descriptionWidgetParent );
vboxl->addWidget( groupbox );
if( m_pluginList->numRows() > 0 )
{
@@ -241,22 +254,20 @@ effectList::~effectList()
void effectList::onHighlighted( int _pluginIndex )
{
QLayoutIterator it = m_descriptionWidget->layout()->iterator();
while( it.current() )
{
it.deleteCurrent();
}
m_descriptionWidget->hide();
m_currentSelection = m_effectKeys[_pluginIndex];
delete m_descriptionWidget;
m_descriptionWidget = NULL;
if( m_currentSelection.desc &&
m_currentSelection.desc->sub_plugin_features )
{
m_descriptionWidget = m_currentSelection.desc->
sub_plugin_features->
createDescriptionWidget( m_descriptionWidgetParent,
m_currentSelection.desc->sub_plugin_features->
fillDescriptionWidget( m_descriptionWidget,
eng(), m_currentSelection );
}
if( m_descriptionWidget != NULL )
{
dynamic_cast<QVBoxLayout *>(
m_descriptionWidgetParent->layout() )->
addWidget( m_descriptionWidget );
m_descriptionWidget->show();
}
emit( highlighted( m_currentSelection ) );
@@ -280,6 +291,15 @@ void effectList::onAddButtonReleased()
void effectList::resizeEvent( QResizeEvent * )
{
m_descriptionWidget->setFixedWidth( width() - 40 );
}
#include "effect_select_dialog.moc"
#endif

View File

@@ -4,7 +4,7 @@
* piano_roll.cpp - implementation of piano-roll which is used for actual
* writing of melodies
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -2368,9 +2368,9 @@ void pianoRoll::selectAll( void )
// the difference between old and new start-key
// to m_selectedKeys, otherwise the selection
// is just moved down...
int diff = m_selectStartKey - ( key - 1 );
m_selectedKeys += m_selectStartKey
- ( key - 1 );
m_selectStartKey = key - 1;
m_selectedKeys += diff;
}
if( key >= m_selectedKeys+m_selectStartKey ||
first_time )

View File

@@ -963,7 +963,6 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start,
|| dynamic_cast<pattern *>( tco )->empty() ) )
{
sendMidiTime( _start );
emit sentMidiTime( _start );
}
}
else
@@ -972,8 +971,8 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start,
_frames / frames_per_tact64th ) );
bb_track = NULL;
sendMidiTime( _start );
emit sentMidiTime( _start );
}
emit sentMidiTime( _start );
if ( tcos.size() == 0 )
{