I fixed a bug in the patch and added cut functionality.
So here's a new patch.
I will try to make a patch for the undo branche soon.
Is there a active irc?
I'd like to discuss some ideas.
Dave
On 06-03-10 16:49, Sebastian Moors wrote:
Dave Stikkolorum wrote:
I've written a copy paste in the popup of the instrumentlist.
I know that there is a undo branche, maybe can someone
help me out to apply it to that branche?
Hi Dave,
thanks for the Patch! I'm going to try it later!
Thanks,
Sebastian
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Hydrogen-devel mailing list
Hydrogen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel
Index: gui/src/PatternEditor/PatternEditorInstrumentList.h
===================================================================
--- gui/src/PatternEditor/PatternEditorInstrumentList.h (revision 1618)
+++ gui/src/PatternEditor/PatternEditorInstrumentList.h (working copy)
@@ -56,6 +56,9 @@
private slots:
void functionClearNotes();
+ void functionCopyNotes(); //added cut
+ void functionCutNotes(); //added copy
+ void functionPasteNotes(); //added paste
void functionFillAllNotes();
void functionFillEveryTwoNotes();
Index: gui/src/PatternEditor/DrumPatternEditor.h
===================================================================
--- gui/src/PatternEditor/DrumPatternEditor.h (revision 1618)
+++ gui/src/PatternEditor/DrumPatternEditor.h (working copy)
@@ -67,7 +67,9 @@
static QColor computeNoteColor( float );
+ std::multimap <int, H2Core::Note*> tmpPattern;//for remembering copy/paste
+
public slots:
void updateEditor();
Index: gui/src/PatternEditor/PatternEditorInstrumentList.cpp
===================================================================
--- gui/src/PatternEditor/PatternEditorInstrumentList.cpp (revision 1618)
+++ gui/src/PatternEditor/PatternEditorInstrumentList.cpp (working copy)
@@ -88,23 +88,26 @@
- // Popup menu
- m_pFunctionPopup = new QMenu( this );
- m_pFunctionPopup->addAction( trUtf8( "Clear notes" ), this, SLOT( functionClearNotes() ) );
- m_pFunctionPopupSub = new QMenu( trUtf8( "Fill notes ..." ), m_pFunctionPopup );
- m_pFunctionPopupSub->addAction( trUtf8( "Fill all notes" ), this, SLOT( functionFillAllNotes() ) );
- m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/2 notes" ), this, SLOT( functionFillEveryTwoNotes() ) );
- m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/3 notes" ), this, SLOT( functionFillEveryThreeNotes() ) );
- m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/4 notes" ), this, SLOT( functionFillEveryFourNotes() ) );
- m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/6 notes" ), this, SLOT( functionFillEverySixNotes() ) );
- m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/8 notes" ), this, SLOT( functionFillEveryEightNotes() ) );
- m_pFunctionPopup->addMenu( m_pFunctionPopupSub );
- m_pFunctionPopup->addAction( trUtf8( "Randomize velocity" ), this, SLOT( functionRandomizeVelocity() ) );
- m_pFunctionPopup->addSeparator();
- m_pFunctionPopup->addAction( trUtf8( "Delete instrument" ), this, SLOT( functionDeleteInstrument() ) );
+ // Popup menu
+ m_pFunctionPopup = new QMenu( this );
+ m_pFunctionPopup->addAction( trUtf8( "Clear notes" ), this, SLOT( functionClearNotes() ) );
+ m_pFunctionPopup->addAction( trUtf8( "Cut notes" ), this, SLOT( functionCutNotes() ) );
+ m_pFunctionPopup->addAction( trUtf8( "Copy notes" ), this, SLOT( functionCopyNotes() ) );
+ m_pFunctionPopup->addAction( trUtf8( "Paste notes" ), this, SLOT( functionPasteNotes() ) );
+ m_pFunctionPopupSub = new QMenu( trUtf8( "Fill notes ..." ), m_pFunctionPopup );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill all notes" ), this, SLOT( functionFillAllNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/2 notes" ), this, SLOT( functionFillEveryTwoNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/3 notes" ), this, SLOT( functionFillEveryThreeNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/4 notes" ), this, SLOT( functionFillEveryFourNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/6 notes" ), this, SLOT( functionFillEverySixNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/8 notes" ), this, SLOT( functionFillEveryEightNotes() ) );
+ m_pFunctionPopup->addMenu( m_pFunctionPopupSub );
+ m_pFunctionPopup->addAction( trUtf8( "Randomize velocity" ), this, SLOT( functionRandomizeVelocity() ) );
+ m_pFunctionPopup->addSeparator();
+ m_pFunctionPopup->addAction( trUtf8( "Delete instrument" ), this, SLOT( functionDeleteInstrument() ) );
- m_bIsSelected = true;
- setSelected(false);
+ m_bIsSelected = true;
+ setSelected(false);
}
@@ -244,8 +247,66 @@
EventQueue::get_instance()->push_event( EVENT_SELECTED_INSTRUMENT_CHANGED, -1 );
}
+void InstrumentLine::functionCutNotes()
+{
+ functionCopyNotes();
+ functionClearNotes();
+}
+void InstrumentLine::functionCopyNotes()
+{
+ Hydrogen *pEngine = Hydrogen::get_instance();
+ Pattern *pCurrentPattern = getCurrentPattern();
+ int nSelectedInstrument = pEngine->getSelectedInstrumentNumber();
+
+ Song *pSong = pEngine->getSong();
+ Instrument *instrRef = (pSong->get_instrument_list())->get( nSelectedInstrument );
+
+
+ for(std::multimap<int, Note*>::iterator i=pCurrentPattern->note_map.begin();i!=pCurrentPattern->note_map.end();++i){
+ if(i->second->get_instrument()==instrRef){
+ HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.insert(std::make_pair( i->first,i->second ));
+ }
+ }
+
+ for(std::multimap<int, Note*>::iterator j=HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.begin();j!=HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.end();++j){
+ Note *pNote = new Note(j->second);
+ j->second=pNote;
+ j->second->set_instrument(instrRef);
+ }
+}
+
+void InstrumentLine::functionPasteNotes()
+{
+ Hydrogen *pEngine = Hydrogen::get_instance();
+ Pattern *pCurrentPattern = getCurrentPattern();
+ int nSelectedInstrument = pEngine->getSelectedInstrumentNumber();
+
+ AudioEngine::get_instance()->lock( RIGHT_HERE ); // lock the audio engine
+
+ Song *pSong = pEngine->getSong();
+ Instrument *instrRef = (pSong->get_instrument_list())->get( nSelectedInstrument );
+
+ for(std::multimap<int, Note*>::iterator j=HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.begin();j!=HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.end();++j){
+ Note *pNote = new Note(j->second);
+ j->second=pNote;
+ j->second->set_instrument(instrRef);
+ }
+
+ std::multimap<int, Note*>::iterator i=pCurrentPattern->note_map.end();
+ for(std::multimap<int, Note*>::iterator j=HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.begin();j!=HydrogenApp::get_instance()->getPatternEditorPanel()->getDrumPatternEditor()->tmpPattern.end();++j){
+ pCurrentPattern->note_map.insert(i,std::make_pair( j->first,j->second ));
+ i++;
+ }
+
+ AudioEngine::get_instance()->unlock(); // unlock the audio engine
+
+ // this will force an update...
+ EventQueue::get_instance()->push_event( EVENT_SELECTED_INSTRUMENT_CHANGED, -1 );
+
+}
+
void InstrumentLine::functionFillAllNotes(){ functionFillNotes(1); }
void InstrumentLine::functionFillEveryTwoNotes(){ functionFillNotes(2); }
void InstrumentLine::functionFillEveryThreeNotes(){ functionFillNotes(3); }
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Hydrogen-devel mailing list
Hydrogen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel