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

Change zoom in SongEditor to a Slider Zoom #6664

Merged
merged 39 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bb14622
New styles and icons for Horizontal Slider
superpaik Mar 9, 2023
06005dd
Adapt TimeLineWidget to new zoom values
superpaik Mar 9, 2023
edcc68e
Change Zoom to a Slider in SongEditor
superpaik Mar 9, 2023
dba768a
Correct codefactor warnings
superpaik Mar 9, 2023
2af3dbe
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
85c29fa
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
a610cf3
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
9e9e44f
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
370595a
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
361dd04
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
85ce756
Update src/gui/editors/SongEditor.cpp
superpaik Mar 10, 2023
4d32bb8
Correcting data types
superpaik Mar 10, 2023
3364ae3
Change function to Qt 5.6
superpaik Mar 10, 2023
c33327d
globalPosition as DeprecationHelper
superpaik Mar 15, 2023
4ffe707
Adjust clip width
superpaik Mar 15, 2023
ef834dd
Coding convention
superpaik Mar 15, 2023
29edff3
Minor changes after testing
superpaik Mar 30, 2023
14e2314
Fix minor changes
superpaik Apr 3, 2023
63d6c72
Log slider + Error corrections
superpaik Apr 8, 2023
6d2f5d9
Log slider + Error corrections (2)
superpaik Apr 8, 2023
aff055e
Set allowDragOptions in Slider
superpaik Apr 8, 2023
f0deac2
Renaming Models
superpaik Apr 8, 2023
3c8fd4b
Change zoomMin calculation
superpaik Apr 9, 2023
15346af
Adapt zoom to test results
superpaik May 8, 2023
589d068
Simplify zoom and snap calculations, remove TextFloat
allejok96 May 13, 2023
7a29833
Revert the revert - scroll on track label should be ignored
allejok96 May 13, 2023
7dd679a
Merge pull request #1 from allejok96/songEditorSliderZoom
superpaik May 13, 2023
aa861cf
Files reverted
superpaik May 14, 2023
0606cb5
Control min clip witdh
superpaik May 15, 2023
c75fceb
Update src/gui/editors/SongEditor.cpp
superpaik May 16, 2023
5ecc693
Update src/gui/editors/SongEditor.cpp
superpaik May 16, 2023
502567f
Update src/gui/editors/SongEditor.cpp
superpaik May 16, 2023
c499473
Update src/gui/editors/TimeLineWidget.cpp
superpaik May 16, 2023
e20ffec
Update src/gui/editors/SongEditor.cpp
superpaik May 16, 2023
436bd1f
Update src/gui/editors/SongEditor.cpp
superpaik May 16, 2023
dffef1d
Update src/gui/editors/SongEditor.cpp
superpaik May 16, 2023
4d8d2c1
Adapt to Alt (+ wheel)
superpaik May 16, 2023
1b1b2be
Snap_sizes and small optimizations
superpaik May 18, 2023
a823978
Add PROPORTIONAL_SNAP_SIZES variable
superpaik May 22, 2023
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/horizontal_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,25 @@ lmms--gui--AutomatableSlider::handle:vertical {
margin: -4px -12px -2px;
}

/* main horizontal sliders (zoom) */

lmms--gui--AutomatableSlider::groove:horizontal {
background: rgba(0,0,0, 128);
border: 1px inset rgba(100,100,100, 64);
border-radius: 2px;
height: 2px;
margin: 2px;
}

lmms--gui--AutomatableSlider::handle:horizontal {
background: none;
border-image: url(resources:horizontal_slider.png);
width: 10px;
height: 26px;
border-radius: 2px;
margin: -12px -2px;
}

