| 1 |
/* |
|---|
| 2 |
* Sweep, a sound wave editor |
|---|
| 3 |
* |
|---|
| 4 |
* Copyright (C) 2000 Conrad Parker |
|---|
| 5 |
* |
|---|
| 6 |
* This program 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 2 of the License, or |
|---|
| 9 |
* (at your option) any later version. |
|---|
| 10 |
* |
|---|
| 11 |
* This program 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 this program; if not, write to the Free Software |
|---|
| 18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 19 |
*/ |
|---|
| 20 |
|
|---|
| 21 |
#ifndef _SAMPLE_DISPLAY_H |
|---|
| 22 |
#define _SAMPLE_DISPLAY_H |
|---|
| 23 |
|
|---|
| 24 |
#include <gdk/gdk.h> |
|---|
| 25 |
#include <gtk/gtkwidget.h> |
|---|
| 26 |
|
|---|
| 27 |
#include <sweep/sweep_types.h> |
|---|
| 28 |
#include <sweep/sweep_sample.h> |
|---|
| 29 |
#include "view.h" |
|---|
| 30 |
|
|---|
| 31 |
#define SAMPLE_DISPLAY(obj) GTK_CHECK_CAST (obj, sample_display_get_type (), SampleDisplay) |
|---|
| 32 |
#define SAMPLE_DISPLAY_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, sample_display_get_type (), SampleDisplayClass) |
|---|
| 33 |
#define IS_SAMPLE_DISPLAY(obj) GTK_CHECK_TYPE (obj, sample_display_get_type ()) |
|---|
| 34 |
|
|---|
| 35 |
typedef struct _SampleDisplay SampleDisplay; |
|---|
| 36 |
typedef struct _SampleDisplayClass SampleDisplayClass; |
|---|
| 37 |
|
|---|
| 38 |
enum { |
|---|
| 39 |
SAMPLE_DISPLAYCOL_BG, |
|---|
| 40 |
SAMPLE_DISPLAYCOL_FG, |
|---|
| 41 |
SAMPLE_DISPLAYCOL_PLAY, |
|---|
| 42 |
SAMPLE_DISPLAYCOL_PAUSE, |
|---|
| 43 |
SAMPLE_DISPLAYCOL_ZERO, |
|---|
| 44 |
SAMPLE_DISPLAYCOL_SEL, |
|---|
| 45 |
SAMPLE_DISPLAYCOL_TMP_SEL, |
|---|
| 46 |
SAMPLE_DISPLAYCOL_CROSSING, |
|---|
| 47 |
SAMPLE_DISPLAYCOL_MINMAX, |
|---|
| 48 |
SAMPLE_DISPLAYCOL_HIGHLIGHT, |
|---|
| 49 |
SAMPLE_DISPLAYCOL_LOWLIGHT, |
|---|
| 50 |
SAMPLE_DISPLAYCOL_REC, |
|---|
| 51 |
SAMPLE_DISPLAYCOL_LAST |
|---|
| 52 |
}; |
|---|
| 53 |
|
|---|
| 54 |
struct _SampleDisplay |
|---|
| 55 |
{ |
|---|
| 56 |
GtkWidget widget; |
|---|
| 57 |
|
|---|
| 58 |
GdkGC *bg_gc, *fg_gc, *play_gc, *user_gc, *rec_gc, *sel_gc, *tmp_sel_gc, |
|---|
| 59 |
*crossing_gc; |
|---|
| 60 |
GdkGC *minmax_gc, *zeroline_gc, *highlight_gc, *lowlight_gc; |
|---|
| 61 |
|
|---|
| 62 |
GdkGC * bg_gcs[VIEW_COLOR_MAX]; |
|---|
| 63 |
GdkGC * fg_gcs[VIEW_COLOR_MAX]; |
|---|
| 64 |
|
|---|
| 65 |
GdkPixmap * backing_pixmap; |
|---|
| 66 |
|
|---|
| 67 |
int width, height; /* Width and height of the widget */ |
|---|
| 68 |
|
|---|
| 69 |
sw_view * view; /* The view (and hence, sample) we're displaying */ |
|---|
| 70 |
|
|---|
| 71 |
/* current user offset of the sample */ |
|---|
| 72 |
int user_offset_x, old_user_offset_x; |
|---|
| 73 |
|
|---|
| 74 |
/* previous play_offset drawn */ |
|---|
| 75 |
int play_offset_x, old_play_offset_x; |
|---|
| 76 |
|
|---|
| 77 |
/* current recording offset */ |
|---|
| 78 |
int rec_offset_x, old_rec_offset_x; |
|---|
| 79 |
|
|---|
| 80 |
gint mouse_x; |
|---|
| 81 |
glong mouse_offset; /* what the pointer is currently pointing to */ |
|---|
| 82 |
|
|---|
| 83 |
int selecting; /* Current state of this sample-display */ |
|---|
| 84 |
int selection_mode; /* Mode of selection: replace or intersect */ |
|---|
| 85 |
|
|---|
| 86 |
gint marching_tag; /* gtk_timeout tag for marching ants */ |
|---|
| 87 |
gboolean marching; /* whether or not ants are marching */ |
|---|
| 88 |
|
|---|
| 89 |
gint pulsing_tag; /* gtk_timeout tag for cursor pulse */ |
|---|
| 90 |
gboolean pulse; |
|---|
| 91 |
|
|---|
| 92 |
gint hand_scroll_tag; /* gtk_timeout tag for natural hand scrolling */ |
|---|
| 93 |
gint hand_scroll_delta; /* natural hand scrolling */ |
|---|
| 94 |
|
|---|
| 95 |
/* Window panning */ |
|---|
| 96 |
int selecting_x0; /* the coordinate where the mouse was clicked */ |
|---|
| 97 |
int selecting_wins0; /* stored value of view->v_start when the mouse |
|---|
| 98 |
* was clicked */ |
|---|
| 99 |
|
|---|
| 100 |
/* Scrolling timeout tags */ |
|---|
| 101 |
gint scroll_left_tag, scroll_right_tag; |
|---|
| 102 |
|
|---|
| 103 |
/* Meta key down? */ |
|---|
| 104 |
gboolean meta_down; |
|---|
| 105 |
}; |
|---|
| 106 |
|
|---|
| 107 |
struct _SampleDisplayClass |
|---|
| 108 |
{ |
|---|
| 109 |
GtkWidgetClass parent_class; |
|---|
| 110 |
|
|---|
| 111 |
GdkColor colors[SAMPLE_DISPLAYCOL_LAST]; |
|---|
| 112 |
GdkColor bg_colors[VIEW_COLOR_MAX]; |
|---|
| 113 |
GdkColor fg_colors[VIEW_COLOR_MAX]; |
|---|
| 114 |
|
|---|
| 115 |
void (*selection_changed)(SampleDisplay *s, int start, int end); |
|---|
| 116 |
void (*window_changed)(SampleDisplay *s, int start, int end); |
|---|
| 117 |
void (*mouse_offset_changed)(SampleDisplay *s, int mouse_offset); |
|---|
| 118 |
}; |
|---|
| 119 |
|
|---|
| 120 |
GType |
|---|
| 121 |
sample_display_get_type (void); |
|---|
| 122 |
|
|---|
| 123 |
GtkWidget* |
|---|
| 124 |
sample_display_new (void); |
|---|
| 125 |
|
|---|
| 126 |
void |
|---|
| 127 |
sample_display_refresh (SampleDisplay *s); |
|---|
| 128 |
|
|---|
| 129 |
sw_framecount_t |
|---|
| 130 |
sample_display_get_mouse_offset (SampleDisplay * s); |
|---|
| 131 |
|
|---|
| 132 |
void |
|---|
| 133 |
sample_display_set_view (SampleDisplay *s, sw_view *view); |
|---|
| 134 |
|
|---|
| 135 |
void |
|---|
| 136 |
sample_display_refresh_user_marker (SampleDisplay *s); |
|---|
| 137 |
|
|---|
| 138 |
void |
|---|
| 139 |
sample_display_refresh_play_marker (SampleDisplay *s); |
|---|
| 140 |
|
|---|
| 141 |
void |
|---|
| 142 |
sample_display_refresh_rec_marker (SampleDisplay *s); |
|---|
| 143 |
|
|---|
| 144 |
void |
|---|
| 145 |
sample_display_set_cursor (SampleDisplay * s, GdkCursor * cursor); |
|---|
| 146 |
|
|---|
| 147 |
void |
|---|
| 148 |
sample_display_set_window (SampleDisplay *s, sw_framecount_t start, |
|---|
| 149 |
sw_framecount_t end); |
|---|
| 150 |
|
|---|
| 151 |
void |
|---|
| 152 |
sample_display_clear_sel (SampleDisplay * s); |
|---|
| 153 |
|
|---|
| 154 |
void |
|---|
| 155 |
sample_display_sink_tmp_sel (SampleDisplay * s); |
|---|
| 156 |
|
|---|
| 157 |
void |
|---|
| 158 |
sample_display_start_marching_ants (SampleDisplay * s); |
|---|
| 159 |
|
|---|
| 160 |
void |
|---|
| 161 |
sample_display_stop_marching_ants (SampleDisplay * s); |
|---|
| 162 |
|
|---|
| 163 |
#endif /* _SAMPLE_DISPLAY_H */ |
|---|