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

Enhanced snapping in song editor #4973

Merged
merged 68 commits into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
680d75f
Mostly working
Spekular May 15, 2019
831cb64
Simplify and fix snapping for pattern cloning
Spekular May 16, 2019
123c8da
Add icon
Spekular May 16, 2019
70a3612
Adaptive Snap
Spekular May 16, 2019
dde4daa
Fix potential crash by capping snap fineness. Add space between adapt…
Spekular May 16, 2019
54270a7
Fix cloning of short patterns
Spekular May 16, 2019
d5e7f10
Widen song editor's default size, remove unused lines
Spekular May 16, 2019
04d3d35
Preserve offsets!
Spekular May 17, 2019
0f94d79
Clamp position to be non-negative
Spekular May 17, 2019
ee77192
Snap modes for single clip move
Spekular May 18, 2019
4fa3d48
Use modifier keys instead of toggle for snap behavior, allow differen…
Spekular May 21, 2019
2bef0b2
Apply enhanced snap to resizing
Spekular May 21, 2019
f4d7092
Lots of resize fixes
Spekular May 21, 2019
07eabc7
Preserve latest offset instead of initial offset
Spekular May 25, 2019
56b350f
Refactoring
Spekular May 25, 2019
54cc582
Typo fix 1
Spekular May 27, 2019
7fda4fa
Typo fix 2
Spekular May 27, 2019
32a88a4
Fix offset when scrolled
Spekular May 29, 2019
f1ab886
Clean up
Spekular May 29, 2019
1e5b75d
BaraMGB's suggestions from code review
Spekular Jun 2, 2019
1698dd5
More code review
Spekular Jun 2, 2019
d51b633
Proportional Snap Icon (classic)
Spekular Jun 2, 2019
59875bb
Proportional Snap Icon (default)
Spekular Jun 2, 2019
f73e9c8
Update proportional snap pixmap
Spekular Jun 2, 2019
80ba55b
Proportional snap off by default
Spekular Jun 2, 2019
578bd09
Display snap level when proportional snap enabled
Spekular Jun 10, 2019
73f5ce1
Make proportional snap false at initialization
Spekular Jun 10, 2019
d489763
Plurals in snap size label
Spekular Jun 10, 2019
d51d8b4
Add missing "return"
Spekular Jun 10, 2019
9106dc6
Update src/gui/editors/SongEditor.cpp
Spekular Jun 11, 2019
34b32bf
Better resize limits
Spekular Jun 22, 2019
0a757d3
Consolidation attempt
Spekular Jun 26, 2019
4736c38
Also snap end position in shift mode
Spekular Jul 12, 2019
d87cf8f
Mostly working
Spekular May 15, 2019
3602aa7
Simplify and fix snapping for pattern cloning
Spekular May 16, 2019
dac6c32
Add icon
Spekular May 16, 2019
fbe4371
Adaptive Snap
Spekular May 16, 2019
45f78b6
Fix potential crash by capping snap fineness. Add space between adapt…
Spekular May 16, 2019
2ad7401
Fix cloning of short patterns
Spekular May 16, 2019
b74e1fe
Widen song editor's default size, remove unused lines
Spekular May 16, 2019
eda9b48
Preserve offsets!
Spekular May 17, 2019
89dfcba
Clamp position to be non-negative
Spekular May 17, 2019
b3094f4
Snap modes for single clip move
Spekular May 18, 2019
e8a970f
Use modifier keys instead of toggle for snap behavior, allow differen…
Spekular May 21, 2019
c86ae79
Apply enhanced snap to resizing
Spekular May 21, 2019
d879090
Lots of resize fixes
Spekular May 21, 2019
d6446e4
Preserve latest offset instead of initial offset
Spekular May 25, 2019
30c5806
Refactoring
Spekular May 25, 2019
56bb8ab
Typo fix 1
Spekular May 27, 2019
b197bdc
Typo fix 2
Spekular May 27, 2019
ef8b8cb
Fix offset when scrolled
Spekular May 29, 2019
ef14bf1
Clean up
Spekular May 29, 2019
e6b9c58
BaraMGB's suggestions from code review
Spekular Jun 2, 2019
d24715e
More code review
Spekular Jun 2, 2019
3b979b3
Proportional Snap Icon (classic)
Spekular Jun 2, 2019
3ef3411
Proportional Snap Icon (default)
Spekular Jun 2, 2019
23c42a1
Update proportional snap pixmap
Spekular Jun 2, 2019
d0ba763
Proportional snap off by default
Spekular Jun 2, 2019
b10503e
Display snap level when proportional snap enabled
Spekular Jun 10, 2019
eea5a71
Make proportional snap false at initialization
Spekular Jun 10, 2019
a261a0a
Plurals in snap size label
Spekular Jun 10, 2019
ff93fc9
Add missing "return"
Spekular Jun 10, 2019
cc3edb6
Update src/gui/editors/SongEditor.cpp
Spekular Jun 11, 2019
0ee09b5
Better resize limits
Spekular Jun 22, 2019
bac1541
Consolidation attempt
Spekular Jun 26, 2019
dbc90b6
Also snap end position in shift mode
Spekular Jul 12, 2019
321a0df
Merge branch 'SESnap' of https://github.com/Spekular/lmms into SESnap
Spekular Jul 13, 2019
0ca9358
Fix for changes on master
Spekular Jul 13, 2019
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
Binary file added data/themes/classic/proportional_snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/themes/default/proportional_snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions include/MidiTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LMMS_EXPORT MidiTime
MidiTime( const tact_t tact, const tick_t ticks );
MidiTime( const tick_t ticks = 0 );

