SSSystem
Introductioninterface to a SeeScore System DiscussionA System is a range of bars able to draw itself in a CGContextRef, and is a product of calling SScore layoutXXX: drawWithContext draws the system into a CGContextRef, the call with colourRender argument allowing item colouring (and requiring an additional licence) partIndexForYPos, barIndexForXPos can be used to locate the bar and part under the cursor/finger hitTest is used to find the exact layout components (eg notehead, stem, beam) at a particular location (requiring a contents licence) componentsForItem is used to find all the layout components of a particular score item (requiring a contents licence) Methods
addTiedToNotehead:add a tied pair if there is a suitable note to the right which can be tied to the notehead defined by target -(bool)addTiedToNotehead:(SSTargetLocation*)target; ParametersReturn Valuetrue if added pair successfully, false if not possible, with no change to score barIndexForXPos:get the bar index of the bar enclosing the given x coordinate in this system -(int)barIndexForXPos:(float) xpos; ParametersReturn Valuethe 0-based bar index barLayout:get barline measurements for the part in this system -(SSBarLayout*)barLayout:(int)partIndex; ParametersReturn Valuebarline dimensions boundsForItem:get a bounding box which encloses all layout components for a score item in this system -(CGRect)boundsForItem:(sscore_item_handle)item_h; ParametersReturn Valuethe bounds of (all components of) the item - empty if not licensed Discussiona contents licence is required canAddTiedToNotehead:is there a suitable note to the right which can be tied to the notehead defined by target -(bool)canAddTiedToNotehead:(SSTargetLocation*)target; ParametersReturn Valuetrue if a valid tied pair of elements can be added to the given notehead and one immediately to the right with the same pitch closeFeatures:get an array of components within a certain distance of a given a point in this system -(NSArray<SSComponent*> *)closeFeatures:(CGPoint)p distance:(float)distance; ParametersReturn Valuearray of intersecting SSComponent - empty if unlicensed Discussionresults are sorted in order of increasing distance. A contents licence is required See Also closeFeatures:distance:get an array of components within a certain distance of a given a point in this system -(NSArray<SSComponent*> *)closeFeatures:(CGPoint)p distance:(float)distance; ParametersDiscussionresults are sorted in order of increasing distance. A contents licence is required See Also componentsForItem:get an array of layout components which belong to a particular score item in this system -(NSArray<SSComponent*>*)componentsForItem:(sscore_item_handle)item_h; ParametersReturn Valuearray of SSComponent - empty if unlicensed Discussiona contents licence is required cursorRectForBar:context:get the cursor rectangle for a particular system and bar -(SSCursorRect)cursorRectForBar:(int)barIndex context:(CGContextRef)ctx; ParametersReturn Valuethe bar rectangle which can be used for a cursor deselectAlldeselect all selected items in this system -(void)deselectAll; deselectItem:deselect the item previously selected item -(void)deselectItem:(sscore_item_handle)item_h; ParametersdirectionForComponent:find the direction-type from a layout component created from it -(SSDirectionType*)directionTypeForComponent:(SSComponent*)directionComponent; ParametersReturn Valuethe direction-type See Also directionsNearComponent:find the directions around the point defined by the (note or direction) component -(NSArray<SSDirectionType*>*)directionsNearComponent:(SSComponent*)comp; ParametersReturn Valuearray of SSDirectionType* . Those of type sscore_dir_words can be cast to SSDirectionTypeWords, and then the text is readable and writeable directionTypeForComponent:find the direction-type from a layout component created from it -(SSDirectionType*)directionTypeForComponent:(SSComponent*)directionComponent; ParametersSee Also drawDragItem:withContext:topleft:translate:redraw an existing item in the system when dragged (eg update slur when control point dragged) -(void)drawDragItem:(SSEditItem *)item withContext:(CGContextRef)ctx topleft:(CGPoint)tl translate:(CGPoint)translate; ParametersSee Also drawDragItem:withContext:translate:redraw an existing item in the system when dragged (eg update slur when control point dragged) -(void)drawDragItem:(SSEditItem *)item withContext:(CGContextRef)ctx topleft:(CGPoint)tl translate:(CGPoint)translate; ParametersSee Also drawDragType:itemType:pos:draw any required decoration - (ledgers) for the item type being dragged in the system -(void)drawDragType:(const sscore_edit_type *)itemType withContext:(CGContextRef)ctx topleft:(CGPoint)tl pos:(CGPoint)pos; ParametersSee Also drawDragType:withContext:topleft:pos:draw any required decoration - (ledgers) for the item type being dragged in the system -(void)drawDragType:(const sscore_edit_type *)itemType withContext:(CGContextRef)ctx topleft:(CGPoint)tl pos:(CGPoint)pos; ParametersSee Also drawWithContext:at:magnification:draw this system at the given point. -(void)drawWithContext:(CGContextRef)ctx at:(CGPoint)tl magnification:(float)magnification; ParametersdrawWithContext:at:magnification:colourRender:draw this system at the given point allowing optional colouring of particular items/components in the layout. -(enum sscore_error)drawWithContext:(CGContextRef)ctx at:(CGPoint)tl magnification:(float)magnification colourRender:(SSColourRender*)colourRender; Parameters
dropItem:translate:drop dragged existing item in the score (eg slur control point) -(bool)dropItem:(SSEditItem *)item translate:(CGPoint)translate; ParametershitTest:get an array of components which intersect a given a point in this system -(NSArray<SSComponent*> *)hitTest:(CGPoint)p; ParametersReturn Valuearray of intersecting SSComponent - empty if unlicensed Discussiona contents licence is required includesBar:does this system include the bar? -(bool)includesBar:(int)barIndex; Return Valuetrue if this system includes the bar with given index includesBarRange:does this system include the bar range? -(bool)includesBarRange:(const sscore_barrange*)barrange; Return Valuetrue if this system includes any bars in barrange insertPosForTargetcalculate and return a suitable approximation to the insertion position for this target to show in the UI while dragging -(CGPoint)insertPosForTarget:(SSTargetLocation*)target lr:(enum sscore_edit_leftrightlocation_e)lr; ParametersReturn Valuethe insertion point in the system See Also insertPosForTarget:lr:calculate and return a suitable approximation to the insertion position for this target to show in the UI while dragging -(CGPoint)insertPosForTarget:(SSTargetLocation*)target lr:(enum sscore_edit_leftrightlocation_e)lr; ParametersSee Also itemForComponent:get the editable item for a SSComponent -(SSEditItem*)itemForComponent:(SSComponent*)component; Return Valueitem itemForDirectionType:get the editable item for a SSDirectionType -(SSEditItem*)itemForDirectionType:(SSDirectionType*)directionType; Return Valueitem nearestDirectionComponentAt: maxDistance:find the closest layout component within maxDistance of pos that is part of a direction (words etc) -(SSComponent*)nearestDirectionComponentAt:(CGPoint)pos type:(enum sscore_direction_type)type maxDistance:(float)maxDist; ParametersReturn Valuethe closest note component See Also nearestDirectionComponentAt:type:maxDistance:find the closest layout component within maxDistance of pos that is part of a direction (words etc) -(SSComponent*)nearestDirectionComponentAt:(CGPoint)pos type:(enum sscore_direction_type)type maxDistance:(float)maxDist; ParametersSee Also nearestInsertTargetFor:at:return the nearest valid target location to insert an item of given type in the score -(SSTargetLocation*)nearestInsertTargetFor:(const sscore_edit_type *)itemType at:(CGPoint)pos max:(float)max_distance; ParametersReturn Valuereturn the nearest valid target location at which the itemType can be inserted in the score. Return nil if not near a valid point See Also nearestInsertTargetFor:at:max:return the nearest valid target location to insert an item of given type in the score -(SSTargetLocation*)nearestInsertTargetFor:(const sscore_edit_type *)itemType at:(CGPoint)pos max:(float)max_distance; ParametersSee Also nearestNoteComponentAt:maxDistance:find the closest layout component within maxDistance of pos that is part of a note (notehead,stem,dot,accidental etc) -(SSComponent*)nearestNoteComponentAt:(CGPoint)pos maxDistance:(float)maxDist; ParametersReturn Valuethe closest note component partIndexForYPos:get the part index of the part enclosing the given y coordinate in this system -(int)partIndexForYPos:(float)ypos; ParametersReturn Valuethe 0-based part index partLayout:get staff measurement for the part in this system -(SSStaffLayout*)staffLayout:(int)partIndex; ParametersReturn Valuestaff measurements See Also pointsToFontSize:get the pointsize of a UIFont (of type "Georgia") which will look exactly like a SeeScore direction with this fontsize -(float)pointsToFontSize:(float)points; ParametersReturn Valuethe fontsize to use in the call [UIFont fontWithName:at"Georgia" size:fontsize]; printTo:at:magnification:draw this system at the given point with optimisation for printing (ie without special pixel alignment). -(void)printTo:(CGContextRef)ctx at:(CGPoint)tl magnification:(float)magnification; ParametersselectItem:part:bar:foreground:background:select the item in the system/part/bar and colour it -(void)selectItem:(sscore_item_handle)item_h part:(int)partIndex bar:(int)barIndex foreground:(CGColorRef)fgCol background:(CGColorRef)bgCol; ParametersstaffIndexForYPos:get the index of the staff within the part closest to the given y coordinate in this system -(int)staffIndexForYPos:(float)ypos; ParametersReturn Valuethe 0-based staff index - 0 for a single-staff part staffLayout:get staff measurement for the part in this system -(SSStaffLayout*)staffLayout:(int)partIndex; ParametersSee Also staffLocationForYPos:from the ypos return above or below according to the ypos relative to the closest staff -(enum sscore_system_stafflocation_e)staffLocationForYPos:(float)ypos; ParametersReturn Valueabove/below relative to the staff tiedRect:get the bounding box of the tie which can be added to the right of the given notehead so we can draw it in temporarily -(CGRect)tiedRect:(SSTargetLocation*)target; ParametersReturn Valuerectangle in cg units updateLayout:newState:update the layout to show the state in the sscore_state_container (called by state change handler) -(void)updateLayout:(CGContextRef)ctx newState:(const sscore_state_container*)newstate; ParametersProperties
barRangethe start bar index and number of bars for this system. @property (nonatomic, readonly) sscore_barrange barRange; boundsthe bounding box of this system. @property (nonatomic, readonly) CGSize bounds; defaultSpacinga default value for vertical system spacing @property (nonatomic, readonly) float defaultSpacing; indexthe index of this system from the top of the score. Index 0 is the topmost. @property (nonatomic, readonly) int index; magnificationthe magnification this system - a value of 1.0 approximates to a standard 6mm staff height as in a printed score @property (nonatomic, readonly) float magnification; rawsystemaccess the underlying C type @property (nonatomic, readonly) sscore_system *rawsystem; |