copy/paste selection support in piano roll

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1855 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Andrew Kelley
2008-11-29 00:15:18 +00:00
parent cb308e3d59
commit 49a00ac211
4 changed files with 28 additions and 36 deletions

View File

@@ -1,3 +1,11 @@
2008-11-28 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/gui/piano_roll.cpp:
* src/core/note.cpp:
copy/paste selection support
* TODO:
added a bunch
2008-11-28 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/mmp.h:

8
TODO
View File

@@ -51,6 +51,7 @@
- add FLAC as export-format?
Andrew Kelley's todo:
- when you draw a note, if there's a selection it should clear it
- piano roll, copy and paste notes
- remove the move tool, it's irrelevant now
- holding control and shift shouldn't bring up the automation window
@@ -59,12 +60,15 @@ Andrew Kelley's todo:
- moving a group of notes shouldn't crunch them together if brought to boundary conditions
- moving a group with an unquantized note will quantize that note when you move the selection (this is bad)
- undo/redo for piano roll
- when you clone a track in the song editor, rename the track so that it doesn't have the same name (increment the number if necessary)
- doing actions on the piano roll when LMMS doesn't have focus is glitchy
- somehow enable easy pattern copy pasting in the beat+bassline editor
- make knobs easier to tune (less sensitive)
- make copy/paste work beyond inside piano roll - it didn't work when I copied notes from one pattern and then opened another pattern and pasted.
- make it so you can see the notes when putting a pattern in the playlist
- make the menu for a channel happen when you right click, instead of renaming, and make the midi input a top-level menu item
- segfault on quit
- recording automation
- dragging a note below the automation level messes up dragging it's weird and glitchy fix it
- adding/removing steps to the beat+bassline editor is awkward
- the 'add beat+bassline' button in the beat+bassline editor is misleading - I say we remove it and rely on the song editor to add beat+basslines

View File

@@ -69,9 +69,9 @@ note::note( const note & _note ) :
m_volume( _note.m_volume ),
m_panning( _note.m_panning ),
m_length( _note.m_length ),
m_pos( _note.m_pos )
m_pos( _note.m_pos ),
m_selected( _note.m_selected )
{
setSelected( false );
m_detuning = sharedObject::ref( _note.m_detuning );
}

View File

@@ -2722,39 +2722,14 @@ void pianoRoll::getSelectedNotes( noteVector & _selected_notes )
return;
}
int sel_pos_start = m_selectStartTick;
int sel_pos_end = sel_pos_start + m_selectedTick;
if( sel_pos_start > sel_pos_end )
{
qSwap<int>( sel_pos_start, sel_pos_end );
}
int sel_key_start = m_selectStartKey;
int sel_key_end = sel_key_start + m_selectedKeys;
if( sel_key_start > sel_key_end )
{
qSwap<int>( sel_key_start, sel_key_end );
}
const noteVector & notes = m_pattern->notes();
for( noteVector::const_iterator it = notes.begin(); it != notes.end();
++it )
{
Sint32 len_ticks = ( *it )->length();
if( len_ticks > 0 )
if( ( *it )->getSelected() )
{
int key = ( *it )->key();
Sint32 pos_ticks = ( *it )->pos();
if( key > sel_key_start &&
key <= sel_key_end &&
pos_ticks >= sel_pos_start &&
pos_ticks+len_ticks <= sel_pos_end )
{
_selected_notes.push_back( *it );
}
_selected_notes.push_back( *it );
}
}
}
@@ -2794,11 +2769,6 @@ void pianoRoll::copySelectedNotes( void )
if( selected_notes.empty() == false )
{
copy_to_clipboard( selected_notes );
textFloat::displayMessage( tr( "Notes copied" ),
tr( "All selected notes were copied to the "
"clipboard." ),
embed::getIconPixmap( "edit_copy" ), 2000 );
}
}
@@ -2854,11 +2824,21 @@ void pianoRoll::pasteNotes( void )
QDomNodeList list = mmp.elementsByTagName(
note::classNodeName() );
// remove selection and select the newly pasted notes
clearSelectedNotes();
for( int i = 0; !list.item( i ).isNull(); ++i )
{
// create the note
note cur_note;
cur_note.restoreState( list.item( i ).toElement() );
cur_note.setPos( cur_note.pos() + m_timeLine->pos() );
// select it
cur_note.setSelected( true );
// add to pattern
m_pattern->addNote( cur_note );
}