1 /* GSequencer - Advanced GTK Sequencer 2 * Copyright (C) 2005-2019 Joël Krähemann 3 * 4 * This file is part of GSequencer. 5 * 6 * GSequencer is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU 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 * GSequencer 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 General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with GSequencer. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __AGS_AUTOMATION_EDIT_H__ 21 #define __AGS_AUTOMATION_EDIT_H__ 22 23 #include <glib.h> 24 #include <glib-object.h> 25 26 #include <gtk/gtk.h> 27 28 #include <ags/libags.h> 29 #include <ags/libags-audio.h> 30 #include <ags/libags-gui.h> 31 32 G_BEGIN_DECLS 33 34 #define AGS_TYPE_AUTOMATION_EDIT (ags_automation_edit_get_type()) 35 #define AGS_AUTOMATION_EDIT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_AUTOMATION_EDIT, AgsAutomationEdit)) 36 #define AGS_AUTOMATION_EDIT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_AUTOMATION_EDIT, AgsAutomationEditClass)) 37 #define AGS_IS_AUTOMATION_EDIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AGS_TYPE_AUTOMATION_EDIT)) 38 #define AGS_IS_AUTOMATION_EDIT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_AUTOMATION_EDIT)) 39 #define AGS_AUTOMATION_EDIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, AGS_TYPE_AUTOMATION_EDIT, AgsAutomationEditClass)) 40 41 #define AGS_AUTOMATION_EDIT_DEFAULT_HEIGHT (128) 42 #define AGS_AUTOMATION_EDIT_DEFAULT_WIDTH (512) 43 44 #define AGS_AUTOMATION_EDIT_DEFAULT_POINT_RADIUS (1.75) 45 46 #define AGS_AUTOMATION_EDIT_DEFAULT_SCAN_HEIGHT (8) 47 #define AGS_AUTOMATION_EDIT_DEFAULT_SCAN_WIDTH (64) 48 49 #define AGS_AUTOMATION_EDIT_DEFAULT_CONTROL_WIDTH (64) 50 #define AGS_AUTOMATION_EDIT_DEFAULT_CONTROL_HEIGHT (8) 51 52 #define AGS_AUTOMATION_EDIT_DEFAULT_STEP_COUNT (16) 53 54 #define AGS_AUTOMATION_EDIT_DEFAULT_CURSOR_POSITION_X (0) 55 #define AGS_AUTOMATION_EDIT_DEFAULT_CURSOR_POSITION_Y (0.0) 56 57 #define AGS_AUTOMATION_EDIT_DEFAULT_SELECTED_ACCELERATION_BORDER (2) 58 59 #define AGS_AUTOMATION_EDIT_DEFAULT_FADER_WIDTH (3) 60 61 #define AGS_AUTOMATION_EDIT_CURSOR_WIDTH (5) 62 #define AGS_AUTOMATION_EDIT_CURSOR_HEIGHT (5) 63 64 #define AGS_AUTOMATION_EDIT_MIN_ZOOM (1.0 / 16.0) 65 #define AGS_AUTOMATION_EDIT_MAX_ZOOM (4.0) 66 67 #define AGS_AUTOMATION_EDIT_DEFAULT_LOWER (0.0) 68 #define AGS_AUTOMATION_EDIT_DEFAULT_UPPER (1.0) 69 #define AGS_AUTOMATION_EDIT_DEFAULT_VALUE (0.0) 70 71 #define AGS_AUTOMATION_EDIT_DEFAULT_PADDING (8) 72 73 typedef struct _AgsAutomationEdit AgsAutomationEdit; 74 typedef struct _AgsAutomationEditClass AgsAutomationEditClass; 75 76 typedef enum{ 77 AGS_AUTOMATION_EDIT_CONNECTED = 1, 78 AGS_AUTOMATION_EDIT_AUTO_SCROLL = 1 << 1, 79 AGS_AUTOMATION_EDIT_SHOW_RULER = 1 << 2, 80 AGS_AUTOMATION_EDIT_SHOW_VSCROLLBAR = 1 << 3, 81 AGS_AUTOMATION_EDIT_SHOW_HSCROLLBAR = 1 << 4, 82 AGS_AUTOMATION_EDIT_LOGARITHMIC = 1 << 5, 83 }AgsAutomationEditFlags; 84 85 typedef enum{ 86 AGS_AUTOMATION_EDIT_NO_EDIT_MODE, 87 AGS_AUTOMATION_EDIT_POSITION_CURSOR, 88 AGS_AUTOMATION_EDIT_ADD_ACCELERATION, 89 AGS_AUTOMATION_EDIT_DELETE_ACCELERATION, 90 AGS_AUTOMATION_EDIT_SELECT_ACCELERATION, 91 }AgsAutomationEditMode; 92 93 typedef enum{ 94 AGS_AUTOMATION_EDIT_BUTTON_1 = 1, 95 }AgsAutomationEditButtonMask; 96 97 typedef enum{ 98 AGS_AUTOMATION_EDIT_KEY_L_CONTROL = 1, 99 AGS_AUTOMATION_EDIT_KEY_R_CONTROL = 1 << 1, 100 AGS_AUTOMATION_EDIT_KEY_L_SHIFT = 1 << 2, 101 AGS_AUTOMATION_EDIT_KEY_R_SHIFT = 1 << 3, 102 }AgsAutomationEditKeyMask; 103 104 struct _AgsAutomationEdit 105 { 106 GtkTable table; 107 108 guint flags; 109 guint mode; 110 111 guint button_mask; 112 guint key_mask; 113 114 guint note_offset; 115 guint note_offset_absolute; 116 117 guint point_radius; 118 119 guint scan_width; 120 guint scan_height; 121 122 guint control_width; 123 guint control_height; 124 125 guint step_count; 126 127 guint cursor_position_x; 128 gdouble cursor_position_y; 129 130 guint selected_acceleration_border; 131 132 guint selection_x0; 133 guint selection_x1; 134 guint selection_y0; 135 guint selection_y1; 136 137 AgsAcceleration *current_acceleration; 138 139 AgsRuler *ruler; 140 141 GType channel_type; 142 143 gchar *filename; 144 gchar *effect; 145 146 gchar *control_specifier; 147 gchar *control_name; 148 149 gdouble lower; 150 gdouble upper; 151 gdouble default_value; 152 153 GtkDrawingArea *drawing_area; 154 155 GtkVScrollbar *vscrollbar; 156 GtkHScrollbar *hscrollbar; 157 }; 158 159 struct _AgsAutomationEditClass 160 { 161 GtkTableClass table; 162 }; 163 164 GType ags_automation_edit_get_type(void); 165 166 void ags_automation_edit_reset_vscrollbar(AgsAutomationEdit *automation_edit); 167 void ags_automation_edit_reset_hscrollbar(AgsAutomationEdit *automation_edit); 168 169 void ags_automation_edit_draw_segment(AgsAutomationEdit *automation_edit, cairo_t *cr); 170 void ags_automation_edit_draw_position(AgsAutomationEdit *automation_edit, cairo_t *cr); 171 172 void ags_automation_edit_draw_cursor(AgsAutomationEdit *automation_edit, cairo_t *cr); 173 void ags_automation_edit_draw_selection(AgsAutomationEdit *automation_edit, cairo_t *cr); 174 175 void ags_automation_edit_draw_acceleration(AgsAutomationEdit *automation_edit, 176 AgsAcceleration *acceleration_a, AgsAcceleration *acceleration_b, 177 cairo_t *cr, 178 gdouble opacity); 179 void ags_automation_edit_draw_automation(AgsAutomationEdit *automation_edit, cairo_t *cr); 180 181 void ags_automation_edit_draw(AgsAutomationEdit *automation_edit, cairo_t *cr); 182 183 AgsAutomationEdit* ags_automation_edit_new(); 184 185 G_END_DECLS 186 187 #endif /*__AGS_AUTOMATION_EDIT_H__*/ 188