Highlight the currently selected instrument/automation patterns in the song editor

This commit is contained in:
Vesa
2014-03-12 07:14:29 +02:00
parent 288a3162c5
commit ba7e5e5f5c
4 changed files with 222 additions and 202 deletions

View File

@@ -24,8 +24,8 @@
*
*/
#ifndef _PIANO_ROLL_H
#define _PIANO_ROLL_H
#ifndef PIANO_ROLL_H
#define PIANO_ROLL_H
#include <QtGui/QWidget>
@@ -147,6 +147,7 @@ protected slots:
signals:
void currentPatternChanged();
void semiToneMarkerMenuScaleSetEnabled(bool);
void semiToneMarkerMenuChordSetEnabled(bool);
@@ -169,7 +170,7 @@ private:
ActionChangeNoteProperty,
ActionResizeNoteEditArea
};
enum noteEditMode
{
NoteEditVolume,
@@ -205,7 +206,7 @@ private:
void autoScroll( const MidiTime & _t );
MidiTime newNoteLen() const;
void shiftPos(int amount);
void shiftSemiTone(int amount);
bool isSelection() const;
@@ -213,19 +214,19 @@ private:
void testPlayNote( note * n );
void testPlayKey( int _key, int _vol, int _pan );
void pauseTestNotes( bool _pause = true );
inline int noteEditTop() const;
inline int keyAreaBottom() const;
inline int noteEditBottom() const;
inline int keyAreaTop() const;
inline int noteEditRight() const;
inline int noteEditLeft() const;
void dragNotes( int x, int y, bool alt, bool shift );
static const int cm_scrollAmtHoriz = 10;
static const int cm_scrollAmtVert = 1;
static QPixmap * s_whiteKeyBigPm;
static QPixmap * s_whiteKeyBigPressedPm;
static QPixmap * s_whiteKeySmallPm;
@@ -252,7 +253,7 @@ private:
toolButton * m_eraseButton;
toolButton * m_selectButton;
toolButton * m_detuneButton;
toolButton * m_cutButton;
toolButton * m_copyButton;
toolButton * m_pasteButton;
@@ -287,22 +288,22 @@ private:
int m_selectedTick;
int m_selectStartKey;
int m_selectedKeys;
// boundary box around all selected notes when dragging
int m_moveBoundaryLeft;
int m_moveBoundaryTop;
int m_moveBoundaryRight;
int m_moveBoundaryBottom;
// remember where the scrolling started when dragging so that
// we can handle dragging while scrolling with arrow keys
int m_mouseDownKey;
int m_mouseDownTick;
// remember the last x and y of a mouse movement
int m_lastMouseX;
int m_lastMouseY;
// x,y of when the user starts a drag
int m_moveStartX;
int m_moveStartY;
@@ -312,7 +313,7 @@ private:
int m_ppt;
int m_totalKeysToScroll;
// remember these values to use them
// remember these values to use them
// for the next note that is set
MidiTime m_lenOfNewNotes;
volume_t m_lastNoteVolume;
@@ -323,7 +324,7 @@ private:
editModes m_editMode;
editModes m_ctrlMode; // mode they were in before they hit ctrl
bool m_mouseDownLeft; //true if left click is being held down
bool m_mouseDownRight; //true if right click is being held down
@@ -337,7 +338,7 @@ private:
note * noteUnderMouse();
// turn a selection rectangle into selected notes
void computeSelectedNotes( bool shift );
void computeSelectedNotes( bool shift );
void clearSelectedNotes();
friend class engine;

View File

@@ -48,6 +48,8 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
{
connect( m_pat, SIGNAL( dataChanged() ),
this, SLOT( update() ) );
connect( engine::automationEditor(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );
setAttribute( Qt::WA_OpaquePaintEvent, true );
setFixedHeight( parentWidget()->height() - 2 );
@@ -228,11 +230,17 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
lingrad.setColorAt( 0, c );
p.setBrush( lingrad );
p.setPen( c.lighter( 160 ) );
if( engine::automationEditor()->currentPattern() == m_pat )
p.setPen( c.lighter( 160 ) );
else
p.setPen( c.lighter( 130 ) );
p.drawRect( 1, 1, width()-3, height()-3 );
p.setBrush( QBrush() );
p.setPen( c.darker( 300 ) );
if( engine::automationEditor()->currentPattern() == m_pat )
p.setPen( c.lighter( 130 ) );
else
p.setPen( c.darker( 300 ) );
p.drawRect( 0, 0, width()-1, height()-1 );
const float ppt = fixedTCOs() ?

File diff suppressed because it is too large Load Diff

View File

@@ -605,6 +605,9 @@ patternView::patternView( pattern * _pattern, trackView * _parent ) :
m_paintPixmap(),
m_needsUpdate( true )
{
connect( engine::pianoRoll(), SIGNAL( currentPatternChanged() ),
this, SLOT( update() ) );
if( s_stepBtnOn == NULL )
{
s_stepBtnOn = new QPixmap( embed::getIconPixmap(
@@ -931,13 +934,19 @@ void patternView::paintEvent( QPaintEvent * )
}
p.setBrush( lingrad );
p.setPen( c.darker( 300 ) );
if( engine::pianoRoll()->currentPattern() == m_pat && m_pat->m_patternType != pattern::BeatPattern )
p.setPen( c.lighter( 130 ) );
else
p.setPen( c.darker( 300 ) );
p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) );
p.setBrush( QBrush() );
if( m_pat->m_patternType != pattern::BeatPattern )
{
p.setPen( c.lighter( 130 ) );
if( engine::pianoRoll()->currentPattern() == m_pat )
p.setPen( c.lighter( 160 ) );
else
p.setPen( c.lighter( 130 ) );
p.drawRect( QRect( 1, 1, width() - 3, height() - 3 ) );
}