MUSX Document Model
Loading...
Searching...
No Matches
SmartShape.h
1/*
2 * Copyright (C) 2025, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include "musx/util/Logger.h"
25#include "musx/util/Fraction.h"
26
27#include "BaseClasses.h"
28#include "CommonClasses.h"
29 // do not add other dom class dependencies. Use Implementations.cpp for implementations that need total class access.
30
31namespace musx {
32namespace utils {
33enum class PseudoTieMode;
34} // namespace utils
35
36namespace dom {
37
38class EntryInfoPtr;
39
40namespace details {
41class SmartShapeEntryAssign;
42}
43
44namespace others {
45 class SmartShapeMeasureAssign;
46}
47
51{
54
55 // Add more known types here
56};
57
58namespace smartshape {
59
64enum class DirectionType
65{
66 None,
67 Under,
68 Over
69};
70
78enum class EntryConnectionType
79{
80 HeadLeftTop,
81 HeadRightTop,
82 HeadRightBottom,
83 HeadLeftBottom,
84
85 StemLeftTop,
86 StemRightTop,
87 StemRightBottom,
88 StemLeftBottom,
89
90 NoteLeftTop,
91 NoteRightTop,
92 NoteRightBottom,
93 NoteLeftBottom,
94 NoteLeftCenter,
95 NoteRightCenter,
96
97 LyricRightCenter,
98 LyricLeftCenter,
99 LyricRightBottom,
100 HeadRightLyricBaseline,
101 DotRightLyricBaseline,
102 DurationLyricBaseline,
103
104 SystemLeft,
105 SystemRight
106};
107
127
132{
133public:
135
140
143 [[nodiscard]] bool calcIsValid() const;
144
146 [[nodiscard]] util::Fraction calcPosition() const;
147
149 [[nodiscard]] util::Fraction calcGlobalPosition() const;
150
157 [[nodiscard]] int compareMetricPosition(const EndPoint& other) const;
158
166 [[nodiscard]] EntryInfoPtr calcAssociatedEntry(bool findExact = false) const;
167
170
173
175 [[nodiscard]] bool calcIsAssigned() const;
176
179
181};
182
187{
188public:
190
193 bool active{};
194 DirectionType contextDir{};
195 EntryConnectionType contextEntCnct{};
196
198 [[nodiscard]] Evpu calcHorzOffset() const
199 { return active ? horzOffset : 0; }
200
202 [[nodiscard]] Evpu calcVertOffset() const
203 { return active ? vertOffset : 0; }
204
208 [[nodiscard]] bool calcHasVerticalEquivalentConnection(const EndPointAdjustment& other) const;
209
211};
212
213} // namespace smartshape
214
215namespace others {
216
223class SmartShape : public OthersBase
224{
225private:
226public:
228 explicit SmartShape(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
229 : OthersBase(document, partId, shareMode, cmper) {}
230
235 {
236 public:
238
239 std::shared_ptr<smartshape::EndPoint> endPoint;
240 std::shared_ptr<smartshape::EndPointAdjustment> endPointAdj;
241 std::shared_ptr<smartshape::ControlPointAdjustment> ctlPtAdj;
242 std::shared_ptr<smartshape::EndPointAdjustment> breakAdj;
244
245 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
246 {
248 if (!endPoint) {
249 endPoint = std::make_shared<smartshape::EndPoint>(getParent());
250 }
251 if (!endPointAdj) {
252 endPointAdj = std::make_shared<smartshape::EndPointAdjustment>(getParent());
253 }
254 if (!ctlPtAdj) {
255 ctlPtAdj = std::make_shared<smartshape::ControlPointAdjustment>(getParent());
256 }
257 if (!breakAdj) {
258 breakAdj = std::make_shared<smartshape::EndPointAdjustment>(getParent());
259 }
260 endPoint->integrityCheck(endPoint);
261 endPointAdj->integrityCheck(endPointAdj);
262 ctlPtAdj->integrityCheck(ctlPtAdj);
263 breakAdj->integrityCheck(breakAdj);
264 }
265
267 };
268
322
328 {
329 Auto,
330 Off,
331 On,
332 };
333
339 {
340 Auto,
341 Off,
342 On,
343 Invalid = -1
344 };
345
354 {
355 Same,
356 Opposite,
359 };
360
362 bool entryBased{};
363 bool rotate{};
365 bool makeHorz{};
367 bool makeVert{};
371 std::shared_ptr<TerminationSeg> startTermSeg;
372 std::shared_ptr<TerminationSeg> endTermSeg;
373 std::shared_ptr<smartshape::ControlPointAdjustment> fullCtlPtAdj;
374 bool hidden{};
384 std::optional<LyricTextType> startLyricType;
385 std::optional<LyricTextType> endLyricType;
387
390 [[nodiscard]]
391 bool calcIsValid() const;
392
394 [[nodiscard]]
395 bool calcIsSlur() const;
396
402 [[nodiscard]]
403 bool calcAppliesTo(const EntryInfoPtr& entryInfo) const;
404
408 [[nodiscard]]
410
413 [[nodiscard]]
415
424 [[nodiscard]] NoteInfoPtr calcStartNote() const;
425
434 [[nodiscard]] NoteInfoPtr calcEndNote() const;
435
442 [[nodiscard]] NoteInfoPtr calcArpeggiatedTieToNote(const EntryInfoPtr& forStartEntry) const;
443
446 [[nodiscard]]
448
453
456 [[nodiscard]]
457 bool calcIsDashed() const;
458
463 [[nodiscard]]
464 bool calcIsPseudoTie(utils::PseudoTieMode mode, const EntryInfoPtr& forStartEntry) const;
465
470 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator, DeferredReference<MusxInstanceList<StaffUsed>> staffList = {}) const;
471
472 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
473 {
475 if (!startTermSeg) {
476 startTermSeg = std::make_shared<TerminationSeg>(ptrToThis);
477 }
478 if (!endTermSeg) {
479 endTermSeg = std::make_shared<TerminationSeg>(ptrToThis);
480 }
481 if (!fullCtlPtAdj) {
482 fullCtlPtAdj = std::make_shared<smartshape::ControlPointAdjustment>(ptrToThis);
483 }
484 startTermSeg->integrityCheck(ptrToThis);
485 endTermSeg->integrityCheck(ptrToThis);
486 fullCtlPtAdj->integrityCheck(ptrToThis);
487 }
488
489private:
493 [[nodiscard]] NoteInfoPtr calcEndpointNote(
494 const std::shared_ptr<TerminationSeg>& termSeg, NoteNumber noteId) const;
495
496public:
497 constexpr static std::string_view XmlNodeName = "smartShape";
499};
500
508{
509 util::EnigmaParsingContext getRawTextCtx(Cmper forPartId, Cmper textBlockId) const;
510
511public:
513 explicit SmartShapeCustomLine(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
514 : OthersBase(document, partId, shareMode, cmper) {}
515
518 enum class LineStyle { Char, Solid, Dashed };
519
522 enum class LineCapType { None, Hook, ArrowheadPreset, ArrowheadCustom };
523
526 {
527 public:
529 explicit CharParams(const MusxInstance<EnigmaBase>& parent)
530 : ContainedClassBase(parent), font(std::make_shared<FontInfo>(parent->getDocument()))
531 {
532 }
533
534 char32_t lineChar{};
535 std::shared_ptr<FontInfo> font;
537
539 };
540
551
563
565 // No fixture has a part-specific SmartShapeCustomLine. If partial sharing is observed, its
566 // applicable parameter object must be copied and rebound before nested fields are overlaid.
567 // See PartContextRebinder<details::CenterShape> and the CenterShape field mappings for the pattern.
568 std::shared_ptr<CharParams> charParams;
569 std::shared_ptr<SolidParams> solidParams;
570 std::shared_ptr<DashedParams> dashedParams;
571
576
577 bool makeHorz{};
581
587
598
604
607
612 [[nodiscard]]
614 { return getRawTextCtx(forPartId, leftStartRawTextId); }
615
620 [[nodiscard]]
622 { return getRawTextCtx(forPartId, leftContRawTextId); }
623
628 [[nodiscard]]
630 { return getRawTextCtx(forPartId, rightEndRawTextId); }
631
636 [[nodiscard]]
638 { return getRawTextCtx(forPartId, centerFullRawTextId); }
639
644 [[nodiscard]]
646 { return getRawTextCtx(forPartId, centerAbbrRawTextId); }
647
648 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
649 {
651
652 if (lineStyle == LineStyle::Char && !charParams)
653 charParams = std::make_shared<CharParams>(ptrToThis);
654
655 if (lineStyle == LineStyle::Solid && !solidParams)
656 solidParams = std::make_shared<SolidParams>(ptrToThis);
657
658 if (lineStyle == LineStyle::Dashed && !dashedParams)
659 dashedParams = std::make_shared<DashedParams>(ptrToThis);
660 }
661
662 constexpr static std::string_view XmlNodeName = "ssLineStyle";
664};
665
684[[nodiscard]]
685std::optional<Cmper> importSmartShapeCustomLineInto(const DocumentPtr& target,
687 const ImportObjectCallback& onImported = {});
688
701{
702public:
704 explicit SmartShapeMeasureAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
705 : OthersBase(document, partId, shareMode, cmper, inci)
706 {
707 }
708
712
713 constexpr static std::string_view XmlNodeName = "smartShapeMeasMark";
715};
716
717} // namespace others
718
719#ifndef DOXYGEN_SHOULD_IGNORE_THIS
720template <>
721struct PartContextRebinder<others::SmartShape>
722{
723 static std::shared_ptr<others::SmartShape::TerminationSeg> copyTerminationSeg(
724 const std::shared_ptr<others::SmartShape::TerminationSeg>& source,
725 const std::shared_ptr<others::SmartShape>& parent);
726 static void rebind(const std::shared_ptr<others::SmartShape>& shape);
727};
728#endif
729
730namespace details {
731
748{
749public:
750
759 explicit CenterShape(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper shapeNum, Cmper centerShapeNum)
760 : DetailsBase(document, partId, shareMode, shapeNum, centerShapeNum)
761 {}
762
763 std::shared_ptr<smartshape::EndPointAdjustment> startBreakAdj;
764 std::shared_ptr<smartshape::EndPointAdjustment> endBreakAdj;
765 std::shared_ptr<smartshape::ControlPointAdjustment> ctlPtAdj;
766
767 void integrityCheck(const std::shared_ptr<EnigmaBase>& ptrToThis) override
768 {
769 if (!startBreakAdj) {
770 startBreakAdj = std::make_shared<smartshape::EndPointAdjustment>(ptrToThis);
771 }
772 if (!endBreakAdj) {
773 endBreakAdj = std::make_shared<smartshape::EndPointAdjustment>(ptrToThis);
774 }
775 if (!ctlPtAdj) {
776 ctlPtAdj = std::make_shared<smartshape::ControlPointAdjustment>(ptrToThis);
777 }
778 }
779
780 constexpr static std::string_view XmlNodeName = "centerShape";
782};
783
791{
792public:
794 explicit SmartShapeEntryAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, EntryNumber entnum, Inci inci)
795 : EntryDetailsBase(document, partId, shareMode, entnum, inci)
796 {
797 }
798
800
801 constexpr static std::string_view XmlNodeName = "smartShapeEntryMark";
803};
804
805} // namespace details
806
807#ifndef DOXYGEN_SHOULD_IGNORE_THIS
808template <>
809struct PartContextRebinder<details::CenterShape>
810{
811 static void rebind(const std::shared_ptr<details::CenterShape>& shape);
812};
813#endif
814
815} // namespace dom
816} // namespace musx
EnigmaBase class for classes that are contained by other classes.
Definition BaseClasses.h:179
ContainedClassBase(const MusxInstance< EnigmaBase > &parent)
Constructs a ContainedClassBase object.
Definition BaseClasses.h:211
MusxInstance< ParentClass > getParent() const
Get the parent.
Definition BaseClasses.h:217
Wraps a reference to an existing object or owns a temporary value if needed.
Definition MusxInstance.h:194
EnigmaBase class for all "details" types.
Definition BaseClasses.h:393
DocumentPtr getDocument() const
Gets a reference to the Document.
Definition DocumentElement.h:58
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:95
virtual void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis)
Performs a final consistency check after population.
Definition BaseClasses.h:116
EnigmaBase class for all "details" types that use entnum rather than cmper and cmper.
Definition BaseClasses.h:465
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:555
Represents the default font settings for a particular element type.
Definition CommonClasses.h:110
Utility class that represents of a range of musical time.
Definition CommonClasses.h:635
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:118
Wraps an EntryInfo instance and a note index.
Definition Entries.h:1619
EnigmaBase class for all "others" types.
Definition BaseClasses.h:261
Represents a center shape for a others::SmartShape that spans three or more measures.
Definition SmartShape.h:748
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition SmartShape.h:767
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition SmartShape.h:780
std::shared_ptr< smartshape::ControlPointAdjustment > ctlPtAdj
Manual adjustments made to this center shape.
Definition SmartShape.h:765
std::shared_ptr< smartshape::EndPointAdjustment > endBreakAdj
Adjustment at the end break (xml: <endBreakAdj>)
Definition SmartShape.h:764
CenterShape(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper shapeNum, Cmper centerShapeNum)
Constructor.
Definition SmartShape.h:759
std::shared_ptr< smartshape::EndPointAdjustment > startBreakAdj
Adjustment at the start break (xml: <startBreakAdj>)
Definition SmartShape.h:763
static const xml::XmlElementArray< CenterShape > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Assigns a smart shape to an entry.
Definition SmartShape.h:791
Cmper shapeNum
The Cmper of the others::SmartShape that is being assigned.
Definition SmartShape.h:799
SmartShapeEntryAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, Inci inci)
Constructor function.
Definition SmartShape.h:794
static const xml::XmlElementArray< SmartShapeEntryAssign > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition SmartShape.h:801
Hold parameters for LineStyle::Char.
Definition SmartShape.h:526
static const xml::XmlElementArray< CharParams > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
CharParams(const MusxInstance< EnigmaBase > &parent)
Constructor function.
Definition SmartShape.h:529
char32_t lineChar
The character to use for the line.
Definition SmartShape.h:534
std::shared_ptr< FontInfo > font
<fontID>, <fontSize>, <fontEfx>
Definition SmartShape.h:535
int baselineShiftEms
The UI says the units are "EMs", but it may be 1/100 EMs.
Definition SmartShape.h:536
Hold parameters for LineStyle::Dashed.
Definition SmartShape.h:553
Efix dashOff
Length of gap between dashes.
Definition SmartShape.h:559
Efix dashOn
Dash length.
Definition SmartShape.h:558
Efix lineWidth
Dashed line width.
Definition SmartShape.h:557
static const xml::XmlElementArray< DashedParams > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Hold parameters for LineStyle::Solid.
Definition SmartShape.h:543
Efix lineWidth
Solid line width.
Definition SmartShape.h:547
static const xml::XmlElementArray< SolidParams > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Represents a Finale smart shape custom line style.
Definition SmartShape.h:508
Evpu leftContX
Left continuation position X.
Definition SmartShape.h:590
Evpu rightEndX
Right end position X.
Definition SmartShape.h:592
bool lineBeforeRightEndText
Line adjustments "Right H: Before Text".
Definition SmartShape.h:579
Evpu leftStartX
Left start position X.
Definition SmartShape.h:588
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition SmartShape.h:648
SmartShapeCustomLine(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition SmartShape.h:513
LineCapType lineCapEndType
Line cap end type.
Definition SmartShape.h:573
util::EnigmaParsingContext getLeftContRawTextCtx(Cmper forPartId) const
Gets the raw text context for parsing the left-continuation text, or nullptr if none.
Definition SmartShape.h:621
Evpu centerFullY
Center full position Y.
Definition SmartShape.h:595
Efix lineCapStartHookLength
Length of start hook (if lineStyle is Hook)
Definition SmartShape.h:605
Cmper centerFullRawTextId
Cmper of texts::SmartShapeText. xml node is <centerFullRawTextID>
Definition SmartShape.h:585
Evpu centerAbbrY
Center abbreviation position Y.
Definition SmartShape.h:597
static const xml::XmlElementArray< SmartShapeCustomLine > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Efix lineCapEndHookLength
Length of end hook (if lineStyle is Hook)
Definition SmartShape.h:606
util::EnigmaParsingContext getCenterFullRawTextCtx(Cmper forPartId) const
Gets the raw text context for parsing the center-full text, or nullptr if none.
Definition SmartShape.h:637
Cmper leftStartRawTextId
Cmper of texts::SmartShapeText. xml node is <leftStartRawTextID>
Definition SmartShape.h:582
Evpu lineEndX
Line adjustments "End H" value.
Definition SmartShape.h:601
Evpu rightEndY
Right end position Y.
Definition SmartShape.h:593
Evpu lineEndY
Line adjustments "Start H" value.
Definition SmartShape.h:602
util::EnigmaParsingContext getRightEndRawTextCtx(Cmper forPartId) const
Gets the raw text context for parsing the right-end text, or nullptr if none.
Definition SmartShape.h:629
std::shared_ptr< CharParams > charParams
Parameters for char line style. Only allocated if lineStyle is LineStyle::Char.
Definition SmartShape.h:568
std::shared_ptr< DashedParams > dashedParams
Parameters for dashed line style. Only allocated if lineStyle is LineStyle::Dashed.
Definition SmartShape.h:570
LineStyle lineStyle
Line style.
Definition SmartShape.h:564
Evpu centerAbbrX
Center abbreviation position X.
Definition SmartShape.h:596
bool lineAfterLeftContText
Line adjustments "Cont H: After Text".
Definition SmartShape.h:580
Evpu leftContY
Left continuation position Y.
Definition SmartShape.h:591
Cmper lineCapStartArrowId
Cmper of start arrowhead (ArrowheadPreset or cmper of custom ShapeDef). xml node is <lineCapStartArro...
Definition SmartShape.h:574
bool lineAfterLeftStartText
Line adjustments "Start H: After Text".
Definition SmartShape.h:578
Evpu lineContX
Line adjustments "V" value (Finale syncs this with lineStartY.)
Definition SmartShape.h:603
Cmper rightEndRawTextId
Cmper of texts::SmartShapeText. xml node is <rightEndRawTextID>
Definition SmartShape.h:584
Evpu leftStartY
Left start position Y.
Definition SmartShape.h:589
bool makeHorz
"Horizontal"
Definition SmartShape.h:577
Cmper centerAbbrRawTextId
Cmper of texts::SmartShapeText. xml node is <centerAbbrRawTextID>
Definition SmartShape.h:586
Cmper leftContRawTextId
Cmper of texts::SmartShapeText. xml node is <leftContRawTextID>
Definition SmartShape.h:583
util::EnigmaParsingContext getCenterAbbrRawTextCtx(Cmper forPartId) const
Gets the raw text context for parsing the center-abbreviated text, or nullptr if none.
Definition SmartShape.h:645
util::EnigmaParsingContext getLeftStartRawTextCtx(Cmper forPartId) const
Gets the raw text context for parsing the left-start, or nullptr if none.
Definition SmartShape.h:613
LineStyle
The type of line style.
Definition SmartShape.h:518
std::shared_ptr< SolidParams > solidParams
Parameters for solid line style. Only allocated if lineStyle is LineStyle::Solid.
Definition SmartShape.h:569
Cmper lineCapEndArrowId
Cmper of end arrowhead (ArrowheadPreset or cmper of custom ShapeDef). xml node is <lineCapStartArrowI...
Definition SmartShape.h:575
LineCapType
The type of line cap.
Definition SmartShape.h:522
Evpu lineStartX
Line adjustments "Start H" value.
Definition SmartShape.h:599
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition SmartShape.h:662
Evpu centerFullX
Center full position X.
Definition SmartShape.h:594
Evpu lineStartY
Line adjustments "V" value (Finale syncs this with lineEndY.)
Definition SmartShape.h:600
LineCapType lineCapStartType
Line cap start type.
Definition SmartShape.h:572
Assigns a smart shape or center shape to a measure.
Definition SmartShape.h:701
static const xml::XmlElementArray< SmartShapeMeasureAssign > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition SmartShape.h:713
SmartShapeMeasureAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
Constructor function.
Definition SmartShape.h:704
Cmper shapeNum
The Cmper of the SmartShape that is being assigned.
Definition SmartShape.h:709
Cmper centerShapeNum
Definition SmartShape.h:710
Represents the termination segment of the smart shape.
Definition SmartShape.h:235
std::shared_ptr< smartshape::ControlPointAdjustment > ctlPtAdj
Manual adjustments for the shape at this endpoint.
Definition SmartShape.h:241
static const xml::XmlElementArray< TerminationSeg > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition SmartShape.h:245
std::shared_ptr< smartshape::EndPoint > endPoint
Endpoint information.
Definition SmartShape.h:239
std::shared_ptr< smartshape::EndPointAdjustment > endPointAdj
Endpoint adjustment information.
Definition SmartShape.h:240
std::shared_ptr< smartshape::EndPointAdjustment > breakAdj
Definition SmartShape.h:242
Represents a Finale smart shape.
Definition SmartShape.h:224
bool calcIsValid() const
Finale sometimes leaves dead smart shapes hanging around that it does not display....
Definition SmartShape.cpp:406
bool calcIsSlur() const
Returns true if this smart shape is a type of slur.
Definition SmartShape.cpp:411
SlurAvoidAccidentalsState
The selection whether this shape avoids accidentals. (Only applicable for slurs.)
Definition SmartShape.h:339
@ Invalid
May not be used, but exists as a possibility in the Finale app.
SmartShape(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition SmartShape.h:228
Cmper lineStyleId
If non-zero, the SmartShapeCustomLine for this shape. Several ShapeType values use it....
Definition SmartShape.h:378
bool iterateEntries(std::function< bool(const EntryInfoPtr &)> iterator, DeferredReference< MusxInstanceList< StaffUsed > > staffList={}) const
Iterates all the entries that start within the staves and music range defined by the SmartShape....
Definition SmartShape.cpp:360
bool entryBased
Whether the shape is entry-based.
Definition SmartShape.h:362
bool calcIsDashed() const
Returns true if the smart shape's ShapeType uses a dashed line style.
Definition SmartShape.cpp:510
std::optional< LyricTextType > endLyricType
Definition SmartShape.h:385
NoteNumber startNoteId
If non-zero, the specific note with the entry that this shape starts from. (xml node is <startNoteID>...
Definition SmartShape.h:376
SystemBreakType
How this shape breaks across systems. Represents the choice between "Make Horizontal Over System Brea...
Definition SmartShape.h:354
@ Same
System break honors makeHorz setting over a system break. (Default)
EngraverSlurState
The selection for engraver slurs. (Only applicable for slurs.)
Definition SmartShape.h:328
@ Auto
Take the engraver slur setting from options::SmartShapeOptions::useEngraverSlurs. (Default value....
@ Off
Do not use engraver slur behaviour.
bool calcAppliesTo(const EntryInfoPtr &entryInfo) const
Calculates if the smart shape applies to the specified entry.
Definition SmartShape.cpp:318
Cmper startLyricNum
The text block of the lyrics text if this is a word extension or hyphen smart shape.
Definition SmartShape.h:379
std::shared_ptr< TerminationSeg > endTermSeg
End termination segment.
Definition SmartShape.h:372
NoteInfoPtr calcEndNote() const
Returns the note this shape ends on.
Definition SmartShape.cpp:396
std::optional< LyricTextType > startLyricType
The type of lyrics block for startLyricNum. (xml node is <startLyricTag>)
Definition SmartShape.h:384
NoteNumber endNoteId
If non-zero, the specific note with the entry that this shape ends on. (xml node is <endNoteID>)
Definition SmartShape.h:377
VerticalPlacement calcVerticalPlacementForBeatAttached() const
Calculates a vertical placement classification for beat-attached smart shapes.
Definition SmartShape.cpp:475
bool makeVert
This option has no obvious setting in the Finale U.I. A plugin could perhaps set it,...
Definition SmartShape.h:367
bool hidden
Inverse of "Show" option.
Definition SmartShape.h:374
EngraverSlurState engraverSlurState
The engraver slur setting if this is a slur.
Definition SmartShape.h:368
NoteInfoPtr calcStartNote() const
Returns the note this shape starts from.
Definition SmartShape.cpp:391
void integrityCheck(const std::shared_ptr< EnigmaBase > &ptrToThis) override
Performs a final consistency check after population.
Definition SmartShape.h:472
ShapeType
All the smart shape types supported by Finale.
Definition SmartShape.h:278
@ TwoOctaveUp
Quindicesima (15ma) == 21.
@ DashLineDownLeft
Dashed line with downward left hook.
@ DashLineUpLeft
Dashed line with upward left hook. == 32.
@ CustomLine
User-created custom line with shape determined by lineStyleId. (xml value is "smartLine")
@ Crescendo
Crescendo hairpin. (xml value is "cresc")
@ SlurAuto
Slur with direction automatically determined.
@ DashSlurUp
Thin line dashed upward slur (tips point down).
@ Trill
Trill (includes "tr" symbol at the beginning). == 14.
@ DashLineUp
Dashed line with upward hook.
@ DashLineDownBoth
Dashed line with downward hooks on both ends. (xml value is "dashLineDown2")
@ SlurDown
Downward Slur (tips point up). This is the default and may not appear in the xml, but the text is in ...
@ WordExtension
Lyric word extension, used only with lyric assignments. (xml value is "wordExt")
@ TabSlide
Tab slide (a solid line that is often used as a note-attached glissando)
@ SolidLineDown
Solid line with downward right hook.
@ DashSlurDown
Thin line dashed downward slur (tips point up).
@ SolidLineDownBoth
Solid line with downward hooks on both ends. (xml value is "solidLineDown2")
@ Glissando
Glissando (shape is determined by lineStyleId) == 25 (24 has no value)
@ SolidLineDownUp
Solid line with downward left hook and upward right hook.
@ SolidLineUp
Solid line with upward right hook.
@ Decrescendo
Decrescendo hairpin. (xml value is "decresc")
@ BendHat
Bend hat (solid up-down line with a corner in the middle)
@ Hyphen
Lyric hyphen, used only with lyric assignments.
@ DashLineUpDown
Dashed line with upward left hook and downward right hook.
@ DashContourSlurAuto
Contoured line dashed slur with direction automatically determined.
@ DashContourSlurUp
Contoured line dashed upward slur (tips point down).
@ DashContourSlurDown
Contoured line dashed downward slur (tips point up).
@ SolidLineDownLeft
Solid line with downward left hook.
@ DashLineDown
Dashed line with downward hook. == 7.
@ DashLineUpBoth
Dashed line with upward hooks on both ends. (xml value is "dashLineUp2")
@ SolidLineUpBoth
Solid line with upward hooks on both ends. (xml value is "solidLineUp2")
@ DashSlurAuto
Thin line dashed slur with direction automatically determined.
@ SolidLineUpDown
Solid line with upward left hook and downward right hook.
@ TrillExtension
Trill extension: only the wavy line. (xml value is "trillExt")
@ SolidLineUpLeft
Solid line with upward left hook.
@ TwoOctaveDown
Quindicesima bassa (15ma bassa)
@ SlurUp
Upward Slur (tips point down).
@ DashLineDownUp
Dashed line with downward left hook and upward right hook.
bool makeHorz
"Make Horizontal"
Definition SmartShape.h:365
SystemBreakType yBreakType
Whether a system break should honor makeHorz or do its opposite.
Definition SmartShape.h:370
Cmper endLyricNum
Definition SmartShape.h:380
CurveContourDirection calcContourDirection() const
Determines whether the smart shape's contour runs up or down.
Definition SmartShape.cpp:431
SlurAvoidAccidentalsState slurAvoidAcciState
The avoid accidentals settings if this is a slur.
Definition SmartShape.h:369
MusicRange createMusicRange() const
Creates a music range for the SmartShape in staff EDUs. If the SmartShape spans staves with different...
Definition SmartShape.cpp:350
bool noPresetShape
Legacy flag that may no longer be used.
Definition SmartShape.h:364
bool calcIsPseudoTie(utils::PseudoTieMode mode, const EntryInfoPtr &forStartEntry) const
Returns true if this slur is being used as a pseudo tie for the specified mode. It is used by NoteInf...
Definition SmartShape.cpp:535
static const xml::XmlElementArray< SmartShape > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool noPushEndStart
Legacy flag that should always be false in modern files going back to at least Finale 2000.
Definition SmartShape.h:366
bool rotate
Purpose unknown: always set for slurs.
Definition SmartShape.h:363
static constexpr std::string_view XmlNodeName
XML node name.
Definition SmartShape.h:497
std::shared_ptr< smartshape::ControlPointAdjustment > fullCtlPtAdj
If the shape is only on one staff system, this is where the manual edits are.
Definition SmartShape.h:373
std::shared_ptr< TerminationSeg > startTermSeg
Start termination segment.
Definition SmartShape.h:371
MusicRange createGlobalMusicRange() const
Creates a music range for the SmartShape in global EDUs.
Definition SmartShape.cpp:355
ShapeDirection direction
Direction setting for this shape (xml node is <dir>).
Definition SmartShape.h:375
ShapeType shapeType
Type of smart shape.
Definition SmartShape.h:361
NoteInfoPtr calcArpeggiatedTieToNote(const EntryInfoPtr &forStartEntry) const
Returns the tied-to note if this slur is being used as an arpeggiated tie on the specified entry.
Definition SmartShape.cpp:401
Represents the manual adjustments to a smart shape.
Definition SmartShape.h:114
DirectionType contextDir
The direction type for this adjustment.
Definition SmartShape.h:123
Evpu startCtlPtY
Vertical offset of the start control point.
Definition SmartShape.h:119
Evpu endCtlPtY
Vertical offset of the end control point.
Definition SmartShape.h:121
Evpu startCtlPtX
Horizontal offset of the start control point.
Definition SmartShape.h:118
static const xml::XmlElementArray< ControlPointAdjustment > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Evpu endCtlPtX
Horizontal offset of the end control point.
Definition SmartShape.h:120
bool active
If true, this adjustment should be used when it is applicable.
Definition SmartShape.h:122
Represents the endpoint adjustment of a smart shape or center shape.
Definition SmartShape.h:187
Evpu calcVertOffset() const
Returns the effective vertical offset, taking into account whether the endpoint is active.
Definition SmartShape.h:202
EntryConnectionType contextEntCnct
The entry conntection type for this adjustment.
Definition SmartShape.h:195
bool calcHasVerticalEquivalentConnection(const EndPointAdjustment &other) const
Returns true if the two intances of EndPointAdjustment have connection types that allow their vertica...
Definition SmartShape.cpp:256
bool active
If true, this adjustment should be used when it is applicable (xml node is <on>)
Definition SmartShape.h:193
Evpu calcHorzOffset() const
Returns the effective horizontal offset, taking into account whether the endpoint is active.
Definition SmartShape.h:198
static const xml::XmlElementArray< EndPointAdjustment > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Evpu horzOffset
Horizontal offset (xml node is <x>)
Definition SmartShape.h:191
Evpu vertOffset
Vertical offset (xml node is <y>)
Definition SmartShape.h:192
DirectionType contextDir
The direction type for this adjustment.
Definition SmartShape.h:194
Represents an endpoint of the smart shape.
Definition SmartShape.h:132
util::Fraction calcGlobalPosition() const
Calculates the global position of the endpoint within its measure, based on whether it is measure- or...
Definition SmartShape.cpp:214
MusxInstance< others::StaffComposite > createCurrentStaff() const
Return true if this endpoint is properly assigned to its measure and to its entry (for entry-attached...
Definition SmartShape.cpp:181
Edu eduPosition
Edu position of endpoint (xml node is <edu>)
Definition SmartShape.h:138
bool calcIsAssigned() const
Return true if this endpoint is properly assigned to its measure and to its entry (for entry-attached...
Definition SmartShape.cpp:170
util::Fraction calcPosition() const
Calculates the staff-level position of the endpoint within its measure, based on whether it is measur...
Definition SmartShape.cpp:203
int compareMetricPosition(const EndPoint &other) const
Compares the metric position of two endpoints.
Definition SmartShape.cpp:233
EntryNumber entryNumber
Entry number. Zero if the endpoint is not entry-attached. (xml node is <entryNum>)
Definition SmartShape.h:139
EntryInfoPtr calcAssociatedEntry(bool findExact=false) const
Calculates the entry associated with the endpoint.
Definition SmartShape.cpp:82
MusxInstance< details::SmartShapeEntryAssign > getEntryAssignment() const
Gets the entry assignment for this endpoint or null if none. Always null for measure-assigned endpoin...
Definition SmartShape.cpp:148
static const xml::XmlElementArray< EndPoint > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
MusxInstance< others::SmartShapeMeasureAssign > getMeasureAssignment() const
Gets the measure assignment for this endpoint or null if none.
Definition SmartShape.cpp:129
MeasCmper measId
Measure ID (xml node is <meas>)
Definition SmartShape.h:137
bool calcIsValid() const
Finale can leave dead smart shapes around. This function calculates if the endpoint's staff and measu...
Definition SmartShape.cpp:191
StaffCmper staffId
Staff ID (xml node is <inst>)
Definition SmartShape.h:136
Wrapper class for interpreting and rendering Enigma-style strings with insert handling.
Definition EnigmaString.h:435
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:38
std::optional< Cmper > importSmartShapeCustomLineInto(const DocumentPtr &target, const MusxInstance< SmartShapeCustomLine > &source, const ImportObjectCallback &onImported={})
Copies a custom line and its document-local dependencies into another document.
Definition SmartShape.cpp:552
CurveContourDirection
Curve contour direction for ties and slurs.
Definition EnumClasses.h:62
@ Unrecognized
Fallback when recognition fails.
@ VerticalLineRightHooks
Vertical line with short horizontal hooks extending to the right at both ends.
KnownSmartShapeType
Enumerates the custom smart shape types we can recognize semantically.
Definition SmartShape.h:51
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:66
int32_t Efix
EFIX value (64 per EVPU, 64*288=18432 per inch)
Definition Fundamentals.h:62
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:40
ShapeDirection
Direction settings shared by smart-shape options and instances.
Definition EnumClasses.h:171
@ None
Do not override the existing enharmonic state. (Default)
VerticalPlacement
Specifies a vertical placement relationship for notation objects.
Definition EnumClasses.h:220
int16_t Inci
Enigma "incident" key type.
Definition Fundamentals.h:58
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:59
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:57
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:63
ArrowheadPreset
Finale-defined arrowhead presets.
Definition EnumClasses.h:52
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition DocumentElement.h:37
int32_t EntryNumber
Entry identifier.
Definition Fundamentals.h:71
std::function< void(const EnigmaBase &)> ImportObjectCallback
Receives each document-pool object newly created by an import helper.
Definition BaseClasses.h:148
uint16_t NoteNumber
Note identifier.
Definition Fundamentals.h:72
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition DocumentElement.h:35
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:67
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:133
object model for musx file (enigmaxml)
Definition BaseClasses.h:38