musicxml/elements/
part_symbol.rs

1use crate::datatypes::{Color, GroupSymbolValue, StaffNumber, Tenths};
2use alloc::{string::String, vec::Vec};
3use musicxml_internal::*;
4use musicxml_macros::*;
5
6/// Attributes pertaining to the [PartSymbol] element.
7#[derive(Debug, Default, PartialEq, Eq, AttributeDeserialize, AttributeSerialize)]
8pub struct PartSymbolAttributes {
9  /// Specifies the bottom staff of the symbol when it does not extend across the entire part.
10  pub bottom_staff: Option<StaffNumber>,
11  /// Indicates the color of an element.
12  pub color: Option<Color>,
13  /// Changes the computation of the default horizontal position.
14  /// The origin is changed relative to the left-hand side of the note or the musical position within the bar.
15  /// Positive x is right and negative x is left.
16  ///
17  /// This attribute provides higher-resolution positioning data than the [Offset][super::Offset] element.
18  /// Applications reading a MusicXML file that can understand both features should generally rely on this attribute for its greater accuracy.
19  pub default_x: Option<Tenths>,
20  /// Changes the computation of the default vertical position.
21  /// The origin is changed relative to the top line of the staff. Positive y is up and negative y is down.
22  ///
23  /// This attribute provides higher-resolution positioning data than the `placement` attribute.
24  /// Applications reading a MusicXML file that can understand both attributes should generally rely on this attribute for its greater accuracy.
25  pub default_y: Option<Tenths>,
26  /// Changes the horizontal position relative to the default position, either as computed by the individual program, or as overridden by the `default_x` attribute.
27  /// Positive x is right and negative x is left. It should be interpreted in the context of the [Offset][super::Offset] element or directive attribute if those are present.
28  pub relative_x: Option<Tenths>,
29  /// Changes the vertical position relative to the default position, either as computed by the individual program, or as overridden by the `default_y` attribute.
30  /// Positive y is up and negative y is down. It should be interpreted in the context of the `placement` attribute if that is present.
31  pub relative_y: Option<Tenths>,
32  /// Specifies the top staff of the symbol when it does not extend across the entire part.
33  pub top_staff: Option<StaffNumber>,
34}
35
36/// The [PartSymbol] element indicates how a symbol for a multi-staff part is indicated in the score.
37///
38/// Brace is the default value.
39///
40/// The `top_staff` and `bottom_staff` attributes are used when the brace does not extend across the entire part. For example, in a 3-staff organ
41/// part, the `top_staff` will typically be 1 for the right hand, while the `bottom_staff` will typically be 2 for the left hand. Staff 3 for the pedals
42/// is usually outside the brace. By default, the presence of a [PartSymbol] element that does not extend across the entire part also indicates a corresponding
43/// change in the common barlines within a part.
44#[derive(Debug, PartialEq, Eq, ElementDeserialize, ElementSerialize)]
45#[rename("part-symbol")]
46pub struct PartSymbol {
47  /// Element-specific attributes
48  pub attributes: PartSymbolAttributes,
49  /// Element-specific content
50  pub content: GroupSymbolValue,
51}