1 /*
2  * Copyright (C) 2002 2003 2004, Magnus Hjorth
3  *
4  * This file is part of mhWaveEdit.
5  *
6  * mhWaveEdit 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  * mhWaveEdit 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 mhWaveEdit; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 
22 /* ChunkView is a graphical component that gives a view of the data inside a
23  * chunk object.
24  */
25 
26 #ifndef CHUNKVIEW_H_INCLUDED
27 #define CHUNKVIEW_H_INCLUDED
28 
29 #include <gtk/gtk.h>
30 #include "chunk.h"
31 #include "document.h"
32 #include "viewcache.h"
33 
34 #define CHUNKVIEW(obj) GTK_CHECK_CAST (obj, chunk_view_get_type(), ChunkView)
35 #define CHUNKVIEW_CLASS(klass) GTK_CHECK_CLASS_CAST(klass,chunk_view_get_type(),ChunkViewClass)
36 #define IS_CHUNKVIEW(obj) GTK_CHECK_TYPE (obj,chunk_view_get_type())
37 
38 
39 typedef struct _ChunkView {
40 
41      /* PRIVATE MEMBERS - Keep out! */
42 
43      GtkDrawingArea parent;
44 
45      /* Image used for double-buffering the sample view. Only used under GTK2,
46       * however the image_width/image_height variables are used at various
47       * places so they are kept updated (ugly solution) */
48      GdkPixmap *image;
49      guint image_width,image_height;
50 
51 
52      ViewCache *cache;
53      int last_redraw_time,need_redraw_left,need_redraw_right;
54 
55      gfloat scale_factor; /* Vertical scaling factor (default: 1.0) */
56 
57      /* READ-ONLY PUBLIC MEMBERS */
58      /* To change these, use the public functions below. */
59 
60      Document *doc;
61      gboolean timescale;        /* Time scale visible flag */
62      gboolean show_bufpos;
63 
64 } ChunkView;
65 
66 typedef struct _ChunkViewClass {
67      GtkDrawingAreaClass parent_class;
68 
69      /* SIGNALS */
70 
71      /* Emitted when the user double-clicked somewhere in the view */
72      /* The off_t pointer is because off_t values aren't directly supported by
73       * the GTK (1.2) type system */
74      void (*double_click)(ChunkView *view, off_t *sample);
75 
76 } ChunkViewClass;
77 
78 GtkType chunk_view_get_type(void);
79 
80 
81 /* Creates a new ChunkView */
82 GtkWidget *chunk_view_new(void);
83 
84 
85 void chunk_view_set_document(ChunkView *cv, Document *d);
86 
87 
88 /* Selects whether a time scale should be drawn at the bottom of the view. */
89 void chunk_view_set_timescale(ChunkView *cv, gboolean scale_visible);
90 
91 
92 /* This is called when the caches should progress. */
93 
94 gboolean chunk_view_update_cache(ChunkView *cv);
95 
96 void chunk_view_force_repaint(ChunkView *cv);
97 
98 void chunk_view_use_backing_pixmap(ChunkView *cv, gboolean use_pixmap);
99 
100 void chunk_view_set_scale(ChunkView *cv, gfloat scale);
101 
102 #endif
103