1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/**
* @file
* Private header for the \e GtkExperimentTranscript widget
*/
/*
* Copyright (C) 2012 Otto-von-Guericke-Universität Magdeburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_EXPERIMENT_TRANSCRIPT_PRIVATE_H
#define __GTK_EXPERIMENT_TRANSCRIPT_PRIVATE_H
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <experiment-reader.h>
#include "gtk-experiment-transcript.h"
/** @private */
#define GTK_EXPERIMENT_TRANSCRIPT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_EXPERIMENT_TRANSCRIPT, GtkExperimentTranscriptPrivate))
/** @private */
typedef struct _GtkExperimentTranscriptFormat {
GRegex *regexp;
PangoAttrList *attribs;
} GtkExperimentTranscriptFormat;
/** @private */
typedef enum {
GTK_EXPERIMENT_TRANSCRIPT_REVERSE_MASK = 1 << 0
} GtkExperimentTranscriptFlagMask;
/**
* @private
* Private instance attribute structure.
* You can access these attributes using \c klass->priv->attribute.
*/
struct _GtkExperimentTranscriptPrivate {
gint flag_mask;
GtkObject *time_adjustment;
gulong time_adj_on_value_changed_id;
GdkPixmap *layer_text;
PangoLayout *layer_text_layout;
GList *contribs;
GSList *formats;
GtkExperimentTranscriptFormat interactive_format;
GtkWidget *menu; /**< Drop-down menu, doesn't have to be unreferenced manually */
GSList *alignment_group; /**< GtkRadioMenuItem group for Alignment settings (owned by GTK) */
GtkWidget *menu_reverse_item;
};
/** @private */
typedef gboolean (*GtkExperimentTranscriptContribRenderer)
(GtkExperimentTranscript *, ExperimentReaderContrib *,
gint64, gint64, gint *);
#define DEFAULT_WIDTH 100
#define DEFAULT_HEIGHT 200
/** @todo scale should be configurable */
#define PX_PER_SECOND 15
#define TIME_TO_PX(TIME) ((TIME)/(1000/PX_PER_SECOND))
#define PX_TO_TIME(PX) (((PX)*1000)/PX_PER_SECOND)
/**
* @private
* Unreference object given by variable, but only once.
* Use it in \ref gtk_experiment_transcript_dispose to unreference object
* references in public or private instance attributes.
*
* @sa gtk_experiment_transcript_dispose
*
* @param VAR Variable to unreference
*/
#define GOBJECT_UNREF_SAFE(VAR) do { \
if ((VAR) != NULL) { \
g_object_unref(VAR); \
VAR = NULL; \
} \
} while (0)
/** @private */
void gtk_experiment_transcript_text_layer_redraw(GtkExperimentTranscript *trans);
/** @private */
void gtk_experiment_transcript_apply_format(GtkExperimentTranscriptFormat *fmt,
const gchar *text,
PangoAttrList *attrib_list);
/** @private */
static inline void
gtk_experiment_transcript_free_format(GtkExperimentTranscriptFormat *format)
{
if (format->regexp != NULL)
g_regex_unref(format->regexp);
if (format->attribs != NULL)
pango_attr_list_unref(format->attribs);
}
/** @private */
void gtk_experiment_transcript_free_formats(GSList *formats);
#endif
|