Finale PDK Framework  0.54
ff_text.h
1 /*
2  * File: ff_text.h
3  * Author: Jari Williamsson
4  *
5  * Created on den 7 november 2010, 20:56
6  */
7 
8 #ifndef FF_TEXT_H
9 #define FF_TEXT_H
10 
16 class FCRawText : public __FCBaseData {
17  bool _workaround2012bug; /* Working around a FinMac2012 bug */
18 protected:
19 
21  virtual void SetRawTextNumber(twobyte number)
22  {
23  _dataid.text.rawTextNumber = number;
24  }
25  virtual int DataSizeLoad();
26  virtual void* Allocate();
27  virtual void Deallocate();
28  virtual bool IsDynamicSize() { return true; }
29 
30  virtual EVERSION EnigmaVersion();
31 
32  virtual EXTAG Tag() { return GetCustomTag() ? GetCustomTag() : tx_TextBlock; }
33 
35  virtual __FCBaseData* CreateObject() { return NULL; }
36 
39  virtual bool HasUnicodeSupport();
40 
41 public:
42  virtual const char* ClassName() { return "FCRawText"; }
43  virtual const PDKFRAMEWORK_CLASSID GetClassID() { return FCID_RAWTEXT; }
44 
46  FCRawText();
47 
49  virtual ~FCRawText();
50 
55  bool Load(twobyte number);
56 
57 
59  virtual bool LoadFirst()
60  {
62  return LoadNext();
63  }
64 
68  bool SaveAs(twobyte number);
69 
74  bool SaveNew();
75 
83  void SetText(FCString* pString);
84 
91  void GetText(FCString* pString);
92 
97  virtual twobyte GetItemNo() const { return _dataid.text.rawTextNumber; }
98 
108 
109 #ifdef PDK_FRAMEWORK_LUAFRIENDLY
110 
111  FCString* CreateString_GC();
112 #endif
113 
114 #ifdef PDK_FRAMEWORK_DEBUG
115  virtual void DebugDump()
116  {
118  FCString* pString = CreateString();
119  DebugOutString("String value: ", pString->GetCString());
120  delete pString;
121  }
122 #endif
123 };
124 
125 
126 
133 class __FCOtherText : public FCRawText
134 {
135 protected:
137  virtual void SetRawTextNumber(twobyte number)
138  {
139  _dataid.other.cmper = number;
140  }
141 
142  virtual EXTAG Tag() { return 0; } /* MUST be overwritten in child classes. */
143 public:
144  virtual const char* ClassName() { return "__FCOtherText"; }
145 
147  virtual twobyte GetItemNo() { return _dataid.other.cmper; }
148 };
149 
152 {
153  virtual EXTAG Tag() { return ot_EndingRepeatText; }
154 public:
155  virtual const char* ClassName() { return "FCEndingRepeatText"; }
156 };
157 
158 
161 {
162  virtual EXTAG Tag() {
163 #if FXT_VERSION >= FINALEVERSION_25_3
164  /* Unicode and tag change since 25.3 */
165  return ot_RepeatStaffListName;
166 #else
167  return ot_StaffListName;
168 #endif
169  }
170 
171  virtual bool HasUnicodeSupport();
172 
173 public:
174  virtual const char* ClassName() { return "FCStaffListText"; }
175 };
176 
177 
178 /* Previously undocumented */
179 
180 const EXTAG __ot_CategoryStaffListName = MAKEEXTAG(edOther, 'C', 'L');
181 
184 {
185  virtual EXTAG Tag() { return __ot_CategoryStaffListName; }
186  virtual bool HasUnicodeSupport() { return false; }
187 public:
188  virtual const char* ClassName() { return "FCCategoryStaffListText"; }
189 };
190 
191 
192 /* Previously undocumented */
193 const EXTAG __ot_StaffAssignStaffListName = MAKEEXTAG(edOther, 'S', 'l');
194 
197 {
198  virtual EXTAG Tag() { return __ot_StaffAssignStaffListName; }
199  virtual bool HasUnicodeSupport() { return false; }
200 public:
201  virtual const char* ClassName() { return "FCStaffListStaffAssignText"; }
202 };
203 
206 protected:
207  virtual EXTAG Tag() { return ot_TextRepeatStyleText; }
208 public:
209  virtual const char* ClassName() { return "FCTextRepeatText"; }
210 };
211 
215 protected:
216  virtual EXTAG Tag() { return ot_PercussionMapTitle; }
217 public:
218  virtual const char* ClassName() { return "FCPercussionLayoutNotesText"; }
219 };
220 
224 protected:
225  virtual EXTAG Tag() { return ot_InstDefinitionName; }
226 public:
227  virtual const char* ClassName() { return "FCInstrumentDefText"; }
228 };
229 
235 class __FCLyricsBase : public FCRawText {
236 public:
237  virtual EXTAG Tag() { return 0; } /* Override, but keep a public reference here */
238  virtual const char* ClassName() { return "__FCLyricsBase"; }
239 };
240 
247 protected:
248  virtual EXTAG Tag() { return tx_VerseLyric; }
249 public:
250  virtual const char* ClassName() { return "FCLyricsVerseText"; }
251 };
252 
259 protected:
260  virtual EXTAG Tag() { return tx_SectionLyric; }
261 private:
262  virtual const char* ClassName() { return "FCLyricsSectionText"; }
263 };
264 
271 protected:
272  virtual EXTAG Tag() { return tx_ChorusLyric; }
273 private:
274  virtual const char* ClassName() { return "FCLyricsChorusText"; }
275 };
276 
277 
278 #ifdef PDK_FRAMEWORK_ENIGMASTRINGS
279 
291 class FCFileInfoText : public FCRawText {
292 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
293 private:
298  bool _LoadWrapper(twobyte number)
299  {
300  if (!Load(number)) return false;
301  FCString* pString = CreateString();
302  if (!pString) return true;
303  pString->TrimEnigmaFontTags();
304  SetText(pString);
305  delete pString;
306  return true;
307  }
308 #endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
309 protected:
310  virtual EXTAG Tag() { return tx_FileInfo; }
311 public:
312  virtual const char* ClassName() { return "FCFileInfoText"; }
313 
314 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
315  const twobyte GetID_Title() { return 1; }
316  const twobyte GetID_Subtitle() { return 7; }
317  const twobyte GetID_Composer() { return 2; }
318  const twobyte GetID_Arranger() { return 6; }
319  const twobyte GetID_Lyricist() { return 5; }
320  const twobyte GetID_Copyright() { return 3; }
321  const twobyte GetID_Description() { return 4; }
322 #endif /* #ifndef DOXYGEN_SHOULD_IGNORE_THIS */
323 
328  bool LoadTitle() { return _LoadWrapper(GetID_Title()); }
329 
334  bool LoadSubtitle() { return _LoadWrapper(GetID_Subtitle()); }
335 
340  bool LoadComposer() { return _LoadWrapper(GetID_Composer()); }
341 
346  bool LoadArranger() { return _LoadWrapper(GetID_Arranger()); }
347 
352  bool LoadLyricist() { return _LoadWrapper(GetID_Lyricist()); }
353 
358  bool LoadCopyright() { return _LoadWrapper(GetID_Copyright()); }
359 
364  bool LoadDescription() { return _LoadWrapper(GetID_Description()); }
365 
371  bool SaveAsTitle() { return SaveAs(GetID_Title()); }
372 
378  bool SaveAsSubtitle() { return SaveAs(GetID_Subtitle()); }
379 
385  bool SaveAsComposer() { return SaveAs(GetID_Composer()); }
386 
392  bool SaveAsArranger() { return SaveAs(GetID_Arranger()); }
393 
399  bool SaveAsLyricist() { return SaveAs(GetID_Lyricist()); }
400 
406  bool SaveAsCopyright() { return SaveAs(GetID_Copyright()); }
407 
413  bool SaveAsDescription() { return SaveAs(GetID_Description()); }
414 };
415 #endif /* PDK_FRAMEWORK_ENIGMASTRINGS */
416 
417 
418 
419 
420 #endif /* FF_TEXT_H */
421 
const char * GetCString() const
Returns a C-string version of the string.
Definition: finaleframework.cpp:1159
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition: ff_base.h:918
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:375
bool SaveAsTitle()
Saves the text as the "Title" in the File Info text.
Definition: ff_text.h:371
The class for chorus lyrics texts.
Definition: ff_text.h:270
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:238
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:216
virtual bool IsDynamicSize()
Definition: ff_text.h:28
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:248
EXTAG GetCustomTag()
Returns the custom Enigma tag, if any.
Definition: ff_base.h:815
bool LoadCopyright()
Loads the copyright File Info text.
Definition: ff_text.h:358
The class for file information text fields.
Definition: ff_text.h:291
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:209
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:144
virtual int DataSizeLoad()
Returns the data size for the data structure that should be loaded.
Definition: finaleframework.cpp:3845
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:237
virtual bool HasUnicodeSupport()
Should return true if the data structure has Unicode support on the running platform.
Definition: finaleframework.cpp:3966
virtual void Deallocate()
Definition: finaleframework.cpp:3858
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition: ff_text.h:115
Text used for the name of a percussion layout. Please refer to the FCPercussionLayoutNotes class...
Definition: ff_text.h:214
virtual const PDKFRAMEWORK_CLASSID GetClassID()
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition: ff_text.h:43
Staff list titles for staff lists in repeats.
Definition: ff_text.h:160
Staff list titles for staff lists in categories.
Definition: ff_text.h:183
bool SaveAsCopyright()
Saves the text as the "Copyright" in the File Info text.
Definition: ff_text.h:406
bool SaveAsDescription()
Saves the text as the "Description" in the File Info text.
Definition: ff_text.h:413
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:188
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:155
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:201
bool LoadComposer()
Loads the composer File Info text.
Definition: ff_text.h:340
bool LoadTitle()
Loads the title File Info text.
Definition: ff_text.h:328
Text in repeat endings.
Definition: ff_text.h:151
virtual void * Allocate()
Definition: finaleframework.cpp:3852
bool Load(twobyte number)
Loads the text with the indicated text number.
Definition: finaleframework.cpp:3865
PDKFRAMEWORK_CLASSID
Constants for the GetClassID method.
Definition: ff_base.h:60
bool SaveAsSubtitle()
Saves the text as the "Subtitle" in the File Info text.
Definition: ff_text.h:378
bool LoadDescription()
Loads the description File Info text.
Definition: ff_text.h:364
The class for section lyrics texts.
Definition: ff_text.h:258
Staff list titles for staff-assigned staff lists.
Definition: ff_text.h:196
The class for raw text objects. All other text classes are based on this class, but it can also be us...
Definition: ff_text.h:16
bool SaveAsLyricist()
Saves the text as the "Lyricist" in the File Info text.
Definition: ff_text.h:399
bool SaveAs(twobyte number)
Saves the text by a new text number.
Definition: finaleframework.cpp:3902
The base class for all lyrics text classes.
Definition: ff_text.h:235
FCRawText()
The constructor.
Definition: finaleframework.cpp:3816
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:272
FCString * CreateString()
Creates a string object with the loaded text. If the string doesn't exist (or if it's empty)...
Definition: finaleframework.cpp:3949
bool LoadSubtitle()
Loads the subtitle File Info text.
Definition: ff_text.h:334
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:42
virtual twobyte GetItemNo() const
Gets the item number for the text.
Definition: ff_text.h:97
bool LoadArranger()
Loads the arranger File Info text.
Definition: ff_text.h:346
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:260
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:174
bool TrimEnigmaFontTags()
Removes all Enigma font tags from a string, leaving only the actual text and text insert tags...
Definition: finaleframework.cpp:1262
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:227
The base class for text classes that loads from 'other' (not as regular raw text).
Definition: ff_text.h:133
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:32
Base class for all data-related classes (that handles Finale data).
Definition: ff_base.h:628
virtual ~FCRawText()
The (virtual) destructor.
Definition: finaleframework.cpp:3821
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:312
virtual twobyte GetItemNo()
Gets the item number for the text.
Definition: ff_text.h:147
bool SaveAsArranger()
Saves the text as the "Arranger" in the File Info text.
Definition: ff_text.h:392
void GetText(FCString *pString)
Copies the object's text to a FCString object.
Definition: finaleframework.cpp:3937
virtual void SetRawTextNumber(twobyte number)
Definition: ff_text.h:137
The class for verse lyrics texts.
Definition: ff_text.h:246
bool SaveAsComposer()
Saves the text as the "Composer" in the File Info text.
Definition: ff_text.h:385
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:250
EDataID _dataid
The EdataID for the last loaded/saved object.
Definition: ff_base.h:657
Class that provides storage for text. This is to achieve platform-transparent text handling...
Definition: ff_base.h:1473
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_text.h:218
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:207
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:225
bool LoadLyricist()
Loads the lyricist File Info text.
Definition: ff_text.h:352
virtual __FCBaseData * CreateObject()
Definition: ff_text.h:35
virtual bool LoadNext()
Loads the next element from the database, if any.
Definition: finaleframework.cpp:877
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:142
virtual EXTAG Tag()
The Enigma tag for the derived class.
Definition: ff_text.h:310
bool SaveNew()
Saves the text at the first empty spot.
Definition: finaleframework.cpp:3909
void SetText(FCString *pString)
Sets the text for the object. (The object needs to be saved to Finale to take effect.)
Definition: finaleframework.cpp:3916
Text used for text repeats.
Definition: ff_text.h:205
virtual EVERSION EnigmaVersion()
The Enigma version for save/load/create/delete operations.
Definition: finaleframework.cpp:3827
Text used for an instrument definition. Please refer to the FCInstrumentDef class.
Definition: ff_text.h:223
virtual bool LoadFirst()
Loads the first raw text entry.
Definition: ff_text.h:59
virtual void SetRawTextNumber(twobyte number)
Definition: ff_text.h:21