M2Document Class Reference
Inherits from | NSPersistentDocument |
Declared in | M2Document.h M2Document.m |
Overview
Controls one open document. Part of Cocoa document-application hierarchy.
Since this class is subclass of NSPersistentDocument, the managed object context is managed for us. This context is then used to persist document data.
Tasks
General helpers
-
documentController
Property for quick access to document controller
property -
sharedContext
Property for quick access to shared data context
property -
– window
Shortcut for retrieving window of document
Array controllers
-
libObjectsController
Controller for managing lib objects
property -
canvasObjectsController
Controller for managing canvas objects
property
Views
-
canvasView
Canvas view
property
Exporting
-
exportView
Accessory view for export panel. Contains format choice combo box.
property -
exportFormatButton
Button for export format choice. Used when saving to determine selected format.
property -
– exportAction:
Action for exporting current document
-
– exportFormats
Returns list of available export formats. Used for interface binding.
-
– exportToURL:withFormat:
Exports current document to URL with specified format.
General actions
-
– instantiateAction:
Action for creating new view on canvas from library objects
-
– removeAction:
Action for removing objects from canvas. Triggered by backspace key.
-
– printAction:
Action for printing current document
Saving and gallery
-
– isSaved
Returns true if current document is saved
-
– galleryAddAction:
Action for adding document to gallery
Importing objects to library
-
– importAction:
Opens import dialog to select file to be imported.
-
– importSVGByURL:
Imports SVG specified by URL
Properties
canvasObjectsController
Controller for managing canvas objects
@property (assign) IBOutlet NSArrayController *canvasObjectsController
Discussion
Controller for managing canvas objects
Declared In
M2Document.h
canvasView
Canvas view
@property (assign) IBOutlet M2CanvasView *canvasView
Discussion
Canvas view
Declared In
M2Document.h
documentController
Property for quick access to document controller
@property (readonly) M2DocumentController *documentController
Discussion
Property for quick access to document controller
Declared In
M2Document.h
exportFormatButton
Button for export format choice. Used when saving to determine selected format.
@property (assign) IBOutlet NSPopUpButton *exportFormatButton
Discussion
Button for export format choice. Used when saving to determine selected format.
Declared In
M2Document.h
exportView
Accessory view for export panel. Contains format choice combo box.
@property (assign) IBOutlet NSView *exportView
Discussion
Accessory view for export panel. Contains format choice combo box.
Declared In
M2Document.h
Instance Methods
exportAction:
Action for exporting current document
- (IBAction)exportAction:(id)sender
Discussion
Action for exporting current document
Declared In
M2Document.h
exportFormats
Returns list of available export formats. Used for interface binding.
- (NSArray *)exportFormats
Discussion
Returns list of available export formats. Used for interface binding.
Declared In
M2Document.h
exportToURL:withFormat:
Exports current document to URL with specified format.
- (void)exportToURL:(NSURL *)url withFormat:(NSString *)format
Discussion
Exports current document to URL with specified format.
Declared In
M2Document.h
galleryAddAction:
Action for adding document to gallery
- (IBAction)galleryAddAction:(id)sender
Discussion
Action for adding document to gallery
Declared In
M2Document.h
importAction:
Opens import dialog to select file to be imported.
- (IBAction)importAction:(id)sender
Discussion
Opens import dialog to select file to be imported.
Declared In
M2Document.h
importSVGByURL:
Imports SVG specified by URL
- (void)importSVGByURL:(NSURL *)url
Discussion
Imports SVG specified by URL
Declared In
M2Document.h
instantiateAction:
Action for creating new view on canvas from library objects
- (IBAction)instantiateAction:(id)sender
Discussion
Action for creating new view on canvas from library objects
Declared In
M2Document.h
isSaved
Returns true if current document is saved
- (BOOL)isSaved
Discussion
Returns true if current document is saved
Declared In
M2Document.h
printAction:
Action for printing current document
- (IBAction)printAction:(id)sender
Discussion
Action for printing current document
Declared In
M2Document.h