32 void _StoreIDForSwitchBack()
34 _lastdocid = FX_GetCurrentEnigmaDocument();
35 if (FX_GetCurrentEnigmaDocument() < 1) _lastdocid = 0;
40 const char*
ClassName()
const override {
return "FCDocument"; }
42#ifdef PDK_FRAMEWORK_LUAFRIENDLY
44 static FCDocument* FCDocument_Lua(
void* ptr, lua_State* L)
46 return _OneOptionalParamLuaConstructor<FCDocument, EDOCID>(ptr, L);
59 _docid = FX_GetCurrentEnigmaDocument();
69 EDOCID
GetID()
const {
return _docid; }
75 bool IsCurrent() {
return _docid == FX_GetCurrentEnigmaDocument(); }
81 if (!pOtherDocument)
return false;
100 bool GetPathSpec(
void *pathspec, EVERSION convertversion);
108 if (_lastdocid != 0)
return false;
109 _docid = FX_GetCurrentEnigmaDocument();
116 if (_lastdocid != 0)
return false;
166#ifdef PDK_FRAMEWORK_LUAFRIENDLY
169 bool SwitchTo(
const FCString* pUndoString,
bool saveedits, _state_ptr S =
nullptr);
183#ifdef PDK_FRAMEWORK_LUAFRIENDLY
184 bool SwitchBack(
bool saveedits, _state_ptr S);
186 bool SwitchBack(
bool saveedits, _state_ptr S =
nullptr);
198 int windowcount = FX_GetWindowCount();
199 if (windowcount == 0)
return false;
200#if FXT_VERSION < FINALEVERSION_2012
201 int datasize =
sizeof (EXDocWindow2009) * windowcount;
202 EXDocWindow2009* pDocwindowarray =
new EXDocWindow2009[windowcount];
203#elif FXT_VERSION < FINALEVERSION_25
204 int datasize =
sizeof (EXDocWindow2012) * windowcount;
205 EXDocWindow2012* pDocwindowarray =
new EXDocWindow2012[windowcount];
207 int datasize =
sizeof (EXDocWindow25) * windowcount;
208 EXDocWindow25* pDocwindowarray =
new EXDocWindow25[windowcount];
210 memset(pDocwindowarray, 0, datasize);
213 FX_GetWindowInfoList(pDocwindowarray, windowcount);
214 bool windowswitched =
false;
215 for (
int i = 0; i < windowcount; i++)
217 if (pDocwindowarray[i].docID == _docid)
219 if (!FX_SetCurrentWindow(pDocwindowarray[i].hWnd))
221 delete [] pDocwindowarray;
224 windowswitched =
true;
228 if (!windowswitched) {
229 delete [] pDocwindowarray;
233 if (!FX_SetCurrentEnigmaDocument(_docid))
235 delete [] pDocwindowarray;
238 FX_RedrawMusic(NULL);
257#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
259 static int Save_CFunc(lua_State* L)
261 return _CFunctionOneOptionalParameter<FCDocument, bool, const FCString*, &FCDocument::Save>(L,
nullptr);
281#ifdef PDK_FRAMEWORK_LUAFRIENDLY
282 bool Open(
const FCString* pFilePath,
bool createwindow,
const FCString* pUndoString,
bool saveedits,
bool addtorecents,
bool hidedialogs, _state_ptr S);
284 bool Open(
const FCString* pFilePath,
bool createwindow,
const FCString* pUndoString,
bool saveedits,
bool addtorecents,
bool hidedialogs, _state_ptr S =
nullptr);
299#ifdef PDK_FRAMEWORK_LUAFRIENDLY
300 bool New(
const FCString* pUndoString,
bool saveedits, _state_ptr S);
302 bool New(
const FCString* pUndoString,
bool saveedits, _state_ptr S =
nullptr);
316#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
318 static int CloseCurrentDocumentAndWindow_CFunc(lua_State *L)
320 return _CFunctionOneOptionalParameterWithState<FCDocument, bool, bool, &FCDocument::CloseCurrentDocumentAndWindow>(L,
true);
333 bool Close(
bool saveedits =
true, _state_ptr S =
nullptr);
335#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
337 static int Close_CFunc(lua_State *L)
339 return _CFunctionOneOptionalParameterWithState<FCDocument, bool, bool, &FCDocument::Close>(L,
true);
358 return FX_IsEnigmaDocumentDirty(
GetID()) != 0;
368 return FX_SetEnigmaDocumentDirty(
GetID(), state);
371#ifdef PDK_FRAMEWORK_DEBUG
393 const char*
ClassName()
const override {
return "FCDocuments"; }
415 for (
int i = 0; i <
GetCount(); i++)
418 if (pObject->
IsCurrent())
return pObject;
431 for (
int i = 0; i <
GetCount(); i++)
434 if (pObject->
GetID() == docid)
return pObject;
Base class for the Finale Framework classes.
Definition ff_base.h:71
static void DebugOutString(const char *pszPrefixText, const char *thestring)
Static method that outputs a line for debugging purposes (C string version). The text appears with th...
Definition finaleframework.cpp:436
static void DebugOutInt(const char *pszPrefixText, int i)
Static method that outputs a line for debugging purposes. The text appears with the extra digit (in d...
Definition finaleframework.cpp:335
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:609
Base class for all collection classes. A collection is a storage that can store multiple objects of s...
Definition ff_basecollection.h:26
int GetCount() const
Returns the number of elements of the collection.
Definition ff_basecollection.h:102
__FCBase * GetItemAt(int index) const
Returns the object at the index position. Index is 0-based.
Definition finaleframework.cpp:13767
Class for an opened Finale document. An opened Finale document has a 1-based ID and can be displayed ...
Definition ff_documents.h:28
bool Close(bool saveedits=true, _state_ptr S=nullptr)
Closes the document. Use this function to close a document if you did not open a document window when...
Definition finaleframework.cpp:32684
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_documents.h:40
bool New(const FCString *pUndoString, bool saveedits, _state_ptr S=nullptr)
Creates an new untitled Finale documnent. The new document automatically gets editing focus....
Definition finaleframework.cpp:32655
bool Print(FCPrintSettings *pSettings)
Prints the document, using the specified printer settings.
Definition finaleframework.cpp:32691
bool Save(const FCString *pFilePath=nullptr)
Saves the current document at the current document path or the specified document path.
Definition finaleframework.cpp:32572
void SetDirty(bool state)
Sets the "dirty" flag for the document (that indicates that the document needs to be saved).
Definition ff_documents.h:366
bool GetPathSpec(void *pathspec, EVERSION convertversion)
Copies the document path to a path spec.
Definition finaleframework.cpp:32532
bool CloseCurrentDocumentAndWindow(bool saveedits=true, _state_ptr S=nullptr)
Closes the current document and any windows it has open. Use this function to close a document if you...
Definition finaleframework.cpp:32675
FCDocument(EDOCID id=-1)
The constructor.
Definition ff_documents.h:56
bool GetPath(FCString *pString)
Gets the full path of the document in a FCString object.
Definition finaleframework.cpp:32709
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_documents.h:372
bool SwitchBack(bool saveedits, _state_ptr S=nullptr)
Ends the started edit block and switch back to the previous document.
Definition finaleframework.cpp:32514
bool DisplayVisually()
Moves the visual focus to the document.
Definition ff_documents.h:195
bool IsIdentical(const __FCBase *pCompareObject) const override
Overridden method for comparison of documents.
Definition ff_documents.h:78
bool GetDirty() const
Returns the "dirty" flag for document (that indicates that the document needs to be saved).
Definition ff_documents.h:356
bool SwitchTo(const FCString *pUndoString, bool saveedits, _state_ptr S=nullptr)
Switch document focus to this document and start a new undo/redo record, without closing the previous...
Definition finaleframework.cpp:32490
bool IsCurrent()
Returns true if the current document is the current document.
Definition ff_documents.h:75
EDOCID GetID() const
Returns the document ID.
Definition ff_documents.h:69
bool _SetID(EDOCID docID)
Directly sets the ID.
Definition ff_documents.h:114
bool SetToCurrent()
Remaps the object to the current document.
Definition ff_documents.h:106
bool IsUntitled()
Returns true if the document has no file connected to it.
Definition finaleframework.cpp:32697
bool Open(const FCString *pFilePath, bool createwindow, const FCString *pUndoString, bool saveedits, bool addtorecents, bool hidedialogs, _state_ptr S=nullptr)
Opens a file as a new Finale document. The new document automatically gets editing focus....
Definition finaleframework.cpp:32582
Class for a collection of documents. Usually used to get all the currently loaded documents in Finale...
Definition ff_documents.h:391
int ForEachWithScope(FCIteratorHandler *pIterator, FCString *pUndoString, _state_ptr S _NOLUACODE(=nullptr))
Works like ForEach, but sets each document into scope before calling the Iterate handler method.
Definition finaleframework.cpp:32803
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_documents.h:393
FCDocument * FindID(EDOCID docid)
Tries to find the document with a specific document ID.
Definition ff_documents.h:429
FCDocument * FindCurrent()
Returns the document in the collection that is the current document.
Definition ff_documents.h:413
FCDocument * GetItemAt(int index) const
Overridden version of GetItemAt().
Definition ff_documents.h:443
int LoadAll()
Gets all open docs into the collection.
Definition finaleframework.cpp:32789
Class for iterator handlers.
Definition ff_iterator.h:26
Class containing printing settings (and the ability to print documents).
Definition ff_base.h:4969
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1877
const char * GetCString() const
Returns a C-string version of the string.
Definition finaleframework.cpp:1338