1 /* 2 * Copyright (C) 2019 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 Zrythm. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 /** 21 * \file 22 * 23 * Timeline minimap. 24 */ 25 26 #ifndef __GUI_WIDGETS_TIMELINE_MINIMAP_H__ 27 #define __GUI_WIDGETS_TIMELINE_MINIMAP_H__ 28 29 #include "audio/position.h" 30 31 #include <gtk/gtk.h> 32 33 #define TIMELINE_MINIMAP_WIDGET_TYPE \ 34 (timeline_minimap_widget_get_type ()) 35 G_DECLARE_FINAL_TYPE ( 36 TimelineMinimapWidget, 37 timeline_minimap_widget, 38 Z, TIMELINE_MINIMAP_WIDGET, 39 GtkOverlay) 40 41 typedef struct _TimelineMinimapBgWidget TimelineMinimapBgWidget; 42 typedef struct _TimelineMinimapSelectionWidget TimelineMinimapSelectionWidget; 43 typedef struct TimelineMinimap TimelineMinimap; 44 45 /** 46 * @addtogroup widgets 47 * 48 * @{ 49 */ 50 51 #define MW_TIMELINE_MINIMAP \ 52 MW_TIMELINE_BOT_BOX->timeline_minimap 53 54 typedef enum TimelineMinimapAction 55 { 56 TIMELINE_MINIMAP_ACTION_NONE, 57 TIMELINE_MINIMAP_ACTION_RESIZING_L, 58 TIMELINE_MINIMAP_ACTION_RESIZING_R, 59 TIMELINE_MINIMAP_ACTION_STARTING_MOVING, ///< in drag_start 60 TIMELINE_MINIMAP_ACTION_MOVING, ///< in drag start, 61 ///< also for dragging up/down bitwig style 62 } TimelineMinimapAction; 63 64 typedef struct _TimelineMinimapWidget 65 { 66 GtkOverlay parent_instance; 67 TimelineMinimapBgWidget * bg; 68 TimelineMinimapSelectionWidget * selection; 69 TimelineMinimapAction action; 70 GtkGestureDrag * drag; 71 GtkGestureMultiPress * multipress; 72 GtkGestureMultiPress * right_mouse_mp; 73 double last_offset_x; ///< for dragging regions, selections 74 double last_offset_y; ///< for selections 75 double selection_start_pos; ///< to be set in drag_begin 76 double selection_end_pos; ///< to be set in drag_begin 77 double start_x; ///< for dragging 78 double start_y; ///< for dragging 79 double start_zoom_level; //< to be set in drag_begin 80 int n_press; ///< for multipress 81 } TimelineMinimapWidget; 82 83 /** 84 * Taken from arranger.c 85 */ 86 void 87 timeline_minimap_widget_px_to_pos ( 88 TimelineMinimapWidget * self, 89 Position * pos, 90 int px); 91 92 /** 93 * Causes reallocation. 94 */ 95 void 96 timeline_minimap_widget_refresh ( 97 TimelineMinimapWidget * self); 98 99 /** 100 * @} 101 */ 102 103 #endif 104