33 void _StoreIDForSwitchBack()
35 _lastdocid = FX_GetCurrentEnigmaDocument();
36 if (FX_GetCurrentEnigmaDocument() < 1) _lastdocid = 0;
41 const char*
ClassName()
const override {
return "FCDocument"; }
43#ifdef PDK_FRAMEWORK_LUAFRIENDLY
45 static FCDocument* FCDocument_Lua(
void* ptr, lua_State* L)
47 return _OneOptionalParamLuaConstructor<FCDocument, EDOCID>(ptr, L);
60 _docid = FX_GetCurrentEnigmaDocument();
70 EDOCID
GetID()
const {
return _docid; }
76 bool IsCurrent() {
return _docid == FX_GetCurrentEnigmaDocument(); }
82 if (!pOtherDocument)
return false;
135 bool GetPathSpec(
void *pathspec, EVERSION convertversion);
143 if (_lastdocid != 0)
return false;
144 _docid = FX_GetCurrentEnigmaDocument();
151 if (_lastdocid != 0)
return false;
201#ifdef PDK_FRAMEWORK_LUAFRIENDLY
204 bool SwitchTo(
const FCString* pUndoString,
bool saveedits, _state_ptr S =
nullptr);
218#ifdef PDK_FRAMEWORK_LUAFRIENDLY
219 bool SwitchBack(
bool saveedits, _state_ptr S);
221 bool SwitchBack(
bool saveedits, _state_ptr S =
nullptr);
233 int windowcount = FX_GetWindowCount();
234 if (windowcount == 0)
return false;
235#if FXT_VERSION < FINALEVERSION_2012
236 int datasize =
sizeof (EXDocWindow2009) * windowcount;
237 EXDocWindow2009* pDocwindowarray =
new EXDocWindow2009[windowcount];
238#elif FXT_VERSION < FINALEVERSION_25
239 int datasize =
sizeof (EXDocWindow2012) * windowcount;
240 EXDocWindow2012* pDocwindowarray =
new EXDocWindow2012[windowcount];
242 int datasize =
sizeof (EXDocWindow25) * windowcount;
243 EXDocWindow25* pDocwindowarray =
new EXDocWindow25[windowcount];
245 memset(pDocwindowarray, 0, datasize);
248 FX_GetWindowInfoList(pDocwindowarray, windowcount);
249 bool windowswitched =
false;
250 for (
int i = 0; i < windowcount; i++)
252 if (pDocwindowarray[i].docID == _docid)
254 if (!FX_SetCurrentWindow(pDocwindowarray[i].hWnd))
256 delete [] pDocwindowarray;
259 windowswitched =
true;
263 if (!windowswitched) {
264 delete [] pDocwindowarray;
268 if (!FX_SetCurrentEnigmaDocument(_docid))
270 delete [] pDocwindowarray;
273 FX_RedrawMusic(NULL);
292#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
294 static int Save_CFunc(lua_State* L)
296 return _CFunctionOneOptionalParameter<FCDocument, bool, const FCString*, &FCDocument::Save>(L,
nullptr);
316#ifdef PDK_FRAMEWORK_LUAFRIENDLY
317 bool Open(
const FCString* pFilePath,
bool createwindow,
const FCString* pUndoString,
bool saveedits,
bool addtorecents,
bool hidedialogs, _state_ptr S);
319 bool Open(
const FCString* pFilePath,
bool createwindow,
const FCString* pUndoString,
bool saveedits,
bool addtorecents,
bool hidedialogs, _state_ptr S =
nullptr);
334#ifdef PDK_FRAMEWORK_LUAFRIENDLY
335 bool New(
const FCString* pUndoString,
bool saveedits, _state_ptr S);
337 bool New(
const FCString* pUndoString,
bool saveedits, _state_ptr S =
nullptr);
351#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
353 static int CloseCurrentDocumentAndWindow_CFunc(lua_State *L)
355 return _CFunctionOneOptionalParameterWithState<FCDocument, bool, bool, &FCDocument::CloseCurrentDocumentAndWindow>(L,
true);
368 bool Close(
bool saveedits =
true, _state_ptr S =
nullptr);
370#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
372 static int Close_CFunc(lua_State *L)
374 return _CFunctionOneOptionalParameterWithState<FCDocument, bool, bool, &FCDocument::Close>(L,
true);
393 return FX_IsEnigmaDocumentDirty(
GetID()) != 0;
403 return FX_SetEnigmaDocumentDirty(
GetID(), state);
406#ifdef PDK_FRAMEWORK_DEBUG
428 const char*
ClassName()
const override {
return "FCDocuments"; }
450 for (
int i = 0; i <
GetCount(); i++)
453 if (pObject->
IsCurrent())
return pObject;
466 for (
int i = 0; i <
GetCount(); i++)
469 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:864
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
virtual void DebugDump()
Outputs the class data/information for debugging purposes.
Definition finaleframework.cpp:1037
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:14195
Class for an opened Finale document. An opened Finale document has a 1-based ID and can be displayed ...
Definition ff_documents.h:29
EVERSION GetModifiedVersion() const
Returns the Enigma version from the "modified" file header field.
Definition finaleframework.cpp:32978
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:33179
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:41
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:33150
bool Print(FCPrintSettings *pSettings)
Prints the document, using the specified printer settings.
Definition finaleframework.cpp:33186
bool Save(const FCString *pFilePath=nullptr)
Saves the current document at the current document path or the specified document path.
Definition finaleframework.cpp:33067
void SetDirty(bool state)
Sets the "dirty" flag for the document (that indicates that the document needs to be saved).
Definition ff_documents.h:401
bool GetPathSpec(void *pathspec, EVERSION convertversion)
Copies the document path to a path spec.
Definition finaleframework.cpp:33027
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:33170
FCDocument(EDOCID id=-1)
The constructor.
Definition ff_documents.h:57
bool GetPath(FCString *pString)
Gets the full path of the document in a FCString object.
Definition finaleframework.cpp:33204
void DebugDump() override
Outputs the class data/information for debugging purposes.
Definition ff_documents.h:407
bool SwitchBack(bool saveedits, _state_ptr S=nullptr)
Ends the started edit block and switch back to the previous document.
Definition finaleframework.cpp:33009
std::string GetCreatedDate() const
Returns the document creation date from the file header in ISO format.
Definition finaleframework.cpp:32957
bool DisplayVisually()
Moves the visual focus to the document.
Definition ff_documents.h:230
bool IsIdentical(const __FCBase *pCompareObject) const override
Overridden method for comparison of documents.
Definition ff_documents.h:79
EVERSION GetCreatedVersion() const
Returns the Enigma version from the "created" file header field.
Definition finaleframework.cpp:32971
bool GetDirty() const
Returns the "dirty" flag for document (that indicates that the document needs to be saved).
Definition ff_documents.h:391
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:32985
bool IsCurrent()
Returns true if the current document is the current document.
Definition ff_documents.h:76
EDOCID GetID() const
Returns the document ID.
Definition ff_documents.h:70
bool _SetID(EDOCID docID)
Directly sets the ID.
Definition ff_documents.h:149
bool SetToCurrent()
Remaps the object to the current document.
Definition ff_documents.h:141
std::string GetModifiedDate() const
Returns the document modified date from the file header in ISO format.
Definition finaleframework.cpp:32964
bool IsUntitled()
Returns true if the document has no file connected to it.
Definition finaleframework.cpp:33192
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:33077
Class for a collection of documents. Usually used to get all the currently loaded documents in Finale...
Definition ff_documents.h:426
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:33298
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:428
FCDocument * FindID(EDOCID docid)
Tries to find the document with a specific document ID.
Definition ff_documents.h:464
FCDocument * FindCurrent()
Returns the document in the collection that is the current document.
Definition ff_documents.h:448
FCDocument * GetItemAt(int index) const
Overridden version of GetItemAt().
Definition ff_documents.h:478
int LoadAll()
Gets all open docs into the collection.
Definition finaleframework.cpp:33284
Class for iterator handlers.
Definition ff_iterator.h:26
Class containing printing settings (and the ability to print documents).
Definition ff_base.h:5023
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1931
const char * GetCString() const
Returns a C-string version of the string.
Definition finaleframework.cpp:1766