Added basic preferences framework.

CQTexperiment
vspader 2006-09-04 18:06:23 +00:00
parent 0f34406ca5
commit 54f5918487
28 changed files with 1472 additions and 17 deletions

View File

@ -11,6 +11,12 @@
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
8E07AAF10AAC910500A4B32F /* SS_PreferencePaneProtocol.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8E07AAEE0AAC910500A4B32F /* SS_PreferencePaneProtocol.h */; };
8E07AAF20AAC910500A4B32F /* SS_PrefsController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8E07AAEF0AAC910500A4B32F /* SS_PrefsController.h */; };
8E07AAF30AAC910500A4B32F /* SS_PrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AAF00AAC910500A4B32F /* SS_PrefsController.m */; };
8E07AB780AAC930B00A4B32F /* PreferencesController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8E07AB760AAC930B00A4B32F /* PreferencesController.h */; };
8E07AB790AAC930B00A4B32F /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AB770AAC930B00A4B32F /* PreferencesController.m */; };
8E07AEEA0AACA08100A4B32F /* General.preferencePane in Resources */ = {isa = PBXBuildFile; fileRef = 8E07AEE90AACA08100A4B32F /* General.preferencePane */; };
8E0AD92B0A338CFF00215AEF /* Shorten.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8EA9172F0A336CC30087CDE2 /* Shorten.framework */; }; 8E0AD92B0A338CFF00215AEF /* Shorten.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8EA9172F0A336CC30087CDE2 /* Shorten.framework */; };
8E1296DA0A2BA9CE00443124 /* PlaylistHeaderView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8E1296D80A2BA9CE00443124 /* PlaylistHeaderView.h */; }; 8E1296DA0A2BA9CE00443124 /* PlaylistHeaderView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8E1296D80A2BA9CE00443124 /* PlaylistHeaderView.h */; };
8E1296DB0A2BA9CE00443124 /* PlaylistHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1296D90A2BA9CE00443124 /* PlaylistHeaderView.m */; }; 8E1296DB0A2BA9CE00443124 /* PlaylistHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E1296D90A2BA9CE00443124 /* PlaylistHeaderView.m */; };
@ -171,15 +177,9 @@
8EFFCD720AA093AF00C458A5 /* UKFNSubscribeFileWatcher.h in CopyFiles */, 8EFFCD720AA093AF00C458A5 /* UKFNSubscribeFileWatcher.h in CopyFiles */,
8EFFCD750AA093AF00C458A5 /* UKKQueue.h in CopyFiles */, 8EFFCD750AA093AF00C458A5 /* UKKQueue.h in CopyFiles */,
8EFFCD770AA093AF00C458A5 /* UKMainThreadProxy.h in CopyFiles */, 8EFFCD770AA093AF00C458A5 /* UKMainThreadProxy.h in CopyFiles */,
); 8E07AAF10AAC910500A4B32F /* SS_PreferencePaneProtocol.h in CopyFiles */,
runOnlyForDeploymentPostprocessing = 0; 8E07AAF20AAC910500A4B32F /* SS_PrefsController.h in CopyFiles */,
}; 8E07AB780AAC930B00A4B32F /* PreferencesController.h in CopyFiles */,
8EB44F4B0A2BB82B00AA711F /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 7;
files = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -196,6 +196,12 @@
32CA4F630368D1EE00C91783 /* Cog_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cog_Prefix.pch; sourceTree = "<group>"; }; 32CA4F630368D1EE00C91783 /* Cog_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cog_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Cog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cog.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D1107320486CEB800E47090 /* Cog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cog.app; sourceTree = BUILT_PRODUCTS_DIR; };
8E07AAEE0AAC910500A4B32F /* SS_PreferencePaneProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SS_PreferencePaneProtocol.h; path = Preferences/SS_PreferencePaneProtocol.h; sourceTree = "<group>"; };
8E07AAEF0AAC910500A4B32F /* SS_PrefsController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SS_PrefsController.h; path = Preferences/SS_PrefsController.h; sourceTree = "<group>"; };
8E07AAF00AAC910500A4B32F /* SS_PrefsController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SS_PrefsController.m; path = Preferences/SS_PrefsController.m; sourceTree = "<group>"; };
8E07AB760AAC930B00A4B32F /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PreferencesController.h; path = Preferences/PreferencesController.h; sourceTree = "<group>"; };
8E07AB770AAC930B00A4B32F /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PreferencesController.m; path = Preferences/PreferencesController.m; sourceTree = "<group>"; };
8E07AEE90AACA08100A4B32F /* General.preferencePane */ = {isa = PBXFileReference; lastKnownFileType = folder; name = General.preferencePane; path = Preferences/General/build/Release/General.preferencePane; sourceTree = "<group>"; };
8E1296D80A2BA9CE00443124 /* PlaylistHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlaylistHeaderView.h; sourceTree = "<group>"; }; 8E1296D80A2BA9CE00443124 /* PlaylistHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlaylistHeaderView.h; sourceTree = "<group>"; };
8E1296D90A2BA9CE00443124 /* PlaylistHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PlaylistHeaderView.m; sourceTree = "<group>"; }; 8E1296D90A2BA9CE00443124 /* PlaylistHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PlaylistHeaderView.m; sourceTree = "<group>"; };
8E1849C40A43DB5C0084C69D /* MAD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MAD.framework; path = Libraries/MAD/build/Release/MAD.framework; sourceTree = "<group>"; }; 8E1849C40A43DB5C0084C69D /* MAD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MAD.framework; path = Libraries/MAD/build/Release/MAD.framework; sourceTree = "<group>"; };
@ -385,6 +391,7 @@
080E96DDFE201D6D7F000001 /* Classes */ = { 080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8E07AAEA0AAC90DC00A4B32F /* Preferences */,
8EFFCD410AA093AF00C458A5 /* FileDrawer */, 8EFFCD410AA093AF00C458A5 /* FileDrawer */,
8E75752309F31D5A0080F1EE /* Feedback */, 8E75752309F31D5A0080F1EE /* Feedback */,
8E75755D09F31D5A0080F1EE /* Updates */, 8E75755D09F31D5A0080F1EE /* Updates */,
@ -453,11 +460,12 @@
29B97317FDCFA39411CA2CEA /* Resources */ = { 29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8EB44FF90A2BB8B300AA711F /* Cog Help */, 8E07AD280AAC9BE600A4B32F /* Preference Panes */,
8E7575D909F31E930080F1EE /* Localizable.strings */,
8E75758E09F31D800080F1EE /* Icons */, 8E75758E09F31D800080F1EE /* Icons */,
8EB44FF90A2BB8B300AA711F /* Cog Help */,
8D1107310486CEB800E47090 /* Info.plist */, 8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
8E7575D909F31E930080F1EE /* Localizable.strings */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
8E7575C309F31DCA0080F1EE /* Changelog */, 8E7575C309F31DCA0080F1EE /* Changelog */,
8E7575C409F31DCA0080F1EE /* Cog.scriptSuite */, 8E7575C409F31DCA0080F1EE /* Cog.scriptSuite */,
@ -481,6 +489,26 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
8E07AAEA0AAC90DC00A4B32F /* Preferences */ = {
isa = PBXGroup;
children = (
8E07AAEE0AAC910500A4B32F /* SS_PreferencePaneProtocol.h */,
8E07AAEF0AAC910500A4B32F /* SS_PrefsController.h */,
8E07AAF00AAC910500A4B32F /* SS_PrefsController.m */,
8E07AB760AAC930B00A4B32F /* PreferencesController.h */,
8E07AB770AAC930B00A4B32F /* PreferencesController.m */,
);
name = Preferences;
sourceTree = "<group>";
};
8E07AD280AAC9BE600A4B32F /* Preference Panes */ = {
isa = PBXGroup;
children = (
8E07AEE90AACA08100A4B32F /* General.preferencePane */,
);
name = "Preference Panes";
sourceTree = "<group>";
};
8E75751A09F31D5A0080F1EE /* Custom */ = { 8E75751A09F31D5A0080F1EE /* Custom */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -660,6 +688,7 @@
8EFFCD410AA093AF00C458A5 /* FileDrawer */ = { 8EFFCD410AA093AF00C458A5 /* FileDrawer */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8EFFCD540AA093AF00C458A5 /* UKKQueue */,
8EFFCD440AA093AF00C458A5 /* FileIconCell.h */, 8EFFCD440AA093AF00C458A5 /* FileIconCell.h */,
8EFFCD450AA093AF00C458A5 /* FileIconCell.m */, 8EFFCD450AA093AF00C458A5 /* FileIconCell.m */,
8EFFCD4E0AA093AF00C458A5 /* ImageTextCell.h */, 8EFFCD4E0AA093AF00C458A5 /* ImageTextCell.h */,
@ -678,7 +707,6 @@
8EFFCD470AA093AF00C458A5 /* FileNode.m */, 8EFFCD470AA093AF00C458A5 /* FileNode.m */,
8EFFCD520AA093AF00C458A5 /* PathNode.h */, 8EFFCD520AA093AF00C458A5 /* PathNode.h */,
8EFFCD530AA093AF00C458A5 /* PathNode.m */, 8EFFCD530AA093AF00C458A5 /* PathNode.m */,
8EFFCD540AA093AF00C458A5 /* UKKQueue */,
); );
path = FileDrawer; path = FileDrawer;
sourceTree = "<group>"; sourceTree = "<group>";
@ -710,7 +738,6 @@
8D11072C0486CEB800E47090 /* Sources */, 8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */, 8D11072E0486CEB800E47090 /* Frameworks */,
8E757AEC09F3265E0080F1EE /* CopyFiles */, 8E757AEC09F3265E0080F1EE /* CopyFiles */,
8EB44F4B0A2BB82B00AA711F /* CopyFiles */,
); );
buildRules = ( buildRules = (
); );
@ -742,6 +769,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
8E07AEEA0AACA08100A4B32F /* General.preferencePane in Resources */,
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
8E75758709F31D5A0080F1EE /* SOUNDTODO in Resources */, 8E75758709F31D5A0080F1EE /* SOUNDTODO in Resources */,
@ -840,6 +868,8 @@
8EFFCD730AA093AF00C458A5 /* UKFNSubscribeFileWatcher.m in Sources */, 8EFFCD730AA093AF00C458A5 /* UKFNSubscribeFileWatcher.m in Sources */,
8EFFCD760AA093AF00C458A5 /* UKKQueue.m in Sources */, 8EFFCD760AA093AF00C458A5 /* UKKQueue.m in Sources */,
8EFFCD780AA093AF00C458A5 /* UKMainThreadProxy.m in Sources */, 8EFFCD780AA093AF00C458A5 /* UKMainThreadProxy.m in Sources */,
8E07AAF30AAC910500A4B32F /* SS_PrefsController.m in Sources */,
8E07AB790AAC930B00A4B32F /* PreferencesController.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -125,6 +125,12 @@
}; };
SUPERCLASS = NSTableView; SUPERCLASS = NSTableView;
}, },
{
ACTIONS = {showPrefs = id; };
CLASS = PreferencesController;
LANGUAGE = ObjC;
SUPERCLASS = NSObject;
},
{ {
ACTIONS = { ACTIONS = {
changeVolume = id; changeVolume = id;

View File

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>71 108 639 388 0 0 1024 746 </string> <string>33 358 639 388 0 0 1024 746 </string>
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>1063</key> <key>1063</key>
@ -29,12 +29,12 @@
<integer>564</integer> <integer>564</integer>
</array> </array>
<key>IBOldestOS</key> <key>IBOldestOS</key>
<integer>3</integer> <integer>4</integer>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>463</integer>
<integer>29</integer> <integer>29</integer>
<integer>21</integer> <integer>21</integer>
<integer>463</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>8J135</string> <string>8J135</string>

Binary file not shown.

View File

@ -41,7 +41,6 @@ NSString *MovedRowsType = @"MOVED_ROWS_TYPE";
{ {
NSDragOperation dragOp = NSDragOperationCopy; NSDragOperation dragOp = NSDragOperationCopy;
NSLog(@"VALIDATING");
if ([info draggingSource] == tv) if ([info draggingSource] == tv)
dragOp = NSDragOperationMove; dragOp = NSDragOperationMove;

Binary file not shown.

View File

@ -0,0 +1,20 @@
{
IBClasses = (
{CLASS = FileDrawerPane; LANGUAGE = ObjC; SUPERCLASS = PreferencePane; },
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = HotKeyPane; LANGUAGE = ObjC; SUPERCLASS = PreferencePane; },
{
CLASS = PrefPaneController;
LANGUAGE = ObjC;
OUTLETS = {fileDrawerPane = FileDrawerPane; hotKeyPane = HotKeyPane; };
SUPERCLASS = NSObject;
},
{
CLASS = PreferencePane;
LANGUAGE = ObjC;
OUTLETS = {view = NSView; };
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>69 77 356 240 0 0 1024 746 </string>
<key>IBEditorPositions</key>
<dict>
<key>10</key>
<string>-9 537 668 209 0 0 1024 746 </string>
<key>11</key>
<string>155 171 241 464 0 0 1024 746 </string>
</dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>11</integer>
<integer>10</integer>
</array>
<key>IBSystem Version</key>
<string>8J135</string>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1,17 @@
//
// FileDrawerPane.h
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "PreferencePane.h"
@interface FileDrawerPane : PreferencePane {
}
@end

View File

@ -0,0 +1,20 @@
//
// FileDrawerPane.m
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "FileDrawerPane.h"
@implementation FileDrawerPane
- (void)awakeFromNib
{
[self setName:@"File Drawer"];
[self setIcon:@"file_drawer"];
}
@end

View File

@ -0,0 +1,311 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
8E07AA870AAC8EA200A4B32F /* FileDrawerPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AA7F0AAC8EA200A4B32F /* FileDrawerPane.m */; };
8E07AA880AAC8EA200A4B32F /* HotKeyPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AA810AAC8EA200A4B32F /* HotKeyPane.m */; };
8E07AA890AAC8EA200A4B32F /* PreferencePane.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AA830AAC8EA200A4B32F /* PreferencePane.m */; };
8E07AA8A0AAC8EA200A4B32F /* PrefPaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AA850AAC8EA200A4B32F /* PrefPaneController.m */; };
8E07ABDC0AAC95BC00A4B32F /* file_drawer.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E07ABDA0AAC95BC00A4B32F /* file_drawer.png */; };
8E07ABDD0AAC95BC00A4B32F /* hot_keys.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */; };
8E07AC050AAC968C00A4B32F /* Preferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 8E07AC030AAC968C00A4B32F /* Preferences.nib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* General_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = General_Prefix.pch; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* General.preferencePane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = General.preferencePane; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
8E07AA7E0AAC8EA200A4B32F /* FileDrawerPane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FileDrawerPane.h; sourceTree = "<group>"; };
8E07AA7F0AAC8EA200A4B32F /* FileDrawerPane.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = FileDrawerPane.m; sourceTree = "<group>"; };
8E07AA800AAC8EA200A4B32F /* HotKeyPane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HotKeyPane.h; sourceTree = "<group>"; };
8E07AA810AAC8EA200A4B32F /* HotKeyPane.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HotKeyPane.m; sourceTree = "<group>"; };
8E07AA820AAC8EA200A4B32F /* PreferencePane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PreferencePane.h; sourceTree = "<group>"; };
8E07AA830AAC8EA200A4B32F /* PreferencePane.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PreferencePane.m; sourceTree = "<group>"; };
8E07AA840AAC8EA200A4B32F /* PrefPaneController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PrefPaneController.h; sourceTree = "<group>"; };
8E07AA850AAC8EA200A4B32F /* PrefPaneController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PrefPaneController.m; sourceTree = "<group>"; };
8E07AA860AAC8EA200A4B32F /* SS_PreferencePaneProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SS_PreferencePaneProtocol.h; sourceTree = "<group>"; };
8E07ABDA0AAC95BC00A4B32F /* file_drawer.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = file_drawer.png; path = Icons/file_drawer.png; sourceTree = "<group>"; };
8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = hot_keys.png; path = Icons/hot_keys.png; sourceTree = "<group>"; };
8E07AC040AAC968C00A4B32F /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D5B49B3048680CD000E48DA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
089C166AFE841209C02AAC07 /* General */ = {
isa = PBXGroup;
children = (
08FB77AFFE84173DC02AAC07 /* Classes */,
32C88E010371C26100C91783 /* Other Sources */,
089C167CFE841241C02AAC07 /* Resources */,
089C1671FE841209C02AAC07 /* Frameworks and Libraries */,
19C28FB8FE9D52D311CA2CBB /* Products */,
);
name = General;
sourceTree = "<group>";
};
089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */,
1058C7AEFEA557BF11CA2CBB /* Other Frameworks */,
);
name = "Frameworks and Libraries";
sourceTree = "<group>";
};
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8E07ABD90AAC95AF00A4B32F /* Icons */,
8D5B49B7048680CD000E48DA /* Info.plist */,
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
8E07AC030AAC968C00A4B32F /* Preferences.nib */,
);
name = Resources;
sourceTree = "<group>";
};
08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
8E07AA860AAC8EA200A4B32F /* SS_PreferencePaneProtocol.h */,
8E07AA840AAC8EA200A4B32F /* PrefPaneController.h */,
8E07AA850AAC8EA200A4B32F /* PrefPaneController.m */,
8E07AA820AAC8EA200A4B32F /* PreferencePane.h */,
8E07AA830AAC8EA200A4B32F /* PreferencePane.m */,
8E07AA7E0AAC8EA200A4B32F /* FileDrawerPane.h */,
8E07AA7F0AAC8EA200A4B32F /* FileDrawerPane.m */,
8E07AA800AAC8EA200A4B32F /* HotKeyPane.h */,
8E07AA810AAC8EA200A4B32F /* HotKeyPane.m */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
089C167FFE841241C02AAC07 /* AppKit.framework */,
D2F7E65807B2D6F200F64583 /* CoreData.framework */,
089C1672FE841209C02AAC07 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FB8FE9D52D311CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D5B49B6048680CD000E48DA /* General.preferencePane */,
);
name = Products;
sourceTree = "<group>";
};
32C88E010371C26100C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
32DBCF630370AF2F00C91783 /* General_Prefix.pch */,
);
name = "Other Sources";
sourceTree = "<group>";
};
8E07ABD90AAC95AF00A4B32F /* Icons */ = {
isa = PBXGroup;
children = (
8E07ABDA0AAC95BC00A4B32F /* file_drawer.png */,
8E07ABDB0AAC95BC00A4B32F /* hot_keys.png */,
);
name = Icons;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D5B49AC048680CD000E48DA /* General */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "General" */;
buildPhases = (
8D5B49AF048680CD000E48DA /* Resources */,
8D5B49B1048680CD000E48DA /* Sources */,
8D5B49B3048680CD000E48DA /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = General;
productInstallPath = "$(HOME)/Library/Bundles";
productName = General;
productReference = 8D5B49B6048680CD000E48DA /* General.preferencePane */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "General" */;
hasScannedForEncodings = 1;
mainGroup = 089C166AFE841209C02AAC07 /* General */;
projectDirPath = "";
targets = (
8D5B49AC048680CD000E48DA /* General */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D5B49AF048680CD000E48DA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */,
8E07ABDC0AAC95BC00A4B32F /* file_drawer.png in Resources */,
8E07ABDD0AAC95BC00A4B32F /* hot_keys.png in Resources */,
8E07AC050AAC968C00A4B32F /* Preferences.nib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D5B49B1048680CD000E48DA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8E07AA870AAC8EA200A4B32F /* FileDrawerPane.m in Sources */,
8E07AA880AAC8EA200A4B32F /* HotKeyPane.m in Sources */,
8E07AA890AAC8EA200A4B32F /* PreferencePane.m in Sources */,
8E07AA8A0AAC8EA200A4B32F /* PrefPaneController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C167EFE841241C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
8E07AC030AAC968C00A4B32F /* Preferences.nib */ = {
isa = PBXVariantGroup;
children = (
8E07AC040AAC968C00A4B32F /* English */,
);
name = Preferences.nib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
1DEB913B08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = General_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
PRODUCT_NAME = General;
WRAPPER_EXTENSION = preferencePane;
ZERO_LINK = YES;
};
name = Debug;
};
1DEB913C08733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = General_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
PRODUCT_NAME = General;
WRAPPER_EXTENSION = preferencePane;
};
name = Release;
};
1DEB913F08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
1DEB914008733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "General" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB913B08733D840010E9CD /* Debug */,
1DEB913C08733D840010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "General" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB913F08733D840010E9CD /* Debug */,
1DEB914008733D840010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
}

View File

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'General' target in the 'General' project.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -0,0 +1,17 @@
//
// HotKeyPane.h
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "PreferencePane.h"
@interface HotKeyPane : PreferencePane {
}
@end

View File

@ -0,0 +1,20 @@
//
// HotKeyPane.m
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "HotKeyPane.h"
@implementation HotKeyPane
- (void)awakeFromNib
{
[self setName:@"Hot Keys"];
[self setIcon:@"hot_keys"];
}
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.vspader.cogpreferences</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>PrefPaneController</string>
</dict>
</plist>

View File

@ -0,0 +1,23 @@
//
// PreferencesController.h
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "SS_PreferencePaneProtocol.h"
#import "HotKeyPane.h"
#import "FileDrawerPane.h"
@interface PrefPaneController : NSObject <SS_PreferencePaneProtocol> {
IBOutlet HotKeyPane *hotKeyPane;
IBOutlet FileDrawerPane *fileDrawerPane;
}
- (FileDrawerPane *)fileDrawerPane;
- (HotKeyPane *)hotKeyPane;
@end

View File

@ -0,0 +1,34 @@
//
// PreferencesController.m
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "PrefPaneController.h"
#import "SS_PreferencePaneProtocol.h"
@implementation PrefPaneController
+ (NSArray *)preferencePanes
{
BOOL loaded;
PrefPaneController *prefPaneController = [[PrefPaneController alloc] init];
loaded = [NSBundle loadNibNamed:@"Preferences" owner:prefPaneController];
return [NSArray arrayWithObjects: [prefPaneController hotKeyPane], [prefPaneController fileDrawerPane], nil];
}
- (HotKeyPane *)hotKeyPane
{
return hotKeyPane;
}
- (FileDrawerPane *)fileDrawerPane
{
return fileDrawerPane;
}
@end

View File

@ -0,0 +1,31 @@
//
// PreferencePane.h
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "SS_PreferencePaneProtocol.h"
@interface PreferencePane : NSObject <SS_PreferencePaneProtocol> {
IBOutlet NSView *view;
NSString *name;
NSImage *icon;
}
- (NSView *)paneView;
- (NSString *)paneName;
- (NSImage *)paneIcon;
- (NSString *)paneToolTip;
- (BOOL)allowsHorizontalResizing;
- (BOOL)allowsVerticalResizing;
- (void)setName:(NSString *)s;
- (void)setIcon:(NSString *)i;
- (void)setToolTip:(NSString *)t;
@end

View File

@ -0,0 +1,57 @@
//
// PreferencePane.m
// Preferences
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "PreferencePane.h"
@implementation PreferencePane
- (NSView *)paneView
{
return view;
}
- (NSString *)paneName
{
return name;
}
- (NSImage *)paneIcon
{
return icon;
}
- (NSString *)paneToolTip
{
return nil;
}
- (BOOL)allowsHorizontalResizing
{
return NO;
}
- (BOOL)allowsVerticalResizing
{
return NO;
}
- (void)setName:(NSString *)s
{
[s retain];
[name release];
name = s;
}
- (void)setIcon:(NSString *)i
{
[icon release];
icon = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForImageResource:i]];
}
@end

View File

@ -0,0 +1,50 @@
#import <Cocoa/Cocoa.h>
@protocol SS_PreferencePaneProtocol
// preferencePanes is called whenever the calling application wants to instantiate preference panes.
// This method returns an array of preference pane instances. This array is autoreleased,
// so the calling application needs to retain whatever it wants to keep.
// If no instances were generated, this returns nil.
+ (NSArray *)preferencePanes;
// paneView returns a preference pane's view. This must not be nil.
- (NSView *)paneView;
// paneName returns the name associated with a preference pane's view.
// This is used as the label of the pane's toolbar item in the Preferences window,
// and as the title of the Preferences window when the pane is selected.
// This must not be nil or an empty string.
- (NSString *)paneName;
// paneIcon returns a preference pane's icon as an NSImage.
// The icon will be scaled to the default size for a toolbar icon (if necessary),
// and shown in the toolbar in the Preferences window.
- (NSImage *)paneIcon;
// paneToolTip returns the ToolTip to be used for a preference pane's icon in the
// Preferences window's toolbar. You can return nil or an empty string to disable
// the ToolTip for this preference pane.
- (NSString *)paneToolTip;
// allowsHorizontalResizing and allowsVerticalResizing determine whether the Preferences window
// will be resizable in the respective directions when the receiver is the visible preference
// pane. The initial size of the receiver's view will be used as the minimum size of the
// Preferences window.
- (BOOL)allowsHorizontalResizing;
- (BOOL)allowsVerticalResizing;
@end

View File

@ -0,0 +1,18 @@
//
// PreferencesController.h
// Cog
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "SS_PrefsController.h"
@interface PreferencesController : NSObject {
SS_PrefsController *prefs;
}
- (IBAction)showPrefs:(id)sender;
@end

View File

@ -0,0 +1,40 @@
//
// PreferencesController.m
// Cog
//
// Created by Zaphod Beeblebrox on 9/4/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "PreferencesController.h"
@implementation PreferencesController
- (IBAction)showPrefs:(id)sender
{
if (!prefs) {
// Determine path to the sample preference panes
NSString *pathToPanes = [[NSBundle mainBundle] resourcePath];
NSLog(@"Loading preferences...%@", pathToPanes);
prefs = [[SS_PrefsController alloc] initWithPanesSearchPath:pathToPanes bundleExtension:@"preferencePane"];
[prefs setDebug:YES];
// Set which panes are included, and their order.
// [prefs setPanesOrder:[NSArray arrayWithObjects:@"General", @"Updating", @"A Non-Existent Preference Pane", nil]];
}
// Show the preferences window.
[prefs showPreferencesWindow];
}
- (void)dealloc
{
[prefs release];
[super dealloc];
}
@end

View File

@ -0,0 +1,50 @@
#import <Cocoa/Cocoa.h>
@protocol SS_PreferencePaneProtocol
// preferencePanes is called whenever the calling application wants to instantiate preference panes.
// This method returns an array of preference pane instances. This array is autoreleased,
// so the calling application needs to retain whatever it wants to keep.
// If no instances were generated, this returns nil.
+ (NSArray *)preferencePanes;
// paneView returns a preference pane's view. This must not be nil.
- (NSView *)paneView;
// paneName returns the name associated with a preference pane's view.
// This is used as the label of the pane's toolbar item in the Preferences window,
// and as the title of the Preferences window when the pane is selected.
// This must not be nil or an empty string.
- (NSString *)paneName;
// paneIcon returns a preference pane's icon as an NSImage.
// The icon will be scaled to the default size for a toolbar icon (if necessary),
// and shown in the toolbar in the Preferences window.
- (NSImage *)paneIcon;
// paneToolTip returns the ToolTip to be used for a preference pane's icon in the
// Preferences window's toolbar. You can return nil or an empty string to disable
// the ToolTip for this preference pane.
- (NSString *)paneToolTip;
// allowsHorizontalResizing and allowsVerticalResizing determine whether the Preferences window
// will be resizable in the respective directions when the receiver is the visible preference
// pane. The initial size of the receiver's view will be used as the minimum size of the
// Preferences window.
- (BOOL)allowsHorizontalResizing;
- (BOOL)allowsVerticalResizing;
@end

View File

@ -0,0 +1,76 @@
/* SS_PrefsController */
#import <Cocoa/Cocoa.h>
@interface SS_PrefsController : NSObject
{
NSWindow *prefsWindow;
NSMutableDictionary *preferencePanes;
NSMutableArray *panesOrder;
NSString *bundleExtension;
NSString *searchPath;
NSToolbar *prefsToolbar;
NSMutableDictionary *prefsToolbarItems;
NSToolbarDisplayMode toolbarDisplayMode;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
NSToolbarSizeMode toolbarSizeMode;
#endif
BOOL usesTexturedWindow;
BOOL alwaysShowsToolbar;
BOOL alwaysOpensCentered;
BOOL debug;
}
// Convenience constructors
+ (id)preferencesWithPanesSearchPath:(NSString*)path bundleExtension:(NSString *)ext;
+ (id)preferencesWithBundleExtension:(NSString *)ext;
+ (id)preferencesWithPanesSearchPath:(NSString*)path;
+ (id)preferences;
// Designated initializer
- (id)initWithPanesSearchPath:(NSString*)path bundleExtension:(NSString *)ext;
- (id)initWithBundleExtension:(NSString *)ext;
- (id)initWithPanesSearchPath:(NSString*)path;
- (void)showPreferencesWindow;
- (void)createPreferencesWindowAndDisplay:(BOOL)shouldDisplay;
- (void)createPreferencesWindow;
- (void)destroyPreferencesWindow;
- (BOOL)loadPrefsPaneNamed:(NSString *)name display:(BOOL)disp;
- (BOOL)loadPreferencePaneNamed:(NSString *)name;
- (void)activatePane:(NSString*)path;
- (void)debugLog:(NSString*)msg;
float ToolbarHeightForWindow(NSWindow *window);
- (void)createPrefsToolbar;
- (void)prefsToolbarItemClicked:(NSToolbarItem*)item;
// Accessors
- (NSWindow *)preferencesWindow;
- (NSString *)bundleExtension;
- (NSString *)searchPath;
- (NSArray *)loadedPanes;
- (NSArray *)panesOrder;
- (void)setPanesOrder:(NSArray *)newPanesOrder;
- (BOOL)debug;
- (void)setDebug:(BOOL)newDebug;
- (BOOL)usesTexturedWindow;
- (void)setUsesTexturedWindow:(BOOL)newUsesTexturedWindow;
- (BOOL)alwaysShowsToolbar;
- (void)setAlwaysShowsToolbar:(BOOL)newAlwaysShowsToolbar;
- (BOOL)alwaysOpensCentered;
- (void)setAlwaysOpensCentered:(BOOL)newAlwaysOpensCentered;
- (NSToolbarDisplayMode)toolbarDisplayMode;
- (void)setToolbarDisplayMode:(NSToolbarDisplayMode)displayMode;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
- (NSToolbarSizeMode)toolbarSizeMode;
- (void)setToolbarSizeMode:(NSToolbarSizeMode)sizeMode;
#endif
@end

View File

