A SERVICE OF

logo

T implement the menu commands, add some new data members to theo
Changes to
TMyWindow class: FileData, IsDirty, and IsNewFile.
TMyWindow
The FileData member is a pointer to a TOpenSaveDialog::TData object. The
FileData
TOpenSaveDialog class is the direct base class of both the TFileOpenDialog
class and the TFileSaveDialog class. Both of these classes use the
TOpenSaveDialog::TData class to contain information about the current file
or file operation, such as the file name, the initial directory to search, file
name filters, and so on.
FileData is initialized in the TMyWindow constructor to a newed
TOpenSaveDialog::TData object. Because FileData is a pointer to an object, a
delete statement must be added to the TMyWindow destructor to ensure
that the object is removed from memory when the application terminates.
The IsDirty flag indicates whether the current drawing is “dirty ” that is,,
IsDirty
whether the drawing has been saved since it was last modified by the user.
If the drawing hasn’t been modified, or if the user hasn’t drawn anything
on an empty window IsDirty is set to FALSE. Otherwise it is set to TRUE.,
IsDirty is set to FALSE in the TMyWindow constructor because the drawing
hasn’t been modified yet.
Outside of the constructor the IsDirty flag is set in a number of functions:,
In the EvLButtonDown function, IsDirty is set to FALSE to reflect the
change made to the drawing.
In the CmFileNew function, IsDirty is set to FALSE when the window is
cleared.
In the OpenFile and SaveFile functions, IsDirty is set to FALSE to reflect
that the drawing hasn’t been modified since last saved or loaded.
The IsNewFile flag indicates whether the file has a name. A file has a name if
IsNewFile
it was loaded from an existing file or has been saved to disk to some file
name. If the file has a name (that is, if it’ been saved previously or wass
loaded from an existing file), the IsNewFile flag is set to FALSE. IsNewFile is
set to TRUE in the TMyWindow constructor because the drawing hasn’t yet
been saved with a name.
Outside the constructor the IsNewFile flag is set in a number of functions:,
In the CmFileNew function, IsNewFile is set to TRUE when the window is
cleared.
54
OWL P ogrammer’ Guider s