-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Drop sample on sampletracks #5043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
9d267a8
14819db
3056622
cf8cf8d
94aee14
b25e991
89f8bdd
8873e35
2e718e3
ddbe22d
abf5313
131e8ca
8a4228e
4b66e4c
271a6ed
2fe0775
a520146
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ TrackContainerView::TrackContainerView( TrackContainer * _tc ) : | |
| JournallingObject(), | ||
| SerializingObjectHook(), | ||
| m_currentPosition( 0, 0 ), | ||
| m_timeLineWidgetHeight(0), | ||
| m_tc( _tc ), | ||
| m_trackViews(), | ||
| m_scrollArea( new scrollArea( this ) ), | ||
|
|
@@ -377,18 +378,46 @@ 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 == "samplefile" || type == "pluginpresetfile" | ||
| || type == "soundfontfile" || type == "vstpluginfile" | ||
| || type == "patchfile") | ||
| { | ||
| InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( | ||
| Track::create( Track::InstrumentTrack, | ||
| m_tc ) ); | ||
| PluginFactory::PluginInfoAndKey piakn = | ||
| pluginFactory->pluginSupportingExtension(FileItem::extension(value)); | ||
| Instrument * i = it->loadInstrument(piakn.info.name(), &piakn.key); | ||
| i->loadFile( value ); | ||
| //it->toggledInstrumentTrackButton( true ); | ||
| const TrackView * trackView = trackViewAt(_de->pos().y() - m_timeLineWidgetHeight); | ||
| //if we drop on a sample track, add sample TCO to it | ||
| if (type == "samplefile" && trackView && trackView->getTrack()->type() == Track::SampleTrack) | ||
| { | ||
| for (auto tv : trackViews()) | ||
| { | ||
| if (tv == trackView) | ||
| { | ||
| 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; | ||
|
|
||
| int xPos = _de->pos().x() < trackHeadWidth | ||
| ? trackHeadWidth | ||
| : _de->pos().x(); | ||
|
|
||
| SampleTCO * newTco = new SampleTCO(tv->getTrack()); | ||
| newTco->setSampleFile(value); | ||
| newTco->movePosition(fixedTCOs() == false | ||
| ? MidiTime((xPos - trackHeadWidth) / pixelsPerTact() | ||
| * MidiTime::ticksPerTact()).toNearestTact() | ||
| : MidiTime(0) | ||
| ); | ||
| } | ||
| } | ||
| } | ||
PhysSong marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else | ||
| { | ||
| InstrumentTrack * it = dynamic_cast<InstrumentTrack *>( | ||
|
||
| Track::create(Track::InstrumentTrack, | ||
| m_tc)); | ||
| PluginFactory::PluginInfoAndKey piakn = | ||
| pluginFactory->pluginSupportingExtension(FileItem::extension(value)); | ||
| Instrument * i = it->loadInstrument(piakn.info.name(), &piakn.key); | ||
| i->loadFile(value); | ||
| } | ||
| _de->accept(); | ||
| } | ||
| else if( type == "presetfile" ) | ||
|
|
@@ -474,6 +503,9 @@ void TrackContainerView::resizeEvent( QResizeEvent * _re ) | |
| QWidget::resizeEvent( _re ); | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| RubberBand *TrackContainerView::rubberBand() const | ||
| { | ||
| return m_rubberBand; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,7 @@ SongEditor::SongEditor( Song * song ) : | |
| this, SLOT( selectRegionFromPixels( int, int ) ) ); | ||
| connect( m_timeLine, SIGNAL( selectionFinished() ), | ||
| this, SLOT( stopRubberBand() ) ); | ||
| connect(m_timeLine, SIGNAL(sizeChanged()), this, SLOT(timeLineHeigthChanged())); | ||
|
|
||
| m_positionLine = new positionLine( this ); | ||
| static_cast<QVBoxLayout *>( layout() )->insertWidget( 1, m_timeLine ); | ||
|
|
@@ -625,6 +626,14 @@ void SongEditor::zoomingChanged() | |
|
|
||
|
|
||
|
|
||
| void SongEditor::timeLineHeigthChanged() | ||
|
||
| { | ||
| m_timeLineWidgetHeight = m_timeLine->height(); | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| void SongEditor::selectAllTcos( bool select ) | ||
| { | ||
| QVector<selectableObject *> so = select ? rubberBand()->selectableObjects() : rubberBand()->selectedObjects(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to use the Track::createTCO function instead.