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 #ifndef __GUI_WIDGETS_MIDI_ACTIVITY_BAR_H__
21 #define __GUI_WIDGETS_MIDI_ACTIVITY_BAR_H__
22 
23 /**
24  * \file
25  *
26  * MIDI activity bar for tracks.
27  */
28 
29 #include <gtk/gtk.h>
30 
31 #define MIDI_ACTIVITY_BAR_WIDGET_TYPE \
32   (midi_activity_bar_widget_get_type ())
33 G_DECLARE_FINAL_TYPE (
34   MidiActivityBarWidget,
35   midi_activity_bar_widget,
36   Z, MIDI_ACTIVITY_BAR_WIDGET,
37   GtkDrawingArea)
38 
39 typedef struct Track Track;
40 
41 /**
42  * @addtogroup widgets
43  *
44  * @{
45  */
46 
47 typedef enum MidiActivityBarType
48 {
49   MAB_TYPE_TRACK,
50   MAB_TYPE_ENGINE,
51 } MidiActivityBarType;
52 
53 typedef enum MidiActivityBarAnimation
54 {
55   /** Shows a bars that decreases over time. */
56   MAB_ANIMATION_BAR,
57   /** Shows a flash that fades out over time. */
58   MAB_ANIMATION_FLASH,
59 } MidiActivityBarAnimation;
60 
61 typedef struct _MidiActivityBarWidget
62 {
63   GtkDrawingArea parent_instance;
64 
65   /** Track associated with this widget. */
66   Track  *       track;
67 
68   MidiActivityBarType type;
69 
70   MidiActivityBarAnimation animation;
71 
72   /** System time at last trigger, so we know
73    * how to draw the bar (for fading down). */
74   gint64         last_trigger_time;
75 
76   /** Draw border or not. */
77   int            draw_border;
78 
79 } MidiActivityBarWidget;
80 
81 /**
82  * Creates a MidiActivityBarWidget for use inside
83  * TrackWidget implementations.
84  */
85 void
86 midi_activity_bar_widget_setup_track (
87   MidiActivityBarWidget * self,
88   Track *                 track);
89 
90 /**
91  * Sets the animation.
92  */
93 void
94 midi_activity_bar_widget_set_animation (
95   MidiActivityBarWidget * self,
96   MidiActivityBarAnimation animation);
97 
98 /**
99  * Creates a MidiActivityBarWidget for the
100  * AudioEngine.
101  */
102 void
103 midi_activity_bar_widget_setup_engine (
104   MidiActivityBarWidget * self);
105 
106 /**
107  * @}
108  */
109 
110 #endif
111