Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
77d69e2
First commit
IanCaio Oct 13, 2020
fb2107d
Implements inValue/outValue on Automation Nodes
IanCaio Oct 14, 2020
28611b8
Fixes and refactor code on AutomationEditor.cpp
IanCaio Oct 15, 2020
e5c9669
Avoids unnecessary check in putValue
IanCaio Oct 15, 2020
ab0aeb0
Adds upgrade routine for the automation nodes
IanCaio Oct 15, 2020
2ed2a66
Allows dragging outValues on the Automation Editor
IanCaio Oct 16, 2020
7b6729b
Small fix inside AutomationPattern.cpp
IanCaio Oct 16, 2020
a800943
Creates separate files for AutomationNode
IanCaio Oct 16, 2020
3932106
Adds more members to AutomationNode
IanCaio Oct 16, 2020
9f55d2c
Removes unused code from AutomationEditor
IanCaio Oct 16, 2020
c42c46b
Changes to the outValues now update the tangents
IanCaio Oct 16, 2020
504143c
Keeps discrete jumps when flipping patterns
IanCaio Oct 16, 2020
d67942b
Allows reseting outValues on the AutomationEditor
IanCaio Oct 16, 2020
7c269bd
Makes so dragging nodes keep the outValue
IanCaio Oct 16, 2020
64fcec0
Fixes code style on modified code
IanCaio Oct 16, 2020
578367e
Adds a QProperty for the node outValue color
IanCaio Oct 16, 2020
c4960a1
Adds doxygen comments on methods
IanCaio Oct 16, 2020
5c94591
Refactor flipX and flipY methods
IanCaio Oct 16, 2020
939596a
Add a new edit mode to Automation Editor
IanCaio Oct 16, 2020
5a38f74
Improves the Draw OutValue edit mode
IanCaio Oct 17, 2020
7925196
Adds mutex to AutomationPattern
IanCaio Oct 17, 2020
9e325dc
Veratil's review changes
IanCaio Oct 19, 2020
61d20ff
Changes the inValue sphere to be draw first
IanCaio Oct 19, 2020
ff92b56
Merge branch 'master' into feature/automationProgression
IanCaio Oct 21, 2020
3d4be23
Changes comments and variables names
IanCaio Oct 21, 2020
caa43ad
Changes QProperty variables to use MEMBER
IanCaio Oct 22, 2020
61ef27a
Overloads some AutomationNode's operators
IanCaio Oct 22, 2020
932a46e
Improves getNodeAt method
IanCaio Oct 22, 2020
a64942a
Changes behavior of setDragValue
IanCaio Oct 22, 2020
3b6f238
Moves getNodeAt to an upper level, reducing lines
IanCaio Oct 22, 2020
53f4afa
Changes icon of Draw OutValue edit mode
IanCaio Oct 22, 2020
108323d
Merge branch 'master' into feature/automationProgression
IanCaio Oct 24, 2020
203d3b5
Removes unnecessary non-const methods
IanCaio Nov 12, 2020
1531668
Merge branch 'master' into feature/automationProgression
IanCaio Nov 12, 2020
5184d79
Fixes formatting and doxygen comments
IanCaio Nov 13, 2020
9805321
Adds helper macros for AutomationNodes
IanCaio Nov 13, 2020
055c95f
Removes tabs from ternary operator
IanCaio Nov 13, 2020
1c3502c
Update files to use AutomationNode macros
IanCaio Nov 13, 2020
3471b8f
Merge branch 'master' into feature/automationProgression
IanCaio Nov 26, 2020
7559a41
Addresses my own code review
IanCaio Nov 26, 2020
2cf33e1
Addresses Veratil's review
IanCaio Nov 26, 2020
e0c3563
Adds helper MACROs for node tangents
IanCaio Nov 26, 2020
85a0ca3
Merge branch 'master' into feature/automationProgression
IanCaio Dec 5, 2020
cbf73dc
Fixes header inclusion order
IanCaio Dec 5, 2020
de6d7c9
Removes mutex from AutomationEditor
IanCaio Dec 6, 2020
7d1f196
Locks mutex on AutomationPattern copy assignment
IanCaio Dec 6, 2020
128c723
Changes resetOutValue() so it generates tangents
IanCaio Dec 6, 2020
adc223b
Changes some methods to use for loops
IanCaio Dec 11, 2020
169cc3b
Move removeNodes/resetNodes to AutomationPattern
IanCaio Dec 11, 2020
033bfab
Optimizes loop inside putValue/putValues
IanCaio Dec 11, 2020
fe53845
Adds comment to mysterious calculation
IanCaio Dec 12, 2020
1f28a45
Merge branch 'master' into feature/automationProgression
IanCaio Dec 16, 2020
1e1e5f8
Reduces indentation on getNodeAt
IanCaio Dec 16, 2020
6bec055
Applies Veratil suggestions
IanCaio Dec 16, 2020
1d23334
Updates comment from changed code
IanCaio Dec 16, 2020
8c5f9d4
Uses lambda functions to extract code
IanCaio Dec 16, 2020
1d1d57c
Fixes behavior of AutomationPattern::flipX
IanCaio Dec 20, 2020
d9862c5
Changes pattern XML for backwards compatibility
IanCaio Dec 20, 2020
2d1fbd0
Fixes bug on AutomationPattern::resetNodes
IanCaio Dec 20, 2020
2226108
Implements fine tuning with double click
tecknixia Dec 26, 2020
4b4ac2b
Adds comment about copy-assignment
IanCaio Jan 7, 2021
93c0c65
Merge branch 'master' into feature/automationProgression
IanCaio Jan 30, 2021
5a66667
Changes flipY logic and address PhysSong review
IanCaio Jan 30, 2021
174f335
Merge branch 'feature/automationProgression' into feature/automationP…
IanCaio Feb 25, 2021
5a2a5db
Merge branch 'master' into feature/automationProgressionFineTuning
IanCaio Feb 28, 2021
5f3e69b
Fixes bug with double clicking on erase mode
IanCaio Feb 28, 2021
5290c71
Small change to the fine tuning of inValues
IanCaio Feb 28, 2021
df67e46
Addresses Spekular change requests
IanCaio Mar 26, 2021
0334021
Addresses Veratil's review
IanCaio Mar 26, 2021
7eae19c
Improves indentation on fineTuneValue
IanCaio Mar 28, 2021
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
Prev Previous commit
Next Next commit
Changes QProperty variables to use MEMBER
	Instead of creating a getter and setter for each QProperty, we use MEMBER instead and access those variables directly.
  • Loading branch information
