[Hdrflow-svn] SF.net SVN: hdrflow: [199] trunk/app/HDRFlow
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-07-22 16:48:53
|
Revision: 199
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=199&view=rev
Author: glslang
Date: 2007-07-22 09:48:49 -0700 (Sun, 22 Jul 2007)
Log Message:
-----------
+ Toolbar abstraction code
Modified Paths:
--------------
trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib
trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib
trunk/app/HDRFlow/English.lproj/Preferences.nib/classes.nib
trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib
trunk/app/HDRFlow/English.lproj/Preferences.nib/keyedobjects.nib
trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj
trunk/app/HDRFlow/PreferencesController.h
trunk/app/HDRFlow/PreferencesController.m
Added Paths:
-----------
trunk/app/HDRFlow/ToolbarHolder.h
trunk/app/HDRFlow/ToolbarHolder.m
Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib
===================================================================
--- trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-07-21 22:42:43 UTC (rev 198)
+++ trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-07-22 16:48:49 UTC (rev 199)
@@ -13,8 +13,8 @@
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
+ <integer>21</integer>
<integer>29</integer>
- <integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>8R2218</string>
Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/classes.nib
===================================================================
--- trunk/app/HDRFlow/English.lproj/Preferences.nib/classes.nib 2007-07-21 22:42:43 UTC (rev 198)
+++ trunk/app/HDRFlow/English.lproj/Preferences.nib/classes.nib 2007-07-22 16:48:49 UTC (rev 199)
@@ -2,6 +2,7 @@
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
+ ACTIONS = {toolbarItem = id; };
CLASS = PreferencesController;
LANGUAGE = ObjC;
OUTLETS = {generalView = NSView; };
Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib
===================================================================
--- trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib 2007-07-21 22:42:43 UTC (rev 198)
+++ trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib 2007-07-22 16:48:49 UTC (rev 199)
@@ -7,7 +7,7 @@
<key>IBEditorPositions</key>
<dict>
<key>10</key>
- <string>361 341 412 270 0 0 1440 878 </string>
+ <string>514 465 412 270 0 0 1440 878 </string>
</dict>
<key>IBFramework Version</key>
<string>446.1</string>
Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj
===================================================================
--- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-21 22:42:43 UTC (rev 198)
+++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-22 16:48:49 UTC (rev 199)
@@ -16,6 +16,7 @@
67A8A73E0C4183C500DB3F1B /* ScriptEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 67A8A73D0C4183C500DB3F1B /* ScriptEngine.cpp */; };
67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */; };
67C064EE0C52231A00E9ED8E /* Preferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 67C064EC0C52231A00E9ED8E /* Preferences.nib */; };
+ 67C3D3220C53A71000136EE8 /* ToolbarHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 67C3D3210C53A71000136EE8 /* ToolbarHolder.m */; };
67C8D8B80C4AD8340006B871 /* bootstrap.py in Resources */ = {isa = PBXBuildFile; fileRef = 67C8D8B70C4AD8340006B871 /* bootstrap.py */; };
67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */; };
67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */; };
@@ -48,6 +49,8 @@
67BD59C70C36BE3600F0F7DF /* HDRFlowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HDRFlowController.h; sourceTree = "<group>"; };
67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HDRFlowController.m; sourceTree = "<group>"; };
67C064ED0C52231A00E9ED8E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; };
+ 67C3D3170C5361C600136EE8 /* ToolbarHolder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ToolbarHolder.h; sourceTree = "<group>"; };
+ 67C3D3210C53A71000136EE8 /* ToolbarHolder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ToolbarHolder.m; sourceTree = "<group>"; };
67C8D8B70C4AD8340006B871 /* bootstrap.py */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.python; name = bootstrap.py; path = Scripts/bootstrap.py; sourceTree = "<group>"; };
67DC61B10C2EAB5E005CFE6E /* ViewportOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportOpenGLView.h; sourceTree = "<group>"; };
67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewportOpenGLView.m; sourceTree = "<group>"; };
@@ -86,6 +89,8 @@
673D044F0C522C980096513A /* PreferencesController.m */,
671E22910C41652E00CA1860 /* ScriptEditorController.h */,
671E22A20C4166E400CA1860 /* ScriptEditorController.mm */,
+ 67C3D3170C5361C600136EE8 /* ToolbarHolder.h */,
+ 67C3D3210C53A71000136EE8 /* ToolbarHolder.m */,
);
name = Classes;
sourceTree = "<group>";
@@ -245,6 +250,7 @@
671E22A30C4166E400CA1860 /* ScriptEditorController.mm in Sources */,
67A8A73E0C4183C500DB3F1B /* ScriptEngine.cpp in Sources */,
673D04500C522C980096513A /* PreferencesController.m in Sources */,
+ 67C3D3220C53A71000136EE8 /* ToolbarHolder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/app/HDRFlow/PreferencesController.h
===================================================================
--- trunk/app/HDRFlow/PreferencesController.h 2007-07-21 22:42:43 UTC (rev 198)
+++ trunk/app/HDRFlow/PreferencesController.h 2007-07-22 16:48:49 UTC (rev 199)
@@ -7,19 +7,17 @@
#import <Cocoa/Cocoa.h>
+// forward declarations
+@class ToolbarHolder;
+
@interface PreferencesController : NSWindowController
{
- NSMutableDictionary* items;
+ ToolbarHolder* toolbarHolder;
IBOutlet NSView* generalView;
}
-- ( NSToolbarItem* ) toolbar: ( NSToolbar* ) toolbar itemForItemIdentifier: ( NSString* ) itemIdentifier willBeInsertedIntoToolbar: ( BOOL ) flag;
-- ( NSArray* ) toolbarDefaultItemIdentifiers: ( NSToolbar* ) toolbar;
-- ( NSArray* ) toolbarAllowedItemIdentifiers: ( NSToolbar* ) toolbar;
-
-- ( void ) addToolbarItem: ( NSString* ) identifier label: ( NSString* ) label paletteLabel: ( NSString* ) paletteLabel tooltip: ( NSString* ) tooltip target: ( id ) target settingSelector: ( SEL ) settingSelector itemContent: ( id ) itemContent action: ( SEL ) action;
-- ( void ) toolbarItemAction: ( id ) sender;
+- ( IBAction ) toolbarItem: ( id ) sender;
- ( void ) setActiveView: ( NSView* ) view;
@end
Modified: trunk/app/HDRFlow/PreferencesController.m
===================================================================
--- trunk/app/HDRFlow/PreferencesController.m 2007-07-21 22:42:43 UTC (rev 198)
+++ trunk/app/HDRFlow/PreferencesController.m 2007-07-22 16:48:49 UTC (rev 199)
@@ -6,6 +6,7 @@
// For more information, see http://www.cryogenicgraphics.com/hdrflow.
#import "PreferencesController.h"
+#import "ToolbarHolder.h"
@implementation PreferencesController
@@ -16,81 +17,25 @@
- ( void ) awakeFromNib
{
- items = [ [ NSMutableDictionary dictionary ] retain ];
-
- NSToolbar* toolbar = [ [ [ NSToolbar alloc ] initWithIdentifier: @"HDRFlowPreferencesToolbar" ] autorelease ];
- [ toolbar setAllowsUserCustomization: YES ];
- [ toolbar setAutosavesConfiguration: YES ];
- [ toolbar setSizeMode: NSToolbarSizeModeDefault ];
- [ toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel ];
- [ toolbar setDelegate: self ];
+ toolbarHolder = [ [ ToolbarHolder alloc ] init: @"HDRFlowPreferencesToolbar" ];
- [ self addToolbarItem: @"General" label: @"General" paletteLabel: @"General" tooltip: @"Generic application configuration parameters" target: self settingSelector: @selector( setImage: ) itemContent: [ NSImage imageNamed: @"GeneralPreferences" ] action: @selector( toolbarItemAction: ) ];
+ [ toolbarHolder addToolbarItem: @"General" label: @"General" paletteLabel: @"General" tooltip: @"Generic application configuration parameters" target: self settingSelector: @selector( setImage: ) itemContent: [ NSImage imageNamed: @"GeneralPreferences" ] action: @selector( toolbarItem: ) ];
- [ [ self window ] setToolbar: toolbar ];
+ [ [ self window ] setToolbar: [ toolbarHolder toolbar ] ];
}
- ( void ) dealloc
{
- [ items release ];
+ [ toolbarHolder release ];
[ super dealloc ];
}
-#pragma mark ---- NSToolbar required delegate methods ----
-
-- ( NSToolbarItem* ) toolbar: ( NSToolbar* ) toolbar itemForItemIdentifier: ( NSString* ) itemIdentifier willBeInsertedIntoToolbar: ( BOOL ) flag
-{
- NSToolbarItem* cloneItem = [ [ [ NSToolbarItem alloc ] initWithItemIdentifier: itemIdentifier ] autorelease ];
- NSToolbarItem* originalItem = [ items objectForKey: itemIdentifier ];
-
- [ cloneItem setLabel: [ originalItem label ] ];
- [ cloneItem setPaletteLabel: [ originalItem paletteLabel ] ];
- [ cloneItem setToolTip: [ originalItem toolTip ] ];
- [ cloneItem setTarget: [ originalItem target ] ];
- [ cloneItem setAction: [ originalItem action ] ];
- if( [ originalItem view ] != nil )
- {
- [ cloneItem setView: [ originalItem view ] ];
- [ cloneItem setMinSize: [ [ originalItem view ] bounds ].size ];
- [ cloneItem setMaxSize: [ [ originalItem view ] bounds ].size ];
- }
- else
- {
- [ cloneItem setImage: [ originalItem image ] ];
- }
-
- return cloneItem;
-}
-
-- ( NSArray* ) toolbarDefaultItemIdentifiers: ( NSToolbar* ) toolbar
-{
- return [ NSArray arrayWithObjects: @"General", nil ];
-}
-
-- ( NSArray* ) toolbarAllowedItemIdentifiers: ( NSToolbar* ) toolbar
-{
- return [ NSArray arrayWithObjects: @"General", nil ];
-}
-
#pragma mark ---- Toolbar items ----
-- ( void ) addToolbarItem: ( NSString* ) identifier label: ( NSString* ) label paletteLabel: ( NSString* ) paletteLabel tooltip: ( NSString* ) tooltip target: ( id ) target settingSelector: ( SEL ) settingSelector itemContent: ( id ) itemContent action: ( SEL ) action
+- ( IBAction ) toolbarItem: ( id ) sender
{
- NSToolbarItem* item = [ [ [ NSToolbarItem alloc ] initWithItemIdentifier: identifier ] autorelease ];
- [ item setLabel: label ];
- [ item setPaletteLabel: paletteLabel ];
- [ item setToolTip: tooltip ];
- [ item setTarget: target ];
- [ item performSelector: settingSelector withObject: itemContent ];
- [ item setAction: action ];
-
- [ items setObject: item forKey: identifier ];
}
-- ( void ) toolbarItemAction: ( id ) sender
-{
-}
-
- ( void ) setActiveView: ( NSView* ) view
{
[ [ self window ] setContentView: view ];
Added: trunk/app/HDRFlow/ToolbarHolder.h
===================================================================
--- trunk/app/HDRFlow/ToolbarHolder.h (rev 0)
+++ trunk/app/HDRFlow/ToolbarHolder.h 2007-07-22 16:48:49 UTC (rev 199)
@@ -0,0 +1,25 @@
+
+// HDRFlow - A image processing application
+
+// Copyright (c) 2007 Goncalo N. M. de Carvalho
+// Released under the GPL.
+// For more information, see http://www.cryogenicgraphics.com/hdrflow.
+
+#import <Cocoa/Cocoa.h>
+
+@interface ToolbarHolder : NSObject
+{
+ NSMutableDictionary* items;
+ NSToolbar* toolbar;
+}
+
+- ( ToolbarHolder* ) init: ( NSString* ) identifier;
+- ( void ) addToolbarItem: ( NSString* ) identifier label: ( NSString* ) label paletteLabel: ( NSString* ) paletteLabel tooltip: ( NSString* ) tooltip target: ( id ) target settingSelector: ( SEL ) settingSelector itemContent: ( id ) itemContent action: ( SEL ) action;
+- ( NSToolbar* ) toolbar;
+- ( NSToolbarItem* ) itemForKey: ( NSString* ) itemIdentifier;
+
+- ( NSToolbarItem* ) toolbar: ( NSToolbar* ) toolbar itemForItemIdentifier: ( NSString* ) itemIdentifier willBeInsertedIntoToolbar: ( BOOL ) flag;
+- ( NSArray* ) toolbarDefaultItemIdentifiers: ( NSToolbar* ) toolbar;
+- ( NSArray* ) toolbarAllowedItemIdentifiers: ( NSToolbar* ) toolbar;
+
+@end
Added: trunk/app/HDRFlow/ToolbarHolder.m
===================================================================
--- trunk/app/HDRFlow/ToolbarHolder.m (rev 0)
+++ trunk/app/HDRFlow/ToolbarHolder.m 2007-07-22 16:48:49 UTC (rev 199)
@@ -0,0 +1,94 @@
+
+// HDRFlow - A image processing application
+
+// Copyright (c) 2007 Goncalo N. M. de Carvalho
+// Released under the GPL.
+// For more information, see http://www.cryogenicgraphics.com/hdrflow.
+
+#import "ToolbarHolder.h"
+
+@implementation ToolbarHolder
+
+- ( ToolbarHolder* ) init: ( NSString* ) identifier
+{
+ [ super init ];
+
+ items = [ [ NSMutableDictionary dictionary ] retain ];
+
+ toolbar = [ [ [ NSToolbar alloc ] initWithIdentifier: identifier ] retain ];
+ [ toolbar setAllowsUserCustomization: YES ];
+ [ toolbar setAutosavesConfiguration: YES ];
+ [ toolbar setSizeMode: NSToolbarSizeModeDefault ];
+ [ toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel ];
+ [ toolbar setDelegate: self ];
+
+ return self;
+}
+
+- ( void ) dealloc
+{
+ [ items release ];
+ [ toolbar release ];
+ [ super dealloc ];
+}
+
+- ( void ) addToolbarItem: ( NSString* ) identifier label: ( NSString* ) label paletteLabel: ( NSString* ) paletteLabel tooltip: ( NSString* ) tooltip target: ( id ) target settingSelector: ( SEL ) settingSelector itemContent: ( id ) itemContent action: ( SEL ) action
+{
+ NSToolbarItem* item = [ [ [ NSToolbarItem alloc ] initWithItemIdentifier: identifier ] autorelease ];
+ [ item setLabel: label ];
+ [ item setPaletteLabel: paletteLabel ];
+ [ item setToolTip: tooltip ];
+ [ item setTarget: target ];
+ [ item performSelector: settingSelector withObject: itemContent ];
+ [ item setAction: action ];
+
+ [ items setObject: item forKey: identifier ];
+}
+
+- ( NSToolbar* ) toolbar
+{
+ return toolbar;
+}
+
+- ( NSToolbarItem* ) itemForKey: ( NSString* ) itemIdentifier
+{
+ return [ items objectForKey: itemIdentifier ];
+}
+
+#pragma mark ---- NSToolbar required delegate methods ----
+
+- ( NSToolbarItem* ) toolbar: ( NSToolbar* ) toolbar itemForItemIdentifier: ( NSString* ) itemIdentifier willBeInsertedIntoToolbar: ( BOOL ) flag
+{
+ NSToolbarItem* cloneItem = [ [ [ NSToolbarItem alloc ] initWithItemIdentifier: itemIdentifier ] autorelease ];
+ NSToolbarItem* originalItem = [ items objectForKey: itemIdentifier ];
+
+ [ cloneItem setLabel: [ originalItem label ] ];
+ [ cloneItem setPaletteLabel: [ originalItem paletteLabel ] ];
+ [ cloneItem setToolTip: [ originalItem toolTip ] ];
+ [ cloneItem setTarget: [ originalItem target ] ];
+ [ cloneItem setAction: [ originalItem action ] ];
+ if( [ originalItem view ] != nil )
+ {
+ [ cloneItem setView: [ originalItem view ] ];
+ [ cloneItem setMinSize: [ [ originalItem view ] bounds ].size ];
+ [ cloneItem setMaxSize: [ [ originalItem view ] bounds ].size ];
+ }
+ else
+ {
+ [ cloneItem setImage: [ originalItem image ] ];
+ }
+
+ return cloneItem;
+}
+
+- ( NSArray* ) toolbarDefaultItemIdentifiers: ( NSToolbar* ) toolbar
+{
+ return [ NSArray arrayWithObjects: @"General", nil ];
+}
+
+- ( NSArray* ) toolbarAllowedItemIdentifiers: ( NSToolbar* ) toolbar
+{
+ return [ NSArray arrayWithObjects: @"General", nil ];
+}
+
+@end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|