Skip to content
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

Fixed inverted zooming. #3570

Merged
merged 2 commits into from
Jun 10, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 13 additions & 13 deletions src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ QPixmap * AutomationEditor::s_toolYFlip = NULL;
QPixmap * AutomationEditor::s_toolXFlip = NULL;

const QVector<double> AutomationEditor::m_zoomXLevels =
{ 8.0f, 4.0f, 2.0f, 1.0f, 0.5f, 0.25f, 0.125f };
{ 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f };



Expand Down Expand Up @@ -1303,7 +1303,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
//Don't bother doing/rendering anything if there is no automation points
if( time_map.size() > 0 )
{
timeMap::iterator it = time_map.begin();
timeMap::iterator it = time_map.begin();
while( it+1 != time_map.end() )
{
// skip this section if it occurs completely before the
Expand All @@ -1320,7 +1320,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
{
break;
}

//NEEDS Change in CSS
/*bool is_selected = false;
// if we're in move-mode, we may only draw
Expand Down Expand Up @@ -1360,8 +1360,8 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
for( int i = 0; i < ( it + 1 ).key() - it.key(); i++ )
{ path.lineTo( QPointF( xCoordOfTick( it.key() + i ), yCoordOfLevel( values[i] ) ) );
//NEEDS Change in CSS
//drawLevelTick( p, it.key() + i, values[i], is_selected );
//drawLevelTick( p, it.key() + i, values[i], is_selected );

}
path.lineTo( QPointF( xCoordOfTick( ( it + 1 ).key() ), yCoordOfLevel( nextValue ) ) );
path.lineTo( QPointF( xCoordOfTick( ( it + 1 ).key() ), yCoordOfLevel( 0 ) ) );
Expand Down Expand Up @@ -1537,12 +1537,12 @@ void AutomationEditor::drawLevelTick(QPainter & p, int tick, float value)

p.fillRect( x, y_start, rect_width, rect_height, currentColor );
}

else
{
printf("not in range\n");
}

}


Expand Down Expand Up @@ -1600,12 +1600,12 @@ void AutomationEditor::wheelEvent(QWheelEvent * we )
{
y++;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
y--;
}
y = qBound( 0, y, m_zoomingYModel.size() - 1 );
m_zoomingYModel.setValue( y );
m_zoomingYModel.setValue( y );
}
else if( we->modifiers() & Qt::ControlModifier && we->modifiers() & Qt::AltModifier )
{
Expand All @@ -1614,7 +1614,7 @@ void AutomationEditor::wheelEvent(QWheelEvent * we )
{
q--;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
q++;
}
Expand All @@ -1627,11 +1627,11 @@ void AutomationEditor::wheelEvent(QWheelEvent * we )
int x = m_zoomingXModel.value();
if( we->delta() > 0 )
{
x--;
x++;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
x++;
x--;
}
x = qBound( 0, x, m_zoomingXModel.size() - 1 );
m_zoomingXModel.setValue( x );
Expand Down
30 changes: 15 additions & 15 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ PianoRoll::PianoRollKeyTypes PianoRoll::prKeyOrder[] =
const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DefaultStepsPerTact;

const QVector<double> PianoRoll::m_zoomLevels =
{ 8.0f, 4.0f, 2.0f, 1.0f, 0.5f, 0.25f, 0.125f };
{ 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f };


PianoRoll::PianoRoll() :
Expand Down Expand Up @@ -805,7 +805,7 @@ void PianoRoll::setBackgroundShade( const QColor & c )



void PianoRoll::drawNoteRect( QPainter & p, int x, int y,
void PianoRoll::drawNoteRect( QPainter & p, int x, int y,
int width, const Note * n, const QColor & noteCol,
const QColor & selCol, const int noteOpc, const bool borders )
{
Expand Down Expand Up @@ -1917,7 +1917,7 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * me )
{
// select the notes within the selection rectangle and
// then destroy the selection rectangle
computeSelectedNotes(
computeSelectedNotes(
me->modifiers() & Qt::ShiftModifier );
}
else if( m_action == ActionMoveNote )
Expand Down Expand Up @@ -2462,15 +2462,15 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl )
}
}
}
}
}
else if (m_action == ActionResizeNote)
{
// When resizing notes:
// If shift is not pressed, resize the selected notes but do not rearrange them
// If shift is pressed we resize and rearrange only the selected notes
// If shift + ctrl then we also rearrange all posterior notes (sticky)
// If shift is pressed but only one note is selected, apply sticky

if (shift)
{
// Algorithm:
Expand All @@ -2490,8 +2490,8 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl )
const Note *posteriorNote = nullptr;
for (const Note *note : notes)
{
if (note->selected() && (posteriorNote == nullptr ||
note->oldPos().getTicks() + note->oldLength().getTicks() >
if (note->selected() && (posteriorNote == nullptr ||
note->oldPos().getTicks() + note->oldLength().getTicks() >
posteriorNote->oldPos().getTicks() + posteriorNote->oldLength().getTicks()))
{
posteriorNote = note;
Expand All @@ -2511,9 +2511,9 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl )
if(note->selected())
{
// scale relative start and end positions by scaleFactor
int newStart = stretchStartTick + scaleFactor *
int newStart = stretchStartTick + scaleFactor *
(note->oldPos().getTicks() - stretchStartTick);
int newEnd = stretchStartTick + scaleFactor *
int newEnd = stretchStartTick + scaleFactor *
(note->oldPos().getTicks()+note->oldLength().getTicks() - stretchStartTick);
// if not holding alt, quantize the offsets
if(!alt)
Expand All @@ -2532,7 +2532,7 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl )
int newLength = qMax(1, newEnd-newStart);
if (note == posteriorNote)
{
posteriorDeltaThisFrame = (newStart+newLength) -
posteriorDeltaThisFrame = (newStart+newLength) -
(note->pos().getTicks() + note->length().getTicks());
}
note->setLength( MidiTime(newLength) );
Expand Down Expand Up @@ -3255,7 +3255,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we )
{
q--;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
q++;
}
Expand All @@ -3269,7 +3269,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we )
{
l--;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
l++;
}
Expand All @@ -3281,11 +3281,11 @@ void PianoRoll::wheelEvent(QWheelEvent * we )
int z = m_zoomingModel.value();
if( we->delta() > 0 )
{
z--;
z++;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
z++;
z--;
}
z = qBound( 0, z, m_zoomingModel.size() - 1 );
// update combobox with zooming-factor
Expand Down
8 changes: 4 additions & 4 deletions src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void positionLine::paintEvent( QPaintEvent * pe )
}

const QVector<double> SongEditor::m_zoomLevels =
{ 16.0f, 8.0f, 4.0f, 2.0f, 1.0f, 0.5f, 0.25f, 0.125f };
{ 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f, 16.0f };


SongEditor::SongEditor( Song * song ) :
Expand Down Expand Up @@ -361,11 +361,11 @@ void SongEditor::wheelEvent( QWheelEvent * we )

if( we->delta() > 0 )
{
z--;
z++;
}
if( we->delta() < 0 )
else if( we->delta() < 0 )
{
z++;
z--;
}
z = qBound( 0, z, m_zoomingModel->size() - 1 );
// update combobox with zooming-factor
Expand Down