File: denemo.h

package info (click to toggle)
denemo 2.2.0-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 53,500 kB
  • ctags: 9,731
  • sloc: ansic: 80,323; lisp: 33,381; xml: 15,377; sh: 11,905; makefile: 1,116
file content (186 lines) | stat: -rw-r--r-- 6,051 bytes parent folder | download | duplicates (2)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/* denemo.h
 *
 * the important data structures and defines for denemo, a gtk+ frontend to
 * Lilypond, the GNU music typesetter
 *
 * (c) 1999-2005 Matthew Hiller, Adam Tee
 *
 */

#ifndef DENEMO_DATASTRUCTURES
#define DENEMO_DATASTRUCTURES
#ifdef __cplusplus
extern "C" {
#endif

/* Include the internationalization stuff.  */
#include <libintl.h>
#include <locale.h>

#define _(String) gettext (String)
#ifndef gettext_noop
# define gettext_noop(String) String
#endif
#ifndef N_
# define N_(String) gettext_noop (String)
#endif


#include <glib.h>
#include <gmodule.h>

#include "denemo_api.h"



/*Set maximum number of undos*/
#define MAX_UNDOS 50

/* This unit of memory size is used all over the place.  */
#define SEVENGINTS (sizeof (gint) * 7)

#define CHECKING_MASK (GDK_CONTROL_MASK)
#define ADDING_MASK (GDK_MOD1_MASK)  //Alt
#define CHORD_MASK (1<<25)  //Not used by GDK

#define DENEMO_INITIAL_MEASURE_WIDTH 160
#define DENEMO_INITIAL_STAFF_HEIGHT 100

#define DENEMO_FILE_SUFFIX  ".denemo"
#define XML_EXT             ".xml"
#define SCM_EXT             ".scm"
#define LILYPOND_EXT        ".ly"
#define KEYMAP_EXT          ".commands"

#define SCHEME_INIT         "denemo.scm"
#define DENEMO_NO_COMMAND (-1) /* command id for no command */

#define g_malloc(a) g_malloc0(a) /* for extensible debuggable code */
#if 0
  //use this to detect bad access to G_OBJECT
#define g_object_set_data(a,b,c) (G_IS_OBJECT((a))? g_object_set_data((a),(b),(c)):((gpointer)fprintf(stderr,"Bad G_OBJECT at %s line %d\n",__FILE__, __LINE__), NULL))
#define g_object_get_data(a,b) (G_IS_OBJECT(a)? g_object_get_data((a),(b)):((gpointer)fprintf(stderr,"Bad G_OBJECT at %s line %d\n",__FILE__, __LINE__), NULL))
#endif
#if 0
  // use these to test for bad frees.
#define g_list_free
#define g_error_free
#define gtk_tree_path_free
#define g_free(a) (a)
#define g_string_free(a, b) (((GString*)(a))->str)
#endif


#define gtk_widget_reparent(w,p) (g_object_ref(G_OBJECT(w)),gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(w)), w),gtk_container_add(GTK_CONTAINER(p), w),g_object_unref(G_OBJECT(w)))


#if ((GTK_MAJOR_VERSION == 3) && (GTK_MINOR_VERSION >= 10))
#define FAKE_TOOLTIPS 1
#endif

#if ((GTK_MAJOR_VERSION == 3) && (GTK_MINOR_VERSION >= 22))
#define gtk_menu_popup(m, p2,p3,p4,p5,p6,p7) gtk_menu_popup_at_pointer(m, NULL)
#endif
#if ((GTK_MAJOR_VERSION == 2) || ((GTK_MAJOR_VERSION == 3)  && (GTK_MINOR_VERSION < 12)))
#define gtk_widget_set_margin_end(a,b) gtk_misc_set_padding(a,b,0)
#endif

#define gdk_cursor_new(t) gdk_cursor_new_for_display(gdk_display_get_default (),t)

#ifdef FAKE_TOOLTIPS
extern gchar *format_tooltip (const gchar*);
#define FAKE_TOOLTIPS_MASK GDK_POINTER_MOTION_MASK  //GDK_ENTER_NOTIFY_MASK
#define FAKE_TOOLTIPS_SIGNAL "motion-notify-event" //""enter-notify-event" 

#define gtk_widget_set_tooltip_markup(w, t) (Denemo.prefs.tooltip_timeout >= 0)?g_object_set_data(G_OBJECT(w), "tooltip", format_tooltip(t)), \
    gtk_widget_add_events (w, FAKE_TOOLTIPS_MASK), \
    g_signal_connect_after (w, "destroy", G_CALLBACK(free_tooltip), format_tooltip(t)), \
    g_signal_connect (w, FAKE_TOOLTIPS_SIGNAL, G_CALLBACK (show_tooltip), format_tooltip(t)): \
    gtk_widget_set_tooltip_markup(w, t)
    
    
#define gtk_widget_set_tooltip_text(w, t) (Denemo.prefs.tooltip_timeout >= 0)?g_object_set_data(G_OBJECT(w), "tooltip", format_tooltip(t)), \
    gtk_widget_add_events (w, FAKE_TOOLTIPS_MASK), \
    g_signal_connect_after (w, "destroy", G_CALLBACK(free_tooltip), format_tooltip(t)), \
    g_signal_connect (w, FAKE_TOOLTIPS_SIGNAL, G_CALLBACK (show_tooltip), format_tooltip(t)): \
    gtk_widget_set_tooltip_markup(w, t)

#define gtk_widget_get_tooltip_text(w) ((Denemo.prefs.tooltip_timeout >= 0)? \
    (gchar*)g_object_get_data (G_OBJECT(w), "tooltip"): \
    gtk_widget_get_tooltip_text(w))