/* about dialog */
QTabWidget, QTabWidget QWidget {
background: #5b6571;
Expand Down
Binary file added data/themes/default/horizontal_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,25 @@ lmms--gui--AutomatableSlider::handle:vertical {
margin: -4px -12px -2px;
}

/* main horizontal sliders (zoom) */

lmms--gui--AutomatableSlider::groove:horizontal {
background: #040506;
border: none;
border-radius: 2px;
height: 2px;
margin: 2px;
}

lmms--gui--AutomatableSlider::handle:horizontal {
background: none;
border-image: url(resources:horizontal_slider.png);
width: 10px;
height: 26px;
border-radius: 2px;
margin: -12px -2px;
}

/* window that shows up when you add effects */

lmms--gui--EffectSelectDialog QScrollArea {
Expand Down
17 changes: 8 additions & 9 deletions include/SongEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef LMMS_GUI_SONG_EDITOR_H
#define LMMS_GUI_SONG_EDITOR_H

#include "AutomatableModel.h"
#include "Editor.h"
#include "TrackContainerView.h"

Expand Down Expand Up @@ -69,7 +70,6 @@ class SongEditor : public TrackContainerView
void saveSettings( QDomDocument& doc, QDomElement& element ) override;
void loadSettings( const QDomElement& element ) override;

ComboBoxModel *zoomingModel() const;
ComboBoxModel *snappingModel() const;
float getSnapSize() const;
QString getSnapSizeString() const;
Expand Down Expand Up @@ -120,10 +120,12 @@ private slots:
bool allowRubberband() const override;
bool knifeMode() const override;

int calculatePixelsPerBar() const;
int calculateZoomSliderValue(int pixelsPerBar) const;

int trackIndexFromSelectionPoint(int yPos);
int indexOfTrackView(const TrackView* tv);


Song * m_song;

QScrollBar * m_leftRightScroll;
Expand All @@ -141,12 +143,10 @@ private slots:

PositionLine * m_positionLine;

ComboBoxModel* m_zoomingModel;
IntModel* m_zoomingModel;
ComboBoxModel* m_snappingModel;
bool m_proportionalSnap;

static const QVector<float> m_zoomLevels;

bool m_scrollBack;
bool m_smoothScroll;

Expand All @@ -158,14 +158,14 @@ private slots:
QPoint m_mousePos;
int m_rubberBandStartTrackview;
TimePos m_rubberbandStartTimePos;
int m_currentZoomingValue;
int m_rubberbandPixelsPerBar; //!< pixels per bar when selection starts
int m_trackHeadWidth;
bool m_selectRegion;

friend class SongEditorWindow;

signals:
void zoomingValueChanged( float );
void pixelsPerBarChanged(float);
} ;


Expand Down Expand Up @@ -213,15 +213,14 @@ protected slots:
QAction* m_selectModeAction;
QAction* m_crtlAction;

ComboBox * m_zoomingComboBox;
AutomatableSlider * m_zoomingSlider;
ComboBox * m_snappingComboBox;
QLabel* m_snapSizeLabel;

QAction* m_insertBarAction;
QAction* m_removeBarAction;
};


} // namespace gui

} // namespace lmms
Expand Down
9 changes: 4 additions & 5 deletions src/gui/clips/ClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ClipView::ClipView( Clip * clip,

connect( m_clip, SIGNAL(lengthChanged()),
this, SLOT(updateLength()));
connect( getGUI()->songEditor()->m_editor->zoomingModel(), SIGNAL(dataChanged()), this, SLOT(updateLength()));
connect(getGUI()->songEditor()->m_editor, &SongEditor::pixelsPerBarChanged, this, &ClipView::updateLength);
connect( m_clip, SIGNAL(positionChanged()),
this, SLOT(updatePosition()));
connect( m_clip, SIGNAL(destroyedClip()), this, SLOT(close()));
Expand Down Expand Up @@ -314,10 +314,9 @@ void ClipView::updateLength()
}
else
{
setFixedWidth(
static_cast<int>( m_clip->length() * pixelsPerBar() /
TimePos::ticksPerBar() ) + 1 /*+
BORDER_WIDTH * 2-1*/ );
// this std::max function is needed for clips that do not start or end on the beat, otherwise, they "disappear" when zooming to min
// 3 is the minimun width needed to make a clip visible
setFixedWidth(std::max(static_cast<int>(m_clip->length() * pixelsPerBar() / TimePos::ticksPerBar() + 1), 3));
}
m_trackView->trackContainerView()->update();
}
Expand Down
Loading