* along with this program. If not, see http://www.gnu.org/licenses/ .
*/
+#include <string.h>
+
#include "score.h"
struct score_staff
{
int i;
cairo_glyph_t clef_glyph;
- cairo_text_extents_t clef_extents;
cairo_save (cr);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
cairo_show_glyphs (cr, &clef_glyph, 1);
- cairo_glyph_extents (cr, &clef_glyph, 1, &clef_extents);
-
/* Draw staff lines */
for (i = 0; i < 5; i++) {
cairo_move_to (cr, 0, i * score->space_height + score->line_width / 2.0);
cairo_stroke (cr);
/* Make space for clef before drawing notes */
- cairo_translate (cr, (int) (1.5 * clef_extents.width), 0);
+ cairo_translate (cr, (int) (4 * score->space_height), 0);
/* Draw notes */
for (i = 0; i < staff->num_notes; i++) {
_draw_note (score, cr, staff, staff->notes[i]);
+ /* Draw all notes concurrent for now (as a chord)
cairo_translate (cr, score->space_height * 2.0, 0);
+ */
}
cairo_restore (cr);
return note;
}
+void
+score_staff_remove_note (score_staff_t *staff, score_note_t *note)
+{
+ int i;
+
+ for (i = 0; i < staff->num_notes; i++)
+ if (staff->notes[i] == note)
+ break;
+
+ if (i == staff->num_notes)
+ return;
+
+ if (i < staff->num_notes - 1)
+ {
+ memmove (staff->notes + i,
+ staff->notes + i + 1,
+ (staff->num_notes - 1 - i) * sizeof (score_note_t *));
+ }
+
+ staff->num_notes -= 1;
+}
+
+score_note_t *
+score_staff_find_note (score_staff_t *staff,
+ score_pitch_t pitch,
+ int octave,
+ score_duration_t duration)
+{
+ int i;
+ score_note_t *note;
+
+ for (i = 0; i < staff->num_notes; i++) {
+ note = staff->notes[i];
+ if (note->pitch == pitch &&
+ note->octave == octave &&
+ note->duration == duration)
+ {
+ return note;
+ }
+ }
+
+ return NULL;
+}
+