IanCaio committed Oct 22, 2020
commit caa43ad5edecfcdaa643a53c8b957a9b5cf6ea26
38 changes: 9 additions & 29 deletions include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ class TimeLineWidget;
class AutomationEditor : public QWidget, public JournallingObject
{
Q_OBJECT
Q_PROPERTY(QColor barLineColor READ barLineColor WRITE setBarLineColor)
Q_PROPERTY(QColor beatLineColor READ beatLineColor WRITE setBeatLineColor)
Q_PROPERTY(QColor lineColor READ lineColor WRITE setLineColor)
Q_PROPERTY(QColor nodeInValueColor READ nodeInValueColor WRITE setNodeInValueColor)
Q_PROPERTY(QColor nodeOutValueColor READ nodeOutValueColor WRITE setNodeOutValueColor)
Q_PROPERTY(QBrush scaleColor READ scaleColor WRITE setScaleColor)
Q_PROPERTY(QBrush graphColor READ graphColor WRITE setGraphColor)
Q_PROPERTY(QColor crossColor READ crossColor WRITE setCrossColor)
Q_PROPERTY(QColor backgroundShade READ backgroundShade WRITE setBackgroundShade)
Q_PROPERTY(QColor barLineColor MEMBER m_barLineColor)
Q_PROPERTY(QColor beatLineColor MEMBER m_beatLineColor)
Q_PROPERTY(QColor lineColor MEMBER m_lineColor)
Q_PROPERTY(QColor nodeInValueColor MEMBER m_nodeInValueColor)
Q_PROPERTY(QColor nodeOutValueColor MEMBER m_nodeOutValueColor)
Q_PROPERTY(QBrush scaleColor MEMBER m_scaleColor)
Q_PROPERTY(QBrush graphColor MEMBER m_graphColor)
Q_PROPERTY(QColor crossColor MEMBER m_crossColor)
Q_PROPERTY(QColor backgroundShade MEMBER m_backgroundShade)
public:
void setCurrentPattern(AutomationPattern * new_pattern);

Expand All @@ -81,26 +81,6 @@ class AutomationEditor : public QWidget, public JournallingObject
return "automationeditor";
}

