X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=scherzo.c;h=c49584c2465e2c153f3f6690fa2df3045e829751;hb=0261a9e510c766d7c8c69a8d66783bf050683c9f;hp=fbb23f0ed34da8efa4df50f9309258ca6c4840d7;hpb=6024b2beade6f8376df4795d407fa2704c23befb;p=scherzo diff --git a/scherzo.c b/scherzo.c index fbb23f0..c49584c 100644 --- a/scherzo.c +++ b/scherzo.c @@ -22,6 +22,12 @@ #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), @@ -39,11 +45,12 @@ on_expose_event_draw (GtkWidget *widget, 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; @@ -56,7 +63,6 @@ on_expose_event_draw (GtkWidget *widget, /* Add some padding on the left/right */ cairo_translate (cr, pad, pad); - score_set_width (score, widget_width - 2 * pad); score_draw (score, cr); @@ -69,11 +75,13 @@ main (int argc, char *argv[]) { 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); @@ -88,7 +96,7 @@ main (int argc, char *argv[]) g_signal_connect (drawing_area, "expose-event", G_CALLBACK (on_expose_event_draw), - &score); + &scherzo); gtk_widget_show_all (window);