[Hdrflow-svn] SF.net SVN: hdrflow: [222] trunk/app/HDRFlow
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-08-04 13:10:58
|
Revision: 222
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=222&view=rev
Author: glslang
Date: 2007-08-04 06:10:53 -0700 (Sat, 04 Aug 2007)
Log Message:
-----------
+ Preferences plugins filling of Outline view
Modified Paths:
--------------
trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib
trunk/app/HDRFlow/English.lproj/Preferences.nib/keyedobjects.nib
trunk/app/HDRFlow/PlugInsPreferencesController.h
trunk/app/HDRFlow/PlugInsPreferencesController.mm
trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.h
trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.mm
Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib
===================================================================
--- trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib 2007-08-03 21:29:44 UTC (rev 221)
+++ trunk/app/HDRFlow/English.lproj/Preferences.nib/info.nib 2007-08-04 13:10:53 UTC (rev 222)
@@ -17,10 +17,10 @@
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
- <integer>12</integer>
<integer>10</integer>
+ <integer>5</integer>
<integer>33</integer>
- <integer>5</integer>
+ <integer>12</integer>
</array>
<key>IBSystem Version</key>
<string>8R2218</string>
Modified: trunk/app/HDRFlow/English.lproj/Preferences.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/app/HDRFlow/PlugInsPreferencesController.h
===================================================================
--- trunk/app/HDRFlow/PlugInsPreferencesController.h 2007-08-03 21:29:44 UTC (rev 221)
+++ trunk/app/HDRFlow/PlugInsPreferencesController.h 2007-08-04 13:10:53 UTC (rev 222)
@@ -9,10 +9,11 @@
@interface PlugInsPreferencesController : NSObject
{
- NSMutableArray* rootItems;
+ NSMutableArray* plugIns;
PlugInsPreferencesOutlineViewNode* selectedItem;
}
-- ( void ) initRootItems;
+- ( void ) initPlugIns;
+- ( void ) initNodeMetadata: ( NSString* ) name library: ( NSString* ) library type: ( NSString* ) type;
@end
Modified: trunk/app/HDRFlow/PlugInsPreferencesController.mm
===================================================================
--- trunk/app/HDRFlow/PlugInsPreferencesController.mm 2007-08-03 21:29:44 UTC (rev 221)
+++ trunk/app/HDRFlow/PlugInsPreferencesController.mm 2007-08-04 13:10:53 UTC (rev 222)
@@ -5,34 +5,87 @@
// Released under the GPL.
// For more information, see http://www.cryogenicgraphics.com/hdrflow.
+#import <HDRFlow/openlibraries.hpp>
+
#import "PlugInsPreferencesController.h"
+namespace opl = olib::openpluginlib;
+
+namespace
+{
+ struct query_traits
+ {
+ explicit query_traits( const opl::wstring& libname, const opl::wstring& type )
+ : libname_( libname )
+ , type_( type )
+ { }
+
+ opl::wstring libname( ) const
+ { return libname_; }
+
+ opl::wstring to_match( ) const
+ { return L""; }
+
+ opl::wstring type( ) const
+ { return type_; }
+
+ int merit( ) const
+ { return 0; }
+
+ opl::wstring libname_;
+ opl::wstring type_;
+ };
+}
+
@implementation PlugInsPreferencesController
- ( id ) init
{
[ super init ];
- rootItems = [ [ NSMutableArray alloc ] init ];
- [ self initRootItems ];
- selectedItem = [ rootItems objectAtIndex: 0 ];
+ opl::init( );
+ plugIns = [ [ NSMutableArray alloc ] init ];
+
+ [ self initPlugIns ];
+ selectedItem = [ plugIns objectAtIndex: 0 ];
+
return self;
}
- ( void ) dealloc
{
- [ rootItems release ];
+ [ plugIns release ];
[ super dealloc ];
}
-- ( void ) initRootItems
+- ( void ) initPlugIns
{
- [ rootItems addObject: [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: @"All" ] ];
- [ rootItems addObject: [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: @"Image" ] ];
- [ rootItems addObject: [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: @"Media" ] ];
- [ rootItems addObject: [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: @"Effects" ] ];
- [ rootItems addObject: [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: @"OFX" ] ];
+ [ self initNodeMetadata: @"All" library: @"" type: @"" ];
+ [ self initNodeMetadata: @"Image" library: @"openimagelib" type: @"" ];
+ [ self initNodeMetadata: @"Media" library: @"openmedialib" type: @"" ];
+ [ self initNodeMetadata: @"Effects" library: @"openeffectslib" type: @"" ];
+ [ self initNodeMetadata: @"OFX" library: @"" type: @"ofx" ];
}
+- ( void ) initNodeMetadata: ( NSString* ) name library: ( NSString* ) library type: ( NSString* ) type
+{
+ typedef opl::discovery<query_traits> discovery;
+
+ discovery plugins( query_traits( opl::to_wstring( [ library UTF8String ] ), opl::to_wstring( [ type UTF8String ] ) ) );
+ if( !plugins.empty( ) )
+ {
+ PlugInsPreferencesOutlineViewNode* node = [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: name ];
+
+ for( discovery::const_iterator I = plugins.begin( ); I != plugins.end( ); ++I )
+ {
+ PlugInsPreferencesOutlineViewNode* child =
+ [ [ PlugInsPreferencesOutlineViewNode alloc ] initWithString: [ [ NSString alloc ] initWithUTF8String: opl::to_string( I->name( ) ).c_str( ) ] ];
+ [ node addChildObject: child ];
+ }
+
+ [ plugIns addObject: node ];
+ }
+}
+
@end
Modified: trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.h
===================================================================
--- trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.h 2007-08-03 21:29:44 UTC (rev 221)
+++ trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.h 2007-08-04 13:10:53 UTC (rev 222)
@@ -16,8 +16,9 @@
- ( id ) initWithString: ( NSString* ) name;
- ( void ) addChildObject: ( id ) childObject;
+- ( NSString* ) itemName;
+
- ( int ) numberOfChildren;
-- ( NSString* ) itemName;
- ( NSArray* ) children;
- ( BOOL ) isLeaf;
Modified: trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.mm
===================================================================
--- trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.mm 2007-08-03 21:29:44 UTC (rev 221)
+++ trunk/app/HDRFlow/PlugInsPreferencesOutlineViewNode.mm 2007-08-04 13:10:53 UTC (rev 222)
@@ -13,6 +13,7 @@
{
[ super init ];
children = [ [ NSMutableArray alloc ] init ];
+
itemName = [ [ NSString alloc ] initWithString: name ];
return self;
@@ -30,14 +31,16 @@
[ children addObject: childObject ];
}
-- ( int ) numberOfChildren
+- ( NSString* ) itemName
{
- return [ children count ];
+ return itemName;
}
-- ( NSString* ) itemName
+#pragma mark ---- NSTreeController and Bindings ----
+
+- ( int ) numberOfChildren
{
- return itemName;
+ return [ children count ];
}
- ( NSArray* ) children
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|