hdrflow-svn Mailing List for HDRFlow (Page 12)
Status: Pre-Alpha
Brought to you by:
glslang
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
(30) |
May
(38) |
Jun
(22) |
Jul
(53) |
Aug
(66) |
Sep
(56) |
Oct
(29) |
Nov
(13) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(16) |
Feb
(22) |
Mar
(12) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gl...@us...> - 2007-07-15 18:44:51
|
Revision: 187 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=187&view=rev Author: glslang Date: 2007-07-15 11:44:50 -0700 (Sun, 15 Jul 2007) Log Message: ----------- + Python modules within HDRFlow framework Modified Paths: -------------- trunk/app/HDRFlow/ScriptEditorController.mm trunk/app/HDRFlow/ScriptEngine.cpp trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am trunk/unity.sh Modified: trunk/app/HDRFlow/ScriptEditorController.mm =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-15 18:34:09 UTC (rev 186) +++ trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-15 18:44:50 UTC (rev 187) @@ -38,7 +38,7 @@ - ( void ) executeScript { NSString* script = [ scriptEdit_ string ]; - NSString* output = [ scriptOutput_ string ]; + NSString* output = [ [ [ NSString alloc ] initWithString: @"" ] autorelease ]; if( engine_->eval( [ script UTF8String ] ) ) { @@ -54,6 +54,7 @@ NSString* out = [ [ [ NSString alloc ] initWithUTF8String: engine_->result( ).c_str( ) ] autorelease ]; output = [ output stringByAppendingString: out ]; + output = [ output stringByAppendingString: @"\n" ]; [ scriptOutput_ setString: output ]; [ scriptOutput_ setNeedsDisplay: YES ]; Modified: trunk/app/HDRFlow/ScriptEngine.cpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-15 18:34:09 UTC (rev 186) +++ trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-15 18:44:50 UTC (rev 187) @@ -18,8 +18,10 @@ { if( obj ) { - py::extract<std::string> extract( obj ); - if( extract.check( ) ) return extract( ); + py::object strobj( py::handle<>( PyObject_Str( obj ) ) ); + py::extract<std::string> extract( strobj ); + if( extract.check( ) ) + return extract( ); } return pl::string( ); @@ -46,16 +48,20 @@ try { py::handle<> handle; - if( !( handle = py::handle<>( - py::allow_null( PyRun_String( str.c_str( ), Py_eval_input, main_namespace.ptr( ), main_namespace.ptr( ) ) ) ) ) ) + if( !( handle = + py::handle<>( py::allow_null( PyRun_String( str.c_str( ), Py_eval_input, main_namespace.ptr( ), main_namespace.ptr( ) ) ) ) ) ) { + // clear all errors so the call below has a chance to succeed. PyErr_Clear( ); handle = py::handle<>( PyRun_String( str.c_str( ), Py_file_input, main_namespace.ptr( ), main_namespace.ptr( ) ) ); } py::object strobj( py::handle<>( PyObject_Str( py::object( handle ).ptr( ) ) ) ); if( strobj ) - result_ = PyString_AsString( strobj.ptr( ) ) + pl::string( "\n" ); + { + result_ = PyString_AsString( strobj.ptr( ) ); + if( result_ == "None" ) result_.clear( ); + } } catch( py::error_already_set ) { @@ -64,12 +70,18 @@ PyObject* error_traceback; PyErr_Fetch( &error_type, &error_data, &error_traceback ); - + result_ += error_to_result( error_type ); result_ += error_to_result( error_data ); - result_ += error_to_result( error_traceback ); - result_ += "\n"; + result_ += error_to_result( error_traceback ); + + if( result_.empty( ) ) + result_ = "<no info available>"; + Py_XDECREF( error_type ); + Py_XDECREF( error_data ); + Py_XDECREF( error_traceback ); + return false; } Modified: trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am 2007-07-15 18:34:09 UTC (rev 186) +++ trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am 2007-07-15 18:44:50 UTC (rev 187) @@ -81,6 +81,7 @@ $(BOOST_FILESYSTEM_LIBS) \ $(BOOST_REGEX_LIBS) \ $(BOOST_THREAD_LIBS) \ + $(BOOST_IOSTREAMS_LIBS) \ $(GLEW_LIBS) \ $(XML2_LIBS) \ $(OFX_LIBS) Modified: trunk/unity.sh =================================================================== --- trunk/unity.sh 2007-07-15 18:34:09 UTC (rev 186) +++ trunk/unity.sh 2007-07-15 18:44:50 UTC (rev 187) @@ -32,12 +32,13 @@ build_frameworks=0 build_umbrella=0 build_installer=0 +build_application=0 framework_version="A" install_name_prefix="/Library/Frameworks" output_directory="." -while getopts "v:b:efi:o:x:up" option +while getopts "v:b:efi:o:x:upa" option do case $option in e ) update_boost_version=1;; @@ -49,6 +50,7 @@ i ) install_name_prefix="$OPTARG";; u ) build_umbrella=1;; p ) build_installer=1;; + a ) build_application=1;; esac done @@ -105,9 +107,23 @@ cp $i $1.framework/Versions/Current/$1 && install_name_tool -id $install_name_prefix/$1.framework/Versions/$framework_version/$1 $1.framework/$1 fi - done + done } +make_framework_python_libs( ) +{ + if [ -d $2 ] + then + libs=`ls $2/.libs/*.?.dylib` + for i in $libs + do if [ ! -L $i ] + then cp $i $1.framework/Versions/$framework_version/PlugIns/$1.so && + install_name_tool -id $install_name_prefix/$1.framework/Versions/$framework_version/$1 $1.framework/$1 + fi + done + fi +} + make_framework_deps( ) { deplist="GLEW boost" @@ -247,51 +263,60 @@ make_framework_dir $1 && make_framework_headers $2 $1 && make_framework_libs $1 $2 && - make_framework_resources $1 $2 - make_framework_deps $1 - make_framework_plugins $2 $1 - make_framework_plugins_deps $1 - make_framework_interdeps $1 + make_framework_python_libs $1 "$2/../py" && + make_framework_resources $1 $2 && + make_framework_deps $1 && + make_framework_plugins $2 $1 && + make_framework_interdeps $1 && + make_framework_plugins_deps $1 && make_framework_libs_deps $1 } -make_umbrella_framework( ) +make_umbrella_framework_deps( ) { - rm -rf "./HDRFlow.framework" - make_framework "HDRFlow" "./lib/openlibraries/src/umbrella_framework" - - framework_dir="$output_directory/HDRFlow.framework" - mkdir -p "$framework_dir/Versions/$framework_version/Frameworks" - ln -sf "Versions/Current/Frameworks" "$framework_dir/Frameworks" - - cp -R "./HDRFlowPlugin.framework" "$framework_dir/Versions/$framework_version/Frameworks" - cp -R "./HDRFlowImage.framework" "$framework_dir/Versions/$framework_version/Frameworks" - cp -R "./HDRFlowMedia.framework" "$framework_dir/Versions/$framework_version/Frameworks" - deplist="openpluginlib_pl openimagelib_il openmedialib_ml" for i in $deplist - do depname=`otool -L HDRFlow.framework/HDRFlow | grep $i | cut -d ' ' -f 1` + do depname=`otool -L $1 | grep $i | cut -d ' ' -f 1` if [ ! -z $depname ] then case $i in openpluginlib_pl ) install_name_tool -change $depname \ "$install_name_prefix"/HDRFlow.framework/Versions/$framework_version/Frameworks/HDRFlowPlugin.framework/Versions/$framework_version/HDRFlowPlugin \ - ./HDRFlow.framework/Versions/$framework_version/HDRFlow + $1 ;; openimagelib_il ) install_name_tool -change $depname \ "$install_name_prefix"/HDRFlow.framework/Versions/$framework_version/Frameworks/HDRFlowImage.framework/Versions/$framework_version/HDRFlowImage \ - ./HDRFlow.framework/Versions/$framework_version/HDRFlow + $1 ;; openmedialib_ml ) install_name_tool -change $depname \ "$install_name_prefix"/HDRFlow.framework/Versions/$framework_version/Frameworks/HDRFlowMedia.framework/Versions/$framework_version/HDRFlowMedia \ - ./HDRFlow.framework/Versions/$framework_version/HDRFlow + $1 ;; esac fi done +} + +make_umbrella_framework( ) +{ + rm -rf "./HDRFlow.framework" + make_framework "HDRFlow" "./lib/openlibraries/src/umbrella_framework" + framework_dir="$output_directory/HDRFlow.framework" + mkdir -p "$framework_dir/Versions/$framework_version/Frameworks" + ln -sf "Versions/Current/Frameworks" "$framework_dir/Frameworks" + + cp -R "./HDRFlowPlugin.framework" "$framework_dir/Versions/$framework_version/Frameworks" + cp -R "./HDRFlowImage.framework" "$framework_dir/Versions/$framework_version/Frameworks" + cp -R "./HDRFlowMedia.framework" "$framework_dir/Versions/$framework_version/Frameworks" + + make_umbrella_framework_deps "HDRFlow.framework/HDRFlow" + make_umbrella_framework_deps "HDRFlow.framework/Frameworks/HDRFlowPlugin.framework/PlugIns/HDRFlowPlugin.so" + make_umbrella_framework_deps "HDRFlow.framework/Frameworks/HDRFlowImage.framework/PlugIns/HDRFlowImage.so" + make_umbrella_framework_deps "HDRFlow.framework/Frameworks/HDRFlowMedia.framework/PlugIns/HDRFlowMedia.so" + deplist="GLEW boost" for i in $deplist do fmwklist="HDRFlowPlugin HDRFlowImage HDRFlowMedia" @@ -301,8 +326,17 @@ do base=`basename $k` install_name_tool -change $k \ $install_name_prefix/HDRFlow.framework/Versions/$framework_version/Libraries/$base \ - HDRFlow.framework/Versions/$framework_version/Frameworks/$j.framework/$j + HDRFlow.framework/Versions/$framework_version/Frameworks/$j.framework/$j done + + # Python modules + depname=`otool -L HDRFlow.framework/Frameworks/$j.framework/PlugIns/$j.so | grep $i | cut -d ' ' -f 1` + for k in $depname + do base=`basename $k` + install_name_tool -change $k \ + $install_name_prefix/HDRFlow.framework/Versions/$framework_version/Libraries/$base \ + HDRFlow.framework/Versions/$framework_version/Frameworks/$j.framework/PlugIns/$j.so + done done done @@ -362,9 +396,12 @@ check_status $? fi - echo -n " HDRFlow application..." - make_app - check_status $? + if [ "$build_application" -eq 1 ] + then + echo -n " HDRFlow application..." + make_app + check_status $? + fi if [ "$build_installer" -eq 1 ] then echo " Building packages..." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-15 18:34:11
|
Revision: 186 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=186&view=rev Author: glslang Date: 2007-07-15 11:34:09 -0700 (Sun, 15 Jul 2007) Log Message: ----------- + change python modules name Modified Paths: -------------- trunk/lib/openlibraries/src/openimagelib/py/py.cpp trunk/lib/openlibraries/src/openmedialib/py/py.cpp Modified: trunk/lib/openlibraries/src/openimagelib/py/py.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/py/py.cpp 2007-07-15 16:42:55 UTC (rev 185) +++ trunk/lib/openlibraries/src/openimagelib/py/py.cpp 2007-07-15 18:34:09 UTC (rev 186) @@ -10,7 +10,7 @@ namespace il = olib::openimagelib::il; -BOOST_PYTHON_MODULE( openimagelib ) +BOOST_PYTHON_MODULE( HDRFlowImage ) { il::detail::py_basic_image( ); il::detail::py_utility( ); Modified: trunk/lib/openlibraries/src/openmedialib/py/py.cpp =================================================================== --- trunk/lib/openlibraries/src/openmedialib/py/py.cpp 2007-07-15 16:42:55 UTC (rev 185) +++ trunk/lib/openlibraries/src/openmedialib/py/py.cpp 2007-07-15 18:34:09 UTC (rev 186) @@ -9,7 +9,7 @@ namespace ml = olib::openmedialib::ml; -BOOST_PYTHON_MODULE( openmedialib ) +BOOST_PYTHON_MODULE( HDRFlowMedia ) { ml::detail::py_audio( ); ml::detail::py_audio_reseat( ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-15 16:42:57
|
Revision: 185 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=185&view=rev Author: glslang Date: 2007-07-15 09:42:55 -0700 (Sun, 15 Jul 2007) Log Message: ----------- + python module name change Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/py/py.cpp Modified: trunk/lib/openlibraries/src/openpluginlib/py/py.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/py/py.cpp 2007-07-14 23:36:02 UTC (rev 184) +++ trunk/lib/openlibraries/src/openpluginlib/py/py.cpp 2007-07-15 16:42:55 UTC (rev 185) @@ -16,7 +16,7 @@ namespace opl = olib::openpluginlib; -BOOST_PYTHON_MODULE( openpluginlib ) +BOOST_PYTHON_MODULE( HDRFlowPlugin ) { opl::detail::py_geometry( ); opl::detail::py_single_property( ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-14 23:36:27
|
Revision: 184 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=184&view=rev Author: glslang Date: 2007-07-14 16:36:02 -0700 (Sat, 14 Jul 2007) Log Message: ----------- +Python interpreter initial implementation Modified Paths: -------------- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib trunk/app/HDRFlow/ScriptEditorController.h trunk/app/HDRFlow/ScriptEditorController.mm trunk/app/HDRFlow/ScriptEngine.cpp trunk/app/HDRFlow/ScriptEngine.hpp trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-12 22:11:47 UTC (rev 183) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-14 23:36:02 UTC (rev 184) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>69 49 356 240 0 0 1280 778 </string> + <string>81 58 356 240 0 0 1440 878 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/app/HDRFlow/ScriptEditorController.h =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.h 2007-07-12 22:11:47 UTC (rev 183) +++ trunk/app/HDRFlow/ScriptEditorController.h 2007-07-14 23:36:02 UTC (rev 184) @@ -7,13 +7,21 @@ #import <Cocoa/Cocoa.h> +// forward declaration +namespace hdrflow { class ScriptEngine; } + @interface ScriptEditorController : NSWindowController { IBOutlet NSTextView* scriptEdit_; IBOutlet NSTextView* scriptOutput_; IBOutlet NSTextField* scriptStatus_; + + hdrflow::ScriptEngine* engine_; } +- ( void ) executeScript; +- ( void ) clearScript; + - ( IBAction ) executeScript: ( id ) sender; - ( IBAction ) clearScript: ( id ) sender; Modified: trunk/app/HDRFlow/ScriptEditorController.mm =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-12 22:11:47 UTC (rev 183) +++ trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-14 23:36:02 UTC (rev 184) @@ -7,16 +7,64 @@ #import "ScriptEditorController.h" +#import "ScriptEngine.hpp" + @implementation ScriptEditorController +#pragma mark ---- IB actions ---- + - ( IBAction ) executeScript: ( id ) sender { + [ self executeScript ]; } - ( IBAction ) clearScript: ( id ) sender { - [ scriptEdit_ setString: @""]; - [ scriptEdit_ setNeedsDisplay: YES]; + [ self clearScript ]; } +- ( id ) initWithWindowNibName: ( NSString* ) windowNibName +{ + engine_ = new hdrflow::ScriptEngine( ); + return [ super initWithWindowNibName: windowNibName ]; +} + +- ( void ) dealloc +{ + delete engine_; + [ super dealloc ]; +} + +- ( void ) executeScript +{ + NSString* script = [ scriptEdit_ string ]; + NSString* output = [ scriptOutput_ string ]; + + if( engine_->eval( [ script UTF8String ] ) ) + { + output = [ output stringByAppendingString: script ]; + output = [ output stringByAppendingString: @"\n" ]; + [ scriptStatus_ setStringValue: @"Script successful." ]; + } + else + { + output = [ output stringByAppendingString: @"Error in script:\n\t" ]; + [ scriptStatus_ setStringValue: @"Script failed." ]; + } + + NSString* out = [ [ [ NSString alloc ] initWithUTF8String: engine_->result( ).c_str( ) ] autorelease ]; + output = [ output stringByAppendingString: out ]; + + [ scriptOutput_ setString: output ]; + [ scriptOutput_ setNeedsDisplay: YES ]; + + [ self clearScript ]; +} + +- ( void ) clearScript +{ + [ scriptEdit_ setString: @"" ]; + [ scriptEdit_ setNeedsDisplay: YES ]; +} + @end Modified: trunk/app/HDRFlow/ScriptEngine.cpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-12 22:11:47 UTC (rev 183) +++ trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-14 23:36:02 UTC (rev 184) @@ -8,14 +8,27 @@ #include "ScriptEngine.hpp" namespace py = boost::python; +namespace pl = olib::openpluginlib; namespace hdrflow { +namespace +{ + pl::string error_to_result( PyObject* obj ) + { + if( obj ) + { + py::extract<std::string> extract( obj ); + if( extract.check( ) ) return extract( ); + } + + return pl::string( ); + } +} + ScriptEngine::ScriptEngine( ) { Py_Initialize( ); - - main_module_ = py::object( py::handle<>( py::borrowed( PyImport_AddModule( "__main__" ) ) ) ); } ScriptEngine::~ScriptEngine( ) @@ -23,9 +36,49 @@ Py_Finalize( ); } -bool ScriptEngine::eval( ) +bool ScriptEngine::eval( const pl::string& str ) { - return false; + py::object main_module( py::handle<>( py::borrowed( PyImport_AddModule( "__main__" ) ) ) ); + py::object main_namespace = main_module.attr( "__dict__" ); + + result_.clear( ); + + try + { + py::handle<> handle; + if( !( handle = py::handle<>( + py::allow_null( PyRun_String( str.c_str( ), Py_eval_input, main_namespace.ptr( ), main_namespace.ptr( ) ) ) ) ) ) + { + PyErr_Clear( ); + handle = py::handle<>( PyRun_String( str.c_str( ), Py_file_input, main_namespace.ptr( ), main_namespace.ptr( ) ) ); + } + + py::object strobj( py::handle<>( PyObject_Str( py::object( handle ).ptr( ) ) ) ); + if( strobj ) + result_ = PyString_AsString( strobj.ptr( ) ) + pl::string( "\n" ); + } + catch( py::error_already_set ) + { + PyObject* error_type; + PyObject* error_data; + PyObject* error_traceback; + + PyErr_Fetch( &error_type, &error_data, &error_traceback ); + + result_ += error_to_result( error_type ); + result_ += error_to_result( error_data ); + result_ += error_to_result( error_traceback ); + result_ += "\n"; + + return false; + } + + return true; } +pl::string ScriptEngine::result( ) const +{ + return result_; } + +} Modified: trunk/app/HDRFlow/ScriptEngine.hpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.hpp 2007-07-12 22:11:47 UTC (rev 183) +++ trunk/app/HDRFlow/ScriptEngine.hpp 2007-07-14 23:36:02 UTC (rev 184) @@ -18,10 +18,11 @@ explicit ScriptEngine( ); ~ScriptEngine( ); - bool eval( ); + bool eval( const olib::openpluginlib::string& str ); + olib::openpluginlib::string result( ) const; private: - boost::python::object main_module_; + olib::openpluginlib::string result_; }; } Modified: trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp =================================================================== --- trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp 2007-07-12 22:11:47 UTC (rev 183) +++ trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp 2007-07-14 23:36:02 UTC (rev 184) @@ -8,7 +8,9 @@ #ifndef OPENLIBRARIES_INC_ #define OPENLIBRARIES_INC_ +#ifndef __OBJC__ #include <boost/python.hpp> +#endif #include <openpluginlib/pl/openpluginlib.hpp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-12 22:11:49
|
Revision: 183 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=183&view=rev Author: glslang Date: 2007-07-12 15:11:47 -0700 (Thu, 12 Jul 2007) Log Message: ----------- +olibs integration Modified Paths: -------------- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj trunk/app/HDRFlow/ScriptEngine.cpp trunk/app/HDRFlow/ScriptEngine.hpp trunk/lib/openlibraries/src/umbrella_framework/Makefile.am trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp trunk/unity.sh Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj =================================================================== --- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-11 20:39:38 UTC (rev 182) +++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-12 22:11:47 UTC (rev 183) @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 67032E9E0C46DB9C00FA55E2 /* HDRFlow.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67032E9D0C46DB9C00FA55E2 /* HDRFlow.framework */; }; 671E22A30C4166E400CA1860 /* ScriptEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */; }; 674E44640C3F854A0036A908 /* ScriptEditor.nib in Resources */ = {isa = PBXBuildFile; fileRef = 674E44620C3F854A0036A908 /* ScriptEditor.nib */; }; 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */; }; @@ -30,6 +31,7 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 32CA4F630368D1EE00C91783 /* HDRFlow_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDRFlow_Prefix.pch; sourceTree = "<group>"; }; + 67032E9D0C46DB9C00FA55E2 /* HDRFlow.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HDRFlow.framework; path = /Library/Frameworks/HDRFlow.framework; sourceTree = "<absolute>"; }; 671E22910C41652E00CA1860 /* ScriptEditorController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ScriptEditorController.h; sourceTree = "<group>"; }; 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ScriptEditorController.mm; sourceTree = "<group>"; }; 674E44630C3F854A0036A908 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/ScriptEditor.nib; sourceTree = "<group>"; }; @@ -55,6 +57,7 @@ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */, 67A8A6EA0C41836600DB3F1B /* Python.framework in Frameworks */, + 67032E9E0C46DB9C00FA55E2 /* HDRFlow.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -79,6 +82,7 @@ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( + 67032E9D0C46DB9C00FA55E2 /* HDRFlow.framework */, 67A8A6E90C41836600DB3F1B /* Python.framework */, 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */, 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, @@ -277,6 +281,10 @@ buildSettings = { GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /usr/include/python2.3, + ); PREBINDING = NO; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; @@ -287,6 +295,10 @@ buildSettings = { GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /usr/include/python2.3, + ); PREBINDING = NO; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; Modified: trunk/app/HDRFlow/ScriptEngine.cpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-11 20:39:38 UTC (rev 182) +++ trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-12 22:11:47 UTC (rev 183) @@ -7,11 +7,15 @@ #include "ScriptEngine.hpp" +namespace py = boost::python; + namespace hdrflow { ScriptEngine::ScriptEngine( ) { Py_Initialize( ); + + main_module_ = py::object( py::handle<>( py::borrowed( PyImport_AddModule( "__main__" ) ) ) ); } ScriptEngine::~ScriptEngine( ) Modified: trunk/app/HDRFlow/ScriptEngine.hpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.hpp 2007-07-11 20:39:38 UTC (rev 182) +++ trunk/app/HDRFlow/ScriptEngine.hpp 2007-07-12 22:11:47 UTC (rev 183) @@ -8,7 +8,7 @@ #ifndef SCRIPT_ENGINE_INC_ #define SCRIPT_ENGINE_INC_ -#include <Python/python.h> +#include <HDRFlow/openlibraries.hpp> namespace hdrflow { @@ -21,6 +21,7 @@ bool eval( ); private: + boost::python::object main_module_; }; } Modified: trunk/lib/openlibraries/src/umbrella_framework/Makefile.am =================================================================== --- trunk/lib/openlibraries/src/umbrella_framework/Makefile.am 2007-07-11 20:39:38 UTC (rev 182) +++ trunk/lib/openlibraries/src/umbrella_framework/Makefile.am 2007-07-12 22:11:47 UTC (rev 183) @@ -11,14 +11,18 @@ openlibraries.cpp \ openlibraries.hpp -libumbrella_framework_la_CXXFLAGS = \ - $(OLIB_CXXFLAGS) \ - $(BOOST_INCLUDE_PATH) +libumbrella_framework_la_CXXFLAGS = \ + $(OLIB_CXXFLAGS) \ + $(BOOST_INCLUDE_PATH) \ + $(GLEW_INCLUDE_PATH) \ + $(PYTHON_INCLUDE_PATH) libumbrella_framework_la_LIBADD = \ $(top_builddir)/src/openpluginlib/pl/libopenpluginlib_pl.la \ - $(top_builddir)/src/openimagelib/il/libopenimagelib_il.la \ - $(top_builddir)/src/openmedialib/ml/libopenmedialib_ml.la + $(top_builddir)/src/openimagelib/il/libopenimagelib_il.la \ + $(top_builddir)/src/openmedialib/ml/libopenmedialib_ml.la \ + $(BOOST_PYTHON_LIBS) \ + $(GLEW_LIBS) libumbrella_framework_la_LDFLAGS = \ $(OLIB_LDFLAGS) \ Modified: trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp =================================================================== --- trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp 2007-07-11 20:39:38 UTC (rev 182) +++ trunk/lib/openlibraries/src/umbrella_framework/openlibraries.hpp 2007-07-12 22:11:47 UTC (rev 183) @@ -8,6 +8,8 @@ #ifndef OPENLIBRARIES_INC_ #define OPENLIBRARIES_INC_ +#include <boost/python.hpp> + #include <openpluginlib/pl/openpluginlib.hpp> #endif Modified: trunk/unity.sh =================================================================== --- trunk/unity.sh 2007-07-11 20:39:38 UTC (rev 182) +++ trunk/unity.sh 2007-07-12 22:11:47 UTC (rev 183) @@ -323,7 +323,7 @@ done # Copy Boost headers - cp -R /usr/local/include/boost-1_35/boost HDRFlow.framework/Versions/$framework_version/Frameworks/HDRFlowPlugin.framework/Headers + cp -R /usr/local/include/boost-$boost_new_version/boost HDRFlow.framework/Versions/$framework_version/Frameworks/HDRFlowPlugin.framework/Headers header_prefix="HDRFlow.framework/Versions/$framework_version/Frameworks/HDRFlowPlugin.framework/Headers/boost" find $header_prefix -name '*.hpp' | xargs sed -e "s|boost/|HDRFlowPlugin/boost/|g" -i '' } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-11 20:40:18
|
Revision: 182 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=182&view=rev Author: glslang Date: 2007-07-11 13:39:38 -0700 (Wed, 11 Jul 2007) Log Message: ----------- +more UI hookups Modified Paths: -------------- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib trunk/app/HDRFlow/ScriptEditorController.h Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-10 22:43:33 UTC (rev 181) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-11 20:39:38 UTC (rev 182) @@ -5,7 +5,11 @@ ACTIONS = {clearScript = id; executeScript = id; }; CLASS = ScriptEditorController; LANGUAGE = ObjC; - OUTLETS = {"scriptEdit_" = id; }; + OUTLETS = { + "scriptEdit_" = NSTextView; + "scriptOutput_" = NSTextView; + "scriptStatus_" = NSTextField; + }; SUPERCLASS = NSWindowController; } ); Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-10 22:43:33 UTC (rev 181) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-11 20:39:38 UTC (rev 182) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>81 58 356 240 0 0 1440 878 </string> + <string>69 49 356 240 0 0 1280 778 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/app/HDRFlow/ScriptEditorController.h =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.h 2007-07-10 22:43:33 UTC (rev 181) +++ trunk/app/HDRFlow/ScriptEditorController.h 2007-07-11 20:39:38 UTC (rev 182) @@ -10,6 +10,8 @@ @interface ScriptEditorController : NSWindowController { IBOutlet NSTextView* scriptEdit_; + IBOutlet NSTextView* scriptOutput_; + IBOutlet NSTextField* scriptStatus_; } - ( IBAction ) executeScript: ( id ) sender; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-10 22:43:41
|
Revision: 181 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=181&view=rev Author: glslang Date: 2007-07-10 15:43:33 -0700 (Tue, 10 Jul 2007) Log Message: ----------- + eol-style to native Property Changed: ---------------- trunk/app/HDRFlow/CustomOpenGLView.h trunk/app/HDRFlow/CustomOpenGLView.m trunk/app/HDRFlow/HDRFlowController.h trunk/app/HDRFlow/HDRFlowController.m trunk/app/HDRFlow/HDRFlow_Prefix.pch trunk/app/HDRFlow/Info.plist trunk/app/HDRFlow/ScriptEditorController.h trunk/app/HDRFlow/ScriptEditorController.mm trunk/app/HDRFlow/ScriptEngine.cpp trunk/app/HDRFlow/ScriptEngine.hpp trunk/app/HDRFlow/ViewportOpenGLView.h trunk/app/HDRFlow/ViewportOpenGLView.m trunk/app/HDRFlow/main.m Property changes on: trunk/app/HDRFlow/CustomOpenGLView.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/CustomOpenGLView.m ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/HDRFlowController.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/HDRFlowController.m ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/HDRFlow_Prefix.pch ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/Info.plist ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/ScriptEditorController.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/ScriptEditorController.mm ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/ScriptEngine.cpp ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/ScriptEngine.hpp ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/ViewportOpenGLView.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/ViewportOpenGLView.m ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/app/HDRFlow/main.m ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-10 22:27:18
|
Revision: 180 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=180&view=rev Author: glslang Date: 2007-07-10 15:27:18 -0700 (Tue, 10 Jul 2007) Log Message: ----------- +Script Editor actions Modified Paths: -------------- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-10 22:19:17
|
Revision: 179 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=179&view=rev Author: glslang Date: 2007-07-10 15:19:16 -0700 (Tue, 10 Jul 2007) Log Message: ----------- +Script Editor actions 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/ScriptEditor.nib/classes.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib trunk/app/HDRFlow/HDRFlowController.m trunk/app/HDRFlow/ScriptEditorController.h trunk/app/HDRFlow/ScriptEditorController.mm Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-07-08 20:52:19 UTC (rev 178) +++ trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-07-10 22:19:16 UTC (rev 179) @@ -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/ScriptEditor.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-08 20:52:19 UTC (rev 178) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-10 22:19:16 UTC (rev 179) @@ -2,8 +2,10 @@ IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { + ACTIONS = {clearScript = id; executeScript = id; }; CLASS = ScriptEditorController; LANGUAGE = ObjC; + OUTLETS = {"scriptEdit_" = id; }; SUPERCLASS = NSWindowController; } ); Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/app/HDRFlow/HDRFlowController.m =================================================================== --- trunk/app/HDRFlow/HDRFlowController.m 2007-07-08 20:52:19 UTC (rev 178) +++ trunk/app/HDRFlow/HDRFlowController.m 2007-07-10 22:19:16 UTC (rev 179) @@ -11,6 +11,13 @@ #pragma mark ---- IB actions ---- +- ( void ) openPanelDidEnd: ( NSOpenPanel* ) panel returnCode: ( int ) rc contextInfo: ( void* ) ctx +{ + if( rc == NSOKButton ) + { + } +} + - ( IBAction ) fileOpen: ( id ) sender { NSOpenPanel* openPanel = [ NSOpenPanel openPanel ]; @@ -30,13 +37,6 @@ contextInfo: nil ]; } -- ( void ) openPanelDidEnd: ( NSOpenPanel* ) panel returnCode: ( int ) rc contextInfo: ( void* ) ctx -{ - if( rc == NSOKButton ) - { - } -} - - ( IBAction ) scriptEditor: ( id ) sender { if( scriptEditor == nil ) Modified: trunk/app/HDRFlow/ScriptEditorController.h =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.h 2007-07-08 20:52:19 UTC (rev 178) +++ trunk/app/HDRFlow/ScriptEditorController.h 2007-07-10 22:19:16 UTC (rev 179) @@ -9,6 +9,10 @@ @interface ScriptEditorController : NSWindowController { + IBOutlet NSTextView* scriptEdit_; } +- ( IBAction ) executeScript: ( id ) sender; +- ( IBAction ) clearScript: ( id ) sender; + @end Modified: trunk/app/HDRFlow/ScriptEditorController.mm =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-08 20:52:19 UTC (rev 178) +++ trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-10 22:19:16 UTC (rev 179) @@ -9,4 +9,14 @@ @implementation ScriptEditorController +- ( IBAction ) executeScript: ( id ) sender +{ +} + +- ( IBAction ) clearScript: ( id ) sender +{ + [ scriptEdit_ setString: @""]; + [ scriptEdit_ setNeedsDisplay: YES]; +} + @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-08 20:52:29
|
Revision: 178 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=178&view=rev Author: glslang Date: 2007-07-08 13:52:19 -0700 (Sun, 08 Jul 2007) Log Message: ----------- + Initial ScriptEngine classes. UI independent python scripting abstraction Modified Paths: -------------- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj Added Paths: ----------- trunk/app/HDRFlow/ScriptEngine.cpp trunk/app/HDRFlow/ScriptEngine.hpp Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj =================================================================== --- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-08 19:58:09 UTC (rev 177) +++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-08 20:52:19 UTC (rev 178) @@ -10,6 +10,8 @@ 671E22A30C4166E400CA1860 /* ScriptEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */; }; 674E44640C3F854A0036A908 /* ScriptEditor.nib in Resources */ = {isa = PBXBuildFile; fileRef = 674E44620C3F854A0036A908 /* ScriptEditor.nib */; }; 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */; }; + 67A8A6EA0C41836600DB3F1B /* Python.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67A8A6E90C41836600DB3F1B /* Python.framework */; }; + 67A8A73E0C4183C500DB3F1B /* ScriptEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 67A8A73D0C4183C500DB3F1B /* ScriptEngine.cpp */; }; 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */; }; 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */; }; 67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */; }; @@ -32,6 +34,9 @@ 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ScriptEditorController.mm; sourceTree = "<group>"; }; 674E44630C3F854A0036A908 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/ScriptEditor.nib; sourceTree = "<group>"; }; 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CustomOpenGLView.m; sourceTree = "<group>"; }; + 67A8A6E40C4181C600DB3F1B /* ScriptEngine.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = ScriptEngine.hpp; sourceTree = "<group>"; }; + 67A8A6E90C41836600DB3F1B /* Python.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Python.framework; path = /System/Library/Frameworks/Python.framework; sourceTree = "<absolute>"; }; + 67A8A73D0C4183C500DB3F1B /* ScriptEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEngine.cpp; sourceTree = "<group>"; }; 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>"; }; 67DC61B10C2EAB5E005CFE6E /* ViewportOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewportOpenGLView.h; sourceTree = "<group>"; }; @@ -49,6 +54,7 @@ files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */, + 67A8A6EA0C41836600DB3F1B /* Python.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -73,6 +79,7 @@ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( + 67A8A6E90C41836600DB3F1B /* Python.framework */, 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */, 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ); @@ -114,6 +121,8 @@ children = ( 32CA4F630368D1EE00C91783 /* HDRFlow_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, + 67A8A6E40C4181C600DB3F1B /* ScriptEngine.hpp */, + 67A8A73D0C4183C500DB3F1B /* ScriptEngine.cpp */, ); name = "Other Sources"; sourceTree = "<group>"; @@ -197,6 +206,7 @@ 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */, 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */, 671E22A30C4166E400CA1860 /* ScriptEditorController.mm in Sources */, + 67A8A73E0C4183C500DB3F1B /* ScriptEngine.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: trunk/app/HDRFlow/ScriptEngine.cpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.cpp (rev 0) +++ trunk/app/HDRFlow/ScriptEngine.cpp 2007-07-08 20:52:19 UTC (rev 178) @@ -0,0 +1,27 @@ + +// 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. + +#include "ScriptEngine.hpp" + +namespace hdrflow { + +ScriptEngine::ScriptEngine( ) +{ + Py_Initialize( ); +} + +ScriptEngine::~ScriptEngine( ) +{ + Py_Finalize( ); +} + +bool ScriptEngine::eval( ) +{ + return false; +} + +} Added: trunk/app/HDRFlow/ScriptEngine.hpp =================================================================== --- trunk/app/HDRFlow/ScriptEngine.hpp (rev 0) +++ trunk/app/HDRFlow/ScriptEngine.hpp 2007-07-08 20:52:19 UTC (rev 178) @@ -0,0 +1,28 @@ + +// 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. + +#ifndef SCRIPT_ENGINE_INC_ +#define SCRIPT_ENGINE_INC_ + +#include <Python/python.h> + +namespace hdrflow { + +class ScriptEngine +{ +public: + explicit ScriptEngine( ); + ~ScriptEngine( ); + + bool eval( ); + +private: +}; + +} + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-08 19:58:16
|
Revision: 177 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=177&view=rev Author: glslang Date: 2007-07-08 12:58:09 -0700 (Sun, 08 Jul 2007) Log Message: ----------- + Script Editor and interface layout changes Modified Paths: -------------- trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj trunk/app/HDRFlow/HDRFlowController.h trunk/app/HDRFlow/HDRFlowController.m Added Paths: ----------- trunk/app/HDRFlow/ScriptEditorController.h trunk/app/HDRFlow/ScriptEditorController.mm Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib 2007-07-08 19:58:09 UTC (rev 177) @@ -2,7 +2,7 @@ IBClasses = ( {CLASS = CustomOpenGLView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, { - ACTIONS = {fileOpen = id; }; + ACTIONS = {fileOpen = id; scriptEditor = id; }; CLASS = HDRFlowController; LANGUAGE = ObjC; SUPERCLASS = NSObject; Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-07-08 19:58:09 UTC (rev 177) @@ -14,6 +14,7 @@ <key>IBOpenObjects</key> <array> <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/ScriptEditor.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-08 19:58:09 UTC (rev 177) @@ -1,4 +1,11 @@ { - IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + CLASS = ScriptEditorController; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); IBVersion = 1; } \ No newline at end of file Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-08 19:58:09 UTC (rev 177) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>69 49 356 240 0 0 1280 778 </string> + <string>81 58 356 240 0 0 1440 878 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> Modified: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj =================================================================== --- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-08 19:58:09 UTC (rev 177) @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 671E22A30C4166E400CA1860 /* ScriptEditorController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */; }; 674E44640C3F854A0036A908 /* ScriptEditor.nib in Resources */ = {isa = PBXBuildFile; fileRef = 674E44620C3F854A0036A908 /* ScriptEditor.nib */; }; 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */; }; 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */; }; @@ -27,6 +28,8 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 32CA4F630368D1EE00C91783 /* HDRFlow_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDRFlow_Prefix.pch; sourceTree = "<group>"; }; + 671E22910C41652E00CA1860 /* ScriptEditorController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ScriptEditorController.h; sourceTree = "<group>"; }; + 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ScriptEditorController.mm; sourceTree = "<group>"; }; 674E44630C3F854A0036A908 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/ScriptEditor.nib; sourceTree = "<group>"; }; 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CustomOpenGLView.m; sourceTree = "<group>"; }; 67BD59C70C36BE3600F0F7DF /* HDRFlowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HDRFlowController.h; sourceTree = "<group>"; }; @@ -61,6 +64,8 @@ 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */, 67BD59C70C36BE3600F0F7DF /* HDRFlowController.h */, 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */, + 671E22910C41652E00CA1860 /* ScriptEditorController.h */, + 671E22A20C4166E400CA1860 /* ScriptEditorController.mm */, ); name = Classes; sourceTree = "<group>"; @@ -191,6 +196,7 @@ 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */, 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */, 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */, + 671E22A30C4166E400CA1860 /* ScriptEditorController.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: trunk/app/HDRFlow/HDRFlowController.h =================================================================== --- trunk/app/HDRFlow/HDRFlowController.h 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/HDRFlowController.h 2007-07-08 19:58:09 UTC (rev 177) @@ -7,8 +7,12 @@ #import <Cocoa/Cocoa.h> +// forward declarations +@class ScriptEditorController; + @interface HDRFlowController : NSObject { + ScriptEditorController* scriptEditor; } - ( BOOL ) acceptsFirstResponder; @@ -16,5 +20,6 @@ - ( BOOL ) resignFirstResponder; - ( IBAction ) fileOpen: ( id ) sender; +- ( IBAction ) scriptEditor: ( id ) sender; @end Modified: trunk/app/HDRFlow/HDRFlowController.m =================================================================== --- trunk/app/HDRFlow/HDRFlowController.m 2007-07-07 08:29:49 UTC (rev 176) +++ trunk/app/HDRFlow/HDRFlowController.m 2007-07-08 19:58:09 UTC (rev 177) @@ -37,6 +37,14 @@ } } +- ( IBAction ) scriptEditor: ( id ) sender +{ + if( scriptEditor == nil ) + scriptEditor = [ [ ScriptEditorController alloc ] initWithWindowNibName:@"ScriptEditor" ]; + + [ scriptEditor showWindow: self ]; +} + - ( BOOL ) acceptsFirstResponder { return YES; @@ -52,4 +60,10 @@ return YES; } +- ( void ) dealloc +{ + [ scriptEditor dealloc ]; + [ super dealloc ]; +} + @end Added: trunk/app/HDRFlow/ScriptEditorController.h =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.h (rev 0) +++ trunk/app/HDRFlow/ScriptEditorController.h 2007-07-08 19:58:09 UTC (rev 177) @@ -0,0 +1,14 @@ + +// 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 ScriptEditorController : NSWindowController +{ +} + +@end Added: trunk/app/HDRFlow/ScriptEditorController.mm =================================================================== --- trunk/app/HDRFlow/ScriptEditorController.mm (rev 0) +++ trunk/app/HDRFlow/ScriptEditorController.mm 2007-07-08 19:58:09 UTC (rev 177) @@ -0,0 +1,12 @@ + +// 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 "ScriptEditorController.h" + +@implementation ScriptEditorController + +@end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-07 08:29:50
|
Revision: 176 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=176&view=rev Author: glslang Date: 2007-07-07 01:29:49 -0700 (Sat, 07 Jul 2007) Log Message: ----------- + Project file beautification Modified Paths: -------------- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj =================================================================== --- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-07 08:24:11 UTC (rev 175) +++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-07 08:29:49 UTC (rev 176) @@ -7,11 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 674E44640C3F854A0036A908 /* ScriptEditor.nib in Resources */ = {isa = PBXBuildFile; fileRef = 674E44620C3F854A0036A908 /* ScriptEditor.nib */; }; 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */; }; 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */; }; 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */; }; 67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */; }; - 67E9DF490C3EF24A006F4444 /* ScriptEditor.nib in Resources */ = {isa = PBXBuildFile; fileRef = 67E9DF480C3EF24A006F4444 /* ScriptEditor.nib */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; @@ -27,13 +27,13 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 32CA4F630368D1EE00C91783 /* HDRFlow_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDRFlow_Prefix.pch; sourceTree = "<group>"; }; + 674E44630C3F854A0036A908 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/ScriptEditor.nib; sourceTree = "<group>"; }; 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CustomOpenGLView.m; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; - 67E9DF480C3EF24A006F4444 /* ScriptEditor.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = ScriptEditor.nib; sourceTree = "<group>"; }; 67F6CCF70C285D6C00098F90 /* CustomOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CustomOpenGLView.h; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* HDRFlow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HDRFlow.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -119,7 +119,7 @@ 8D1107310486CEB800E47090 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, - 67E9DF480C3EF24A006F4444 /* ScriptEditor.nib */, + 674E44620C3F854A0036A908 /* ScriptEditor.nib */, ); name = Resources; sourceTree = "<group>"; @@ -176,7 +176,7 @@ files = ( 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, - 67E9DF490C3EF24A006F4444 /* ScriptEditor.nib in Resources */, + 674E44640C3F854A0036A908 /* ScriptEditor.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -213,6 +213,14 @@ name = MainMenu.nib; sourceTree = "<group>"; }; + 674E44620C3F854A0036A908 /* ScriptEditor.nib */ = { + isa = PBXVariantGroup; + children = ( + 674E44630C3F854A0036A908 /* English */, + ); + name = ScriptEditor.nib; + sourceTree = "<group>"; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-07 08:24:12
|
Revision: 175 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=175&view=rev Author: glslang Date: 2007-07-07 01:24:11 -0700 (Sat, 07 Jul 2007) Log Message: ----------- +Script Editor in Resources folder Added Paths: ----------- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib Removed Paths: ------------- trunk/app/HDRFlow/ScriptEditor.nib/ Added: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib (rev 0) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/classes.nib 2007-07-07 08:24:11 UTC (rev 175) @@ -0,0 +1,4 @@ +{ + IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); + IBVersion = 1; +} \ No newline at end of file Added: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib (rev 0) +++ trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/info.nib 2007-07-07 08:24:11 UTC (rev 175) @@ -0,0 +1,16 @@ +<?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 49 356 240 0 0 1280 778 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8R2218</string> +</dict> +</plist> Added: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) Property changes on: trunk/app/HDRFlow/English.lproj/ScriptEditor.nib/keyedobjects.nib ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-07 08:21:17
|
Revision: 174 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=174&view=rev Author: glslang Date: 2007-07-07 01:21:15 -0700 (Sat, 07 Jul 2007) Log Message: ----------- +NIB file for script editor Modified Paths: -------------- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj Added Paths: ----------- trunk/app/HDRFlow/ScriptEditor.nib/ trunk/app/HDRFlow/ScriptEditor.nib/classes.nib trunk/app/HDRFlow/ScriptEditor.nib/info.nib trunk/app/HDRFlow/ScriptEditor.nib/keyedobjects.nib Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj =================================================================== --- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-04 20:23:48 UTC (rev 173) +++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-07-07 08:21:15 UTC (rev 174) @@ -11,6 +11,7 @@ 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */; }; 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */; }; 67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */; }; + 67E9DF490C3EF24A006F4444 /* ScriptEditor.nib in Resources */ = {isa = PBXBuildFile; fileRef = 67E9DF480C3EF24A006F4444 /* ScriptEditor.nib */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; @@ -32,6 +33,7 @@ 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>"; }; 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; + 67E9DF480C3EF24A006F4444 /* ScriptEditor.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = ScriptEditor.nib; sourceTree = "<group>"; }; 67F6CCF70C285D6C00098F90 /* CustomOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CustomOpenGLView.h; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D1107320486CEB800E47090 /* HDRFlow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HDRFlow.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -117,6 +119,7 @@ 8D1107310486CEB800E47090 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, + 67E9DF480C3EF24A006F4444 /* ScriptEditor.nib */, ); name = Resources; sourceTree = "<group>"; @@ -173,6 +176,7 @@ files = ( 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 67E9DF490C3EF24A006F4444 /* ScriptEditor.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: trunk/app/HDRFlow/ScriptEditor.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/ScriptEditor.nib/classes.nib (rev 0) +++ trunk/app/HDRFlow/ScriptEditor.nib/classes.nib 2007-07-07 08:21:15 UTC (rev 174) @@ -0,0 +1,4 @@ +{ + IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); + IBVersion = 1; +} \ No newline at end of file Added: trunk/app/HDRFlow/ScriptEditor.nib/info.nib =================================================================== --- trunk/app/HDRFlow/ScriptEditor.nib/info.nib (rev 0) +++ trunk/app/HDRFlow/ScriptEditor.nib/info.nib 2007-07-07 08:21:15 UTC (rev 174) @@ -0,0 +1,16 @@ +<?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 49 356 240 0 0 1280 778 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8R2218</string> +</dict> +</plist> Added: trunk/app/HDRFlow/ScriptEditor.nib/keyedobjects.nib =================================================================== (Binary files differ) Property changes on: trunk/app/HDRFlow/ScriptEditor.nib/keyedobjects.nib ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-04 20:23:50
|
Revision: 173 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=173&view=rev Author: glslang Date: 2007-07-04 13:23:48 -0700 (Wed, 04 Jul 2007) Log Message: ----------- + more shared_ptr correctness Modified Paths: -------------- trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp Modified: trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp 2007-07-04 20:23:48 UTC (rev 173) @@ -20,7 +20,7 @@ struct IL_DECLSPEC openimagelib_plugin : public olib::openpluginlib::openplugin { virtual image_type_ptr load( openpluginlib::stream_ptr stream ) = 0; - virtual bool store( openpluginlib::stream_ptr stream, const image_type_ptr& image ) = 0; + virtual bool store( openpluginlib::stream_ptr stream, image_type_ptr image ) = 0; }; typedef boost::shared_ptr<openimagelib_plugin> openimagelib_plugin_ptr; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -90,7 +90,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return il::image_type_ptr( ); } - virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr stream, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -21,7 +21,7 @@ virtual il::image_type_ptr load( pl::stream_ptr ) { return il::image_type_ptr( ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -205,7 +205,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_dds( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -839,7 +839,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_dpx( stream ); } - virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& im ) + virtual bool store( pl::stream_ptr stream, il::image_type_ptr im ) { return store_dpx( stream, im ); } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -61,7 +61,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_exr( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -150,7 +150,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_image( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -271,7 +271,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_hdr( stream ); } - virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& im ) + virtual bool store( pl::stream_ptr stream, il::image_type_ptr im ) { return store_hdr( stream, im ); } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -295,7 +295,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_jpg( stream ); } - virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& im ) + virtual bool store( pl::stream_ptr stream, il::image_type_ptr im ) { return store_jpg( stream, im ); } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -102,7 +102,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_png( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -76,7 +76,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_psd( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -118,7 +118,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_quicktime( stream ); } - virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr stream, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -267,7 +267,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_sgi( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -225,7 +225,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_tga( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp 2007-07-04 06:52:17 UTC (rev 172) +++ trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp 2007-07-04 20:23:48 UTC (rev 173) @@ -124,7 +124,7 @@ virtual il::image_type_ptr load( pl::stream_ptr stream ) { return load_tiff( stream ); } - virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, il::image_type_ptr ) { return false; } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-04 06:52:20
|
Revision: 172 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=172&view=rev Author: glslang Date: 2007-07-03 23:52:17 -0700 (Tue, 03 Jul 2007) Log Message: ----------- + eol-native Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp Property Changed: ---------------- trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp Modified: trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp 2007-07-03 23:16:17 UTC (rev 171) +++ trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp 2007-07-04 06:52:17 UTC (rev 172) @@ -1,122 +1,122 @@ - -// openpluginlib - A plugin interface to openlibraries. - -// Copyright (C) 2007 Goncalo Nuno M. de Carvalho -// Released under the LGPL. -// For more information, see http://www.cryogenicgraphics.com/hdrflow. - -#include <boost/filesystem/operations.hpp> - -#include <openpluginlib/pl/utf8_utils.hpp> -#include <openpluginlib/pl/stream.hpp> - -namespace fs = boost::filesystem; - -namespace olib { namespace openpluginlib { - -stream::stream( const string& path, std::ios::openmode flags, std::size_t max_size ) - : data_( 0 ) - , offset_( 0 ) - , max_size_( max_size ) - , flags_( flags ) - , path_( path ) -{ - fs::path fs_path( path.c_str( ), fs::native ); - if( fs::exists( fs_path ) ) - { - mapped_.open( fs_path.native_file_string( ), flags ); - if( mapped_.is_open( ) ) - { - if( ( flags_ && std::ios::out ) != 0 )data_ = const_cast<char*>( mapped_.const_data( ) ); - else data_ = mapped_.data( ); - - max_size_ = mapped_.size( ); - } - } -} - -stream::~stream( ) -{ - if( mapped_.is_open( ) ) - { - data_ = 0; - offset_ = 0; - mapped_.close( ); - } -} - -std::size_t stream::read( stream::pointer data, std::size_t bytes ) -{ - bytes = actual_bytes( bytes ); - - memcpy( data, data_ + offset_, bytes ); - offset_ += bytes; - - return bytes; -} - -std::size_t stream::write( stream::const_pointer data, std::size_t bytes ) -{ - bytes = actual_bytes( bytes ); - - memcpy( data_ + offset_, data, bytes ); - offset_ += bytes; - - return bytes; -} - -void stream::seek( std::size_t bytes, std::ios::seekdir flags ) -{ - if( flags == std::ios::beg ) - offset_ = bytes; - else if( flags == std::ios::cur ) - offset_ += bytes; - else if( flags == std::ios::end ) - offset_ = max_size_ - bytes; -} - -std::size_t stream::getline( pointer data, std::size_t bytes ) -{ - bytes = actual_bytes( bytes ); - - std::size_t i = 0; - for( ; *( data_ + i ) != '\n' && i < bytes; ++i ) - *data++ = *( data_ + i ); - - if( *( data_ + i ) == '\n' ) - ++i; - - offset_ += i; - - return bytes; -} - -string stream::path( ) const -{ - return fs::path( path_.c_str( ), fs::native ).native_file_string( ); -} - -wstring stream::wpath( ) const -{ - return to_wstring( path( ) ); -} - -std::size_t stream::actual_bytes( std::size_t bytes ) const -{ - if( offset_ + bytes > max_size_ ) - bytes = max_size_ - offset_; - - return bytes; -} - -stream_ptr make_stream( const string& path, std::ios::openmode flags ) -{ - return stream_ptr( new stream( path, flags ) ); -} - -stream_ptr make_stream( void* data, std::ios::openmode flags ) -{ - return stream_ptr( new stream( static_cast<char*>( data ), flags ) ); -} - -} } + +// openpluginlib - A plugin interface to openlibraries. + +// Copyright (C) 2007 Goncalo Nuno M. de Carvalho +// Released under the LGPL. +// For more information, see http://www.cryogenicgraphics.com/hdrflow. + +#include <boost/filesystem/operations.hpp> + +#include <openpluginlib/pl/utf8_utils.hpp> +#include <openpluginlib/pl/stream.hpp> + +namespace fs = boost::filesystem; + +namespace olib { namespace openpluginlib { + +stream::stream( const string& path, std::ios::openmode flags, std::size_t max_size ) + : data_( 0 ) + , offset_( 0 ) + , max_size_( max_size ) + , flags_( flags ) + , path_( path ) +{ + fs::path fs_path( path.c_str( ), fs::native ); + if( fs::exists( fs_path ) ) + { + mapped_.open( fs_path.native_file_string( ), flags ); + if( mapped_.is_open( ) ) + { + if( ( flags_ && std::ios::out ) != 0 )data_ = const_cast<char*>( mapped_.const_data( ) ); + else data_ = mapped_.data( ); + + max_size_ = mapped_.size( ); + } + } +} + +stream::~stream( ) +{ + if( mapped_.is_open( ) ) + { + data_ = 0; + offset_ = 0; + mapped_.close( ); + } +} + +std::size_t stream::read( stream::pointer data, std::size_t bytes ) +{ + bytes = actual_bytes( bytes ); + + memcpy( data, data_ + offset_, bytes ); + offset_ += bytes; + + return bytes; +} + +std::size_t stream::write( stream::const_pointer data, std::size_t bytes ) +{ + bytes = actual_bytes( bytes ); + + memcpy( data_ + offset_, data, bytes ); + offset_ += bytes; + + return bytes; +} + +void stream::seek( std::size_t bytes, std::ios::seekdir flags ) +{ + if( flags == std::ios::beg ) + offset_ = bytes; + else if( flags == std::ios::cur ) + offset_ += bytes; + else if( flags == std::ios::end ) + offset_ = max_size_ - bytes; +} + +std::size_t stream::getline( pointer data, std::size_t bytes ) +{ + bytes = actual_bytes( bytes ); + + std::size_t i = 0; + for( ; *( data_ + i ) != '\n' && i < bytes; ++i ) + *data++ = *( data_ + i ); + + if( *( data_ + i ) == '\n' ) + ++i; + + offset_ += i; + + return bytes; +} + +string stream::path( ) const +{ + return fs::path( path_.c_str( ), fs::native ).native_file_string( ); +} + +wstring stream::wpath( ) const +{ + return to_wstring( path( ) ); +} + +std::size_t stream::actual_bytes( std::size_t bytes ) const +{ + if( offset_ + bytes > max_size_ ) + bytes = max_size_ - offset_; + + return bytes; +} + +stream_ptr make_stream( const string& path, std::ios::openmode flags ) +{ + return stream_ptr( new stream( path, flags ) ); +} + +stream_ptr make_stream( void* data, std::ios::openmode flags ) +{ + return stream_ptr( new stream( static_cast<char*>( data ), flags ) ); +} + +} } Property changes on: trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp 2007-07-03 23:16:17 UTC (rev 171) +++ trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp 2007-07-04 06:52:17 UTC (rev 172) @@ -1,85 +1,85 @@ - -// openpluginlib - A plugin interface to openlibraries. - -// Copyright (C) 2007 Goncalo Nuno M. de Carvalho -// Released under the LGPL. -// For more information, see http://www.cryogenicgraphics.com/hdrflow. - -#ifndef STREAM_INC_ -#define STREAM_INC_ - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4251 ) -#endif - -#include <boost/shared_ptr.hpp> -#include <boost/iostreams/device/mapped_file.hpp> - -#include <openpluginlib/pl/config.hpp> -#include <openpluginlib/pl/string.hpp> - -namespace olib { namespace openpluginlib { - -class OPENPLUGINLIB_DECLSPEC stream -{ -public: - typedef char value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - -public: - explicit stream( pointer data = 0, std::ios::openmode flags = std::ios::in | std::ios::out, std::size_t max_size = 0 ) - : data_( data ) - , offset_( 0 ) - , max_size_( max_size ) - , flags_( flags ) - { } - - explicit stream( const string& path, std::ios::openmode flags = std::ios::in | std::ios::out, std::size_t max_size = 0 ); - - ~stream( ); - - std::size_t read( pointer data, std::size_t bytes ); - std::size_t write( const_pointer data, std::size_t bytes ); - void seek( std::size_t bytes, std::ios::seekdir flags ); - std::size_t getline( pointer data, std::size_t bytes ); - - std::ios::openmode flags( ) const { return flags_; } - bool is_null( ) const { return data_ == 0; } - const char* data( ) const { return data_; } - std::size_t offset( ) const { return offset_; } - std::size_t max_size( ) const { return max_size_; } - - string path( ) const; - wstring wpath( ) const; - -private: - std::size_t actual_bytes( std::size_t bytes ) const; - -private: - stream( const stream& ); - stream& operator=( const stream& ); - -private: - pointer data_; - std::size_t offset_, max_size_; - std::ios::openmode flags_; - string path_; - -private: - boost::iostreams::mapped_file mapped_; -}; - -typedef boost::shared_ptr<stream> stream_ptr; - -OPENPLUGINLIB_DECLSPEC stream_ptr make_stream( const string& path, std::ios::openmode flags ); -OPENPLUGINLIB_DECLSPEC stream_ptr make_stream( void* data, std::ios::openmode flags ); - -} } - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - -#endif + +// openpluginlib - A plugin interface to openlibraries. + +// Copyright (C) 2007 Goncalo Nuno M. de Carvalho +// Released under the LGPL. +// For more information, see http://www.cryogenicgraphics.com/hdrflow. + +#ifndef STREAM_INC_ +#define STREAM_INC_ + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable: 4251 ) +#endif + +#include <boost/shared_ptr.hpp> +#include <boost/iostreams/device/mapped_file.hpp> + +#include <openpluginlib/pl/config.hpp> +#include <openpluginlib/pl/string.hpp> + +namespace olib { namespace openpluginlib { + +class OPENPLUGINLIB_DECLSPEC stream +{ +public: + typedef char value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + +public: + explicit stream( pointer data = 0, std::ios::openmode flags = std::ios::in | std::ios::out, std::size_t max_size = 0 ) + : data_( data ) + , offset_( 0 ) + , max_size_( max_size ) + , flags_( flags ) + { } + + explicit stream( const string& path, std::ios::openmode flags = std::ios::in | std::ios::out, std::size_t max_size = 0 ); + + ~stream( ); + + std::size_t read( pointer data, std::size_t bytes ); + std::size_t write( const_pointer data, std::size_t bytes ); + void seek( std::size_t bytes, std::ios::seekdir flags ); + std::size_t getline( pointer data, std::size_t bytes ); + + std::ios::openmode flags( ) const { return flags_; } + bool is_null( ) const { return data_ == 0; } + const char* data( ) const { return data_; } + std::size_t offset( ) const { return offset_; } + std::size_t max_size( ) const { return max_size_; } + + string path( ) const; + wstring wpath( ) const; + +private: + std::size_t actual_bytes( std::size_t bytes ) const; + +private: + stream( const stream& ); + stream& operator=( const stream& ); + +private: + pointer data_; + std::size_t offset_, max_size_; + std::ios::openmode flags_; + string path_; + +private: + boost::iostreams::mapped_file mapped_; +}; + +typedef boost::shared_ptr<stream> stream_ptr; + +OPENPLUGINLIB_DECLSPEC stream_ptr make_stream( const string& path, std::ios::openmode flags ); +OPENPLUGINLIB_DECLSPEC stream_ptr make_stream( void* data, std::ios::openmode flags ); + +} } + +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + +#endif Property changes on: trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-03 23:16:19
|
Revision: 171 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=171&view=rev Author: glslang Date: 2007-07-03 16:16:17 -0700 (Tue, 03 Jul 2007) Log Message: ----------- +build fixes Modified Paths: -------------- trunk/lib/openlibraries/test/openimagelib/GL/_2D_scale/_2D_scale.cpp Modified: trunk/lib/openlibraries/test/openimagelib/GL/_2D_scale/_2D_scale.cpp =================================================================== --- trunk/lib/openlibraries/test/openimagelib/GL/_2D_scale/_2D_scale.cpp 2007-07-03 23:09:14 UTC (rev 170) +++ trunk/lib/openlibraries/test/openimagelib/GL/_2D_scale/_2D_scale.cpp 2007-07-03 23:16:17 UTC (rev 171) @@ -63,18 +63,18 @@ float tex_w, tex_h; } -static GLuint download_texture( const boost::filesystem::path& path ) +static GLuint download_texture( const opl::string& path ) { typedef opl::discovery<query_traits> oil_discovery; - oil_discovery plugins( query_traits( opl::to_wstring( path.native_file_string( ).c_str( ) ) ) ); + oil_discovery plugins( query_traits( opl::to_wstring( path ) ) ); if( plugins.empty( ) ) return 0; oil_discovery::const_iterator i = plugins.begin( ); - boost::shared_ptr<il::openimagelib_plugin> plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); + il::openimagelib_plugin_ptr plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); if( !plug ) return 0; - il::image_type_ptr image = plug->load( path ); + il::image_type_ptr image = plug->load( opl::make_stream( path, std::ios::in ) ); if( !image ) return 0; image = il::conform( image, il::cropped | il::flipped | il::flopped ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-03 23:09:18
|
Revision: 170 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=170&view=rev Author: glslang Date: 2007-07-03 16:09:14 -0700 (Tue, 03 Jul 2007) Log Message: ----------- +build fixes Modified Paths: -------------- trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp Modified: trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp 2007-07-03 23:07:29 UTC (rev 169) +++ trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp 2007-07-03 23:09:14 UTC (rev 170) @@ -38,7 +38,7 @@ err = NativePathNameToFSSpec( const_cast<char*>( stream->path( ).c_str( ) ), &fsspec, kErrorIfFileNotFound ); #else FSRef ref; - err = FSPathMakeRef( ( const UInt8* ) ( path.native_file_string( ) ).c_str( ), &ref, 0 ); + err = FSPathMakeRef( ( const UInt8* ) stream->path( ).c_str( ), &ref, 0 ); if( err != noErr ) return il::image_type_ptr( ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-03 23:07:31
|
Revision: 169 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=169&view=rev Author: glslang Date: 2007-07-03 16:07:29 -0700 (Tue, 03 Jul 2007) Log Message: ----------- +build fixes Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp Modified: trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp 2007-07-03 23:02:52 UTC (rev 168) +++ trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp 2007-07-03 23:07:29 UTC (rev 169) @@ -41,7 +41,6 @@ { data_ = 0; offset_ = 0; - flags_ = 0; mapped_.close( ); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-07-03 23:03:12
|
Revision: 168 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=168&view=rev Author: glslang Date: 2007-07-03 16:02:52 -0700 (Tue, 03 Jul 2007) Log Message: ----------- + generic stream abstraction Modified Paths: -------------- trunk/lib/extras/src/raw/raw.cpp trunk/lib/openlibraries/installer/openlibraries_sdk.nsi trunk/lib/openlibraries/src/openassetlib/al/al.cpp trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp trunk/lib/openlibraries/src/openimagelib/py/il.cpp trunk/lib/openlibraries/src/openmedialib/plugins/oil/oil_plugin.cpp trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.cpp trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.hpp trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp trunk/lib/openlibraries/src/openpluginlib/pl/stream.hpp trunk/lib/openlibraries/test/openimagelib/GL/_2D/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D/_2D.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_compressed/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D_compressed/_2D_compressed.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_compressed_cubemap/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D_compressed_cubemap/_2D_compressed_cubemap.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_crop/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D_crop/_2D_crop.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_crop2/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D_crop2/_2D_crop2.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_exr/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D_exr/_2D_exr.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_sgi/Makefile.am trunk/lib/openlibraries/test/openimagelib/GL/_2D_sgi/_2D_sgi.cpp Modified: trunk/lib/extras/src/raw/raw.cpp =================================================================== --- trunk/lib/extras/src/raw/raw.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/extras/src/raw/raw.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -11,11 +11,10 @@ #include <windows.h> #endif -#include <openmedialib/ml/openmedialib_plugin.hpp> +#include <openmedialib/il/openimagelib_plugin.hpp> namespace pl = olib::openpluginlib; namespace il = olib::openimagelib::il; -namespace ml = olib::openmedialib::ml; namespace fs = boost::filesystem; namespace pcos = olib::openpluginlib::pcos; @@ -23,12 +22,16 @@ namespace { + bool dcraw( property_container properties ) + { + return true; + } } -class raw_input : public ml::input_type +class raw_plugin : public il::openimagelib_plugin { public: - explicit raw_input( const pl::wstring& resource ) + explicit raw_plugin( ) : verbose_( pcos::key::from_string( "verbose" ) ) , thumbnail_( pcos::key::from_string( "thumbnail" ) ) , camera_white_balance_( pcos::key::from_string( "camera_white_balance" ) ) @@ -51,6 +54,12 @@ , tiff_output_( pcos::key::from_string( "tiff_output" ) ) { } + virtual il::image_type_ptr load( const fs::path& path ) + { return il::image_type_ptr( ); } + + virtual bool store( const fs::path&, const il::image_type_ptr& ) + { return false; } + private: pcos::property verbose_; pcos::property thumbnail_; @@ -74,13 +83,6 @@ pcos::property tiff_output_; }; -class raw_plugin : public ml::openmedialib_plugin -{ -public: - explicit raw_plugin( ) - { } -}; - } } } extern "C" Modified: trunk/lib/openlibraries/installer/openlibraries_sdk.nsi =================================================================== --- trunk/lib/openlibraries/installer/openlibraries_sdk.nsi 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/installer/openlibraries_sdk.nsi 2007-07-03 23:02:52 UTC (rev 168) @@ -101,6 +101,7 @@ File ..\src\openpluginlib\pl\shader_manager.hpp File ..\src\openpluginlib\pl\simplestringstorage.h File ..\src\openpluginlib\pl\smallstringopt.h + File ..\src\openpluginlib\pl\stream.hpp File ..\src\openpluginlib\pl\string.hpp File ..\src\openpluginlib\pl\timer.hpp File ..\src\openpluginlib\pl\utf8_utils.hpp Modified: trunk/lib/openlibraries/src/openassetlib/al/al.cpp =================================================================== --- trunk/lib/openlibraries/src/openassetlib/al/al.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openassetlib/al/al.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -630,7 +630,7 @@ if(!plugin) continue; - oil::il::image_type_ptr image = boost::shared_dynamic_cast<oil::il::openimagelib_plugin>(plugin)->load(fs::path( filepath.c_str( ), fs::native )); + oil::il::image_type_ptr image = boost::shared_dynamic_cast<oil::il::openimagelib_plugin>(plugin)->load( opl::make_stream( filepath, std::ios::in )); if(image) { asset->set("width", image->width()); Modified: trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/il/openimagelib_plugin.hpp 2007-07-03 23:02:52 UTC (rev 168) @@ -10,16 +10,17 @@ #include <boost/filesystem/path.hpp> +#include <openpluginlib/pl/openpluginlib.hpp> +#include <openpluginlib/pl/stream.hpp> + #include <openimagelib/il/il.hpp> -#include <openpluginlib/pl/openpluginlib.hpp> - namespace olib { namespace openimagelib { namespace il { struct IL_DECLSPEC openimagelib_plugin : public olib::openpluginlib::openplugin { - virtual image_type_ptr load( const boost::filesystem::path& path ) = 0; - virtual bool store( const boost::filesystem::path& path, const image_type_ptr& image ) = 0; + virtual image_type_ptr load( openpluginlib::stream_ptr stream ) = 0; + virtual bool store( openpluginlib::stream_ptr stream, const image_type_ptr& image ) = 0; }; typedef boost::shared_ptr<openimagelib_plugin> openimagelib_plugin_ptr; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/3D_lightmap/3D_lightmap_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -10,7 +10,6 @@ #include <openimagelib/il/openimagelib_plugin.hpp> -namespace fs = boost::filesystem; namespace il = olib::openimagelib::il; namespace pl = olib::openpluginlib; @@ -21,6 +20,7 @@ void destroy( il::image_type* im ) { delete im; } +/* bool discover_lightmap_size( const boost::filesystem::path& path, int& radius ) { typedef boost::tokenizer< boost::char_separator<char> > tokenizer; @@ -81,15 +81,16 @@ return im; } +*/ } class lightmap3D_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const boost::filesystem::path& path ) - { return generate_lightmap( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return il::image_type_ptr( ); } - virtual bool store( const boost::filesystem::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/bmp/bmp_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -8,7 +8,6 @@ #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { @@ -19,10 +18,10 @@ struct bmp_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const boost::filesystem::path& ) + virtual il::image_type_ptr load( pl::stream_ptr ) { return il::image_type_ptr( ); } - virtual bool store( const boost::filesystem::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/dds/dds_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -6,16 +6,12 @@ // For more information, see http://www.openlibraries.org. #include <cstdlib> -#include <iostream> #include <vector> #include <string> -#include <boost/filesystem/fstream.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { @@ -96,17 +92,6 @@ bool is_dds_header( const std::string& magic ) { return magic == std::string( "DDS " ); } - bool Read_s( fs::ifstream& file, char* s, std::streamsize size, std::streamsize max ) - { -#if _MSC_VER >= 1400 - file._Read_s( s, size, max ); -#else - file.read( s, size ); -#endif // _MSC_VER >= 1400 - - return !file.fail( ); - } - il::image_type_ptr ddsd_pixelformat_to_image_type( DDSURFACEDESC2 ddsd ) { # ifndef MAKEFOURCC @@ -186,21 +171,20 @@ #undef DDSCAPS2_CUBEMAP } - il::image_type_ptr load_dds( const fs::path& path ) + il::image_type_ptr load_dds( pl::stream_ptr stream ) { - typedef il::image_type::size_type size_type; + typedef il::image_type::size_type size_type; - fs::ifstream file( path, std::ios::in | std::ios::binary ); - if( !file.is_open( ) ) + if( stream->is_null( ) ) return il::image_type_ptr( ); char magic[ 4 ]; - Read_s( file, magic, 4, 4 ); + stream->read( magic, 4 ); if( !is_dds_header( std::string( magic, 4 ) ) ) return il::image_type_ptr( ); DDSURFACEDESC2 ddsd; - Read_s( file, reinterpret_cast<char*>( &ddsd ), sizeof( DDSURFACEDESC2 ), 124 ); + stream->read( reinterpret_cast<char*>( &ddsd ), sizeof( DDSURFACEDESC2 ) ); #ifdef __BIG_ENDIAN__ swap_surface_desc( ddsd ); @@ -210,7 +194,7 @@ if( !im ) return il::image_type_ptr( ); - Read_s( file, reinterpret_cast<char*>( im->data( ) ), std::streamsize( im->size( ) ), std::streamsize( im->size( ) ) ); + stream->read( reinterpret_cast<char*>( im->data( ) ), std::streamsize( im->size( ) ) ); return im; } @@ -218,10 +202,10 @@ struct dds_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const boost::filesystem::path& path ) - { return load_dds( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_dds( stream ); } - virtual bool store( const boost::filesystem::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/dpx/dpx_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -7,12 +7,9 @@ #include <sstream> -#include <boost/filesystem/fstream.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { @@ -342,22 +339,6 @@ return 0; } - bool Read_s( fs::ifstream& file, char* s, std::streamsize size, std::streamsize max ) - { -#if _MSC_VER >= 1400 - file._Read_s( s, size, max ); -#else - file.read( s, size ); -#endif - - return !file.fail( ); - } - - bool Write_s( fs::ofstream& file, char* s, std::streamsize size ) - { - return !file.write( s, size ).fail( ); - } - std::wstring generate_image_pf( const image_information_header& im_header ) { std::wostringstream str; @@ -590,33 +571,32 @@ } } - il::image_type_ptr load_dpx( const fs::path& path ) + il::image_type_ptr load_dpx( pl::stream_ptr stream ) { - fs::ifstream file( path, std::ios::in | std::ios::binary ); - if( !file.is_open( ) ) + if( stream->is_null( ) ) return il::image_type_ptr( ); file_information_header header; - if( !Read_s( file, ( char* ) &header, sizeof( header ), sizeof( header ) ) ) + if( !stream->read( ( char* ) &header, sizeof( header ) ) ) return il::image_type_ptr( ); if( header.magic != 0x58504453 && header.magic != 0x53445058 ) return il::image_type_ptr( ); image_information_header image_info_header; - if( !Read_s( file, ( char* ) &image_info_header, sizeof( image_info_header ), sizeof( image_info_header ) ) ) + if( !stream->read( ( char* ) &image_info_header, sizeof( image_info_header ) ) ) return il::image_type_ptr( ); image_orientation_information_header image_orientation_info_header; - if( !Read_s( file, ( char* ) &image_orientation_info_header, sizeof( image_orientation_info_header ), sizeof( image_orientation_info_header ) ) ) + if( !stream->read( ( char* ) &image_orientation_info_header, sizeof( image_orientation_info_header ) ) ) return il::image_type_ptr( ); motion_picture_film_information_header motion_info_header; - if( !Read_s( file, ( char* ) &motion_info_header, sizeof( motion_info_header ), sizeof( motion_info_header ) ) ) + if( !stream->read( ( char* ) &motion_info_header, sizeof( motion_info_header ) ) ) return il::image_type_ptr( ); television_information_header tv_info_header; - if( !Read_s( file, ( char* ) &tv_info_header, sizeof( tv_info_header ), sizeof( tv_info_header ) ) ) + if( !stream->read( ( char* ) &tv_info_header, sizeof( tv_info_header ) ) ) return il::image_type_ptr( ); bool swab = header.magic == 0x58504453 ? true : false; @@ -638,7 +618,7 @@ for( int i = 0; i < image_info_header.image_elements; ++i ) { - file.rdbuf( )->pubseekoff( image_info_header.element[ i ].offset, std::ios::beg ); + stream->seek( image_info_header.element[ i ].offset, std::ios::beg ); int bitdepth = image_info_header.element[ i ].bitdepth; int packing = image_info_header.element[ i ].packing; @@ -654,7 +634,7 @@ for( unsigned int j = 0; j < image_info_header.lines_per_element; ++j ) { - Read_s( file, reinterpret_cast<char*>( &data[ 0 ] ), linesize, linesize ); + stream->read( reinterpret_cast<char*>( &data[ 0 ] ), linesize ); data += im->pitch( i ); } } @@ -665,7 +645,7 @@ std::vector<unsigned char> image_data( linesize ); for( unsigned int j = 0; j < image_info_header.lines_per_element; ++j ) { - Read_s( file, reinterpret_cast<char*>( &image_data[ 0 ] ), linesize, linesize ); + stream->read( reinterpret_cast<char*>( &image_data[ 0 ] ), linesize ); memcpy( &data[ 0 ], &image_data[ 0 ], linesize ); data += im->pitch( i ); } @@ -680,7 +660,7 @@ else if( bitdepth == 10 || ( bitdepth == 12 || !packing ) ) { std::vector<unsigned char> image_data( linesize * image_info_header.lines_per_element ); - Read_s( file, reinterpret_cast<char*>( &image_data[ 0 ] ), linesize * image_info_header.lines_per_element, linesize * image_info_header.lines_per_element ); + stream->read( reinterpret_cast<char*>( &image_data[ 0 ] ), linesize * image_info_header.lines_per_element ); if( packing == 0 ) { @@ -757,10 +737,9 @@ return false; } - bool store_dpx( const fs::path& path, const il::image_type_ptr& im ) + bool store_dpx( pl::stream_ptr stream, const il::image_type_ptr& im ) { - fs::ofstream file( path, std::ios::out | std::ios::binary ); - if( !file.is_open( ) ) return false; + if( stream->is_null( ) ) return false; il::image_type::size_type width = im->width( ); il::image_type::size_type height = im->height( ); @@ -817,12 +796,12 @@ user_defined_data_header user_defined_header; memset( &user_defined_header, 0, sizeof( user_defined_header ) ); - if( !( Write_s( file, ( char* ) &header, sizeof( header ) ) && - Write_s( file, ( char* ) &image_info_header, sizeof( image_info_header ) ) && - Write_s( file, ( char* ) &image_orientation_info_header, sizeof( image_orientation_info_header ) ) && - Write_s( file, ( char* ) &motion_info_header, sizeof( motion_info_header ) ) && - Write_s( file, ( char* ) &tv_info_header, sizeof( tv_info_header ) ) && - Write_s( file, ( char* ) &user_defined_header, sizeof( user_defined_header ) ) ) ) + if( !( stream->write( ( char* ) &header, sizeof( header ) ) && + stream->write( ( char* ) &image_info_header, sizeof( image_info_header ) ) && + stream->write( ( char* ) &image_orientation_info_header, sizeof( image_orientation_info_header ) ) && + stream->write( ( char* ) &motion_info_header, sizeof( motion_info_header ) ) && + stream->write( ( char* ) &tv_info_header, sizeof( tv_info_header ) ) && + stream->write( ( char* ) &user_defined_header, sizeof( user_defined_header ) ) ) ) return false; for( int i = 0; i < image_info_header.image_elements; ++i ) @@ -832,7 +811,7 @@ il::image_type::const_pointer data = im->data( i ); for( int j = 0; j < height; ++j ) { - if( !Write_s( file, ( char* ) data, im->pitch( i ) ) ) + if( !stream->write( ( char* ) data, im->pitch( i ) ) ) return false; data += im->pitch( i ); @@ -843,7 +822,7 @@ unsigned short* data = ( unsigned short* ) im->data( i ); for( int j = 0; j < height; ++j ) { - if( !Write_s( file, ( char* ) data, im->linesize( i ) * sizeof( unsigned short ) ) ) + if( !stream->write( ( char* ) data, im->linesize( i ) * sizeof( unsigned short ) ) ) return false; data += im->pitch( i ); @@ -857,11 +836,11 @@ struct dpx_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const boost::filesystem::path& path ) - { return load_dpx( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_dpx( stream ); } - virtual bool store( const boost::filesystem::path& path, const il::image_type_ptr& im ) - { return store_dpx( path, im ); } + virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& im ) + { return store_dpx( stream, im ); } }; } } } Modified: trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/exr/exr_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -11,7 +11,6 @@ #include <openimagelib/il/openimagelib_plugin.hpp> -namespace fs = boost::filesystem; namespace il = olib::openimagelib::il; namespace pl = olib::openpluginlib; @@ -22,9 +21,9 @@ void destroy( il::image_type* im ) { delete im; } - il::image_type_ptr load_exr( const fs::path& path ) + il::image_type_ptr load_exr( pl::stream_ptr stream ) { - Imf::RgbaInputFile file( path.native_file_string( ).c_str( ) ); + Imf::RgbaInputFile file( stream->path( ).c_str( ) ); Imath::Box2i dw = file.header( ).dataWindow( ); int width = dw.max.x - dw.min.x + 1; @@ -59,10 +58,10 @@ struct exr_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const fs::path& path ) - { return load_exr( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_exr( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/gdi+/gdi+_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -20,7 +20,6 @@ #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { @@ -80,9 +79,9 @@ } } - il::image_type_ptr load_image( const fs::path& path ) + il::image_type_ptr load_image( pl::stream_ptr stream ) { - Gdiplus::Bitmap bitmap( ( pl::to_wstring( path.native_directory_string( ) ) ).c_str( ) ); + Gdiplus::Bitmap bitmap( ( pl::to_wstring( stream->path( ) ) ).c_str( ) ); Gdiplus::BitmapData bitmapData; Gdiplus::Rect rect( 0, 0, bitmap.GetWidth( ), bitmap.GetHeight( ) ); @@ -113,7 +112,7 @@ bitmap.UnlockBits( &bitmapData ); - return il::image_type_ptr( image ); + return image; } /* bool store_png( const fs::path& path, const image_type_ptr& image ) @@ -148,10 +147,10 @@ class gdi_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const fs::path& path ) - { return load_image( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_image( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/hdr/hdr_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -12,13 +12,11 @@ #include <cmath> #include <limits> #include <vector> +#include <sstream> -#include <boost/filesystem/fstream.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { @@ -38,23 +36,12 @@ char format[ 16 ]; }; - bool Read_s( fs::ifstream& file, char* s, std::streamsize size, std::streamsize max ) + bool read_rgbe_pixels_raw( pl::stream_ptr stream, unsigned char* data, int width, int height ) { -#if _MSC_VER >= 1400 - file._Read_s( s, size, max ); -#else - file.read( s, size ); -#endif - - return !file.fail( ); - } - - bool read_rgbe_pixels_raw( fs::ifstream& file, unsigned char* data, int width, int height ) - { int numpixels = width * height; while( numpixels-- ) { - if( !Read_s( file, ( char* ) data, 4, 4 ) ) + if( !stream->read( ( char* ) data, 4 ) ) return false; data += 4; @@ -63,12 +50,12 @@ return true; } - bool read_rgbe_pixels( fs::ifstream& file, il::image_type_ptr im, int width, int height ) + bool read_rgbe_pixels( pl::stream_ptr stream, il::image_type_ptr im, int width, int height ) { il::image_type::pointer data = im->data( ); if( width < 8 || width > 0x7FFF ) - return read_rgbe_pixels_raw( file, data, width, height ); + return read_rgbe_pixels_raw( stream, data, width, height ); std::vector<unsigned char> line; line.resize( width * 4 * 4 ); @@ -76,7 +63,7 @@ unsigned char rgbe[ 4 ]; for( int i = 0; i < height; ++i ) { - if( !Read_s( file, ( char* ) rgbe, sizeof( rgbe ), sizeof( rgbe ) ) ) + if( !stream->read( ( char* ) rgbe, sizeof( rgbe ) ) ) return false; if( ( rgbe[ 0 ] != 2 ) || ( rgbe[ 1 ] != 2 ) || ( rgbe[ 2 ] & 0x80 ) ) @@ -88,7 +75,7 @@ data += 4; - return read_rgbe_pixels_raw( file, data, width, height ); + return read_rgbe_pixels_raw( stream, data, width, height ); } if( ( ( ( int ) rgbe[ 2 ] ) << 8 | rgbe[ 3 ] ) != width ) @@ -106,7 +93,7 @@ while( I < J ) { unsigned char buf[ 2 ]; - if( !Read_s( file, ( char* ) buf, 2, 2 ) ) + if( !stream->read( ( char* ) buf, 2 ) ) return false; if( buf[ 0 ] > 128 ) @@ -126,7 +113,7 @@ *I++ = buf[ 1 ]; if( --count > 0 ) { - if( !Read_s( file, ( char* ) I, count, count ) ) + if( !stream->read( ( char* ) I, count ) ) return false; } @@ -151,7 +138,7 @@ return true; } - bool read_hdr_header( fs::ifstream& file, RgbeInfo& info, int& width, int& height ) + bool read_hdr_header( pl::stream_ptr stream, RgbeInfo& info, int& width, int& height ) { info.valid = 0; memset( info.program_type, 0, sizeof( info.program_type ) ); @@ -161,8 +148,7 @@ char buffer[ 128 ]; - file.getline( buffer, 128 ); - if( file.fail( ) ) + if( !stream->getline( buffer, 128 ) ) return false; if( buffer[ 0 ] != '#' || buffer[ 1 ] != '?' ) @@ -177,8 +163,7 @@ info.program_type[ i ] = buffer[ i + 2 ]; } - file.getline( buffer, 128 ); - if( file.fail( ) ) + if( !stream->getline( buffer, 128 ) ) return false; for( ;; ) @@ -208,13 +193,12 @@ info.valid |= RGBE_VALID_EXPOSURE; } - file.getline( buffer, 128 ); + stream->getline( buffer, 128 ); if( !strlen( buffer ) ) break; } - file.getline( buffer, 128 ); - if( file.fail( ) ) + if( !stream->getline( buffer, 128 ) ) return false; #if _MSC_VER >= 1400 @@ -227,32 +211,30 @@ return true; } - il::image_type_ptr load_hdr( const fs::path& path ) + il::image_type_ptr load_hdr( pl::stream_ptr stream ) { - fs::ifstream file( path, std::ios::in | std::ios::binary ); - if( !file.is_open( ) ) + if( stream->is_null( ) ) return il::image_type_ptr( ); int width, height; RgbeInfo rgbe_info; - if( !read_hdr_header( file, rgbe_info, width, height ) ) + if( !read_hdr_header( stream, rgbe_info, width, height ) ) return il::image_type_ptr( ); il::image_type_ptr image = il::allocate( L"rgbe", width, height ); if( !image ) return il::image_type_ptr( ); - if( !read_rgbe_pixels( file, image, width, height ) ) + if( !read_rgbe_pixels( stream, image, width, height ) ) return il::image_type_ptr( ); return image; } - bool store_hdr( const fs::path& path, const il::image_type_ptr& im ) + bool store_hdr( pl::stream_ptr stream, const il::image_type_ptr& im ) { - fs::ofstream file( path, std::ios::out | std::ios::binary ); - if( !file.is_open( ) ) + if( stream->is_null( ) ) return false; il::image_type_ptr dst = il::convert( im, L"rgbe" ); @@ -262,15 +244,20 @@ il::image_type::size_type height = dst->height( ); // write header. - file << "#?RGBE\nGAMMA=1.0\nEXPOSURE=1.0\nFORMAT=32-bit_rle_rgbe\n\n"; - file << "-Y " << height << "+X " << width << "\n"; + std::ostringstream buf; + buf << "#?RGBE\nGAMMA=1.0\nEXPOSURE=1.0\nFORMAT=32-bit_rle_rgbe\n\n"; + stream->write( buf.str( ).c_str( ), buf.str( ).size( ) ); + buf.clear( ); + buf << "-Y " << height << "+X " << width << "\n"; + stream->write( buf.str( ).c_str( ), buf.str( ).size( ) ); + il::image_type::const_pointer data = dst->data( ); il::image_type::size_type pitch = dst->pitch( ); while( height-- ) { - file.write( ( char* ) data, dst->linesize( ) ); + stream->write( ( char* ) data, dst->linesize( ) ); data += pitch; } } @@ -281,11 +268,11 @@ struct hdr_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const boost::filesystem::path& path ) - { return load_hdr( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_hdr( stream ); } - virtual bool store( const boost::filesystem::path& path, const il::image_type_ptr& im ) - { return store_hdr( path, im ); } + virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& im ) + { return store_hdr( stream, im ); } }; } } } Modified: trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/jpg/jpg_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -15,7 +15,7 @@ #include <openimagelib/il/openimagelib_plugin.hpp> -extern "C" { +extern "C" { #include <jpeglib.h> } @@ -25,24 +25,126 @@ #endif namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { namespace { - FILE* Fopen_s( const pl::string& path, const char* mode ) + struct olib_jpeg_source_mgr { -#if _MSC_VER >= 1400 - FILE* file; - fopen_s( &file, path.c_str( ), mode ); - return file; -#else - return fopen( path.c_str( ), mode ); -#endif + struct jpeg_source_mgr pub; + + pl::stream_ptr stream; + JOCTET* buffer; + boolean start_of_file; + }; + + typedef olib_jpeg_source_mgr* olib_jpeg_source_mgr_ptr; + + extern "C" void init_source( j_decompress_ptr cinfo ) + { + olib_jpeg_source_mgr_ptr src = ( olib_jpeg_source_mgr_ptr ) cinfo->src; + src->start_of_file = TRUE; } + + extern "C" boolean fill_input_buffer( j_decompress_ptr cinfo ) + { + olib_jpeg_source_mgr_ptr src = ( olib_jpeg_source_mgr_ptr ) cinfo->src; + + src->pub.next_input_byte = ( JOCTET* ) src->stream->data( ); + src->pub.bytes_in_buffer = src->stream->max_size( ); + src->start_of_file = FALSE; + + return TRUE; + } + + extern "C" void skip_input_data( j_decompress_ptr cinfo, long num_bytes ) + { + olib_jpeg_source_mgr_ptr src = ( olib_jpeg_source_mgr_ptr ) cinfo->src; + + src->pub.next_input_byte += static_cast<std::size_t>( num_bytes ); + src->pub.bytes_in_buffer -= static_cast<std::size_t>( num_bytes ); + } + + extern "C" void term_source( j_decompress_ptr ) + { + } + void jpeg_oil_stream_src( j_decompress_ptr cinfo, pl::stream_ptr stream ) + { + olib_jpeg_source_mgr_ptr src = 0; + + if( cinfo->src == NULL ) + { + cinfo->src = ( jpeg_source_mgr* ) ( *cinfo->mem->alloc_small )( ( j_common_ptr ) cinfo, JPOOL_PERMANENT, sizeof( olib_jpeg_source_mgr ) ); + memset( cinfo->src, 0, sizeof( olib_jpeg_source_mgr ) ); + } + + src = ( olib_jpeg_source_mgr_ptr ) cinfo->src; + src->stream = stream; + src->buffer = ( JOCTET* ) stream->data( ); + src->pub.init_source = init_source; + src->pub.fill_input_buffer = fill_input_buffer; + src->pub.skip_input_data = skip_input_data; + src->pub.resync_to_restart = jpeg_resync_to_restart; + src->pub.term_source = term_source; + src->pub.bytes_in_buffer = 0; + src->pub.next_input_byte = NULL; + } + + struct olib_jpeg_destination_mgr + { + struct jpeg_destination_mgr pub; + + pl::stream_ptr stream; + JOCTET* buffer; + }; + + typedef olib_jpeg_destination_mgr* olib_jpeg_destination_mgr_ptr; + + extern "C" void init_destination( j_compress_ptr cinfo ) + { + olib_jpeg_destination_mgr_ptr dest = ( olib_jpeg_destination_mgr_ptr ) cinfo->dest; + + dest->buffer = ( JOCTET* ) ( *cinfo->mem->alloc_small )( ( j_common_ptr ) cinfo, JPOOL_IMAGE, dest->stream->max_size( ) ); + dest->pub.next_output_byte = dest->buffer; + dest->pub.free_in_buffer = dest->stream->max_size( ); + } + + extern "C" boolean empty_output_buffer( j_compress_ptr cinfo ) + { + olib_jpeg_destination_mgr_ptr dest = ( olib_jpeg_destination_mgr_ptr ) cinfo->dest; + + dest->stream->write( ( pl::stream::const_pointer ) dest->buffer, dest->pub.free_in_buffer ); + + dest->pub.next_output_byte = dest->buffer; + dest->pub.free_in_buffer = dest->stream->max_size( ); + + return TRUE; + } + + extern "C" void term_destination( j_compress_ptr ) + { + } + + void jpeg_oil_stream_dest( j_compress_ptr cinfo, pl::stream_ptr stream ) + { + olib_jpeg_destination_mgr_ptr dest = 0; + + if( cinfo->dest == NULL ) + { + cinfo->dest = ( jpeg_destination_mgr* ) ( *cinfo->mem->alloc_small )( ( j_common_ptr ) cinfo, JPOOL_PERMANENT, sizeof( olib_jpeg_destination_mgr ) ); + memset( cinfo->dest, 0, sizeof( olib_jpeg_destination_mgr ) ); + } + + dest = ( olib_jpeg_destination_mgr_ptr ) cinfo->dest; + dest->pub.init_destination = init_destination; + dest->pub.empty_output_buffer = empty_output_buffer; + dest->pub.term_destination = term_destination; + dest->stream = stream; + } + void destroy( il::image_type* im ) { delete im; } @@ -84,10 +186,9 @@ } #endif - il::image_type_ptr load_jpg( const boost::filesystem::path& path ) + il::image_type_ptr load_jpg( pl::stream_ptr stream ) { - FILE* infile = Fopen_s( path.native_directory_string( ), "rb" ); - if( infile == NULL ) return il::image_type_ptr( ); + if( stream->is_null( ) ) return il::image_type_ptr( ); // TODO: some proper exception handling is needed. can't really be bothered // with that setjmp thingie... @@ -107,7 +208,7 @@ #ifdef HAVE_JPEGHDR jpeghdr_create_decompress( &info ); - jpeg_stdio_src( &info.cinfo, infile ); + jpeg_oil_stream_src( &info.cinfo, stream ); switch( jpeghdr_read_header( &info ) ) { @@ -125,7 +226,7 @@ } #else jpeg_create_decompress( &info ); - jpeg_stdio_src( &info, infile ); + jpeg_oil_stream_src( &info.cinfo, stream ); jpeg_read_header( &info, TRUE ); jpeg_start_decompress( &info ); #endif @@ -152,27 +253,23 @@ read_jpeg( &info, pixels, image->pitch( ) ); #endif - fclose( infile ); - return image; } - bool store_jpg( const boost::filesystem::path& path, il::image_type_ptr img ) + bool store_jpg( pl::stream_ptr stream, il::image_type_ptr img ) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; - FILE *out = Fopen_s( path.native_directory_string( ), "wb" ); - il::image_type_ptr image = il::convert( img, L"r8g8b8" ); image = il::conform( image, 0 ); - if ( out != NULL ) + if ( !stream->is_null( ) ) { il::image_type::pointer line = image->data( ); cinfo.err = jpeg_std_error( &jerr ); jpeg_create_compress( &cinfo ); - jpeg_stdio_dest( &cinfo, out ); + jpeg_oil_stream_dest( &cinfo, stream ); cinfo.image_width = image->width( ); cinfo.image_height = image->height( ); cinfo.input_components = 3; @@ -184,7 +281,6 @@ for ( int i = 0 ; i < image->height( ); i ++, line += image->pitch( ) ) jpeg_write_scanlines( &cinfo, &line, 1 ); jpeg_finish_compress( &cinfo ); - fclose( out ); jpeg_destroy_compress( &cinfo ); return true; } @@ -196,11 +292,11 @@ class jpg_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const fs::path& path ) - { return load_jpg( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_jpg( stream ); } - virtual bool store( const fs::path& path, const il::image_type_ptr& im ) - { return store_jpg( path, im ); } + virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& im ) + { return store_jpg( stream, im ); } }; } } } Modified: trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/png/png_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -16,7 +16,6 @@ namespace pl = olib::openpluginlib; namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace olib { namespace openimagelib { namespace il { @@ -40,10 +39,10 @@ } } - il::image_type_ptr load_png( const fs::path& path ) + il::image_type_ptr load_png( pl::stream_ptr stream ) { // TODO: some proper exception handling is needed. - FILE* infile = fopen( path.native_directory_string( ).c_str( ), "rb" ); + FILE* infile = fopen( stream->path( ).c_str( ), "rb" ); if( infile == NULL ) return il::image_type_ptr( ); png_byte sig[ 8 ]; @@ -100,10 +99,10 @@ struct png_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const fs::path& path ) - { return load_png( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_png( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/psd/psd_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -9,13 +9,10 @@ #include <vector> #include <string> -#include <boost/filesystem/fstream.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> namespace pl = olib::openpluginlib; namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace olib { namespace openimagelib { namespace il { @@ -26,17 +23,6 @@ bool is_psd_header( const std::string& magic ) { return magic == std::string( "8BPS" ); } - - void Read_s( fs::ifstream& file, char* s, std::streamsize size, std::streamsize max ) - { -#if _MSC_VER >= 1400 - file._Read_s( s, size, max ); -#else - file.read( s, size ); -#endif // _MSC_VER >= 1400 - - assert( !file.fail( ) && L"PSD_image_loader::Read_s" ); - } } template<typename T> @@ -47,7 +33,7 @@ long psd_long( T s[ 4 ] ) { return ( s[ 0 ] << 24 ) + ( s[ 1 ] << 16 ) + ( s[ 2 ] << 8 ) + s[ 3 ]; } -il::image_type_ptr load_psd( const fs::path& path ) +il::image_type_ptr load_psd( pl::stream_ptr stream ) { #ifdef WIN32 # pragma pack( push, 1 ) @@ -73,12 +59,11 @@ // TODO: do the equivalent on Linux... #endif // WIN32 - fs::ifstream file( path, std::ios::in | std::ios::binary ); - if( !file.is_open( ) ) + if( stream->is_null( ) ) return il::image_type_ptr( ); PhotoshopHeader head; - Read_s( file, reinterpret_cast<char*>( &head ), sizeof( head ), sizeof( head ) ); + stream->read( reinterpret_cast<char*>( &head ), sizeof( head ) ); if( !is_psd_header( std::string( head.signature, 4 ) ) ) return il::image_type_ptr( ); @@ -88,10 +73,10 @@ class psd_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const fs::path& path ) - { return load_psd( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_psd( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/quicktime/quicktime_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -14,14 +14,12 @@ #include <QuickTime/QuickTimeComponents.h> #endif -#include <boost/filesystem/fstream.hpp> #include <boost/thread/recursive_mutex.hpp> #include <openpluginlib/pl/utf8_utils.hpp> #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; -namespace fs = boost::filesystem; namespace pl = olib::openpluginlib; namespace olib { namespace openimagelib { namespace il { @@ -31,13 +29,13 @@ void destroy( il::image_type* im ) { delete im; } - il::image_type_ptr load_quicktime( const fs::path& path ) + il::image_type_ptr load_quicktime( pl::stream_ptr stream ) { OSStatus err; FSSpec fsspec; #ifdef WIN32 - err = NativePathNameToFSSpec( const_cast<char*>( path.native_file_string( ).c_str( ) ), &fsspec, kErrorIfFileNotFound ); + err = NativePathNameToFSSpec( const_cast<char*>( stream->path( ).c_str( ) ), &fsspec, kErrorIfFileNotFound ); #else FSRef ref; err = FSPathMakeRef( ( const UInt8* ) ( path.native_file_string( ) ).c_str( ), &ref, 0 ); @@ -117,10 +115,10 @@ struct qt_plugin : public il::openimagelib_plugin { - virtual il::image_type_ptr load( const fs::path& path ) - { return load_quicktime( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_quicktime( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr stream, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/sgi/sgi_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -9,13 +9,10 @@ #include <vector> #include <string> -#include <boost/filesystem/fstream.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> namespace il = olib::openimagelib::il; namespace pl = olib::openpluginlib; -namespace fs = boost::filesystem; namespace olib { namespace openimagelib { namespace il { @@ -44,7 +41,7 @@ unsigned int t1 = *ptr++; unsigned int t2 = *ptr++; - *array++ = ( t1 << 8 ) | t2; + *array++ = static_cast<unsigned short>( ( t1 << 8 ) | t2 ); } } @@ -63,17 +60,6 @@ } } - bool Read_s( fs::ifstream& file, char* s, std::streamsize size, std::streamsize max ) - { -#if _MSC_VER >= 1400 - file._Read_s( s, size, max ); -#else - file.read( s, size ); -#endif // _MSC_VER >= 1400 - - return !file.fail( ); - } - il::image_type_ptr sgi_image_type_to_image_type( int /*dimension*/, int channels, int width, int height ) { typedef il::image<unsigned char, il::r8g8b8> r8g8b8_image_type; @@ -102,15 +88,15 @@ return il::image_type_ptr( ); } - bool read_row( fs::ifstream& file, SGI_image& di, unsigned char* buf, int y, int z ) + bool read_row( pl::stream_ptr stream, SGI_image& di, unsigned char* buf, int y, int z ) { if( ( di.type & 0xFF00 ) == 0x0100 ) { std::vector<unsigned char> tmp; tmp.resize( di.row_size[ y + z * di.ysize ] ); - file.rdbuf( )->pubseekoff( di.row_start[ y + z * di.ysize ], std::ios::beg ); - if( !Read_s( file, reinterpret_cast<char*>( &tmp[ 0 ] ), di.row_size[ y + z * di.ysize ], di.row_size[ y + z * di.ysize ] ) ) return false; + stream->seek( di.row_start[ y + z * di.ysize ], std::ios::beg ); + stream->read( reinterpret_cast<char*>( &tmp[ 0 ] ), di.row_size[ y + z * di.ysize ] ); unsigned char* s = &tmp[ 0 ]; unsigned char* t = buf; @@ -135,14 +121,14 @@ } else { - file.rdbuf( )->pubseekoff( 512 + ( y * di.xsize ) + ( z * di.xsize * di.ysize ), std::ios::beg ); - if( !Read_s( file, reinterpret_cast<char*>( buf ), di.xsize, di.xsize ) ) return false; + stream->seek( 512 + ( y * di.xsize ) + ( z * di.xsize * di.ysize ), std::ios::beg ); + stream->read( reinterpret_cast<char*>( buf ), di.xsize ); } return true; } - il::image_type_ptr load_sgi( const fs::path& path ) + il::image_type_ptr load_sgi( pl::stream_ptr stream ) { SGI_image di; @@ -150,10 +136,9 @@ big_endian_test.i = 1; bool is_big_endian = big_endian_test.c[ 0 ] == 1; - fs::ifstream file( path, std::ios::in | std::ios::binary ); - if( !file.is_open( ) ) return il::image_type_ptr( ); + if( stream->is_null( ) ) return il::image_type_ptr( ); - if( !Read_s( file, reinterpret_cast<char*>( &di ), 12, 12 ) ) + if( !stream->read( reinterpret_cast<char*>( &di ), 12 ) ) return il::image_type_ptr( ); if( is_big_endian ) @@ -173,12 +158,10 @@ di.rle_end = 512 + ( 2 * size ); - file.rdbuf( )->pubseekoff( 512, std::ios::beg ); + stream->seek( 512, std::ios::beg ); - if( !Read_s( file, reinterpret_cast<char*>( &di.row_start[ 0 ] ), size, size ) ) - return il::image_type_ptr( ); - if( !Read_s( file, reinterpret_cast<char*>( &di.row_size[ 0 ] ), size, size ) ) - return il::image_type_ptr( ); + stream->read( reinterpret_cast<char*>( &di.row_start[ 0 ] ), size ); + stream->read( reinterpret_cast<char*>( &di.row_size[ 0 ] ), size ); if( is_big_endian ) { @@ -199,10 +182,10 @@ { if( di.zsize >= 4 ) { - if( !read_row( file, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); - if( !read_row( file, di, &g[ 0 ], y, 1 ) ) return il::image_type_ptr( ); - if( !read_row( file, di, &b[ 0 ], y, 2 ) ) return il::image_type_ptr( ); - if( !read_row( file, di, &a[ 0 ], y, 3 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &g[ 0 ], y, 1 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &b[ 0 ], y, 2 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &a[ 0 ], y, 3 ) ) return il::image_type_ptr( ); unsigned char* rptr = &r[ 0 ]; unsigned char* gptr = &g[ 0 ]; @@ -222,9 +205,9 @@ } else if( di.zsize == 3 ) { - if( !read_row( file, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); - if( !read_row( file, di, &g[ 0 ], y, 1 ) ) return il::image_type_ptr( ); - if( !read_row( file, di, &b[ 0 ], y, 2 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &g[ 0 ], y, 1 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &b[ 0 ], y, 2 ) ) return il::image_type_ptr( ); unsigned char* rptr = &r[ 0 ]; unsigned char* gptr = &g[ 0 ]; @@ -242,8 +225,8 @@ } else if( di.zsize == 2 ) { - if( !read_row( file, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); - if( !read_row( file, di, &a[ 0 ], y, 1 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &a[ 0 ], y, 1 ) ) return il::image_type_ptr( ); unsigned char* rptr = &r[ 0 ]; unsigned char* aptr = &a[ 0 ]; @@ -259,7 +242,7 @@ } else { - if( !read_row( file, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); + if( !read_row( stream, di, &r[ 0 ], y, 0 ) ) return il::image_type_ptr( ); unsigned char* rptr = &r[ 0 ]; long n = di.xsize; @@ -281,10 +264,10 @@ class sgi_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const fs::path& path ) - { return load_sgi( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_sgi( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/tga/tga_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -12,12 +12,8 @@ #include <vector> #include <string> -#include <boost/filesystem/fstream.hpp> -#include <boost/filesystem/path.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> -namespace fs = boost::filesystem; namespace il = olib::openimagelib::il; namespace pl = olib::openpluginlib; @@ -28,17 +24,6 @@ void destroy( il::image_type* im ) { delete im; } - bool Read_s( fs::ifstream& file, char* s, std::streamsize size, std::streamsize max ) - { -#if _MSC_VER >= 1400 - file._Read_s( s, size, max ); -#else - file.read( s, size ); -#endif // _MSC_VER >= 1400 - - return !file.fail( ); - } - il::image_type_ptr tga_image_type_to_image_type( unsigned char type, unsigned char bpp, int width, int height ) { typedef il::image<unsigned char, il::b8g8r8> b8g8r8_image_type; @@ -65,7 +50,7 @@ } } - il::image_type_ptr load_tga( const fs::path& path ) + il::image_type_ptr load_tga( pl::stream_ptr stream ) { #ifdef WIN32 #pragma pack( push, 1 ) @@ -110,20 +95,8 @@ // TODO: do the equivalent on Linux... #endif // WIN32 - fs::ifstream file( path, std::ios::in | std::ios::binary ); - if( !file.is_open( ) ) - return il::image_type_ptr( ); + const char* data = stream->data( ); - std::ios::pos_type beg = file.rdbuf( )->pubseekoff( 0, std::ios::beg ); - std::ios::pos_type end = file.rdbuf( )->pubseekoff( 0, std::ios::end ); - file.rdbuf( )->pubseekoff( 0, std::ios::beg ); - - std::vector<char> stream_data; - stream_data.resize( end - beg ); - Read_s( file, &stream_data[ 0 ], end - beg, end - beg ); - - const char* data = &stream_data[ 0 ]; - TgaHeader head; head = *( ( TgaHeader* ) data ); data += sizeof( TgaHeader ); @@ -249,10 +222,10 @@ class tga_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const fs::path& path ) - { return load_tga( path ); } - - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_tga( stream ); } + + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -10,12 +10,8 @@ #include <tiffio.h> -#include <boost/filesystem/fstream.hpp> -#include <boost/filesystem/path.hpp> - #include <openimagelib/il/openimagelib_plugin.hpp> -namespace fs = boost::filesystem; namespace il = olib::openimagelib::il; namespace pl = olib::openpluginlib; @@ -33,9 +29,9 @@ return il::image_type_ptr( ); } - il::image_type_ptr load_tiff( const fs::path& path ) + il::image_type_ptr load_tiff( pl::stream_ptr stream ) { - struct tiff* tif = TIFFOpen( path.native_file_string( ).c_str( ), "r" ); + struct tiff* tif = TIFFOpen( stream->path( ).c_str( ), "r" ); if( tif == NULL ) return il::image_type_ptr( ); @@ -125,10 +121,10 @@ class tiff_plugin : public il::openimagelib_plugin { public: - virtual il::image_type_ptr load( const fs::path& path ) - { return load_tiff( path ); } + virtual il::image_type_ptr load( pl::stream_ptr stream ) + { return load_tiff( stream ); } - virtual bool store( const fs::path&, const il::image_type_ptr& ) + virtual bool store( pl::stream_ptr, const il::image_type_ptr& ) { return false; } }; Modified: trunk/lib/openlibraries/src/openimagelib/py/il.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/py/il.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openimagelib/py/il.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -22,7 +22,7 @@ if( !plug ) return il::image_type_ptr( ); - il::image_type_ptr image = plug->load( fs::path( path, fs::native ) ); + il::image_type_ptr image = plug->load( opl::make_stream( path, std::ios::in ) ); if( !image ) return il::image_type_ptr( ); Modified: trunk/lib/openlibraries/src/openmedialib/plugins/oil/oil_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openmedialib/plugins/oil/oil_plugin.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openmedialib/plugins/oil/oil_plugin.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -328,7 +328,7 @@ if ( full != last_image_name_ ) { last_image_name_ = full; - last_image_ = plug_->load( fs::path( full.c_str( ), fs::native ) ); + last_image_ = plug_->load( pl::make_stream( full, std::ios::in ) ); if ( last_image_ ) last_image_->set_writable( false ); } @@ -338,7 +338,7 @@ { if ( bucket_[ index ] == image_type_ptr( ) ) { - image_type_ptr image = plug_->load( fs::path( full.c_str( ), fs::native ) ); + image_type_ptr image = plug_->load( pl::make_stream( full, std::ios::in) ); if ( image ) { bucket_[ index ] = image; @@ -473,9 +473,9 @@ discovery plugins( query ); if ( plugins.size( ) == 0 ) return false; discovery::const_iterator i = plugins.begin( ); - boost::shared_ptr<il::openimagelib_plugin>plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); + il::openimagelib_plugin_ptr plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); if ( plug == 0 ) return false; - return plug->store( out.str( ), image ); + return plug->store( pl::make_stream( out, std::ios::out ), image ); } private: Modified: trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp =================================================================== --- trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -144,7 +144,7 @@ il::openimagelib_plugin_ptr plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); if( !plug ) return false; - im_ = plug->load( path ); + im_ = plug->load( opl::make_stream( path.native_file_string( ), std::ios::in ) ); if( !im_ ) return false; if( !opl::is_compressed_format( im_->pf( ).c_str( ) ) && im_->count( ) == 1 && im_->depth( ) == 1 ) Modified: trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -130,30 +130,4 @@ return false; } -bool proxy_texture_target( size_t width, size_t height, GLenum& target, bool force_2_0_targets ) -{ - if( ( ( GLEW_VERSION_2_0 || GLEW_ARB_texture_non_power_of_two ) && force_2_0_targets ) || ( !( width & ( width - 1 ) ) ) && ( !( height & ( height - 1 ) ) ) ) - { - target = GL_PROXY_TEXTURE_2D; - return true; - } - else if( GLEW_ARB_texture_rectangle ) - { - target = GL_PROXY_TEXTURE_RECTANGLE_ARB; - return true; - } - else if( GLEW_EXT_texture_rectangle ) - { - target = GL_PROXY_TEXTURE_RECTANGLE_EXT; - return true; - } - else if( GLEW_NV_texture_rectangle ) - { - target = GL_PROXY_TEXTURE_RECTANGLE_NV; - return true; - } - - return false; -} - } } Modified: trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.hpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openpluginlib/pl/GL_utility.hpp 2007-07-03 23:02:52 UTC (rev 168) @@ -21,7 +21,6 @@ OPENPLUGINLIB_DECLSPEC bool is_compressed_format( const wstring& pf ); OPENPLUGINLIB_DECLSPEC bool is_yuv_format( const wstring& pf ); OPENPLUGINLIB_DECLSPEC bool texture_target( size_t width, size_t height, GLenum& target, float& tex_w, float& tex_h, bool force_2_0_targets = false ); -OPENPLUGINLIB_DECLSPEC bool proxy_texture_target( size_t width, size_t height, GLenum& target, bool force_2_0_targets = false ); } } Modified: trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openpluginlib/pl/Makefile.am 2007-07-03 23:02:52 UTC (rev 168) @@ -44,10 +44,11 @@ flex_string_shell.h \ simplestringstorage.h \ smallstringopt.h \ + stream.hpp \ + stream.cpp \ vectorstringstorage.h \ GL_utility.hpp \ GL_utility.cpp \ - string.hpp \ cg.hpp \ cg.cpp \ pcos/key.hpp \ @@ -106,18 +107,11 @@ string.hpp \ timer.hpp \ shader_manager.hpp \ - allocatorstringstorage.h \ - cowstringopt.h \ - flex_string_details.h \ - flex_string.h \ - flex_string_shell.h \ - simplestringstorage.h \ - smallstringopt.h \ - vectorstringstorage.h \ geometry.hpp \ cg.hpp \ GL_utility.hpp \ string.hpp \ + stream.hpp \ pcos/key.hpp \ pcos/observer.hpp \ pcos/iproperty_container.hpp \ Modified: trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp 2007-06-30 16:50:29 UTC (rev 167) +++ trunk/lib/openlibraries/src/openpluginlib/pl/stream.cpp 2007-07-03 23:02:52 UTC (rev 168) @@ -3,15 +3,121 @@ // Copyright (C) 2007 Goncalo Nuno M. de Carvalho // Released under the LGPL. -// For more information, see http://www.openlibraries.org. +// For more information, see http://www.cryogenicgraphics.com/hdrflow. +#include <boost/filesystem/operations.hpp> + +#include <openpluginlib/pl/utf8_utils.hpp> #include <openpluginlib/pl/stream.hpp> +namespace fs = boost::filesystem; + namespace olib { namespace openpluginlib { -stream_ptr make_stream( const string&, int ) +stream::stream( const string& path, std::ios::openmode flags, std::size_t max_size ) + : data_( 0 ) + , offset_( 0 ) + , max_size_( max_size ) + , flags_( flags ) + , path_( path ) { - return stream_ptr( ); + fs::path fs_path( path.c_str( ), fs::native ); + if( fs::exists( fs_path ) ) + { + mapped_.open( fs_path.native_file_string( ), flags ); + if( mapped_.is_open( ) ) + { + if( ( flags_ && std::ios::out ) != 0 )data_ = const_cast<char*>( mapped_.const_data( ) ); + else data_ = mapped_.data( ); + + max_size_ = mapped_.size( ); + } + } } +stream::~stream( ) +{ + if( mapped_.is_open( ) ) + { + data_ = 0; + offset_ = 0; + flags_ = 0; + mapped_.close( ); + } +} + +std::size_t stream::read( stream::pointer data, std::size_t bytes ) +{ + bytes = actual_bytes( bytes ); + + memcpy( data, data_ + offset_, bytes ); + offset_ += bytes; + + return bytes; +} + +std::size_t stream::write( stream::const_pointer data, std::size_t bytes ) +{ + bytes = actual_bytes( bytes ); + + memcpy( data_ + offset_, data, bytes ); + offset_ += bytes; + + return bytes; +} + +void stream::seek( std::size_t bytes, std::ios::seekdir flags ) +{ + if( flags == std::ios::beg ) + offset_ = bytes; + else if( flags == std::ios::cur ) + offset_ += bytes; + else if( flags == std::ios::end ) + offset_ = max_size_ - bytes; +} + +std::size_t stream::getline( pointer data, std::size_t bytes ) +{ + bytes = actual_bytes( bytes ); + + std::size_t i = 0; + for( ; *( data_ + i ) != '\n' && i < bytes; ++i ) + *data++ = *( data_ + i ); + + if( *( data_ + i ) == '\n' ) + ++i; +... [truncated message content] |
From: <gl...@us...> - 2007-06-30 16:50:32
|
Revision: 167 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=167&view=rev Author: glslang Date: 2007-06-30 09:50:29 -0700 (Sat, 30 Jun 2007) Log Message: ----------- + adds a controller and open panel Modified Paths: -------------- trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj Added Paths: ----------- trunk/app/HDRFlow/HDRFlowController.h trunk/app/HDRFlow/HDRFlowController.m Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib 2007-06-27 19:24:48 UTC (rev 166) +++ trunk/app/HDRFlow/English.lproj/MainMenu.nib/classes.nib 2007-06-30 16:50:29 UTC (rev 167) @@ -1,7 +1,12 @@ { IBClasses = ( {CLASS = CustomOpenGLView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {fileOpen = id; }; + CLASS = HDRFlowController; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, {CLASS = ViewportOpenGLView; LANGUAGE = ObjC; SUPERCLASS = CustomOpenGLView; } ); IBVersion = 1; Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib =================================================================== --- trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-06-27 19:24:48 UTC (rev 166) +++ trunk/app/HDRFlow/English.lproj/MainMenu.nib/info.nib 2007-06-30 16:50:29 UTC (rev 167) @@ -3,17 +3,16 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>472 85 356 240 0 0 1440 878 </string> + <string>66 363 356 240 0 0 1440 878 </string> <key>IBEditorPositions</key> <dict> <key>29</key> - <string>109 299 290 44 0 0 1440 878 </string> + <string>2 829 290 44 0 0 1440 878 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> <array> - <integer>21</integer> <integer>29</integer> </array> <key>IBSystem Version</key> Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj =================================================================== --- trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-06-27 19:24:48 UTC (rev 166) +++ trunk/app/HDRFlow/HDRFlow.xcodeproj/project.pbxproj 2007-06-30 16:50:29 UTC (rev 167) @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */; }; + 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */; }; 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */; }; 67DC62180C2EC0D9005CFE6E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; @@ -26,6 +27,8 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 32CA4F630368D1EE00C91783 /* HDRFlow_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDRFlow_Prefix.pch; sourceTree = "<group>"; }; 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CustomOpenGLView.m; sourceTree = "<group>"; }; + 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>"; }; 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>"; }; 67DC62170C2EC0D9005CFE6E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; @@ -54,6 +57,8 @@ 678A4AA60C2B18B50011E9F7 /* CustomOpenGLView.m */, 67DC61B10C2EAB5E005CFE6E /* ViewportOpenGLView.h */, 67DC61B80C2EAC94005CFE6E /* ViewportOpenGLView.m */, + 67BD59C70C36BE3600F0F7DF /* HDRFlowController.h */, + 67BD59C80C36BE3700F0F7DF /* HDRFlowController.m */, ); name = Classes; sourceTree = "<group>"; @@ -181,6 +186,7 @@ 8D11072D0486CEB800E47090 /* main.m in Sources */, 678A4AA70C2B18B50011E9F7 /* CustomOpenGLView.m in Sources */, 67DC61B90C2EAC94005CFE6E /* ViewportOpenGLView.m in Sources */, + 67BD59C90C36BE3700F0F7DF /* HDRFlowController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Added: trunk/app/HDRFlow/HDRFlowController.h =================================================================== --- trunk/app/HDRFlow/HDRFlowController.h (rev 0) +++ trunk/app/HDRFlow/HDRFlowController.h 2007-06-30 16:50:29 UTC (rev 167) @@ -0,0 +1,20 @@ + +// 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 HDRFlowController : NSObject +{ +} + +- ( BOOL ) acceptsFirstResponder; +- ( BOOL ) becomesFirstResponder; +- ( BOOL ) resignFirstResponder; + +- ( IBAction ) fileOpen: ( id ) sender; + +@end Added: trunk/app/HDRFlow/HDRFlowController.m =================================================================== --- trunk/app/HDRFlow/HDRFlowController.m (rev 0) +++ trunk/app/HDRFlow/HDRFlowController.m 2007-06-30 16:50:29 UTC (rev 167) @@ -0,0 +1,55 @@ + +// 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 "HDRFlowController.h" + +@implementation HDRFlowController + +#pragma mark ---- IB actions ---- + +- ( IBAction ) fileOpen: ( id ) sender +{ + NSOpenPanel* openPanel = [ NSOpenPanel openPanel ]; + + [ openPanel setCanChooseDirectories: YES ]; + [ openPanel setCanChooseFiles: YES ]; + [ openPanel setAllowsMultipleSelection: YES ]; + + NSArray* fileTypes = [ NSArray arrayWithObjects:@"exr", @"jpg", nil ]; + + [ openPanel beginSheetForDirectory: nil + file: nil + types: fileTypes + modalForWindow: [ NSApp mainWindow ] + modalDelegate: self + didEndSelector: @selector( openPanelDidEnd: returnCode: contextInfo: ) + contextInfo: nil ]; +} + +- ( void ) openPanelDidEnd: ( NSOpenPanel* ) panel returnCode: ( int ) rc contextInfo: ( void* ) ctx +{ + if( rc == NSOKButton ) + { + } +} + +- ( BOOL ) acceptsFirstResponder +{ + return YES; +} + +- ( BOOL ) becomesFirstResponder +{ + return YES; +} + +- ( BOOL ) resignFirstResponder +{ + return YES; +} + +@end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-06-27 19:24:54
|
Revision: 166 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=166&view=rev Author: glslang Date: 2007-06-27 12:24:48 -0700 (Wed, 27 Jun 2007) Log Message: ----------- + cleanup after the sort mess Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp Modified: trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-25 21:01:22 UTC (rev 165) +++ trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-27 19:24:48 UTC (rev 166) @@ -138,7 +138,7 @@ : public std::binary_function<detail::discover_query_impl::plugin_proxy, detail::discover_query_impl::plugin_proxy, bool> { bool operator( )( const detail::discover_query_impl::plugin_proxy& x, const detail::discover_query_impl::plugin_proxy& y ) const - { return !( x.merit( ) < y.merit( ) ) && x.name( ) < y.name( ) && x.type( ) < y.type( ); } + { return x.merit( ) > y.merit( ); } }; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-06-25 21:01:24
|
Revision: 165 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=165&view=rev Author: glslang Date: 2007-06-25 14:01:22 -0700 (Mon, 25 Jun 2007) Log Message: ----------- + cleanup Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp Modified: trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-25 20:57:56 UTC (rev 164) +++ trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-25 21:01:22 UTC (rev 165) @@ -74,15 +74,6 @@ plugin_item item_; }; - private: - struct equals : std::binary_function<plugin_proxy, plugin_proxy, bool> - { - bool operator( )( const plugin_proxy& x, const plugin_proxy& y ) const - { - return x.name( ) == y.name( ) && x.type( ) == y.type( ); - } - }; - public: typedef std::vector<plugin_proxy> container; typedef container::const_iterator const_iterator; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-06-25 20:58:22
|
Revision: 164 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=164&view=rev Author: glslang Date: 2007-06-25 13:57:56 -0700 (Mon, 25 Jun 2007) Log Message: ----------- + changes to proper use discovery plugin item within an STL container Modified Paths: -------------- trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.cpp trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp Modified: trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp =================================================================== --- trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp 2007-06-25 19:09:09 UTC (rev 163) +++ trunk/lib/openlibraries/src/openobjectlib/sg/appearance.cpp 2007-06-25 20:57:56 UTC (rev 164) @@ -141,7 +141,7 @@ if( plugins.empty( ) ) return false; oil_discovery::const_iterator i = plugins.begin( ); - boost::shared_ptr<il::openimagelib_plugin> plug = boost::shared_static_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); + il::openimagelib_plugin_ptr plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) ); if( !plug ) return false; im_ = plug->load( path ); Modified: trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.cpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.cpp 2007-06-25 19:09:09 UTC (rev 163) +++ trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.cpp 2007-06-25 20:57:56 UTC (rev 164) @@ -231,7 +231,7 @@ opl_ptr discover_query_impl::plugin_proxy::create_plugin( const string& options ) const { if( !item_.resolver.dlopened ) - acquire_shared_symbols( item_.resolver, item_.filename ); + acquire_shared_symbols( const_cast<plugin_resolver&>( item_.resolver ), item_.filename ); if( item_.resolver.dlopened ) { Modified: trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-25 19:09:09 UTC (rev 163) +++ trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-25 20:57:56 UTC (rev 164) @@ -44,16 +44,10 @@ class OPENPLUGINLIB_DECLSPEC plugin_proxy { public: - plugin_proxy( plugin_item& item ) + plugin_proxy( plugin_item item ) : item_( item ) { } - plugin_proxy& operator=( const plugin_proxy& rhs ) - { - item_ = rhs.item_; - return *this; - } - opl_ptr create_plugin( const string& options ) const; public: @@ -77,7 +71,7 @@ { return item_.context; } private: - plugin_item& item_; + plugin_item item_; }; private: @@ -111,10 +105,7 @@ template<class StrictWeakOrdering> void sort( const StrictWeakOrdering& comp = StrictWeakOrdering( ) ) - { - std::sort( plugins_.begin( ), plugins_.end( ), comp ); - plugins_.erase( std::unique( plugins_.begin( ), plugins_.end( ), equals( ) ), plugins_.end( ) ); - } + { std::sort( plugins_.begin( ), plugins_.end( ), comp ); } private: container plugins_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-06-25 19:09:11
|
Revision: 163 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=163&view=rev Author: glslang Date: 2007-06-25 12:09:09 -0700 (Mon, 25 Jun 2007) Log Message: ----------- + ensures discovery returns a unique set of sorted plugins Modified Paths: -------------- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp Modified: trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp =================================================================== --- trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-24 20:49:00 UTC (rev 162) +++ trunk/lib/openlibraries/src/openpluginlib/pl/openpluginlib.hpp 2007-06-25 19:09:09 UTC (rev 163) @@ -39,7 +39,7 @@ namespace detail { class OPENPLUGINLIB_DECLSPEC discover_query_impl - { + { public: class OPENPLUGINLIB_DECLSPEC plugin_proxy { @@ -80,6 +80,15 @@ plugin_item& item_; }; + private: + struct equals : std::binary_function<plugin_proxy, plugin_proxy, bool> + { + bool operator( )( const plugin_proxy& x, const plugin_proxy& y ) const + { + return x.name( ) == y.name( ) && x.type( ) == y.type( ); + } + }; + public: typedef std::vector<plugin_proxy> container; typedef container::const_iterator const_iterator; @@ -102,7 +111,10 @@ template<class StrictWeakOrdering> void sort( const StrictWeakOrdering& comp = StrictWeakOrdering( ) ) - { std::sort( plugins_.begin( ), plugins_.end( ), comp ); } + { + std::sort( plugins_.begin( ), plugins_.end( ), comp ); + plugins_.erase( std::unique( plugins_.begin( ), plugins_.end( ), equals( ) ), plugins_.end( ) ); + } private: container plugins_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |