mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:00:37 +00:00
Added MacOS 10.4 methods for NSDocument, NSDocumentController,
NSPrintOperation, NSResponder and NSCell. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24378 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6f754401c4
commit
9a71af08ad
25 changed files with 1902 additions and 521 deletions
47
ChangeLog
47
ChangeLog
|
@ -1,3 +1,50 @@
|
|||
2007-01-17 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSResponder.h: Add MacOS 10.4 methods.
|
||||
* Source/NSResponder.m: Implement new MacOS 10.4 methods.
|
||||
* Headers/AppKit/NSDocumentFrameworkPrivate.h: Remove.
|
||||
* Source/NSDocumentFrameworkPrivate.h: Add.
|
||||
* Source/GNUmakefile: Don't install NSDocumentFrameworkPrivate.h.
|
||||
* Headers/AppKit/NSDocument.h: Add MacOS 10.4 methods and
|
||||
additional ivars. Rename ivars to adopt to coding standards.
|
||||
* Source/NSDocument.m: Implement new MacOS 10.4 methods adopted
|
||||
to changes of ivar names.
|
||||
* Headers/AppKit/NSDocument.h: Add MacOS 10.4 methods and
|
||||
additional ivars. Rename ivars to adopt to coding standards.
|
||||
* Source/NSDocument.m: Adopt include of NSDocumentFrameworkPrivate.h.
|
||||
Implement new MacOS 10.4 methods and adopt to changes of ivar names.
|
||||
* Headers/AppKit/NSDocumentController.h: Add MacOS 10.4 methods and
|
||||
additional ivars. Rename ivars to adopt to coding standards. Fix includes.
|
||||
* Source/NSDocumentController.m: Adopt include of NSDocumentFrameworkPrivate.h.
|
||||
Implement new MacOS 10.4 methods and adopt to changes of ivar names.
|
||||
* Headers/AppKit/NSWindowController.h: Rename ivars to adopt to coding standards.
|
||||
* Source/NSWindowController.m: Adopt include of NSDocumentFrameworkPrivate.h.
|
||||
Adopt to changes of ivar names.
|
||||
|
||||
* Headers/AppKit/NSPrintOperation.h: Add MacOS 10.4 methods and
|
||||
additional ivars. Rename ivars to adopt to coding standards.
|
||||
* Source/NSPrintOperation.m: Implement new MacOS 10.4 methods and
|
||||
adopt to changes of ivar names.
|
||||
* Source/GSPrintOperation.m,
|
||||
* Source/GSEPSPrintOperation.m,
|
||||
* Printing/GSLPR/GSLPRPrintOperation.m,
|
||||
* Printing/GSCUPS/GSCUPSPrintOperation.m: Adopt to changes in super class.
|
||||
|
||||
* Headers/AppKit/NSCell.h: Add MacOS 10.4 methods and
|
||||
additional ivars. Store the state in two bits only. Rename ivar to
|
||||
adopt to coding standards. Move mnemonic_location into flags.
|
||||
* Source/NSCell.m: Implement new MacOS 10.3 and 10.4 methods and
|
||||
adopt to changes of ivar names. Add encoding and decoding of new
|
||||
ivars and improve keyed coding and decoding.
|
||||
|
||||
* Headers/AppKit/NSColor.h: Adopt values of NSControlTint
|
||||
enumerator to Cocoa values.
|
||||
* Headers/AppKit/NSParagraphstyle.h: Add protection against double inclusion.
|
||||
* Source/GSServicemanager.m,
|
||||
* Source/NSAttributedString.m,
|
||||
* Source/NSView.m,
|
||||
* Source/NSApplication.m: Correct includes to avoid compiler warnings.
|
||||
|
||||
2007-01-14 Stefan Bidigaray
|
||||
|
||||
* Source/NSWindow.m:
|
||||
|
|
|
@ -36,8 +36,12 @@
|
|||
|
||||
// For tint
|
||||
#include <AppKit/NSColor.h>
|
||||
// for NSWritingDirection
|
||||
#include <AppKit/NSParagraphStyle.h>
|
||||
// For text alignment
|
||||
#include <AppKit/NSText.h>
|
||||
// for NSFocusRingType
|
||||
#include <AppKit/NSView.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSMutableDictionary;
|
||||
|
@ -58,9 +62,9 @@ enum {
|
|||
NSPositiveIntType,
|
||||
NSFloatType,
|
||||
NSPositiveFloatType,
|
||||
NSDateType,
|
||||
NSDoubleType,
|
||||
NSPositiveDoubleType
|
||||
NSPositiveDoubleType,
|
||||
NSDateType
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -121,7 +125,7 @@ enum {
|
|||
NSString *_contents;
|
||||
NSImage *_cell_image;
|
||||
NSFont *_font;
|
||||
id _objectValue;
|
||||
id _object_value;
|
||||
struct GSCellFlagsType {
|
||||
// total 32 bits. 0 bits left.
|
||||
unsigned contents_is_attributed_string: 1;
|
||||
|
@ -144,30 +148,40 @@ enum {
|
|||
unsigned type: 2; // 3 values
|
||||
unsigned image_position: 3; // 7 values
|
||||
unsigned entry_type: 4; // 8 values
|
||||
unsigned allows_undo: 1;
|
||||
unsigned line_break_mode: 3; // 6 values
|
||||
|
||||
// total 19 bits. 4 bits extension, 9 bits left.
|
||||
int state: 2; // 3 values but one negative
|
||||
unsigned mnemonic_location: 8;
|
||||
unsigned control_tint: 3;
|
||||
unsigned control_size: 2;
|
||||
unsigned focus_ring_type: 2; // 3 values
|
||||
unsigned base_writing_direction: 2; // 3 values
|
||||
// 4 bits reserved for subclass use
|
||||
unsigned subclass_bool_one: 1;
|
||||
unsigned subclass_bool_two: 1;
|
||||
unsigned subclass_bool_three: 1;
|
||||
unsigned subclass_bool_four: 1;
|
||||
/* This is not in the bitfield now (for simpler macosx compatibility)
|
||||
but who knows in the future */
|
||||
int state; // 3 values but one negative
|
||||
} _cell;
|
||||
unsigned char _mnemonic_location;
|
||||
unsigned int _mouse_down_flags;
|
||||
unsigned int _action_mask;
|
||||
NSFormatter *_formatter;
|
||||
NSMenu *_menu;
|
||||
id _represented_object;
|
||||
void *_reserved1;
|
||||
}
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
+ (NSFocusRingType)defaultFocusRingType;
|
||||
#endif
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
+ (NSMenu *)defaultMenu;
|
||||
#endif
|
||||
+ (BOOL) prefersTrackingUntilMouseUp;
|
||||
+ (BOOL)prefersTrackingUntilMouseUp;
|
||||
|
||||
//
|
||||
// Initializing an NSCell
|
||||
|
@ -217,6 +231,10 @@ enum {
|
|||
- (BOOL)isOpaque;
|
||||
- (void)setBezeled:(BOOL)flag;
|
||||
- (void)setBordered:(BOOL)flag;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
- (NSFocusRingType)focusRingType;
|
||||
- (void)setFocusRingType:(NSFocusRingType)type;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Setting the NSCell's State
|
||||
|
@ -254,6 +272,14 @@ enum {
|
|||
- (void)setTitle:(NSString *)aString;
|
||||
- (NSString *)title;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
- (NSWritingDirection)baseWritingDirection;
|
||||
- (void)setBaseWritingDirection:(NSWritingDirection)direction;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSLineBreakMode)lineBreakMode;
|
||||
- (void)setLineBreakMode:(NSLineBreakMode)mode;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Target and Action
|
||||
|
@ -437,6 +463,10 @@ enum {
|
|||
- (BOOL)sendsActionOnEndEditing;
|
||||
- (void)setSendsActionOnEndEditing:(BOOL)flag;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (BOOL)allowsUndo;
|
||||
- (void)setAllowsUndo:(BOOL)flag;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
|
||||
typedef enum _NSControlTint {
|
||||
NSDefaultControlTint,
|
||||
NSClearControlTint,
|
||||
NSBlueControlTint,
|
||||
NSGraphiteControlTint
|
||||
NSGraphiteControlTint = 6,
|
||||
NSClearControlTint
|
||||
} NSControlTint;
|
||||
|
||||
typedef enum _NSControlSize {
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
Author: Carl Lindberg <Carl.Lindberg@hbo.com>
|
||||
Date: 1999
|
||||
Modifications: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: Dec 2006
|
||||
Added MacOS 10.4 methods.
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -41,6 +44,9 @@
|
|||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSData;
|
||||
@class NSDate;
|
||||
@class NSDictionary;
|
||||
@class NSError;
|
||||
@class NSFileManager;
|
||||
@class NSURL;
|
||||
@class NSUndoManager;
|
||||
|
@ -50,7 +56,9 @@
|
|||
@class NSView;
|
||||
@class NSSavePanel;
|
||||
@class NSMenuItem;
|
||||
@class NSPageLayout;
|
||||
@class NSPrintInfo;
|
||||
@class NSPrintOperation;
|
||||
@class NSPopUpButton;
|
||||
@class NSFileWrapper;
|
||||
@class NSDocumentController;
|
||||
|
@ -60,49 +68,87 @@
|
|||
typedef enum _NSDocumentChangeType {
|
||||
NSChangeDone = 0,
|
||||
NSChangeUndone = 1,
|
||||
NSChangeCleared = 2
|
||||
NSChangeCleared = 2,
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
NSChangeReadOtherContents = 3,
|
||||
NSChangeAutosaved = 4
|
||||
#endif
|
||||
} NSDocumentChangeType;
|
||||
|
||||
typedef enum _NSSaveOperationType {
|
||||
NSSaveOperation = 0,
|
||||
NSSaveAsOperation = 1,
|
||||
NSSaveToOperation = 2
|
||||
NSSaveToOperation = 2,
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
NSAutosaveOperation = 3
|
||||
#endif
|
||||
} NSSaveOperationType;
|
||||
|
||||
@interface NSDocument : NSObject
|
||||
{
|
||||
@private
|
||||
NSWindow *_window; // Outlet for the single window case
|
||||
NSMutableArray *_windowControllers; // WindowControllers for this document
|
||||
NSString *_fileName; // Save location
|
||||
NSString *_fileType; // file/document type
|
||||
NSPrintInfo *_printInfo; // print info record
|
||||
long _changeCount; // number of time the document has been changed
|
||||
NSView *savePanelAccessory; // outlet for the accessory save-panel view
|
||||
NSPopUpButton *spaButton; // outlet for "the File Format:" button in the save panel.
|
||||
int _documentIndex; // Untitled index
|
||||
NSUndoManager *_undoManager; // Undo manager for this document
|
||||
NSString *_saveType; // the currently selected extension.
|
||||
NSMutableArray *_window_controllers; // WindowControllers for this document
|
||||
NSURL *_file_url; // Save location as URL
|
||||
NSString *_file_name; // Save location
|
||||
NSString *_file_type; // file/document type
|
||||
NSDate *_file_modification_date;// file modification date
|
||||
NSString *_last_component_file_name; // file name last component
|
||||
NSURL *_autosaved_file_url; // Autosave location as URL
|
||||
NSPrintInfo *_print_info; // print info record
|
||||
NSView *_save_panel_accessory; // outlet for the accessory save-panel view
|
||||
NSPopUpButton *_spa_button; // outlet for "the File Format:" button in the save panel.
|
||||
NSString *_save_type; // the currently selected extension.
|
||||
NSUndoManager *_undo_manager; // Undo manager for this document
|
||||
long _change_count; // number of time the document has been changed
|
||||
long _autosave_change_count; // number of time the document has been changed since the last autosave
|
||||
int _document_index; // Untitled index
|
||||
struct __docFlags {
|
||||
unsigned int inClose:1;
|
||||
unsigned int hasUndoManager:1;
|
||||
unsigned int in_close:1;
|
||||
unsigned int has_undo_manager:1;
|
||||
unsigned int RESERVED:30;
|
||||
} _docFlags;
|
||||
} _doc_flags;
|
||||
void *_reserved1;
|
||||
}
|
||||
|
||||
+ (NSArray *)readableTypes;
|
||||
+ (NSArray *)writableTypes;
|
||||
+ (BOOL)isNativeType:(NSString *)type;
|
||||
|
||||
/*" Initialization "*/
|
||||
- (id)init;
|
||||
- (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)fileType;
|
||||
- (id)initWithContentsOfURL:(NSURL *)url ofType:(NSString *)fileType;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id)initForURL:(NSURL *)forUrl
|
||||
withContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (id)initWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (id)initWithType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
#endif
|
||||
|
||||
/*" Window management "*/
|
||||
- (NSArray *)windowControllers;
|
||||
- (void)addWindowController:(NSWindowController *)windowController;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, MAC_OS_X_VERSION_10_4)
|
||||
- (BOOL)shouldCloseWindowController:(NSWindowController *)windowController;
|
||||
#endif
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
- (void)shouldCloseWindowController:(NSWindowController *)windowController
|
||||
delegate:(id)delegate
|
||||
shouldCloseSelector:(SEL)callback
|
||||
contextInfo:(void *)contextInfo;
|
||||
#endif
|
||||
- (void)showWindows;
|
||||
- (void)removeWindowController:(NSWindowController *)windowController;
|
||||
- (void)setWindow:(NSWindow *)aWindow;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSWindow *)windowForSheet;
|
||||
#endif
|
||||
|
||||
/*" Window controller creation "*/
|
||||
- (void)makeWindowControllers; // Manual creation
|
||||
|
@ -125,16 +171,28 @@ typedef enum _NSSaveOperationType {
|
|||
|
||||
/*" Closing "*/
|
||||
- (void)close;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, MAC_OS_X_VERSION_10_4)
|
||||
- (BOOL)canCloseDocument;
|
||||
#endif
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
- (void)canCloseDocumentWithDelegate:(id)delegate
|
||||
shouldCloseSelector:(SEL)shouldCloseSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
#endif
|
||||
|
||||
/*" Type and location "*/
|
||||
- (NSString *)fileName;
|
||||
- (void)setFileName:(NSString *)fileName;
|
||||
- (NSString *)fileType;
|
||||
- (void)setFileType:(NSString *)type;
|
||||
+ (NSArray *)readableTypes;
|
||||
+ (NSArray *)writableTypes;
|
||||
+ (BOOL)isNativeType:(NSString *)type;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSURL *)fileURL;
|
||||
- (void)setFileURL:(NSURL *)url;
|
||||
- (NSDate *)fileModificationDate;
|
||||
- (void)setFileModificationDate: (NSDate *)date;
|
||||
- (NSString *)lastComponentOfFileName;
|
||||
- (void)setLastComponentOfFileName:(NSString *)str;
|
||||
#endif
|
||||
|
||||
/*" Read/Write/Revert "*/
|
||||
|
||||
|
@ -152,11 +210,43 @@ typedef enum _NSSaveOperationType {
|
|||
- (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)type;
|
||||
- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)type;
|
||||
- (BOOL)revertToSavedFromURL:(NSURL *)url ofType:(NSString *)type;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSData *)dataOfType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (NSFileWrapper *)fileWrapperOfType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (BOOL)readFromData:(NSData *)data
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (BOOL)readFromFileWrapper:(NSFileWrapper *)wrapper
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (BOOL)readFromURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (BOOL)revertToContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (BOOL)writeSafelyToURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
forSaveOperation:(NSSaveOperationType)op
|
||||
error:(NSError **)error;
|
||||
- (BOOL)writeToURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)error;
|
||||
- (BOOL)writeToURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
forSaveOperation:(NSSaveOperationType)op
|
||||
originalContentsURL:(NSURL *)orig
|
||||
error:(NSError **)error;
|
||||
#endif
|
||||
|
||||
/*" Save panel "*/
|
||||
- (BOOL)shouldRunSavePanelWithAccessoryView;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, MAC_OS_X_VERSION_10_4)
|
||||
- (NSString *)fileNameFromRunningSavePanelForSaveOperation:(NSSaveOperationType)saveOperation;
|
||||
- (int)runModalSavePanel:(NSSavePanel *)savePanel withAccessoryView:(NSView *)accessoryView;
|
||||
#endif
|
||||
- (NSString *)fileTypeFromLastRunSavePanel;
|
||||
- (NSDictionary *)fileAttributesToWriteToFile: (NSString *)fullDocumentPath
|
||||
ofType: (NSString *)docType
|
||||
|
@ -168,6 +258,15 @@ typedef enum _NSSaveOperationType {
|
|||
- (BOOL)writeWithBackupToFile:(NSString *)fileName
|
||||
ofType:(NSString *)fileType
|
||||
saveOperation:(NSSaveOperationType)saveOp;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSArray *)writableTypesForSaveOperation:(NSSaveOperationType)op;
|
||||
- (NSDictionary *)fileAttributesToWriteToURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
forSaveOperation:(NSSaveOperationType)op
|
||||
originalContentsURL:(NSURL *)original
|
||||
error:(NSError **)error;
|
||||
- (BOOL)fileNameExtensionWasHiddenInLastRunSavePanel;
|
||||
#endif
|
||||
|
||||
/*" Printing "*/
|
||||
- (NSPrintInfo *)printInfo;
|
||||
|
@ -177,6 +276,24 @@ typedef enum _NSSaveOperationType {
|
|||
- (int)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)printInfo;
|
||||
- (IBAction)printDocument:(id)sender;
|
||||
- (void)printShowingPrintPanel:(BOOL)flag;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (BOOL)preparePageLayout:(NSPageLayout *)pageLayout;
|
||||
- (void)runModalPageLayoutWithPrintInfo:(NSPrintInfo *)info
|
||||
delegate:(id)delegate
|
||||
didRunSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
- (void)printDocumentWithSettings:(NSDictionary *)settings
|
||||
showPrintPanel:(BOOL)flag
|
||||
delegate:(id)delegate
|
||||
didPrintSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)settings
|
||||
error:(NSError **)error;
|
||||
- (void)runModalPrintOperation:(NSPrintOperation *)op
|
||||
delegate:(id)delegate
|
||||
didRunSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
#endif
|
||||
|
||||
/*" IB Actions "*/
|
||||
- (IBAction)saveDocument:(id)sender;
|
||||
|
@ -195,13 +312,6 @@ typedef enum _NSSaveOperationType {
|
|||
- (void)setHasUndoManager:(BOOL)flag;
|
||||
|
||||
/* NEW delegate operations*/
|
||||
- (void)shouldCloseWindowController:(NSWindowController *)windowController
|
||||
delegate:(id)delegate
|
||||
shouldCloseSelector:(SEL)callback
|
||||
contextInfo:(void *)contextInfo;
|
||||
- (void)canCloseDocumentWithDelegate:(id)delegate
|
||||
shouldCloseSelector:(SEL)shouldCloseSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
- (void)saveToFile:(NSString *)fileName
|
||||
saveOperation:(NSSaveOperationType)saveOperation
|
||||
delegate:(id)delegate
|
||||
|
@ -216,6 +326,36 @@ typedef enum _NSSaveOperationType {
|
|||
didSaveSelector:(SEL)didSaveSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (BOOL)saveToURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
forSaveOperation:(NSSaveOperationType)op
|
||||
error:(NSError **)error;
|
||||
- (BOOL)saveToURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
forSaveOperation:(NSSaveOperationType)op
|
||||
delegate:(id)delegate
|
||||
didSaveSelector:(SEL)didSaveSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
|
||||
/* Autosaving */
|
||||
- (NSURL *)autosavedContentsFileURL;
|
||||
- (void)setAutosavedContentsFileURL:(NSURL *)url;
|
||||
- (void)autosaveDocumentWithDelegate:(id)delegate
|
||||
didAutosaveSelector:(SEL)didAutosaveSelector
|
||||
contextInfo:(void *)context;
|
||||
- (NSString *)autosavingFileType;
|
||||
- (BOOL)hasUnautosavedChanges;
|
||||
|
||||
|
||||
- (BOOL)presentError:(NSError *)error;
|
||||
- (void)presentError:(NSError *)error
|
||||
modalForWindow:(NSWindow *)window
|
||||
delegate:(id)delegate
|
||||
didPresentSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
- (NSError *)willPresentError:(NSError *)error;
|
||||
#endif
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSDocument
|
||||
|
|
|
@ -32,27 +32,33 @@
|
|||
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <AppKit/NSNibDeclarations.h>
|
||||
#include <AppKit/NSUserInterfaceValidation.h>
|
||||
|
||||
@class NSArray, NSMutableArray;
|
||||
@class NSArray;
|
||||
@class NSError;
|
||||
@class NSMutableArray;
|
||||
@class NSURL;
|
||||
@class NSMenuItem, NSOpenPanel, NSWindow;
|
||||
@class NSString;
|
||||
|
||||
@class NSDocument;
|
||||
@class NSMenuItem;
|
||||
@class NSOpenPanel;
|
||||
@class NSWindow;
|
||||
|
||||
@interface NSDocumentController : NSObject
|
||||
{
|
||||
@private
|
||||
NSMutableArray *_documents;
|
||||
NSMutableArray *_recentDocuments;
|
||||
struct __controllerFlags {
|
||||
unsigned int shouldCreateUI:1;
|
||||
unsigned int RESERVED:31;
|
||||
} _controllerFlags;
|
||||
NSMutableArray *_recent_documents;
|
||||
NSArray *_types; // from info.plist with key NSTypes
|
||||
NSTimeInterval _autosavingDelay;
|
||||
struct __controller_flags {
|
||||
unsigned int should_create_ui:1;
|
||||
unsigned int RESERVED:31;
|
||||
} _controller_flags;
|
||||
void *_reserved1;
|
||||
void *_reserved2;
|
||||
}
|
||||
|
||||
+ (id)sharedDocumentController;
|
||||
|
@ -67,6 +73,32 @@
|
|||
|
||||
- (id)makeDocumentWithContentsOfURL:(NSURL *)url ofType:(NSString *)type;
|
||||
- (id)openDocumentWithContentsOfURL:(NSURL *)url display:(BOOL)display;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id)makeDocumentForURL:(NSURL *)url
|
||||
withContentsOfURL:(NSURL *)contents
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)err;
|
||||
- (id)makeDocumentWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)err;
|
||||
- (id)makeUntitledDocumentOfType:(NSString *)type
|
||||
error:(NSError **)err;
|
||||
- (id)openDocumentWithContentsOfURL:(NSURL *) url
|
||||
display:(BOOL) flag
|
||||
error:(NSError **) err;
|
||||
- (id)openUntitledDocumentAndDisplay:(BOOL)flag
|
||||
error:(NSError **)err;
|
||||
- (BOOL)reopenDocumentForURL:(NSURL *)url
|
||||
withContentsOfURL:(NSURL *)contents
|
||||
error:(NSError **)err;
|
||||
- (BOOL)presentError:(NSError *)err;
|
||||
- (void)presentError:(NSError *)err
|
||||
modalForWindow:(NSWindow *)win
|
||||
delegate:(id)delegate
|
||||
didPresentSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
- (NSError *)willPresentError:(NSError *)err;
|
||||
#endif
|
||||
|
||||
/*" With or without UI "*/
|
||||
- (BOOL)shouldCreateUI;
|
||||
|
@ -107,6 +139,9 @@
|
|||
- (NSString *)currentDirectory;
|
||||
- (id)documentForWindow:(NSWindow *)window;
|
||||
- (id)documentForFileName:(NSString *)fileName;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (id)documentForURL:(NSURL *)url;
|
||||
#endif
|
||||
|
||||
|
||||
/*" Menu validation "*/
|
||||
|
@ -118,10 +153,20 @@
|
|||
- (NSString *)typeFromFileExtension:(NSString *)fileExtension;
|
||||
- (NSArray *)fileExtensionsFromType:(NSString *)type;
|
||||
- (Class)documentClassForType:(NSString *)type;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (NSString *)defaultType;
|
||||
- (NSArray *)documentClassNames;
|
||||
- (NSString *)typeForContentsOfURL:(NSURL *)url error:(NSError **)err;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
/* Autosaving */
|
||||
- (NSTimeInterval)autosavingDelay;
|
||||
- (void)setAutosavingDelay:(NSTimeInterval)autosavingDelay;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#endif // GS_API_MACOSX
|
||||
|
||||
#endif // _GNUstep_H_NSDocumentController
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
NSParagraphStyle.h
|
||||
|
||||
NSParagraphStyle and NSMutableParagraphStyle hold paragraph style
|
||||
|
@ -7,7 +6,7 @@
|
|||
|
||||
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Daniel Bðhringer <boehring@biomed.ruhr-uni-bochum.de>
|
||||
Author: Daniel Böhringer <boehring@biomed.ruhr-uni-bochum.de>
|
||||
Date: August 1998
|
||||
Update: Richard Frith-Macdonald <richard@brainstorm.co.uk> March 1999
|
||||
|
||||
|
@ -29,6 +28,9 @@
|
|||
51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef _GNUstep_H_NSParagraphStyle
|
||||
#define _GNUstep_H_NSParagraphStyle
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#include <AppKit/NSText.h>
|
||||
|
||||
|
@ -135,7 +137,7 @@ typedef enum _NSWritingDirection {
|
|||
- (float) maximumLineHeight;
|
||||
- (NSLineBreakMode) lineBreakMode;
|
||||
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
|
||||
/*
|
||||
* Returns the writing direction of "language", which is an ISO 639
|
||||
* two- or three letter code, e.g. "en", or an ISO language-region
|
||||
|
@ -165,7 +167,9 @@ typedef enum _NSWritingDirection {
|
|||
- (void) setTabStops: (NSArray*)array;
|
||||
- (void) setParagraphStyle: (NSParagraphStyle*)obj;
|
||||
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
|
||||
- (void) setBaseWritingDirection: (NSWritingDirection)direction;
|
||||
#endif
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSParagraphStyle
|
||||
|
|
|
@ -61,17 +61,22 @@ typedef enum _NSPrintingPageOrder {
|
|||
@interface NSPrintOperation : NSObject
|
||||
{
|
||||
// Attributes
|
||||
NSPrintInfo *_printInfo;
|
||||
NSPrintInfo *_print_info;
|
||||
NSView *_view;
|
||||
NSRect _rect;
|
||||
NSMutableData *_data;
|
||||
NSString *_path;
|
||||
NSGraphicsContext *_context;
|
||||
NSPrintPanel *_printPanel;
|
||||
NSView *_accessoryView;
|
||||
NSPrintingPageOrder _pageOrder;
|
||||
BOOL _showPanels;
|
||||
//BOOL _pathSet; removed, just test _path for nil
|
||||
NSPrintPanel *_print_panel;
|
||||
NSView *_accessory_view;
|
||||
NSString *_job_style_hint;
|
||||
NSPrintingPageOrder _page_order;
|
||||
struct __Flags {
|
||||
unsigned int show_print_panel:1;
|
||||
unsigned int show_progress_panel:1;
|
||||
unsigned int can_spawn_separate_thread:1;
|
||||
unsigned int RESERVED:29;
|
||||
} _flags;
|
||||
int _currentPage;
|
||||
}
|
||||
|
||||
|
@ -137,6 +142,12 @@ typedef enum _NSPrintingPageOrder {
|
|||
- (BOOL)showPanels;
|
||||
- (void)setPrintPanel:(NSPrintPanel *)panel;
|
||||
- (void)setShowPanels:(BOOL)flag;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (BOOL)showsPrintPanel;
|
||||
- (void)setShowsPrintPanel:(BOOL)flag;
|
||||
- (BOOL)showsProgressPanel;
|
||||
- (void)setShowsProgressPanel:(BOOL)flag;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
- (NSView *)accessoryView;
|
||||
|
@ -164,10 +175,16 @@ typedef enum _NSPrintingPageOrder {
|
|||
- (BOOL)deliverResult;
|
||||
- (BOOL)runOperation;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
- (void)runOperationModalForWindow: (NSWindow *)docWindow
|
||||
delegate: (id)delegate
|
||||
didRunSelector: (SEL)didRunSelector
|
||||
- (void)runOperationModalForWindow:(NSWindow *)docWindow
|
||||
delegate:(id)delegate
|
||||
didRunSelector:(SEL)didRunSelector
|
||||
contextInfo:(void *)contextInfo;
|
||||
- (BOOL)canSpawnSeparateThread;
|
||||
- (void)setCanSpawnSeparateThread:(BOOL)flag;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
|
||||
- (NSString *) jobStyleHint;
|
||||
- (void)setJobStyleHint:(NSString *)hint;
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
@ -36,10 +36,13 @@
|
|||
#include <AppKit/AppKitDefines.h>
|
||||
|
||||
@class NSCoder;
|
||||
@class NSError;
|
||||
@class NSString;
|
||||
|
||||
@class NSEvent;
|
||||
@class NSMenu;
|
||||
@class NSUndoManager;
|
||||
@class NSWindow;
|
||||
|
||||
@interface NSResponder : NSObject <NSCoding>
|
||||
{
|
||||
|
@ -128,7 +131,9 @@
|
|||
- (void) rightMouseDown: (NSEvent*)theEvent;
|
||||
- (void) rightMouseDragged: (NSEvent*)theEvent;
|
||||
- (void) rightMouseUp: (NSEvent*)theEvent;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
- (void) scrollWheel: (NSEvent *)theEvent;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Services menu support
|
||||
|
@ -175,6 +180,17 @@
|
|||
|
||||
- (BOOL) shouldBeTreatedAsInkEvent: (NSEvent *)theEvent;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (BOOL)presentError:(NSError *)error;
|
||||
- (void)presentError:(NSError *)error
|
||||
modalForWindow:(NSWindow *)window
|
||||
delegate:(id)delegate
|
||||
didPresentSelector:(SEL)sel
|
||||
contextInfo:(void *)context;
|
||||
- (NSError *)willPresentError:(NSError *)error;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
|
@ -231,6 +247,7 @@
|
|||
- (void) selectParagraph: (id)sender;
|
||||
- (void) selectToMark: (id)sender;
|
||||
- (void) selectWord: (id)sender;
|
||||
- (void) setMark: (id)sender;
|
||||
- (void) showContextHelp: (id)sender;
|
||||
- (void) swapWithMark: (id)sender;
|
||||
- (void) transpose: (id)sender;
|
||||
|
@ -238,11 +255,22 @@
|
|||
- (void) uppercaseWord: (id)sender;
|
||||
- (void) yank: (id)sender;
|
||||
|
||||
// New in MacOSX 10.3
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
- (void) cancelOperation: (id)sender;
|
||||
- (void) deleteBackwardByDecomposingPreviousCharacter: (id)sender;
|
||||
- (void) moveLeftAndModifySelection: (id)sender;
|
||||
- (void) moveRightAndModifySelection: (id)sender;
|
||||
- (void) moveWordLeft: (id)sender;
|
||||
- (void) moveWordLeftAndModifySelection: (id)sender;
|
||||
- (void) moveWordRight: (id)sender;
|
||||
- (void) moveWordRightAndModifySelection: (id)sender;
|
||||
#endif
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (void) insertContainerBreak: (id)sender;
|
||||
- (void) insertLineBreak: (id)sender;
|
||||
- (void) tabletPoint:(NSEvent *)event;
|
||||
- (void) tabletProximity:(NSEvent *)event;
|
||||
#endif
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -38,17 +38,17 @@
|
|||
{
|
||||
@private
|
||||
NSWindow *_window;
|
||||
NSString *_windowNibName;
|
||||
NSString *_windowNibPath;
|
||||
NSString *_windowFrameAutosaveName;
|
||||
NSString *_window_nib_name;
|
||||
NSString *_window_nib_path;
|
||||
NSString *_window_frame_autosave_name;
|
||||
NSDocument *_document;
|
||||
NSArray *_topLevelObjects;
|
||||
NSArray *_top_level_objects;
|
||||
id _owner;
|
||||
struct ___wcFlags
|
||||
{
|
||||
unsigned int shouldCloseDocument:1;
|
||||
unsigned int shouldCascade:1;
|
||||
unsigned int nibIsLoaded:1;
|
||||
unsigned int should_close_document:1;
|
||||
unsigned int should_cascade:1;
|
||||
unsigned int nib_is_loaded:1;
|
||||
unsigned int RESERVED:29;
|
||||
} _wcFlags;
|
||||
void *_reserved1;
|
||||
|
|
|
@ -97,9 +97,9 @@
|
|||
//NSMutableArray *args;
|
||||
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
name = [[_printInfo printer] name];
|
||||
name = [[[self printInfo] printer] name];
|
||||
status = [NSString stringWithFormat: @"Spooling to printer %@.", name];
|
||||
[_printPanel _setStatusStringValue: status];
|
||||
[[self printPanel] _setStatusStringValue: status];
|
||||
|
||||
cupsPrintFile( [name UTF8String],
|
||||
[_path UTF8String],
|
||||
|
@ -107,7 +107,7 @@
|
|||
0, NULL );
|
||||
|
||||
|
||||
//dict = [_printInfo dictionary];
|
||||
//dict = [[self printInfo] dictionary];
|
||||
//args = [NSMutableArray array];
|
||||
//copies = [[dict objectForKey: NSPrintCopies] intValue];
|
||||
//if (copies > 1)
|
||||
|
@ -141,7 +141,7 @@
|
|||
}
|
||||
NSDebugMLLog(@"GSPrinting", @"Creating context.");
|
||||
|
||||
info = [_printInfo dictionary];
|
||||
info = [[self printInfo] dictionary];
|
||||
|
||||
output = [info objectForKey: NSPrintSavePath];
|
||||
if (output)
|
||||
|
|
|
@ -102,11 +102,11 @@
|
|||
NSMutableArray *args;
|
||||
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
name = [[_printInfo printer] name];
|
||||
name = [[[self printInfo] printer] name];
|
||||
status = [NSString stringWithFormat: @"Spooling to printer %@.", name];
|
||||
[_printPanel _setStatusStringValue: status];
|
||||
[[self printPanel] _setStatusStringValue: status];
|
||||
|
||||
dict = [_printInfo dictionary];
|
||||
dict = [[self printInfo] dictionary];
|
||||
args = [NSMutableArray array];
|
||||
copies = [[dict objectForKey: NSPrintCopies] intValue];
|
||||
if (copies > 1)
|
||||
|
@ -140,7 +140,7 @@
|
|||
}
|
||||
NSDebugMLLog(@"GSPrinting", @"Creating context.");
|
||||
|
||||
info = [_printInfo dictionary];
|
||||
info = [[self printInfo] dictionary];
|
||||
|
||||
output = [info objectForKey: NSPrintSavePath];
|
||||
if (output)
|
||||
|
|
|
@ -347,7 +347,6 @@ NSWindow+Toolbar.h \
|
|||
NSWorkspace.h \
|
||||
NSAttributedString.h \
|
||||
NSColorPicking.h \
|
||||
NSDocumentFrameworkPrivate.h \
|
||||
NSDragging.h \
|
||||
NSGraphics.h \
|
||||
NSNibConnector.h \
|
||||
|
|
|
@ -98,8 +98,8 @@
|
|||
{
|
||||
/* Save this for the view to look at. Seems like there should
|
||||
be a better way to pass it to beginDocument */
|
||||
[[_printInfo dictionary] setObject: [NSValue valueWithRect: _rect]
|
||||
forKey: @"NSPrintSheetBounds"];
|
||||
[[[self printInfo] dictionary] setObject: [NSValue valueWithRect: _rect]
|
||||
forKey: @"NSPrintSheetBounds"];
|
||||
|
||||
[_view beginDocument];
|
||||
|
||||
|
@ -136,7 +136,7 @@
|
|||
if (_context)
|
||||
return _context;
|
||||
|
||||
info = [_printInfo dictionary];
|
||||
info = [[self printInfo] dictionary];
|
||||
|
||||
[info setObject: _path
|
||||
forKey: @"NSOutputFile"];
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
toData: [NSMutableData data]
|
||||
printInfo: aPrintInfo];
|
||||
|
||||
_showPanels = YES;
|
||||
[self setShowPanels: YES];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@
|
|||
NSString *job;
|
||||
|
||||
success = YES;
|
||||
job = [_printInfo jobDisposition];
|
||||
job = [[self printInfo] jobDisposition];
|
||||
if ([job isEqual: NSPrintPreviewJob])
|
||||
{
|
||||
/* Check to see if there is a GNUstep app that can preview PS files.
|
||||
|
@ -126,7 +126,7 @@
|
|||
NSTask *task;
|
||||
NSString *preview;
|
||||
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
|
||||
[_printPanel _setStatusStringValue: @"Opening in previewer..."];
|
||||
[[self printPanel] _setStatusStringValue: @"Opening in previewer..."];
|
||||
|
||||
preview = [ws getBestAppInRole: @"Viewer"
|
||||
forExtension: @"ps"];
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSSerialization.h>
|
||||
#include <Foundation/NSPort.h>
|
||||
#include <Foundation/NSPortNameServer.h>
|
||||
#include <Foundation/NSTask.h>
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
|
|
|
@ -33,18 +33,24 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSSet.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSInvocation.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSTimer.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSSet.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSTimer.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
#ifndef LIB_FOUNDATION_LIBRARY
|
||||
# include <Foundation/NSConnection.h>
|
||||
|
@ -52,20 +58,20 @@
|
|||
|
||||
#include "AppKit/AppKitExceptions.h"
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSCell.h"
|
||||
#include "AppKit/NSCursor.h"
|
||||
#include "AppKit/NSDocumentController.h"
|
||||
#include "AppKit/NSPasteboard.h"
|
||||
#include "AppKit/NSFontManager.h"
|
||||
#include "AppKit/NSPanel.h"
|
||||
#include "AppKit/NSEvent.h"
|
||||
#include "AppKit/NSFontManager.h"
|
||||
#include "AppKit/NSImage.h"
|
||||
#include "AppKit/NSMenu.h"
|
||||
#include "AppKit/NSMenuItem.h"
|
||||
#include "AppKit/NSMenuItemCell.h"
|
||||
#include "AppKit/NSMenuView.h"
|
||||
#include "AppKit/NSCursor.h"
|
||||
#include "AppKit/NSWorkspace.h"
|
||||
#include "AppKit/NSNibLoading.h"
|
||||
#include "AppKit/NSPageLayout.h"
|
||||
#include "AppKit/NSPanel.h"
|
||||
#include "AppKit/NSPasteboard.h"
|
||||
#include "AppKit/NSWorkspace.h"
|
||||
#include "AppKit/NSScreen.h"
|
||||
#include "AppKit/PSOperators.h"
|
||||
|
||||
#include "GNUstepGUI/GSDisplayServer.h"
|
||||
|
|
|
@ -28,10 +28,16 @@
|
|||
*/
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSCharacterSet.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSDocumentController.h"
|
||||
#include "AppKit/NSParagraphStyle.h"
|
||||
|
|
286
Source/NSCell.m
286
Source/NSCell.m
|
@ -99,7 +99,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
if (self == [NSCell class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
[self setVersion: 2];
|
||||
colorClass = [NSColor class];
|
||||
cellClass = [NSCell class];
|
||||
fontClass = [NSFont class];
|
||||
|
@ -117,11 +117,16 @@ static NSColor *shadowCol;
|
|||
}
|
||||
}
|
||||
|
||||
+ (NSMenu*)defaultMenu
|
||||
+ (NSMenu*) defaultMenu
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSFocusRingType) defaultFocusRingType
|
||||
{
|
||||
return NSFocusRingTypeDefault;
|
||||
}
|
||||
|
||||
/**<p>This class method returns NO. This method should be overrided by
|
||||
subclasses.</p>
|
||||
*/
|
||||
|
@ -170,6 +175,7 @@ static NSColor *shadowCol;
|
|||
//_cell.state = 0;
|
||||
_action_mask = NSLeftMouseUpMask;
|
||||
_menu = [isa defaultMenu];
|
||||
[self setFocusRingType: [isa defaultFocusRingType]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -199,6 +205,7 @@ static NSColor *shadowCol;
|
|||
//_cell.is_selectable = NO;
|
||||
_action_mask = NSLeftMouseUpMask;
|
||||
_menu = [isa defaultMenu];
|
||||
[self setFocusRingType: [isa defaultFocusRingType]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -209,7 +216,7 @@ static NSColor *shadowCol;
|
|||
TEST_RELEASE (_cell_image);
|
||||
TEST_RELEASE (_font);
|
||||
TEST_RELEASE (_represented_object);
|
||||
TEST_RELEASE (_objectValue);
|
||||
TEST_RELEASE (_object_value);
|
||||
TEST_RELEASE (_formatter);
|
||||
TEST_RELEASE (_menu);
|
||||
|
||||
|
@ -223,7 +230,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
if (_cell.has_valid_object_value)
|
||||
{
|
||||
return _objectValue;
|
||||
return _object_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -242,9 +249,9 @@ static NSColor *shadowCol;
|
|||
- (double) doubleValue
|
||||
{
|
||||
if ((_cell.has_valid_object_value == YES) &&
|
||||
([_objectValue respondsToSelector: @selector(doubleValue)]))
|
||||
([_object_value respondsToSelector: @selector(doubleValue)]))
|
||||
{
|
||||
return [_objectValue doubleValue];
|
||||
return [_object_value doubleValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -258,9 +265,9 @@ static NSColor *shadowCol;
|
|||
- (float) floatValue
|
||||
{
|
||||
if ((_cell.has_valid_object_value == YES) &&
|
||||
([_objectValue respondsToSelector: @selector(floatValue)]))
|
||||
([_object_value respondsToSelector: @selector(floatValue)]))
|
||||
{
|
||||
return [_objectValue floatValue];
|
||||
return [_object_value floatValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -274,9 +281,9 @@ static NSColor *shadowCol;
|
|||
- (int) intValue
|
||||
{
|
||||
if ((_cell.has_valid_object_value == YES) &&
|
||||
([_objectValue respondsToSelector: @selector(intValue)]))
|
||||
([_object_value respondsToSelector: @selector(intValue)]))
|
||||
{
|
||||
return [_objectValue intValue];
|
||||
return [_object_value intValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -291,7 +298,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
if (_cell.contents_is_attributed_string == NO)
|
||||
{
|
||||
// If we have a formatter this is also the string of the _objectValue
|
||||
// If we have a formatter this is also the string of the _object_value
|
||||
return _contents;
|
||||
}
|
||||
else
|
||||
|
@ -304,7 +311,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
id newContents;
|
||||
|
||||
ASSIGN (_objectValue, object);
|
||||
ASSIGN (_object_value, object);
|
||||
|
||||
if (_formatter == nil)
|
||||
{
|
||||
|
@ -322,14 +329,14 @@ static NSColor *shadowCol;
|
|||
}
|
||||
else
|
||||
{
|
||||
newContents = [_objectValue description];
|
||||
newContents = [_object_value description];
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newContents = [_formatter stringForObjectValue: _objectValue];
|
||||
newContents = [_formatter stringForObjectValue: _object_value];
|
||||
_cell.contents_is_attributed_string = NO;
|
||||
if (newContents != nil)
|
||||
{
|
||||
|
@ -414,7 +421,7 @@ static NSColor *shadowCol;
|
|||
if (_formatter == nil)
|
||||
{
|
||||
ASSIGN (_contents, string);
|
||||
ASSIGN (_objectValue, string);
|
||||
ASSIGN (_object_value, string);
|
||||
_cell.has_valid_object_value = YES;
|
||||
}
|
||||
else
|
||||
|
@ -708,6 +715,16 @@ static NSColor *shadowCol;
|
|||
_cell.is_bezeled = NO;
|
||||
}
|
||||
|
||||
- (NSFocusRingType) focusRingType
|
||||
{
|
||||
return _cell.focus_ring_type;
|
||||
}
|
||||
|
||||
- (void) setFocusRingType: (NSFocusRingType)type
|
||||
{
|
||||
_cell.focus_ring_type = type;
|
||||
}
|
||||
|
||||
/**<p>Sets the NSCell's state. Please use always symbolic constants when
|
||||
calling this method. The integer values could be changed in the this
|
||||
implementation. (Currently they match the Cocoa values but they are
|
||||
|
@ -896,6 +913,11 @@ static NSColor *shadowCol;
|
|||
if (flag)
|
||||
{
|
||||
_cell.is_scrollable = NO;
|
||||
[self setLineBreakMode: NSLineBreakByWordWrapping];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setLineBreakMode: NSLineBreakByClipping];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -935,7 +957,7 @@ static NSColor *shadowCol;
|
|||
NSAttributedString *attrStr;
|
||||
|
||||
attributes = [self _nonAutoreleasedTypingAttributes];
|
||||
attrStr = [_formatter attributedStringForObjectValue: _objectValue
|
||||
attrStr = [_formatter attributedStringForObjectValue: _object_value
|
||||
withDefaultAttributes: attributes];
|
||||
RELEASE(attributes);
|
||||
if (attrStr != nil)
|
||||
|
@ -1022,6 +1044,26 @@ static NSColor *shadowCol;
|
|||
[self setStringValue: aString];
|
||||
}
|
||||
|
||||
- (NSLineBreakMode) lineBreakMode
|
||||
{
|
||||
return _cell.line_break_mode;
|
||||
}
|
||||
|
||||
- (void) setLineBreakMode: (NSLineBreakMode)mode
|
||||
{
|
||||
_cell.line_break_mode = mode;
|
||||
}
|
||||
|
||||
- (NSWritingDirection) baseWritingDirection
|
||||
{
|
||||
return _cell.base_writing_direction;
|
||||
}
|
||||
|
||||
- (void) setBaseWritingDirection: (NSWritingDirection)direction
|
||||
{
|
||||
_cell.base_writing_direction = direction;
|
||||
}
|
||||
|
||||
/**<p>Implemented by subclasses to return the action method.
|
||||
The NSCell implementaiton returns NULL.</p>
|
||||
<p>See Also: -setAction: -setTarget: -target</p>
|
||||
|
@ -1247,7 +1289,7 @@ static NSColor *shadowCol;
|
|||
}
|
||||
|
||||
/*
|
||||
* respond to keyboard
|
||||
* Should this cell respond to keyboard input?
|
||||
*/
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
|
@ -1287,23 +1329,19 @@ static NSColor *shadowCol;
|
|||
|
||||
- (void) setMnemonicLocation: (unsigned int)location
|
||||
{
|
||||
_mnemonic_location = location;
|
||||
_cell.mnemonic_location = location;
|
||||
}
|
||||
|
||||
- (unsigned int) mnemonicLocation
|
||||
{
|
||||
return _mnemonic_location;
|
||||
return _cell.mnemonic_location;
|
||||
}
|
||||
|
||||
/* Apple Compatibility method - do not use - please test whether the
|
||||
cell is enabled or disabled instead. */
|
||||
- (BOOL) refusesFirstResponder
|
||||
{
|
||||
return _cell.refuses_first_responder;
|
||||
}
|
||||
|
||||
/* Apple Compatibility method - do not use - please disable the cell
|
||||
instead. */
|
||||
- (void) setRefusesFirstResponder: (BOOL)flag
|
||||
{
|
||||
_cell.refuses_first_responder = flag;
|
||||
|
@ -1845,24 +1883,22 @@ static NSColor *shadowCol;
|
|||
|
||||
- (void) setControlSize: (NSControlSize)controlSize
|
||||
{
|
||||
// FIXME
|
||||
_cell.control_size = controlSize;
|
||||
}
|
||||
|
||||
- (NSControlSize) controlSize
|
||||
{
|
||||
// FIXME
|
||||
return NSRegularControlSize;
|
||||
return _cell.control_size;
|
||||
}
|
||||
|
||||
- (void) setControlTint: (NSControlTint)controlTint
|
||||
{
|
||||
// FIXME
|
||||
_cell.control_tint = controlTint;
|
||||
}
|
||||
|
||||
- (NSControlTint) controlTint
|
||||
{
|
||||
// FIXME
|
||||
return NSDefaultControlTint;
|
||||
return _cell.control_tint;
|
||||
}
|
||||
|
||||
/**<p>This method is used by subclasses to specified the control view.
|
||||
|
@ -1947,7 +1983,10 @@ static NSColor *shadowCol;
|
|||
}
|
||||
|
||||
if (_cell.shows_first_responder)
|
||||
NSDottedFrameRect(cellFrame);
|
||||
{
|
||||
// FIXME: Should depend on _cell.focus_ring_type
|
||||
NSDottedFrameRect(cellFrame);
|
||||
}
|
||||
|
||||
// NB: We don't do any highlighting to make it easier for subclasses
|
||||
// to reuse this code while doing their own custom highlighting and
|
||||
|
@ -2082,7 +2121,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
NSString *contents;
|
||||
|
||||
contents = [_formatter editingStringForObjectValue: _objectValue];
|
||||
contents = [_formatter editingStringForObjectValue: _object_value];
|
||||
if (contents == nil)
|
||||
{
|
||||
contents = _contents;
|
||||
|
@ -2126,7 +2165,7 @@ static NSColor *shadowCol;
|
|||
[clipView removeFromSuperview];
|
||||
}
|
||||
|
||||
/** <p> TODO.This method does nothing if a the <var>controlView</var> is nil,
|
||||
/** <p> This method does nothing if the <var>controlView</var> is nil,
|
||||
if text object does not exist or if the cell's type is not <ref type="type"
|
||||
id="NSCellType">NSTextCellType</ref> </p>
|
||||
*/
|
||||
|
@ -2148,7 +2187,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
NSString *contents;
|
||||
|
||||
contents = [_formatter editingStringForObjectValue: _objectValue];
|
||||
contents = [_formatter editingStringForObjectValue: _object_value];
|
||||
if (contents == nil)
|
||||
{
|
||||
contents = _contents;
|
||||
|
@ -2185,6 +2224,16 @@ static NSColor *shadowCol;
|
|||
_cell.sends_action_on_end_editing = flag;
|
||||
}
|
||||
|
||||
- (BOOL) allowsUndo
|
||||
{
|
||||
return _cell.allows_undo;
|
||||
}
|
||||
|
||||
- (void) setAllowsUndo: (BOOL)flag
|
||||
{
|
||||
_cell.allows_undo = flag;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copying
|
||||
*/
|
||||
|
@ -2198,7 +2247,7 @@ static NSColor *shadowCol;
|
|||
pointers to the objects are copied. We need to RETAIN them all
|
||||
though. */
|
||||
TEST_RETAIN (_font);
|
||||
TEST_RETAIN (_objectValue);
|
||||
TEST_RETAIN (_object_value);
|
||||
TEST_RETAIN (_menu);
|
||||
TEST_RETAIN (_cell_image);
|
||||
TEST_RETAIN (_formatter);
|
||||
|
@ -2218,40 +2267,55 @@ static NSColor *shadowCol;
|
|||
unsigned int cFlags2 = 0;
|
||||
|
||||
// encode contents
|
||||
[aCoder encodeObject: _contents forKey: @"NSContents"];
|
||||
[aCoder encodeObject: [self objectValue] forKey: @"NSContents"];
|
||||
|
||||
// flags
|
||||
cFlags |= [self focusRingType];
|
||||
cFlags |= [self showsFirstResponder] ? 0x4 : 0;
|
||||
cFlags |= (_action_mask & NSLeftMouseUpMask) ? 0 : 0x20;
|
||||
cFlags |= [self wraps] ? 0x40 : 0;
|
||||
cFlags |= (_action_mask & NSLeftMouseDraggedMask) ? 0x100 : 0;
|
||||
cFlags |= ([self lineBreakMode] << 12);
|
||||
cFlags |= (_action_mask & NSLeftMouseDownMask) ? 0x40000 : 0;
|
||||
cFlags |= [self isContinuous] ? 0x80000 : 0;
|
||||
cFlags |= [self isScrollable] ? 0x100000 : 0;
|
||||
cFlags |= [self isSelectable] ? 0x200001 : 0;
|
||||
cFlags |= [self isSelectable] ? 0x200000 : 0;
|
||||
cFlags |= [self isBezeled] ? 0x400000 : 0;
|
||||
cFlags |= [self isBordered] ? 0x800000 : 0;
|
||||
cFlags |= ([self type] == NSTextCellType) ? 0x4000000 : 0;
|
||||
cFlags |= [self isContinuous] ? 0x40000 : 0;
|
||||
cFlags |= ([self type] << 26);
|
||||
cFlags |= [self isEditable] ? 0x10000000 : 0;
|
||||
cFlags |= ([self isEnabled] == NO) ? 0x20000000 : 0;
|
||||
cFlags |= ([self state] == NSOnState) ? 0x80000000 : 0;
|
||||
cFlags |= [self isHighlighted] ? 0x40000000 : 0;
|
||||
cFlags |= ([self state] == NSOnState) ? 0x80000000 : 0;
|
||||
[aCoder encodeInt: cFlags forKey: @"NSCellFlags"];
|
||||
|
||||
// flags part 2
|
||||
cFlags2 |= ([self controlTint] << 5);
|
||||
cFlags2 |= ([self controlSize] << 17);
|
||||
cFlags2 |= [self sendsActionOnEndEditing] ? 0x400000 : 0;
|
||||
cFlags2 |= [self allowsMixedState] ? 0x1000000 : 0;
|
||||
cFlags2 |= [self refusesFirstResponder] ? 0x2000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSRightTextAlignment) ? 0x4000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSCenterTextAlignment) ? 0x8000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSJustifiedTextAlignment) ? 0xC000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSNaturalTextAlignment) ? 0x10000000 : 0;
|
||||
cFlags2 |= ([self alignment] << 26);
|
||||
cFlags2 |= [self importsGraphics] ? 0x20000000 : 0;
|
||||
cFlags2 |= [self allowsEditingTextAttributes] ? 0x40000000 : 0;
|
||||
[aCoder encodeInt: cFlags2 forKey: @"NSCellFlags2"];
|
||||
|
||||
// font and formatter.
|
||||
[aCoder encodeObject: [self font] forKey: @"NSSupport"];
|
||||
|
||||
if ([self formatter])
|
||||
{
|
||||
[aCoder encodeObject: [self formatter] forKey: @"NSFormatter"];
|
||||
if (_cell.type == NSTextCellType)
|
||||
{
|
||||
// font and formatter.
|
||||
if ([self font])
|
||||
{
|
||||
[aCoder encodeObject: [self font] forKey: @"NSSupport"];
|
||||
}
|
||||
|
||||
if ([self formatter])
|
||||
{
|
||||
[aCoder encodeObject: [self formatter] forKey: @"NSFormatter"];
|
||||
}
|
||||
}
|
||||
else if ([self image])
|
||||
{
|
||||
[aCoder encodeObject: [self image] forKey: @"NSSupport"];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2262,7 +2326,7 @@ static NSColor *shadowCol;
|
|||
[aCoder encodeObject: _contents];
|
||||
[aCoder encodeObject: _cell_image];
|
||||
[aCoder encodeObject: _font];
|
||||
[aCoder encodeObject: _objectValue];
|
||||
[aCoder encodeObject: _object_value];
|
||||
flag = _cell.contents_is_attributed_string;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_highlighted;
|
||||
|
@ -2297,7 +2361,7 @@ static NSColor *shadowCol;
|
|||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.allows_mixed_state;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.wraps;
|
||||
flag = [self wraps];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
tmp_int = _cell.text_align;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
|
@ -2307,14 +2371,29 @@ static NSColor *shadowCol;
|
|||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.entry_type;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
// FIXME: State may be -1, why do we encode it as unsigned?
|
||||
tmp_int = _cell.state;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_mnemonic_location];
|
||||
tmp_int = _cell.mnemonic_location;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_mouse_down_flags];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_action_mask];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_formatter];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_menu];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_represented_object];
|
||||
|
||||
tmp_int = _cell.allows_undo;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.line_break_mode;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.control_tint;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.control_size;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.focus_ring_type;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.base_writing_direction;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2336,66 +2415,67 @@ static NSColor *shadowCol;
|
|||
else
|
||||
{
|
||||
self = [self init];
|
||||
[self setObjectValue: contents];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSCellFlags"])
|
||||
{
|
||||
unsigned long cFlags;
|
||||
|
||||
unsigned long mask = 0;
|
||||
cFlags = [aDecoder decodeIntForKey: @"NSCellFlags"];
|
||||
|
||||
[self setFocusRingType: (cFlags & 0x3)];
|
||||
[self setShowsFirstResponder: ((cFlags & 0x4) == 0x4)];
|
||||
// This bit flag is the other way around!
|
||||
if ((cFlags & 0x20) != 0x20)
|
||||
mask |= NSLeftMouseUpMask;
|
||||
// This bit flag is the other way around!
|
||||
[self setWraps: ((cFlags & 0x40) != 0x40)];
|
||||
if ((cFlags & 0x100) == 0x100)
|
||||
mask |= NSLeftMouseDraggedMask;
|
||||
[self setLineBreakMode: ((cFlags & 0x7000) >> 12)];
|
||||
if ((cFlags & 0x40000) == 0x40000)
|
||||
mask |= NSLeftMouseDownMask;
|
||||
if ((cFlags & 0x80000) == 0x80000)
|
||||
mask |= NSPeriodicMask;
|
||||
[self sendActionOn: mask];
|
||||
[self setScrollable: ((cFlags & 0x100000) == 0x100000)];
|
||||
// Strange that this is not a simple bit flag
|
||||
[self setSelectable: ((cFlags & 0x200001) == 0x200001)];
|
||||
[self setSelectable: ((cFlags & 0x200000) == 0x200000)];
|
||||
[self setBezeled: ((cFlags & 0x400000) == 0x400000)];
|
||||
[self setBordered: ((cFlags & 0x800000) == 0x800000)];
|
||||
if ((cFlags & 0x4000000) == 0x4000000)
|
||||
{
|
||||
[self setType: NSTextCellType];
|
||||
}
|
||||
|
||||
[self setContinuous: ((cFlags & 0x40000) == 0x40000)];
|
||||
[self setType: ((cFlags & 0xC000000) >> 26)];
|
||||
[self setEditable: ((cFlags & 0x10000000) == 0x10000000)];
|
||||
// This bit flag is the other way around!
|
||||
[self setEnabled: ((cFlags & 0x20000000) != 0x20000000)];
|
||||
[self setHighlighted: ((cFlags & 0x40000000) == 0x40000000)];
|
||||
[self setState: ((cFlags & 0x80000000) == 0x80000000)?NSOnState:NSOffState];
|
||||
[self setState: ((cFlags & 0x80000000) == 0x80000000) ? NSOnState : NSOffState];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSCellFlags2"])
|
||||
{
|
||||
int cFlags2;
|
||||
|
||||
cFlags2 = [aDecoder decodeIntForKey: @"NSCellFlags2"];
|
||||
[self setControlTint: ((cFlags2 & 0xE0) >> 5)];
|
||||
[self setControlSize: ((cFlags2 & 0xE0000) >> 17)];
|
||||
[self setSendsActionOnEndEditing: (cFlags2 & 0x400000)];
|
||||
[self setAllowsMixedState: ((cFlags2 & 0x1000000) == 0x1000000)];
|
||||
[self setRefusesFirstResponder: ((cFlags2 & 0x2000000) == 0x2000000)];
|
||||
if ((cFlags2 & 0x4000000) == 0x4000000)
|
||||
{
|
||||
[self setAlignment: NSRightTextAlignment];
|
||||
}
|
||||
if ((cFlags2 & 0x8000000) == 0x8000000)
|
||||
{
|
||||
[self setAlignment: NSCenterTextAlignment];
|
||||
}
|
||||
if ((cFlags2 & 0xC000000) == 0xC000000)
|
||||
{
|
||||
[self setAlignment: NSJustifiedTextAlignment];
|
||||
}
|
||||
if ((cFlags2 & 0x10000000) == 0x10000000)
|
||||
{
|
||||
[self setAlignment: NSNaturalTextAlignment];
|
||||
}
|
||||
|
||||
[self setAlignment: ((cFlags2 & 0x1C000000) >> 26)];
|
||||
[self setImportsGraphics: ((cFlags2 & 0x20000000) == 0x20000000)];
|
||||
[self setAllowsEditingTextAttributes: ((cFlags2 & 0x40000000) == 0x40000000)];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSupport"])
|
||||
{
|
||||
NSFont *support = [aDecoder decodeObjectForKey: @"NSSupport"];
|
||||
id support = [aDecoder decodeObjectForKey: @"NSSupport"];
|
||||
|
||||
[self setFont: support];
|
||||
if ([support isKindOfClass: [NSFont class]])
|
||||
{
|
||||
[self setFont: support];
|
||||
}
|
||||
else if ([support isKindOfClass: [NSImage class]])
|
||||
{
|
||||
[self setImage: support];
|
||||
}
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSFormatter"])
|
||||
{
|
||||
|
@ -2409,11 +2489,12 @@ static NSColor *shadowCol;
|
|||
BOOL flag;
|
||||
unsigned int tmp_int;
|
||||
id formatter, menu;
|
||||
int version = [aDecoder versionForClassName: @"NSCell"];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contents];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell_image];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_font];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_objectValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_object_value];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
_cell.contents_is_attributed_string = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
|
@ -2457,8 +2538,8 @@ static NSColor *shadowCol;
|
|||
_cell.entry_type = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.state = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_mnemonic_location];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.mnemonic_location = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_mouse_down_flags];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &_action_mask];
|
||||
|
@ -2472,7 +2553,7 @@ static NSColor *shadowCol;
|
|||
{
|
||||
NSString *contents;
|
||||
|
||||
contents = [_formatter stringForObjectValue: _objectValue];
|
||||
contents = [_formatter stringForObjectValue: _object_value];
|
||||
if (contents != nil)
|
||||
{
|
||||
_cell.has_valid_object_value = YES;
|
||||
|
@ -2480,6 +2561,22 @@ static NSColor *shadowCol;
|
|||
_cell.contents_is_attributed_string = NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (version >= 2)
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.allows_undo = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.line_break_mode = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.control_tint = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.control_size = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.focus_ring_type = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.base_writing_direction = tmp_int;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -2507,21 +2604,12 @@ static NSColor *shadowCol;
|
|||
NSMutableParagraphStyle *paragraphStyle;
|
||||
|
||||
color = [self textColor];
|
||||
/* Note: there are only 6 possible paragraph styles for cells.
|
||||
TODO: Create them once at the beginning, and reuse them for the whole
|
||||
app lifetime. */
|
||||
/* Note: There are only a few possible paragraph styles for cells.
|
||||
TODO: Cache them and reuse them for the whole app lifetime. */
|
||||
paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||
|
||||
if (_cell.wraps)
|
||||
{
|
||||
[paragraphStyle setLineBreakMode: NSLineBreakByWordWrapping];
|
||||
}
|
||||
else
|
||||
{
|
||||
[paragraphStyle setLineBreakMode: NSLineBreakByClipping];
|
||||
}
|
||||
|
||||
[paragraphStyle setAlignment: _cell.text_align];
|
||||
[paragraphStyle setLineBreakMode: [self lineBreakMode]];
|
||||
[paragraphStyle setBaseWritingDirection: [self baseWritingDirection]];
|
||||
[paragraphStyle setAlignment: [self alignment]];
|
||||
|
||||
attr = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
_font, NSFontAttributeName,
|
||||
|
|
1062
Source/NSDocument.m
1062
Source/NSDocument.m
File diff suppressed because it is too large
Load diff
|
@ -27,16 +27,22 @@
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
|
||||
#include "AppKit/NSDocumentController.h"
|
||||
#include "AppKit/NSOpenPanel.h"
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSMenuItem.h"
|
||||
#include "AppKit/NSWorkspace.h"
|
||||
#include "AppKit/NSDocumentFrameworkPrivate.h"
|
||||
#include "NSDocumentFrameworkPrivate.h"
|
||||
#include "GSGuiPrivate.h"
|
||||
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
|
||||
static NSString *NSTypesKey = @"NSTypes";
|
||||
static NSString *NSNameKey = @"NSName";
|
||||
static NSString *NSRoleKey = @"NSRole";
|
||||
|
@ -165,22 +171,22 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
_documents = [[NSMutableArray alloc] init];
|
||||
|
||||
/* Get list of recent documents */
|
||||
_recentDocuments = [[NSUserDefaults standardUserDefaults]
|
||||
_recent_documents = [[NSUserDefaults standardUserDefaults]
|
||||
objectForKey: NSRecentDocuments];
|
||||
if (_recentDocuments)
|
||||
if (_recent_documents)
|
||||
{
|
||||
int i, count;
|
||||
_recentDocuments = [_recentDocuments mutableCopy];
|
||||
count = [_recentDocuments count];
|
||||
_recent_documents = [_recent_documents mutableCopy];
|
||||
count = [_recent_documents count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSURL *url;
|
||||
url = [NSURL URLWithString: [_recentDocuments objectAtIndex: i]];
|
||||
[_recentDocuments replaceObjectAtIndex: i withObject: url];
|
||||
url = [NSURL URLWithString: [_recent_documents objectAtIndex: i]];
|
||||
[_recent_documents replaceObjectAtIndex: i withObject: url];
|
||||
}
|
||||
}
|
||||
else
|
||||
_recentDocuments = RETAIN([NSMutableArray array]);
|
||||
_recent_documents = RETAIN([NSMutableArray array]);
|
||||
[self setShouldCreateUI:YES];
|
||||
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter]
|
||||
|
@ -198,19 +204,47 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
{
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver: self];
|
||||
RELEASE (_documents);
|
||||
RELEASE (_recentDocuments);
|
||||
RELEASE (_recent_documents);
|
||||
RELEASE (_types);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/*
|
||||
* Private helper method to check, if the method given via the selector sel
|
||||
* has been overridden in the current subclass.
|
||||
*/
|
||||
- (BOOL)_hasOverridden: (SEL)sel
|
||||
{
|
||||
// The actual signature is not important as we wont call the methods.
|
||||
IMP meth1;
|
||||
IMP meth2;
|
||||
|
||||
meth1 = [self methodForSelector: sel];
|
||||
meth2 = [[NSDocument class] instanceMethodForSelector: sel];
|
||||
|
||||
return (meth1 != meth2);
|
||||
}
|
||||
|
||||
#define OVERRIDDEN(sel) [self _hasOverridden: @selector(sel)]
|
||||
|
||||
- (BOOL) shouldCreateUI
|
||||
{
|
||||
return _controllerFlags.shouldCreateUI;
|
||||
return _controller_flags.should_create_ui;
|
||||
}
|
||||
|
||||
- (void) setShouldCreateUI: (BOOL)flag
|
||||
{
|
||||
_controllerFlags.shouldCreateUI = flag;
|
||||
_controller_flags.should_create_ui = flag;
|
||||
}
|
||||
|
||||
- (NSTimeInterval) autosavingDelay
|
||||
{
|
||||
return _autosavingDelay;
|
||||
}
|
||||
|
||||
- (void) setAutosavingDelay: (NSTimeInterval)autosavingDelay
|
||||
{
|
||||
_autosavingDelay = autosavingDelay;
|
||||
}
|
||||
|
||||
- (id) makeUntitledDocumentOfType: (NSString *)type
|
||||
|
@ -238,14 +272,69 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
ofType: type]);
|
||||
}
|
||||
|
||||
- _defaultType
|
||||
- (id)makeDocumentForURL:(NSURL *)url
|
||||
withContentsOfURL:(NSURL *)contents
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)err
|
||||
{
|
||||
Class documentClass = [self documentClassForType: type];
|
||||
return AUTORELEASE([[documentClass alloc] initForURL: url
|
||||
withContentsOfURL: contents
|
||||
ofType: type
|
||||
error: err]);
|
||||
}
|
||||
|
||||
- (id)makeDocumentWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)type
|
||||
error:(NSError **)err
|
||||
{
|
||||
Class documentClass = [self documentClassForType: type];
|
||||
return AUTORELEASE([[documentClass alloc] initWithContentsOfURL: url
|
||||
ofType: type
|
||||
error: err]);
|
||||
}
|
||||
|
||||
- (id)makeUntitledDocumentOfType:(NSString *)type
|
||||
error:(NSError **)err
|
||||
{
|
||||
Class documentClass = [self documentClassForType: type];
|
||||
return AUTORELEASE([[documentClass alloc] initWithType: type
|
||||
error: err]);
|
||||
}
|
||||
|
||||
- (BOOL)presentError:(NSError *)error
|
||||
{
|
||||
error = [self willPresentError: error];
|
||||
return [NSApp presentError: error];
|
||||
}
|
||||
|
||||
- (void)presentError:(NSError *)error
|
||||
modalForWindow:(NSWindow *)window
|
||||
delegate:(id)delegate
|
||||
didPresentSelector:(SEL)sel
|
||||
contextInfo:(void *)context
|
||||
{
|
||||
error = [self willPresentError: error];
|
||||
[NSApp presentError: error
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: sel
|
||||
contextInfo: context];
|
||||
}
|
||||
|
||||
- (NSError *) willPresentError: (NSError *)error
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
- (NSString*) defaultType
|
||||
{
|
||||
if ([_types count] == 0)
|
||||
{
|
||||
return nil; // raise exception?
|
||||
}
|
||||
|
||||
return [(NSDictionary*)[_types objectAtIndex:0] objectForKey:NSNameKey];
|
||||
return [(NSDictionary*)[_types objectAtIndex: 0] objectForKey: NSNameKey];
|
||||
}
|
||||
|
||||
- (void) addDocument: (NSDocument *)document
|
||||
|
@ -268,13 +357,10 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
}
|
||||
|
||||
[self addDocument: document];
|
||||
if ([self shouldCreateUI])
|
||||
if (display && [self shouldCreateUI])
|
||||
{
|
||||
[document makeWindowControllers];
|
||||
if (display)
|
||||
{
|
||||
[document showWindows];
|
||||
}
|
||||
[document showWindows];
|
||||
}
|
||||
|
||||
return document;
|
||||
|
@ -294,13 +380,16 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
{
|
||||
NSString *type = [self typeFromFileExtension: [fileName pathExtension]];
|
||||
|
||||
if ((document = [self makeDocumentWithContentsOfFile: fileName
|
||||
ofType: type]))
|
||||
document = [self makeDocumentWithContentsOfFile: fileName ofType: type];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
[self addDocument: document];
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([self shouldCreateUI])
|
||||
[self addDocument: document];
|
||||
|
||||
if (display && [self shouldCreateUI])
|
||||
{
|
||||
[document makeWindowControllers];
|
||||
}
|
||||
|
@ -324,11 +413,11 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
*/
|
||||
- (id) openDocumentWithContentsOfURL: (NSURL *)url display: (BOOL)display
|
||||
{
|
||||
// Should we only do this if [url isFileURL] is YES?
|
||||
NSDocument *document = [self documentForFileName: [url path]];
|
||||
NSDocument *document = [self documentForURL: url];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
// Should we only do this if [url isFileURL] is YES?
|
||||
NSString *type = [self typeFromFileExtension:
|
||||
[[url path] pathExtension]];
|
||||
|
||||
|
@ -341,7 +430,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
|
||||
[self addDocument: document];
|
||||
|
||||
if ([self shouldCreateUI])
|
||||
if (display && [self shouldCreateUI])
|
||||
{
|
||||
[document makeWindowControllers];
|
||||
}
|
||||
|
@ -358,6 +447,94 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
return document;
|
||||
}
|
||||
|
||||
- (id)openUntitledDocumentAndDisplay:(BOOL)display
|
||||
error:(NSError **)err
|
||||
{
|
||||
NSString *type;
|
||||
|
||||
type = [self defaultType];
|
||||
|
||||
if (OVERRIDDEN(openUntitledDocumentOfType:display:))
|
||||
{
|
||||
return [self openUntitledDocumentOfType: type display: display];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDocument *document = [self makeUntitledDocumentOfType: type
|
||||
error: err];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
[self addDocument: document];
|
||||
if (display && [self shouldCreateUI])
|
||||
{
|
||||
[document makeWindowControllers];
|
||||
[document showWindows];
|
||||
}
|
||||
|
||||
return document;
|
||||
}
|
||||
}
|
||||
|
||||
- (id) openDocumentWithContentsOfURL: (NSURL *)url
|
||||
display: (BOOL)display
|
||||
error: (NSError **)err
|
||||
{
|
||||
if (OVERRIDDEN(openDocumentWithContentsOfFile:display:))
|
||||
{
|
||||
NSString *fileName;
|
||||
|
||||
fileName = [url path];
|
||||
return [self openDocumentWithContentsOfFile: fileName display: display];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDocument *document = [self documentForURL: url];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
// Should we only do this if [url isFileURL] is YES?
|
||||
NSString *type = [self typeFromFileExtension:
|
||||
[[url path] pathExtension]];
|
||||
|
||||
document = [self makeDocumentWithContentsOfURL: url ofType: type error: err];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
[self addDocument: document];
|
||||
|
||||
if (display && [self shouldCreateUI])
|
||||
{
|
||||
[document makeWindowControllers];
|
||||
}
|
||||
}
|
||||
|
||||
// remember this document as opened
|
||||
[self noteNewRecentDocumentURL: url];
|
||||
|
||||
if (display && [self shouldCreateUI])
|
||||
{
|
||||
[document showWindows];
|
||||
}
|
||||
|
||||
return document;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) reopenDocumentForURL: (NSURL *)url
|
||||
withContentsOfURL: (NSURL *)contents
|
||||
error: (NSError **)err
|
||||
{
|
||||
// FIXME
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSOpenPanel *) _setupOpenPanel
|
||||
{
|
||||
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
||||
|
@ -455,7 +632,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
|
||||
- (IBAction) newDocument: (id)sender
|
||||
{
|
||||
[self openUntitledDocumentOfType: [self _defaultType] display: YES];
|
||||
[self openUntitledDocumentOfType: [self defaultType] display: YES];
|
||||
}
|
||||
|
||||
|
||||
|
@ -564,7 +741,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
|
||||
- (BOOL) applicationOpenUntitledFile: (NSApplication *)sender
|
||||
{
|
||||
return [self openUntitledDocumentOfType: [self _defaultType]
|
||||
return [self openUntitledDocumentOfType: [self defaultType]
|
||||
display: YES] ? YES : NO;
|
||||
}
|
||||
|
||||
|
@ -691,6 +868,33 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (id)documentForURL: (NSURL *)url
|
||||
{
|
||||
if (OVERRIDDEN(documentForFileName:))
|
||||
{
|
||||
NSString *fileName;
|
||||
|
||||
fileName = [url path];
|
||||
return [self documentForFileName: fileName];
|
||||
}
|
||||
else
|
||||
{
|
||||
int i, count = [_documents count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSDocument *document = [_documents objectAtIndex: i];
|
||||
|
||||
if ([[document fileURL] isEqual: url])
|
||||
{
|
||||
return document;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) validateMenuItem: (NSMenuItem *)anItem
|
||||
{
|
||||
if ([anItem action] == @selector(saveAllDocuments:))
|
||||
|
@ -733,6 +937,15 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) typeForContentsOfURL: (NSURL *)url error: (NSError **)err
|
||||
{
|
||||
// FIXME
|
||||
NSString *extension;
|
||||
|
||||
extension = [[url path] pathExtension];
|
||||
return [self typeFromFileExtension: extension];
|
||||
}
|
||||
|
||||
- (NSArray *) fileExtensionsFromType: (NSString *)type
|
||||
{
|
||||
NSDictionary *typeInfo = TYPE_INFO(type);
|
||||
|
@ -751,11 +964,29 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
return className? NSClassFromString(className) : Nil;
|
||||
}
|
||||
|
||||
- (NSArray *)documentClassNames
|
||||
{
|
||||
int i, count = [_types count];
|
||||
NSMutableArray *classNames;
|
||||
|
||||
classNames = [[NSMutableArray alloc] initWithCapacity: count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSDictionary *typeInfo = [_types objectAtIndex: i];
|
||||
|
||||
[classNames addObject: [typeInfo objectForKey: NSDocumentClassKey]];
|
||||
}
|
||||
|
||||
return AUTORELEASE(classNames);
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) clearRecentDocuments: (id)sender
|
||||
{
|
||||
[_recentDocuments removeAllObjects];
|
||||
[_recent_documents removeAllObjects];
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: _recentDocuments forKey: NSRecentDocuments];
|
||||
setObject: _recent_documents forKey: NSRecentDocuments];
|
||||
}
|
||||
|
||||
// The number of remembered recent documents
|
||||
|
@ -772,22 +1003,22 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
|
||||
- (void) noteNewRecentDocumentURL: (NSURL *)anURL
|
||||
{
|
||||
unsigned index = [_recentDocuments indexOfObject: anURL];
|
||||
unsigned index = [_recent_documents indexOfObject: anURL];
|
||||
NSMutableArray *a;
|
||||
|
||||
if (index != NSNotFound)
|
||||
{
|
||||
// Always keep the current object at the end of the list
|
||||
[_recentDocuments removeObjectAtIndex: index];
|
||||
[_recent_documents removeObjectAtIndex: index];
|
||||
}
|
||||
else if ([_recentDocuments count] > MAX_DOCS)
|
||||
else if ([_recent_documents count] > MAX_DOCS)
|
||||
{
|
||||
[_recentDocuments removeObjectAtIndex: 0];
|
||||
[_recent_documents removeObjectAtIndex: 0];
|
||||
}
|
||||
|
||||
[_recentDocuments addObject: anURL];
|
||||
[_recent_documents addObject: anURL];
|
||||
|
||||
a = [_recentDocuments mutableCopy];
|
||||
a = [_recent_documents mutableCopy];
|
||||
index = [a count];
|
||||
while (index-- > 0)
|
||||
{
|
||||
|
@ -801,7 +1032,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
|
||||
- (NSArray *) recentDocumentURLs
|
||||
{
|
||||
return _recentDocuments;
|
||||
return _recent_documents;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
*/
|
||||
#ifndef _GNUstep_H_NSDocumentFramworkPrivate
|
||||
#define _GNUstep_H_NSDocumentFramworkPrivate
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#include "NSDocumentController.h"
|
||||
#include <AppKit/NSDocumentController.h>
|
||||
|
||||
@interface NSDocumentController (Private)
|
||||
- (NSArray *)_editorAndViewerTypesForClass:(Class)documentClass;
|
||||
|
@ -42,7 +41,7 @@
|
|||
@end
|
||||
|
||||
|
||||
#include "NSDocument.h"
|
||||
#include <AppKit/NSDocument.h>
|
||||
|
||||
@interface NSDocument (Private)
|
||||
- (void)_removeWindowController:(NSWindowController *)controller;
|
||||
|
@ -50,7 +49,7 @@
|
|||
@end
|
||||
|
||||
|
||||
#include "NSWindowController.h"
|
||||
#include <AppKit/NSWindowController.h>
|
||||
|
||||
@interface NSWindowController (Private)
|
||||
- (void)_windowDidLoad;
|
|
@ -290,13 +290,14 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_printInfo);
|
||||
RELEASE(_print_info);
|
||||
RELEASE(_view);
|
||||
RELEASE(_data);
|
||||
TEST_RELEASE(_context);
|
||||
TEST_RELEASE(_printPanel);
|
||||
TEST_RELEASE(_accessoryView);
|
||||
TEST_RELEASE(_print_panel);
|
||||
TEST_RELEASE(_accessory_view);
|
||||
TEST_RELEASE(_path);
|
||||
TEST_RELEASE(_job_style_hint);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -324,17 +325,17 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
*/
|
||||
- (NSPrintPanel *)printPanel
|
||||
{
|
||||
if (_printPanel == nil)
|
||||
ASSIGN(_printPanel, [NSPrintPanel printPanel]);
|
||||
if (_print_panel == nil)
|
||||
ASSIGN(_print_panel, [NSPrintPanel printPanel]);
|
||||
|
||||
return _printPanel;
|
||||
return _print_panel;
|
||||
}
|
||||
|
||||
/** Returns YES if the reciever display an NSPrintPanel and other information
|
||||
when running a print operation. */
|
||||
- (BOOL)showPanels
|
||||
{
|
||||
return _showPanels;
|
||||
return [self showsPrintPanel] && [self showsProgressPanel];
|
||||
}
|
||||
|
||||
/** Sets the NSPrintPanel used by the receiver obtaining and displaying
|
||||
|
@ -342,7 +343,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
*/
|
||||
- (void)setPrintPanel:(NSPrintPanel *)panel
|
||||
{
|
||||
ASSIGN(_printPanel, panel);
|
||||
ASSIGN(_print_panel, panel);
|
||||
}
|
||||
|
||||
/** Use this to set whether a print panel is displayed during a printing
|
||||
|
@ -352,15 +353,37 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
*/
|
||||
- (void)setShowPanels:(BOOL)flag
|
||||
{
|
||||
_showPanels = flag;
|
||||
[self setShowsPrintPanel: flag];
|
||||
[self setShowsProgressPanel: flag];
|
||||
}
|
||||
|
||||
- (BOOL)showsPrintPanel
|
||||
{
|
||||
return _flags.show_print_panel;
|
||||
}
|
||||
|
||||
- (void)setShowsPrintPanel:(BOOL)flag
|
||||
{
|
||||
_flags.show_print_panel = flag;
|
||||
}
|
||||
|
||||
- (BOOL)showsProgressPanel
|
||||
{
|
||||
return _flags.show_progress_panel;
|
||||
}
|
||||
|
||||
- (void)setShowsProgressPanel:(BOOL)flag
|
||||
{
|
||||
_flags.show_progress_panel = flag;
|
||||
}
|
||||
|
||||
|
||||
/** Returns the accessory view used by the NSPrintPanel associated with
|
||||
the receiver.
|
||||
*/
|
||||
- (NSView *)accessoryView
|
||||
{
|
||||
return _accessoryView;
|
||||
return _accessory_view;
|
||||
}
|
||||
|
||||
/** Set the accessory view used by the NSPrintPanel associated with the
|
||||
|
@ -368,7 +391,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
*/
|
||||
- (void)setAccessoryView:(NSView *)aView
|
||||
{
|
||||
ASSIGN(_accessoryView, aView);
|
||||
ASSIGN(_accessory_view, aView);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -413,14 +436,14 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
*/
|
||||
- (NSPrintingPageOrder)pageOrder
|
||||
{
|
||||
return _pageOrder;
|
||||
return _page_order;
|
||||
}
|
||||
|
||||
/** Set the page order used when printing.
|
||||
*/
|
||||
- (void)setPageOrder:(NSPrintingPageOrder)order
|
||||
{
|
||||
_pageOrder = order;
|
||||
_page_order = order;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -455,12 +478,12 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
{
|
||||
BOOL result;
|
||||
|
||||
if (_showPanels)
|
||||
if ([self showsPrintPanel])
|
||||
{
|
||||
NSPrintPanel *panel = [self printPanel];
|
||||
int button;
|
||||
|
||||
[panel setAccessoryView: _accessoryView];
|
||||
[panel setAccessoryView: _accessory_view];
|
||||
[self _setupPrintInfo];
|
||||
[panel updateFromPrintInfo];
|
||||
button = [panel runModal];
|
||||
|
@ -495,7 +518,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
NSPrintPanel *panel = [self printPanel];
|
||||
|
||||
/* Save the selector so we can use it later */
|
||||
dict = [_printInfo dictionary];
|
||||
dict = [_print_info dictionary];
|
||||
[dict setObject: [NSValue value: &didRunSelector withObjCType: @encode(SEL)]
|
||||
forKey: @"GSModalRunSelector"];
|
||||
[dict setObject: delegate
|
||||
|
@ -504,10 +527,10 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
/* Assume we want to show the panel regardless of the value
|
||||
of _showPanels
|
||||
*/
|
||||
[panel setAccessoryView: _accessoryView];
|
||||
[panel setAccessoryView: _accessory_view];
|
||||
[self _setupPrintInfo];
|
||||
[panel updateFromPrintInfo];
|
||||
[panel beginSheetWithPrintInfo: _printInfo
|
||||
[panel beginSheetWithPrintInfo: _print_info
|
||||
modalForWindow: docWindow
|
||||
delegate: delegate
|
||||
didEndSelector:
|
||||
|
@ -516,6 +539,26 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
[panel setAccessoryView: nil];
|
||||
}
|
||||
|
||||
- (BOOL)canSpawnSeparateThread
|
||||
{
|
||||
return _flags.can_spawn_separate_thread;
|
||||
}
|
||||
|
||||
- (void)setCanSpawnSeparateThread:(BOOL)flag
|
||||
{
|
||||
_flags.can_spawn_separate_thread = flag;
|
||||
}
|
||||
|
||||
- (NSString *) jobStyleHint
|
||||
{
|
||||
return _job_style_hint;
|
||||
}
|
||||
|
||||
- (void)setJobStyleHint:(NSString *)hint
|
||||
{
|
||||
ASSIGN(_job_style_hint, hint);
|
||||
}
|
||||
|
||||
//
|
||||
// Getting the NSPrintInfo Object
|
||||
//
|
||||
|
@ -523,7 +566,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
*/
|
||||
- (NSPrintInfo *)printInfo
|
||||
{
|
||||
return _printInfo;
|
||||
return _print_info;
|
||||
}
|
||||
|
||||
/** Set the NSPrintInfo object associated with the receiver.
|
||||
|
@ -533,7 +576,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
if (aPrintInfo == nil)
|
||||
aPrintInfo = [NSPrintInfo sharedPrintInfo];
|
||||
|
||||
ASSIGNCOPY(_printInfo, aPrintInfo);
|
||||
ASSIGNCOPY(_print_info, aPrintInfo);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -565,8 +608,9 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
ASSIGN(_view, aView);
|
||||
_rect = rect;
|
||||
ASSIGN(_data, data);
|
||||
_pageOrder = NSUnknownPageOrder;
|
||||
_showPanels = NO;
|
||||
_page_order = NSUnknownPageOrder;
|
||||
[self setShowsPrintPanel: NO];
|
||||
[self setShowsProgressPanel: NO];
|
||||
[self setPrintInfo: aPrintInfo];
|
||||
_path = nil;
|
||||
_currentPage = 0;
|
||||
|
@ -593,13 +637,13 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
return NO;
|
||||
|
||||
result = NO;
|
||||
if (_pageOrder == NSUnknownPageOrder)
|
||||
if (_page_order == NSUnknownPageOrder)
|
||||
{
|
||||
if ([[[_printInfo dictionary] objectForKey: NSPrintReversePageOrder]
|
||||
if ([[[_print_info dictionary] objectForKey: NSPrintReversePageOrder]
|
||||
boolValue] == YES)
|
||||
_pageOrder = NSDescendingPageOrder;
|
||||
_page_order = NSDescendingPageOrder;
|
||||
else
|
||||
_pageOrder = NSAscendingPageOrder;
|
||||
_page_order = NSAscendingPageOrder;
|
||||
}
|
||||
|
||||
[NSGraphicsContext setCurrentContext: _context];
|
||||
|
@ -626,7 +670,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
{
|
||||
BOOL knowsPageRange;
|
||||
NSRange viewPageRange;
|
||||
NSMutableDictionary *dict = [_printInfo dictionary];
|
||||
NSMutableDictionary *dict = [_print_info dictionary];
|
||||
|
||||
knowsPageRange = [_view knowsPageRange: &viewPageRange];
|
||||
if (knowsPageRange == YES)
|
||||
|
@ -656,7 +700,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
success = [self deliverResult];
|
||||
}
|
||||
[self cleanUpOperation];
|
||||
dict = [_printInfo dictionary];
|
||||
dict = [_print_info dictionary];
|
||||
didRunSelector = [[dict objectForKey: @"GSModalRunSelector"] pointerValue];
|
||||
delegate = [dict objectForKey: @"GSModalRunDelegate"];
|
||||
didRun = (void (*)(id, SEL, BOOL, id))[delegate methodForSelector:
|
||||
|
@ -693,10 +737,10 @@ scaleRect(NSRect rect, double scale)
|
|||
- (void) _printPaginateWithInfo: (page_info_t *)info knowsRange: (BOOL)knowsRange
|
||||
{
|
||||
NSMutableDictionary *dict;
|
||||
dict = [_printInfo dictionary];
|
||||
dict = [_print_info dictionary];
|
||||
|
||||
info->paperSize = [_printInfo paperSize];
|
||||
info->orient = [_printInfo orientation];
|
||||
info->paperSize = [_print_info paperSize];
|
||||
info->orient = [_print_info orientation];
|
||||
info->printScale = [[dict objectForKey: NSPrintScalingFactor] doubleValue];
|
||||
info->nup = [[dict objectForKey: NSPrintPagesPerSheet] intValue];
|
||||
info->nupScale = 1;
|
||||
|
@ -709,12 +753,12 @@ scaleRect(NSRect rect, double scale)
|
|||
|
||||
/* Subtract the margins from the paper size to get print boundary */
|
||||
info->paperBounds.size = info->paperSize;
|
||||
info->paperBounds.origin.x = [_printInfo leftMargin];
|
||||
info->paperBounds.origin.y = [_printInfo bottomMargin];
|
||||
info->paperBounds.origin.x = [_print_info leftMargin];
|
||||
info->paperBounds.origin.y = [_print_info bottomMargin];
|
||||
info->paperBounds.size.width -=
|
||||
([_printInfo rightMargin]+[_printInfo leftMargin]);
|
||||
([_print_info rightMargin]+[_print_info leftMargin]);
|
||||
info->paperBounds.size.height -=
|
||||
([_printInfo topMargin]+[_printInfo bottomMargin]);
|
||||
([_print_info topMargin]+[_print_info bottomMargin]);
|
||||
|
||||
info->sheetBounds = info->paperBounds;
|
||||
if (info->orient == NSLandscapeOrientation)
|
||||
|
@ -739,10 +783,10 @@ scaleRect(NSRect rect, double scale)
|
|||
if (knowsRange == NO)
|
||||
{
|
||||
/* Now calculate page fitting to get page scale */
|
||||
if ([_printInfo horizontalPagination] == NSFitPagination)
|
||||
if ([_print_info horizontalPagination] == NSFitPagination)
|
||||
info->pageScale = info->paperBounds.size.width
|
||||
/ NSWidth(info->scaledBounds);
|
||||
if ([_printInfo verticalPagination] == NSFitPagination)
|
||||
if ([_print_info verticalPagination] == NSFitPagination)
|
||||
info->pageScale = MIN(info->pageScale,
|
||||
NSHeight(info->paperBounds)/NSHeight(info->scaledBounds));
|
||||
/* Scale bounds by pageScale */
|
||||
|
@ -751,9 +795,9 @@ scaleRect(NSRect rect, double scale)
|
|||
/* Now find out how many pages */
|
||||
info->xpages = ceil(NSWidth(info->scaledBounds)/NSWidth(info->paperBounds));
|
||||
info->ypages = ceil(NSHeight(info->scaledBounds)/NSHeight(info->paperBounds));
|
||||
if ([_printInfo horizontalPagination] == NSClipPagination)
|
||||
if ([_print_info horizontalPagination] == NSClipPagination)
|
||||
info->xpages = 1;
|
||||
if ([_printInfo verticalPagination] == NSClipPagination)
|
||||
if ([_print_info verticalPagination] == NSClipPagination)
|
||||
info->ypages = 1;
|
||||
}
|
||||
|
||||
|
@ -869,7 +913,7 @@ scaleRect(NSRect rect, double scale)
|
|||
NSMutableDictionary *dict;
|
||||
page_info_t info;
|
||||
|
||||
dict = [_printInfo dictionary];
|
||||
dict = [_print_info dictionary];
|
||||
|
||||
/* Setup pagination */
|
||||
allPages = [[dict objectForKey: NSPrintAllPages] boolValue];
|
||||
|
@ -917,7 +961,7 @@ scaleRect(NSRect rect, double scale)
|
|||
|
||||
_currentPage = info.first;
|
||||
dir = 1;
|
||||
if (_pageOrder == NSDescendingPageOrder)
|
||||
if (_page_order == NSDescendingPageOrder)
|
||||
{
|
||||
_currentPage = info.last;
|
||||
dir = -1;
|
||||
|
@ -975,12 +1019,12 @@ scaleRect(NSRect rect, double scale)
|
|||
/* Check if adjust pages forced part of the bounds onto
|
||||
another page */
|
||||
if (NSMaxX(pageRect) < NSMaxX(_rect)
|
||||
&& [_printInfo horizontalPagination] != NSClipPagination)
|
||||
&& [_print_info horizontalPagination] != NSClipPagination)
|
||||
{
|
||||
info.xpages++;
|
||||
}
|
||||
if (NSMaxY(pageRect) < NSMaxY(_rect)
|
||||
&& [_printInfo verticalPagination] != NSClipPagination)
|
||||
&& [_print_info verticalPagination] != NSClipPagination)
|
||||
{
|
||||
info.ypages++;
|
||||
}
|
||||
|
|
|
@ -437,4 +437,48 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)presentError:(NSError *)error
|
||||
{
|
||||
error = [self willPresentError: error];
|
||||
|
||||
if (_next_responder)
|
||||
{
|
||||
return [_next_responder presentError: error];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [NSApp presentError: error];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)presentError:(NSError *)error
|
||||
modalForWindow:(NSWindow *)window
|
||||
delegate:(id)delegate
|
||||
didPresentSelector:(SEL)sel
|
||||
contextInfo:(void *)context
|
||||
{
|
||||
error = [self willPresentError: error];
|
||||
if (_next_responder)
|
||||
{
|
||||
[_next_responder presentError: error
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: sel
|
||||
contextInfo: context];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSApp presentError: error
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: sel
|
||||
contextInfo: context];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSError *) willPresentError: (NSError *)error
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <float.h>
|
||||
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSCalendarDate.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
|
|
|
@ -24,10 +24,15 @@
|
|||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "AppKit/NSWindowController.h"
|
||||
#include "AppKit/NSPanel.h"
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#include "AppKit/NSNibLoading.h"
|
||||
#include "AppKit/NSDocumentFrameworkPrivate.h"
|
||||
#include "AppKit/NSPanel.h"
|
||||
#include "AppKit/NSWindowController.h"
|
||||
#include "NSDocumentFrameworkPrivate.h"
|
||||
|
||||
@implementation NSWindowController
|
||||
|
||||
|
@ -51,7 +56,7 @@
|
|||
}
|
||||
|
||||
self = [self initWithWindow: nil];
|
||||
ASSIGN(_windowNibName, windowNibName);
|
||||
ASSIGN(_window_nib_name, windowNibName);
|
||||
_owner = owner;
|
||||
return self;
|
||||
}
|
||||
|
@ -72,7 +77,7 @@
|
|||
}
|
||||
|
||||
self = [self initWithWindow: nil];
|
||||
ASSIGN(_windowNibPath, windowNibPath);
|
||||
ASSIGN(_window_nib_path, windowNibPath);
|
||||
_owner = owner;
|
||||
return self;
|
||||
}
|
||||
|
@ -81,9 +86,9 @@
|
|||
{
|
||||
self = [super init];
|
||||
|
||||
_windowFrameAutosaveName = @"";
|
||||
_wcFlags.shouldCascade = YES;
|
||||
_wcFlags.shouldCloseDocument = NO;
|
||||
_window_frame_autosave_name = @"";
|
||||
_wcFlags.should_cascade = YES;
|
||||
_wcFlags.should_close_document = NO;
|
||||
|
||||
[self setWindow: window];
|
||||
if (_window != nil)
|
||||
|
@ -103,40 +108,40 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
[self setWindow: nil];
|
||||
RELEASE (_windowNibName);
|
||||
RELEASE (_windowNibPath);
|
||||
RELEASE (_windowFrameAutosaveName);
|
||||
RELEASE (_topLevelObjects);
|
||||
RELEASE(_window_nib_name);
|
||||
RELEASE(_window_nib_path);
|
||||
RELEASE(_window_frame_autosave_name);
|
||||
RELEASE(_top_level_objects);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) windowNibName
|
||||
{
|
||||
if ((_windowNibName == nil) && (_windowNibPath != nil))
|
||||
if ((_window_nib_name == nil) && (_window_nib_path != nil))
|
||||
{
|
||||
return [[_windowNibPath lastPathComponent]
|
||||
return [[_window_nib_path lastPathComponent]
|
||||
stringByDeletingPathExtension];
|
||||
}
|
||||
|
||||
return _windowNibName;
|
||||
return _window_nib_name;
|
||||
}
|
||||
|
||||
- (NSString *)windowNibPath
|
||||
{
|
||||
if ((_windowNibName != nil) && (_windowNibPath == nil))
|
||||
if ((_window_nib_name != nil) && (_window_nib_path == nil))
|
||||
{
|
||||
NSString *path;
|
||||
|
||||
path = [[NSBundle bundleForClass: [_owner class]]
|
||||
pathForNibResource: _windowNibName];
|
||||
pathForNibResource: _window_nib_name];
|
||||
if (path == nil)
|
||||
path = [[NSBundle mainBundle]
|
||||
pathForNibResource: _windowNibName];
|
||||
pathForNibResource: _window_nib_name];
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
return _windowNibPath;
|
||||
return _window_nib_path;
|
||||
}
|
||||
|
||||
- (id) owner
|
||||
|
@ -187,7 +192,7 @@
|
|||
|
||||
- (void) setWindowFrameAutosaveName:(NSString *)name
|
||||
{
|
||||
ASSIGN(_windowFrameAutosaveName, name);
|
||||
ASSIGN(_window_frame_autosave_name, name);
|
||||
|
||||
if ([self isWindowLoaded])
|
||||
{
|
||||
|
@ -197,27 +202,27 @@
|
|||
|
||||
- (NSString *) windowFrameAutosaveName
|
||||
{
|
||||
return _windowFrameAutosaveName;
|
||||
return _window_frame_autosave_name;
|
||||
}
|
||||
|
||||
- (void) setShouldCloseDocument: (BOOL)flag
|
||||
{
|
||||
_wcFlags.shouldCloseDocument = flag;
|
||||
_wcFlags.should_close_document = flag;
|
||||
}
|
||||
|
||||
- (BOOL) shouldCloseDocument
|
||||
{
|
||||
return _wcFlags.shouldCloseDocument;
|
||||
return _wcFlags.should_close_document;
|
||||
}
|
||||
|
||||
- (void) setShouldCascadeWindows: (BOOL)flag
|
||||
{
|
||||
_wcFlags.shouldCascade = flag;
|
||||
_wcFlags.should_cascade = flag;
|
||||
}
|
||||
|
||||
- (BOOL) shouldCascadeWindows
|
||||
{
|
||||
return _wcFlags.shouldCascade;
|
||||
return _wcFlags.should_cascade;
|
||||
}
|
||||
|
||||
- (void) close
|
||||
|
@ -375,7 +380,7 @@
|
|||
|
||||
- (BOOL) isWindowLoaded
|
||||
{
|
||||
return _wcFlags.nibIsLoaded;
|
||||
return _wcFlags.nib_is_loaded;
|
||||
}
|
||||
|
||||
- (void) windowDidLoad
|
||||
|
@ -388,15 +393,15 @@
|
|||
|
||||
- (void) _windowDidLoad
|
||||
{
|
||||
_wcFlags.nibIsLoaded = YES;
|
||||
_wcFlags.nib_is_loaded = YES;
|
||||
|
||||
[self synchronizeWindowTitleWithDocumentName];
|
||||
|
||||
/* Make sure window sizes itself right */
|
||||
if ([_windowFrameAutosaveName length] > 0)
|
||||
if ([_window_frame_autosave_name length] > 0)
|
||||
{
|
||||
[_window setFrameUsingName: _windowFrameAutosaveName];
|
||||
[_window setFrameAutosaveName: _windowFrameAutosaveName];
|
||||
[_window setFrameUsingName: _window_frame_autosave_name];
|
||||
[_window setFrameAutosaveName: _window_frame_autosave_name];
|
||||
}
|
||||
|
||||
if ([self shouldCascadeWindows])
|
||||
|
@ -431,7 +436,7 @@
|
|||
externalNameTable: table
|
||||
withZone: [_owner zone]])
|
||||
{
|
||||
_wcFlags.nibIsLoaded = YES;
|
||||
_wcFlags.nib_is_loaded = YES;
|
||||
|
||||
if (_window == nil && _document != nil && _owner == _document)
|
||||
{
|
||||
|
@ -440,10 +445,10 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_windowNibName != nil)
|
||||
if (_window_nib_name != nil)
|
||||
{
|
||||
NSLog (@"%@: could not load nib named %@.nib",
|
||||
[self class], _windowNibName);
|
||||
[self class], _window_nib_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue