Finale PDK Framework 0.77
Power Up Your Finale Music Software
Loading...
Searching...
No Matches
ff_base.h
1/*
2 * File: ff_base.h
3 * Author: Jari Williamsson
4 *
5 * Created on den 26 december 2009, 14:03
6 *
7 * Important! Don't use size_t in general, since it's crashes Lua on 64-bit Windows if used in method prototypes.
8 */
9
10#ifndef _FF_BASE_H
11#define _FF_BASE_H
12
13#include <finalepdk.h>
14#include <ctype.h>
15#ifdef PDK_FRAMEWORK_TINYXML
16#include <tinyxml2.h>
17#endif
18#include <ctime> /* strftime */
19#include <algorithm>
20#include <typeinfo>
21#include <string>
22#include <vector>
23
24#ifdef PDK_FRAMEWORK_DEBUG
25#if OPERATING_SYSTEM == WINDOWS
26#include <stdio.h> /* sprintf */
27#endif
28#endif
29
30/* Define macros to simplify Lua/non-Lua types */
31#ifdef PDK_FRAMEWORK_LUAFRIENDLY
32#include "fflua_lua.h"
33#define _LUACODE(x) x
34#define _NOLUACODE(x)
35#define _state_ptr lua_State*
36void __finale_version_check(EVERSION version, const char* funcName, const char* className);
37#define FINALE_VERSION_CHECK(version) __finale_version_check(version, __func__, typeid(*this).name())
38#else
39#define _LUACODE(x)
40#define _NOLUACODE(x) x
41typedef void* _state_ptr;
42#define FINALE_VERSION_CHECK(version)
43#endif // PDK_FRAMEWORK_LUAFRIENDLY
44
45#define _ENUMCODE(x) _NOLUACODE(x)
46
47#ifndef LB2
48#define LB2(C)
49#endif
50
51#ifndef LB3
52#define LB3(C)
53#endif
54
55// Macros for selecting an item from one or another struct for getters and setters
56#define _GET_OLD_NEW_MEMBER_SELECT(MEMBEROLD, MEMBERNEW, DATAOLD, DATANEW, ISNEW) \
57 ( (ISNEW) ? DATANEW.MEMBERNEW : static_cast<decltype(DATANEW.MEMBERNEW)>(DATAOLD.MEMBEROLD) )
58#define _SET_OLD_NEW_MEMBER_SELECT(MEMBEROLD, MEMBERNEW, DATAOLD, DATANEW, ISNEW) \
59 (([&]() -> decltype(DATANEW.MEMBERNEW)& { return (ISNEW) ? DATANEW.MEMBERNEW : DATAOLD.MEMBEROLD; })())
60
61/* Forward declararations of some required classes. */
62class FCString;
63class FCUI;
64class FCNumbers;
65
70class __FCBase //warning, this breaks FCString and other stuff: LB3(: public std::enable_shared_from_this<__FCBase>)
71{
72#ifndef DOXYGEN_SHOULD_IGNORE_THIS
74 void *_UserData;
76 void *_UserData2;
77#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
78public:
84 {
85 FCID_UNKNOWN = 0,
86 FCID_ACCIDENTALMOD,
87 FCID_ACTIVELYRIC,
88 FCID_ALLOTMENT,
89 FCID_ARTICULATION,
90 FCID_ARTICULATIONDEF,
91 FCID_BACKWARDREPEAT,
92 FCID_BASELINE,
93 FCID_BEAMMOD,
94 FCID_BEATCHARTELEMENT,
95 FCID_BOOKMARK,
96 FCID_BROKENBEAMMOD,
97 FCID_CATEGORYDEF,
98 FCID_CELLCLEFCHANGE,
99 FCID_CELLFRAMEHOLD,
100 FCID_CELLGRAPHIC,
101 FCID_CELLTEXT,
102 FCID_CENTERSMARTSHAPE,
103 FCID_CHORD,
104 FCID_CHORDPREFS,
105 FCID_CHORDSUFFIXELEMENT,
106 FCID_CHORUSSYLLABLE,
107 FCID_CLEFDEF,
108 FCID_COMPOSITETIMESIGBOTTOMELEMENT,
109 FCID_COMPOSITETIMESIGTOPELEMENT,
110 FCID_CROSSSTAFFMOD,
111 FCID_CUSTOMSMARTLINEDEF,
112 FCID_CUSTOMSTEMMOD,
113 FCID_DISTANCEPREFS,
114 FCID_DOTMOD,
115 FCID_ENCLOSURE,
116 FCID_ENDINGREPEAT,
117 FCID_ENIGMATEXTSTYLE,
118 FCID_ENTRYALTERMOD,
119 FCID_EXECUTABLESHAPEDEF,
120 FCID_EXPRESSION,
121
124
125 FCID_FONTPREFS,
126 FCID_FREEZESYSTEM,
127 FCID_FRETBOARDSTYLEDEF,
128 FCID_FRETBOARDSTYLEDEFS,
129 FCID_FRETBOARDGROUPDEF,
130 FCID_FRETBOARDGROUPDEFS,
131 FCID_FRETINSTRUMENTDEF,
132 FCID_GENERALPREFS,
133 FCID_GRIDSGUIDESPREFS,
134 FCID_GROUP,
135 FCID_GROUPNAMEPOSITIONPREFS,
136 FCID_HUMANPLAYBACKPREFS,
137 FCID_INDEPENDENTCELLDETAIL,
138 FCID_INSTRUMENTDEF,
139 FCID_INSTRUMENTPLAYBACKDATA,
140 FCID_KEYMODEDEF,
141 FCID_KEYSIGNATURE,
142 FCID_LAYERPREFS,
143 FCID_LYRICSBASELINE,
144 FCID_LYRICSPREFS,
145 FCID_MEASURE,
146 FCID_MEASURENUMBERREGION,
147 FCID_METATOOLASSIGNMENT,
148 FCID_MIDIEXPRESSION,
149 FCID_MISCDOCPREFS,
150 FCID_MULTIMEASUREREST,
151 FCID_MULTIMEASURERESTPREFS,
152 FCID_MULTISTAFFINSTRUMENT,
153 FCID_MULTISTAFFINSTRUMENTS,
154 FCID_MUSICCHARACTERPREFS,
155 FCID_MUSICSPACINGPREFS,
156
159 FCID_NOTEHEADMOD,
160 FCID_OTHERINCI,
161 FCID_PERCUSSIONLAYOUTNOTE,
162 FCID_PERCUSSIONSTAFF,
163 FCID_PERFORMANCEMOD,
164 FCID_PAGE,
165 FCID_PAGEFORMATPREFS,
166 FCID_PAGEGRAPHIC,
167 FCID_PAGETEXT,
168 FCID_PART,
169 FCID_PARTEXTRACTPREFS,
170 FCID_PARTSCOPEPREFS,
171 FCID_PARTSTAFFVOICING,
172 FCID_PERCUSSIONNOTEMOD,
173 FCID_PIANOBRACEPREFS,
174 FCID_PLAYBACKPREFS,
175 FCID_RAWTEXT,
176 FCID_REPEATPREFS,
177 FCID_SECONDARYBEAMBREAKMOD,
178 FCID_BEAMEXTENSIONMOD,
179 FCID_SECTIONSYLLABLE,
180 FCID_SEPARATEMEASURENUMBER,
181 FCID_SEPARATEPLACEMENT,
182 FCID_SHAPEDEF,
183 FCID_SHAPEEXPRESSIONDEF,
184 FCID_SLURCONTOURPREFS,
185 FCID_SIZEPREFS,
186 FCID_SMARTSHAPE,
187 FCID_SMARTSHAPEENTRYMARK,
188 FCID_SMARTSHAPEMEASUREMARK,
189 FCID_SMARTSHAPEPREFS,
190 FCID_STAFF,
191 FCID_STAFFLIST,
192 FCID_STAFFNAMEPOSITION,
193 FCID_STAFFNAMEPOSITIONPREFS,
194 FCID_STAFFSTYLEASSIGN,
195 FCID_STAFFSTYLEDEF,
196 FCID_STAFFSYSTEM,
197 FCID_STEMCONNECTIONTABLE,
198 FCID_STEMMOD,
199
202
203 FCID_SYLLABLEENTRYMOD,
204 FCID_SYSTEMSTAFF,
205 FCID_TABLATURENOTEMOD,
206 FCID_TEMPOELEMENT,
207 FCID_TEXTBLOCK,
208 FCID_TEXTEXPRESSIONDEF,
209 FCID_TEXTREPEAT,
210 FCID_TEXTREPEATDEF,
211 FCID_TIEMOD,
212 FCID_TIEPREFS,
213 FCID_TIECONTOURPREFS,
214 FCID_TIEPLACEMENTPREFS,
215 FCID_TIMESIGNATURE,
216 FCID_TUPLET,
217 FCID_TUPLETPREFS,
218 FCID_VERSESYLLABLE
219 };
220
228 virtual const PDKFRAMEWORK_CLASSID GetClassID() const { return FCID_UNKNOWN; }
229
230#ifdef PDK_FRAMEWORK_LUAFRIENDLY
231#ifndef DOXYGEN_SHOULD_IGNORE_THIS
234 int _Lua_GetClassID() const { return (int) GetClassID(); }
235#endif
236#endif
237
243 {
246
249
252
255
258
261
264
267 };
268
274 virtual const char* ClassName() const = 0;
275
276protected:
279 {
280 _UserData = NULL;
281 _UserData2 = NULL;
282 }
283public:
284
289 /* NOTE: This was a bug that wasn't discovered until April 04 2013, so all
290 * plug-ins that use primitive collections (such as string collections)
291 * should be rebuilt. */
292 virtual ~__FCBase()
293 {
294 }
295
296#ifdef PDK_FRAMEWORK_DEBUG
302 void DebugMsgInt(const char* pszPrefixText, int i);
303
309 void DebugMsgHex(const char* pszPrefixText, int i);
310
316 void DebugMsgString(const char* pszPrefixText, const char * thestring);
317
322 void DebugMsg(const char* pszMsg);
323
331 static void DebugOutPtr(const char* pszPrefixText, void* ptr);
332
338 static void DebugOutInt(const char* pszPrefixText, int i);
339
345 static void DebugOutFloat(const char* pszPrefixText, double f);
346
352 static void DebugOutTag(const char* pszPrefixText, EXTAG extag);
353
359 static void DebugOutHex(const char* pszPrefixText, int i);
360
366 static void DebugOutBin(const char* pszPrefixText, int i);
367
373 static void DebugOutString(const char* pszPrefixText, const char * thestring);
374
380 static void DebugOutString(const char* pszPrefixText, FCString* pString);
381
387 static void DebugOutBool(const char* pszPrefixText, bool state);
388
394 static void DebugOutBlock(const void * pBuffer, int startoffset, int size);
395
406 static void DebugOutByteArrayBlock(const void * pBuffer, int startoffset, int size);
407
412 static void DebugOut(const char* pszLine);
413
418 void DebugOutMenuInfo(FCUI* pUI, int menuixd_horiz, int menuixd_vert) const;
419
420#ifdef PDK_FRAMEWORK_FORMAT
426 int DebugOutFormat(const char *fmt, ...);
427#endif
428
437 virtual void DebugDump();
438
447 virtual void DebugDataDump();
448
458 virtual void DebugDataByteArrayDump();
459#endif
460
467 void Set16BitFlag(FLAG_16 *flag, FLAG_16 flagbits, bool state);
468
475 void Set32BitFlag(FLAG_32 *flag, FLAG_32 flagbits, bool state);
476
485 bool GetBitFlag(FLAG_32 flag, FLAG_32 flagbits) const { return (flag & flagbits) != 0; }
486
488 int GetBitCount(FLAG_32 flag);
489
496 void SetSpecific32Bit(FLAG_32* flag, int bitnumber, bool state);
497
503 void SetUserData(void* pData) { _UserData = pData; }
504
510 void SetUserData2(void* pData) { _UserData2 = pData; }
511
517 void* GetUserData() const { return _UserData; }
518
524 void* GetUserData2() const { return _UserData2; }
525
539 virtual bool IsIdentical(const __FCBase* pCompareObject) const
540 {
541 if (!pCompareObject) return false;
542 if (ClassName() != pCompareObject->ClassName()) return false; /* Should point to same const string */
543 return true;
544 }
545
546
547#ifdef PDK_FRAMEWORK_TINYXML
552 void StoreXML_String(tinyxml2::XMLElement* pParentNode, const char* pszElementName, FCString* pStringValue);
553
558 void StoreXML_Integer(tinyxml2::XMLElement* pParentNode, const char* pszElementName, int value);
559
564 void StoreXML_Bool(tinyxml2::XMLElement* pParentNode, const char* pszElementName, bool value);
565
570 void StoreXML_StringAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, FCString* pStringValue);
571
576 void StoreXML_IntegerAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, int value);
577
582 void StoreXML_BoolAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, bool value);
583
588 void StoreXML_FloatAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, float value);
589
596 virtual void StoreToXML([[maybe_unused]]tinyxml2::XMLElement* pParentNode) {}
597
598
605 bool ReadXML_String(tinyxml2::XMLElement* pParentNode, const char* pszElementName, FCString* pStringValue);
606
613 bool ReadXML_Integer(tinyxml2::XMLElement* pParentNode, const char* pszElementName, int* pValue);
614
621 bool ReadXML_Bool(tinyxml2::XMLElement* pParentNode, const char* pszElementName, bool *pValue);
622
629 bool ReadXML_StringAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, FCString* pStringValue);
630
637 bool ReadXML_IntegerAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, int* pValue);
638
645 bool ReadXML_BoolAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, bool *pValue);
646
653 bool ReadXML_FloatAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, float *pValue);
654
663 virtual bool ReadFromXML([[maybe_unused]]tinyxml2::XMLElement* pParentNode) { return false; }
664#endif
665};
666
676class __FCBaseData : public __FCBase {
677#ifndef DOXYGEN_SHOULD_IGNORE_THIS
678 EXTAG _customtag;
679
681 virtual bool _RawRelink()
682 {
683 DeleteData();
684 return Save();
685 }
686#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
687protected:
692
696
700
709
710
712 EDataID _dataid;
713
714
720 virtual void* Allocate() = 0;
721
725 virtual void Deallocate() {
726 }
727
733 virtual bool IsDynamicSize() {
734 return false;
735 }
736
740 bool LoadDataBlock();
741
746 void ClearData();
747
755 virtual twobyte CalcLastInci() { return kNewInci; }
756
766
770 bool DataIsLoaded() const {
771 return (_loadedsize > 0);
772 }
773
778 void _TagDocumentID();
779public:
780
781 const PDKFRAMEWORK_CLASSID GetClassID() const override = 0; /* Force all inherited class to have this method implementation */
782
787 EDOCID GetConnectedDocID() const
788 {
789 return _connecteddocID;
790 }
791
799
804 virtual EXTAG Tag() const = 0;
805
812 virtual EVERSION EnigmaVersion() const { return FXT_VERSION; }
813
819 virtual int DataSizeLoad() const = 0;
820
824 virtual int DataSizeSave() const;
825
826
827 const char* ClassName() const override { return "__FCBaseData"; }
828
833 void _CloneFrom(__FCBaseData* pSource);
834
842 virtual void CloneMemoryFrom(__FCBaseData* pSource);
843
848 const EDataID* _GetDataID() { return &_dataid; }
849
854 int _GetLoadedSize() const { return _loadedsize; }
855
860 const void* GetDataBlock() { return _datablock; }
861
870 EXTAG GetCustomTag() const { return _customtag; }
871
882 void SetCustomTag(EXTAG tag) { _customtag = tag; }
883
885 __FCBaseData();
886
888 virtual ~__FCBaseData();
889
896 virtual bool Save();
897
912 virtual bool Reload();
913
922 virtual bool DeleteData();
923
930 virtual bool DeepDeleteData()
931 {
932 return DeleteData();
933 }
934
943 virtual bool LoadFirst() = 0;
944
949 virtual bool LoadLast() { return false; }
950
955 virtual bool LoadNext();
956
961 virtual bool LoadPrevious() { return false; }
962
984 bool RelinkToCurrentView();
985
994 bool RelinkToScore();
995
1004
1005#ifdef PDK_FRAMEWORK_DEBUG
1006 void DebugDump() override
1007 {
1009 DebugOutPtr("Data block: ", _datablock);
1010 DebugOutInt("Loaded size: ", (int) _GetLoadedSize());
1011 }
1012
1013 void DebugDataDump() override
1014 {
1017 }
1018
1024
1025#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1026 virtual void DebugDataCompare(__FCBaseData *pCompareObject)
1027 {
1028 if (!pCompareObject)
1029 {
1030 DebugOut("DebugDataCompare(): Compare object is nil.");
1031 return;
1032 }
1033 if (_GetLoadedSize() != pCompareObject->_GetLoadedSize())
1034 {
1035 char szBuffer[200];
1036 snprintf(szBuffer, sizeof(szBuffer), "DebugDataCompare(): Compare size differs. %d compared to %d byte(s)", (int) _GetLoadedSize(), (int) pCompareObject->_GetLoadedSize());
1037 DebugOut(szBuffer);
1038 return;
1039 }
1040 unsigned char* pDataBlock = (unsigned char*) GetDataBlock();
1041 unsigned char* pCompareBlock = (unsigned char*) pCompareObject->GetDataBlock();
1042 int diffcount = 0;
1043 for (int i = 0; i < _GetLoadedSize(); i++)
1044 {
1045 if (pDataBlock[i] != pCompareBlock[i])
1046 {
1047 diffcount ++;
1048 char szBuffer[200];
1049 snprintf(szBuffer, sizeof(szBuffer), "DebugDataCompare() DIFF at 0-based byte offset %d: 0x%02x - 0x%02x ", i, pDataBlock[i], pCompareBlock[i]);
1050 DebugOut(szBuffer);
1051 }
1052 }
1053 if (diffcount == 0)
1054 {
1055 DebugOut("DebugDataCompare(): Data blocks are identical");
1056 }
1057 }
1058#endif
1059
1062 void DebugDataOffsetDump(int offset, int size);
1063
1064#endif
1065
1082
1083#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1085 luabridge::RefCountedPtr<FCNumbers> CreateRawDataDump_GC()
1086 { return makeLuaSharedPtr(CreateRawDataDump()); }
1087#endif
1088
1089};
1090
1091
1096{
1097public:
1098 const char* ClassName() const override { return "__FCInci"; }
1099
1101 bool Load(CMPER cmper, twobyte inci);
1102};
1103
1104
1105class FCString;
1106
1107// this value is used to set apart "Fixed" (absolute) font formatting
1108// within the context of a displayed string. An example where it is used
1109// is when displaying an Enigma string in FCCtrlTextEditor.
1110constexpr double kDisplayPercentForFixedFontSize = 1.1;
1111
1137class FCFontInfo : public __FCBase
1138{
1139#if FXT_VERSION >= FINALEVERSION_25
1140 EnigmaFontName _nameUTF16; /* 64-bit version of the data. */
1141#else
1142 EFONTNAME _name; /* Should NOT be used on Finale 25 or later. */
1143#endif
1144 EFONTID _fontid; /* The internal font ID. This is not
1145 document independent, but can be used for
1146 some cases when the exact font ID is
1147 required within the document. Currently the Framework
1148 hardly uses it and gets the internal font number with
1149 GetIDByName if it needs it.*/
1150 double _size; /* Although Finale itself doesn't support fractional points,
1151 support it here. The FCCtrlCanvas supports it. */
1152 FLAG_16 _styles;
1153private:
1154 const static FCString DefaultFontName;
1155public:
1156 const char* ClassName() const override { return "FCFontInfo"; }
1157 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_FONTINFO; }
1158
1165 {
1167 ENIGMASTYLE_PLAIN = FONT_EFX_PLAIN,
1168
1170 ENIGMASTYLE_BOLD = FONT_EFX_BOLD,
1171
1173 ENIGMASTYLE_ITALIC = FONT_EFX_ITALIC,
1174
1176 ENIGMASTYLE_UNDERLINE = FONT_EFX_UNDERLINE,
1177
1179 ENIGMASTYLE_STRIKEOUT = FONT_EFX_STRIKEOUT,
1180
1182 ENIGMASTYLE_ABSOLUTE = FONT_EFX_ABSOLUTE,
1183
1185 ENIGMASTYLE_HIDDEN = FONT_EFX_HIDDEN
1187
1196 FCFontInfo();
1197
1207 FCFontInfo(const FCString& name, double size, FLAG_16 enigmastyles = ENIGMASTYLE_PLAIN);
1208
1209#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1211 static FCFontInfo* FCFontInfo_Lua(void* ptr, lua_State *L);
1212#endif // PDK_FRAMEWORK_LUAFRIENDLY_CPP
1213
1215 FCFontInfo(const ETextStyle& style);
1216
1217#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1222 static int FCFontInfo_tostring(lua_State* L);
1223#endif
1224
1232 static fourbyte GetSystemTextEncoding();
1233
1234
1239 void CopyFrom(const FCFontInfo* pInfo);
1240
1248 {
1249 FCFontInfo* pCopy = new FCFontInfo();
1250 pCopy->CopyFrom(this);
1251 return pCopy;
1252 }
1253
1254#ifdef PDK_FRAMEWORK_PREFS
1255 /* NOTE! These 2 declarations are not type safe, since this declaration is in ff_base.h */
1256
1267 bool LoadFontPrefs(int prefsID);
1268
1279 bool SaveFontPrefs(int prefsID);
1280
1281#endif /* PDK_FRAMEWORK_PREFS*/
1282
1289 int GetSize() const { return static_cast<int>(_size); }
1290
1297 double GetSizeFloat() const
1298 {
1299 return _size;
1300 }
1301
1302#if FXT_VERSION < FINALEVERSION_25
1303#ifndef PDK_FRAMEWORK_LUAFRIENDLY
1305 void GetNameParam(const EFONTNAME* pName) { strcpy((char*)pName, (const char*)_name); }
1306#endif
1307#endif
1308
1317 void GetNameString(FCString* pString) const;
1318
1325 std::string GetName() const;
1326
1340 EFONTID GetIDByName() const;
1341
1348 [[deprecated]]EFONTID GetNameByID() const
1349 { return GetIDByName(); }
1350
1351
1358 FLAG_16 GetEnigmaStyles() const { return _styles; }
1359
1360#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
1376 bool MakeEnigmaString(FCString* pString, FCString* pFontTagString = NULL);
1377
1390 FCString* CreateEnigmaString(FCString* pFontTagString = NULL);
1391
1392#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1393private:
1395 luabridge::RefCountedPtr<FCString>CreateEnigmaString_GC(FCString* pFontTagString)
1396 { return makeLuaSharedPtr(CreateEnigmaString(pFontTagString)); }
1397public:
1399 static int CreateEnigmaString_CFunc(lua_State* L)
1400 {
1401 return _CFunctionOneOptionalParameter<FCFontInfo, luabridge::RefCountedPtr<FCString>, FCString*, &FCFontInfo::CreateEnigmaString_GC>(L, nullptr);
1402 }
1403#endif
1404
1414 void MakeEnigmaStyleString(FCString* pString);
1415
1425 void MakeEnigmaSizeString(FCString* pString);
1426
1435
1436#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1438 luabridge::RefCountedPtr<FCString> CreateEnigmaStyleString_GC()
1439 { return makeLuaSharedPtr(CreateEnigmaStyleString()); }
1440#endif
1441
1451 bool ParseEnigmaCommand(FCString* pString);
1452
1453#endif /* PDK_FRAMEWORK_ENIGMASTRINGS */
1454
1456 void ParseEnigmaFont(const EEnigmaFont* pEnigmaFont)
1457 {
1458 SetEnigmaStyles(pEnigmaFont->efx);
1459 SetSize(pEnigmaFont->size);
1460 SetNameByID(pEnigmaFont->font);
1461 }
1462
1469 void SetEnigmaStyles(FLAG_16 fontstyles) { _styles = fontstyles; }
1470
1477 FCString* CreateDescription() const;
1478
1479#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1481 luabridge::RefCountedPtr<FCString> CreateDescription_GC()
1482 { return makeLuaSharedPtr(CreateDescription()); }
1483#endif
1484
1485#if FXT_VERSION < FINALEVERSION_25
1486#ifndef PDK_FRAMEWORK_LUAFRIENDLY
1488 void SetName( const EFONTNAME* pName) { strcpy((char*)_name, (const char*)pName); }
1489#endif
1490#endif
1491
1498 void SetName(const std::string& pszName);
1499
1511 EFONTID GetFontID() const { return _fontid; }
1512
1525 void SetFontID(EFONTID fontID) { _fontid = fontID; }
1526
1531 void SetNameString(const FCString& value);
1532
1538 void SetNameByID(EFONTID id);
1539
1546 void SetSize(int fontsize) { _size = static_cast<double>(fontsize); }
1547
1554 void SetSizeFloat(double fontsize) { _size = fontsize; }
1555
1562 void SetAbsolute(bool state) { Set16BitFlag(&_styles, FONT_EFX_ABSOLUTE, state); }
1563
1570 void SetStrikeOut(bool state) { Set16BitFlag(&_styles, FONT_EFX_STRIKEOUT, state); }
1571
1578 void SetBold(bool state) { Set16BitFlag(&_styles, FONT_EFX_BOLD, state); }
1579
1586 void SetHidden(bool state) { Set16BitFlag(&_styles, FONT_EFX_HIDDEN, state); }
1587
1594 void SetItalic(bool state) { Set16BitFlag(&_styles, FONT_EFX_ITALIC, state); }
1595
1602 void SetUnderline(bool state) { Set16BitFlag(&_styles, FONT_EFX_UNDERLINE, state); }
1603
1608 void SetPlain() { _styles = 0; }
1609
1618 bool IsName(const char* pszTestName) const;
1619
1628 bool IsNameString(const FCString& pTestName) const;
1629
1634 bool IsPlain() { return (_styles == 0); }
1635
1640 bool GetBold() const { return GetBitFlag(_styles, FONT_EFX_BOLD); }
1641
1646 bool GetItalic() const { return GetBitFlag(_styles, FONT_EFX_ITALIC); }
1647
1652 bool GetUnderline() const { return GetBitFlag(_styles, FONT_EFX_UNDERLINE); }
1653
1658 bool GetStrikeOut() const { return GetBitFlag(_styles, FONT_EFX_STRIKEOUT); }
1659
1664 bool GetAbsolute() const { return GetBitFlag(_styles, FONT_EFX_ABSOLUTE); }
1665
1670 bool GetHidden() const { return GetBitFlag(_styles, FONT_EFX_HIDDEN); }
1671
1679 bool GetIsSMuFLFont() const
1680 {
1681#if FXT_VERSION >= FINALEVERSION_27_1
1682 return FX_IsSMuFLFont(GetIDByName());
1683#else
1684 return false;
1685#endif
1686 }
1687
1695 bool IsMacSymbolFont() const;
1696
1702 bool IsIdenticalTo(const FCFontInfo& compareWith) const;
1703
1711 bool MakeDefaultMusicFont();
1712
1725
1739 {
1741 }
1742
1743#ifdef PDK_FRAMEWORK_DEBUG
1744 void DebugDump() override;
1745#endif
1746};
1747
1748
1757{
1758 FCFontInfo _font;
1759 EColor _color{}; // not currently used
1760 fourbyte _tracking{};
1761 Evpu32 _baselineshift{};
1762 Evpu32 _superscript{};
1763
1764public:
1765 const char* ClassName() const override { return "FCEnigmaTextStyle"; }
1766 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_ENIGMATEXTSTYLE; }
1767
1768#ifdef PDK_FRAMEWORK_LUAFRIENDLY
1770 static FCEnigmaTextStyle* FCEnigmaTextStyle_Lua(void* ptr, lua_State* L)
1771 {
1772 return _OneOptionalParamLuaConstructor<FCEnigmaTextStyle, const FCFontInfo&>(ptr, L);
1773 }
1774#endif
1775
1780 FCEnigmaTextStyle() : _font() {}
1781
1786 FCEnigmaTextStyle(const FCFontInfo& font) : _font()
1787 {
1788 _font.CopyFrom(&font);
1789 }
1790
1791#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1793 FCEnigmaTextStyle(const ETextStyle& ts) : _font(ts)
1794 {
1795 _color = ts.color;
1796 _tracking = ts.tracking;
1797 _baselineshift = ts.baselineShift;
1798 _superscript = ts.superscript;
1799 }
1800#endif // DOXYGEN_SHOULD_IGNORE_THIS
1801
1808 FCFontInfo* GetFont() { return &_font; }
1809
1810#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1812 const FCFontInfo* GetFont() const { return &_font; }
1813#endif
1814
1819 fourbyte GetInterletterSpacing() const { return _tracking; }
1820
1825 Evpu32 GetBaselineShift() const { return _baselineshift; }
1826
1831 Evpu32 GetSuperscript() const { return _superscript; }
1832
1837 void SetInterletterSpacing(fourbyte value) { _tracking = value; }
1838
1843 void SetBaselineShift(Evpu32 value) { _baselineshift = value; }
1844
1849 void SetSuperscript(Evpu32 value) { _superscript = value; }
1850};
1851
1852
1853class FCStrings;
1854class FCCategoryDef;
1855class FCRange;
1856
1857const eUniChar16 UTF16_HIGH_SURROGATE_MASK = 0xD800;
1858const eUniChar16 UTF16_LOW_SURROGATE_MASK = 0xDC00;
1859
1876class FCString : public __FCBase
1877{
1878 // use _fcStringChar instead of eUniChar16 so that C++ debuggers
1879 // will display the buffers as strings.
1880 using _fcStringChar = WINCODE(WCHAR) MACCODE(char16_t);
1881 static_assert(sizeof(_fcStringChar) == sizeof(eUniChar16), "FCString internal _fcStringChar must match sizeof(eUniChar16).");
1882
1883#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1884 int _length;
1885 int _storagelength; // Maximum characters that can fit in the storage
1886 _fcStringChar* _pStorage; /* The main string buffer (UTF16) for Unicode.
1887 * The contents MUST be 0-terminated (since
1888 * some APIs require it)! */
1889 mutable char* _pTempCBuffer; // Used for GetCString
1890 mutable char* _pTempCUTF8Buffer; // Used for GetCStringUTF8
1891
1892#if OPERATING_SYSTEM == MAC_OS
1893 mutable void* _nsstringobject; /* A retained NSString* object for GetNSString() */
1894#endif
1895
1897 void _DeleteStorage();
1898
1900 void _ExpandStorageIfNecessary(int minimumlength);
1901
1903 bool _SetFinalePath(FinPath pathconstant);
1904
1905 void __init()
1906 {
1907 _length = 0;
1908 _storagelength = 0;
1909 _pStorage = NULL;
1910 _pTempCBuffer = NULL;
1911 _pTempCUTF8Buffer = NULL;
1912#if OPERATING_SYSTEM == MAC_OS
1913 _nsstringobject = nullptr;
1914#endif
1915 Clear();
1916 }
1917
1918#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
1919
1920
1921#ifdef PDK_FRAMEWORK_TINYXML
1928 void StoreToXML(tinyxml2::XMLElement* pParentNode) override {
1929 StoreXML_StringAttribute(pParentNode, "FCString", this);
1930 }
1931
1932 /* \brief Virtual method that reads the string object data. This method is
1933 * only called passively by the collection load feature.
1934 *
1935 * This method requires the <b>PDK_FRAMEWORK_TINYXML</b> define. */
1936 bool ReadFromXML(tinyxml2::XMLElement* pParentNode) override
1937 {
1938 return ReadXML_StringAttribute(pParentNode, "FCString", this);
1939 }
1940#endif
1941
1942 static bool _IsHighSurrogate(eUniChar16 value)
1943 {
1944 return (value & 0xFC00) == UTF16_HIGH_SURROGATE_MASK;
1945 }
1946
1947 static bool _IsLowSurrogate(eUniChar16 value)
1948 {
1949 return (value & 0xFC00) == UTF16_LOW_SURROGATE_MASK;
1950 }
1951
1957 bool _GetCodePointRange(FCRange *pRange) const;
1958
1959public:
1960 const char* ClassName() const override { return "FCString"; }
1961 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_STRING; }
1962
1963#ifdef PDK_FRAMEWORK_LUAFRIENDLY
1965 static FCString* FCString_Lua(void* ptr, lua_State* L)
1966 {
1967 return _OneOptionalParamLuaConstructor<FCString, const char *>(ptr, L);
1968 }
1969#endif
1970
1976 {
1977 __init();
1978 }
1979
1986 FCString(const char* pszCString) : __FCBase()
1987 {
1988 __init();
1989 SetUTF8String(pszCString); // SetUTF8String falls back to platform encoding if UTF8 doesn't work, but we should try UTF8 first.
1990 }
1991
1993 FCString(const eUniChar16* pszCString) : __FCBase()
1994 {
1995 __init();
1996 SetUnicodeString(pszCString);
1997 }
1998
2000 FCString(const _fcStringChar* pszCString) : __FCBase()
2001 {
2002 __init();
2003 SetUnicodeString(reinterpret_cast<const eUniChar16 *>(pszCString));
2004 }
2005
2008 virtual ~FCString();
2009
2010#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2015 static int FCString_tostring(lua_State* L)
2016 {
2017 FCString* pThis = luabridge::Stack<FCString*>::get(L, 1) LB3(.value());
2018 std::string s = std::string(pThis->ClassName()) + ": " + pThis->GetUTF8String();
2019 luabridge::Stack<std::string>::push(L, s).throw_on_error();
2020 return 1;
2021 }
2022#endif
2023
2026 FCString(const FCString &src)
2027 {
2028 __init();
2029 SetString(&src); //note: SetString checks for self-assignment
2030 }
2031
2035 {
2036 // do NOT call __init() here because this-> points to a constructed FCString
2037 // and we need to let SetString() release the old memory.
2038 SetString(&src); //note: SetString checks for self-assignment
2039 return *this;
2040 }
2041
2042#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2043 bool operator==(const FCString &src) const
2044 { return (0 == this->Compare(src)); }
2045 template<typename T> // if we ever overload operator==(), this template picks up the overload as well
2046 bool operator!=(T src) const
2047 { return ! (*this == src); }
2048
2050 const _fcStringChar* GetOSUnicodeString() const { return _pStorage; }
2051
2053 const std::basic_string_view<eUniChar16> _GetBasicStringView() const
2054 { return std::basic_string_view<eUniChar16>(_GetUnicodeBuffer(), GetLength()); }
2055
2056 static const eUniChar16 emptyUniCharStr[];
2057#endif // DOXYGEN_SHOULD_IGNORE_THIS
2058
2068 void AppendCharacter(eUniChar32 character);
2069
2074 void AppendString(const FCString* pOtherString);
2075
2080 void AppendCString(const char* pOtherString);
2081
2082#if defined(PDK_FRAMEWORK_LUAFRIENDLY) || defined(DOXYGEN_SHOULD_IGNORE_THIS)
2090 void AppendLuaString(const char* pOtherString);
2091#endif
2092
2097 void AppendInteger(int value);
2098
2103 void AppendFloat(double value);
2104
2110
2118 {
2119 if (IsEmpty()) return;
2120#if OPERATING_SYSTEM == WINDOWS
2121 if (!EndsWith("\\") && !EndsWith("/")) AppendCString("\\");
2122#else
2123 if (!EndsWith("/")) AppendCString("/");
2124#endif
2125 }
2126
2143 bool EncodeFromMacRoman();
2144
2155 bool EncodeToMacRoman();
2156
2181 bool SplitAt(int splitpointindex, FCString* pFirstString, FCString* pSecondString, bool includesplitposchar) const
2182 {
2183 /* Make sure the 0-based index position is valid */
2184 if (splitpointindex < -1) return false;
2185 if (splitpointindex >= GetLength()) return false;
2186 if ((pFirstString) && (pFirstString == pSecondString))
2187 {
2188 /* Reference to same destination object is not allowed */
2189 return false;
2190 }
2191 if (pFirstString && pSecondString)
2192 {
2193 /* Don't allow copying to "this" if both substrings are used */
2194 if (pFirstString == this) return false;
2195 if (pSecondString == this) return false;
2196 }
2197 if (pFirstString)
2198 {
2199 pFirstString->SetString(this);
2200 /* Check state of includesplitposchar, to decide if the
2201 split point should be included or not. */
2202 const int splitoffset = includesplitposchar ? 1 : 0;
2203 // ignore return value here, because TruncateAt returns false if there is nothing to truncate,
2204 // but we do not care about that. We have already checked for the other conditions that might
2205 // cause TruncateAt to fail.
2206 pFirstString->TruncateAt((std::max)(0, splitpointindex + splitoffset));
2207 }
2208 if (pSecondString)
2209 {
2210 pSecondString->SetString(this);
2211 if (splitpointindex >= 0)
2212 pSecondString->DeleteCharactersAt(0, splitpointindex + 1);
2213 }
2214 return true;
2215 }
2216
2231 bool SplitToPathAndFile(FCString* pPathPart, FCString* pFilePart) const
2232 {
2233#if OPERATING_SYSTEM == WINDOWS
2234 // Little known fact: Windows recognizes either forward or back slash as a path delimiter.
2235 int pos = (std::max)(FindLast("/"), FindLast("\\"));
2236#else
2237 int pos = FindLast("/");
2238#endif
2239 return SplitAt(pos, pPathPart, pFilePart, true);
2240 }
2241
2246 void SetUserPath();
2247
2256 void SetUserOptionsPath();
2257
2264 void SetPluginsFolderPath() { _SetFinalePath(FinPath_PluginDir); }
2265
2272 void SetMusicFolderPath() { _SetFinalePath(FinPath_MusicDir); }
2273
2280 void SetLibFolderPath() { _SetFinalePath(FinPath_LibDir); }
2281
2288 void SetBackupFolderPath() { _SetFinalePath(FinPath_BackupDir); }
2289
2296 void SetAutoSaveFolderPath() { _SetFinalePath(FinPath_AutoSaveDir); }
2297
2304 void SetTemplateFolderPath() { _SetFinalePath(FinPath_TemplateDir); }
2305
2312 void SetTempFolderPath() { _SetFinalePath(FinPath_TempFilesDir); }
2313
2320 void SetFontAnnotationFolderPath() { _SetFinalePath(FinPath_FontAnnotationDir); }
2321
2328 void SetDocStylesFolderPath() { _SetFinalePath(FinPath_DocStylesDir); }
2329
2338 {
2339 _SetFinalePath(FinPath_PercNoteTypesFile);
2340 Replace("\\\\", "\\");
2341 }
2342
2343#if FXT_VERSION >= FINALEVERSION_2012
2350 void SetPreferencesFolderPath() { _SetFinalePath(FinPath_PreferencesDir); }
2351#endif
2352
2362#ifdef PDK_FRAMEWORK_LUAFRIENDLY
2363 void SetRunningLuaFolderPath(lua_State *L);
2364#else
2366#endif
2367
2380#ifdef PDK_FRAMEWORK_LUAFRIENDLY
2381 void SetRunningLuaFilePath(lua_State *L);
2382#else
2383 void SetRunningLuaFilePath();
2384#endif
2385
2386
2391 void Clear() { SetUnicodeString(emptyUniCharStr); }
2392
2401 int Compare(const FCString& value) const
2402 {
2403 const size_t maxSize = (std::max)(GetLength(), value.GetLength());
2404 return std::char_traits<_fcStringChar>::compare(_pStorage, value._pStorage, maxSize);
2405 }
2406
2411 int CompareNoCase(const FCString& value) const
2412 {
2413 /* Please note!!! For some reason, _stricmp/strcasecmp don't
2414 * work correctly. It seems to hang under certain circumstances
2415 * on both platforms. */
2416 FCString string1, string2;
2417 string1.SetString(this);
2418 string2.SetString(&value);
2419 string1.ToLowerCase();
2420 string2.ToLowerCase();
2421 return string1.Compare(string2);
2422 }
2423
2429 bool ContainsString(const FCString& pSubString) const;
2430
2440 [[deprecated]] bool ContainsCString(const char* pszSubString) const
2441 {
2442 FCString substring;
2443 substring.SetCString(pszSubString);
2444 return ContainsString(substring);
2445 }
2446
2453 bool ContainsStringFrom(const FCString& pSubString, int startindex) const;
2454
2463 [[deprecated]]bool ContainsCStringFrom(const char* pszSubString, int startindex) const
2464 {
2465 FCString substring;
2466 substring.SetCString(pszSubString);
2467 return ContainsStringFrom(substring, startindex);
2468 }
2469
2476 int CalcStringPos(const FCString& subString) const
2477 {
2478 /* This method can't be size_t, since it must be able to return -1! */
2479 return CalcStringPosFrom(subString, 0);
2480 }
2481
2488 int CalcLastStringPos(const FCString& subString) const
2489 {
2490 auto pos = _GetBasicStringView().rfind(subString._GetBasicStringView());
2491 if (pos == std::basic_string_view<eUniChar16>::npos)
2492 return -1;
2493 return static_cast<int>(pos);
2494 }
2495
2509 [[deprecated]]int CalcCStringPos([[maybe_unused]]const FCString* pSubString, const char* pszSubString) const
2510 {
2511 /* This method can't return size_t, since it must be able to return -1! */
2512 FCString substring;
2513 substring.SetCString(pszSubString);
2514 return CalcStringPos(substring);
2515 }
2516
2525 int CalcStringPosFrom(const FCString& subString, int startindex) const
2526 {
2527 /* This method can't return size_t, since it must be able to return -1! */
2528 auto pos = _GetBasicStringView().find(subString._GetBasicStringView(), static_cast<size_t>(startindex));
2529 if (pos == std::basic_string_view<eUniChar16>::npos)
2530 return -1;
2531 return static_cast<int>(pos);
2532 }
2533
2545 [[deprecated]]int CalcCStringPosFrom(const char* pszSubString, int startindex) const
2546 {
2547 /* This method can't be size_t, since it must be able to return -1! */
2548 FCString substring;
2549 substring.SetCString(pszSubString);
2550 return CalcStringPosFrom(substring, startindex);
2551 }
2552
2553#if OPERATING_SYSTEM == MAC_OS
2555 void ConvertToPascal(Str255& pascalString);
2556
2558 void _SetCFURLRefPath(CFURLRef cfurl);
2559
2560#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2561 /* For internal use only. Converts a file path to CFURLRef */
2562 CFURLRef _GetPathCFURLRef() const;
2563#endif // DOXYGEN_SHOULD_IGNORE_THIS
2564
2565#endif
2566
2567#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
2575 bool ContainsEnigmaTextInsert(bool only_file_info_inserts = true) const;
2576
2592
2593#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2595 luabridge::RefCountedPtr<FCStrings> CreateEnigmaComponents_GC() const
2596 { return makeLuaSharedPtr(CreateEnigmaComponents()); }
2597#endif
2598
2612 FCStrings* CreateEnigmaStrings(bool include_non_commands = false) const;
2613
2614#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2616 luabridge::RefCountedPtr<FCStrings> CreateEnigmaStrings_GC(bool include_non_commands) const
2617 { return makeLuaSharedPtr(CreateEnigmaStrings(include_non_commands)); }
2618#endif
2619#endif
2620
2630
2631#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2633 luabridge::RefCountedPtr<FCFontInfo> CreateLastFontInfo_GC() const
2634 { return makeLuaSharedPtr(CreateLastFontInfo()); }
2635#endif
2636
2650 FCStrings* CreateParsedStrings(const char* pszSeparators) const;
2651
2652#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2654 luabridge::RefCountedPtr<FCStrings> CreateParsedStrings_GC(const char* pszSeparators) const
2655 { return makeLuaSharedPtr(CreateParsedStrings(pszSeparators)); }
2656#endif
2657
2668 FCStrings* CreateRows() const;
2669
2670#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2672 luabridge::RefCountedPtr<FCStrings> CreateRows_GC() const
2673 { return makeLuaSharedPtr(CreateRows()); }
2674#endif
2675
2687 bool DeleteCodePointAt(int index)
2688 { return DeleteCodePointsAt(index, 1); }
2689
2702 bool DeleteCodePointsAt(int index, int count);
2703
2716 bool DeleteCharacterAt(int index)
2717 { return DeleteCharactersAt(index, 1); }
2718
2731 bool DeleteCharactersAt(int index, int count);
2732
2740 {
2741 int index = (int) GetLength() - 1;
2742 int count = 0;
2743 while (index >= 0)
2744 {
2745 eUniChar16 currentchar = GetCharacterAt(index);
2746 if (currentchar == '.')
2747 {
2748 FCString newstring;
2749 index ++;
2750 while (index < GetLength())
2751 {
2752 newstring.AppendCharacter(GetCharacterAt(index));
2753 index ++;
2754 }
2755 SetString(&newstring);
2756 return;
2757 }
2758 if (currentchar == '/') break;
2759 if (currentchar == '\\') break;
2760 index --;
2761 count ++;
2762 }
2763 Clear();
2764 }
2765
2778 int FindFirst(const char* pszSubStr) const
2779 {
2780 twobyte firstchar = *pszSubStr;
2781 if (!firstchar) return -1;
2782 for (int i = 0; i < GetLength(); i++)
2783 {
2784 twobyte character = this->GetCharacterAt(i);
2785 if (character == firstchar)
2786 {
2787 int j = 1;
2788 bool identical = true;
2789 while (pszSubStr[j])
2790 {
2791 twobyte testchar = pszSubStr[j];
2792 if (this->GetCharacterAt(i + j) != testchar)
2793 {
2794 identical = false;
2795 break;
2796 }
2797 j++;
2798 }
2799 if (identical) return i;
2800 }
2801 }
2802 return -1;
2803 }
2804
2817 int FindLast(const char* pszSubStr) const
2818 {
2819 twobyte firstchar = *pszSubStr;
2820 if (!firstchar) return -1;
2821 int substrlength = (int) strlen(pszSubStr);
2822
2823 for (int i = (int) (GetLength() - substrlength); i >= 0; i--)
2824 {
2825 twobyte character = this->GetCharacterAt(i);
2826 if (character == firstchar)
2827 {
2828 int j = 1;
2829 bool identical = true;
2830 while (pszSubStr[j])
2831 {
2832 twobyte testchar = pszSubStr[j];
2833 if (this->GetCharacterAt(i + j) != testchar)
2834 {
2835 identical = false;
2836 break;
2837 }
2838 j++;
2839 }
2840 if (identical) return i;
2841 }
2842 }
2843 return -1;
2844 }
2845
2846
2847#ifdef PDK_FRAMEWORK_FORMAT
2860 int FormatCStringArgs(const char *fmt, va_list args);
2861
2871 int FormatCString(const char *fmt, ...);
2872
2885 int FormatString(FCString *fmt, ...);
2886#endif
2887
2897 void FormatCharacterNumber(eUniChar32 character);
2898
2905 const char* GetCString() const;
2906
2915 const char* GetLuaString() const; // the Lua connector uses _CFunctionProxyGetter with this function
2916
2917#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2919 static int GetLuaString_CFunc(lua_State *L)
2920 {
2921 return _CFunctionProxyGetter<FCString, const char *, &FCString::GetLuaString>(L);
2922 }
2923#endif
2924
2926 const char* GetUTF8String() const;
2927
2938 bool CopyToUnicodeBuffer(eUniChar16 *pBuffer, int maxbufferlen = 0) const;
2939
2940#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2942 UTRANSID _StartFinaleEdit() const;
2943
2944 /* \brief For internal use only! Returns the internal UTF-16 buffer for the string. */
2945 eUniChar16* _GetUnicodeBuffer() const;
2946#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
2947
2948#if OPERATING_SYSTEM == MAC_OS
2956 void* GetNSString() const;
2957
2959 void SetNSString(void* pNSString);
2960#endif
2961
2971 int GetInteger(int index = 0) const;
2972
2973#ifdef PDK_FRAMEWORK_LUAFRIENDLY
2974 static int GetInteger_CFunc(lua_State* L)
2975 {
2976 return _CFunctionOneOptionalParameter<FCString, int, int, &FCString::GetInteger>(L, 0);
2977 }
2978#endif
2979
2987 int GetHex() const;
2988
3000 double GetFloat(int index = 0) const;
3001
3021 eUniChar16 GetCharacterAt(int index) const;
3022
3036 std::pair<eUniChar32, int> GetCodePointAt(int index) const;
3037
3038#ifdef PDK_FRAMEWORK_LUAFRIENDLY
3039 static int GetCodePointAt_CFunc(lua_State* L)
3040 {
3041 // argument 1 is `this`
3042 const FCString& selfStr = luabridge::Stack<const FCString&>::get(L, 1) LB3(.value());
3043 int index = luabridge::Stack<int>::get(L, 2) LB3(.value());
3044 auto [codepoint, nextIndex] = selfStr.GetCodePointAt(index);
3045 luabridge::Stack<eUniChar32>::push(L, codepoint) LB3(.throw_on_error());
3046 luabridge::Stack<int>::push(L, nextIndex) LB3(.throw_on_error());
3047 return 2;
3048 }
3049#endif
3050
3055 int GetLength() const { return _length; }
3056
3065 const char* GetEOL() const;
3066
3077 [[deprecated]]void Insert(const char* pszString, int insertindex = 0);
3078
3090 void InsertString(const FCString* pString, int insertindex = 0);
3091
3099 bool IsDigit(int index) const;
3100
3106 bool IsAllDigits() const;
3107
3120 bool IsNumber() const;
3121
3127 [[deprecated]]bool IsEqualCString(const char* pszString) const;
3128
3135 bool IsEqual(const char* pszString) const { return IsEqualString(pszString); }
3136
3142 bool IsEqualString(const FCString& value) const { return value == *this; };
3143
3157 bool IsCharacter(int index, eUniChar32 character) const;
3158
3173 bool IsCharacters(int index, const char *pChars) const;
3174
3179 bool IsEmpty() const { return (GetLength() == 0); }
3180
3188 bool IsWhitespace(int index) const;
3189
3190#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3195 bool IsEnigmaCommand() const
3196 {
3197 if (!IsCharacters(0, "^")) return false;
3198 if (IsCharacters(1, "^")) return false;
3199 return true;
3200 }
3201
3206 bool IsEnigmaFont() const;
3207
3212 bool IsEnigmaFileInfoTitle() const;
3213
3218 bool IsEnigmaFileInfoSubtitle() const;
3219
3224 bool IsEnigmaFileInfoComposer() const;
3225
3230 bool IsEnigmaFileInfoArranger() const;
3231
3236 bool IsEnigmaFileInfoLyricist() const;
3237
3242 bool IsEnigmaFileInfoCopyright() const;
3243
3248 bool IsEnigmaTextInsert(bool only_file_info_inserts = true) const;
3249#endif
3250
3251#if OPERATING_SYSTEM == WINDOWS
3262 bool LoadResource(int resourceID, HINSTANCE dllinstance = 0);
3263#endif
3264#if OPERATING_SYSTEM == MAC_OS
3284 bool LoadResource(const char* resourceID,
3285 const char* pszResourceFileName = NULL,
3286 const char* pszTableName = NULL);
3287#endif
3288
3289#if OPERATING_SYSTEM == WINDOWS
3303 static int LoadIntegerResource(int resourceID, int defaultValue, HINSTANCE dllinstance = 0);
3304#endif
3305#if OPERATING_SYSTEM == MAC_OS
3328 static int LoadIntegerResource(const char* resourceID,
3329 int defaultValue,
3330 const char* pszResourceFileName = NULL,
3331 const char* pszTableName = NULL);
3332#endif
3333
3360 bool MakeSubString(int startindex, int substringlength, FCString* pDestinationString); // no `const` because pDestinationString can be this
3361
3362#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3391 bool ReplaceCategoryFonts(FCCategoryDef* pCategoryDef, int fontmode, bool replacefonttag);
3392#endif
3393
3394
3400 void SetCString(const char* pszBuffer, int maxchars = -1);
3401
3402#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3403#if OPERATING_SYSTEM == WINDOWS
3405 void _SetWCHARString(const WCHAR* pCharBuffer);
3406#endif
3407#endif
3408
3416 void SetLuaString(const char* pszBuffer) { SetUTF8String(pszBuffer); }
3417
3418#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3420 static int SetLuaString_CFunc(lua_State *L)
3421 {
3422 return _CFunctionProxySetter<FCString, const char *, &FCString::SetLuaString>(L);
3423 }
3424#endif
3425
3427 void SetUTF8String(const char* pszBuffer);
3428
3447 void SetCharacterAt(int index, eUniChar16 newcharacter);
3448
3456 void SetUnicodeString(const eUniChar16 *pChar, int maxchars = -1);
3457
3462 void SetInteger(int i);
3463
3473 void SetHex(int number, int bitwidth);
3474
3477 void SetFloat(double f);
3478
3479#ifdef PDK_FRAMEWORK_PREFS
3490 void SetMeasurement(double value, twobyte unit);
3491
3502 double GetMeasurement(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) unit) const;
3503#endif /* #ifdef PDK_FRAMEWORK_PREFS */
3504
3511 void SetString(const FCString* pString);
3512
3518
3527 bool SetCharacterUpperCase(int index);
3528
3534 {
3535 time_t now = time(0);
3536 struct tm tstruct;
3537 char buf[80];
3538 tstruct = *localtime(&now);
3539 strftime(buf, sizeof(buf), "%X", &tstruct);
3540 SetCString(buf);
3541 }
3542
3555 bool Replace(const char* pszSource, const char* pszReplacement);
3556
3563 bool EndsWith(const char* pszString) const;
3564
3571 bool EndsWithString(const FCString* pString) const;
3572
3579 bool StartsWith(const char* pszString) const;
3580
3587 bool StartsWithString(const FCString* pString) const;
3588
3590 void ToUnicode(eUniChar16* pBuffer, int maxsize) const
3591 {
3592 int len = GetLength();
3593 if (len > maxsize - 1) len = maxsize - 1;
3594 for (int i = 0; i < len; i++) pBuffer[i] = GetCharacterAt(i);
3595 pBuffer[len] = 0;
3596 }
3597
3604 void ToLowerCase();
3605
3612 void ToUpperCase();
3613
3614#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3622 bool TrimEnigmaTags();
3623#endif
3624
3625#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3642 bool TrimEnigmaFontTags();
3643#endif
3644
3651 void TrimWhitespace();
3652
3659 void TrimLinefeed();
3660
3661
3670 bool TruncateAt(int newlength)
3671 {
3672 if (newlength < 0 || newlength >= GetLength()) return false;
3673 _length = newlength;
3674 _pStorage[_length] = 0; /* Make sure there's a NULL termination in the unicode buffer */
3675 return true;
3676 }
3677
3686 bool TruncateEnd(int count)
3687 {
3688 if (count < 1) return false;
3689 return TruncateAt(GetLength() - count);
3690 }
3691
3697 void TruncateWidth(int maxlength, int prefixchars)
3698 {
3699 if (_length <= maxlength) return;
3700 if (prefixchars + 3 > maxlength) return;
3701 if (prefixchars < -1) return;
3702 FCString resultstring;
3703 for (int i = 0; i < prefixchars; i++)
3704 {
3705 resultstring.AppendCharacter(this->GetCharacterAt(i));
3706 }
3707 resultstring.AppendCString("...");
3708 int startindex = _length - maxlength + prefixchars + 3;
3709 for (int i = startindex; i < _length; i++)
3710 {
3711 resultstring.AppendCharacter(this->GetCharacterAt((int) i));
3712 }
3713 this->SetString(&resultstring);
3714 }
3715
3716#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3721 static EVERSION _GetFinPathVersion();
3722
3729 bool MakeSpecFromFilePath(void *pFinPathSpec, EVERSION convertversion) const;
3730
3737 bool MakeFullFilePath(const void* pFinPathSpec, EVERSION convertversion);
3738
3739#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
3740
3741#ifdef PDK_FRAMEWORK_DEBUG
3742 void DebugDump() override
3743 {
3745 DebugOutInt("Length: ", (int) _length);
3746 DebugOutInt("Storage length: ", (int) _storagelength);
3747 DebugOutPtr("_pStorage: ", _pStorage);
3748 DebugOutString("String contents: ", GetCString());
3749 }
3750#endif
3751
3752};
3753
3754
3755
3761{
3762 FCString _keystring;
3763 FCString _valuestring;
3764public:
3765 const char* ClassName() const override { return "FCSettingsPair"; }
3766
3773 FCSettingsPair(FCString* pLeftString, FCString* pRightString) : __FCBase()
3774 {
3775 _keystring.SetString(pLeftString);
3776 _keystring.TrimWhitespace();
3777 _valuestring.SetString(pRightString);
3778 _valuestring.TrimWhitespace();
3779 }
3780
3782 FCString* GetKeyString() { return &_keystring; }
3783
3785 FCString* GetValueString() { return &_valuestring; }
3786
3788 void SetValueString(FCString* pString) { _valuestring.SetString(pString); }
3789#ifdef PDK_FRAMEWORK_DEBUG
3790 void DebugDump() override
3791 {
3793 DebugOutString("Key: ", GetKeyString());
3794 DebugOutString("Value: ", GetValueString());
3795 }
3796#endif
3797};
3798
3799
3800#ifdef PDK_FRAMEWORK_ENTRIES
3801class FCNoteEntry;
3802#endif
3803
3804class FCCell;
3805
3817{
3818 bool _loaded;
3819
3820 EMeasureMetrics2009a _metrics;
3821
3822 // This value remains global because it is a global condition in Finale. Whichever concurrently
3823 // running script sets it, the next internal call to metrics will rebuild them.
3824 static bool _metricsshouldupdate;
3825
3826public:
3827 const char* ClassName() const override { return "FCCellMetrics"; }
3828
3835 {
3836 memset(&_metrics, 0, sizeof(_metrics));
3837 _loaded = false;
3838 }
3839
3840 virtual ~FCCellMetrics()
3841 {
3842 FreeMetrics();
3843 }
3844
3850 static void MarkMetricsForRebuild() { _metricsshouldupdate = true; }
3851
3860 bool LoadAtCell(FCCell* pCell);
3861
3862#ifdef PDK_FRAMEWORK_ENTRIES
3868 bool LoadAtEntry(FCNoteEntry* pEntry);
3869#endif
3870
3878 {
3879 return _metrics.measMetrics.horzPercent;
3880 }
3881
3892 Evpu32 GetTopStafflinePos() const
3893 {
3894 return _metrics.measMetrics.fipTopStaffLine;
3895 }
3896
3908 {
3909 return _metrics.measMetrics.fipBottom;
3910 }
3911
3919 Evpu32 GetReferenceLinePos() const
3920 {
3921 return _metrics.measMetrics.fipTop;
3922 }
3923
3928 Int100 GetStaffScaling() const
3929 {
3930 return _metrics.measMetrics.lperc;
3931 }
3932
3937 Int100 GetSystemScaling() const
3938 {
3939 return _metrics.measMetrics.percent;
3940 }
3941
3948 {
3949 return _metrics.attachCount;
3950 }
3951
3958 {
3959 return _metrics.measMetrics.meposadj;
3960 }
3961
3968 int GetLeftEdge() const
3969 {
3970 return _metrics.leftEdge;
3971 }
3972
3977 int GetWidth() const
3978 {
3979 return _metrics.measMetrics.mewidth;
3980 }
3981
3986 int GetMusicWidth() const
3987 {
3988 return _metrics.measMetrics.scalewidth;
3989 }
3990
3996 {
3997 return _metrics.measMetrics.frontRepWidth;
3998 }
3999
4005 {
4006 return _metrics.measMetrics.backRepWidth;
4007 }
4008
4015 {
4016 return _metrics.measMetrics.barWidth;
4017 }
4018
4023 int GetStaffSystem() const
4024 {
4025 return _metrics.measMetrics.ssys;
4026 }
4027
4033 Evpu32 GetSystemTopPos() const
4034 {
4035 return _metrics.measMetrics.ssysTop;
4036 }
4037
4043 Evpu32 GetSlotNumber() const
4044 {
4045 return _metrics.measMetrics.slot;
4046 }
4047
4062 bool GetAttachment(__FCBaseData* pBaseDataObject, fourbyte the_id, EAttachment* pAttachment, bool stop = false)
4063 {
4064 if (_metrics.attachCount == 0) return false;
4065 for (int i = 0; i < _metrics.attachCount; i++)
4066 {
4067 EAttachment* pTest = &_metrics.pAttach[i];
4068 if (pTest->tag != pBaseDataObject->Tag()) continue;
4069 if (pTest->id != the_id) continue;
4070 if (stop)
4071 {
4072 if (!GetBitFlag(pTest->flags, EATTACH_STOP_SHAPE)) continue;
4073 }
4074 memcpy(pAttachment, pTest, sizeof(EAttachment));
4075 return true;
4076 }
4077 return false;
4078 }
4079
4096 void FreeMetrics();
4097
4098#ifdef PDK_FRAMEWORK_DEBUG
4099 void DebugDump() override
4100 {
4102 DebugOutInt("Horizontal stretch: ", GetHorizontalStretch());
4103 }
4104#endif
4105};
4106
4107
4108#ifdef PDK_FRAMEWORK_ENTRIES
4118{
4119 bool _directaccess; /* If true, Load() and FreeMetrics() will not work. The data was copied through _EnableDirectAccessMode(). */
4120 ENTNUM _directaccess_entnum; /* The connected entry ID in direct access mode */
4121
4122 bool _loaded;
4123 EEntryMetrics2009a _metrics2009a;
4124#if FXT_VERSION >= FINALEVERSION_2014
4125 EEntryMetrics2014 _metrics2014;
4126#endif
4127
4128 // This value remains global because it is a global condition in Finale. Whichever concurrently
4129 // running script sets it, the next internal call to metrics will rebuild them.
4130 static bool _updatemetrics;
4131
4133 EVERSION _VersionToUse() const;
4134
4138 EEntryMetrics2009a* _GetBasicMetricsPtr() const
4139 {
4140#if FXT_VERSION >= FINALEVERSION_2014
4141 if (_VersionToUse() == FINALEVERSION_2014)
4142 return (EEntryMetrics2009a*) &_metrics2014;
4143 else
4144#endif
4145 return (EEntryMetrics2009a*) &_metrics2009a;
4146
4147 }
4148public:
4149 const char* ClassName() const override { return "FCEntryMetrics"; }
4150
4156
4157#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4158 /* For internal use only. If this method is used, it should be called immediatelly after the constructor. */
4159 void _EnableDirectAccessMode(EEntryMetrics2014* pMetrics, ENTNUM entrynumber);
4160
4161 /* For internal use only. Only used in direct access mode. */
4162 ENTNUM _GetConnectedEntryNumber() { return _directaccess_entnum; }
4163#endif // DOXYGEN_SHOULD_IGNORE_THIS
4164
4165 virtual ~FCEntryMetrics()
4166 {
4167 FreeMetrics();
4168 }
4169
4175 static void MarkMetricsForRebuild() { _updatemetrics = true; }
4176
4184 bool Load(const FCNoteEntry* pEntry);
4185
4194 int CalcLeftmostNotePosition();
4195
4202 {
4203 return _GetBasicMetricsPtr()->attachCount;
4204 }
4205
4220 bool GetAttachment(__FCBaseData* pBaseDataObject, fourbyte the_id, EAttachment* pAttachment, bool stop = false)
4221 {
4222 if (_GetBasicMetricsPtr()->attachCount == 0) return false;
4223 for (int i = 0; i < _GetBasicMetricsPtr()->attachCount; i++)
4224 {
4225 EAttachment* pTest = &_GetBasicMetricsPtr()->pAttach[i];
4226 if (pTest->tag != pBaseDataObject->Tag()) continue;
4227 if (pTest->id != the_id) continue;
4228 if (stop)
4229 {
4230 if (!GetBitFlag(pTest->flags, EATTACH_STOP_SHAPE)) continue;
4231 }
4232 memcpy(pAttachment, pTest, sizeof(EAttachment));
4233 return true;
4234 }
4235 return false;
4236 }
4237
4238
4243 int GetTopPosition() const
4244 {
4245 if (_GetBasicMetricsPtr()->headRect.top > _GetBasicMetricsPtr()->stemRect.top) return _GetBasicMetricsPtr()->headRect.top;
4246 return _GetBasicMetricsPtr()->stemRect.top;
4247 }
4248
4254 {
4255 if (_GetBasicMetricsPtr()->headRect.bottom < _GetBasicMetricsPtr()->stemRect.bottom) return _GetBasicMetricsPtr()->headRect.bottom;
4256 return _GetBasicMetricsPtr()->stemRect.bottom;
4257 }
4258
4265 {
4266 return _GetBasicMetricsPtr()->stemRect.bottom;
4267 }
4268
4275 {
4276 return _GetBasicMetricsPtr()->stemRect.top;
4277 }
4278
4285 {
4286 return _GetBasicMetricsPtr()->headRect.left;
4287 }
4288
4295 {
4296 return _GetBasicMetricsPtr()->headRect.right;
4297 }
4298
4305 {
4306 return _GetBasicMetricsPtr()->stemRect.left;
4307 }
4308
4315 {
4316 return _GetBasicMetricsPtr()->stemRect.right;
4317 }
4318
4325 {
4326 return _GetBasicMetricsPtr()->lastDot;
4327 }
4328
4336 {
4337 return _GetBasicMetricsPtr()->firstAcci;
4338 }
4339
4342 {
4343 return _GetBasicMetricsPtr()->entryFlags;
4344 }
4345
4347 ENoteMetrics* FindNoteMetrics(twobyte noteID);
4348
4349#if FXT_VERSION >= FINALEVERSION_2014
4351 ENoteMetrics2014* FindNoteMetrics2014(twobyte noteID);
4352#endif
4353
4359 int GetNoteCount() const
4360 {
4361 return _GetBasicMetricsPtr()->numNotes;
4362 }
4363
4375 int GetNoteLeftPosition(int index) const;
4376
4385 int GetNoteWidth(int index) const;
4386
4398 int GetNoteCenterVerticalPos(int index) const;
4399
4408 eNoteID GetNoteID(int index) const;
4409
4414 JWERECT* GetStemRect()
4415 {
4416 if (!_loaded) return NULL;
4417 return &_GetBasicMetricsPtr()->stemRect;
4418 }
4419
4425 {
4426 if (!_loaded) return NULL;
4427 return &_GetBasicMetricsPtr()->headRect;
4428 }
4429
4446 void FreeMetrics();
4447
4448#ifdef PDK_FRAMEWORK_DEBUG
4449 void DebugDump() override
4450 {
4452 }
4453#endif
4454};
4455#endif
4456
4457
4458
4459class FCArticulationDef;
4460
4471{
4472#if FXT_VERSION >= FINALEVERSION_25
4473 ETextMetrics _textMetrics;
4474#endif
4475public:
4476
4483
4506 bool LoadString(const FCString* pText, const FCFontInfo* pFont, float percent);
4507
4522 bool LoadSymbol(eUniChar16 symbolchar, FCFontInfo* pFont, float percent);
4523
4542 bool LoadArticulation(FCArticulationDef* pArticDef, bool flipped, float percent);
4543
4550 void CopyFrom(FCTextMetrics* pTextMetrics);
4551
4566 double GetAdvanceWidthPoints() const {
4567#if FXT_VERSION >= FINALEVERSION_25
4568 return _textMetrics.width;
4569#else
4570 return 0;
4571#endif
4572 }
4573
4585 double GetLeftPoints() const {
4586#if FXT_VERSION >= FINALEVERSION_25
4587 return _textMetrics.left;
4588#else
4589 return 0;
4590#endif
4591 }
4592
4604 double GetRightPoints() const {
4605#if FXT_VERSION >= FINALEVERSION_25
4606 return _textMetrics.right;
4607#else
4608 return 0;
4609#endif
4610 }
4611
4623 double GetTopPoints() const {
4624#if FXT_VERSION >= FINALEVERSION_25
4625 return _textMetrics.top;
4626#else
4627 return 0;
4628#endif
4629 }
4630
4642 double GetBottomPoints() const {
4643#if FXT_VERSION >= FINALEVERSION_25
4644 return _textMetrics.bottom;
4645#else
4646 return 0;
4647#endif
4648 }
4649
4658 double GetAdvanceWidthEVPUs() const {
4659#if FXT_VERSION >= FINALEVERSION_25
4660 return _textMetrics.eWidth;
4661#else
4662 return 0;
4663#endif
4664 }
4665
4673 double GetLeftEVPUs() const {
4674#if FXT_VERSION >= FINALEVERSION_25
4675 return _textMetrics.eLeft;
4676#else
4677 return 0;
4678#endif
4679 }
4680
4688 double GetRightEVPUs() const {
4689#if FXT_VERSION >= FINALEVERSION_25
4690 return _textMetrics.eRight;
4691#else
4692 return 0;
4693#endif
4694 }
4695
4703 double GetTopEVPUs() const {
4704#if FXT_VERSION >= FINALEVERSION_25
4705 return _textMetrics.eTop;
4706#else
4707 return 0;
4708#endif
4709 }
4710
4718 double GetBottomEVPUs() const {
4719#if FXT_VERSION >= FINALEVERSION_25
4720 return _textMetrics.eBottom;
4721#else
4722 return 0;
4723#endif
4724 }
4725
4738#if FXT_VERSION >= FINALEVERSION_25
4739 return GetTopPoints()-GetBottomPoints();
4740#else
4741 return 0;
4742#endif
4743 }
4744
4757#if FXT_VERSION >= FINALEVERSION_25
4758 return GetRightPoints()-GetLeftPoints();
4759#else
4760 return 0;
4761#endif
4762 }
4763
4772#if FXT_VERSION >= FINALEVERSION_25
4773 return GetTopEVPUs()-GetBottomEVPUs();
4774#else
4775 return 0;
4776#endif
4777 }
4778
4787#if FXT_VERSION >= FINALEVERSION_25
4788 return GetRightEVPUs()-GetLeftEVPUs();
4789#else
4790 return 0;
4791#endif
4792 }
4793
4794 const char* ClassName() const override { return "FCTextMetrics"; }
4795
4796#ifdef PDK_FRAMEWORK_DEBUG
4797 void DebugDump() override
4798 {
4800 DebugOutFloat("Advance Width: ", GetAdvanceWidthPoints());
4801 DebugOutFloat("Left: ", GetLeftPoints());
4802 DebugOutFloat("Right: ", GetRightPoints());
4803 DebugOutFloat("Top: ", GetTopPoints());
4804 DebugOutFloat("Bottom: ", GetBottomPoints());
4805
4806 DebugOutFloat("Advance Width EVPU: ", GetAdvanceWidthEVPUs());
4807 DebugOutFloat("Left EVPU: ", GetLeftEVPUs());
4808 DebugOutFloat("Right EVPU: ", GetRightEVPUs());
4809 DebugOutFloat("Top EVPU: ", GetTopEVPUs());
4810 DebugOutFloat("Bottom EVPU: ", GetBottomEVPUs());
4811 }
4812#endif
4813};
4814
4815
4820class FCNumber : public __FCBase
4821{
4822 int _intvalue;
4823 double _floatvalue;
4824 public:
4825 const char* ClassName() const override { return "FCNumber"; }
4826 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_NUMBER; }
4827
4834 FCNumber(double value) : __FCBase()
4835 {
4836 /* A separate int and double curbs precision issues that cause unexpected rounding near integers. */
4837 _intvalue = static_cast<int>(value);
4838 _floatvalue = value;
4839 }
4840
4845 void SetInt(int value)
4846 {
4847 _intvalue = value;
4848 _floatvalue = static_cast<double>(value);
4849 }
4850
4855 void SetFloat(double value)
4856 {
4857 _intvalue = static_cast<int>(value);
4858 _floatvalue = value;
4859 }
4860
4865 int GetInt() const { return _intvalue; }
4866
4871 double GetFloat() const { return _floatvalue; }
4872
4873
4874#ifdef PDK_FRAMEWORK_DEBUG
4875 void DebugDump() override
4876 {
4878 DebugOutFloat("Floating value", _floatvalue);
4879 DebugOutInt("Integer value: ", _intvalue);
4880 }
4881#endif
4882};
4883
4884
4891class FCPoint : public __FCBase
4892{
4893 double _x;
4894 double _y;
4895public:
4896 const char* ClassName() const override { return "FCPoint"; }
4897
4902 FCPoint(double x, double y) : __FCBase(), _x(x), _y(y) {}
4903
4904#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
4909 static int FCPoint_tostring(lua_State* L)
4910 {
4911 FCPoint* pThis = luabridge::Stack<FCPoint*>::get(L, 1) LB3(.value());
4912 FCString strX; strX.SetMeasurement(pThis->GetX(), UNIT_EVPUS);
4913 FCString strY; strY.SetMeasurement(pThis->GetY(), UNIT_EVPUS);
4914 std::string s = std::string(pThis->ClassName()) + ": (" + strX.GetLuaString() + ", " + strY.GetLuaString() + ")";
4915 luabridge::Stack<std::string>::push(L, s).throw_on_error();
4916 return 1;
4917 }
4918#endif
4919
4924 void SetX(double value) { _x = value; }
4925
4930 void SetY(double value) { _y = value; }
4931
4936 double GetX() const { return _x; }
4937
4942 double GetY() const { return _y; }
4943
4948 void MoveX(double value) { _x += value; }
4949
4954 void MoveY(double value) { _y += value; }
4955};
4956
4957
4958
4959class FCDocument;
4960
4969{
4970 FinPrintSettings _settings;
4971public:
4972 const char* ClassName() const override { return "FCPrintSettings"; }
4973
4980 {
4982 PRINTODDEVEN_ALL = 0,
4983
4985 PRINTODDEVEN_ODD = 1,
4986
4988 PRINTODDEVEN_EVEN = 2
4990
4998 {
4999 _settings.copies = 1;
5000 _settings.startPage = 1;
5001 _settings.endPage = 1000;
5002 }
5003
5004 /* Getters */
5005
5010 twobyte GetCopyCount() const { return _settings.copies; }
5011
5016 bool GetColor() const { return _settings.bPrintColor != 0; }
5017
5022 twobyte GetStartPage() const { return _settings.startPage; }
5023
5028 twobyte GetEndPage() const { return _settings.endPage; }
5029
5034 bool GetReverse() const { return _settings.reverse != 0; }
5035
5040 bool GetDrawCropMarks() const { return _settings.cropMarks != 0; }
5041
5046 bool GetDrawRegistrationMarks() const { return _settings.regMarks != 0; }
5047
5052 bool GetDrawFileName() const { return _settings.regFileName != 0; }
5053
5058 bool GetTile() const { return _settings.tile != 0; }
5059
5064 twobyte GetLayoutCount() const { return _settings.nUp; }
5065
5070 Evpu32 GetTileOverlap() const { return _settings.userOverlap; }
5071
5076 bool GetFitWithinMargins() const { return _settings.bFitWithinMargins != 0; }
5077
5084#ifndef PDK_FRAMEWORK_LUAFRIENDLY
5085 PRINTODDEVENMODES
5086#else
5087 twobyte
5088#endif
5089 GetOddEvenMode() const { return (PRINTODDEVENMODES) _settings.oddEven; }
5090
5095 const char* GetPageRangeString() const
5096 {
5097 return _settings.pageRangeString;
5098 }
5099
5100 /* Setters */
5101
5108 void SetCopyCount(twobyte copies)
5109 {
5110 if (copies < 0) return;
5111 if (copies > 100) return;
5112 _settings.copies = copies;
5113 }
5114
5119 void SetColor(bool state) { _settings.bPrintColor = state; }
5120
5125 void SetStartPage(twobyte startpage)
5126 {
5127 if (startpage < 1) return;
5128 _settings.startPage = startpage;
5129 }
5130
5135 void SetEndPage(twobyte endpage)
5136 {
5137 if (endpage < 1) return;
5138 _settings.endPage = endpage;
5139 }
5140
5145 void SetReverse(bool state) { _settings.reverse = state; }
5146
5151 void SetDrawCropMarks(bool state) { _settings.cropMarks = state; }
5152
5157 void SetDrawRegistrationMarks(twobyte state) { _settings.regMarks = state; }
5158
5163 void SetDrawFileName(bool state) { _settings.regFileName = state; }
5164
5169 void SetTile(bool state) { _settings.tile = state; }
5170
5177 void SetLayoutCount(twobyte count)
5178 {
5179 switch (count) {
5180 case 0:
5181 case 1:
5182 case 2:
5183 case 4:
5184 _settings.nUp = count;
5185 break;
5186 default:
5187 break;
5188 }
5189 }
5190
5195 void SetTileOverlap(Evpu32 value)
5196 {
5197 if (value < 0) return;
5198 _settings.userOverlap = value;
5199 }
5200
5205 void SetFitWithinMargins(bool state) { _settings.bFitWithinMargins = state; }
5206
5214#ifndef PDK_FRAMEWORK_LUAFRIENDLY
5216#else
5217 twobyte
5218#endif
5219 value
5220 )
5221 {
5222 switch (value)
5223 {
5224 case PRINTODDEVEN_ALL:
5225 case PRINTODDEVEN_EVEN:
5226 case PRINTODDEVEN_ODD:
5227 _settings.oddEven = value;
5228 break;
5229 default:
5230 break;
5231 }
5232 }
5233
5238 void SetPageRangeString(const char* pszString)
5239 {
5240 if (!pszString) return;
5241 strncpy(_settings.pageRangeString, pszString, sizeof(_settings.pageRangeString));
5242 _settings.pageRangeString[sizeof(_settings.pageRangeString) - 1] = 0;
5243 }
5244
5245
5246 /* Misc methods */
5247
5255 bool PrintCurrent();
5256
5266 bool PrintDocument(FCDocument* pDocument);
5267};
5268
5269
5270
5271
5279{
5280 ufourbyte _glyphnumber; /* The glyph number that should be loaded. */
5281 float _height, _width, _left, _bottom;
5282 float _maxascent, _maxdescent;
5283public:
5286 {
5287 _glyphnumber = 0;
5288 _height = _width = 0;
5289 _left = _bottom = 0;
5290 _maxascent = _maxdescent = 0;
5291 };
5292
5302 bool LoadInfo(FCFontInfo* pFontInfo, ufourbyte glyphno);
5303
5308 void _SetHeight(float h) { _height = h; }
5309
5314 void _SetWidth(float w) { _width = w; }
5315
5320 void _SetLeft(float l) { _left = l; }
5321
5326 void _SetBottom(float b) { _bottom = b; }
5327
5332 void _SetMaxAscent(float b) { _maxascent = b; }
5333
5338 void _SetMaxDescent(float b) { _maxdescent = b; }
5339
5340 /***********/
5341 /* GETTERS */
5342 /***********/
5343
5348 ufourbyte GetGlyphNumber() { return _glyphnumber; }
5349
5354 float GetWidth() { return _width; }
5355
5360 float GetHeight() const { return _height; }
5361
5366 float GetLeft() const { return _left; }
5367
5374 float GetBottom() const { return _bottom; }
5375
5384 float GetRight() const { return _left+_width; }
5385
5395 float GetTop() const { return _bottom+_height; }
5396
5405 float GetMaxAscent() { return _maxascent; }
5406
5415 float GetMaxDescent() { return _maxdescent; }
5416
5417#ifdef PDK_FRAMEWORK_DEBUG
5418 void DebugDump() override
5419 {
5421 DebugOutHex("Glyph Number: ", GetGlyphNumber());
5422 DebugOutFloat("Width: ", GetWidth());
5423 DebugOutFloat("Height: ", GetHeight());
5424 DebugOutFloat("Left: ", GetLeft());
5425 DebugOutFloat("Bottom: ", GetBottom());
5426 DebugOutFloat("Max Ascender: ", GetMaxAscent());
5427 DebugOutFloat("Max Descender: ", GetMaxDescent());
5428 }
5429#endif
5430};
5431
5432
5446{
5447 FCUI* _pUI;
5448 FCFontInfo* _pUserFontInfo;
5449 FCString _samplestring;
5450 bool _usesizes;
5451 bool _usestyles;
5452
5453public:
5454 const char* ClassName() const override { return "FCFontDialog"; }
5455
5465 FCFontDialog(FCUI* pUI, FCFontInfo* pFontInfo) : __FCBase()
5466 {
5467 _pUI = pUI;
5468 _pUserFontInfo = pFontInfo;
5469 _usesizes = true;
5470 _usestyles = true;
5471 }
5472
5473 /* GETTERS */
5474
5481 bool GetUseSizes() const { return _usesizes; }
5482
5489 bool GetUseStyles() const { return _usestyles; }
5490
5499 FCFontInfo* GetFontInfo() const { return _pUserFontInfo; }
5500
5508 {
5509 if (!pString) return;
5510 pString->SetString(&_samplestring);
5511 }
5512
5513 /* SETTERS */
5514
5521 void SetUseSizes(bool state) { _usesizes = state; }
5522
5529 void SetUseStyles(bool state) { _usestyles = state; }
5530
5542 void SetFontInfo(FCFontInfo* pFontInfo) { _pUserFontInfo = pFontInfo; }
5543
5550 void SetSampleString(FCString* pString) { _samplestring.SetString(pString); }
5551
5562 bool Execute();
5563};
5564
5569class FCRange : public __FCBase
5570{
5571private:
5572 int _start;
5573 int _length;
5574
5575public:
5576 const char* ClassName() const override { return "FCRange"; }
5577
5585 FCRange(int start = 0, int length = 0) : __FCBase(), _start(start), _length(length) {}
5586
5587#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
5589 static FCRange* FCRange_Lua(void* ptr, lua_State *L)
5590 {
5591 const int numArgs = lua_gettop(L);
5592 const int start = (numArgs <= 2) ? 0 : luabridge::Stack<int>::get(L, 2) LB3(.value());
5593 const int length = (numArgs <= 3) ? 0 : luabridge::Stack<int>::get(L, 3) LB3(.value());;
5594 return new(ptr) FCRange(start, length);
5595 }
5596#endif
5597
5598#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
5603 static int FCRange_tostring(lua_State* L)
5604 {
5605 FCRange* pThis = luabridge::Stack<FCRange*>::get(L, 1) LB3(.value());
5606 std::string s = std::string(pThis->ClassName()) + ": (" + std::to_string(pThis->GetStart()) + ", " + std::to_string(pThis->GetLength()) + ")";
5607 luabridge::Stack<std::string>::push(L, s).throw_on_error();
5608 return 1;
5609 }
5610#endif
5611
5616 int GetStart() const { return _start; }
5617
5622 int GetLength() const { return _length; }
5623
5629 int GetEnd() const { return _start + _length; }
5630
5635 void SetStart(int val) { _start = val; }
5636
5641 void SetLength(int val) { _length = val; }
5642};
5643
5644#endif /* _FF_BASE_H */
Base class for all data-related classes (that handles Finale data).
Definition ff_base.h:676
virtual twobyte CalcLastInci()
For internal use only!
Definition ff_base.h:755
virtual void Deallocate()
Definition ff_base.h:725
void ClearData()
Definition finaleframework.cpp:895
EXTAG GetCustomTag() const
Returns the custom Enigma tag, if any.
Definition ff_base.h:870
virtual __FCBaseData * CreateObject()=0
Creates a new instance of the object.
void DebugDataByteArrayDump() override
Outputs a memory dump of the data block in the object for debugging purposes, as a C++ byte array.
Definition ff_base.h:1019
void DebugDataOffsetDump(int offset, int size)
For debug mode only. Dumps a data memory block at a specific offset and with a specific size.
Definition finaleframework.cpp:883
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:827
virtual bool LoadFirst()=0
Loads the very first element in the database, if any.
FCNumbers * CreateRawDataDump()
Creates a byte collection with the raw loaded data block for the object (if the object type supports ...
Definition finaleframework.cpp:986
const void * GetDataBlock()
Intended ONLY for the _CloneFrom implementation.
Definition ff_base.h:860
__FCBaseData()
The constructor.
Definition finaleframework.cpp:788
const PDKFRAMEWORK_CLASSID GetClassID() const override=0
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
virtual bool DeepDeleteData()
Deletes data and all data that's connected to the object.
Definition ff_base.h:930
EDataID _dataid
The EdataID for the last loaded/saved object.
Definition ff_base.h:712
virtual bool LoadPrevious()
Loads the previous element in the database, if any.
Definition ff_base.h:961
EDOCID GetConnectedDocID() const
Returns the document ID that was connected to the last load/save of the data.
Definition ff_base.h:787
bool DataIsLoaded() const
Returns true is any data has been loaded into the object.
Definition ff_base.h:770
bool LoadDataBlock()
Loads the data. If the object is of dynamic size, the old memory block is freed and a new is allocate...
Definition finaleframework.cpp:921
void _CloneFrom(__FCBaseData *pSource)
For internal use only. Copies object data (except data block) from another object.
Definition finaleframework.cpp:828
void SetCustomTag(EXTAG tag)
Sets the custom Enigma tag, for classes that support multiple Enigma tags.
Definition ff_base.h:882
void * _datablock
Pointer to the object's data block, the meaning is implementation-specific for each derived subclass.
Definition ff_base.h:695
virtual EVERSION EnigmaVersion() const
The Enigma version for save/load/create/delete operations.
Definition ff_base.h:812
virtual int DataSizeLoad() const =0
Returns the data size for the data structure that should be loaded.
virtual int DataSizeSave() const
Returns the data size for the data structure that should be saved or created.
Definition finaleframework.cpp:916
virtual EXTAG Tag() const =0
The Enigma tag for the derived class.
int _GetLoadedSize() const
Intended ONLY for the _CloneFrom implementation.
Definition ff_base.h:854
__FCBaseData * CreateClone()
Creates an identical copy of an object.
Definition finaleframework.cpp:875
const EDataID * _GetDataID()
Intended ONLY for the _CloneFrom implementation.
Definition ff_base.h:848
virtual bool DeleteData()
Deletes the associated data from Finale's database. Be careful when deleting multiple objects.
Definition finaleframework.cpp:911
virtual bool IsDynamicSize()
Definition ff_base.h:733
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:1006
virtual bool LoadNext()
Loads the next element from the database, if any.
Definition finaleframework.cpp:980
virtual ~__FCBaseData()
Virtual destructor.
Definition finaleframework.cpp:798
bool _heapdatablock
Variable that tells if _datablock is dynamically created on the heap (and should be deleted at object...
Definition ff_base.h:699
virtual void CloneMemoryFrom(__FCBaseData *pSource)
Definition finaleframework.cpp:838
void _TagDocumentID()
For internal use only.
Definition finaleframework.cpp:808
bool RelinkToCurrentView()
Relinks the contents in the current view so that the score and part(s) match.
Definition finaleframework.cpp:857
virtual bool Save()
Saves the currently loaded to its current location.
Definition finaleframework.cpp:951
EDOCID _connecteddocID
The "connected" document ID., which is the document the where the document was loaded (or last saved)...
Definition ff_base.h:691
void DebugDataDump() override
Outputs a memory dump of the data block in the object for debugging purposes.
Definition ff_base.h:1013
bool RelinkToScore()
Relinks all parts to the contents of the score.
Definition finaleframework.cpp:866
virtual bool LoadLast()
Loads the very last element in the database, if any.
Definition ff_base.h:949
bool VerifyConnectedDocID()
Checks that the stored document ID for the data object matches the current document's ID.
Definition finaleframework.cpp:813
virtual void * Allocate()=0
virtual bool Reload()
Refreshes the data for the object, to synch the data with Finale's current data.
Definition finaleframework.cpp:939
int _loadedsize
Loaded size of the data block for a loaded object, in bytes. Since the datablock is implementation-sp...
Definition ff_base.h:708
Base class for the Finale Framework classes.
Definition ff_base.h:71
bool ReadXML_StringAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, FCString *pStringValue)
Helper method to read FCString objects from the XML file, as an attribute to a node.
Definition finaleframework.cpp:749
void DebugMsgString(const char *pszPrefixText, const char *thestring)
Creates a simple Message Box for debug purposes. The text appears with the extra string appearing aft...
Definition finaleframework.cpp:299
void SetUserData2(void *pData)
Sets the additional user data attached to the instance of an object.
Definition ff_base.h:510
bool ReadXML_String(tinyxml2::XMLElement *pParentNode, const char *pszElementName, FCString *pStringValue)
Helper method to read FCString objects from the XML file.
Definition finaleframework.cpp:721
__FCBase()
The constructor.
Definition ff_base.h:278
bool ReadXML_FloatAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, float *pValue)
Helper method to read floating point objects from the XML file, as an attribute to a node.
Definition finaleframework.cpp:773
static void DebugOutString(const char *pszPrefixText, const char *thestring)
Static method that outputs a line for debugging purposes (C string version). The text appears with th...
Definition finaleframework.cpp:436
int GetBitCount(FLAG_32 flag)
Returns the total number of set bits in a 32-bit unsigned int.
Definition finaleframework.cpp:651
static void DebugOutHex(const char *pszPrefixText, int i)
Static method that outputs a line for debugging purposes. The text appears with the extra digit (in h...
Definition finaleframework.cpp:404
bool ReadXML_BoolAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, bool *pValue)
Helper method to read boolean objects from the XML file, as an attribute to a node.
Definition finaleframework.cpp:765
int DebugOutFormat(const char *fmt,...)
Outputs debug text using C style "printf" syntax.
Definition finaleframework.cpp:593
void StoreXML_String(tinyxml2::XMLElement *pParentNode, const char *pszElementName, FCString *pStringValue)
Helper function to store FCString objects in the XML file.
Definition finaleframework.cpp:673
void Set16BitFlag(FLAG_16 *flag, FLAG_16 flagbits, bool state)
Sets a 16 bit flag.
Definition finaleframework.cpp:635
void StoreXML_Integer(tinyxml2::XMLElement *pParentNode, const char *pszElementName, int value)
Helper function to store integer objects in the XML file.
Definition finaleframework.cpp:681
void DebugMsg(const char *pszMsg)
Creates a simple Message Box for debug purposes with just one text string.
Definition finaleframework.cpp:310
PDKFRAMEWORK_CLASSID
Constants for the GetClassID method.
Definition ff_base.h:84
@ FCID_FONTINFO
Definition ff_base.h:123
@ FCID_NUMBER
Definition ff_base.h:158
@ FCID_STRING
Definition ff_base.h:201
void * GetUserData2() const
Gets the additional user data attached to the instance of an object.
Definition ff_base.h:524
static void DebugOutTag(const char *pszPrefixText, EXTAG extag)
Static method that outputs a line for debugging purposes. The text appears with the EXTAG (in text) a...
Definition finaleframework.cpp:350
void SetUserData(void *pData)
Sets the user data attached to the instance of an object.
Definition ff_base.h:503
bool ReadXML_IntegerAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, int *pValue)
Helper method to read integer objects from the XML file, as an attribute to a node.
Definition finaleframework.cpp:757
virtual bool IsIdentical(const __FCBase *pCompareObject) const
Returns true if the data in the passed object is considered to be identical to the current object,...
Definition ff_base.h:539
void StoreXML_BoolAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, bool value)
Helper function to store boolean objects in the XML file, as an attribute to a node.
Definition finaleframework.cpp:711
static void DebugOutInt(const char *pszPrefixText, int i)
Static method that outputs a line for debugging purposes. The text appears with the extra digit (in d...
Definition finaleframework.cpp:335
void Set32BitFlag(FLAG_32 *flag, FLAG_32 flagbits, bool state)
Sets/resets a 32 bit flag, by using a bit mask.
Definition finaleframework.cpp:643
MEASUREMENTUNITS
Constants for Finale's standard measurement units.
Definition ff_base.h:243
@ MEASUREMENTUNIT_EVPUS
Definition ff_base.h:248
@ MEASUREMENTUNIT_CENTIMETERS
Definition ff_base.h:254
@ MEASUREMENTUNIT_DEFAULT
Definition ff_base.h:245
@ MEASUREMENTUNIT_MILLIMETERS
Definition ff_base.h:266
@ MEASUREMENTUNIT_SPACES
Definition ff_base.h:263
@ MEASUREMENTUNIT_POINTS
Definition ff_base.h:257
@ MEASUREMENTUNIT_PICAS
Definition ff_base.h:260
@ MEASUREMENTUNIT_INCHES
Definition ff_base.h:251
bool ReadXML_Bool(tinyxml2::XMLElement *pParentNode, const char *pszElementName, bool *pValue)
Helper method to read boolean objects from the XML file.
Definition finaleframework.cpp:741
static void DebugOut(const char *pszLine)
Static method to output a line of text for debugging purposes.
Definition finaleframework.cpp:526
bool GetBitFlag(FLAG_32 flag, FLAG_32 flagbits) const
Gets a state from flag bits. Returns true if any bit in the mask is set.
Definition ff_base.h:485
void * GetUserData() const
Gets the user data attached to the instance of an object.
Definition ff_base.h:517
void StoreXML_Bool(tinyxml2::XMLElement *pParentNode, const char *pszElementName, bool value)
Helper function to store boolean objects in the XML file.
Definition finaleframework.cpp:691
virtual ~__FCBase()
Virtual destructor, so all inherited classes get the virtual destructor.
Definition ff_base.h:292
void SetSpecific32Bit(FLAG_32 *flag, int bitnumber, bool state)
Sets/resets a single bit in a 32 bit flag, by specifying one specific bit.
Definition finaleframework.cpp:663
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:609
void DebugMsgInt(const char *pszPrefixText, int i)
Creates a simple Message Box for debug purposes. The text appears with the extra digit (in decimal pr...
Definition finaleframework.cpp:277
static void DebugOutFloat(const char *pszPrefixText, double f)
Static method that outputs a line for debugging purposes. The text appears with the extra float value...
Definition finaleframework.cpp:343
static void DebugOutBin(const char *pszPrefixText, int i)
Static method that outputs a line for debugging purposes. The text appears with the extra digit (in b...
Definition finaleframework.cpp:411
virtual bool ReadFromXML(tinyxml2::XMLElement *pParentNode)
Virtual method that is used to read object data.
Definition ff_base.h:663
static void DebugOutPtr(const char *pszPrefixText, void *ptr)
Static method that outputs a line for debugging purposes. The prefix text appears with the extra ptr ...
Definition finaleframework.cpp:319
void StoreXML_FloatAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, float value)
Helper function to store floating point objects in the XML file, as an attribute to a node.
Definition finaleframework.cpp:716
virtual void StoreToXML(tinyxml2::XMLElement *pParentNode)
Virtual method that is used to store an object's data.
Definition ff_base.h:596
static void DebugOutBool(const char *pszPrefixText, bool state)
Static method that outputs a line for debugging purposes. The boolean state appears afterwards as eit...
Definition finaleframework.cpp:451
virtual void DebugDataDump()
Outputs a memory dump of the data block in the object for debugging purposes.
Definition finaleframework.cpp:617
virtual const char * ClassName() const =0
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
void DebugOutMenuInfo(FCUI *pUI, int menuixd_horiz, int menuixd_vert) const
Outputs the menu command info for debugging purposes.
Definition finaleframework.cpp:550
void DebugMsgHex(const char *pszPrefixText, int i)
Creates a simple Message Box for debug purposes. The text appears with the extra digit (as a hexadeci...
Definition finaleframework.cpp:288
static void DebugOutByteArrayBlock(const void *pBuffer, int startoffset, int size)
Static method that outputs a memory block for debugging purposes. Eight bytes per line will appear (a...
Definition finaleframework.cpp:480
bool ReadXML_Integer(tinyxml2::XMLElement *pParentNode, const char *pszElementName, int *pValue)
Helper method to read integer objects from the XML file.
Definition finaleframework.cpp:733
virtual const PDKFRAMEWORK_CLASSID GetClassID() const
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition ff_base.h:228
void StoreXML_StringAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, FCString *pStringValue)
Helper function to store FCString objects in the XML file, as an attribute to a node.
Definition finaleframework.cpp:701
static void DebugOutBlock(const void *pBuffer, int startoffset, int size)
Static method that outputs a memory block for debugging purposes. Eight bytes per line will appear (a...
Definition finaleframework.cpp:458
void StoreXML_IntegerAttribute(tinyxml2::XMLElement *pNode, const char *pszAttributeName, int value)
Helper function to store integer objects in the XML file, as an attribute to a node.
Definition finaleframework.cpp:706
virtual void DebugDataByteArrayDump()
Outputs a memory dump of the data block in the object for debugging purposes, as a C++ byte array.
Definition finaleframework.cpp:624
An inci subrecord class for multi-inci data.
Definition ff_base.h:1096
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:1098
bool Load(CMPER cmper, twobyte inci)
Loads an object from a specific cmper/inci location.
Definition finaleframework.cpp:1006
The class for an articulation definition. On Finale 2012 and above, this class supports the Unicode c...
Definition ff_other.h:12287
Class for a category definition.
Definition ff_other.h:13416
The class that reference a cell (one measure on one staff) in the musical "grid".
Definition ff_cell.h:18
Class that encapsulate the measure metrics info data.
Definition ff_base.h:3817
int GetWidth() const
Returns the total width of the cell, at system scaling.
Definition ff_base.h:3977
int GetMusicStartPos() const
Returns position where the music starts in the cell (after the key/clef/repeats), at system scaling.
Definition ff_base.h:3957
Evpu32 GetSystemTopPos() const
Returns the position of the top of the system. The coordinate is referenced from the bottom of the pa...
Definition ff_base.h:4033
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4099
Evpu32 GetReferenceLinePos() const
Returns the position of the reference line of the staff. The coordinate is referenced from the bottom...
Definition ff_base.h:3919
int GetStaffSystem() const
Returns the staff system number for the cell.
Definition ff_base.h:4023
bool GetAttachment(__FCBaseData *pBaseDataObject, fourbyte the_id, EAttachment *pAttachment, bool stop=false)
Fills a buffer with the attachment data for an element.
Definition ff_base.h:4062
Int100 GetStaffScaling() const
Returns the accumulated staff scaling for the staff, in 100th of a percent.
Definition ff_base.h:3928
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:3827
int GetBackRepeatWidth() const
Returns the width of the back repeat for the cell.
Definition ff_base.h:4004
Evpu32 GetBottomStafflinePos() const
Returns the bottom line position of the staff. The coordinate is referenced from the bottom of the pa...
Definition ff_base.h:3907
int GetAttachmentCount() const
Returns the number of attachments that has info within the metrics data.
Definition ff_base.h:3947
int GetLeftEdge() const
Returns the left position of the cell cell (before the key/clef/repeat), at system scaling.
Definition ff_base.h:3968
Int100 GetSystemScaling() const
Returns the accumulated system scaling, in 100th of a percent.
Definition ff_base.h:3937
Evpu32 GetTopStafflinePos() const
Returns the top line position of the staff. The coordinate is referenced from the bottom of the page.
Definition ff_base.h:3892
int GetRightBarlineWidth() const
Returns the combined total width of the right barline, including double or final barlines and the gap...
Definition ff_base.h:4014
int GetFrontRepeatWidth() const
Returns the width of the front repeat for the cell.
Definition ff_base.h:3995
Evpu32 GetSlotNumber() const
Returns the 1-based slot number within its system for the cell's staff. Subtract 1 to get an index to...
Definition ff_base.h:4043
static void MarkMetricsForRebuild()
Static method that sets the flag that the metrics should be rebuilt on the next load.
Definition ff_base.h:3850
int GetMusicWidth() const
Returns the width of the music part of the cell, at system percent.
Definition ff_base.h:3986
FCCellMetrics()
The constructor. Defaults to unloaded. Metrics must be loaded with LoadAtCell or LoadAtEntry.
Definition ff_base.h:3834
Int100 GetHorizontalStretch() const
Returns the horizontal stretch of the staff system, in 100th of a percent.
Definition ff_base.h:3877
Class for an opened Finale document. An opened Finale document has a 1-based ID and can be displayed ...
Definition ff_documents.h:28
Class that specifies Enigma text style. This includes font, size, efx, superscript,...
Definition ff_base.h:1757
const PDKFRAMEWORK_CLASSID GetClassID() const override
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition ff_base.h:1766
void SetBaselineShift(Evpu32 value)
Returns the baseline shift in evpus. This value does not affect layout.
Definition ff_base.h:1843
void SetSuperscript(Evpu32 value)
Returns the superscript value. This value may affect layout. Negative values are subscripts.
Definition ff_base.h:1849
void SetInterletterSpacing(fourbyte value)
Sets the inter-letter spacing value in 1/1000 of an EM units.
Definition ff_base.h:1837
fourbyte GetInterletterSpacing() const
Returns the inter-letter spacing value in 1/1000 of an EM units.
Definition ff_base.h:1819
FCEnigmaTextStyle()
The constructor.
Definition ff_base.h:1780
Evpu32 GetSuperscript() const
Returns the superscript value. This value may affect layout. Negative values are subscripts.
Definition ff_base.h:1831
Evpu32 GetBaselineShift() const
Returns the baseline shift in evpus. This value does not affect layout.
Definition ff_base.h:1825
FCFontInfo * GetFont()
Returns the font. This is a pointer into the current instance of FCEnigmaTextStyle,...
Definition ff_base.h:1808
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:1765
FCEnigmaTextStyle(const FCFontInfo &font)
Constructor with font info.
Definition ff_base.h:1786
Class that encapsulate the entry metrics data.
Definition ff_base.h:4118
JWERECT * GetStemRect()
Returns a pointer to the stem rectangle in the metrics data.
Definition ff_base.h:4414
int GetTopPosition() const
Returns the highest position for the noteheads or stem.
Definition ff_base.h:4243
JWERECT * GetNoteheadRect()
Returns a pointer to the notehead rectangle in the metrics data.
Definition ff_base.h:4424
int GetLastDotPosition() const
Returns the horizontal position of rightmost augmentation dot.
Definition ff_base.h:4324
int GetRightPosition() const
Returns the right-side position for the noteheads or stem.
Definition ff_base.h:4294
int GetFirstAccidentalPosition() const
Returns the the left most edge of the accidental rectangle for all accidentals on the entry.
Definition ff_base.h:4335
int GetStemTopPosition() const
Returns the bottom position for the stem.
Definition ff_base.h:4274
int GetStemLeftPosition() const
Returns the left-side position for the stem.
Definition ff_base.h:4304
int GetStemBottomPosition() const
Returns the bottom position for the stem.
Definition ff_base.h:4264
int GetStemRightPosition() const
Returns the right-side position for the stem.
Definition ff_base.h:4314
int GetAttachmentCount() const
Returns the number of attachments that have info within the metrics data.
Definition ff_base.h:4201
int GetLeftPosition() const
Returns the left-side position for the noteheads or stem.
Definition ff_base.h:4284
int GetNoteCount() const
Returns the number of notes that the metrics data has information about.
Definition ff_base.h:4359
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4449
static void MarkMetricsForRebuild()
Static method that sets the refresh flag, so the next Load call will rebuild the metrics data.
Definition ff_base.h:4175
FLAG_32 GetEntryFlags()
Return the metrics entry flags.
Definition ff_base.h:4341
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:4149
int GetBottomPosition() const
Returns the lowest position for the noteheads or stem.
Definition ff_base.h:4253
bool GetAttachment(__FCBaseData *pBaseDataObject, fourbyte the_id, EAttachment *pAttachment, bool stop=false)
Fills a buffer with the attachment data for an note-attached element.
Definition ff_base.h:4220
Class to display the font selection dialog box to the user.
Definition ff_base.h:5446
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:5454
FCFontInfo * GetFontInfo() const
Gets the transfer object that should be used in the dialog. The object is used for both the input and...
Definition ff_base.h:5499
bool GetUseStyles() const
Returns if font styles should be selectable in the dialog box.
Definition ff_base.h:5489
void SetSampleString(FCString *pString)
Sets the sample string, that should be used to demo the apparence of the font selection.
Definition ff_base.h:5550
void GetSampleString(FCString *pString)
Gets the sample string, that is used to demo the apparence of the font selection.
Definition ff_base.h:5507
void SetUseStyles(bool state)
Sets if font styles (such as bold, underline, etc) should be selectable in the dialog box.
Definition ff_base.h:5529
void SetFontInfo(FCFontInfo *pFontInfo)
Sets the transfer object (of the FCFontInfo class). This is used for both font input and output in th...
Definition ff_base.h:5542
void SetUseSizes(bool state)
Sets if font sizes should be selectable in the dialog box.
Definition ff_base.h:5521
bool GetUseSizes() const
Returns if font sizes should be selectable in the dialog box.
Definition ff_base.h:5481
FCFontDialog(FCUI *pUI, FCFontInfo *pFontInfo)
The constructor.
Definition ff_base.h:5465
Class for document-independent font information.
Definition ff_base.h:1138
double CalcAverageRomanCharacterWidthPoints() const
Calculates the average width of the roman characters in the font in points.
Definition ff_base.h:1738
double CalcAverageRomanCharacterWidthEVPUs() const
Calculates the average width of the roman characters in the font in EVPUs.
Definition finaleframework.cpp:3723
void CopyFrom(const FCFontInfo *pInfo)
Copies data from another font info object.
Definition finaleframework.cpp:3394
bool GetBold() const
Returns true if the font style is boldface.
Definition ff_base.h:1640
bool IsName(const char *pszTestName) const
Checks if the font name is a perfect match to the C-string test string.
Definition finaleframework.cpp:3664
bool MakeDefaultMusicFont()
Changes the document's default music font to match this instance of FCFontInfo and modifies this inst...
Definition finaleframework.cpp:3713
void SetAbsolute(bool state)
Sets the absolute (fixed font) size state of the font info.
Definition ff_base.h:1562
bool MakeEnigmaString(FCString *pString, FCString *pFontTagString=NULL)
Creates an Enigma string (for use in raw strings) based on the current font information.
Definition finaleframework.cpp:3423
bool ParseEnigmaCommand(FCString *pString)
Parses a valid Enigma font command and changes the font information accordingly.
Definition finaleframework.cpp:3488
bool SaveFontPrefs(int prefsID)
Saves the font information to any of the preference fonts.
Definition finaleframework.cpp:3413
void ParseEnigmaFont(const EEnigmaFont *pEnigmaFont)
Transfers the info from a Finale-internal font structure to the FCFontInfo object.
Definition ff_base.h:1456
FCString * CreateDescription() const
Definition finaleframework.cpp:3580
double GetSizeFloat() const
Returns the font size as a floating point (with decimal digits).
Definition ff_base.h:1297
bool IsMacSymbolFont() const
returns true i the font is a Mac Symbol font.
Definition finaleframework.cpp:3685
void SetBold(bool state)
Sets the boldface attribute of the font info.
Definition ff_base.h:1578
void SetItalic(bool state)
Sets the italics attribute of the font info.
Definition ff_base.h:1594
FCFontInfo * CreateCopy()
Creates a copy of the font info object on the heap.
Definition ff_base.h:1247
void SetNameByID(EFONTID id)
Sets the font name by using the document's internal Enigma font ID.
Definition finaleframework.cpp:3650
void SetName(const std::string &pszName)
Sets the font name.
Definition finaleframework.cpp:3634
void SetSize(int fontsize)
Sets the font size as an integer value.
Definition ff_base.h:1546
FLAG_16 GetEnigmaStyles() const
Gets the font style as standard Enigma bit storage.
Definition ff_base.h:1358
void SetPlain()
Clears the styles so the font doesn't use any style.
Definition ff_base.h:1608
void SetStrikeOut(bool state)
Sets the strikeout state of the font info.
Definition ff_base.h:1570
void SetUnderline(bool state)
Sets the underline attribute of the font info.
Definition ff_base.h:1602
int GetSize() const
Returns the font size as an integer number.
Definition ff_base.h:1289
EFONTID GetFontID() const
Gets the internal document-specific font ID. It may not yet have been assigned a value,...
Definition ff_base.h:1511
bool GetHidden() const
Returns true if the font style is hidden (don't print).
Definition ff_base.h:1670
FCString * CreateEnigmaString(FCString *pFontTagString=NULL)
Returns a created FCString object that contains the font information as an Enigma string.
Definition finaleframework.cpp:3455
static fourbyte GetSystemTextEncoding()
Returns the internal Engima encoding number for the running Finale version. This value is appended to...
Definition finaleframework.cpp:3389
void SetSizeFloat(double fontsize)
Sets the font size as a floating point (with decimal digits) value.
Definition ff_base.h:1554
void MakeEnigmaStyleString(FCString *pString)
Makes an Enigma string (for use in raw strings) based on only the current font style information.
Definition finaleframework.cpp:3465
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:3739
FCFontInfo()
Default constructor. This constructor does not add the font to the current document....
Definition finaleframework.cpp:3341
void SetHidden(bool state)
Sets the hidden state of the font info.
Definition ff_base.h:1586
bool IsPlain()
Returns true if the font has no special style flags.
Definition ff_base.h:1634
void SetFontID(EFONTID fontID)
Sets the internal document-specific font ID.
Definition ff_base.h:1525
bool GetIsSMuFLFont() const
Returns true if the font is a SMuFL font.
Definition ff_base.h:1679
const PDKFRAMEWORK_CLASSID GetClassID() const override
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition ff_base.h:1157
bool LoadFontPrefs(int prefsID)
Sets the font information to any of the preference fonts.
Definition finaleframework.cpp:3405
ENIGMASTYLES
Constants for enigma styles. These are bit-sensitve values that can be combined with bitwise-or.
Definition ff_base.h:1165
@ ENIGMASTYLE_STRIKEOUT
Definition ff_base.h:1179
@ ENIGMASTYLE_BOLD
Definition ff_base.h:1170
@ ENIGMASTYLE_HIDDEN
Definition ff_base.h:1185
@ ENIGMASTYLE_PLAIN
Definition ff_base.h:1167
@ ENIGMASTYLE_UNDERLINE
Definition ff_base.h:1176
@ ENIGMASTYLE_ABSOLUTE
Definition ff_base.h:1182
@ ENIGMASTYLE_ITALIC
Definition ff_base.h:1173
bool IsIdenticalTo(const FCFontInfo &compareWith) const
Returns true if all font information is identical to the compared object.
Definition finaleframework.cpp:3694
bool GetAbsolute() const
Returns true if the font size is absolute.
Definition ff_base.h:1664
void SetNameString(const FCString &value)
Sets the font name (FCString version).
Definition finaleframework.cpp:3639
EFONTID GetNameByID() const
Legacy version of GetIDByName with incorrect name.
Definition ff_base.h:1348
bool IsNameString(const FCString &pTestName) const
Checks if the font name is a perfect match to the test string.
Definition finaleframework.cpp:3678
bool GetStrikeOut() const
Returns true if the font style is strikeout.
Definition ff_base.h:1658
std::string GetName() const
Gets the font name (const C-string version).
Definition finaleframework.cpp:3550
bool GetItalic() const
Returns true if the font style is italic.
Definition ff_base.h:1646
bool GetUnderline() const
Returns true if the font style is underline.
Definition ff_base.h:1652
void GetNameString(FCString *pString) const
Gets the font name and puts it in a FCString object.
Definition finaleframework.cpp:3535
FCString * CreateEnigmaStyleString()
Creates a FCString object and creates the Enigma font style info string, based on only the current fo...
Definition finaleframework.cpp:3481
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:1156
void MakeEnigmaSizeString(FCString *pString)
Makes an Enigma string (for use in raw strings) based on only the current font size information.
Definition finaleframework.cpp:3473
void SetEnigmaStyles(FLAG_16 fontstyles)
Sets the font style as standard Enigma bit storage.
Definition ff_base.h:1469
EFONTID GetIDByName() const
Gets the internal Enigma font ID for the current document by searching for the font name....
Definition finaleframework.cpp:3558
Encapsulates a note entry from an owner class (for example FCNoteEntryCell, FCNoteEntryLayer) class.
Definition ff_noteframe.h:940
Simple class to put numbers into collections.
Definition ff_base.h:4821
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4875
double GetFloat() const
Returns the integer value version of the number.
Definition ff_base.h:4871
int GetInt() const
Returns the integer value version of the number.
Definition ff_base.h:4865
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:4825
FCNumber(double value)
The constructor.
Definition ff_base.h:4834
void SetInt(int value)
Sets the number as an integer.
Definition ff_base.h:4845
void SetFloat(double value)
Sets the number as a float.
Definition ff_base.h:4855
const PDKFRAMEWORK_CLASSID GetClassID() const override
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition ff_base.h:4826
Simple collection class for FCNumber class objects.
Definition ff_basecollection.h:357
Simple class for the representation of x, y coordinates.
Definition ff_base.h:4892
void MoveY(double value)
Moves the y position from the current offset.
Definition ff_base.h:4954
double GetY() const
Returns the y position.
Definition ff_base.h:4942
void SetY(double value)
Sets the y position.
Definition ff_base.h:4930
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:4896
void SetX(double value)
Returns the x position.
Definition ff_base.h:4924
void MoveX(double value)
Moves the x position from the current offset.
Definition ff_base.h:4948
FCPoint(double x, double y)
The constructor.
Definition ff_base.h:4902
double GetX() const
Returns the x position.
Definition ff_base.h:4936
Class containing printing settings (and the ability to print documents).
Definition ff_base.h:4969
void SetPageRangeString(const char *pszString)
Returns the page range string as a C-style string.
Definition ff_base.h:5238
bool GetDrawCropMarks() const
Returns if crop marks should be printed.
Definition ff_base.h:5040
bool GetColor() const
Returns true if color printing should be used.
Definition ff_base.h:5016
bool GetReverse() const
Returns if the pages should be printed in reverse order.
Definition ff_base.h:5034
void SetReverse(bool state)
Sets if the pages should be printed in reverse order.
Definition ff_base.h:5145
twobyte GetStartPage() const
Returns the 1-based start page for printing.
Definition ff_base.h:5022
twobyte GetEndPage() const
Returns the 1-based end page for printing.
Definition ff_base.h:5028
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:4972
void SetFitWithinMargins(bool state)
Sets whether to use the printer margins when fitting a page to print.
Definition ff_base.h:5205
void SetStartPage(twobyte startpage)
Sets the 1-based start page.
Definition ff_base.h:5125
bool GetDrawFileName() const
Returns if the file name should be printed.
Definition ff_base.h:5052
bool GetTile() const
Returns if the document should be tited if bigger than specified page.
Definition ff_base.h:5058
PRINTODDEVENMODES GetOddEvenMode() const
Returns the odd/even printing mode.
Definition ff_base.h:5089
void SetTileOverlap(Evpu32 value)
Sets the user overlap for tiled pages.
Definition ff_base.h:5195
bool GetFitWithinMargins() const
Returns whether to use the printer margins when fitting a page to print.
Definition ff_base.h:5076
void SetEndPage(twobyte endpage)
Sets the 1-based end page.
Definition ff_base.h:5135
bool GetDrawRegistrationMarks() const
Returns if registration marks should be printed.
Definition ff_base.h:5046
void SetDrawFileName(bool state)
Sets if the file name should be printed.
Definition ff_base.h:5163
void SetLayoutCount(twobyte count)
Sets the n-Up layout value. Can be 0, 1, 2, 4.
Definition ff_base.h:5177
const char * GetPageRangeString() const
Returns the page range string as a C-style string.
Definition ff_base.h:5095
PRINTODDEVENMODES
Constants used for printing odd/even pages. Used with the GetOddEvenMode() and SetOddEvenMode() metho...
Definition ff_base.h:4980
FCPrintSettings()
The constructor.
Definition ff_base.h:4997
void SetTile(bool state)
Sets if the document should be tited if bigger than specified page.
Definition ff_base.h:5169
void SetOddEvenMode(PRINTODDEVENMODES value)
Sets the odd/even printing mode.
Definition ff_base.h:5213
void SetColor(bool state)
Sets if color printing should be used.
Definition ff_base.h:5119
twobyte GetLayoutCount() const
Returns the n-Up layout value. Can be 0, 1, 2, 4.
Definition ff_base.h:5064
void SetDrawCropMarks(bool state)
Sets if crop marks should be printed.
Definition ff_base.h:5151
twobyte GetCopyCount() const
Returns the number of copies to print.
Definition ff_base.h:5010
void SetDrawRegistrationMarks(twobyte state)
Sets if registration marks should be printed.
Definition ff_base.h:5157
void SetCopyCount(twobyte copies)
Sets the number of copies to print.
Definition ff_base.h:5108
Evpu32 GetTileOverlap() const
Returns the user overlap for tiled pages.
Definition ff_base.h:5070
Class that encapsulates a range (start, length)
Definition ff_base.h:5570
void SetStart(int val)
Sets the start value.
Definition ff_base.h:5635
int GetStart() const
Returns the start value.
Definition ff_base.h:5616
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:5576
int GetLength() const
Returns the length value.
Definition ff_base.h:5622
FCRange(int start=0, int length=0)
The constructor.
Definition ff_base.h:5585
int GetEnd() const
Returns the end value. The is the index after the end of the range, equal to GetStart + GetLength.
Definition ff_base.h:5629
void SetLength(int val)
Sets the length value.
Definition ff_base.h:5641
Class for storing a "key"+"value" pair of values.
Definition ff_base.h:3761
void SetValueString(FCString *pString)
Sets the "value" string.
Definition ff_base.h:3788
FCSettingsPair(FCString *pLeftString, FCString *pRightString)
The constructor.
Definition ff_base.h:3773
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:3765
FCString * GetValueString()
Returns the "value" string.
Definition ff_base.h:3785
FCString * GetKeyString()
Returns the "key" string.
Definition ff_base.h:3782
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:3790
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1877
void AppendEOL()
Appends a system-specific end-of-line string to the to the FCString object.
Definition ff_base.h:2109
int CalcStringPosFrom(const FCString &subString, int startindex) const
Returns the first position where a substring occurs, from a starting point.
Definition ff_base.h:2525
void AppendCharacter(eUniChar32 character)
Appends a character to the string.
Definition finaleframework.cpp:1825
void AppendLuaString(const char *pOtherString)
Appends a Lua string to the string. This method supports UTF-8.
Definition finaleframework.cpp:1869
void SetLuaString(const char *pszBuffer)
Sets the string, using a Lua string version of the string (as UTF-8).
Definition ff_base.h:3416
int CalcStringPos(const FCString &subString) const
Returns the first position where a substring occurs.
Definition ff_base.h:2476
std::pair< eUniChar32, int > GetCodePointAt(int index) const
Returns the Unicode codepoint at the index position. If the index position points to the high surroga...
Definition finaleframework.cpp:2016
void SetTemplateFolderPath()
Sets the path string to Finale's template folder.
Definition ff_base.h:2304
bool EncodeFromMacRoman()
Re-encodes the string to true Unicode from MacRoman.
Definition finaleframework.cpp:1191
bool SplitToPathAndFile(FCString *pPathPart, FCString *pFilePart) const
Splits a fully qualified file path into path part and file part copies.
Definition ff_base.h:2231
FCStrings * CreateParsedStrings(const char *pszSeparators) const
Creates a collection of strings based on the separator characters. C-style string version.
Definition finaleframework.cpp:2774
void ToLowerCase()
Transforms the string to lower case.
Definition finaleframework.cpp:2859
FCStrings * CreateEnigmaComponents() const
Creates a string collection that consists of the components from an Enigma text command (with correct...
Definition finaleframework.cpp:2630
eUniChar16 GetCharacterAt(int index) const
Returns the character at the index position.
Definition finaleframework.cpp:2008
FCString(const _fcStringChar *pszCString)
Constructor version that takes a the platform UTF16 type as argument.
Definition ff_base.h:2000
void ExtractFileExtension()
Removes everything except the file extension part of a file name.
Definition ff_base.h:2739
FCString * CreateCopy()
Creates a copy of the string object on the heap.
Definition finaleframework.cpp:2411
bool IsEnigmaFileInfoComposer() const
Returns true if the string is an "Composer" Enigma command.
Definition finaleframework.cpp:1637
int GetLength() const
Returns the length of the string.
Definition ff_base.h:3055
FCString(const eUniChar16 *pszCString)
Constructor version that takes a Unicode 16 string as argument.
Definition ff_base.h:1993
int CalcCStringPos(const FCString *pSubString, const char *pszSubString) const
Returns the first position where a substring occurs. C-string version.
Definition ff_base.h:2509
bool EndsWithString(const FCString *pString) const
Returns true if the string ends with the parameter string.
Definition finaleframework.cpp:2916
void SetBackupFolderPath()
Sets the path string to Finale's backup folder.
Definition ff_base.h:2288
bool IsEnigmaCommand() const
Returns true if the string is an Enigma command.
Definition ff_base.h:3195
void TrimWhitespace()
Trims whitespace at both ends of the string.
Definition finaleframework.cpp:1543
static int LoadIntegerResource(const char *resourceID, int defaultValue, const char *pszResourceFileName=NULL, const char *pszTableName=NULL)
Mac version. Static method that loads an integer from a resource string.
bool IsEnigmaFileInfoArranger() const
Returns true if the string is an "Arranger" Enigma command.
Definition finaleframework.cpp:1644
void TrimLinefeed()
Trims linefeed characters at both ends of the string.
Definition finaleframework.cpp:1550
void _SetCFURLRefPath(CFURLRef cfurl)
Definition finaleframework.cpp:1903
FCStrings * CreateEnigmaStrings(bool include_non_commands=false) const
Creates a string collection of every enigma text tag found in the string.
Definition finaleframework.cpp:2703
FCString(const FCString &src)
Copy constructor (required for classes that allocate memory.)
Definition ff_base.h:2026
bool SetCharacterUpperCase(int index)
Sets a specific character to upper case.
Definition finaleframework.cpp:2418
static int LoadIntegerResource(int resourceID, int defaultValue, HINSTANCE dllinstance=0)
Windows version. Static method that loads an integer from a resource string.
Definition finaleframework.cpp:3064
const char * GetEOL() const
Returns the platform-specific end-of-line character(s) as a C-string.
Definition finaleframework.cpp:1704
bool EndsWith(const char *pszString) const
Returns true if the string ends with the parameter string.
Definition finaleframework.cpp:2908
bool SplitAt(int splitpointindex, FCString *pFirstString, FCString *pSecondString, bool includesplitposchar) const
Splits a string into 2 substrings at a specific split point character position.
Definition ff_base.h:2181
bool ContainsStringFrom(const FCString &pSubString, int startindex) const
Returns true if the substring is found within the string from a certain position.
Definition finaleframework.cpp:2952
const char * GetUTF8String() const
Returns a C-string UTF-8 version of the string.
Definition finaleframework.cpp:1376
bool LoadResource(int resourceID, HINSTANCE dllinstance=0)
Windows version. Loads the resource string into the string object.
Definition finaleframework.cpp:2992
void InsertString(const FCString *pString, int insertindex=0)
Inserts a string object to the string at a specified index position.
Definition finaleframework.cpp:1724
bool IsEnigmaFileInfoLyricist() const
Returns true if the string is an "Lyricist" Enigma command.
Definition finaleframework.cpp:1651
bool StartsWith(const char *pszString) const
Returns true if the string starts with the parameter string.
Definition finaleframework.cpp:2842
bool IsEqualCString(const char *pszString) const
Returns true if the string is identical with the parameter. (C-style string version....
Definition finaleframework.cpp:1746
bool IsEnigmaFileInfoCopyright() const
Returns true if the string is an "Copyright" Enigma command.
Definition finaleframework.cpp:1658
void SetUserOptionsPath()
Sets the string to the user options path on the running system.
Definition finaleframework.cpp:1931
bool CopyToUnicodeBuffer(eUniChar16 *pBuffer, int maxbufferlen=0) const
Copies the string to a 16-bit Unicode buffer. The buffer must be big enough to have room for an endin...
Definition finaleframework.cpp:1297
void SetCString(const char *pszBuffer, int maxchars=-1)
Sets the string, using a C-string version of the string.
Definition finaleframework.cpp:1234
double GetMeasurement(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) unit) const
Converts the string to an EVPU measurement value, based on a specific unit.
Definition finaleframework.cpp:2328
void SetPercussionTypesFilePath()
Sets the full path string to Finale's percussion note types text file. This file should NEVER be modi...
Definition ff_base.h:2337
FCString(const char *pszCString)
Constructor version that takes a C string (Lua string) as argument. The C string can be encoded eithe...
Definition ff_base.h:1986
void AppendFloat(double value)
Appends an floating-point value to the string.
Definition finaleframework.cpp:1884
bool IsEnigmaFont() const
Returns true if the string is an Enigma font command.
Definition finaleframework.cpp:1601
void SetMusicFolderPath()
Sets the path string to Finale's music folder.
Definition ff_base.h:2272
int GetInteger(int index=0) const
Converts the decimal string contents to an integer value.
Definition finaleframework.cpp:2056
void * GetNSString() const
Returns a NSString* version of the string (on Cocoa only).
Definition finaleframework.cpp:2044
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:3742
void SetPreferencesFolderPath()
Sets the path string to Finale's preference folder.
Definition ff_base.h:2350
FCString()
The constructor. Defaults to an empty string.
Definition ff_base.h:1975
const PDKFRAMEWORK_CLASSID GetClassID() const override
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition ff_base.h:1961
void SetCurrentTime()
Set the string to the current time in hh:mm:ss format.
Definition ff_base.h:3533
bool ContainsString(const FCString &pSubString) const
Returns true if the substring is found within the string.
Definition finaleframework.cpp:2947
void SetLibFolderPath()
Sets the path string to Finale's library folder.
Definition ff_base.h:2280
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:1960
int FormatString(FCString *fmt,...)
Formats a string using the same syntax and manner as the printf() function in C. The version of the m...
Definition finaleframework.cpp:1097
bool LoadResource(const char *resourceID, const char *pszResourceFileName=NULL, const char *pszTableName=NULL)
Mac version. Loads the resource string into the string object.
void SetFloat(double f)
Sets the string to a floating point value.
Definition finaleframework.cpp:2154
const char * GetCString() const
Returns a C-string version of the string.
Definition finaleframework.cpp:1338
void SetRunningLuaFilePath()
Sets the string to the folder for the running script file. The string is cleared if the script is run...
Definition finaleframework.cpp:1998
void SetHex(int number, int bitwidth)
Sets the string to a lower-case hexadecimal number.
Definition finaleframework.cpp:2108
bool IsEnigmaFileInfoTitle() const
Returns true if the string is an "Title" Enigma command.
Definition finaleframework.cpp:1623
void SetNSString(void *pNSString)
Sets the string to a NSString* value.
Definition finaleframework.cpp:2050
bool ContainsCStringFrom(const char *pszSubString, int startindex) const
Returns true if the substring is found from a certain position within the string.
Definition ff_base.h:2463
void AppendString(const FCString *pOtherString)
Appends another string object to the string.
Definition finaleframework.cpp:1849
void SetTempFolderPath()
Sets the path string to Finale's temp folder (for temporary files).
Definition ff_base.h:2312
void SetInteger(int i)
Sets the string to an integer.
Definition finaleframework.cpp:2141
void ToUnicode(eUniChar16 *pBuffer, int maxsize) const
Copies the string to a 16-bit Unicode string buffer.
Definition ff_base.h:3590
void SetDocStylesFolderPath()
Sets the path string to Finale's document styles folder.
Definition ff_base.h:2328
int CompareNoCase(const FCString &value) const
Case insensitive version of Compare.
Definition ff_base.h:2411
void FormatCharacterNumber(eUniChar32 character)
Formats a 16-bit character (symbol) number to a string for presentation purposes.
Definition finaleframework.cpp:1357
bool IsCharacters(int index, const char *pChars) const
Returns true if the character at the index matches any of the supplied character.
Definition finaleframework.cpp:1763
void ConvertToPascal(Str255 &pascalString)
Converts the string contents to a Str255 pascal string.
Definition finaleframework.cpp:1892
bool IsNumber() const
Returns true if the string is a number.
Definition finaleframework.cpp:1575
bool EncodeToMacRoman()
Re-encodes the string from true Unicode to faux MacRoman.
Definition finaleframework.cpp:1212
void SetAutoSaveFolderPath()
Sets the path string to Finale's auto-save folder.
Definition ff_base.h:2296
double GetFloat(int index=0) const
Converts the decimal string contents to a floating point value.
Definition finaleframework.cpp:2131
void SetString(const FCString *pString)
Copies a string.
Definition finaleframework.cpp:2398
void SetRunningLuaFolderPath()
Sets the string to the folder for the running script file. The string is cleared if the script is run...
Definition finaleframework.cpp:1987
void SetUTF8String(const char *pszBuffer)
Sets the string, using a UTF8 C-style string.
Definition finaleframework.cpp:1257
bool ReplaceCategoryFonts(FCCategoryDef *pCategoryDef, int fontmode, bool replacefonttag)
Parses the raw string and changes all text tags according to a category definition.
Definition finaleframework.cpp:2502
bool TruncateAt(int newlength)
Truncates the string at the indicated position.
Definition ff_base.h:3670
int FormatCString(const char *fmt,...)
Formats a string using the same syntax and manner as the printf() function in C. The version of the m...
Definition finaleframework.cpp:1088
bool ContainsEnigmaTextInsert(bool only_file_info_inserts=true) const
Returns true if the text block contains a text insert.
Definition finaleframework.cpp:2973
bool IsDigit(int index) const
Returns true if the character at the specified 0-based index position is a digit (0 through 9).
Definition finaleframework.cpp:1556
void Clear()
Creates an empty string.
Definition ff_base.h:2391
void SetUserPath()
Sets the string to the user path on the running system.
Definition finaleframework.cpp:1916
int Compare(const FCString &value) const
Compares string against another string.
Definition ff_base.h:2401
bool IsAllDigits() const
Returns true if all characters in the string are digits (0 through 9).
Definition finaleframework.cpp:1565
int GetHex() const
Converts the unsigned hexadecimal string to an integer value. The string can only contain valid hexad...
Definition finaleframework.cpp:2063
int FindLast(const char *pszSubStr) const
Returns the 0-based index for the last occurence of the substring.
Definition ff_base.h:2817
void ToUpperCase()
Transforms the string to upper case.
Definition finaleframework.cpp:2885
bool IsEnigmaFileInfoSubtitle() const
Returns true if the string is an "Subtitle" Enigma command.
Definition finaleframework.cpp:1630
int CalcLastStringPos(const FCString &subString) const
Returns the last position where a substring occurs.
Definition ff_base.h:2488
void AppendCString(const char *pOtherString)
Appends a C-style string to the string.
Definition finaleframework.cpp:1861
bool IsWhitespace(int index) const
Returns true if the character position contains a whitespace.
Definition finaleframework.cpp:1775
void SetFontAnnotationFolderPath()
Sets the path string to Finale's font annotation folder.
Definition ff_base.h:2320
bool ContainsCString(const char *pszSubString) const
Returns true if the substring is found within the string. C-string version.
Definition ff_base.h:2440
bool IsEmpty() const
Returns true if the string is empty.
Definition ff_base.h:3179
bool StartsWithString(const FCString *pString) const
Returns true if the string starts with the parameter string.
Definition finaleframework.cpp:2849
void Insert(const char *pszString, int insertindex=0)
Inserts a C string to the string at a specified index position.
Definition finaleframework.cpp:1715
bool DeleteCodePointsAt(int index, int count)
Removes a range of Unicode codepoints, starting at the 0-based index position.
Definition finaleframework.cpp:1507
FCStrings * CreateRows() const
Definition finaleframework.cpp:2798
int CalcCStringPosFrom(const char *pszSubString, int startindex) const
Returns the first position where a substring occurs, from a starting point. C-string version.
Definition ff_base.h:2545
int FindFirst(const char *pszSubStr) const
Returns the 0-based index for the first occurence of the substring.
Definition ff_base.h:2778
bool TrimEnigmaFontTags()
Removes all Enigma font tags from a string, leaving only the actual text and text insert tags,...
Definition finaleframework.cpp:1437
FCFontInfo * CreateLastFontInfo() const
Creates a FCFontInfo object with the last font information (based on the Enigma text tags) found in t...
Definition finaleframework.cpp:2937
bool IsEqualString(const FCString &value) const
Returns true if the string is identical with the parameter. (FCString string version....
Definition ff_base.h:3142
bool IsEqual(const char *pszString) const
Returns true if the string is identical with the parameter.
Definition ff_base.h:3135
bool DeleteCharacterAt(int index)
Removes a character at the 0-based index position.
Definition ff_base.h:2716
bool IsCharacter(int index, eUniChar32 character) const
Returns true if the character at the index matches the supplied character.
Definition finaleframework.cpp:1752
bool DeleteCharactersAt(int index, int count)
Removes a range of characters, starting at the 0-based index position.
Definition finaleframework.cpp:1491
const char * GetLuaString() const
Returns a Lua version of the string in UTF-8 format.
Definition finaleframework.cpp:1371
virtual ~FCString()
The destructor. Deletes the string storage as well as the C-string pointer (if any).
Definition finaleframework.cpp:1023
void TruncateWidth(int maxlength, int prefixchars)
Truncates the string by removing the middle part and inserting '...' instead.
Definition ff_base.h:3697
bool Replace(const char *pszSource, const char *pszReplacement)
Replaces all occurrences of a source pattern with a replacement string.
Definition finaleframework.cpp:1515
bool MakeSubString(int startindex, int substringlength, FCString *pDestinationString)
Creates a substring from the string.
Definition finaleframework.cpp:1806
void SetMeasurement(double value, twobyte unit)
Sets the string to an EVPU measurement value, formatted to a specific unit.
Definition finaleframework.cpp:2168
void SetUnicodeString(const eUniChar16 *pChar, int maxchars=-1)
Sets the string by using a 16-bit Unicode buffer as input parameter.
Definition finaleframework.cpp:1273
bool IsEnigmaTextInsert(bool only_file_info_inserts=true) const
Returns true if the string is an Enigma text command with a text insert.
Definition finaleframework.cpp:1665
bool TrimEnigmaTags()
Removes all Enigma tag information from a string, leaving only the actual text.
Definition finaleframework.cpp:1396
bool DeleteCodePointAt(int index)
Removes the Unicode codepoint at the 0-based index position.
Definition ff_base.h:2687
void SetCharacterAt(int index, eUniChar16 newcharacter)
Sets the character at the index position.
Definition finaleframework.cpp:2391
FCString & operator=(const FCString &src)
Assignment operator (required for classes that allocate memory.)
Definition ff_base.h:2034
void SetPluginsFolderPath()
Sets the path string to Finale's root plug-in folder.
Definition ff_base.h:2264
bool TruncateEnd(int count)
Truncates the end of the string by a specific number of characters.
Definition ff_base.h:3686
void AssureEndingPathDelimiter()
Makes sure that the string ends with a path delimiter (backslash or slash, depending on OS)....
Definition ff_base.h:2117
void AppendInteger(int value)
Appends an integer value (decimal) to the string.
Definition finaleframework.cpp:1877
int FormatCStringArgs(const char *fmt, va_list args)
Formats a string from an args list. Supports either UTF8 or platform encoding.
Collection class for FCString class objects.
Definition ff_basecollection.h:1085
An object to handle glyph information returned by the system.
Definition ff_base.h:5279
float GetBottom() const
Returns the bottom position of the glyph, relative to the baseline.
Definition ff_base.h:5374
void _SetMaxAscent(float b)
For internal use only.
Definition ff_base.h:5332
float GetTop() const
Returns the top position of the glyph, relative to the baseline.
Definition ff_base.h:5395
float GetHeight() const
Returns the height of the glyph, in fractional points.
Definition ff_base.h:5360
float GetMaxDescent()
Returns the maximum descender for the font, relative to the baseline.
Definition ff_base.h:5415
void _SetBottom(float b)
For internal use only.
Definition ff_base.h:5326
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:5418
float GetMaxAscent()
Returns the maximum ascender for the font, relative to the baseline.
Definition ff_base.h:5405
ufourbyte GetGlyphNumber()
Returns the glyph number for the loaded data.
Definition ff_base.h:5348
void _SetLeft(float l)
For internal use only.
Definition ff_base.h:5320
float GetLeft() const
Returns the left-side position of the glyph, in fractional points.
Definition ff_base.h:5366
float GetWidth()
Returns the width of the glyph, in fractional points.
Definition ff_base.h:5354
void _SetWidth(float w)
For internal use only.
Definition ff_base.h:5314
void _SetHeight(float h)
For internal use only.
Definition ff_base.h:5308
void _SetMaxDescent(float b)
For internal use only.
Definition ff_base.h:5338
float GetRight() const
Returns the right-side position of the glyph.
Definition ff_base.h:5384
FCSystemGlyphInfo()
The constructor.
Definition ff_base.h:5285
A class that fetches the metrics for text (for how Finale will render it), such as the boundary boxes...
Definition ff_base.h:4471
double CalcWidthEVPUs()
Returns the width of the bounding box, in fractional EVPUs.
Definition ff_base.h:4786
double CalcHeightEVPUs()
Returns the width of the bounding box, in fractional EVPUs.
Definition ff_base.h:4771
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_base.h:4794
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4797
double GetBottomEVPUs() const
Returns the bottom side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4718
double GetTopEVPUs() const
Returns the top side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4703
double GetAdvanceWidthPoints() const
Returns the advance width of the string (the pen position before and after printing the string),...
Definition ff_base.h:4566
double GetLeftPoints() const
Returns the left side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4585
double GetLeftEVPUs() const
Returns the left side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4673
double GetAdvanceWidthEVPUs() const
Returns the advance width of the string (the pen position before and after printing the string),...
Definition ff_base.h:4658
double GetRightEVPUs() const
Returns the right side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4688
double GetRightPoints() const
Returns the right side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4604
double CalcHeightPoints()
Returns the width of the bounding box, in fractional Points.
Definition ff_base.h:4737
double GetTopPoints() const
Returns the top side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4623
double CalcWidthPoints()
Returns the width of the bounding box, in fractional Points.
Definition ff_base.h:4756
double GetBottomPoints() const
Returns the bottom side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4642
FCTextMetrics()
The constructor. Defaults to unloaded. Metrics must be loaded with LoadString, LoadSymbol,...
Definition ff_base.h:4482
Standard class for basic user interface functionality.
Definition ff_ui.h:29