@ -0,0 +1,579 @@
#import "SS_PrefsController.h"
#import "SS_PreferencePaneProtocol.h"
@implementation SS_PrefsController
#define Last_Pane_Defaults_Key [[[NSBundle mainBundle] bundleIdentifier] stringByAppendingString:@"_Preferences_Last_Pane_Defaults_Key"]
// ************************************************
// version/init/dealloc/constructors
// ************************************************
+ (int)version
{
return 1; // 28th June 2003
}
+ (id)preferencesWithPanesSearchPath:(NSString*)path bundleExtension:(NSString *)ext
{
return [[[SS_PrefsController alloc] initWithPanesSearchPath:path bundleExtension:ext] autorelease];
}
+ (id)preferencesWithBundleExtension:(NSString *)ext
{
return [[[SS_PrefsController alloc] initWithBundleExtension:ext] autorelease];
}
+ (id)preferencesWithPanesSearchPath:(NSString*)path
{
return [[[SS_PrefsController alloc] initWithPanesSearchPath:path] autorelease];
}
+ (id)preferences
{
return [[[SS_PrefsController alloc] init] autorelease];
}
- (id)init
{
return [self initWithPanesSearchPath:nil bundleExtension:nil];
}
- (id)initWithPanesSearchPath:(NSString*)path
{
return [self initWithPanesSearchPath:path bundleExtension:nil];
}
- (id)initWithBundleExtension:(NSString *)ext
{
return [self initWithPanesSearchPath:nil bundleExtension:ext];
}
// Designated initializer
- (id)initWithPanesSearchPath:(NSString*)path bundleExtension:(NSString *)ext
{
if (self = [super init]) {
[self setDebug:NO];
preferencePanes = [[NSMutableDictionary alloc] init];
panesOrder = [[NSMutableArray alloc] init];
[self setToolbarDisplayMode:NSToolbarDisplayModeIconAndLabel];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
[self setToolbarSizeMode:NSToolbarSizeModeDefault];
#endif
[self setUsesTexturedWindow:NO];
[self setAlwaysShowsToolbar:NO];
[self setAlwaysOpensCentered:YES];
if (!ext || [ext isEqualToString:@""]) {
bundleExtension = [[NSString alloc] initWithString:@"preferencePane"];
} else {
bundleExtension = [ext retain];
}
if (!path || [path isEqualToString:@""]) {
searchPath = [[NSString alloc] initWithString:[[NSBundle mainBundle] resourcePath]];
} else {
searchPath = [path retain];
}
// Read PreferencePanes
if (searchPath) {
NSEnumerator* enumerator = [[NSBundle pathsForResourcesOfType:bundleExtension inDirectory:searchPath] objectEnumerator];
NSString* panePath;
while ((panePath = [enumerator nextObject])) {
[self activatePane:panePath];
}
}
return self;
}
return nil;
}
- (void)dealloc
{
if (prefsWindow) {
[prefsWindow release];
}
if (prefsToolbar) {
[prefsToolbar release];
}
if (prefsToolbarItems) {
[prefsToolbarItems release];
}
if (preferencePanes) {
[preferencePanes release];
}
if (panesOrder) {
[panesOrder release];
}
if (bundleExtension) {
[bundleExtension release];
}
if (searchPath) {
[searchPath release];
}
[super dealloc];
}
// ************************************************
// Preferences methods
// ************************************************
- (void)showPreferencesWindow
{
[self createPreferencesWindowAndDisplay:YES];
}
- (void)createPreferencesWindow
{
[self createPreferencesWindowAndDisplay:YES];
}
- (void)createPreferencesWindowAndDisplay:(BOOL)shouldDisplay
{
if (prefsWindow) {
if (alwaysOpensCentered && ![prefsWindow isVisible]) {
[prefsWindow center];
}
[prefsWindow makeKeyAndOrderFront:nil];
return;
}
// Create prefs window
unsigned int styleMask = (NSClosableWindowMask | NSResizableWindowMask);
if (usesTexturedWindow) {
styleMask = (styleMask | NSTexturedBackgroundWindowMask);
}
prefsWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 350, 200)
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:NO];
[prefsWindow setReleasedWhenClosed:NO];
[prefsWindow setTitle:@"Preferences"]; // initial default title
[prefsWindow center];
[self createPrefsToolbar];
// Register defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (panesOrder && ([panesOrder count] > 0)) {
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
[defaultValues setObject:[panesOrder objectAtIndex:0] forKey:Last_Pane_Defaults_Key];
[defaults registerDefaults:defaultValues];
}
// Load last view
NSString *lastViewName = [defaults objectForKey:Last_Pane_Defaults_Key];
if ([panesOrder containsObject:lastViewName] && [self loadPrefsPaneNamed:lastViewName display:NO]) {
if (shouldDisplay) {
[prefsWindow makeKeyAndOrderFront:nil];
}
return;
}
[self debugLog:[NSString stringWithFormat:@"Could not load last-used preference pane \"%@\". Trying to load another pane instead.", lastViewName]];
// Try to load each prefpane in turn if loading the last-viewed one fails.
NSEnumerator* panes = [panesOrder objectEnumerator];
NSString *pane;
while (pane = [panes nextObject]) {
if (![pane isEqualToString:lastViewName]) {
if ([self loadPrefsPaneNamed:pane display:NO]) {
if (shouldDisplay) {
[prefsWindow makeKeyAndOrderFront:nil];
}
return;
}
}
}
[self debugLog:[NSString stringWithFormat:@"Could not load any valid preference panes. The preference pane bundle extension was \"%@\" and the search path was: %@", bundleExtension, searchPath]];
// Show alert dialog.
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
NSRunAlertPanel(@"Preferences",
[NSString stringWithFormat:@"Preferences are not available for %@.", appName],
@"OK",
nil,
nil);
[prefsWindow release];
prefsWindow = nil;
}
- (void)destroyPreferencesWindow
{
if (prefsWindow) {
[prefsWindow release];
}
prefsWindow = nil;
}
- (void)activatePane:(NSString*)path {
NSBundle* paneBundle = [NSBundle bundleWithPath:path];
if (paneBundle) {
NSDictionary* paneDict = [paneBundle infoDictionary];
NSString* paneName = [paneDict objectForKey:@"NSPrincipalClass"];
if (paneName) {
Class paneClass = NSClassFromString(paneName);
if (!paneClass) {
paneClass = [paneBundle principalClass];
if ([paneClass conformsToProtocol:@protocol(SS_PreferencePaneProtocol)] && [paneClass isKindOfClass:[NSObject class]]) {
NSArray *panes = [paneClass preferencePanes];
NSEnumerator *enumerator = [panes objectEnumerator];
id <SS_PreferencePaneProtocol> aPane;
while (aPane = [enumerator nextObject]) {
[panesOrder addObject:[aPane paneName]];
[preferencePanes setObject:aPane forKey:[aPane paneName]];
}
} else {
[self debugLog:[NSString stringWithFormat:@"Did not load bundle: %@ because its Principal Class is either not an NSObject subclass, or does not conform to the PreferencePane Protocol.", paneBundle]];
}
} else {
[self debugLog:[NSString stringWithFormat:@"Did not load bundle: %@ because its Principal Class was already used in another Preference pane.", paneBundle]];
}
} else {
[self debugLog:[NSString stringWithFormat:@"Could not obtain name of Principal Class for bundle: %@", paneBundle]];
}
} else {
[self debugLog:[NSString stringWithFormat:@"Could not initialize bundle: %@", paneBundle]];
}
}
- (BOOL)loadPreferencePaneNamed:(NSString *)name
{
return [self loadPrefsPaneNamed:(NSString *)name display:YES];
}
- (NSArray *)loadedPanes
{
if (preferencePanes) {
return [preferencePanes allKeys];
}
return nil;
}
- (BOOL)loadPrefsPaneNamed:(NSString *)name display:(BOOL)disp
{
if (!prefsWindow) {
NSBeep();
[self debugLog:[NSString stringWithFormat:@"Could not load \"%@\" preference pane because the Preferences window seems to no longer exist.", name]];
return NO;
}
id tempPane = nil;
tempPane = [preferencePanes objectForKey:name];
if (!tempPane) {
[self debugLog:[NSString stringWithFormat:@"Could not load preference pane \"%@\", because that pane does not exist.", name]];
return NO;
}
NSView *prefsView = nil;
prefsView = [tempPane paneView];
if (!prefsView) {
[self debugLog:[NSString stringWithFormat:@"Could not load \"%@\" preference pane because its view could not be loaded from the bundle.", name]];
return NO;
}
// Get rid of old view before resizing, for display purposes.
if (disp) {
NSView *tempView = [[NSView alloc] initWithFrame:[[prefsWindow contentView] frame]];
[prefsWindow setContentView:tempView];
[tempView release];
}
// Preserve upper left point of window during resize.
NSRect newFrame = [prefsWindow frame];
newFrame.size.height = [prefsView frame].size.height + ([prefsWindow frame].size.height - [[prefsWindow contentView] frame].size.height);
newFrame.size.width = [prefsView frame].size.width;
newFrame.origin.y += ([[prefsWindow contentView] frame].size.height - [prefsView frame].size.height);
id <SS_PreferencePaneProtocol> pane = [preferencePanes objectForKey:name];
[prefsWindow setShowsResizeIndicator:([pane allowsHorizontalResizing] || [pane allowsHorizontalResizing])];
[prefsWindow setFrame:newFrame display:disp animate:disp];
[prefsWindow setContentView:prefsView];
// Set appropriate resizing on window.
NSSize theSize = [prefsWindow frame].size;
theSize.height -= ToolbarHeightForWindow(prefsWindow);
[prefsWindow setMinSize:theSize];
BOOL canResize = NO;
if ([pane allowsHorizontalResizing]) {
theSize.width = FLT_MAX;
canResize = YES;
}
if ([pane allowsVerticalResizing]) {
theSize.height = FLT_MAX;
canResize = YES;
}
[prefsWindow setMaxSize:theSize];
[prefsWindow setShowsResizeIndicator:canResize];
if ((prefsToolbarItems && ([prefsToolbarItems count] > 1)) || alwaysShowsToolbar) {
[prefsWindow setTitle:[@"Preferences: " stringByAppendingString:name]];
}
// Update defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:name forKey:Last_Pane_Defaults_Key];
return YES;
}
- (void)debugLog:(NSString*)msg
{
if (debug) {
NSLog(@"[--- PREFERENCES DEBUG MESSAGE ---]\r%@\r\r", msg);
}
}
// ************************************************
// Prefs Toolbar methods
// ************************************************
float ToolbarHeightForWindow(NSWindow *window)
{
NSToolbar *toolbar;
float toolbarHeight = 0.0;
NSRect windowFrame;
toolbar = [window toolbar];
if(toolbar && [toolbar isVisible])
{
windowFrame = [NSWindow contentRectForFrameRect:[window frame]
styleMask:[window styleMask]];
toolbarHeight = NSHeight(windowFrame)
- NSHeight([[window contentView] frame]);
}
return toolbarHeight;
}
- (void)createPrefsToolbar
{
// Create toolbar items
prefsToolbarItems = [[NSMutableDictionary alloc] init];
NSEnumerator *itemEnumerator = [panesOrder objectEnumerator];
NSString *name;
NSImage *itemImage;
while (name = [itemEnumerator nextObject]) {
if ([preferencePanes objectForKey:name] != nil) {
NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:name];
[item setPaletteLabel:name]; // item's label in the "Customize Toolbar" sheet (not relevant here, but we set it anyway)
[item setLabel:name]; // item's label in the toolbar
NSString *tempTip = [[preferencePanes objectForKey:name] paneToolTip];
if (!tempTip || [tempTip isEqualToString:@""]) {
[item setToolTip:nil];
} else {
[item setToolTip:tempTip];
}
itemImage = [[preferencePanes objectForKey:name] paneIcon];
[item setImage:itemImage];
[item setTarget:self];
[item setAction:@selector(prefsToolbarItemClicked:)]; // action called when item is clicked
[prefsToolbarItems setObject:item forKey:name]; // add to items
[item release];
} else {
[self debugLog:[NSString stringWithFormat:@"Could not create toolbar item for preference pane \"%@\", because that pane does not exist.", name]];
}
}
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
prefsToolbar = [[NSToolbar alloc] initWithIdentifier:[bundleIdentifier stringByAppendingString:@"_Preferences_Toolbar_Identifier"]];
[prefsToolbar setDelegate:self];
[prefsToolbar setAllowsUserCustomization:NO];
[prefsToolbar setAutosavesConfiguration:NO];
[prefsToolbar setDisplayMode:toolbarDisplayMode];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
[prefsToolbar setSizeMode:toolbarSizeMode];
#endif
if ((prefsToolbarItems && ([prefsToolbarItems count] > 1)) || alwaysShowsToolbar) {
[prefsWindow setToolbar:prefsToolbar];
} else if (!alwaysShowsToolbar && prefsToolbarItems && ([prefsToolbarItems count] == 1)) {
[self debugLog:@"Not showing toolbar in Preferences window because there is only one preference pane loaded. You can override this behaviour using -[setAlwaysShowsToolbar:YES]."];
}
}
- (NSToolbarDisplayMode)toolbarDisplayMode
{
return toolbarDisplayMode;
}
- (void)setToolbarDisplayMode:(NSToolbarDisplayMode)displayMode
{
toolbarDisplayMode = displayMode;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
- (NSToolbarSizeMode)toolbarSizeMode
{
return toolbarSizeMode;
}
- (void)setToolbarSizeMode:(NSToolbarSizeMode)sizeMode
{
toolbarSizeMode = sizeMode;
}
#endif
- (void)prefsToolbarItemClicked:(NSToolbarItem*)item
{
if (![[item itemIdentifier] isEqualToString:[prefsWindow title]]) {
[self loadPrefsPaneNamed:[item itemIdentifier] display:YES];
}
}
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
{
return panesOrder;
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
{
return panesOrder;
}
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{
return [prefsToolbarItems objectForKey:itemIdentifier];
}
// ************************************************
// Accessors
// ************************************************
- (NSWindow *)preferencesWindow
{
return prefsWindow;
}
- (NSString *)bundleExtension
{
return bundleExtension;
}
- (NSString *)searchPath
{
return searchPath;
}
- (NSArray *)panesOrder
{
return panesOrder;
}
- (void)setPanesOrder:(NSArray *)newPanesOrder
{
[panesOrder removeAllObjects];
NSEnumerator *enumerator = [newPanesOrder objectEnumerator];
NSString *name;
while (name = [enumerator nextObject]) {
if ([preferencePanes objectForKey:name] != nil) {
[panesOrder addObject:name];
} else {
[self debugLog:[NSString stringWithFormat:@"Did not add preference pane \"%@\" to the toolbar ordering array, because that pane does not exist.", name]];
}
}
}
- (BOOL)debug
{
return debug;
}
- (void)setDebug:(BOOL)newDebug
{
debug = newDebug;
}
- (BOOL)usesTexturedWindow
{
return usesTexturedWindow;
}
- (void)setUsesTexturedWindow:(BOOL)newUsesTexturedWindow
{
usesTexturedWindow = newUsesTexturedWindow;
}
- (BOOL)alwaysShowsToolbar
{
return alwaysShowsToolbar;
}
- (void)setAlwaysShowsToolbar:(BOOL)newAlwaysShowsToolbar
{
alwaysShowsToolbar = newAlwaysShowsToolbar;
}
- (BOOL)alwaysOpensCentered
{
return alwaysOpensCentered;
}
- (void)setAlwaysOpensCentered:(BOOL)newAlwaysOpensCentered
{
alwaysOpensCentered = newAlwaysOpensCentered;
}
@end