sscore_cheditor.h

Introduction

The chord editor

Discussion

Displays a staff with a chord to edit



C Pseudoclasses

sscore_cheditor

abstract chord editor



Functions

sscore_cheditor_accidental_for_chord_note

get the accidental for the note

sscore_cheditor_add_chord_note

actually add a new note to the chord in the score

sscore_cheditor_cancel_op

cancel current operation (drag,accidental,remove,add)

sscore_cheditor_create

create the score editor which displays an item to be edited on a staff

sscore_cheditor_dispose

dispose all memory associated with scedit

sscore_cheditor_drag

actively drag a notehead up or down on the staff

sscore_cheditor_draw

draw the score editor

sscore_cheditor_end_drag

called at the end of a drag operation to update the score with the newly pitched note

sscore_cheditor_notehead_bb

the bounding box of a notehead in the chord

sscore_cheditor_notehead_id_at

get the index of the nearest notehead to p in a displayed chord

sscore_cheditor_pitch_alter_for_notehead

-1 if notehead is flattened, +1 if sharpened

sscore_cheditor_remove_chord_note

remove a note from a chord in the score NB we cannot remove the last - ie there must be one remaining

sscore_cheditor_set_accidental

set the note pitch alteration in the score (an accidental is displayed if appropriate at the score location)

sscore_cheditor_show_accidental

show the note pitch alteration in the score editor with the correct accidental (grey if it will not actually be displayed at this location in the score)

sscore_cheditor_show_add_chord_note

display a new notehead in the chord at the correct point nearest to p

sscore_cheditor_show_remove_chord_note

update the chord editor to show the note missing from the chord

sscore_cheditor_size

return size of score editor


sscore_cheditor_accidental_for_chord_note


get the accidental for the note

EXPORT enum sscore_cheditor_accidental_type sscore_cheditor_accidental_for_chord_note(
    sscore_cheditor *scedit,
    sscore_cheditor_noteid noteheadId,
    int accidental_pitch_alter);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

noteheadId

the id of the notehead in the chord

accidental_pitch_alter

the amount by which to alter the note pitch


sscore_cheditor_add_chord_note


actually add a new note to the chord in the score

EXPORT void sscore_cheditor_add_chord_note(
    sscore_cheditor *scedit,
    sscore_graphics *graphics,
    const sscore_point *p);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

p

the position nearest which the notehead should be placed in the chord


sscore_cheditor_cancel_op


cancel current operation (drag,accidental,remove,add)

Parameters
scedit

the score editor returned from sscore_edit_create_editor


sscore_cheditor_create


create the score editor which displays an item to be edited on a staff

EXPORT sscore_cheditor *sscore_cheditor_create(
    sscore *score,
    sscore_graphics *graphics,
    float magnification,
    const sscore_rect *frame,
    int partIndex,
    int barIndex,
    sscore_item_handle item_h);  
Parameters
score

the score

graphics

the sscore_graphics returned from sscore_graphics_create is used to measure bounds of items, particularly text.

magnification

the scale of the staff

frame

the size of the frame containing the view

partIndex

the part index containing the item to edit

barIndex

the bar index containing the item to edit

item_h

the unique id of the item

Discussion

the caller must install a change handler which forces a redraw of the chord editor on any state change


sscore_cheditor_dispose


dispose all memory associated with scedit

EXPORT void sscore_cheditor_dispose(
    sscore_cheditor *scedit);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

Discussion

cannot call any functions in this interface with scedit after calling sscore_cheditor_dispose


sscore_cheditor_drag


actively drag a notehead up or down on the staff

EXPORT void sscore_cheditor_drag(
    sscore_cheditor *scedit,
    sscore_graphics *graphics,
    sscore_cheditor_noteid noteheadId,
    const sscore_point *translation);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord

translation

the translation of the drag (ie translation->y = 0 for no displacement)

Discussion

this is called repeatedly while dragging and the notehead will be drawn in the new position in sscore_edit_draw. The notehead will appear to slide up and down the stem with the drag, stopping at the correct space and line positions


sscore_cheditor_draw


draw the score editor

EXPORT void sscore_cheditor_draw(
    sscore_cheditor *scedit,
    sscore_graphics *graphics);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create


sscore_cheditor_end_drag


called at the end of a drag operation to update the score with the newly pitched note

EXPORT void sscore_cheditor_end_drag(
    sscore_cheditor *scedit,
    sscore_graphics *graphics,
    sscore_cheditor_noteid noteheadId,
    const sscore_point *translation);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord

translation

the translation of the drag (ie translation->y = 0 for no displacement)


sscore_cheditor_notehead_bb


the bounding box of a notehead in the chord

Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord

Return Value

the bounding box of the notehead


sscore_cheditor_notehead_id_at


get the index of the nearest notehead to p in a displayed chord

Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

p

a point in the score editor

maxdist

the maximum distance from the point to the centre of the closest notehead in tenths of a staff space

Return Value

the index of the nearest notehead in the chord - 0 is the top note or the only note. Increases downwards in the chord sscore_cheditor_invalid_id if p is further than maxdist from the closest notehead


sscore_cheditor_pitch_alter_for_notehead


-1 if notehead is flattened, +1 if sharpened

Parameters
scedit

the score editor returned from sscore_edit_create_editor

noteheadId

the id of the notehead in the chord

Return Value

-2,-1 if the notehead is flat, 0 if natural, +1,+2 if sharp


sscore_cheditor_remove_chord_note


remove a note from a chord in the score NB we cannot remove the last - ie there must be one remaining

Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord


sscore_cheditor_set_accidental


set the note pitch alteration in the score (an accidental is displayed if appropriate at the score location)

EXPORT void sscore_cheditor_set_accidental(
    sscore_cheditor *scedit,
    sscore_graphics *graphics,
    sscore_cheditor_noteid noteheadId,
    int accidental_pitch_alter);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord

accidental_pitch_alter

-2,-1 for flat, 0 for natural, +1,+2 for sharp


sscore_cheditor_show_accidental


show the note pitch alteration in the score editor with the correct accidental (grey if it will not actually be displayed at this location in the score)

EXPORT void sscore_cheditor_show_accidental(
    sscore_cheditor *scedit,
    sscore_graphics *graphics,
    sscore_cheditor_noteid noteheadId,
    int accidental_pitch_alter);  
Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord

accidental_pitch_alter

-2,-1 for flat, 0 for natural, +1,+2 for sharp


sscore_cheditor_show_add_chord_note


display a new notehead in the chord at the correct point nearest to p

Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

p

the position nearest which we should place the notehead in the displayed chord


sscore_cheditor_show_remove_chord_note


update the chord editor to show the note missing from the chord

Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the sscore_graphics returned from sscore_graphics_create

noteheadId

the id of the notehead in the chord


sscore_cheditor_size


return size of score editor

Parameters
scedit

the score editor returned from sscore_edit_create_editor

graphics

the graphics


Typedefs

sscore_cheditor_noteid

unique identifier for a notehead in a chord


sscore_cheditor_noteid


unique identifier for a notehead in a chord

typedef unsigned long sscore_cheditor_noteid;  
Discussion

this is unchanged on reordering the noteheads


Enumerated Types

sscore_cheditor_accidental_type

types of accidental


sscore_cheditor_accidental_type


types of accidental

enum sscore_cheditor_accidental_type {
    sscore_cheditor_noaccidental,
    sscore_cheditor_doubleflat,
    sscore_cheditor_flat,
    sscore_cheditor_natural,
    sscore_cheditor_sharp,
    sscore_cheditor_doublesharp
};