1 /* 2 3 (c) Fraser Stuart 2009 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 19 */ 20 21 #ifndef __KNOB_H 22 #define __KNOB_H 23 24 #include <gtk/gtk.h> 25 #include <cairo.h> 26 #include "widgets.h" 27 28 G_BEGIN_DECLS 29 30 #define INV_KNOB_DRAW_ALL 0 31 #define INV_KNOB_DRAW_DATA 1 32 33 #define INV_KNOB_SIZE_SMALL 50 34 #define INV_KNOB_SIZE_MEDIUM 64 35 #define INV_KNOB_SIZE_LARGE 80 36 37 #define INV_KNOB_CURVE_LINEAR 0 38 #define INV_KNOB_CURVE_LOG 1 39 #define INV_KNOB_CURVE_QUAD 2 40 41 #define INV_KNOB_MARKINGS_PAN 0 42 #define INV_KNOB_MARKINGS_CUST10 1 43 #define INV_KNOB_MARKINGS_CUST12 2 44 #define INV_KNOB_MARKINGS_3 3 45 #define INV_KNOB_MARKINGS_4 4 46 #define INV_KNOB_MARKINGS_5 5 47 #define INV_KNOB_MARKINGS_10 10 48 49 #define INV_KNOB_HIGHLIGHT_L -1 50 #define INV_KNOB_HIGHLIGHT_C 0 51 #define INV_KNOB_HIGHLIGHT_R 1 52 53 #define INV_KNOB(obj) GTK_CHECK_CAST(obj, inv_knob_get_type (), InvKnob) 54 #define INV_KNOB_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, inv_knob_get_type(), InvKnobClass) 55 #define INV_IS_KNOB(obj) GTK_CHECK_TYPE(obj, inv_knob_get_type()) 56 57 58 typedef struct _InvKnob InvKnob; 59 typedef struct _InvKnobClass InvKnobClass; 60 61 62 struct _InvKnob { 63 GtkWidget widget; 64 65 gint bypass; 66 67 gint size; 68 gint curve; 69 gint markings; 70 gint highlight; 71 gint human; 72 char units[5]; 73 char clow[10]; 74 char cmid[10]; 75 char chigh[10]; 76 float min; 77 float max; 78 float value; 79 float lastvalue; 80 float click_x; 81 float click_y; 82 83 GdkPixbuf *img_small; 84 GdkPixbuf *img_med; 85 GdkPixbuf *img_large; 86 87 gint font_size; 88 89 }; 90 91 struct _InvKnobClass { 92 GtkWidgetClass parent_class; 93 94 }; 95 96 97 GtkType inv_knob_get_type(void); 98 GtkWidget * inv_knob_new(); 99 100 void inv_knob_set_bypass(InvKnob *knob, gint num); 101 void inv_knob_set_size(InvKnob *knob, gint num); 102 void inv_knob_set_curve(InvKnob *knob, gint num); 103 void inv_knob_set_markings(InvKnob *knob, gint num); 104 void inv_knob_set_custom(InvKnob *knob, gint pos, char *label); 105 void inv_knob_set_highlight(InvKnob *knob, gint num); 106 void inv_knob_set_human(InvKnob *knob); 107 void inv_knob_set_units(InvKnob *knob, char *units); 108 void inv_knob_set_min(InvKnob *knob, float num); 109 void inv_knob_set_max(InvKnob *knob, float num); 110 void inv_knob_set_value(InvKnob *knob, float num); 111 void inv_knob_set_tooltip(InvKnob *knob, gchar *tip); 112 float inv_knob_get_value(InvKnob *knob); 113 114 115 G_END_DECLS 116 117 #endif /* __KNOB_H */ 118 119