// qproperty access methods
QColor barLineColor() const;
void setBarLineColor(const QColor & c);
QColor beatLineColor() const;
void setBeatLineColor(const QColor & c);
QColor lineColor() const;
void setLineColor(const QColor & c);
QBrush graphColor() const;
void setGraphColor(const QBrush & c);
QColor nodeInValueColor() const;
void setNodeInValueColor(const QColor & c);
QColor nodeOutValueColor() const;
void setNodeOutValueColor(const QColor & c);
QBrush scaleColor() const;
void setScaleColor(const QBrush & c);
QColor crossColor() const;
void setCrossColor(const QColor & c);
QColor backgroundShade() const;
void setBackgroundShade(const QColor & c);

enum EditModes
{
DRAW,
Expand Down
106 changes: 24 additions & 82 deletions src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ AutomationEditor::AutomationEditor() :
m_mouseDownLeft(false),
m_mouseDownRight( false ),
m_scrollBack( false ),
m_barLineColor( 0, 0, 0 ),
m_beatLineColor( 0, 0, 0 ),
m_lineColor( 0, 0, 0 ),
m_graphColor( Qt::SolidPattern ),
m_barLineColor(0, 0, 0),
m_beatLineColor(0, 0, 0),
m_lineColor(0, 0, 0),
m_graphColor(Qt::SolidPattern),
m_nodeInValueColor(0, 0, 0),
m_nodeOutValueColor(0, 0, 0),
m_scaleColor( Qt::SolidPattern ),
m_crossColor( 0, 0, 0 ),
m_backgroundShade( 0, 0, 0 )
m_scaleColor(Qt::SolidPattern),
m_crossColor(0, 0, 0),
m_backgroundShade(0, 0, 0)
{
connect( this, SIGNAL( currentPatternChanged() ),
this, SLOT( updateAfterPatternChange() ),
Expand Down Expand Up @@ -255,64 +255,6 @@ void AutomationEditor::loadSettings( const QDomElement & dom_parent)



// qproperty access methods

QColor AutomationEditor::barLineColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_barLineColor; }

void AutomationEditor::setBarLineColor( const QColor & c )
{ QMutexLocker m(&m_patternEditorMutex); m_barLineColor = c; }

QColor AutomationEditor::beatLineColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_beatLineColor; }

void AutomationEditor::setBeatLineColor( const QColor & c )
{ QMutexLocker m(&m_patternEditorMutex); m_beatLineColor = c; }

QColor AutomationEditor::lineColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_lineColor; }

void AutomationEditor::setLineColor( const QColor & c )
{ QMutexLocker m(&m_patternEditorMutex); m_lineColor = c; }

QBrush AutomationEditor::graphColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_graphColor; }

void AutomationEditor::setGraphColor( const QBrush & c )
{ QMutexLocker m(&m_patternEditorMutex); m_graphColor = c; }

QColor AutomationEditor::nodeInValueColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_nodeInValueColor; }

void AutomationEditor::setNodeInValueColor(const QColor & c)
{ QMutexLocker m(&m_patternEditorMutex); m_nodeInValueColor = c; }

QColor AutomationEditor::nodeOutValueColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_nodeOutValueColor; }

void AutomationEditor::setNodeOutValueColor(const QColor & c)
{ QMutexLocker m(&m_patternEditorMutex); m_nodeOutValueColor = c; }

QBrush AutomationEditor::scaleColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_scaleColor; }

void AutomationEditor::setScaleColor( const QBrush & c )
{ QMutexLocker m(&m_patternEditorMutex); m_scaleColor = c; }

QColor AutomationEditor::crossColor() const
{ QMutexLocker m(&m_patternEditorMutex); return m_crossColor; }

void AutomationEditor::setCrossColor( const QColor & c )
{ QMutexLocker m(&m_patternEditorMutex); m_crossColor = c; }

QColor AutomationEditor::backgroundShade() const
{ QMutexLocker m(&m_patternEditorMutex); return m_backgroundShade; }

void AutomationEditor::setBackgroundShade( const QColor & c )
{ QMutexLocker m(&m_patternEditorMutex); m_backgroundShade = c; }




void AutomationEditor::updateAfterPatternChange()
{
Expand Down Expand Up @@ -984,7 +926,7 @@ inline void AutomationEditor::drawCross( QPainter & p )
/ (float)( m_maxLevel - m_minLevel ) ) :
grid_bottom - ( level - m_bottomLevel ) * m_y_delta;

p.setPen( crossColor() );
p.setPen(m_crossColor);
p.drawLine( VALUES_WIDTH, (int) cross_y, width(), (int) cross_y );
p.drawLine( mouse_pos.x(), TOP_MARGIN, mouse_pos.x(), height() - SCROLLBAR_SIZE );

