can select notes even if you can't see them

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1892 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Andrew Kelley
2008-12-08 21:48:54 +00:00
parent cbe50bf6ef
commit 5f89e203f0
3 changed files with 16 additions and 29 deletions

View File

@@ -9,8 +9,9 @@
2008-12-08 Andrew Kelley <superjoe30/at/gmail/dot/com>
* src/gui/piano_roll.cpp:
ability to scroll left and right while using ctrl to select notes
disabled volume bar changes while dragging a selection
- ability to scroll left and right while using ctrl to select notes
- disabled volume bar changes while dragging a selection
- can select notes even if you can't see them
2008-12-08 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>

2
TODO
View File

@@ -77,4 +77,4 @@ Andrew Kelley's todo:
- make it so that 3xosc notes don't max out
- implement note detuning (used to be ctrl+click to access note detuning) (need some other intuitive way to access note detuning as ctrl, shift, and alt are all being used)
- make the horizontal mouse wheel do the same thing as shift+vertical mouse wheel
- copy-pasted automation patterns have to be manually linked back to their knob for some reason

View File

@@ -1433,10 +1433,6 @@ void pianoRoll::computeSelectedNotes(bool shift)
{
const noteVector & notes = m_pattern->notes();
const int visible_keys = ( height() - PR_TOP_MARGIN -
PR_BOTTOM_MARGIN - m_notesEditHeight ) /
KEY_LINE_HEIGHT + 2;
QPolygon volumeHandles;
for( noteVector::const_iterator it = notes.begin();
@@ -1467,25 +1463,14 @@ void pianoRoll::computeSelectedNotes(bool shift)
midiTime::ticksPerTact();
const int x = ( pos_ticks - m_currentPosition ) *
m_ppt / midiTime::ticksPerTact();
// skip this note if not in visible area at all
if( !( x + note_width >= 0 &&
x <= width() - WHITE_KEY_WIDTH ) )
{
continue;
}
// is the note in visible area?
if( key > 0 && key <= visible_keys )
{
// if the selection even barely overlaps the note
if( key > sel_key_start &&
key <= sel_key_end &&
pos_ticks + len_ticks > sel_pos_start &&
pos_ticks < sel_pos_end )
{
( *it )->setSelected( true );
}
// if the selection even barely overlaps the note
if( key > sel_key_start &&
key <= sel_key_end &&
pos_ticks + len_ticks > sel_pos_start &&
pos_ticks < sel_pos_end )
{
( *it )->setSelected( true );
}
}
}
@@ -1572,7 +1557,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
return;
}
if( _me->y() > PR_TOP_MARGIN )
if( _me->y() > PR_TOP_MARGIN || m_action != ActionNone )
{
bool edit_note = ( _me->y() >
height() - PR_BOTTOM_MARGIN - m_notesEditHeight )
@@ -1580,6 +1565,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
int key_num = getKey( _me->y() );
printf("keynum = %i\n", key_num);
int x = _me->x();
// is the calculated key different from current key?
@@ -1607,7 +1593,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
midiTime() );
}
}
if( x < WHITE_KEY_WIDTH )
if( x < WHITE_KEY_WIDTH && m_action == ActionNone )
{
update();
return;
@@ -1827,7 +1813,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
// change size of selection
if( x < 0 && m_currentPosition > 0 )
/*if( x < 0 && m_currentPosition > 0 )
{
x = 0;
QCursor::setPos( mapToGlobal( QPoint(
@@ -1850,7 +1836,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
_me->y() ) ) );
m_leftRightScroll->setValue( m_currentPosition +
4 );
}
}*/
// get tick in which the cursor is posated
int pos_ticks = x * midiTime::ticksPerTact() / m_ppt +