make midimap obey channels
[galan.git] / include / sample-display.h
blob26b603f0caa34ac45f2608c6ee852fdeb446ae9c
2 /*
3 * The Real SoundTracker - GTK+ sample display widget (header)
5 * Copyright (C) 1998-2000 Michael Krause
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef _SAMPLE_DISPLAY_H
23 #define _SAMPLE_DISPLAY_H
25 #include <gdk/gdk.h>
26 #include <gtk/gtkwidget.h>
28 #define SAMPLE_DISPLAY(obj) GTK_CHECK_CAST (obj, sample_display_get_type (), SampleDisplay)
29 #define SAMPLE_DISPLAY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, sample_display_get_type (), SampleDisplayClass)
30 #define IS_SAMPLE_DISPLAY(obj) GTK_CHECK_TYPE (obj, sample_display_get_type ())
32 typedef struct _SampleDisplay SampleDisplay;
33 typedef struct _SampleDisplayClass SampleDisplayClass;
35 enum {
36 SAMPLE_DISPLAYCOL_BG,
37 SAMPLE_DISPLAYCOL_FG,
38 SAMPLE_DISPLAYCOL_LOOP,
39 SAMPLE_DISPLAYCOL_MIXERPOS,
40 SAMPLE_DISPLAYCOL_ZERO,
41 SAMPLE_DISPLAYCOL_LAST
44 struct _SampleDisplay
46 GtkWidget widget;
47 int edit; /* enable loop / selection editing */
49 int width, height;
50 GdkGC *bg_gc, *fg_gc, *loop_gc, *mixerpos_gc;
51 guint idle_handler;
53 void *data;
54 int datalen;
55 int datatype;
56 gboolean datacopy; /* do we have our own copy */
57 int datacopylen;
59 int win_start, win_length;
61 int mixerpos, old_mixerpos; /* current playing offset of the sample */
63 gboolean display_zero_line;
64 GdkGC *zeroline_gc;
66 /* selection handling */
67 int sel_start, sel_end; /* offsets into the sample data or -1 */
68 int old_ss, old_se;
69 int button; /* button index which started the selection */
70 int selecting;
71 int selecting_x0; /* the coordinate where the mouse was clicked */
72 int selecting_wins0;
74 /* loop points */
75 int loop_start, loop_end; /* offsets into the sample data or -1 */
78 struct _SampleDisplayClass
80 GtkWidgetClass parent_class;
82 GdkColor colors[SAMPLE_DISPLAYCOL_LAST];
84 void (*selection_changed)(SampleDisplay *s, int start, int end);
85 void (*loop_changed)(SampleDisplay *s, int start, int end);
86 void (*window_changed)(SampleDisplay *s, int start, int end);
89 guint sample_display_get_type (void);
90 GtkWidget* sample_display_new (gboolean edit);
92 void sample_display_set_data_16 (SampleDisplay *s, gint16 *data, int len, gboolean copy);
93 void sample_display_set_data_8 (SampleDisplay *s, gint8 *data, int len, gboolean copy);
94 void sample_display_set_loop (SampleDisplay *s, int start, int end);
95 void sample_display_set_selection (SampleDisplay *s, int start, int end);
96 void sample_display_set_mixer_position (SampleDisplay *s, int offset);
97 void sample_display_enable_zero_line (SampleDisplay *s, gboolean enable);
99 void sample_display_set_window (SampleDisplay *s, int start, int end);
101 #endif /* _SAMPLE_DISPLAY_H */