#define denemo_widget_set_tooltip_text(w,t) {gtk_widget_set_tooltip_text(w,t);}
#else
#define denemo_widget_set_tooltip_text(w,t) {gtk_widget_set_tooltip_text(w,t);} //#define denemo_widget_set_tooltip_text gtk_widget_set_tooltip_text
#endif


#define GtkStock gchar*


#define gtk_misc_set_alignment(a,x,y) 

#if GTK_MAJOR_VERSION == 2
#else
//we always have homogeneous FALSE which is the default
//so this is not needed. static GtkWidget *vbox_setter (gboolean homogeneous, gint spacing) {GtkWidget *ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing);gtk_box_set_homogeneous (ret, homogeneous);return ret;}
#define gtk_vbox_new(homogeneous, spacing) gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing)
#define gtk_hbox_new(homogeneous, spacing) gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing)
#define gtk_hscale_new(adj) gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj)
#define gtk_hscrollbar_new(adj) gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, adj)
#define gtk_vscrollbar_new(adj) gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, adj)
#define g_strcasecmp g_ascii_strcasecmp


#define g_idle_add gdk_threads_add_idle
#define g_timeout_add gdk_threads_add_timeout
#define g_timeout_add_seconds gdk_threads_add_timeout_seconds

#define g_timeout_add_full gdk_threads_add_timeout_full
#define g_idle_add_full gdk_threads_add_idle_full
#endif

#define DEFAULT_KEYMAP "Default"
#define DEFAULT_KEYBINDINGS "Default.shortcuts"
#ifdef G_OS_WIN32
#define PREFS_FILE "denemorcV2"
#else
#define PREFS_FILE "denemorc"
#endif

#ifdef G_OS_WIN32
#define mswin g_print
#else
#define mswin
#endif

extern const gchar *None;
extern const gchar *Jack;
extern const gchar *Portaudio;
extern const gchar *Fluidsynth;

#define COMMANDS_DIR   "actions"
#define UI_DIR         "ui"
#define SOUNDFONTS_DIR "sf2"
#define PIXMAPS_DIR    "pixmaps"
#define FONTS_DIR      "denemo"
#define LOCALE_DIR     "po"
#define LILYPOND_INCLUDE_DIR "actions/lilypond"

typedef enum{
  DENEMO_DIR_COMMANDS,
  DENEMO_DIR_UI,
  DENEMO_DIR_SOUNDFONTS,
  DENEMO_DIR_PIXMAPS,
  DENEMO_DIR_FONTS,
  DENEMO_DIR_LOCALE,
  DENEMO_DIR_BIN,
  DENEMO_DIR_LILYPOND_INCLUDE
} DenemoDirectory;

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef DENEMO_DATASTRUCTURES  */