1 /* 2 * Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org> 3 * 4 * This file is part of Zrythm 5 * 6 * Zrythm is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Zrythm is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __GUI_WIDGETS_AUDIO_ARRANGER_H__ 21 #define __GUI_WIDGETS_AUDIO_ARRANGER_H__ 22 23 #include "gui/backend/tool.h" 24 #include "gui/widgets/arranger.h" 25 #include "gui/widgets/main_window.h" 26 #include "audio/position.h" 27 28 #include <gtk/gtk.h> 29 30 /** 31 * @addtogroup widgets 32 * 33 * @{ 34 */ 35 36 #define MW_AUDIO_ARRANGER \ 37 MW_AUDIO_EDITOR_SPACE->arranger 38 39 void 40 audio_arranger_widget_snap_range_r ( 41 ArrangerWidget * self, 42 Position * pos); 43 44 /** 45 * Returns whether the cursor is inside a fade 46 * area. 47 * 48 * @param fade_in True to check for fade in, false 49 * to check for fade out. 50 * @param resize True to check for whether resizing 51 * the fade (left <=> right), false to check 52 * for whether changing the fade curviness up/down. 53 */ 54 bool 55 audio_arranger_widget_is_cursor_in_fade ( 56 ArrangerWidget * self, 57 double x, 58 double y, 59 bool fade_in, 60 bool resize); 61 62 /** 63 * Returns whether the cursor touches the gain line. 64 */ 65 bool 66 audio_arranger_widget_is_cursor_gain ( 67 ArrangerWidget * self, 68 double x, 69 double y); 70 71 UiOverlayAction 72 audio_arranger_widget_get_action_on_drag_begin ( 73 ArrangerWidget * self); 74 75 /** 76 * Handle fade in/out curviness drag. 77 */ 78 void 79 audio_arranger_widget_fade_up ( 80 ArrangerWidget * self, 81 double offset_y, 82 bool fade_in); 83 84 void 85 audio_arranger_widget_update_gain ( 86 ArrangerWidget * self, 87 double offset_y); 88 89 /** 90 * Updates the fade position during drag update. 91 * 92 * @param pos Absolute position in the editor. 93 * @param fade_in Whether we are resizing the fade in 94 * or fade out position. 95 * @parram dry_run Don't resize; just check 96 * if the resize is allowed. 97 * 98 * @return 0 if the operation was successful, 99 * nonzero otherwise. 100 */ 101 int 102 audio_arranger_widget_snap_fade ( 103 ArrangerWidget * self, 104 Position * pos, 105 bool fade_in, 106 bool dry_run); 107 108 /** 109 * Queues a redraw on fade in or fade out. 110 */ 111 void 112 audio_arranger_widget_redraw_fade ( 113 ArrangerWidget * self, 114 bool fade_in); 115 116 /** 117 * Queues a redraw of the gain line. 118 */ 119 void 120 audio_arranger_widget_redraw_gain ( 121 ArrangerWidget * self); 122 123 /** 124 * @} 125 */ 126 127 #endif 128