MidiTime toNearestTact() const;
MidiTime quantize(float) const;
MidiTime toAbsoluteTact() const;

MidiTime& operator+=( const MidiTime& time );
Expand Down Expand Up @@ -110,4 +110,3 @@ class LMMS_EXPORT MidiTime


#endif

12 changes: 11 additions & 1 deletion include/SongEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ class SongEditor : public TrackContainerView
void loadSettings( const QDomElement& element );

ComboBoxModel *zoomingModel() const;
ComboBoxModel *snappingModel() const;
float getSnapSize() const;
QString getSnapSizeString() const;

public slots:
void scrolled( int new_pos );

void setEditMode( EditMode mode );
void setEditModeDraw();
void setEditModeSelect();
void toggleProportionalSnap();

void updatePosition( const MidiTime & t );
void updatePositionLine();
Expand Down Expand Up @@ -130,6 +134,8 @@ private slots:
positionLine * m_positionLine;

ComboBoxModel* m_zoomingModel;
ComboBoxModel* m_snappingModel;
bool m_proportionalSnap;

static const QVector<double> m_zoomLevels;

Expand All @@ -141,7 +147,6 @@ private slots:
EditMode m_ctrlMode; // mode they were in before they hit ctrl

friend class SongEditorWindow;

} ;


Expand Down Expand Up @@ -170,6 +175,8 @@ protected slots:
void lostFocus();
void adjustUiAfterProjectLoad();

void updateSnapLabel();

signals:
void playTriggered();
void resized();
Expand All @@ -181,13 +188,16 @@ protected slots:
QAction* m_addBBTrackAction;
QAction* m_addSampleTrackAction;
QAction* m_addAutomationTrackAction;
QAction* m_setProportionalSnapAction;

ActionGroup * m_editModeGroup;
QAction* m_drawModeAction;
QAction* m_selectModeAction;
QAction* m_crtlAction;

ComboBox * m_zoomingComboBox;
ComboBox * m_snappingComboBox;
QLabel* m_snapSizeLabel;
};

#endif
18 changes: 12 additions & 6 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class TrackContentObjectView : public selectableObject, public ModelView
// access needsUpdate member variable
bool needsUpdate();
void setNeedsUpdate( bool b );

public slots:
virtual bool close();
void cut();
Expand Down Expand Up @@ -297,6 +297,9 @@ protected slots:
Actions m_action;
QPoint m_initialMousePos;
QPoint m_initialMouseGlobalPos;
MidiTime m_initialTCOPos;
MidiTime m_initialTCOEnd;
QVector<MidiTime> m_initialOffsets;

TextFloat * m_hint;

Expand All @@ -311,14 +314,17 @@ protected slots:
bool m_gradient;

bool m_needsUpdate;
inline void setInitialMousePos( QPoint pos )
inline void setInitialPos( QPoint pos )
{
m_initialMousePos = pos;
m_initialMouseGlobalPos = mapToGlobal( pos );
m_initialTCOPos = m_tco->startPosition();
m_initialTCOEnd = m_initialTCOPos + m_tco->length();
}
void setInitialOffsets();

bool mouseMovedDistance( QMouseEvent * me, int distance );

MidiTime draggedTCOPos( QMouseEvent * me );
} ;


Expand Down Expand Up @@ -564,13 +570,13 @@ class LMMS_EXPORT Track : public Model, public JournallingObject

using Model::dataChanged;

inline int getHeight()
inline int getHeight()
{
return m_height >= MINIMAL_TRACK_HEIGHT
? m_height
? m_height
: DEFAULT_TRACK_HEIGHT;
}
inline void setHeight( int height )
inline void setHeight( int height )
{
m_height = height;
}
Expand Down
Loading