Finale PDK Framework 0.77
Power Up Your Finale Music Software
Loading...
Searching...
No Matches
ff_cell.h
1/*
2 * File: ff_cell.h
3 * Author: Jari Williamsson
4 *
5 * Created on den 18 november 2010, 00:59
6 */
7
8#ifndef FF_CELL_H
9#define FF_CELL_H
10
17class FCCell : public __FCBase
18{
19 int _measure;
20 int _staff;
21 FCKeySignature* _pKeySig;
22 FCTimeSignature* _pTimeSig;
23 FCTimeSignature* _pTimeSigDisplay;
24 bool _removeindpendenttime;
25
27 bool _SetIndependentTimeSignature(FCTimeSignature* pTimeSig, bool forDisplay = false);
28
30 bool _SetGlobalTimeSignature(FCTimeSignature* pTimeSig, bool forDisplay = false);
31
33 bool _SetIndependentKeySignature(FCKeySignature* pKeySig);
34
36 bool _SetGlobalKeySignature(FCKeySignature* pKeySig);
37
38public:
43 FCCell(int measure, int staff)
44 {
45 _measure = measure;
46 _staff = staff;
47 _pKeySig = NULL;
48 _pTimeSig = NULL;
49 _pTimeSigDisplay = NULL;
50 _removeindpendenttime = false;
51 }
52
53#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
58 static int FCCell_tostring(lua_State* L)
59 {
60 FCCell* pThis = luabridge::Stack<FCCell*>::get(L, 1) LB3(.value());
61 std::string s = std::string(pThis->ClassName()) + ": (" + std::to_string(pThis->GetMeasure()) + ", " + std::to_string(pThis->GetStaff()) + ")";
62 luabridge::Stack<std::string>::push(L, s).throw_on_error();
63 return 1;
64 }
65#endif
66
67 virtual ~FCCell()
68 {
69 delete _pKeySig;
70 delete _pTimeSig;
71 delete _pTimeSigDisplay;
72 }
73
74#ifdef PDK_FRAMEWORK_ENTRIES
93 FCNoteEntryCell* CreateNoteEntryCell(bool shouldload, int loadlayermode = 0)
94 {
95 FCNoteEntryCell* pFrame = new FCNoteEntryCell(_measure, _staff);
96 if (shouldload)
97 {
98 pFrame->SetLoadLayerMode(loadlayermode);
99 pFrame->Load();
100 }
101 return pFrame;
102 }
103
104#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
106 luabridge::RefCountedPtr<FCNoteEntryCell> CreateNoteEntryCell_GC(bool shouldload, int loadlayermode = 0)
107 { return makeLuaSharedPtr(CreateNoteEntryCell(shouldload, loadlayermode)); }
108#endif
109
110#endif // #ifdef PDK_FRAMEWORK_ENTRIES
111
112 const char* ClassName() const override { return "FCCell"; }
113
120 int GetMeasure() const { return _measure; }
121
128 int GetStaff() const { return _staff; }
129
145 TimeEdu32 CalcEntryDuration(int layer = 0);
146
155 int CalcClefIndexAt(TimeEdu32 pos);
156
162 TimeEdu32 CalcDuration() const
163 {
164 return FX_GetMeasureDuration(GetStaff(), GetMeasure());
165 }
166
167#if PDK_FRAMEWORK_ENTRIES
173 bool CalcContainsEntries();
174#endif
175
191
209 FCKeySignature* CreateCurrentVisibleKeySignature(bool concertpitch = false) const
210 {
211 FCKeySignature* retval = new FCKeySignature();
212 retval->SetID(FX_GetKeySig(GetMeasure(), GetStaff(), !concertpitch));
213 return retval;
214 }
215
216#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
218 luabridge::RefCountedPtr<FCKeySignature> CreateCurrentVisibleKeySignature_GC(bool concertpitch = false)
219 { return makeLuaSharedPtr(CreateCurrentVisibleKeySignature(concertpitch)); }
220#endif
221
228
235
250
263
272 void ReAssign(int measure, int staff)
273 {
274 if ((_measure == measure) && (_staff == staff)) return;
275 _measure = measure;
276 _staff = staff;
277 delete _pKeySig;
278 delete _pTimeSig;
279 _pKeySig = NULL;
280 _pTimeSig = NULL;
281 }
282
290 {
291 FCCellMetrics *pMetrics = new FCCellMetrics();
292 if (pMetrics->LoadAtCell(this)) return pMetrics;
293 delete pMetrics;
294 return NULL;
295 }
296
305
314
324
334 {
335 delete _pTimeSigDisplay;
336 _pTimeSigDisplay = nullptr;
337 _removeindpendenttime = true;
338 }
339
340#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
342 luabridge::RefCountedPtr<FCCellMetrics> CreateCellMetrics_GC()
343 { return makeLuaSharedPtr(CreateCellMetrics()); }
344#endif
345
346
355 bool Save();
356
357};
358
365class FCCellPos : public __FCBase
366{
367 eMeas _measure;
368 eStaff _staff;
369 TimeEdu32 _measurepos;
370public:
375 FCCellPos(int measure, int staff, TimeEdu32 measurepos)
376 {
377 _measure = measure;
378 _staff = staff;
379 _measurepos = measurepos;
380 }
381 const char* ClassName() const override { return "FCCellPos"; }
382
389 eMeas GetMeasure() const { return _measure; }
390
397 eStaff GetStaff() const { return _staff; }
398
407 TimeEdu32 GetMeasurePos() const { return _measurepos; }
408
415 int CalcClefIndex();
416};
417
426{
427public:
428 const char* ClassName() const override { return "FCCells"; }
429
436
445 void ApplyRegion(FCMusicRegion* pRegion);
446
454 int ForEachAtMeasure(int measure, FCIteratorHandler* pIterator);
455
463 int ForEachAtStaff(int staff, FCIteratorHandler* pIterator);
464
472 FCCell* Find(int measure, int staff);
473
479 FCCell* GetItemAt(int index) const { return (FCCell*) __FCCollection::GetItemAt(index); }
480};
481
482
483
484#endif /* FF_CELL_H */
485
Base class for the Finale Framework classes.
Definition ff_base.h:71
Base class for all collection classes. A collection is a storage that can store multiple objects of s...
Definition ff_basecollection.h:26
__FCBase * GetItemAt(int index) const
Returns the object at the index position. Index is 0-based.
Definition finaleframework.cpp:13767
The class that reference a cell (one measure on one staff) in the musical "grid".
Definition ff_cell.h:18
FCKeySignature * GetKeySignature()
Returns a pointer to the key signature object.
Definition finaleframework.cpp:20178
void RemoveIndependentTimeSigForDisplay()
Removes an independent time signature for display if there is one.
Definition ff_cell.h:333
FCNoteEntryCell * CreateNoteEntryCell(bool shouldload, int loadlayermode=0)
Creates a note entry cell object and optionally loads it with notes.
Definition ff_cell.h:93
TimeEdu32 CalcDuration() const
Returns the duration of the frame, according to the time signature.
Definition ff_cell.h:162
FCTimeSignature * GetTimeSignatureForDisplay()
Returns a pointer to the time signature object. If time signature for display shouldn't be used,...
Definition finaleframework.cpp:20292
FCTimeSignature * AssureSavedIndependentTimeSigForDisplay()
Makes sure that the cell has saved independent time signature for display data.
Definition finaleframework.cpp:20379
int GetMeasure() const
Returns the measure for the cell.
Definition ff_cell.h:120
void ReAssign(int measure, int staff)
Reassigns the cell to a different cell position, which will also delete attached cell data.
Definition ff_cell.h:272
FCKeySignature * CreateCurrentVisibleKeySignature(bool concertpitch=false) const
Returns the visible key signature on the score or part, taking into account transposition as well as ...
Definition ff_cell.h:209
bool CalcContainsEntries()
Returns true if the cell contains entries in any layer. This function takes into account voiced linke...
Definition finaleframework.cpp:20141
FCTimeSignature * GetTimeSignature()
Returns a pointer to the time signature object.
Definition finaleframework.cpp:20275
bool HasIndependentTimeSig()
Returns true if the cell has an independent time signature.
Definition finaleframework.cpp:20194
int GetStaff() const
Returns the staff for the cell.
Definition ff_cell.h:128
bool HasIndependentKeySig()
Returns true if the cell has an independent key signature.
Definition finaleframework.cpp:20207
FCCellMetrics * CreateCellMetrics()
Creates a cell metrics object for a cell. The created object must be disposed after use.
Definition ff_cell.h:289
FCKeySignature * AssureSavedIndependentKeySig()
Makes sure that the cell has saved indepentent key signature data.
Definition finaleframework.cpp:20324
int CalcClefIndexAt(TimeEdu32 pos)
Calculates the clef index at a specific position in the cell.
Definition finaleframework.cpp:20134
FCCell(int measure, int staff)
The constructor.
Definition ff_cell.h:43
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_cell.h:112
bool Save()
Saves any independent key and/or time signatures connected with the cell.
Definition finaleframework.cpp:20071
TimeEdu32 CalcEntryDuration(int layer=0)
Returns the duration for all the entries in the cell. The value of the layer with the longest duratio...
Definition finaleframework.cpp:20097
FCTimeSignature * AssureSavedIndependentTimeSig()
Makes sure that the cell has saved independent time signature data.
Definition finaleframework.cpp:20346
Class that encapsulate the measure metrics info data.
Definition ff_base.h:3817
bool LoadAtCell(FCCell *pCell)
Loads the measure metrics for a cell.
Definition finaleframework.cpp:3766
This class is similar to FCCell, but also includes a position within the measure. It represents a "mu...
Definition ff_cell.h:366
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_cell.h:381
TimeEdu32 GetMeasurePos() const
Returns the (horizontal) duration position within the cell.
Definition ff_cell.h:407
FCCellPos(int measure, int staff, TimeEdu32 measurepos)
The constructor.
Definition ff_cell.h:375
eMeas GetMeasure() const
Returns the measure for the cell.
Definition ff_cell.h:389
eStaff GetStaff() const
Returns the staff for the cell.
Definition ff_cell.h:397
A collection of FCCell members.
Definition ff_cell.h:426
FCCell * GetItemAt(int index) const
Overridden GetItemAt() method that returns a FCCell object.
Definition ff_cell.h:479
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_cell.h:428
FCCells()
The constructor.
Definition ff_cell.h:434
Class for iterator handlers.
Definition ff_iterator.h:26
Class for key signatures. Instances of this class are auto-created by FCMeasure:GetKeySignature and F...
Definition ff_keysig.h:25
void SetID(eKey newkey)
Sets the key signature ID.
Definition ff_keysig.h:79
Class that encapsulates EREGION and provides additional functionality to region handling.
Definition ff_region.h:25
Class that encapsulate a cell of note entries.
Definition ff_noteframe.h:3133
bool Load()
Loads the note entries for the cell. Which layers that will be loaded are controlled by the SetLoadLa...
Definition finaleframework.cpp:18898
void SetLoadLayerMode(int mode)
Sets the "layer mode" for the Load method. This must be called/st before any Load() call.
Definition ff_noteframe.h:3679
Class for time signatures. Instances of this class are auto-created when needed by FCMeasure:GetTimeS...
Definition ff_timesig.h:27