From bc274a825203b2a0657101e8d041a03fca75d0eb Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 29 Sep 2013 17:33:28 -0700 Subject: [PATCH] Make score_note_t entirely private to score.c And drop the remaining functions that are no longer being used. (These were easy to find as the only remaining functions in score.h referencing score_note_t.) --- scherzo.c | 2 +- score.c | 69 +++++++++++-------------------------------------------- score.h | 29 ----------------------- 3 files changed, 14 insertions(+), 86 deletions(-) diff --git a/scherzo.c b/scherzo.c index 109de6d..361301d 100644 --- a/scherzo.c +++ b/scherzo.c @@ -1147,7 +1147,7 @@ scherzo_release_pedal (scherzo_t *scherzo) scherzo_update_notes_and_chord (scherzo); } -void +static void _select_challenge (scherzo_t *scherzo) { category_t *category_unused; diff --git a/score.c b/score.c index 5772c0f..4e2a5f3 100644 --- a/score.c +++ b/score.c @@ -25,6 +25,19 @@ #include "score.h" +typedef struct score_note +{ + score_staff_t *staff; + pitch_t pitch; + score_duration_t duration; + + struct { + double r; + double g; + double b; + } color; +} score_note_t; + struct score_staff { score_clef_t clef; @@ -685,34 +698,6 @@ score_add_note (score_t *score, pitch_t pitch, score_duration_t duration) score_staff_add_note (nearest_staff, pitch, duration); } -void -score_remove_note (score_note_t *note) -{ - score_staff_t *staff = note->staff; - 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; - - if (staff->num_notes == 0) { - staff->upper_ledger_lines = 0; - staff->lower_ledger_lines = 0; - } -} - void score_staff_remove_notes (score_staff_t *staff) { @@ -729,31 +714,3 @@ score_remove_notes (score_t *score) for (i = 0; i < score->num_staves; i++) score_staff_remove_notes (score->staves[i]); } - -void -score_set_note_color_rgb (score_note_t *note, - double r, - double g, - double b) -{ - note->color.r = r; - note->color.g = g; - note->color.b = b; -} - -score_note_t * -score_staff_find_note (score_staff_t *staff, - pitch_t pitch, - 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->duration == duration) - return note; - } - - return NULL; -} diff --git a/score.h b/score.h index 573af22..c5d275d 100644 --- a/score.h +++ b/score.h @@ -51,19 +51,6 @@ typedef enum score_duration typedef struct score score_t; typedef struct score_staff score_staff_t; -typedef struct score_note -{ - score_staff_t *staff; - pitch_t pitch; - score_duration_t duration; - - struct { - double r; - double g; - double b; - } color; -} score_note_t; - typedef struct score_chord { score_staff_t *staff; @@ -139,9 +126,6 @@ score_add_chord (score_staff_t *staff, void score_remove_chord (score_chord_t *chord); -/* Remove the given note from its staff. */ -void -score_remove_note (score_note_t *note); /* Remove all notes from the given staff. */ void @@ -151,19 +135,6 @@ score_staff_remove_notes (score_staff_t *staff); void score_remove_notes (score_t *score); -void -score_set_note_color_rgb (score_note_t *note, - double r, - double g, - double b); - -/* Return the first note on the given staff with the given pitch, - * octave, and durations. Returns NULL if no match is found. */ -score_note_t * -score_staff_find_note (score_staff_t *staff, - pitch_t pitch, - score_duration_t duration); - /* Draw the given score_t onto the given cairo_t. * * The caller can call cairo_translate before calling score_draw to -- 2.43.0