Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
arranger_object.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
9
10#ifndef __GUI_WIDGETS_ARRANGER_OBJECT_H__
11#define __GUI_WIDGETS_ARRANGER_OBJECT_H__
12
13#include "common/dsp/arranger_object.h"
14#include "common/utils/ui.h"
15#include "gui/backend/gtk_widgets/gtk_wrapper.h"
16
22
23// Width of fade points on arranger objects
24static constexpr int ARRANGER_OBJECT_FADE_POINT_WIDTH = 12;
25
26// Half-width of fade points on arranger objects
27static constexpr int ARRANGER_OBJECT_FADE_POINT_HALFWIDTH = 6;
28
45bool
47 const ArrangerObject * self,
48 bool in,
49 const int x,
50 int y,
51 bool only_handle,
52 bool only_outer,
53 bool check_lane);
54
55static inline bool
56arranger_object_is_fade_in (
57 const ArrangerObject * self,
58 const int x,
59 int y,
60 bool only_handle,
61 bool only_outer)
62{
63 return arranger_object_is_fade (self, true, x, y, only_handle, only_outer, true)
65 self, true, x, y, only_handle, only_outer, false);
66}
67
68static inline bool
69arranger_object_is_fade_out (
70 const ArrangerObject * self,
71 const int x,
72 int y,
73 bool only_handle,
74 bool only_outer)
75{
76 return arranger_object_is_fade (self, false, x, y, only_handle, only_outer, true)
78 self, false, x, y, only_handle, only_outer, false);
79}
80
87ATTR_NONNULL bool
88arranger_object_is_resize_l (const ArrangerObject * self, const int x);
89
96ATTR_NONNULL bool
97arranger_object_is_resize_r (const ArrangerObject * self, const int x);
98
106bool
108 const ArrangerObject * self,
109 const int x,
110 const int y);
111
117bool
119 const ArrangerObject * self,
120 const int y,
121 bool ctrl_pressed);
122
130ATTR_NONNULL bool
131arranger_object_is_rename (const ArrangerObject * self, const int x, const int y);
132
140bool
142 const ArrangerObject * self,
143 bool alt_pressed);
144
148int
150 ArrangerObject * self,
151 Region &region,
152 GdkRectangle * full_rect);
153
154void
155arranger_object_set_full_rectangle (
156 ArrangerObject * self,
157 ArrangerWidget * arranger);
158
171int
173 ArrangerObject * self,
174 GdkRectangle * parent_rect,
175 GdkRectangle * full_rect,
176 GdkRectangle * draw_rect);
177
185void
187 ArrangerObject * self,
188 ArrangerWidget * arranger,
189 GtkSnapshot * snapshot,
190 GdkRectangle * rect);
191
201bool
203 const ArrangerObject &self,
204 const ArrangerWidget * arranger);
205
211bool
213 const ArrangerObject * self,
214 const ArrangerWidget * arranger);
215
221bool
223 const ArrangerObject * self,
224 const ArrangerWidget * arranger);
225
229
230#endif
bool arranger_object_is_resize_up(const ArrangerObject *self, const int x, const int y)
Returns if the current position is for resizing up (eg, Velocity).
bool arranger_object_should_orig_be_visible(const ArrangerObject &self, const ArrangerWidget *arranger)
Returns if the cached object should be visible, ie, while copy- moving (ctrl+drag) we want to show bo...
bool arranger_object_is_resize_loop(const ArrangerObject *self, const int y, bool ctrl_pressed)
Returns if the current position is for resizing loop.
ATTR_NONNULL bool arranger_object_is_resize_r(const ArrangerObject *self, const int x)
Returns if the current position is for resizing R.
bool arranger_object_should_show_cut_lines(const ArrangerObject *self, bool alt_pressed)
Returns if arranger_object widgets should show cut lines.
void arranger_object_draw(ArrangerObject *self, ArrangerWidget *arranger, GtkSnapshot *snapshot, GdkRectangle *rect)
Draws the given object.
struct _ArrangerWidget { GtkWidget parent_instance; ArrangerWidgetType type; GtkGestureDrag * drag; GtkGestureClick * click; GtkGestureClick * right_click; GtkEventControllerMotion *motion_controller; double last_offset_x; double last_offset_y; double offset_x_from_scroll; double offset_y_from_scroll; UiOverlayAction action; double start_x; double start_y; double start_pos_px; bool drag_update_started; std::unique_ptr< Position > earliest_obj_start_pos; Position fade_pos_at_start; std::unique_ptr< ArrangerObject > start_object; std::weak_ptr< ArrangerObject > prj_start_object; std::weak_ptr< ArrangerObject > hovered_object; bool start_object_was_selected; std::unique_ptr< ArrangerSelections > sel_at_start; std::unique_ptr< Region > region_at_start; std::unique_ptr< ArrangerSelections > sel_to_delete; Position start_pos; bool was_paused; Position playhead_pos_at_start; double curr_ticks_diff_from_start; double adj_ticks_diff; double last_adj_ticks_diff; Position curr_pos; Position end_pos; gboolean key_is_pressed; double hover_x; double hover_y; bool hovered; int n_press; std::shared_ptr< SnapGrid > snap_grid; int shift_held; int ctrl_held; int alt_held; gint64 last_frame_time; int visible_track_diff; int lane_diff; int visible_at_diff; int is_pinned; int resizing_range; int resizing_range_start; AutomationTrack *hovered_at; TrackLane * hovered_lane; Track * hovered_track; GdkTexture *symbolic_link_texture; GdkTexture *music_note_16th_texture; GdkTexture *fork_awesome_snowflake_texture; GdkTexture *media_playlist_repeat_texture; int region_icon_texture_size; GskRenderNode *loop_line_node; GskRenderNode *clip_start_line_node; GskRenderNode *cut_line_node; int hovered_note; int start_vel_val; int vel_diff; int hovered_chord_index; float fval_at_start; double dval_at_start; int last_playhead_px; bool redraw; graphene_rect_t last_rect; bool can_link; bool is_highlighted; GdkRectangle highlight_rect; GdkRectangle last_selection_rect; guint drag_start_btn; bool first_draw; double new_hadj_val; Transport::Display ruler_display; PangoLayoutUniquePtr vel_layout; PangoLayoutUniquePtr ap_layout; PangoLayoutUniquePtr audio_layout; PangoLayoutUniquePtr debug_layout; int queued_playhead_px; GtkPopoverMenu *popover_menu; guint unlisten_notes_timeout_id;} ArrangerWidget
A canvas widget for drawing and interacting with arranger objects.
Definition arranger.h:95
bool arranger_object_is_hovered(const ArrangerObject *self, const ArrangerWidget *arranger)
Whether the object is currently hovered.
int arranger_object_get_full_rect_x_for_region_child(ArrangerObject *self, Region &region, GdkRectangle *full_rect)
Gets the full rectangle for a linked object.
bool arranger_object_is_fade(const ArrangerObject *self, bool in, const int x, int y, bool only_handle, bool only_outer, bool check_lane)
Returns if the current position is for moving the fade in/out mark (timeline only).
int arranger_object_get_draw_rectangle(ArrangerObject *self, GdkRectangle *parent_rect, GdkRectangle *full_rect, GdkRectangle *draw_rect)
Gets the draw rectangle based on the given full rectangle of the arranger object.
ATTR_NONNULL bool arranger_object_is_resize_l(const ArrangerObject *self, const int x)
Returns if the current position is for resizing L.
ATTR_NONNULL bool arranger_object_is_rename(const ArrangerObject *self, const int x, const int y)
Returns if the current position is for renaming the object.
bool arranger_object_is_hovered_or_start_object(const ArrangerObject *self, const ArrangerWidget *arranger)
Whether hovered or the start object of the current action in the arranger.