musicxml/elements/print.rs
1use super::{
2 MeasureLayout, MeasureNumbering, PageLayout, PartAbbreviationDisplay, PartNameDisplay, StaffLayout, SystemLayout,
3};
4use crate::datatypes::{Id, PositiveInteger, Tenths, Token, YesNo};
5use alloc::{string::String, vec::Vec};
6use musicxml_internal::*;
7use musicxml_macros::*;
8
9/// Attributes pertaining to the [Print] element.
10#[derive(Debug, Default, PartialEq, Eq, AttributeDeserialize, AttributeSerialize)]
11pub struct PrintAttributes {
12 /// The number of blank pages to insert before the current measure. It is ignored if `new_page` is not "yes".
13 /// These blank pages have no music, but may have text or images specified by the [Credit][super::Credit] element.
14 /// This is used to allow a combination of pages that are all text, or all text and images, together with pages of music.
15 pub blank_page: Option<PositiveInteger>,
16 /// Specifies an ID that is unique to the entire document.
17 pub id: Option<Id>,
18 /// Indicates whether to force a page break, or to force the current music onto the same page as the preceding music.
19 /// Normally this is the first music data within a measure. If used in multi-part music, the attributes should be placed
20 /// in the same positions within each part, or the results are undefined.
21 pub new_page: Option<YesNo>,
22 /// Indicates whether to force a system break, or to force the current music onto the same system as the preceding music.
23 /// Normally this is the first music data within a measure. If used in multi-part music, the attributes should be placed
24 /// in the same positions within each part, or the results are undefined.
25 pub new_system: Option<YesNo>,
26 /// Sets the number of a new page. It is ignored if `new_page` is not "yes".
27 pub page_number: Option<Token>,
28 /// Specifies spacing between multiple staves in tenths of staff space. Deprecated as of Version 1.1; the [StaffLayout]
29 /// element should be used instead. If both are present, the [StaffLayout] values take priority.
30 pub staff_spacing: Option<Tenths>,
31}
32
33/// Contents of the [Print] element.
34#[derive(Debug, Default, PartialEq, Eq, ContentDeserialize, ContentSerialize)]
35pub struct PrintContents {
36 /// The [PageLayout] element contains general page layout parameters.
37 pub page_layout: Option<PageLayout>,
38 /// The [SystemLayout] element contains general system layout parameters.
39 pub system_layout: Option<SystemLayout>,
40 /// The [StaffLayout] element contains general staff layout parameters.
41 pub staff_layout: Vec<StaffLayout>,
42 /// The [MeasureLayout] element contains general measure layout parameters.
43 pub measure_layout: Option<MeasureLayout>,
44 /// The [MeasureNumbering] element specifies how measure numbers are displayed.
45 pub measure_numbering: Option<MeasureNumbering>,
46 /// The [PartNameDisplay] element specifies how a part name is displayed over the course of a piece.
47 pub part_name_display: Option<PartNameDisplay>,
48 /// The [PartAbbreviationDisplay] element specifies how a part abbreviation is displayed over the course of a piece.
49 pub part_abbreviation_display: Option<PartAbbreviationDisplay>,
50}
51
52/// The [Print] element contains general printing parameters, including layout elements.
53///
54/// The [PartNameDisplay] and [PartAbbreviationDisplay] elements may also be used here to change how a part name or abbreviation is
55/// displayed over the course of a piece. They take effect when the current measure or a succeeding measure starts a new system.
56///
57/// Layout group elements in a [Print] element only apply to the current page, system, or staff. Music that follows continues to take
58/// the default values from the layout determined by the [Defaults][super::Defaults] element.
59#[derive(Debug, PartialEq, Eq, ElementDeserialize, ElementSerialize)]
60pub struct Print {
61 /// Element-specific attributes
62 pub attributes: PrintAttributes,
63 #[flatten]
64 /// Element-specific content
65 pub content: PrintContents,
66}