BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bsteventroll.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BST_EVENT_ROLL_H__
00003 #define __BST_EVENT_ROLL_H__
00004 
00005 #include        "bstsegment.hh"
00006 
00007 G_BEGIN_DECLS
00008 
00009 /* --- type macros --- */
00010 #define BST_TYPE_EVENT_ROLL              (bst_event_roll_get_type ())
00011 #define BST_EVENT_ROLL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BST_TYPE_EVENT_ROLL, BstEventRoll))
00012 #define BST_EVENT_ROLL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), BST_TYPE_EVENT_ROLL, BstEventRollClass))
00013 #define BST_IS_EVENT_ROLL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BST_TYPE_EVENT_ROLL))
00014 #define BST_IS_EVENT_ROLL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), BST_TYPE_EVENT_ROLL))
00015 #define BST_EVENT_ROLL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BST_TYPE_EVENT_ROLL, BstEventRollClass))
00016 
00017 
00018 /* --- typedefs & enums --- */
00019 typedef struct _BstEventRoll        BstEventRoll;
00020 typedef struct _BstEventRollClass   BstEventRollClass;
00021 
00022 
00023 /* --- structures & typedefs --- */
00024 typedef struct {
00025   GXK_SCROLL_CANVAS_DRAG_FIELDS;
00026   gint          tick_width;
00027   guint         start_tick;
00028   gfloat        start_value;
00029   guint         start_valid : 1;
00030   guint         current_tick;
00031   gfloat        current_value;          /* between -1 and +1 if valid */
00032   gfloat        current_value_raw;
00033   guint         current_valid : 1;      /* value out of range */
00034   /* convenience: */
00035   BstEventRoll *eroll;
00036 } BstEventRollDrag;
00037 struct _BstEventRoll
00038 {
00039   GxkScrollCanvas parent_instance;
00040 
00041   SfiProxy       proxy;
00042   BseMidiSignalType control_type;
00043   GtkWidget     *child;
00044 
00045   /* horizontal layout */
00046   guint          ppqn;          /* parts per quarter note */
00047   guint          qnpt;          /* quarter notes per tact */
00048   guint          max_ticks;     /* in ticks */
00049   gfloat         hzoom;
00050   guint          draw_qn_grid : 1;
00051   guint          draw_qqn_grid : 1;
00052 
00053   /* drag data */
00054   guint         start_valid : 1;
00055   guint         start_tick;
00056   gfloat        start_value;
00057 
00058   /* vpanel width sync */
00059   gint         (*fetch_vpanel_width) (gpointer data);
00060   gpointer       fetch_vpanel_width_data;
00061 
00062   /* line drawing */
00063   BstSegment     segment;
00064 
00065   /* selection rectangle */
00066   guint          selection_tick;
00067   guint          selection_duration;
00068   gint           selection_min_note;
00069   gint           selection_max_note;
00070 };
00071 struct _BstEventRollClass
00072 {
00073   GxkScrollCanvasClass parent_class;
00074 
00075   void          (*canvas_drag)                  (BstEventRoll     *self,
00076                                                  BstEventRollDrag *drag);
00077   void          (*canvas_clicked)               (BstEventRoll     *eroll,
00078                                                  guint             button,
00079                                                  guint             tick_position,
00080                                                  gfloat            value,
00081                                                  GdkEvent         *event);
00082   void          (*vpanel_drag)                  (BstEventRoll     *self,
00083                                                  BstEventRollDrag *drag);
00084   void          (*vpanel_clicked)               (BstEventRoll     *eroll,
00085                                                  guint             button,
00086                                                  gfloat            value,
00087                                                  GdkEvent         *event);
00088 };
00089 
00090 
00091 /* --- prototypes --- */
00092 GType       bst_event_roll_get_type              (void);
00093 void        bst_event_roll_set_proxy             (BstEventRoll   *self,
00094                                                   SfiProxy        proxy);
00095 gfloat      bst_event_roll_set_hzoom             (BstEventRoll   *self,
00096                                                   gfloat          hzoom);
00097 void        bst_event_roll_set_view_selection    (BstEventRoll   *self,
00098                                                   guint           tick,
00099                                                   guint           duration);
00100 void        bst_event_roll_set_vpanel_width_hook (BstEventRoll   *self,
00101                                                   gint          (*fetch_vpanel_width) (gpointer data),
00102                                                   gpointer        data);
00103 void        bst_event_roll_set_control_type      (BstEventRoll *self, BseMidiSignalType control_type);
00104 void        bst_event_roll_init_segment          (BstEventRoll   *self,
00105                                                   BstSegmentType  type);
00106 void        bst_event_roll_segment_start         (BstEventRoll   *self,
00107                                                   guint           tick,
00108                                                   gfloat          value);
00109 void        bst_event_roll_segment_move_to       (BstEventRoll   *self,
00110                                                   guint           tick,
00111                                                   gfloat          value);
00112 void        bst_event_roll_segment_tick_range    (BstEventRoll   *self,
00113                                                   guint          *tick,
00114                                                   guint          *duration);
00115 gdouble     bst_event_roll_segment_value         (BstEventRoll   *self,
00116                                                   guint           tick);
00117 void        bst_event_roll_clear_segment         (BstEventRoll   *self);
00118 
00119 G_END_DECLS
00120 
00121 #endif /* __BST_EVENT_ROLL_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines