Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/TrackContainerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <QThread>

#include "Track.h"
#include "SampleTrack.h"
#include "JournallingObject.h"
#include "InstrumentTrack.h"

Expand Down Expand Up @@ -152,6 +153,7 @@ public slots:
virtual void resizeEvent( QResizeEvent * );

MidiTime m_currentPosition;
int m_timeLineWidgetHeigth;


private:
Expand All @@ -176,6 +178,7 @@ public slots:
} ;
friend class TrackContainerView::scrollArea;

void addSampleTCO(Track * track, QString sampleFile, int xPos);
TrackContainer* m_tc;
typedef QList<TrackView *> trackViewList;
trackViewList m_trackViews;
Expand Down
50 changes: 47 additions & 3 deletions src/gui/TrackContainerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ TrackContainerView::TrackContainerView( TrackContainer * _tc ) :
JournallingObject(),
SerializingObjectHook(),
m_currentPosition( 0, 0 ),
m_timeLineWidgetHeigth(0),
m_tc( _tc ),
m_trackViews(),
m_scrollArea( new scrollArea( this ) ),
Expand Down Expand Up @@ -377,9 +378,10 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
//it->toggledInstrumentTrackButton( true );
_de->accept();
}
else if( type == "samplefile" || type == "pluginpresetfile"
|| type == "soundfontfile" || type == "vstpluginfile"
|| type == "patchfile" )
else if(type == "pluginpresetfile"
|| type == "soundfontfile"
|| type == "vstpluginfile"
|| type == "patchfile")
{
InstrumentTrack * it = dynamic_cast<InstrumentTrack *>(
Track::create( Track::InstrumentTrack,
Expand All @@ -391,6 +393,28 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
//it->toggledInstrumentTrackButton( true );
_de->accept();
}
else if(type == "samplefile")
{
const TrackView * trackView = trackViewAt(_de->pos().y() - m_timeLineWidgetHeigth);
if (trackView && trackView->getTrack()->type() == Track::SampleTrack)
{
for (auto tv : trackViews())
{
if (tv == trackView)
{
addSampleTCO(tv->getTrack(), value, _de->pos().x());
}
}
}
else
{
Track * track = Track::create(Track::SampleTrack, m_tc);
if (track)
{
addSampleTCO(track, value, _de->pos().x());
}
}
}
else if( type == "presetfile" )
{
DataFile dataFile( value );
Expand Down Expand Up @@ -474,6 +498,26 @@ void TrackContainerView::resizeEvent( QResizeEvent * _re )
QWidget::resizeEvent( _re );
}




void TrackContainerView::addSampleTCO(Track *track, QString sampleFile, int xPos)
{
int trackHeadWidth = ConfigManager::inst()->value("ui", "compacttrackbuttons").toInt()==1
? DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT + TRACK_OP_WIDTH_COMPACT
: DEFAULT_SETTINGS_WIDGET_WIDTH + TRACK_OP_WIDTH;
SampleTCO * newTco = new SampleTCO(track);
newTco->setSampleFile(sampleFile);
newTco->movePosition(fixedTCOs() == false
? MidiTime((xPos - trackHeadWidth) / pixelsPerTact()
* MidiTime::ticksPerTact()).toNearestTact()
: MidiTime(0)
);
}




RubberBand *TrackContainerView::rubberBand() const
{
return m_rubberBand;
Expand Down
1 change: 1 addition & 0 deletions src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ static inline void animateScroll( QScrollBar *scrollBar, int newVal, bool smooth

void SongEditor::updatePosition( const MidiTime & t )
{
m_timeLineWidgetHeigth = m_timeLine->height();
int widgetWidth, trackOpWidth;
if( ConfigManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() )
{
Expand Down