39 void setAdvanced(
bool b);
41 void setZoom(ZoomRatio z);
42 void setField(StepField f);
43 void setSelectedLane(
int lane);
44 int selectedLane() const noexcept {
return m_selectedLane; }
47 int headerLaneAt(QPointF pos)
const noexcept;
60 const std::vector<int>&
selectedLanes() const noexcept {
return m_selectedLanes; }
61 void setSelectedLanes(std::vector<int> lanes);
63 void clearSelection();
65 void setSelectMode(
bool b);
67 void setRings(
bool b);
68 bool rings() const noexcept {
return m_rings; }
76 std::vector<int> starts;
81 StepField field() const noexcept;
83 double minimumHeight() const noexcept;
85 const
std::vector<
float>& draggedValues() const noexcept {
return m_dragValues; }
88 void paintStep(
int lane,
int step, Patternist::Note n)
89 W_SIGNAL(paintStep, lane, step, n);
90 void paintFinished() W_SIGNAL(paintFinished);
91 void noteChanged(
int lane,
int note) W_SIGNAL(noteChanged, lane, note);
92 void noteChangeFinished() W_SIGNAL(noteChangeFinished);
93 void muteToggled(
int lane) W_SIGNAL(muteToggled, lane);
94 void soloToggled(
int lane) W_SIGNAL(soloToggled, lane);
95 void laneSelected(
int lane) W_SIGNAL(laneSelected, lane);
97 void fieldEdited(
int lane,
int step,
int field,
float value)
98 W_SIGNAL(fieldEdited, lane, step, field, value);
99 void fieldEditFinished() W_SIGNAL(fieldEditFinished);
102 void fieldValuesEdited(
int lane,
int field) W_SIGNAL(fieldValuesEdited, lane, field);
103 void stepMenuRequested(
int lane,
int step, QPoint screen)
104 W_SIGNAL(stepMenuRequested, lane, step, screen);
106 void selectionChanged() W_SIGNAL(selectionChanged);
107 void fieldSelected(
int field) W_SIGNAL(fieldSelected, field);
109 void fieldRandomized(
int lane,
int field) W_SIGNAL(fieldRandomized, lane, field);
110 void fieldReset(
int lane,
int field) W_SIGNAL(fieldReset, lane, field);
113 void laneValueEdited(
int lane,
int which,
int value)
114 W_SIGNAL(laneValueEdited, lane, which, value);
115 void laneValueEditFinished() W_SIGNAL(laneValueEditFinished);
118 static constexpr StepField allFields[]
119 = {StepField::Velocity, StepField::VelocityRandom, StepField::Chance,
120 StepField::Offset, StepField::OffsetRandom, StepField::Gate,
121 StepField::GateRandom, StepField::Ratchet, StepField::Pace,
122 StepField::Pitch, StepField::PitchRandom};
128 std::optional<StepField> random;
130 static constexpr FieldRow fieldRows[]
131 = {{StepField::Velocity, StepField::VelocityRandom},
132 {StepField::Chance, {}},
133 {StepField::Offset, StepField::OffsetRandom},
134 {StepField::Gate, StepField::GateRandom},
135 {StepField::Ratchet, {}},
136 {StepField::Pace, {}},
137 {StepField::Pitch, StepField::PitchRandom}};
139 bool fieldUsed(StepField f)
const noexcept;
140 QString fieldLabel(StepField f)
const;
141 double randomButtonWidth() const noexcept;
143 static constexpr
int all_button = 999;
144 static constexpr
int mute_button = 1000;
145 static constexpr
int solo_button = 2000;
146 static constexpr
int field_button = 3000;
147 static constexpr
int steps_button = 5000;
148 static constexpr
int rate_button = 6000;
150 QFont nameFont() const;
151 const QFont& smallFont() const;
152 bool stackedHeader() const noexcept;
153 bool laneValues() const noexcept;
154 bool ringsMode() const noexcept;
157 double inner{}, outer{};
159 QRectF ringArea() const noexcept;
160 QPointF ringCenter() const noexcept;
161 Ring ring(
int lane) const noexcept;
162 std::pair<
double,
double> slotTurns(const StepSlot& sl) const noexcept;
163 Cell ringCellAt(QPointF pos) const noexcept;
164 void paintRings(QPainter*, const Pattern&) const;
165 void paintRingCenter(QPainter*, const Pattern&, QRectF box) const;
166 double cellHeight() const noexcept;
167 QRectF valueRect(
int lane,
int which) const noexcept;
169 QPainter* painter, QRectF r, const QString& text,
bool inherited,
int id) const;
170 QRectF nameRect(
int lane) const noexcept;
171 QRectF fieldButtonRect(
int i) const noexcept;
172 QRectF allButtonRect() const noexcept;
173 void toggleLane(
int lane);
174 int buttonAt(QPointF pos) const noexcept;
175 void pressButton(
int id, Qt::KeyboardModifiers mods);
177 QPainter* painter, QRectF r, const QString& text,
bool on, const QColor& onColor,
180 const Pattern* pattern() const noexcept;
183 void invalidateSlots();
184 const
std::vector<StepSlot>& slots(
int lane) const;
186 int playingSlot(
int lane) const noexcept;
188 double headerWidth() const noexcept;
189 double measureHeader() const noexcept;
190 double fieldButtonHeight() const noexcept;
191 bool laneButtons() const noexcept;
192 double gridTop() const noexcept;
193 double gridBottom() const noexcept;
194 double laneHeight() const noexcept;
195 QRectF laneRect(
int lane) const noexcept;
196 QRectF muteRect(
int lane) const noexcept;
197 QRectF soloRect(
int lane) const noexcept;
198 double fieldHeight() const noexcept;
199 QRectF fieldRect() const noexcept;
200 bool canEdit() const noexcept;
201 Cell cellAt(QPointF pos) const noexcept;
202 int fieldStepAt(QPointF pos) const noexcept;
204 void paint_impl(QPainter*) const override;
205 void paintCells(QPainter*, const Pattern&) const;
206 void paintHeader(QPainter*, const Pattern&) const;
207 void paintField(QPainter*, const Pattern&) const;
208 void paintStatus(QPainter*) const;
210 void heightChanged(qreal) override;
211 void widthChanged(qreal) override;
213 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
214 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
215 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
216 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
217 void hoverMoveEvent(QGraphicsSceneHoverEvent* event) override;
218 void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
219 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;
220 bool sceneEvent(QEvent* event) override;
221 bool sceneEventFilter(QGraphicsItem* watched, QEvent* event) override;
222 QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
223 void dropEvent(QGraphicsSceneDragDropEvent* event) override;
225 void paintAt(QPointF pos);
226 void startFieldDrag(QPointF pos, Qt::KeyboardModifiers mods);
227 void dragField(QPointF pos);
228 void selectOver(QPointF pos);
231 int lane0{-1}, lane1{-1};
233 bool operator==(
const SelectionArea&)
const noexcept =
default;
235 void setSelectionArea(SelectionArea a);
236 void editFieldAt(QPointF pos);
241 std::vector<score::QGraphicsNoteChooser*> m_lanes;
242 Mode m_mode{Mode::Fit};
244 StepField m_field{StepField::Velocity};
245 int m_selectedLane{};
248 mutable std::vector<std::vector<StepSlot>> m_slots;
249 mutable bool m_slotsValid{};
250 mutable std::optional<double> m_headerWidth;
252 mutable double m_span{};
254 int m_execPattern{-1};
255 int m_pendingPattern{-1};
258 int m_hoverButton{-1};
267 std::optional<ValueDrag> m_valueDrag;
269 SelectionArea m_selectionArea;
270 mutable StepSelection m_selection;
271 std::vector<int> m_selectedLanes;
272 mutable bool m_selectionValid{};
273 QPointF m_selectAnchor;
278 std::optional<Note> m_painting;
280 bool m_editingField{};
282 std::vector<float> m_dragValues;
283 bool m_swallowContextMenu{};