#define unused(foo) foo __attribute__((unused))
+typedef struct scherzo
+{
+ score_t *score;
+ int staff_height;
+} scherzo_t;
+
static int
on_delete_event_quit (unused (GtkWidget *widget),
unused (GdkEvent *event),
unused (GdkEventExpose *event),
void * user_data)
{
- score_t *score = user_data;
+ scherzo_t *scherzo = user_data;
+ score_t *score = scherzo->score;
cairo_t *cr;
GtkAllocation allocation;
static const int pad = 10;
- int widget_width, staff_width;
+ int widget_width;
gtk_widget_get_allocation (widget, &allocation);
widget_width = allocation.width;
/* Add some padding on the left/right */
cairo_translate (cr, pad, pad);
-
score_set_width (score, widget_width - 2 * pad);
score_draw (score, cr);
{
GtkWidget *window;
GtkWidget *drawing_area;
- score_t score;
+ scherzo_t scherzo;
gtk_init (&argc, &argv);
- score_init (&score);
+ scherzo.score = score_create (NULL);
+ scherzo.staff_height = 20;
+ score_set_staff_height (scherzo.score, scherzo.staff_height);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (drawing_area, "expose-event",
G_CALLBACK (on_expose_event_draw),
- &score);
+ &scherzo);
gtk_widget_show_all (window);