File: drawtuplets.c

package info (click to toggle)
denemo 0.5.9-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,500 kB
  • ctags: 2,415
  • sloc: ansic: 23,057; sh: 3,321; yacc: 1,737; makefile: 449; lex: 376
file content (39 lines) | stat: -rw-r--r-- 1,037 bytes parent folder | download
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
/* drawtuplets.c
 *
 * Functions for drawing tuplet indications
 *
 * for Denemo, a gtk+ frontend to GNU Lilypond
 * (c) 1999, 2000, 2001 Matthew Hiller
 */

#include "utils.h"		/* Includes <gdk.h> */
#include "datastructures.h"

void
draw_tupbracket (GdkPixmap * pixmap, GdkGC * gc, GdkFont * font,
		 gint xx, gint y, mudelaobject * theobj)
{
  static GdkFont *tupbracketfont = NULL;
  static GString *tupopentext;

  if (!tupbracketfont)
    {
      tupbracketfont =
	gdk_fontset_load
	("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-*");
      if (!tupbracketfont)
	tupbracketfont = font;
      tupopentext = g_string_new (NULL);
    }
  if (theobj->type == TUPOPEN)
    {
      g_string_sprintf (tupopentext, _("Times %d/%d"),
			theobj->u.tupval.numerator,
			theobj->u.tupval.denominator);
      gdk_draw_text (pixmap, tupbracketfont, gc, xx, y - 4, tupopentext->str,
		     tupopentext->len);
    }
  else if (theobj->type == TUPCLOSE)
    gdk_draw_text (pixmap, tupbracketfont, gc, xx, y - 4, _("End tuplet"),
		   10);
}