Expand Down Expand Up @@ -1018,14 +960,14 @@ inline void AutomationEditor::drawAutomationPoint(QPainter & p, timeMap::iterato

// Draw a circle for the outValue
y = yCoordOfLevel(it.value().getOutValue());
p.setPen(QPen(nodeOutValueColor().lighter(200)));
p.setBrush(QBrush(nodeOutValueColor()));
p.setPen(QPen(m_nodeOutValueColor.lighter(200)));
p.setBrush(QBrush(m_nodeOutValueColor));
p.drawEllipse(x - outerRadius, y - outerRadius, outerRadius * 2, outerRadius * 2);

// Draw a circle for the inValue
y = yCoordOfLevel(it.value().getInValue());
p.setPen(QPen(nodeInValueColor().lighter(200)));
p.setBrush(QBrush(nodeInValueColor()));
p.setPen(QPen(m_nodeInValueColor.lighter(200)));
p.setBrush(QBrush(m_nodeInValueColor));
p.drawEllipse(x - outerRadius, y - outerRadius, outerRadius * 2, outerRadius * 2);
}

Expand Down Expand Up @@ -1055,8 +997,8 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
// start drawing at the bottom
int grid_bottom = height() - SCROLLBAR_SIZE - 1;

p.fillRect( 0, TOP_MARGIN, VALUES_WIDTH, height() - TOP_MARGIN,
scaleColor() );
p.fillRect(0, TOP_MARGIN, VALUES_WIDTH, height() - TOP_MARGIN,
m_scaleColor);

// print value numbers
int font_height = p.fontMetrics().height();
Expand Down Expand Up @@ -1153,14 +1095,14 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
x<=width();
tick += q, x = xCoordOfTick( tick ) )
{
p.setPen( lineColor() );
p.setPen(m_lineColor);
p.drawLine( x, grid_bottom, x, x_line_end );
}

/// \todo move this horizontal line drawing code into the same loop as the value ticks?
if( m_y_auto )
{
QPen pen( beatLineColor() );
QPen pen(m_beatLineColor);
pen.setStyle( Qt::DotLine );
p.setPen( pen );
float y_delta = ( grid_bottom - TOP_MARGIN ) / 8.0f;
Expand All @@ -1178,11 +1120,11 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
y = yCoordOfLevel( (float)level );
if( level % 10 == 0 )
{
p.setPen( beatLineColor() );
p.setPen(m_beatLineColor);
}
else
{
p.setPen( lineColor() );
p.setPen(m_lineColor);
}
// draw level line
p.drawLine( VALUES_WIDTH, (int) y, width(), (int) y );
Expand All @@ -1202,8 +1144,8 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
{
if( ( barCount + leftBars ) % 2 != 0 )
{
p.fillRect( x - m_currentPosition * zoomFactor / timeSignature, TOP_MARGIN, m_ppb,
height() - ( SCROLLBAR_SIZE + TOP_MARGIN ), backgroundShade() );
p.fillRect(x - m_currentPosition * zoomFactor / timeSignature, TOP_MARGIN, m_ppb,
height() - (SCROLLBAR_SIZE + TOP_MARGIN), m_backgroundShade);
}
}

Expand All @@ -1216,7 +1158,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
x<=width();
tick += ticksPerBeat, x = xCoordOfTick( tick ) )
{
p.setPen( beatLineColor() );
p.setPen(m_beatLineColor);
p.drawLine( x, grid_bottom, x, x_line_end );
}

Expand All @@ -1226,7 +1168,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
x<=width();
tick += MidiTime::ticksPerBar(), x = xCoordOfTick( tick ) )
{
p.setPen( barLineColor() );
p.setPen(m_barLineColor);
p.drawLine( x, grid_bottom, x, x_line_end );
}
}
Expand Down Expand Up @@ -1290,7 +1232,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
path.lineTo( QPointF( xCoordOfTick( ( it + 1 ).key() ), yCoordOfLevel( nextValue ) ) );
path.lineTo( QPointF( xCoordOfTick( ( it + 1 ).key() ), yCoordOfLevel( 0 ) ) );
path.lineTo( QPointF( xCoordOfTick( it.key() ), yCoordOfLevel( 0 ) ) );
p.fillPath( path, graphColor() );
p.fillPath(path, m_graphColor);
p.setRenderHints( QPainter::Antialiasing, false );
delete [] values;

Expand Down Expand Up @@ -1433,7 +1375,7 @@ void AutomationEditor::drawLevelTick(QPainter & p, int tick, float value)
rect_height = (int)( value * m_y_delta );
}

QBrush currentColor = graphColor();
QBrush currentColor = m_graphColor;

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