Finale PDK Framework 0.79
Lua Power for 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_RAWDATA,
177 FCID_REPEATPREFS,
178 FCID_SECONDARYBEAMBREAKMOD,
179 FCID_BEAMEXTENSIONMOD,
180 FCID_SECTIONSYLLABLE,
181 FCID_SEPARATEMEASURENUMBER,
182 FCID_SEPARATEPLACEMENT,
183 FCID_SHAPEDEF,
184 FCID_SHAPEEXPRESSIONDEF,
185 FCID_SLURCONTOURPREFS,
186 FCID_SIZEPREFS,
187 FCID_SMARTSHAPE,
188 FCID_SMARTSHAPEENTRYMARK,
189 FCID_SMARTSHAPEMEASUREMARK,
190 FCID_SMARTSHAPEPREFS,
191 FCID_STAFF,
192 FCID_STAFFLIST,
193 FCID_STAFFNAMEPOSITION,
194 FCID_STAFFNAMEPOSITIONPREFS,
195 FCID_STAFFSTYLEASSIGN,
196 FCID_STAFFSTYLEDEF,
197 FCID_STAFFSYSTEM,
198 FCID_STEMCONNECTIONTABLE,
199 FCID_STEMMOD,
200
203
204 FCID_SYLLABLEENTRYMOD,
205 FCID_SYSTEMSTAFF,
206 FCID_TABLATURENOTEMOD,
207 FCID_TEMPOELEMENT,
208 FCID_TEXTBLOCK,
209 FCID_TEXTEXPRESSIONDEF,
210 FCID_TEXTREPEAT,
211 FCID_TEXTREPEATDEF,
212 FCID_TIEMOD,
213 FCID_TIEPREFS,
214 FCID_TIECONTOURPREFS,
215 FCID_TIEPLACEMENTPREFS,
216 FCID_TIMESIGNATURE,
217 FCID_TUPLET,
218 FCID_TUPLETPREFS,
219 FCID_VERSESYLLABLE
220 };
221
229 virtual const PDKFRAMEWORK_CLASSID GetClassID() const { return FCID_UNKNOWN; }
230
231#ifdef PDK_FRAMEWORK_LUAFRIENDLY
232#ifndef DOXYGEN_SHOULD_IGNORE_THIS
235 int _Lua_GetClassID() const { return (int) GetClassID(); }
236#endif
237#endif
238
244 {
247
250
253
256
259
262
265
268 };
269
275 virtual const char* ClassName() const = 0;
276
277protected:
280 {
281 _UserData = NULL;
282 _UserData2 = NULL;
283 }
284public:
285
290 /* NOTE: This was a bug that wasn't discovered until April 04 2013, so all
291 * plug-ins that use primitive collections (such as string collections)
292 * should be rebuilt. */
293 virtual ~__FCBase()
294 {
295 }
296
297#ifdef PDK_FRAMEWORK_DEBUG
303 void DebugMsgInt(const char* pszPrefixText, int i);
304
310 void DebugMsgHex(const char* pszPrefixText, int i);
311
317 void DebugMsgString(const char* pszPrefixText, const char * thestring);
318
323 void DebugMsg(const char* pszMsg);
324
332 static void DebugOutPtr(const char* pszPrefixText, void* ptr);
333
339 static void DebugOutInt(const char* pszPrefixText, int i);
340
346 static void DebugOutFloat(const char* pszPrefixText, double f);
347
353 static void DebugOutTag(const char* pszPrefixText, EXTAG extag);
354
360 static void DebugOutHex(const char* pszPrefixText, int i);
361
367 static void DebugOutBin(const char* pszPrefixText, int i);
368
374 static void DebugOutString(const char* pszPrefixText, const char * thestring);
375
381 static void DebugOutString(const char* pszPrefixText, FCString* pString);
382
388 static void DebugOutBool(const char* pszPrefixText, bool state);
389
395 static void DebugOutBlock(const void * pBuffer, int startoffset, int size);
396
407 static void DebugOutByteArrayBlock(const void * pBuffer, int startoffset, int size);
408
413 static void DebugOut(const char* pszLine);
414
419 void DebugOutMenuInfo(FCUI* pUI, int menuixd_horiz, int menuixd_vert) const;
420
421#ifdef PDK_FRAMEWORK_FORMAT
427 int DebugOutFormat(const char *fmt, ...);
428#endif
429
438 virtual void DebugDump();
439
448 virtual void DebugDataDump();
449
459 virtual void DebugDataByteArrayDump();
460#endif
461
468 void Set16BitFlag(FLAG_16 *flag, FLAG_16 flagbits, bool state);
469
476 void Set32BitFlag(FLAG_32 *flag, FLAG_32 flagbits, bool state);
477
486 bool GetBitFlag(FLAG_32 flag, FLAG_32 flagbits) const { return (flag & flagbits) != 0; }
487
489 int GetBitCount(FLAG_32 flag);
490
497 void SetSpecific32Bit(FLAG_32* flag, int bitnumber, bool state);
498
504 void SetUserData(void* pData) { _UserData = pData; }
505
511 void SetUserData2(void* pData) { _UserData2 = pData; }
512
518 void* GetUserData() const { return _UserData; }
519
525 void* GetUserData2() const { return _UserData2; }
526
540 virtual bool IsIdentical(const __FCBase* pCompareObject) const
541 {
542 if (!pCompareObject) return false;
543 if (ClassName() != pCompareObject->ClassName()) return false; /* Should point to same const string */
544 return true;
545 }
546
547
548#ifdef PDK_FRAMEWORK_TINYXML
553 void StoreXML_String(tinyxml2::XMLElement* pParentNode, const char* pszElementName, FCString* pStringValue);
554
559 void StoreXML_Integer(tinyxml2::XMLElement* pParentNode, const char* pszElementName, int value);
560
565 void StoreXML_Bool(tinyxml2::XMLElement* pParentNode, const char* pszElementName, bool value);
566
571 void StoreXML_StringAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, FCString* pStringValue);
572
577 void StoreXML_IntegerAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, int value);
578
583 void StoreXML_BoolAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, bool value);
584
589 void StoreXML_FloatAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, float value);
590
597 virtual void StoreToXML([[maybe_unused]]tinyxml2::XMLElement* pParentNode) {}
598
599
606 bool ReadXML_String(tinyxml2::XMLElement* pParentNode, const char* pszElementName, FCString* pStringValue);
607
614 bool ReadXML_Integer(tinyxml2::XMLElement* pParentNode, const char* pszElementName, int* pValue);
615
622 bool ReadXML_Bool(tinyxml2::XMLElement* pParentNode, const char* pszElementName, bool *pValue);
623
630 bool ReadXML_StringAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, FCString* pStringValue);
631
638 bool ReadXML_IntegerAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, int* pValue);
639
646 bool ReadXML_BoolAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, bool *pValue);
647
654 bool ReadXML_FloatAttribute(tinyxml2::XMLElement* pNode, const char* pszAttributeName, float *pValue);
655
664 virtual bool ReadFromXML([[maybe_unused]]tinyxml2::XMLElement* pParentNode) { return false; }
665#endif
666};
667
677class __FCBaseData : public __FCBase {
678#ifndef DOXYGEN_SHOULD_IGNORE_THIS
679 EXTAG _customtag;
680
682 virtual bool _RawRelink()
683 {
684 DeleteData();
685 return Save();
686 }
687#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
688protected:
693
697
701
710
711
713 EDataID _dataid;
714
715
721 virtual void* Allocate() = 0;
722
726 virtual void Deallocate() {
727 }
728
734 virtual bool IsDynamicSize() {
735 return false;
736 }
737
741 bool LoadDataBlock();
742
747 void ClearData();
748
756 virtual twobyte CalcLastInci() { return kNewInci; }
757
767
771 bool DataIsLoaded() const {
772 return (_loadedsize > 0);
773 }
774
779 void _TagDocumentID();
780public:
781
782 const PDKFRAMEWORK_CLASSID GetClassID() const override = 0; /* Force all inherited class to have this method implementation */
783
788 EDOCID GetConnectedDocID() const
789 {
790 return _connecteddocID;
791 }
792
800
805 virtual EXTAG Tag() const = 0;
806
813 virtual EVERSION EnigmaVersion() const { return FXT_VERSION; }
814
820 virtual int DataSizeLoad() const = 0;
821
825 virtual int DataSizeSave() const;
826
827
828 const char* ClassName() const override { return "__FCBaseData"; }
829
834 void _CloneFrom(__FCBaseData* pSource);
835
843 virtual void CloneMemoryFrom(__FCBaseData* pSource);
844
849 const EDataID* _GetDataID() { return &_dataid; }
850
855 int _GetLoadedSize() const { return _loadedsize; }
856
861 const void* GetDataBlock() { return _datablock; }
862
871 EXTAG GetCustomTag() const { return _customtag; }
872
883 void SetCustomTag(EXTAG tag) { _customtag = tag; }
884
886 __FCBaseData();
887
889 virtual ~__FCBaseData();
890
897 virtual bool Save();
898
913 virtual bool Reload();
914
923 virtual bool DeleteData();
924
931 virtual bool DeepDeleteData()
932 {
933 return DeleteData();
934 }
935
944 virtual bool LoadFirst() = 0;
945
950 virtual bool LoadLast() { return false; }
951
956 virtual bool LoadNext();
957
962 virtual bool LoadPrevious() { return false; }
963
985 bool RelinkToCurrentView();
986
995 bool RelinkToScore();
996
1005
1006#ifdef PDK_FRAMEWORK_DEBUG
1007 void DebugDump() override
1008 {
1010 DebugOutPtr("Data block: ", _datablock);
1011 DebugOutInt("Loaded size: ", (int) _GetLoadedSize());
1012 }
1013
1014 void DebugDataDump() override
1015 {
1018 }
1019
1025
1026#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1027 virtual void DebugDataCompare(__FCBaseData *pCompareObject)
1028 {
1029 if (!pCompareObject)
1030 {
1031 DebugOut("DebugDataCompare(): Compare object is nil.");
1032 return;
1033 }
1034 if (_GetLoadedSize() != pCompareObject->_GetLoadedSize())
1035 {
1036 char szBuffer[200];
1037 snprintf(szBuffer, sizeof(szBuffer), "DebugDataCompare(): Compare size differs. %d compared to %d byte(s)", (int) _GetLoadedSize(), (int) pCompareObject->_GetLoadedSize());
1038 DebugOut(szBuffer);
1039 return;
1040 }
1041 unsigned char* pDataBlock = (unsigned char*) GetDataBlock();
1042 unsigned char* pCompareBlock = (unsigned char*) pCompareObject->GetDataBlock();
1043 int diffcount = 0;
1044 for (int i = 0; i < _GetLoadedSize(); i++)
1045 {
1046 if (pDataBlock[i] != pCompareBlock[i])
1047 {
1048 diffcount ++;
1049 char szBuffer[200];
1050 snprintf(szBuffer, sizeof(szBuffer), "DebugDataCompare() DIFF at 0-based byte offset %d: 0x%02x - 0x%02x ", i, pDataBlock[i], pCompareBlock[i]);
1051 DebugOut(szBuffer);
1052 }
1053 }
1054 if (diffcount == 0)
1055 {
1056 DebugOut("DebugDataCompare(): Data blocks are identical");
1057 }
1058 }
1059#endif
1060
1063 void DebugDataOffsetDump(int offset, int size);
1064
1065#endif
1066
1083
1084#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1086 luabridge::RefCountedPtr<FCNumbers> CreateRawDataDump_GC()
1087 { return makeLuaSharedPtr(CreateRawDataDump()); }
1088#endif
1089
1096 EXTAG GetRawTag() const { return Tag(); }
1097
1102 CMPER GetRawOtherCmper() const { return _dataid.other.cmper; }
1103
1108 twobyte GetRawOtherInci() const { return _dataid.other.inci; }
1109
1114 CMPER GetRawDetailCmper1() const { return _dataid.detail.cmper1; }
1115
1120 CMPER GetRawDetailCmper2() const { return _dataid.detail.cmper2; }
1121
1126 twobyte GetRawDetailInci() const { return _dataid.detail.inci; }
1127
1135 ENTNUM GetRawEntryDetailEntryNumber() const { return _dataid.entryDetail.entryNumber; }
1136
1141 twobyte GetRawEntryDetailInci() const { return _dataid.entryDetail.inci; }
1142
1143};
1144
1145
1150{
1151public:
1152 const char* ClassName() const override { return "__FCInci"; }
1153
1155 bool Load(CMPER cmper, twobyte inci);
1156};
1157
1158
1159class FCString;
1160
1161// this value is used to set apart "Fixed" (absolute) font formatting
1162// within the context of a displayed string. An example where it is used
1163// is when displaying an Enigma string in FCCtrlTextEditor.
1164constexpr double kDisplayPercentForFixedFontSize = 1.1;
1165
1191class FCFontInfo : public __FCBase
1192{
1193#if FXT_VERSION >= FINALEVERSION_25
1194 EnigmaFontName _nameUTF16; /* 64-bit version of the data. */
1195#else
1196 EFONTNAME _name; /* Should NOT be used on Finale 25 or later. */
1197#endif
1198 EFONTID _fontid; /* The internal font ID. This is not
1199 document independent, but can be used for
1200 some cases when the exact font ID is
1201 required within the document. Currently the Framework
1202 hardly uses it and gets the internal font number with
1203 GetIDByName if it needs it.*/
1204 double _size; /* Although Finale itself doesn't support fractional points,
1205 support it here. The FCCtrlCanvas supports it. */
1206 FLAG_16 _styles;
1207private:
1208 const static FCString DefaultFontName;
1209public:
1210 const char* ClassName() const override { return "FCFontInfo"; }
1211 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_FONTINFO; }
1212
1219 {
1221 ENIGMASTYLE_PLAIN = FONT_EFX_PLAIN,
1222
1224 ENIGMASTYLE_BOLD = FONT_EFX_BOLD,
1225
1227 ENIGMASTYLE_ITALIC = FONT_EFX_ITALIC,
1228
1230 ENIGMASTYLE_UNDERLINE = FONT_EFX_UNDERLINE,
1231
1233 ENIGMASTYLE_STRIKEOUT = FONT_EFX_STRIKEOUT,
1234
1236 ENIGMASTYLE_ABSOLUTE = FONT_EFX_ABSOLUTE,
1237
1239 ENIGMASTYLE_HIDDEN = FONT_EFX_HIDDEN
1241
1250 FCFontInfo();
1251
1261 FCFontInfo(const FCString& name, double size, FLAG_16 enigmastyles = ENIGMASTYLE_PLAIN);
1262
1263#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1265 static FCFontInfo* FCFontInfo_Lua(void* ptr, lua_State *L);
1266#endif // PDK_FRAMEWORK_LUAFRIENDLY_CPP
1267
1269 FCFontInfo(const ETextStyle& style);
1270
1271#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1276 static int FCFontInfo_tostring(lua_State* L);
1277#endif
1278
1286 static fourbyte GetSystemTextEncoding();
1287
1288
1293 void CopyFrom(const FCFontInfo* pInfo);
1294
1302 {
1303 FCFontInfo* pCopy = new FCFontInfo();
1304 pCopy->CopyFrom(this);
1305 return pCopy;
1306 }
1307
1308#ifdef PDK_FRAMEWORK_PREFS
1309 /* NOTE! These 2 declarations are not type safe, since this declaration is in ff_base.h */
1310
1321 bool LoadFontPrefs(int prefsID);
1322
1333 bool SaveFontPrefs(int prefsID);
1334
1335#endif /* PDK_FRAMEWORK_PREFS*/
1336
1343 int GetSize() const { return static_cast<int>(_size); }
1344
1351 double GetSizeFloat() const
1352 {
1353 return _size;
1354 }
1355
1356#if FXT_VERSION < FINALEVERSION_25
1357#ifndef PDK_FRAMEWORK_LUAFRIENDLY
1359 void GetNameParam(const EFONTNAME* pName) { strcpy((char*)pName, (const char*)_name); }
1360#endif
1361#endif
1362
1371 void GetNameString(FCString* pString) const;
1372
1379 std::string GetName() const;
1380
1394 EFONTID GetIDByName() const;
1395
1402 [[deprecated]]EFONTID GetNameByID() const
1403 { return GetIDByName(); }
1404
1405
1412 FLAG_16 GetEnigmaStyles() const { return _styles; }
1413
1414#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
1430 bool MakeEnigmaString(FCString* pString, FCString* pFontTagString = NULL);
1431
1444 FCString* CreateEnigmaString(FCString* pFontTagString = NULL);
1445
1446#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1447private:
1449 luabridge::RefCountedPtr<FCString>CreateEnigmaString_GC(FCString* pFontTagString)
1450 { return makeLuaSharedPtr(CreateEnigmaString(pFontTagString)); }
1451public:
1453 static int CreateEnigmaString_CFunc(lua_State* L)
1454 {
1455 return _CFunctionOneOptionalParameter<FCFontInfo, luabridge::RefCountedPtr<FCString>, FCString*, &FCFontInfo::CreateEnigmaString_GC>(L, nullptr);
1456 }
1457#endif
1458
1468 void MakeEnigmaStyleString(FCString* pString);
1469
1479 void MakeEnigmaSizeString(FCString* pString);
1480
1489
1490#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1492 luabridge::RefCountedPtr<FCString> CreateEnigmaStyleString_GC()
1493 { return makeLuaSharedPtr(CreateEnigmaStyleString()); }
1494#endif
1495
1505 bool ParseEnigmaCommand(FCString* pString);
1506
1507#endif /* PDK_FRAMEWORK_ENIGMASTRINGS */
1508
1510 void ParseEnigmaFont(const EEnigmaFont* pEnigmaFont)
1511 {
1512 SetEnigmaStyles(pEnigmaFont->efx);
1513 SetSize(pEnigmaFont->size);
1514 SetNameByID(pEnigmaFont->font);
1515 }
1516
1523 void SetEnigmaStyles(FLAG_16 fontstyles) { _styles = fontstyles; }
1524
1531 FCString* CreateDescription() const;
1532
1533#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
1535 luabridge::RefCountedPtr<FCString> CreateDescription_GC()
1536 { return makeLuaSharedPtr(CreateDescription()); }
1537#endif
1538
1539#if FXT_VERSION < FINALEVERSION_25
1540#ifndef PDK_FRAMEWORK_LUAFRIENDLY
1542 void SetName( const EFONTNAME* pName) { strcpy((char*)_name, (const char*)pName); }
1543#endif
1544#endif
1545
1552 void SetName(const std::string& pszName);
1553
1565 EFONTID GetFontID() const { return _fontid; }
1566
1579 void SetFontID(EFONTID fontID) { _fontid = fontID; }
1580
1585 void SetNameString(const FCString& value);
1586
1592 void SetNameByID(EFONTID id);
1593
1600 void SetSize(int fontsize) { _size = static_cast<double>(fontsize); }
1601
1608 void SetSizeFloat(double fontsize) { _size = fontsize; }
1609
1616 void SetAbsolute(bool state) { Set16BitFlag(&_styles, FONT_EFX_ABSOLUTE, state); }
1617
1624 void SetStrikeOut(bool state) { Set16BitFlag(&_styles, FONT_EFX_STRIKEOUT, state); }
1625
1632 void SetBold(bool state) { Set16BitFlag(&_styles, FONT_EFX_BOLD, state); }
1633
1640 void SetHidden(bool state) { Set16BitFlag(&_styles, FONT_EFX_HIDDEN, state); }
1641
1648 void SetItalic(bool state) { Set16BitFlag(&_styles, FONT_EFX_ITALIC, state); }
1649
1656 void SetUnderline(bool state) { Set16BitFlag(&_styles, FONT_EFX_UNDERLINE, state); }
1657
1662 void SetPlain() { _styles = 0; }
1663
1672 bool IsName(const char* pszTestName) const;
1673
1682 bool IsNameString(const FCString& pTestName) const;
1683
1688 bool IsPlain() { return (_styles == 0); }
1689
1694 bool GetBold() const { return GetBitFlag(_styles, FONT_EFX_BOLD); }
1695
1700 bool GetItalic() const { return GetBitFlag(_styles, FONT_EFX_ITALIC); }
1701
1706 bool GetUnderline() const { return GetBitFlag(_styles, FONT_EFX_UNDERLINE); }
1707
1712 bool GetStrikeOut() const { return GetBitFlag(_styles, FONT_EFX_STRIKEOUT); }
1713
1718 bool GetAbsolute() const { return GetBitFlag(_styles, FONT_EFX_ABSOLUTE); }
1719
1724 bool GetHidden() const { return GetBitFlag(_styles, FONT_EFX_HIDDEN); }
1725
1733 bool GetIsSMuFLFont() const
1734 {
1735#if FXT_VERSION >= FINALEVERSION_27_1
1736 return FX_IsSMuFLFont(GetIDByName());
1737#else
1738 return false;
1739#endif
1740 }
1741
1749 bool IsMacSymbolFont() const;
1750
1756 bool IsIdenticalTo(const FCFontInfo& compareWith) const;
1757
1765 bool MakeDefaultMusicFont();
1766
1779
1793 {
1795 }
1796
1797#ifdef PDK_FRAMEWORK_DEBUG
1798 void DebugDump() override;
1799#endif
1800};
1801
1802
1811{
1812 FCFontInfo _font;
1813 EColor _color{}; // not currently used
1814 fourbyte _tracking{};
1815 Evpu32 _baselineshift{};
1816 Evpu32 _superscript{};
1817
1818public:
1819 const char* ClassName() const override { return "FCEnigmaTextStyle"; }
1820 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_ENIGMATEXTSTYLE; }
1821
1822#ifdef PDK_FRAMEWORK_LUAFRIENDLY
1824 static FCEnigmaTextStyle* FCEnigmaTextStyle_Lua(void* ptr, lua_State* L)
1825 {
1826 return _OneOptionalParamLuaConstructor<FCEnigmaTextStyle, const FCFontInfo&>(ptr, L);
1827 }
1828#endif
1829
1834 FCEnigmaTextStyle() : _font() {}
1835
1840 FCEnigmaTextStyle(const FCFontInfo& font) : _font()
1841 {
1842 _font.CopyFrom(&font);
1843 }
1844
1845#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1847 FCEnigmaTextStyle(const ETextStyle& ts) : _font(ts)
1848 {
1849 _color = ts.color;
1850 _tracking = ts.tracking;
1851 _baselineshift = ts.baselineShift;
1852 _superscript = ts.superscript;
1853 }
1854#endif // DOXYGEN_SHOULD_IGNORE_THIS
1855
1862 FCFontInfo* GetFont() { return &_font; }
1863
1864#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1866 const FCFontInfo* GetFont() const { return &_font; }
1867#endif
1868
1873 fourbyte GetInterletterSpacing() const { return _tracking; }
1874
1879 Evpu32 GetBaselineShift() const { return _baselineshift; }
1880
1885 Evpu32 GetSuperscript() const { return _superscript; }
1886
1891 void SetInterletterSpacing(fourbyte value) { _tracking = value; }
1892
1897 void SetBaselineShift(Evpu32 value) { _baselineshift = value; }
1898
1903 void SetSuperscript(Evpu32 value) { _superscript = value; }
1904};
1905
1906
1907class FCStrings;
1908class FCCategoryDef;
1909class FCRange;
1910
1911const eUniChar16 UTF16_HIGH_SURROGATE_MASK = 0xD800;
1912const eUniChar16 UTF16_LOW_SURROGATE_MASK = 0xDC00;
1913
1930class FCString : public __FCBase
1931{
1932 // use _fcStringChar instead of eUniChar16 so that C++ debuggers
1933 // will display the buffers as strings.
1934 using _fcStringChar = WINCODE(WCHAR) MACCODE(char16_t);
1935 static_assert(sizeof(_fcStringChar) == sizeof(eUniChar16), "FCString internal _fcStringChar must match sizeof(eUniChar16).");
1936
1937#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1938 int _length;
1939 int _storagelength; // Maximum characters that can fit in the storage
1940 _fcStringChar* _pStorage; /* The main string buffer (UTF16) for Unicode.
1941 * The contents MUST be 0-terminated (since
1942 * some APIs require it)! */
1943 mutable char* _pTempCBuffer; // Used for GetCString
1944 mutable char* _pTempCUTF8Buffer; // Used for GetCStringUTF8
1945
1946#if OPERATING_SYSTEM == MAC_OS
1947 mutable void* _nsstringobject; /* A retained NSString* object for GetNSString() */
1948#endif
1949
1951 void _DeleteStorage();
1952
1954 void _ExpandStorageIfNecessary(int minimumlength);
1955
1957 bool _SetFinalePath(FinPath pathconstant);
1958
1959 void __init()
1960 {
1961 _length = 0;
1962 _storagelength = 0;
1963 _pStorage = NULL;
1964 _pTempCBuffer = NULL;
1965 _pTempCUTF8Buffer = NULL;
1966#if OPERATING_SYSTEM == MAC_OS
1967 _nsstringobject = nullptr;
1968#endif
1969 Clear();
1970 }
1971
1972#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
1973
1974
1975#ifdef PDK_FRAMEWORK_TINYXML
1982 void StoreToXML(tinyxml2::XMLElement* pParentNode) override {
1983 StoreXML_StringAttribute(pParentNode, "FCString", this);
1984 }
1985
1986 /* \brief Virtual method that reads the string object data. This method is
1987 * only called passively by the collection load feature.
1988 *
1989 * This method requires the <b>PDK_FRAMEWORK_TINYXML</b> define. */
1990 bool ReadFromXML(tinyxml2::XMLElement* pParentNode) override
1991 {
1992 return ReadXML_StringAttribute(pParentNode, "FCString", this);
1993 }
1994#endif
1995
1996 static bool _IsHighSurrogate(eUniChar16 value)
1997 {
1998 return (value & 0xFC00) == UTF16_HIGH_SURROGATE_MASK;
1999 }
2000
2001 static bool _IsLowSurrogate(eUniChar16 value)
2002 {
2003 return (value & 0xFC00) == UTF16_LOW_SURROGATE_MASK;
2004 }
2005
2011 bool _GetCodePointRange(FCRange *pRange) const;
2012
2013public:
2014 const char* ClassName() const override { return "FCString"; }
2015 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_STRING; }
2016
2017#ifdef PDK_FRAMEWORK_LUAFRIENDLY
2019 static FCString* FCString_Lua(void* ptr, lua_State* L)
2020 {
2021 return _OneOptionalParamLuaConstructor<FCString, const char *>(ptr, L);
2022 }
2023#endif
2024
2030 {
2031 __init();
2032 }
2033
2040 FCString(const char* pszCString) : __FCBase()
2041 {
2042 __init();
2043 SetUTF8String(pszCString); // SetUTF8String falls back to platform encoding if UTF8 doesn't work, but we should try UTF8 first.
2044 }
2045
2047 FCString(const eUniChar16* pszCString) : __FCBase()
2048 {
2049 __init();
2050 SetUnicodeString(pszCString);
2051 }
2052
2054 FCString(const _fcStringChar* pszCString) : __FCBase()
2055 {
2056 __init();
2057 SetUnicodeString(reinterpret_cast<const eUniChar16 *>(pszCString));
2058 }
2059
2062 virtual ~FCString();
2063
2064#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2069 static int FCString_tostring(lua_State* L)
2070 {
2071 FCString* pThis = luabridge::Stack<FCString*>::get(L, 1) LB3(.value());
2072 std::string s = std::string(pThis->ClassName()) + ": " + pThis->GetUTF8String();
2073 luabridge::Stack<std::string>::push(L, s).throw_on_error();
2074 return 1;
2075 }
2076#endif
2077
2080 FCString(const FCString &src)
2081 {
2082 __init();
2083 SetString(&src); //note: SetString checks for self-assignment
2084 }
2085
2089 {
2090 // do NOT call __init() here because this-> points to a constructed FCString
2091 // and we need to let SetString() release the old memory.
2092 SetString(&src); //note: SetString checks for self-assignment
2093 return *this;
2094 }
2095
2096#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2097 bool operator==(const FCString &src) const
2098 { return (0 == this->Compare(src)); }
2099 template<typename T> // if we ever overload operator==(), this template picks up the overload as well
2100 bool operator!=(T src) const
2101 { return ! (*this == src); }
2102
2104 const _fcStringChar* GetOSUnicodeString() const { return _pStorage; }
2105
2107 const std::basic_string_view<eUniChar16> _GetBasicStringView() const
2108 { return std::basic_string_view<eUniChar16>(_GetUnicodeBuffer(), GetLength()); }
2109
2110 static const eUniChar16 emptyUniCharStr[];
2111#endif // DOXYGEN_SHOULD_IGNORE_THIS
2112
2122 void AppendCharacter(eUniChar32 character);
2123
2128 void AppendString(const FCString* pOtherString);
2129
2134 void AppendCString(const char* pOtherString);
2135
2136#if defined(PDK_FRAMEWORK_LUAFRIENDLY) || defined(DOXYGEN_SHOULD_IGNORE_THIS)
2144 void AppendLuaString(const char* pOtherString);
2145#endif
2146
2151 void AppendInteger(int value);
2152
2157 void AppendFloat(double value);
2158
2164
2172 {
2173 if (IsEmpty()) return;
2174#if OPERATING_SYSTEM == WINDOWS
2175 if (!EndsWith("\\") && !EndsWith("/")) AppendCString("\\");
2176#else
2177 if (!EndsWith("/")) AppendCString("/");
2178#endif
2179 }
2180
2197 bool EncodeFromMacRoman();
2198
2209 bool EncodeToMacRoman();
2210
2235 bool SplitAt(int splitpointindex, FCString* pFirstString, FCString* pSecondString, bool includesplitposchar) const
2236 {
2237 /* Make sure the 0-based index position is valid */
2238 if (splitpointindex < -1) return false;
2239 if (splitpointindex >= GetLength()) return false;
2240 if ((pFirstString) && (pFirstString == pSecondString))
2241 {
2242 /* Reference to same destination object is not allowed */
2243 return false;
2244 }
2245 if (pFirstString && pSecondString)
2246 {
2247 /* Don't allow copying to "this" if both substrings are used */
2248 if (pFirstString == this) return false;
2249 if (pSecondString == this) return false;
2250 }
2251 if (pFirstString)
2252 {
2253 pFirstString->SetString(this);
2254 /* Check state of includesplitposchar, to decide if the
2255 split point should be included or not. */
2256 const int splitoffset = includesplitposchar ? 1 : 0;
2257 // ignore return value here, because TruncateAt returns false if there is nothing to truncate,
2258 // but we do not care about that. We have already checked for the other conditions that might
2259 // cause TruncateAt to fail.
2260 pFirstString->TruncateAt((std::max)(0, splitpointindex + splitoffset));
2261 }
2262 if (pSecondString)
2263 {
2264 pSecondString->SetString(this);
2265 if (splitpointindex >= 0)
2266 pSecondString->DeleteCharactersAt(0, splitpointindex + 1);
2267 }
2268 return true;
2269 }
2270
2285 bool SplitToPathAndFile(FCString* pPathPart, FCString* pFilePart) const
2286 {
2287#if OPERATING_SYSTEM == WINDOWS
2288 // Little known fact: Windows recognizes either forward or back slash as a path delimiter.
2289 int pos = (std::max)(FindLast("/"), FindLast("\\"));
2290#else
2291 int pos = FindLast("/");
2292#endif
2293 return SplitAt(pos, pPathPart, pFilePart, true);
2294 }
2295
2300 void SetUserPath();
2301
2310 void SetUserOptionsPath();
2311
2318 void SetPluginsFolderPath() { _SetFinalePath(FinPath_PluginDir); }
2319
2326 void SetMusicFolderPath() { _SetFinalePath(FinPath_MusicDir); }
2327
2334 void SetLibFolderPath() { _SetFinalePath(FinPath_LibDir); }
2335
2342 void SetBackupFolderPath() { _SetFinalePath(FinPath_BackupDir); }
2343
2350 void SetAutoSaveFolderPath() { _SetFinalePath(FinPath_AutoSaveDir); }
2351
2358 void SetTemplateFolderPath() { _SetFinalePath(FinPath_TemplateDir); }
2359
2366 void SetTempFolderPath() { _SetFinalePath(FinPath_TempFilesDir); }
2367
2374 void SetFontAnnotationFolderPath() { _SetFinalePath(FinPath_FontAnnotationDir); }
2375
2382 void SetDocStylesFolderPath() { _SetFinalePath(FinPath_DocStylesDir); }
2383
2392 {
2393 _SetFinalePath(FinPath_PercNoteTypesFile);
2394 Replace("\\\\", "\\");
2395 }
2396
2397#if FXT_VERSION >= FINALEVERSION_2012
2404 void SetPreferencesFolderPath() { _SetFinalePath(FinPath_PreferencesDir); }
2405#endif
2406
2416#ifdef PDK_FRAMEWORK_LUAFRIENDLY
2417 void SetRunningLuaFolderPath(lua_State *L);
2418#else
2420#endif
2421
2434#ifdef PDK_FRAMEWORK_LUAFRIENDLY
2435 void SetRunningLuaFilePath(lua_State *L);
2436#else
2437 void SetRunningLuaFilePath();
2438#endif
2439
2440
2445 void Clear() { SetUnicodeString(emptyUniCharStr); }
2446
2455 int Compare(const FCString& value) const
2456 {
2457 const size_t maxSize = (std::max)(GetLength(), value.GetLength());
2458 return std::char_traits<_fcStringChar>::compare(_pStorage, value._pStorage, maxSize);
2459 }
2460
2465 int CompareNoCase(const FCString& value) const
2466 {
2467 /* Please note!!! For some reason, _stricmp/strcasecmp don't
2468 * work correctly. It seems to hang under certain circumstances
2469 * on both platforms. */
2470 FCString string1, string2;
2471 string1.SetString(this);
2472 string2.SetString(&value);
2473 string1.ToLowerCase();
2474 string2.ToLowerCase();
2475 return string1.Compare(string2);
2476 }
2477
2483 bool ContainsString(const FCString& pSubString) const;
2484
2494 [[deprecated]] bool ContainsCString(const char* pszSubString) const
2495 {
2496 FCString substring;
2497 substring.SetCString(pszSubString);
2498 return ContainsString(substring);
2499 }
2500
2507 bool ContainsStringFrom(const FCString& pSubString, int startindex) const;
2508
2517 [[deprecated]]bool ContainsCStringFrom(const char* pszSubString, int startindex) const
2518 {
2519 FCString substring;
2520 substring.SetCString(pszSubString);
2521 return ContainsStringFrom(substring, startindex);
2522 }
2523
2530 int CalcStringPos(const FCString& subString) const
2531 {
2532 /* This method can't be size_t, since it must be able to return -1! */
2533 return CalcStringPosFrom(subString, 0);
2534 }
2535
2542 int CalcLastStringPos(const FCString& subString) const
2543 {
2544 auto pos = _GetBasicStringView().rfind(subString._GetBasicStringView());
2545 if (pos == std::basic_string_view<eUniChar16>::npos)
2546 return -1;
2547 return static_cast<int>(pos);
2548 }
2549
2563 [[deprecated]]int CalcCStringPos([[maybe_unused]]const FCString* pSubString, const char* pszSubString) const
2564 {
2565 /* This method can't return size_t, since it must be able to return -1! */
2566 FCString substring;
2567 substring.SetCString(pszSubString);
2568 return CalcStringPos(substring);
2569 }
2570
2579 int CalcStringPosFrom(const FCString& subString, int startindex) const
2580 {
2581 /* This method can't return size_t, since it must be able to return -1! */
2582 auto pos = _GetBasicStringView().find(subString._GetBasicStringView(), static_cast<size_t>(startindex));
2583 if (pos == std::basic_string_view<eUniChar16>::npos)
2584 return -1;
2585 return static_cast<int>(pos);
2586 }
2587
2599 [[deprecated]]int CalcCStringPosFrom(const char* pszSubString, int startindex) const
2600 {
2601 /* This method can't be size_t, since it must be able to return -1! */
2602 FCString substring;
2603 substring.SetCString(pszSubString);
2604 return CalcStringPosFrom(substring, startindex);
2605 }
2606
2607#if OPERATING_SYSTEM == MAC_OS
2609 void ConvertToPascal(Str255& pascalString);
2610
2612 void _SetCFURLRefPath(CFURLRef cfurl);
2613
2614#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2615 /* For internal use only. Converts a file path to CFURLRef */
2616 CFURLRef _GetPathCFURLRef() const;
2617#endif // DOXYGEN_SHOULD_IGNORE_THIS
2618
2619#endif
2620
2621#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
2629 bool ContainsEnigmaTextInsert(bool only_file_info_inserts = true) const;
2630
2646
2647#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2649 luabridge::RefCountedPtr<FCStrings> CreateEnigmaComponents_GC() const
2650 { return makeLuaSharedPtr(CreateEnigmaComponents()); }
2651#endif
2652
2666 FCStrings* CreateEnigmaStrings(bool include_non_commands = false) const;
2667
2668#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2670 luabridge::RefCountedPtr<FCStrings> CreateEnigmaStrings_GC(bool include_non_commands) const
2671 { return makeLuaSharedPtr(CreateEnigmaStrings(include_non_commands)); }
2672#endif
2673#endif
2674
2684
2685#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2687 luabridge::RefCountedPtr<FCFontInfo> CreateLastFontInfo_GC() const
2688 { return makeLuaSharedPtr(CreateLastFontInfo()); }
2689#endif
2690
2704 FCStrings* CreateParsedStrings(const char* pszSeparators) const;
2705
2706#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2708 luabridge::RefCountedPtr<FCStrings> CreateParsedStrings_GC(const char* pszSeparators) const
2709 { return makeLuaSharedPtr(CreateParsedStrings(pszSeparators)); }
2710#endif
2711
2722 FCStrings* CreateRows() const;
2723
2724#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2726 luabridge::RefCountedPtr<FCStrings> CreateRows_GC() const
2727 { return makeLuaSharedPtr(CreateRows()); }
2728#endif
2729
2741 bool DeleteCodePointAt(int index)
2742 { return DeleteCodePointsAt(index, 1); }
2743
2756 bool DeleteCodePointsAt(int index, int count);
2757
2770 bool DeleteCharacterAt(int index)
2771 { return DeleteCharactersAt(index, 1); }
2772
2785 bool DeleteCharactersAt(int index, int count);
2786
2794 {
2795 int index = (int) GetLength() - 1;
2796 int count = 0;
2797 while (index >= 0)
2798 {
2799 eUniChar16 currentchar = GetCharacterAt(index);
2800 if (currentchar == '.')
2801 {
2802 FCString newstring;
2803 index ++;
2804 while (index < GetLength())
2805 {
2806 newstring.AppendCharacter(GetCharacterAt(index));
2807 index ++;
2808 }
2809 SetString(&newstring);
2810 return;
2811 }
2812 if (currentchar == '/') break;
2813 if (currentchar == '\\') break;
2814 index --;
2815 count ++;
2816 }
2817 Clear();
2818 }
2819
2832 int FindFirst(const char* pszSubStr) const
2833 {
2834 twobyte firstchar = *pszSubStr;
2835 if (!firstchar) return -1;
2836 for (int i = 0; i < GetLength(); i++)
2837 {
2838 twobyte character = this->GetCharacterAt(i);
2839 if (character == firstchar)
2840 {
2841 int j = 1;
2842 bool identical = true;
2843 while (pszSubStr[j])
2844 {
2845 twobyte testchar = pszSubStr[j];
2846 if (this->GetCharacterAt(i + j) != testchar)
2847 {
2848 identical = false;
2849 break;
2850 }
2851 j++;
2852 }
2853 if (identical) return i;
2854 }
2855 }
2856 return -1;
2857 }
2858
2871 int FindLast(const char* pszSubStr) const
2872 {
2873 twobyte firstchar = *pszSubStr;
2874 if (!firstchar) return -1;
2875 int substrlength = (int) strlen(pszSubStr);
2876
2877 for (int i = (int) (GetLength() - substrlength); i >= 0; i--)
2878 {
2879 twobyte character = this->GetCharacterAt(i);
2880 if (character == firstchar)
2881 {
2882 int j = 1;
2883 bool identical = true;
2884 while (pszSubStr[j])
2885 {
2886 twobyte testchar = pszSubStr[j];
2887 if (this->GetCharacterAt(i + j) != testchar)
2888 {
2889 identical = false;
2890 break;
2891 }
2892 j++;
2893 }
2894 if (identical) return i;
2895 }
2896 }
2897 return -1;
2898 }
2899
2900
2901#ifdef PDK_FRAMEWORK_FORMAT
2914 int FormatCStringArgs(const char *fmt, va_list args);
2915
2925 int FormatCString(const char *fmt, ...);
2926
2939 int FormatString(FCString *fmt, ...);
2940#endif
2941
2951 void FormatCharacterNumber(eUniChar32 character);
2952
2959 const char* GetCString() const;
2960
2969 const char* GetLuaString() const; // the Lua connector uses _CFunctionProxyGetter with this function
2970
2971#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
2973 static int GetLuaString_CFunc(lua_State *L)
2974 {
2975 return _CFunctionProxyGetter<FCString, const char *, &FCString::GetLuaString>(L);
2976 }
2977#endif
2978
2980 const char* GetUTF8String() const;
2981
2992 bool CopyToUnicodeBuffer(eUniChar16 *pBuffer, int maxbufferlen = 0) const;
2993
2994#ifndef DOXYGEN_SHOULD_IGNORE_THIS
2996 UTRANSID _StartFinaleEdit() const;
2997
2998 /* \brief For internal use only! Returns the internal UTF-16 buffer for the string. */
2999 eUniChar16* _GetUnicodeBuffer() const;
3000#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
3001
3002#if OPERATING_SYSTEM == MAC_OS
3010 void* GetNSString() const;
3011
3013 void SetNSString(void* pNSString);
3014#endif
3015
3025 int GetInteger(int index = 0) const;
3026
3027#ifdef PDK_FRAMEWORK_LUAFRIENDLY
3028 static int GetInteger_CFunc(lua_State* L)
3029 {
3030 return _CFunctionOneOptionalParameter<FCString, int, int, &FCString::GetInteger>(L, 0);
3031 }
3032#endif
3033
3041 int GetHex() const;
3042
3054 double GetFloat(int index = 0) const;
3055
3075 eUniChar16 GetCharacterAt(int index) const;
3076
3090 std::pair<eUniChar32, int> GetCodePointAt(int index) const;
3091
3092#ifdef PDK_FRAMEWORK_LUAFRIENDLY
3093 static int GetCodePointAt_CFunc(lua_State* L)
3094 {
3095 // argument 1 is `this`
3096 const FCString& selfStr = luabridge::Stack<const FCString&>::get(L, 1) LB3(.value());
3097 int index = luabridge::Stack<int>::get(L, 2) LB3(.value());
3098 auto [codepoint, nextIndex] = selfStr.GetCodePointAt(index);
3099 luabridge::Stack<eUniChar32>::push(L, codepoint) LB3(.throw_on_error());
3100 luabridge::Stack<int>::push(L, nextIndex) LB3(.throw_on_error());
3101 return 2;
3102 }
3103#endif
3104
3109 int GetLength() const { return _length; }
3110
3119 const char* GetEOL() const;
3120
3131 [[deprecated]]void Insert(const char* pszString, int insertindex = 0);
3132
3144 void InsertString(const FCString* pString, int insertindex = 0);
3145
3153 bool IsDigit(int index) const;
3154
3160 bool IsAllDigits() const;
3161
3174 bool IsNumber() const;
3175
3181 [[deprecated]]bool IsEqualCString(const char* pszString) const;
3182
3189 bool IsEqual(const char* pszString) const { return IsEqualString(pszString); }
3190
3196 bool IsEqualString(const FCString& value) const { return value == *this; };
3197
3211 bool IsCharacter(int index, eUniChar32 character) const;
3212
3227 bool IsCharacters(int index, const char *pChars) const;
3228
3233 bool IsEmpty() const { return (GetLength() == 0); }
3234
3242 bool IsWhitespace(int index) const;
3243
3244#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3249 bool IsEnigmaCommand() const
3250 {
3251 if (!IsCharacters(0, "^")) return false;
3252 if (IsCharacters(1, "^")) return false;
3253 return true;
3254 }
3255
3260 bool IsEnigmaFont() const;
3261
3266 bool IsEnigmaFileInfoTitle() const;
3267
3272 bool IsEnigmaFileInfoSubtitle() const;
3273
3278 bool IsEnigmaFileInfoComposer() const;
3279
3284 bool IsEnigmaFileInfoArranger() const;
3285
3290 bool IsEnigmaFileInfoLyricist() const;
3291
3296 bool IsEnigmaFileInfoCopyright() const;
3297
3302 bool IsEnigmaTextInsert(bool only_file_info_inserts = true) const;
3303#endif
3304
3305#if OPERATING_SYSTEM == WINDOWS
3316 bool LoadResource(int resourceID, HINSTANCE dllinstance = 0);
3317#endif
3318#if OPERATING_SYSTEM == MAC_OS
3338 bool LoadResource(const char* resourceID,
3339 const char* pszResourceFileName = NULL,
3340 const char* pszTableName = NULL);
3341#endif
3342
3343#if OPERATING_SYSTEM == WINDOWS
3357 static int LoadIntegerResource(int resourceID, int defaultValue, HINSTANCE dllinstance = 0);
3358#endif
3359#if OPERATING_SYSTEM == MAC_OS
3382 static int LoadIntegerResource(const char* resourceID,
3383 int defaultValue,
3384 const char* pszResourceFileName = NULL,
3385 const char* pszTableName = NULL);
3386#endif
3387
3414 bool MakeSubString(int startindex, int substringlength, FCString* pDestinationString); // no `const` because pDestinationString can be this
3415
3416#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3445 bool ReplaceCategoryFonts(FCCategoryDef* pCategoryDef, int fontmode, bool replacefonttag);
3446#endif
3447
3448
3454 void SetCString(const char* pszBuffer, int maxchars = -1);
3455
3456#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3457#if OPERATING_SYSTEM == WINDOWS
3459 void _SetWCHARString(const WCHAR* pCharBuffer);
3460#endif
3461#endif
3462
3470 void SetLuaString(const char* pszBuffer) { SetUTF8String(pszBuffer); }
3471
3472#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
3474 static int SetLuaString_CFunc(lua_State *L)
3475 {
3476 return _CFunctionProxySetter<FCString, const char *, &FCString::SetLuaString>(L);
3477 }
3478#endif
3479
3481 void SetUTF8String(const char* pszBuffer);
3482
3501 void SetCharacterAt(int index, eUniChar16 newcharacter);
3502
3510 void SetUnicodeString(const eUniChar16 *pChar, int maxchars = -1);
3511
3516 void SetInteger(int i);
3517
3527 void SetHex(int number, int bitwidth);
3528
3531 void SetFloat(double f);
3532
3533#ifdef PDK_FRAMEWORK_PREFS
3544 void SetMeasurement(double value, twobyte unit);
3545
3556 double GetMeasurement(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) unit) const;
3557#endif /* #ifdef PDK_FRAMEWORK_PREFS */
3558
3565 void SetString(const FCString* pString);
3566
3572
3581 bool SetCharacterUpperCase(int index);
3582
3588 {
3589 time_t now = time(0);
3590 struct tm tstruct;
3591 char buf[80];
3592 tstruct = *localtime(&now);
3593 strftime(buf, sizeof(buf), "%X", &tstruct);
3594 SetCString(buf);
3595 }
3596
3609 bool Replace(const char* pszSource, const char* pszReplacement);
3610
3617 bool EndsWith(const char* pszString) const;
3618
3625 bool EndsWithString(const FCString* pString) const;
3626
3633 bool StartsWith(const char* pszString) const;
3634
3641 bool StartsWithString(const FCString* pString) const;
3642
3644 void ToUnicode(eUniChar16* pBuffer, int maxsize) const
3645 {
3646 int len = GetLength();
3647 if (len > maxsize - 1) len = maxsize - 1;
3648 for (int i = 0; i < len; i++) pBuffer[i] = GetCharacterAt(i);
3649 pBuffer[len] = 0;
3650 }
3651
3658 void ToLowerCase();
3659
3666 void ToUpperCase();
3667
3668#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3676 bool TrimEnigmaTags();
3677#endif
3678
3679#ifdef PDK_FRAMEWORK_ENIGMASTRINGS
3696 bool TrimEnigmaFontTags();
3697#endif
3698
3705 void TrimWhitespace();
3706
3713 void TrimLinefeed();
3714
3715
3724 bool TruncateAt(int newlength)
3725 {
3726 if (newlength < 0 || newlength >= GetLength()) return false;
3727 _length = newlength;
3728 _pStorage[_length] = 0; /* Make sure there's a NULL termination in the unicode buffer */
3729 return true;
3730 }
3731
3740 bool TruncateEnd(int count)
3741 {
3742 if (count < 1) return false;
3743 return TruncateAt(GetLength() - count);
3744 }
3745
3751 void TruncateWidth(int maxlength, int prefixchars)
3752 {
3753 if (_length <= maxlength) return;
3754 if (prefixchars + 3 > maxlength) return;
3755 if (prefixchars < -1) return;
3756 FCString resultstring;
3757 for (int i = 0; i < prefixchars; i++)
3758 {
3759 resultstring.AppendCharacter(this->GetCharacterAt(i));
3760 }
3761 resultstring.AppendCString("...");
3762 int startindex = _length - maxlength + prefixchars + 3;
3763 for (int i = startindex; i < _length; i++)
3764 {
3765 resultstring.AppendCharacter(this->GetCharacterAt((int) i));
3766 }
3767 this->SetString(&resultstring);
3768 }
3769
3770#ifndef DOXYGEN_SHOULD_IGNORE_THIS
3775 static EVERSION _GetFinPathVersion();
3776
3783 bool MakeSpecFromFilePath(void *pFinPathSpec, EVERSION convertversion) const;
3784
3791 bool MakeFullFilePath(const void* pFinPathSpec, EVERSION convertversion);
3792
3793#endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
3794
3795#ifdef PDK_FRAMEWORK_DEBUG
3796 void DebugDump() override
3797 {
3799 DebugOutInt("Length: ", (int) _length);
3800 DebugOutInt("Storage length: ", (int) _storagelength);
3801 DebugOutPtr("_pStorage: ", _pStorage);
3802 DebugOutString("String contents: ", GetCString());
3803 }
3804#endif
3805
3806};
3807
3808
3809
3815{
3816 FCString _keystring;
3817 FCString _valuestring;
3818public:
3819 const char* ClassName() const override { return "FCSettingsPair"; }
3820
3827 FCSettingsPair(FCString* pLeftString, FCString* pRightString) : __FCBase()
3828 {
3829 _keystring.SetString(pLeftString);
3830 _keystring.TrimWhitespace();
3831 _valuestring.SetString(pRightString);
3832 _valuestring.TrimWhitespace();
3833 }
3834
3836 FCString* GetKeyString() { return &_keystring; }
3837
3839 FCString* GetValueString() { return &_valuestring; }
3840
3842 void SetValueString(FCString* pString) { _valuestring.SetString(pString); }
3843#ifdef PDK_FRAMEWORK_DEBUG
3844 void DebugDump() override
3845 {
3847 DebugOutString("Key: ", GetKeyString());
3848 DebugOutString("Value: ", GetValueString());
3849 }
3850#endif
3851};
3852
3853
3854#ifdef PDK_FRAMEWORK_ENTRIES
3855class FCNoteEntry;
3856#endif
3857
3858class FCCell;
3859
3871{
3872 bool _loaded;
3873
3874 EMeasureMetrics2009a _metrics;
3875
3876 // This value remains global because it is a global condition in Finale. Whichever concurrently
3877 // running script sets it, the next internal call to metrics will rebuild them.
3878 static bool _metricsshouldupdate;
3879
3880public:
3881 const char* ClassName() const override { return "FCCellMetrics"; }
3882
3889 {
3890 memset(&_metrics, 0, sizeof(_metrics));
3891 _loaded = false;
3892 }
3893
3894 virtual ~FCCellMetrics()
3895 {
3896 FreeMetrics();
3897 }
3898
3904 static void MarkMetricsForRebuild() { _metricsshouldupdate = true; }
3905
3914 bool LoadAtCell(FCCell* pCell);
3915
3916#ifdef PDK_FRAMEWORK_ENTRIES
3922 bool LoadAtEntry(FCNoteEntry* pEntry);
3923#endif
3924
3932 {
3933 return _metrics.measMetrics.horzPercent;
3934 }
3935
3946 Evpu32 GetTopStafflinePos() const
3947 {
3948 return _metrics.measMetrics.fipTopStaffLine;
3949 }
3950
3962 {
3963 return _metrics.measMetrics.fipBottom;
3964 }
3965
3973 Evpu32 GetReferenceLinePos() const
3974 {
3975 return _metrics.measMetrics.fipTop;
3976 }
3977
3982 Int100 GetStaffScaling() const
3983 {
3984 return _metrics.measMetrics.lperc;
3985 }
3986
3991 Int100 GetSystemScaling() const
3992 {
3993 return _metrics.measMetrics.percent;
3994 }
3995
4002 {
4003 return _metrics.attachCount;
4004 }
4005
4012 {
4013 return _metrics.measMetrics.meposadj;
4014 }
4015
4022 int GetLeftEdge() const
4023 {
4024 return _metrics.leftEdge;
4025 }
4026
4031 int GetWidth() const
4032 {
4033 return _metrics.measMetrics.mewidth;
4034 }
4035
4040 int GetMusicWidth() const
4041 {
4042 return _metrics.measMetrics.scalewidth;
4043 }
4044
4050 {
4051 return _metrics.measMetrics.frontRepWidth;
4052 }
4053
4059 {
4060 return _metrics.measMetrics.backRepWidth;
4061 }
4062
4069 {
4070 return _metrics.measMetrics.barWidth;
4071 }
4072
4077 int GetStaffSystem() const
4078 {
4079 return _metrics.measMetrics.ssys;
4080 }
4081
4087 Evpu32 GetSystemTopPos() const
4088 {
4089 return _metrics.measMetrics.ssysTop;
4090 }
4091
4097 Evpu32 GetSlotNumber() const
4098 {
4099 return _metrics.measMetrics.slot;
4100 }
4101
4116 bool GetAttachment(__FCBaseData* pBaseDataObject, fourbyte the_id, EAttachment* pAttachment, bool stop = false)
4117 {
4118 if (_metrics.attachCount == 0) return false;
4119 for (int i = 0; i < _metrics.attachCount; i++)
4120 {
4121 EAttachment* pTest = &_metrics.pAttach[i];
4122 if (pTest->tag != pBaseDataObject->Tag()) continue;
4123 if (pTest->id != the_id) continue;
4124 if (stop)
4125 {
4126 if (!GetBitFlag(pTest->flags, EATTACH_STOP_SHAPE)) continue;
4127 }
4128 memcpy(pAttachment, pTest, sizeof(EAttachment));
4129 return true;
4130 }
4131 return false;
4132 }
4133
4150 void FreeMetrics();
4151
4152#ifdef PDK_FRAMEWORK_DEBUG
4153 void DebugDump() override
4154 {
4156 DebugOutInt("Horizontal stretch: ", GetHorizontalStretch());
4157 }
4158#endif
4159};
4160
4161
4162#ifdef PDK_FRAMEWORK_ENTRIES
4172{
4173 bool _directaccess; /* If true, Load() and FreeMetrics() will not work. The data was copied through _EnableDirectAccessMode(). */
4174 ENTNUM _directaccess_entnum; /* The connected entry ID in direct access mode */
4175
4176 bool _loaded;
4177 EEntryMetrics2009a _metrics2009a;
4178#if FXT_VERSION >= FINALEVERSION_2014
4179 EEntryMetrics2014 _metrics2014;
4180#endif
4181
4182 // This value remains global because it is a global condition in Finale. Whichever concurrently
4183 // running script sets it, the next internal call to metrics will rebuild them.
4184 static bool _updatemetrics;
4185
4187 EVERSION _VersionToUse() const;
4188
4192 EEntryMetrics2009a* _GetBasicMetricsPtr() const
4193 {
4194#if FXT_VERSION >= FINALEVERSION_2014
4195 if (_VersionToUse() == FINALEVERSION_2014)
4196 return (EEntryMetrics2009a*) &_metrics2014;
4197 else
4198#endif
4199 return (EEntryMetrics2009a*) &_metrics2009a;
4200
4201 }
4202public:
4203 const char* ClassName() const override { return "FCEntryMetrics"; }
4204
4210
4211#ifndef DOXYGEN_SHOULD_IGNORE_THIS
4212 /* For internal use only. If this method is used, it should be called immediatelly after the constructor. */
4213 void _EnableDirectAccessMode(EEntryMetrics2014* pMetrics, ENTNUM entrynumber);
4214
4215 /* For internal use only. Only used in direct access mode. */
4216 ENTNUM _GetConnectedEntryNumber() { return _directaccess_entnum; }
4217#endif // DOXYGEN_SHOULD_IGNORE_THIS
4218
4219 virtual ~FCEntryMetrics()
4220 {
4221 FreeMetrics();
4222 }
4223
4229 static void MarkMetricsForRebuild() { _updatemetrics = true; }
4230
4238 bool Load(const FCNoteEntry* pEntry);
4239
4248 int CalcLeftmostNotePosition();
4249
4256 {
4257 return _GetBasicMetricsPtr()->attachCount;
4258 }
4259
4274 bool GetAttachment(__FCBaseData* pBaseDataObject, fourbyte the_id, EAttachment* pAttachment, bool stop = false)
4275 {
4276 if (_GetBasicMetricsPtr()->attachCount == 0) return false;
4277 for (int i = 0; i < _GetBasicMetricsPtr()->attachCount; i++)
4278 {
4279 EAttachment* pTest = &_GetBasicMetricsPtr()->pAttach[i];
4280 if (pTest->tag != pBaseDataObject->Tag()) continue;
4281 if (pTest->id != the_id) continue;
4282 if (stop)
4283 {
4284 if (!GetBitFlag(pTest->flags, EATTACH_STOP_SHAPE)) continue;
4285 }
4286 memcpy(pAttachment, pTest, sizeof(EAttachment));
4287 return true;
4288 }
4289 return false;
4290 }
4291
4292
4297 int GetTopPosition() const
4298 {
4299 if (_GetBasicMetricsPtr()->headRect.top > _GetBasicMetricsPtr()->stemRect.top) return _GetBasicMetricsPtr()->headRect.top;
4300 return _GetBasicMetricsPtr()->stemRect.top;
4301 }
4302
4308 {
4309 if (_GetBasicMetricsPtr()->headRect.bottom < _GetBasicMetricsPtr()->stemRect.bottom) return _GetBasicMetricsPtr()->headRect.bottom;
4310 return _GetBasicMetricsPtr()->stemRect.bottom;
4311 }
4312
4319 {
4320 return _GetBasicMetricsPtr()->stemRect.bottom;
4321 }
4322
4329 {
4330 return _GetBasicMetricsPtr()->stemRect.top;
4331 }
4332
4339 {
4340 return _GetBasicMetricsPtr()->headRect.left;
4341 }
4342
4349 {
4350 return _GetBasicMetricsPtr()->headRect.right;
4351 }
4352
4359 {
4360 return _GetBasicMetricsPtr()->stemRect.left;
4361 }
4362
4369 {
4370 return _GetBasicMetricsPtr()->stemRect.right;
4371 }
4372
4379 {
4380 return _GetBasicMetricsPtr()->lastDot;
4381 }
4382
4390 {
4391 return _GetBasicMetricsPtr()->firstAcci;
4392 }
4393
4396 {
4397 return _GetBasicMetricsPtr()->entryFlags;
4398 }
4399
4401 ENoteMetrics* FindNoteMetrics(twobyte noteID);
4402
4403#if FXT_VERSION >= FINALEVERSION_2014
4405 ENoteMetrics2014* FindNoteMetrics2014(twobyte noteID);
4406#endif
4407
4413 int GetNoteCount() const
4414 {
4415 return _GetBasicMetricsPtr()->numNotes;
4416 }
4417
4429 int GetNoteLeftPosition(int index) const;
4430
4439 int GetNoteWidth(int index) const;
4440
4452 int GetNoteCenterVerticalPos(int index) const;
4453
4462 eNoteID GetNoteID(int index) const;
4463
4468 JWERECT* GetStemRect()
4469 {
4470 if (!_loaded) return NULL;
4471 return &_GetBasicMetricsPtr()->stemRect;
4472 }
4473
4479 {
4480 if (!_loaded) return NULL;
4481 return &_GetBasicMetricsPtr()->headRect;
4482 }
4483
4500 void FreeMetrics();
4501
4502#ifdef PDK_FRAMEWORK_DEBUG
4503 void DebugDump() override
4504 {
4506 }
4507#endif
4508};
4509#endif
4510
4511
4512
4513class FCArticulationDef;
4514
4525{
4526#if FXT_VERSION >= FINALEVERSION_25
4527 ETextMetrics _textMetrics;
4528#endif
4529public:
4530
4537
4560 bool LoadString(const FCString* pText, const FCFontInfo* pFont, double percent);
4561
4576 bool LoadSymbol(eUniChar16 symbolchar, FCFontInfo* pFont, double percent);
4577
4596 bool LoadArticulation(FCArticulationDef* pArticDef, bool flipped, double percent);
4597
4604 void CopyFrom(FCTextMetrics* pTextMetrics);
4605
4620 double GetAdvanceWidthPoints() const {
4621#if FXT_VERSION >= FINALEVERSION_25
4622 return _textMetrics.width;
4623#else
4624 return 0;
4625#endif
4626 }
4627
4639 double GetLeftPoints() const {
4640#if FXT_VERSION >= FINALEVERSION_25
4641 return _textMetrics.left;
4642#else
4643 return 0;
4644#endif
4645 }
4646
4658 double GetRightPoints() const {
4659#if FXT_VERSION >= FINALEVERSION_25
4660 return _textMetrics.right;
4661#else
4662 return 0;
4663#endif
4664 }
4665
4677 double GetTopPoints() const {
4678#if FXT_VERSION >= FINALEVERSION_25
4679 return _textMetrics.top;
4680#else
4681 return 0;
4682#endif
4683 }
4684
4696 double GetBottomPoints() const {
4697#if FXT_VERSION >= FINALEVERSION_25
4698 return _textMetrics.bottom;
4699#else
4700 return 0;
4701#endif
4702 }
4703
4712 double GetAdvanceWidthEVPUs() const {
4713#if FXT_VERSION >= FINALEVERSION_25
4714 return _textMetrics.eWidth;
4715#else
4716 return 0;
4717#endif
4718 }
4719
4727 double GetLeftEVPUs() const {
4728#if FXT_VERSION >= FINALEVERSION_25
4729 return _textMetrics.eLeft;
4730#else
4731 return 0;
4732#endif
4733 }
4734
4742 double GetRightEVPUs() const {
4743#if FXT_VERSION >= FINALEVERSION_25
4744 return _textMetrics.eRight;
4745#else
4746 return 0;
4747#endif
4748 }
4749
4757 double GetTopEVPUs() const {
4758#if FXT_VERSION >= FINALEVERSION_25
4759 return _textMetrics.eTop;
4760#else
4761 return 0;
4762#endif
4763 }
4764
4772 double GetBottomEVPUs() const {
4773#if FXT_VERSION >= FINALEVERSION_25
4774 return _textMetrics.eBottom;
4775#else
4776 return 0;
4777#endif
4778 }
4779
4792#if FXT_VERSION >= FINALEVERSION_25
4793 return GetTopPoints()-GetBottomPoints();
4794#else
4795 return 0;
4796#endif
4797 }
4798
4811#if FXT_VERSION >= FINALEVERSION_25
4812 return GetRightPoints()-GetLeftPoints();
4813#else
4814 return 0;
4815#endif
4816 }
4817
4826#if FXT_VERSION >= FINALEVERSION_25
4827 return GetTopEVPUs()-GetBottomEVPUs();
4828#else
4829 return 0;
4830#endif
4831 }
4832
4841#if FXT_VERSION >= FINALEVERSION_25
4842 return GetRightEVPUs()-GetLeftEVPUs();
4843#else
4844 return 0;
4845#endif
4846 }
4847
4848 const char* ClassName() const override { return "FCTextMetrics"; }
4849
4850#ifdef PDK_FRAMEWORK_DEBUG
4851 void DebugDump() override
4852 {
4854 DebugOutFloat("Advance Width: ", GetAdvanceWidthPoints());
4855 DebugOutFloat("Left: ", GetLeftPoints());
4856 DebugOutFloat("Right: ", GetRightPoints());
4857 DebugOutFloat("Top: ", GetTopPoints());
4858 DebugOutFloat("Bottom: ", GetBottomPoints());
4859
4860 DebugOutFloat("Advance Width EVPU: ", GetAdvanceWidthEVPUs());
4861 DebugOutFloat("Left EVPU: ", GetLeftEVPUs());
4862 DebugOutFloat("Right EVPU: ", GetRightEVPUs());
4863 DebugOutFloat("Top EVPU: ", GetTopEVPUs());
4864 DebugOutFloat("Bottom EVPU: ", GetBottomEVPUs());
4865 }
4866#endif
4867};
4868
4869
4874class FCNumber : public __FCBase
4875{
4876 int _intvalue;
4877 double _floatvalue;
4878 public:
4879 const char* ClassName() const override { return "FCNumber"; }
4880 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_NUMBER; }
4881
4888 FCNumber(double value) : __FCBase()
4889 {
4890 /* A separate int and double curbs precision issues that cause unexpected rounding near integers. */
4891 _intvalue = static_cast<int>(value);
4892 _floatvalue = value;
4893 }
4894
4899 void SetInt(int value)
4900 {
4901 _intvalue = value;
4902 _floatvalue = static_cast<double>(value);
4903 }
4904
4909 void SetFloat(double value)
4910 {
4911 _intvalue = static_cast<int>(value);
4912 _floatvalue = value;
4913 }
4914
4919 int GetInt() const { return _intvalue; }
4920
4925 double GetFloat() const { return _floatvalue; }
4926
4927
4928#ifdef PDK_FRAMEWORK_DEBUG
4929 void DebugDump() override
4930 {
4932 DebugOutFloat("Floating value", _floatvalue);
4933 DebugOutInt("Integer value: ", _intvalue);
4934 }
4935#endif
4936};
4937
4938
4945class FCPoint : public __FCBase
4946{
4947 double _x;
4948 double _y;
4949public:
4950 const char* ClassName() const override { return "FCPoint"; }
4951
4956 FCPoint(double x, double y) : __FCBase(), _x(x), _y(y) {}
4957
4958#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
4963 static int FCPoint_tostring(lua_State* L)
4964 {
4965 FCPoint* pThis = luabridge::Stack<FCPoint*>::get(L, 1) LB3(.value());
4966 FCString strX; strX.SetMeasurement(pThis->GetX(), UNIT_EVPUS);
4967 FCString strY; strY.SetMeasurement(pThis->GetY(), UNIT_EVPUS);
4968 std::string s = std::string(pThis->ClassName()) + ": (" + strX.GetLuaString() + ", " + strY.GetLuaString() + ")";
4969 luabridge::Stack<std::string>::push(L, s).throw_on_error();
4970 return 1;
4971 }
4972#endif
4973
4978 void SetX(double value) { _x = value; }
4979
4984 void SetY(double value) { _y = value; }
4985
4990 double GetX() const { return _x; }
4991
4996 double GetY() const { return _y; }
4997
5002 void MoveX(double value) { _x += value; }
5003
5008 void MoveY(double value) { _y += value; }
5009};
5010
5011
5012
5013class FCDocument;
5014
5023{
5024 FinPrintSettings _settings;
5025public:
5026 const char* ClassName() const override { return "FCPrintSettings"; }
5027
5034 {
5036 PRINTODDEVEN_ALL = 0,
5037
5039 PRINTODDEVEN_ODD = 1,
5040
5042 PRINTODDEVEN_EVEN = 2
5044
5052 {
5053 _settings.copies = 1;
5054 _settings.startPage = 1;
5055 _settings.endPage = 1000;
5056 }
5057
5058 /* Getters */
5059
5064 twobyte GetCopyCount() const { return _settings.copies; }
5065
5070 bool GetColor() const { return _settings.bPrintColor != 0; }
5071
5076 twobyte GetStartPage() const { return _settings.startPage; }
5077
5082 twobyte GetEndPage() const { return _settings.endPage; }
5083
5088 bool GetReverse() const { return _settings.reverse != 0; }
5089
5094 bool GetDrawCropMarks() const { return _settings.cropMarks != 0; }
5095
5100 bool GetDrawRegistrationMarks() const { return _settings.regMarks != 0; }
5101
5106 bool GetDrawFileName() const { return _settings.regFileName != 0; }
5107
5112 bool GetTile() const { return _settings.tile != 0; }
5113
5118 twobyte GetLayoutCount() const { return _settings.nUp; }
5119
5124 Evpu32 GetTileOverlap() const { return _settings.userOverlap; }
5125
5130 bool GetFitWithinMargins() const { return _settings.bFitWithinMargins != 0; }
5131
5138#ifndef PDK_FRAMEWORK_LUAFRIENDLY
5139 PRINTODDEVENMODES
5140#else
5141 twobyte
5142#endif
5143 GetOddEvenMode() const { return (PRINTODDEVENMODES) _settings.oddEven; }
5144
5149 const char* GetPageRangeString() const
5150 {
5151 return _settings.pageRangeString;
5152 }
5153
5154 /* Setters */
5155
5162 void SetCopyCount(twobyte copies)
5163 {
5164 if (copies < 0) return;
5165 if (copies > 100) return;
5166 _settings.copies = copies;
5167 }
5168
5173 void SetColor(bool state) { _settings.bPrintColor = state; }
5174
5179 void SetStartPage(twobyte startpage)
5180 {
5181 if (startpage < 1) return;
5182 _settings.startPage = startpage;
5183 }
5184
5189 void SetEndPage(twobyte endpage)
5190 {
5191 if (endpage < 1) return;
5192 _settings.endPage = endpage;
5193 }
5194
5199 void SetReverse(bool state) { _settings.reverse = state; }
5200
5205 void SetDrawCropMarks(bool state) { _settings.cropMarks = state; }
5206
5211 void SetDrawRegistrationMarks(twobyte state) { _settings.regMarks = state; }
5212
5217 void SetDrawFileName(bool state) { _settings.regFileName = state; }
5218
5223 void SetTile(bool state) { _settings.tile = state; }
5224
5231 void SetLayoutCount(twobyte count)
5232 {
5233 switch (count) {
5234 case 0:
5235 case 1:
5236 case 2:
5237 case 4:
5238 _settings.nUp = count;
5239 break;
5240 default:
5241 break;
5242 }
5243 }
5244
5249 void SetTileOverlap(Evpu32 value)
5250 {
5251 if (value < 0) return;
5252 _settings.userOverlap = value;
5253 }
5254
5259 void SetFitWithinMargins(bool state) { _settings.bFitWithinMargins = state; }
5260
5268#ifndef PDK_FRAMEWORK_LUAFRIENDLY
5270#else
5271 twobyte
5272#endif
5273 value
5274 )
5275 {
5276 switch (value)
5277 {
5278 case PRINTODDEVEN_ALL:
5279 case PRINTODDEVEN_EVEN:
5280 case PRINTODDEVEN_ODD:
5281 _settings.oddEven = value;
5282 break;
5283 default:
5284 break;
5285 }
5286 }
5287
5292 void SetPageRangeString(const char* pszString)
5293 {
5294 if (!pszString) return;
5295 strncpy(_settings.pageRangeString, pszString, sizeof(_settings.pageRangeString));
5296 _settings.pageRangeString[sizeof(_settings.pageRangeString) - 1] = 0;
5297 }
5298
5299
5300 /* Misc methods */
5301
5309 bool PrintCurrent();
5310
5320 bool PrintDocument(FCDocument* pDocument);
5321};
5322
5323
5324
5325
5333{
5334 ufourbyte _glyphnumber; /* The glyph number that should be loaded. */
5335 float _height, _width, _left, _bottom;
5336 float _maxascent, _maxdescent;
5337public:
5340 {
5341 _glyphnumber = 0;
5342 _height = _width = 0;
5343 _left = _bottom = 0;
5344 _maxascent = _maxdescent = 0;
5345 };
5346
5356 bool LoadInfo(FCFontInfo* pFontInfo, ufourbyte glyphno);
5357
5362 void _SetHeight(float h) { _height = h; }
5363
5368 void _SetWidth(float w) { _width = w; }
5369
5374 void _SetLeft(float l) { _left = l; }
5375
5380 void _SetBottom(float b) { _bottom = b; }
5381
5386 void _SetMaxAscent(float b) { _maxascent = b; }
5387
5392 void _SetMaxDescent(float b) { _maxdescent = b; }
5393
5394 /***********/
5395 /* GETTERS */
5396 /***********/
5397
5402 ufourbyte GetGlyphNumber() { return _glyphnumber; }
5403
5408 float GetWidth() { return _width; }
5409
5414 float GetHeight() const { return _height; }
5415
5420 float GetLeft() const { return _left; }
5421
5428 float GetBottom() const { return _bottom; }
5429
5438 float GetRight() const { return _left+_width; }
5439
5449 float GetTop() const { return _bottom+_height; }
5450
5459 float GetMaxAscent() { return _maxascent; }
5460
5469 float GetMaxDescent() { return _maxdescent; }
5470
5471#ifdef PDK_FRAMEWORK_DEBUG
5472 void DebugDump() override
5473 {
5475 DebugOutHex("Glyph Number: ", GetGlyphNumber());
5476 DebugOutFloat("Width: ", GetWidth());
5477 DebugOutFloat("Height: ", GetHeight());
5478 DebugOutFloat("Left: ", GetLeft());
5479 DebugOutFloat("Bottom: ", GetBottom());
5480 DebugOutFloat("Max Ascender: ", GetMaxAscent());
5481 DebugOutFloat("Max Descender: ", GetMaxDescent());
5482 }
5483#endif
5484};
5485
5486
5500{
5501 FCUI* _pUI;
5502 FCFontInfo* _pUserFontInfo;
5503 FCString _samplestring;
5504 bool _usesizes;
5505 bool _usestyles;
5506
5507public:
5508 const char* ClassName() const override { return "FCFontDialog"; }
5509
5519 FCFontDialog(FCUI* pUI, FCFontInfo* pFontInfo) : __FCBase()
5520 {
5521 _pUI = pUI;
5522 _pUserFontInfo = pFontInfo;
5523 _usesizes = true;
5524 _usestyles = true;
5525 }
5526
5527 /* GETTERS */
5528
5535 bool GetUseSizes() const { return _usesizes; }
5536
5543 bool GetUseStyles() const { return _usestyles; }
5544
5553 FCFontInfo* GetFontInfo() const { return _pUserFontInfo; }
5554
5562 {
5563 if (!pString) return;
5564 pString->SetString(&_samplestring);
5565 }
5566
5567 /* SETTERS */
5568
5575 void SetUseSizes(bool state) { _usesizes = state; }
5576
5583 void SetUseStyles(bool state) { _usestyles = state; }
5584
5596 void SetFontInfo(FCFontInfo* pFontInfo) { _pUserFontInfo = pFontInfo; }
5597
5604 void SetSampleString(FCString* pString) { _samplestring.SetString(pString); }
5605
5616 bool Execute();
5617};
5618
5623class FCRange : public __FCBase
5624{
5625private:
5626 int _start;
5627 int _length;
5628
5629public:
5630 const char* ClassName() const override { return "FCRange"; }
5631
5639 FCRange(int start = 0, int length = 0) : __FCBase(), _start(start), _length(length) {}
5640
5641#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
5643 static FCRange* FCRange_Lua(void* ptr, lua_State *L)
5644 {
5645 const int numArgs = lua_gettop(L);
5646 const int start = (numArgs <= 2) ? 0 : luabridge::Stack<int>::get(L, 2) LB3(.value());
5647 const int length = (numArgs <= 3) ? 0 : luabridge::Stack<int>::get(L, 3) LB3(.value());;
5648 return new(ptr) FCRange(start, length);
5649 }
5650#endif
5651
5652#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
5657 static int FCRange_tostring(lua_State* L)
5658 {
5659 FCRange* pThis = luabridge::Stack<FCRange*>::get(L, 1) LB3(.value());
5660 std::string s = std::string(pThis->ClassName()) + ": (" + std::to_string(pThis->GetStart()) + ", " + std::to_string(pThis->GetLength()) + ")";
5661 luabridge::Stack<std::string>::push(L, s).throw_on_error();
5662 return 1;
5663 }
5664#endif
5665
5670 int GetStart() const { return _start; }
5671
5676 int GetLength() const { return _length; }
5677
5683 int GetEnd() const { return _start + _length; }
5684
5689 void SetStart(int val) { _start = val; }
5690
5695 void SetLength(int val) { _length = val; }
5696};
5697
5698#endif /* _FF_BASE_H */
Base class for all data-related classes (that handles Finale data).
Definition ff_base.h:677
CMPER GetRawOtherCmper() const
Returns the current EDataID interpreted as other.cmper.
Definition ff_base.h:1102
virtual twobyte CalcLastInci()
For internal use only!
Definition ff_base.h:756
virtual void Deallocate()
Definition ff_base.h:726
EXTAG GetRawTag() const
Returns the currently active EXTAG for this object.
Definition ff_base.h:1096
void ClearData()
Definition finaleframework.cpp:1323
EXTAG GetCustomTag() const
Returns the custom Enigma tag, if any.
Definition ff_base.h:871
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:1020
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:1311
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:828
twobyte GetRawOtherInci() const
Returns the current EDataID interpreted as other.inci.
Definition ff_base.h:1108
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:1414
const void * GetDataBlock()
Intended ONLY for the _CloneFrom implementation.
Definition ff_base.h:861
__FCBaseData()
The constructor.
Definition finaleframework.cpp:1216
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:931
EDataID _dataid
The EdataID for the last loaded/saved object.
Definition ff_base.h:713
virtual bool LoadPrevious()
Loads the previous element in the database, if any.
Definition ff_base.h:962
EDOCID GetConnectedDocID() const
Returns the document ID that was connected to the last load/save of the data.
Definition ff_base.h:788
bool DataIsLoaded() const
Returns true is any data has been loaded into the object.
Definition ff_base.h:771
CMPER GetRawDetailCmper2() const
Returns the current EDataID interpreted as detail.cmper2.
Definition ff_base.h:1120
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:1349
void _CloneFrom(__FCBaseData *pSource)
For internal use only. Copies object data (except data block) from another object.
Definition finaleframework.cpp:1256
void SetCustomTag(EXTAG tag)
Sets the custom Enigma tag, for classes that support multiple Enigma tags.
Definition ff_base.h:883
twobyte GetRawDetailInci() const
Returns the current EDataID interpreted as detail.inci.
Definition ff_base.h:1126
void * _datablock
Pointer to the object's data block, the meaning is implementation-specific for each derived subclass.
Definition ff_base.h:696
virtual EVERSION EnigmaVersion() const
The Enigma version for save/load/create/delete operations.
Definition ff_base.h:813
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:1344
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:855
__FCBaseData * CreateClone()
Creates an identical copy of an object.
Definition finaleframework.cpp:1303
const EDataID * _GetDataID()
Intended ONLY for the _CloneFrom implementation.
Definition ff_base.h:849
virtual bool DeleteData()
Deletes the associated data from Finale's database. Be careful when deleting multiple objects.
Definition finaleframework.cpp:1339
virtual bool IsDynamicSize()
Definition ff_base.h:734
CMPER GetRawDetailCmper1() const
Returns the current EDataID interpreted as detail.cmper1.
Definition ff_base.h:1114
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:1007
virtual bool LoadNext()
Loads the next element from the database, if any.
Definition finaleframework.cpp:1408
virtual ~__FCBaseData()
Virtual destructor.
Definition finaleframework.cpp:1226
bool _heapdatablock
Variable that tells if _datablock is dynamically created on the heap (and should be deleted at object...
Definition ff_base.h:700
virtual void CloneMemoryFrom(__FCBaseData *pSource)
Definition finaleframework.cpp:1266
void _TagDocumentID()
For internal use only.
Definition finaleframework.cpp:1236
bool RelinkToCurrentView()
Relinks the contents in the current view so that the score and part(s) match.
Definition finaleframework.cpp:1285
virtual bool Save()
Saves the currently loaded to its current location.
Definition finaleframework.cpp:1379
ENTNUM GetRawEntryDetailEntryNumber() const
Returns the current EDataID interpreted as entryDetail.entryNumber.
Definition ff_base.h:1135
EDOCID _connecteddocID
The "connected" document ID., which is the document the where the document was loaded (or last saved)...
Definition ff_base.h:692
twobyte GetRawEntryDetailInci() const
Returns the current EDataID interpreted as entryDetail.inci.
Definition ff_base.h:1141
void DebugDataDump() override
Outputs a memory dump of the data block in the object for debugging purposes.
Definition ff_base.h:1014
bool RelinkToScore()
Relinks all parts to the contents of the score.
Definition finaleframework.cpp:1294
virtual bool LoadLast()
Loads the very last element in the database, if any.
Definition ff_base.h:950
bool VerifyConnectedDocID()
Checks that the stored document ID for the data object matches the current document's ID.
Definition finaleframework.cpp:1241
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:1367
int _loadedsize
Loaded size of the data block for a loaded object, in bytes. Since the datablock is implementation-sp...
Definition ff_base.h:709
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:1177
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:727
void SetUserData2(void *pData)
Sets the additional user data attached to the instance of an object.
Definition ff_base.h:511
bool ReadXML_String(tinyxml2::XMLElement *pParentNode, const char *pszElementName, FCString *pStringValue)
Helper method to read FCString objects from the XML file.
Definition finaleframework.cpp:1149
__FCBase()
The constructor.
Definition ff_base.h:279
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:1201
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:864
int GetBitCount(FLAG_32 flag)
Returns the total number of set bits in a 32-bit unsigned int.
Definition finaleframework.cpp:1079
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:832
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:1193
int DebugOutFormat(const char *fmt,...)
Outputs debug text using C style "printf" syntax.
Definition finaleframework.cpp:1021
void StoreXML_String(tinyxml2::XMLElement *pParentNode, const char *pszElementName, FCString *pStringValue)
Helper function to store FCString objects in the XML file.
Definition finaleframework.cpp:1101
void Set16BitFlag(FLAG_16 *flag, FLAG_16 flagbits, bool state)
Sets a 16 bit flag.
Definition finaleframework.cpp:1063
void StoreXML_Integer(tinyxml2::XMLElement *pParentNode, const char *pszElementName, int value)
Helper function to store integer objects in the XML file.
Definition finaleframework.cpp:1109
void DebugMsg(const char *pszMsg)
Creates a simple Message Box for debug purposes with just one text string.
Definition finaleframework.cpp:738
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:202
void * GetUserData2() const
Gets the additional user data attached to the instance of an object.
Definition ff_base.h:525
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:778
void SetUserData(void *pData)
Sets the user data attached to the instance of an object.
Definition ff_base.h:504
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:1185
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:540
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:1139
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:763
void Set32BitFlag(FLAG_32 *flag, FLAG_32 flagbits, bool state)
Sets/resets a 32 bit flag, by using a bit mask.
Definition finaleframework.cpp:1071
MEASUREMENTUNITS
Constants for Finale's standard measurement units.
Definition ff_base.h:244
@ MEASUREMENTUNIT_EVPUS
Definition ff_base.h:249
@ MEASUREMENTUNIT_CENTIMETERS
Definition ff_base.h:255
@ MEASUREMENTUNIT_DEFAULT
Definition ff_base.h:246
@ MEASUREMENTUNIT_MILLIMETERS
Definition ff_base.h:267
@ MEASUREMENTUNIT_SPACES
Definition ff_base.h:264
@ MEASUREMENTUNIT_POINTS
Definition ff_base.h:258
@ MEASUREMENTUNIT_PICAS
Definition ff_base.h:261
@ MEASUREMENTUNIT_INCHES
Definition ff_base.h:252
bool ReadXML_Bool(tinyxml2::XMLElement *pParentNode, const char *pszElementName, bool *pValue)
Helper method to read boolean objects from the XML file.
Definition finaleframework.cpp:1169
static void DebugOut(const char *pszLine)
Static method to output a line of text for debugging purposes.
Definition finaleframework.cpp:954
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:486
void * GetUserData() const
Gets the user data attached to the instance of an object.
Definition ff_base.h:518
void StoreXML_Bool(tinyxml2::XMLElement *pParentNode, const char *pszElementName, bool value)
Helper function to store boolean objects in the XML file.
Definition finaleframework.cpp:1119
virtual ~__FCBase()
Virtual destructor, so all inherited classes get the virtual destructor.
Definition ff_base.h:293
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:1091
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:1037
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:705
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:771
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:839
virtual bool ReadFromXML(tinyxml2::XMLElement *pParentNode)
Virtual method that is used to read object data.
Definition ff_base.h:664
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:747
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:1144
virtual void StoreToXML(tinyxml2::XMLElement *pParentNode)
Virtual method that is used to store an object's data.
Definition ff_base.h:597
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:879
virtual void DebugDataDump()
Outputs a memory dump of the data block in the object for debugging purposes.
Definition finaleframework.cpp:1045
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:978
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:716
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:908
bool ReadXML_Integer(tinyxml2::XMLElement *pParentNode, const char *pszElementName, int *pValue)
Helper method to read integer objects from the XML file.
Definition finaleframework.cpp:1161
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:229
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:1129
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:886
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:1134
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:1052
An inci subrecord class for multi-inci data.
Definition ff_base.h:1150
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:1152
bool Load(CMPER cmper, twobyte inci)
Loads an object from a specific cmper/inci location.
Definition finaleframework.cpp:1434
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:3871
int GetWidth() const
Returns the total width of the cell, at system scaling.
Definition ff_base.h:4031
int GetMusicStartPos() const
Returns position where the music starts in the cell (after the key/clef/repeats), at system scaling.
Definition ff_base.h:4011
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:4087
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4153
Evpu32 GetReferenceLinePos() const
Returns the position of the reference line of the staff. The coordinate is referenced from the bottom...
Definition ff_base.h:3973
int GetStaffSystem() const
Returns the staff system number for the cell.
Definition ff_base.h:4077
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:4116
Int100 GetStaffScaling() const
Returns the accumulated staff scaling for the staff, in 100th of a percent.
Definition ff_base.h:3982
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:3881
int GetBackRepeatWidth() const
Returns the width of the back repeat for the cell.
Definition ff_base.h:4058
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:3961
int GetAttachmentCount() const
Returns the number of attachments that has info within the metrics data.
Definition ff_base.h:4001
int GetLeftEdge() const
Returns the left position of the cell cell (before the key/clef/repeat), at system scaling.
Definition ff_base.h:4022
Int100 GetSystemScaling() const
Returns the accumulated system scaling, in 100th of a percent.
Definition ff_base.h:3991
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:3946
int GetRightBarlineWidth() const
Returns the combined total width of the right barline, including double or final barlines and the gap...
Definition ff_base.h:4068
int GetFrontRepeatWidth() const
Returns the width of the front repeat for the cell.
Definition ff_base.h:4049
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:4097
static void MarkMetricsForRebuild()
Static method that sets the flag that the metrics should be rebuilt on the next load.
Definition ff_base.h:3904
int GetMusicWidth() const
Returns the width of the music part of the cell, at system percent.
Definition ff_base.h:4040
FCCellMetrics()
The constructor. Defaults to unloaded. Metrics must be loaded with LoadAtCell or LoadAtEntry.
Definition ff_base.h:3888
Int100 GetHorizontalStretch() const
Returns the horizontal stretch of the staff system, in 100th of a percent.
Definition ff_base.h:3931
Class for an opened Finale document. An opened Finale document has a 1-based ID and can be displayed ...
Definition ff_documents.h:29
Class that specifies Enigma text style. This includes font, size, efx, superscript,...
Definition ff_base.h:1811
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:1820
void SetBaselineShift(Evpu32 value)
Returns the baseline shift in evpus. This value does not affect layout.
Definition ff_base.h:1897
void SetSuperscript(Evpu32 value)
Returns the superscript value. This value may affect layout. Negative values are subscripts.
Definition ff_base.h:1903
void SetInterletterSpacing(fourbyte value)
Sets the inter-letter spacing value in 1/1000 of an EM units.
Definition ff_base.h:1891
fourbyte GetInterletterSpacing() const
Returns the inter-letter spacing value in 1/1000 of an EM units.
Definition ff_base.h:1873
FCEnigmaTextStyle()
The constructor.
Definition ff_base.h:1834
Evpu32 GetSuperscript() const
Returns the superscript value. This value may affect layout. Negative values are subscripts.
Definition ff_base.h:1885
Evpu32 GetBaselineShift() const
Returns the baseline shift in evpus. This value does not affect layout.
Definition ff_base.h:1879
FCFontInfo * GetFont()
Returns the font. This is a pointer into the current instance of FCEnigmaTextStyle,...
Definition ff_base.h:1862
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:1819
FCEnigmaTextStyle(const FCFontInfo &font)
Constructor with font info.
Definition ff_base.h:1840
Class that encapsulate the entry metrics data.
Definition ff_base.h:4172
JWERECT * GetStemRect()
Returns a pointer to the stem rectangle in the metrics data.
Definition ff_base.h:4468
int GetTopPosition() const
Returns the highest position for the noteheads or stem.
Definition ff_base.h:4297
JWERECT * GetNoteheadRect()
Returns a pointer to the notehead rectangle in the metrics data.
Definition ff_base.h:4478
int GetLastDotPosition() const
Returns the horizontal position of rightmost augmentation dot.
Definition ff_base.h:4378
int GetRightPosition() const
Returns the right-side position for the noteheads or stem.
Definition ff_base.h:4348
int GetFirstAccidentalPosition() const
Returns the the left most edge of the accidental rectangle for all accidentals on the entry.
Definition ff_base.h:4389
int GetStemTopPosition() const
Returns the bottom position for the stem.
Definition ff_base.h:4328
int GetStemLeftPosition() const
Returns the left-side position for the stem.
Definition ff_base.h:4358
int GetStemBottomPosition() const
Returns the bottom position for the stem.
Definition ff_base.h:4318
int GetStemRightPosition() const
Returns the right-side position for the stem.
Definition ff_base.h:4368
int GetAttachmentCount() const
Returns the number of attachments that have info within the metrics data.
Definition ff_base.h:4255
int GetLeftPosition() const
Returns the left-side position for the noteheads or stem.
Definition ff_base.h:4338
int GetNoteCount() const
Returns the number of notes that the metrics data has information about.
Definition ff_base.h:4413
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4503
static void MarkMetricsForRebuild()
Static method that sets the refresh flag, so the next Load call will rebuild the metrics data.
Definition ff_base.h:4229
FLAG_32 GetEntryFlags()
Return the metrics entry flags.
Definition ff_base.h:4395
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:4203
int GetBottomPosition() const
Returns the lowest position for the noteheads or stem.
Definition ff_base.h:4307
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:4274
Class to display the font selection dialog box to the user.
Definition ff_base.h:5500
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:5508
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:5553
bool GetUseStyles() const
Returns if font styles should be selectable in the dialog box.
Definition ff_base.h:5543
void SetSampleString(FCString *pString)
Sets the sample string, that should be used to demo the apparence of the font selection.
Definition ff_base.h:5604
void GetSampleString(FCString *pString)
Gets the sample string, that is used to demo the apparence of the font selection.
Definition ff_base.h:5561
void SetUseStyles(bool state)
Sets if font styles (such as bold, underline, etc) should be selectable in the dialog box.
Definition ff_base.h:5583
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:5596
void SetUseSizes(bool state)
Sets if font sizes should be selectable in the dialog box.
Definition ff_base.h:5575
bool GetUseSizes() const
Returns if font sizes should be selectable in the dialog box.
Definition ff_base.h:5535
FCFontDialog(FCUI *pUI, FCFontInfo *pFontInfo)
The constructor.
Definition ff_base.h:5519
Class for document-independent font information.
Definition ff_base.h:1192
double CalcAverageRomanCharacterWidthPoints() const
Calculates the average width of the roman characters in the font in points.
Definition ff_base.h:1792
double CalcAverageRomanCharacterWidthEVPUs() const
Calculates the average width of the roman characters in the font in EVPUs.
Definition finaleframework.cpp:4151
void CopyFrom(const FCFontInfo *pInfo)
Copies data from another font info object.
Definition finaleframework.cpp:3822
bool GetBold() const
Returns true if the font style is boldface.
Definition ff_base.h:1694
bool IsName(const char *pszTestName) const
Checks if the font name is a perfect match to the C-string test string.
Definition finaleframework.cpp:4092
bool MakeDefaultMusicFont()
Changes the document's default music font to match this instance of FCFontInfo and modifies this inst...
Definition finaleframework.cpp:4141
void SetAbsolute(bool state)
Sets the absolute (fixed font) size state of the font info.
Definition ff_base.h:1616
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:3851
bool ParseEnigmaCommand(FCString *pString)
Parses a valid Enigma font command and changes the font information accordingly.
Definition finaleframework.cpp:3916
bool SaveFontPrefs(int prefsID)
Saves the font information to any of the preference fonts.
Definition finaleframework.cpp:3841
void ParseEnigmaFont(const EEnigmaFont *pEnigmaFont)
Transfers the info from a Finale-internal font structure to the FCFontInfo object.
Definition ff_base.h:1510
FCString * CreateDescription() const
Definition finaleframework.cpp:4008
double GetSizeFloat() const
Returns the font size as a floating point (with decimal digits).
Definition ff_base.h:1351
bool IsMacSymbolFont() const
returns true i the font is a Mac Symbol font.
Definition finaleframework.cpp:4113
void SetBold(bool state)
Sets the boldface attribute of the font info.
Definition ff_base.h:1632
void SetItalic(bool state)
Sets the italics attribute of the font info.
Definition ff_base.h:1648
FCFontInfo * CreateCopy()
Creates a copy of the font info object on the heap.
Definition ff_base.h:1301
void SetNameByID(EFONTID id)
Sets the font name by using the document's internal Enigma font ID.
Definition finaleframework.cpp:4078
void SetName(const std::string &pszName)
Sets the font name.
Definition finaleframework.cpp:4062
void SetSize(int fontsize)
Sets the font size as an integer value.
Definition ff_base.h:1600
FLAG_16 GetEnigmaStyles() const
Gets the font style as standard Enigma bit storage.
Definition ff_base.h:1412
void SetPlain()
Clears the styles so the font doesn't use any style.
Definition ff_base.h:1662
void SetStrikeOut(bool state)
Sets the strikeout state of the font info.
Definition ff_base.h:1624
void SetUnderline(bool state)
Sets the underline attribute of the font info.
Definition ff_base.h:1656
int GetSize() const
Returns the font size as an integer number.
Definition ff_base.h:1343
EFONTID GetFontID() const
Gets the internal document-specific font ID. It may not yet have been assigned a value,...
Definition ff_base.h:1565
bool GetHidden() const
Returns true if the font style is hidden (don't print).
Definition ff_base.h:1724
FCString * CreateEnigmaString(FCString *pFontTagString=NULL)
Returns a created FCString object that contains the font information as an Enigma string.
Definition finaleframework.cpp:3883
static fourbyte GetSystemTextEncoding()
Returns the internal Engima encoding number for the running Finale version. This value is appended to...
Definition finaleframework.cpp:3817
void SetSizeFloat(double fontsize)
Sets the font size as a floating point (with decimal digits) value.
Definition ff_base.h:1608
void MakeEnigmaStyleString(FCString *pString)
Makes an Enigma string (for use in raw strings) based on only the current font style information.
Definition finaleframework.cpp:3893
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:4167
FCFontInfo()
Default constructor. This constructor does not add the font to the current document....
Definition finaleframework.cpp:3769
void SetHidden(bool state)
Sets the hidden state of the font info.
Definition ff_base.h:1640
bool IsPlain()
Returns true if the font has no special style flags.
Definition ff_base.h:1688
void SetFontID(EFONTID fontID)
Sets the internal document-specific font ID.
Definition ff_base.h:1579
bool GetIsSMuFLFont() const
Returns true if the font is a SMuFL font.
Definition ff_base.h:1733
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:1211
bool LoadFontPrefs(int prefsID)
Sets the font information to any of the preference fonts.
Definition finaleframework.cpp:3833
ENIGMASTYLES
Constants for enigma styles. These are bit-sensitve values that can be combined with bitwise-or.
Definition ff_base.h:1219
@ ENIGMASTYLE_STRIKEOUT
Definition ff_base.h:1233
@ ENIGMASTYLE_BOLD
Definition ff_base.h:1224
@ ENIGMASTYLE_HIDDEN
Definition ff_base.h:1239
@ ENIGMASTYLE_PLAIN
Definition ff_base.h:1221
@ ENIGMASTYLE_UNDERLINE
Definition ff_base.h:1230
@ ENIGMASTYLE_ABSOLUTE
Definition ff_base.h:1236
@ ENIGMASTYLE_ITALIC
Definition ff_base.h:1227
bool IsIdenticalTo(const FCFontInfo &compareWith) const
Returns true if all font information is identical to the compared object.
Definition finaleframework.cpp:4122
bool GetAbsolute() const
Returns true if the font size is absolute.
Definition ff_base.h:1718
void SetNameString(const FCString &value)
Sets the font name (FCString version).
Definition finaleframework.cpp:4067
EFONTID GetNameByID() const
Legacy version of GetIDByName with incorrect name.
Definition ff_base.h:1402
bool IsNameString(const FCString &pTestName) const
Checks if the font name is a perfect match to the test string.
Definition finaleframework.cpp:4106
bool GetStrikeOut() const
Returns true if the font style is strikeout.
Definition ff_base.h:1712
std::string GetName() const
Gets the font name (const C-string version).
Definition finaleframework.cpp:3978
bool GetItalic() const
Returns true if the font style is italic.
Definition ff_base.h:1700
bool GetUnderline() const
Returns true if the font style is underline.
Definition ff_base.h:1706
void GetNameString(FCString *pString) const
Gets the font name and puts it in a FCString object.
Definition finaleframework.cpp:3963
FCString * CreateEnigmaStyleString()
Creates a FCString object and creates the Enigma font style info string, based on only the current fo...
Definition finaleframework.cpp:3909
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:1210
void MakeEnigmaSizeString(FCString *pString)
Makes an Enigma string (for use in raw strings) based on only the current font size information.
Definition finaleframework.cpp:3901
void SetEnigmaStyles(FLAG_16 fontstyles)
Sets the font style as standard Enigma bit storage.
Definition ff_base.h:1523
EFONTID GetIDByName() const
Gets the internal Enigma font ID for the current document by searching for the font name....
Definition finaleframework.cpp:3986
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:4875
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4929
double GetFloat() const
Returns the integer value version of the number.
Definition ff_base.h:4925
int GetInt() const
Returns the integer value version of the number.
Definition ff_base.h:4919
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:4879
FCNumber(double value)
The constructor.
Definition ff_base.h:4888
void SetInt(int value)
Sets the number as an integer.
Definition ff_base.h:4899
void SetFloat(double value)
Sets the number as a float.
Definition ff_base.h:4909
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:4880
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:4946
void MoveY(double value)
Moves the y position from the current offset.
Definition ff_base.h:5008
double GetY() const
Returns the y position.
Definition ff_base.h:4996
void SetY(double value)
Sets the y position.
Definition ff_base.h:4984
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:4950
void SetX(double value)
Returns the x position.
Definition ff_base.h:4978
void MoveX(double value)
Moves the x position from the current offset.
Definition ff_base.h:5002
FCPoint(double x, double y)
The constructor.
Definition ff_base.h:4956
double GetX() const
Returns the x position.
Definition ff_base.h:4990
Class containing printing settings (and the ability to print documents).
Definition ff_base.h:5023
void SetPageRangeString(const char *pszString)
Returns the page range string as a C-style string.
Definition ff_base.h:5292
bool GetDrawCropMarks() const
Returns if crop marks should be printed.
Definition ff_base.h:5094
bool GetColor() const
Returns true if color printing should be used.
Definition ff_base.h:5070
bool GetReverse() const
Returns if the pages should be printed in reverse order.
Definition ff_base.h:5088
void SetReverse(bool state)
Sets if the pages should be printed in reverse order.
Definition ff_base.h:5199
twobyte GetStartPage() const
Returns the 1-based start page for printing.
Definition ff_base.h:5076
twobyte GetEndPage() const
Returns the 1-based end page for printing.
Definition ff_base.h:5082
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:5026
void SetFitWithinMargins(bool state)
Sets whether to use the printer margins when fitting a page to print.
Definition ff_base.h:5259
void SetStartPage(twobyte startpage)
Sets the 1-based start page.
Definition ff_base.h:5179
bool GetDrawFileName() const
Returns if the file name should be printed.
Definition ff_base.h:5106
bool GetTile() const
Returns if the document should be tited if bigger than specified page.
Definition ff_base.h:5112
PRINTODDEVENMODES GetOddEvenMode() const
Returns the odd/even printing mode.
Definition ff_base.h:5143
void SetTileOverlap(Evpu32 value)
Sets the user overlap for tiled pages.
Definition ff_base.h:5249
bool GetFitWithinMargins() const
Returns whether to use the printer margins when fitting a page to print.
Definition ff_base.h:5130
void SetEndPage(twobyte endpage)
Sets the 1-based end page.
Definition ff_base.h:5189
bool GetDrawRegistrationMarks() const
Returns if registration marks should be printed.
Definition ff_base.h:5100
void SetDrawFileName(bool state)
Sets if the file name should be printed.
Definition ff_base.h:5217
void SetLayoutCount(twobyte count)
Sets the n-Up layout value. Can be 0, 1, 2, 4.
Definition ff_base.h:5231
const char * GetPageRangeString() const
Returns the page range string as a C-style string.
Definition ff_base.h:5149
PRINTODDEVENMODES
Constants used for printing odd/even pages. Used with the GetOddEvenMode() and SetOddEvenMode() metho...
Definition ff_base.h:5034
FCPrintSettings()
The constructor.
Definition ff_base.h:5051
void SetTile(bool state)
Sets if the document should be tited if bigger than specified page.
Definition ff_base.h:5223
void SetOddEvenMode(PRINTODDEVENMODES value)
Sets the odd/even printing mode.
Definition ff_base.h:5267
void SetColor(bool state)
Sets if color printing should be used.
Definition ff_base.h:5173
twobyte GetLayoutCount() const
Returns the n-Up layout value. Can be 0, 1, 2, 4.
Definition ff_base.h:5118
void SetDrawCropMarks(bool state)
Sets if crop marks should be printed.
Definition ff_base.h:5205
twobyte GetCopyCount() const
Returns the number of copies to print.
Definition ff_base.h:5064
void SetDrawRegistrationMarks(twobyte state)
Sets if registration marks should be printed.
Definition ff_base.h:5211
void SetCopyCount(twobyte copies)
Sets the number of copies to print.
Definition ff_base.h:5162
Evpu32 GetTileOverlap() const
Returns the user overlap for tiled pages.
Definition ff_base.h:5124
Class that encapsulates a range (start, length)
Definition ff_base.h:5624
void SetStart(int val)
Sets the start value.
Definition ff_base.h:5689
int GetStart() const
Returns the start value.
Definition ff_base.h:5670
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:5630
int GetLength() const
Returns the length value.
Definition ff_base.h:5676
FCRange(int start=0, int length=0)
The constructor.
Definition ff_base.h:5639
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:5683
void SetLength(int val)
Sets the length value.
Definition ff_base.h:5695
Class for storing a "key"+"value" pair of values.
Definition ff_base.h:3815
void SetValueString(FCString *pString)
Sets the "value" string.
Definition ff_base.h:3842
FCSettingsPair(FCString *pLeftString, FCString *pRightString)
The constructor.
Definition ff_base.h:3827
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:3819
FCString * GetValueString()
Returns the "value" string.
Definition ff_base.h:3839
FCString * GetKeyString()
Returns the "key" string.
Definition ff_base.h:3836
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:3844
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1931
void AppendEOL()
Appends a system-specific end-of-line string to the to the FCString object.
Definition ff_base.h:2163
int CalcStringPosFrom(const FCString &subString, int startindex) const
Returns the first position where a substring occurs, from a starting point.
Definition ff_base.h:2579
void AppendCharacter(eUniChar32 character)
Appends a character to the string.
Definition finaleframework.cpp:2253
void AppendLuaString(const char *pOtherString)
Appends a Lua string to the string. This method supports UTF-8.
Definition finaleframework.cpp:2297
void SetLuaString(const char *pszBuffer)
Sets the string, using a Lua string version of the string (as UTF-8).
Definition ff_base.h:3470
int CalcStringPos(const FCString &subString) const
Returns the first position where a substring occurs.
Definition ff_base.h:2530
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:2444
void SetTemplateFolderPath()
Sets the path string to Finale's template folder.
Definition ff_base.h:2358
bool EncodeFromMacRoman()
Re-encodes the string to true Unicode from MacRoman.
Definition finaleframework.cpp:1619
bool SplitToPathAndFile(FCString *pPathPart, FCString *pFilePart) const
Splits a fully qualified file path into path part and file part copies.
Definition ff_base.h:2285
FCStrings * CreateParsedStrings(const char *pszSeparators) const
Creates a collection of strings based on the separator characters. C-style string version.
Definition finaleframework.cpp:3202
void ToLowerCase()
Transforms the string to lower case.
Definition finaleframework.cpp:3287
FCStrings * CreateEnigmaComponents() const
Creates a string collection that consists of the components from an Enigma text command (with correct...
Definition finaleframework.cpp:3058
eUniChar16 GetCharacterAt(int index) const
Returns the character at the index position.
Definition finaleframework.cpp:2436
FCString(const _fcStringChar *pszCString)
Constructor version that takes a the platform UTF16 type as argument.
Definition ff_base.h:2054
void ExtractFileExtension()
Removes everything except the file extension part of a file name.
Definition ff_base.h:2793
FCString * CreateCopy()
Creates a copy of the string object on the heap.
Definition finaleframework.cpp:2839
bool IsEnigmaFileInfoComposer() const
Returns true if the string is an "Composer" Enigma command.
Definition finaleframework.cpp:2065
int GetLength() const
Returns the length of the string.
Definition ff_base.h:3109
FCString(const eUniChar16 *pszCString)
Constructor version that takes a Unicode 16 string as argument.
Definition ff_base.h:2047
int CalcCStringPos(const FCString *pSubString, const char *pszSubString) const
Returns the first position where a substring occurs. C-string version.
Definition ff_base.h:2563
bool EndsWithString(const FCString *pString) const
Returns true if the string ends with the parameter string.
Definition finaleframework.cpp:3344
void SetBackupFolderPath()
Sets the path string to Finale's backup folder.
Definition ff_base.h:2342
bool IsEnigmaCommand() const
Returns true if the string is an Enigma command.
Definition ff_base.h:3249
void TrimWhitespace()
Trims whitespace at both ends of the string.
Definition finaleframework.cpp:1971
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:2072
void TrimLinefeed()
Trims linefeed characters at both ends of the string.
Definition finaleframework.cpp:1978
void _SetCFURLRefPath(CFURLRef cfurl)
Definition finaleframework.cpp:2331
FCStrings * CreateEnigmaStrings(bool include_non_commands=false) const
Creates a string collection of every enigma text tag found in the string.
Definition finaleframework.cpp:3131
FCString(const FCString &src)
Copy constructor (required for classes that allocate memory.)
Definition ff_base.h:2080
bool SetCharacterUpperCase(int index)
Sets a specific character to upper case.
Definition finaleframework.cpp:2846
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:3492
const char * GetEOL() const
Returns the platform-specific end-of-line character(s) as a C-string.
Definition finaleframework.cpp:2132
bool EndsWith(const char *pszString) const
Returns true if the string ends with the parameter string.
Definition finaleframework.cpp:3336
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:2235
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:3380
const char * GetUTF8String() const
Returns a C-string UTF-8 version of the string.
Definition finaleframework.cpp:1804
bool LoadResource(int resourceID, HINSTANCE dllinstance=0)
Windows version. Loads the resource string into the string object.
Definition finaleframework.cpp:3420
void InsertString(const FCString *pString, int insertindex=0)
Inserts a string object to the string at a specified index position.
Definition finaleframework.cpp:2152
bool IsEnigmaFileInfoLyricist() const
Returns true if the string is an "Lyricist" Enigma command.
Definition finaleframework.cpp:2079
bool StartsWith(const char *pszString) const
Returns true if the string starts with the parameter string.
Definition finaleframework.cpp:3270
bool IsEqualCString(const char *pszString) const
Returns true if the string is identical with the parameter. (C-style string version....
Definition finaleframework.cpp:2174
bool IsEnigmaFileInfoCopyright() const
Returns true if the string is an "Copyright" Enigma command.
Definition finaleframework.cpp:2086
void SetUserOptionsPath()
Sets the string to the user options path on the running system.
Definition finaleframework.cpp:2359
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:1725
void SetCString(const char *pszBuffer, int maxchars=-1)
Sets the string, using a C-string version of the string.
Definition finaleframework.cpp:1662
double GetMeasurement(_ENUMCODE(MEASUREMENTUNITS) _LUACODE(twobyte) unit) const
Converts the string to an EVPU measurement value, based on a specific unit.
Definition finaleframework.cpp:2756
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:2391
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:2040
void AppendFloat(double value)
Appends an floating-point value to the string.
Definition finaleframework.cpp:2312
bool IsEnigmaFont() const
Returns true if the string is an Enigma font command.
Definition finaleframework.cpp:2029
void SetMusicFolderPath()
Sets the path string to Finale's music folder.
Definition ff_base.h:2326
int GetInteger(int index=0) const
Converts the decimal string contents to an integer value.
Definition finaleframework.cpp:2484
void * GetNSString() const
Returns a NSString* version of the string (on Cocoa only).
Definition finaleframework.cpp:2472
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:3796
void SetPreferencesFolderPath()
Sets the path string to Finale's preference folder.
Definition ff_base.h:2404
FCString()
The constructor. Defaults to an empty string.
Definition ff_base.h:2029
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:2015
void SetCurrentTime()
Set the string to the current time in hh:mm:ss format.
Definition ff_base.h:3587
bool ContainsString(const FCString &pSubString) const
Returns true if the substring is found within the string.
Definition finaleframework.cpp:3375
void SetLibFolderPath()
Sets the path string to Finale's library folder.
Definition ff_base.h:2334
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:2014
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:1525
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:2582
const char * GetCString() const
Returns a C-string version of the string.
Definition finaleframework.cpp:1766
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:2426
void SetHex(int number, int bitwidth)
Sets the string to a lower-case hexadecimal number.
Definition finaleframework.cpp:2536
bool IsEnigmaFileInfoTitle() const
Returns true if the string is an "Title" Enigma command.
Definition finaleframework.cpp:2051
void SetNSString(void *pNSString)
Sets the string to a NSString* value.
Definition finaleframework.cpp:2478
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:2517
void AppendString(const FCString *pOtherString)
Appends another string object to the string.
Definition finaleframework.cpp:2277
void SetTempFolderPath()
Sets the path string to Finale's temp folder (for temporary files).
Definition ff_base.h:2366
void SetInteger(int i)
Sets the string to an integer.
Definition finaleframework.cpp:2569
void ToUnicode(eUniChar16 *pBuffer, int maxsize) const
Copies the string to a 16-bit Unicode string buffer.
Definition ff_base.h:3644
void SetDocStylesFolderPath()
Sets the path string to Finale's document styles folder.
Definition ff_base.h:2382
int CompareNoCase(const FCString &value) const
Case insensitive version of Compare.
Definition ff_base.h:2465
void FormatCharacterNumber(eUniChar32 character)
Formats a 16-bit character (symbol) number to a string for presentation purposes.
Definition finaleframework.cpp:1785
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:2191
void ConvertToPascal(Str255 &pascalString)
Converts the string contents to a Str255 pascal string.
Definition finaleframework.cpp:2320
bool IsNumber() const
Returns true if the string is a number.
Definition finaleframework.cpp:2003
bool EncodeToMacRoman()
Re-encodes the string from true Unicode to faux MacRoman.
Definition finaleframework.cpp:1640
void SetAutoSaveFolderPath()
Sets the path string to Finale's auto-save folder.
Definition ff_base.h:2350
double GetFloat(int index=0) const
Converts the decimal string contents to a floating point value.
Definition finaleframework.cpp:2559
void SetString(const FCString *pString)
Copies a string.
Definition finaleframework.cpp:2826
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:2415
void SetUTF8String(const char *pszBuffer)
Sets the string, using a UTF8 C-style string.
Definition finaleframework.cpp:1685
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:2930
bool TruncateAt(int newlength)
Truncates the string at the indicated position.
Definition ff_base.h:3724
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:1516
bool ContainsEnigmaTextInsert(bool only_file_info_inserts=true) const
Returns true if the text block contains a text insert.
Definition finaleframework.cpp:3401
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:1984
void Clear()
Creates an empty string.
Definition ff_base.h:2445
void SetUserPath()
Sets the string to the user path on the running system.
Definition finaleframework.cpp:2344
int Compare(const FCString &value) const
Compares string against another string.
Definition ff_base.h:2455
bool IsAllDigits() const
Returns true if all characters in the string are digits (0 through 9).
Definition finaleframework.cpp:1993
int GetHex() const
Converts the unsigned hexadecimal string to an integer value. The string can only contain valid hexad...
Definition finaleframework.cpp:2491
int FindLast(const char *pszSubStr) const
Returns the 0-based index for the last occurence of the substring.
Definition ff_base.h:2871
void ToUpperCase()
Transforms the string to upper case.
Definition finaleframework.cpp:3313
bool IsEnigmaFileInfoSubtitle() const
Returns true if the string is an "Subtitle" Enigma command.
Definition finaleframework.cpp:2058
int CalcLastStringPos(const FCString &subString) const
Returns the last position where a substring occurs.
Definition ff_base.h:2542
void AppendCString(const char *pOtherString)
Appends a C-style string to the string.
Definition finaleframework.cpp:2289
bool IsWhitespace(int index) const
Returns true if the character position contains a whitespace.
Definition finaleframework.cpp:2203
void SetFontAnnotationFolderPath()
Sets the path string to Finale's font annotation folder.
Definition ff_base.h:2374
bool ContainsCString(const char *pszSubString) const
Returns true if the substring is found within the string. C-string version.
Definition ff_base.h:2494
bool IsEmpty() const
Returns true if the string is empty.
Definition ff_base.h:3233
bool StartsWithString(const FCString *pString) const
Returns true if the string starts with the parameter string.
Definition finaleframework.cpp:3277
void Insert(const char *pszString, int insertindex=0)
Inserts a C string to the string at a specified index position.
Definition finaleframework.cpp:2143
bool DeleteCodePointsAt(int index, int count)
Removes a range of Unicode codepoints, starting at the 0-based index position.
Definition finaleframework.cpp:1935
FCStrings * CreateRows() const
Definition finaleframework.cpp:3226
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:2599
int FindFirst(const char *pszSubStr) const
Returns the 0-based index for the first occurence of the substring.
Definition ff_base.h:2832
bool TrimEnigmaFontTags()
Removes all Enigma font tags from a string, leaving only the actual text and text insert tags,...
Definition finaleframework.cpp:1865
FCFontInfo * CreateLastFontInfo() const
Creates a FCFontInfo object with the last font information (based on the Enigma text tags) found in t...
Definition finaleframework.cpp:3365
bool IsEqualString(const FCString &value) const
Returns true if the string is identical with the parameter. (FCString string version....
Definition ff_base.h:3196
bool IsEqual(const char *pszString) const
Returns true if the string is identical with the parameter.
Definition ff_base.h:3189
bool DeleteCharacterAt(int index)
Removes a character at the 0-based index position.
Definition ff_base.h:2770
bool IsCharacter(int index, eUniChar32 character) const
Returns true if the character at the index matches the supplied character.
Definition finaleframework.cpp:2180
bool DeleteCharactersAt(int index, int count)
Removes a range of characters, starting at the 0-based index position.
Definition finaleframework.cpp:1919
const char * GetLuaString() const
Returns a Lua version of the string in UTF-8 format.
Definition finaleframework.cpp:1799
virtual ~FCString()
The destructor. Deletes the string storage as well as the C-string pointer (if any).
Definition finaleframework.cpp:1451
void TruncateWidth(int maxlength, int prefixchars)
Truncates the string by removing the middle part and inserting '...' instead.
Definition ff_base.h:3751
bool Replace(const char *pszSource, const char *pszReplacement)
Replaces all occurrences of a source pattern with a replacement string.
Definition finaleframework.cpp:1943
bool MakeSubString(int startindex, int substringlength, FCString *pDestinationString)
Creates a substring from the string.
Definition finaleframework.cpp:2234
void SetMeasurement(double value, twobyte unit)
Sets the string to an EVPU measurement value, formatted to a specific unit.
Definition finaleframework.cpp:2596
void SetUnicodeString(const eUniChar16 *pChar, int maxchars=-1)
Sets the string by using a 16-bit Unicode buffer as input parameter.
Definition finaleframework.cpp:1701
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:2093
bool TrimEnigmaTags()
Removes all Enigma tag information from a string, leaving only the actual text.
Definition finaleframework.cpp:1824
bool DeleteCodePointAt(int index)
Removes the Unicode codepoint at the 0-based index position.
Definition ff_base.h:2741
void SetCharacterAt(int index, eUniChar16 newcharacter)
Sets the character at the index position.
Definition finaleframework.cpp:2819
FCString & operator=(const FCString &src)
Assignment operator (required for classes that allocate memory.)
Definition ff_base.h:2088
void SetPluginsFolderPath()
Sets the path string to Finale's root plug-in folder.
Definition ff_base.h:2318
bool TruncateEnd(int count)
Truncates the end of the string by a specific number of characters.
Definition ff_base.h:3740
void AssureEndingPathDelimiter()
Makes sure that the string ends with a path delimiter (backslash or slash, depending on OS)....
Definition ff_base.h:2171
void AppendInteger(int value)
Appends an integer value (decimal) to the string.
Definition finaleframework.cpp:2305
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:5333
float GetBottom() const
Returns the bottom position of the glyph, relative to the baseline.
Definition ff_base.h:5428
void _SetMaxAscent(float b)
For internal use only.
Definition ff_base.h:5386
float GetTop() const
Returns the top position of the glyph, relative to the baseline.
Definition ff_base.h:5449
float GetHeight() const
Returns the height of the glyph, in fractional points.
Definition ff_base.h:5414
float GetMaxDescent()
Returns the maximum descender for the font, relative to the baseline.
Definition ff_base.h:5469
void _SetBottom(float b)
For internal use only.
Definition ff_base.h:5380
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:5472
float GetMaxAscent()
Returns the maximum ascender for the font, relative to the baseline.
Definition ff_base.h:5459
ufourbyte GetGlyphNumber()
Returns the glyph number for the loaded data.
Definition ff_base.h:5402
void _SetLeft(float l)
For internal use only.
Definition ff_base.h:5374
float GetLeft() const
Returns the left-side position of the glyph, in fractional points.
Definition ff_base.h:5420
float GetWidth()
Returns the width of the glyph, in fractional points.
Definition ff_base.h:5408
void _SetWidth(float w)
For internal use only.
Definition ff_base.h:5368
void _SetHeight(float h)
For internal use only.
Definition ff_base.h:5362
void _SetMaxDescent(float b)
For internal use only.
Definition ff_base.h:5392
float GetRight() const
Returns the right-side position of the glyph.
Definition ff_base.h:5438
FCSystemGlyphInfo()
The constructor.
Definition ff_base.h:5339
A class that fetches the metrics for text (for how Finale will render it), such as the boundary boxes...
Definition ff_base.h:4525
double CalcWidthEVPUs()
Returns the width of the bounding box, in fractional EVPUs.
Definition ff_base.h:4840
double CalcHeightEVPUs()
Returns the width of the bounding box, in fractional EVPUs.
Definition ff_base.h:4825
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:4848
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_base.h:4851
double GetBottomEVPUs() const
Returns the bottom side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4772
double GetTopEVPUs() const
Returns the top side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4757
double GetAdvanceWidthPoints() const
Returns the advance width of the string (the pen position before and after printing the string),...
Definition ff_base.h:4620
double GetLeftPoints() const
Returns the left side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4639
double GetLeftEVPUs() const
Returns the left side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4727
double GetAdvanceWidthEVPUs() const
Returns the advance width of the string (the pen position before and after printing the string),...
Definition ff_base.h:4712
double GetRightEVPUs() const
Returns the right side of the bounding box, in fractional EVPUs.
Definition ff_base.h:4742
double GetRightPoints() const
Returns the right side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4658
double CalcHeightPoints()
Returns the width of the bounding box, in fractional Points.
Definition ff_base.h:4791
double GetTopPoints() const
Returns the top side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4677
double CalcWidthPoints()
Returns the width of the bounding box, in fractional Points.
Definition ff_base.h:4810
double GetBottomPoints() const
Returns the bottom side of the bounding box, in fractional Points measurements.
Definition ff_base.h:4696
FCTextMetrics()
The constructor. Defaults to unloaded. Metrics must be loaded with LoadString, LoadSymbol,...
Definition ff_base.h:4536
Standard class for basic user interface functionality.
Definition ff_ui.h:29