]> git.cworth.org Git - scherzo/blobdiff - scherzo.c
Add some (particularly cheesy) drawing of a brace and clefs on the grand staff.
[scherzo] / scherzo.c
index fbb23f0ed34da8efa4df50f9309258ca6c4840d7..c49584c2465e2c153f3f6690fa2df3045e829751 100644 (file)
--- a/scherzo.c
+++ b/scherzo.c
 
 #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);