Load/save automationPattern position. Allow dragging autoViews directly onto automationTrack
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1204 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -227,6 +227,8 @@ float automationPattern::valueAt( const midiTime & _time )
|
||||
|
||||
void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "pos", startPosition() );
|
||||
|
||||
for( timeMap::const_iterator it = m_timeMap.begin();
|
||||
it != m_timeMap.end(); ++it )
|
||||
{
|
||||
@@ -251,7 +253,7 @@ void automationPattern::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
clear();
|
||||
|
||||
// m_objects.clear();
|
||||
movePosition( _this.attribute( "pos" ).toInt() );
|
||||
|
||||
for( QDomNode node = _this.firstChild(); !node.isNull();
|
||||
node = node.nextSibling() )
|
||||
@@ -630,20 +632,12 @@ void automationPatternView::paintEvent( QPaintEvent * )
|
||||
p.translate( 0.0f, max * height() / y_scale-1 );
|
||||
p.scale( 1.0f, -h );
|
||||
|
||||
//QLinearGradient lin2grad( 0, min, 0, max );
|
||||
QLinearGradient lin2grad( 0, min, 0, max );
|
||||
const QColor cl = QColor( 255, 224, 0 );
|
||||
const QColor cd = QColor( 229, 158, 0 );
|
||||
//lingrad.setColorAt( min, c );
|
||||
|
||||
lin2grad.setColorAt( 1, cl );
|
||||
|
||||
/* if( min < 0 ) {
|
||||
lin2grad.setColorAt( -min/y_scale, Qt::black );
|
||||
lin2grad.setColorAt( 0, k );
|
||||
}
|
||||
else {*/
|
||||
lin2grad.setColorAt( 0, cd );
|
||||
// }
|
||||
lin2grad.setColorAt( 0, cd );
|
||||
|
||||
for( automationPattern::timeMap::const_iterator it =
|
||||
m_pat->getTimeMap().begin();
|
||||
@@ -661,7 +655,7 @@ void automationPatternView::paintEvent( QPaintEvent * )
|
||||
x2 = width() - TCO_BORDER_WIDTH;
|
||||
}
|
||||
p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ),
|
||||
lin2grad /*QColor( 255, 224, 0 )*/ );
|
||||
lin2grad );
|
||||
}
|
||||
|
||||
p.resetMatrix();
|
||||
|
||||
@@ -81,13 +81,11 @@ void peakController::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
void peakController::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
printf("peakController loadSettings\n");
|
||||
int effectId = _this.attribute( "effectId" ).toInt();
|
||||
|
||||
peakControllerEffectVector::iterator i;
|
||||
for( i = s_effects.begin(); i != s_effects.end(); ++i )
|
||||
{
|
||||
printf( "%d %d\n", (*i)->m_effectId , effectId );
|
||||
if( (*i)->m_effectId == effectId )
|
||||
{
|
||||
if( (*i)->m_effectId == effectId )
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
#include "automation_pattern.h"
|
||||
#include "embed.h"
|
||||
#include "name_label.h"
|
||||
|
||||
|
||||
|
||||
#include "string_pair_drag.h"
|
||||
#include "project_journal.h"
|
||||
#include "track_container_view.h"
|
||||
|
||||
automationTrack::automationTrack( trackContainer * _tc, bool _hidden ) :
|
||||
track( _hidden ? HiddenAutomationTrack : AutomationTrack, _tc )
|
||||
@@ -126,6 +126,39 @@ automationTrackView::~automationTrackView()
|
||||
{
|
||||
}
|
||||
|
||||
void automationTrackView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
stringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automationTrackView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
QString type = stringPairDrag::decodeKey( _de );
|
||||
QString val = stringPairDrag::decodeValue( _de );
|
||||
if( type == "automatable_model" )
|
||||
{
|
||||
automatableModel * mod = dynamic_cast<automatableModel *>(
|
||||
engine::getProjectJournal()->
|
||||
getJournallingObject( val.toInt() ) );
|
||||
if( mod != NULL )
|
||||
{
|
||||
midiTime pos = midiTime( getTrackContainerView()->currentPosition()
|
||||
+ ( _de->pos().x() - getTrackContentWidget()->x() ) * midiTime::ticksPerTact() /
|
||||
static_cast<int>( getTrackContainerView()->pixelsPerTact() ) )
|
||||
.toNearestTact();
|
||||
|
||||
trackContentObject * tco = getTrack()->createTCO( pos );
|
||||
automationPattern * pat = dynamic_cast< automationPattern *>( tco );
|
||||
pat->addObject( mod );
|
||||
pat->movePosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user