[Hdrflow-svn] SF.net SVN: hdrflow: [226] trunk/app/HDRFlow
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-08-04 18:12:59
|
Revision: 226
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=226&view=rev
Author: glslang
Date: 2007-08-04 11:12:56 -0700 (Sat, 04 Aug 2007)
Log Message:
-----------
+ small refactoring of ScriptEngine to support a bootstrap py script
Modified Paths:
--------------
trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib
trunk/app/HDRFlow/HDRFlowController.h
trunk/app/HDRFlow/HDRFlowController.mm
trunk/app/HDRFlow/ScriptEditorController.h
trunk/app/HDRFlow/ScriptEditorController.mm
Modified: trunk/app/HDRFlow/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/app/HDRFlow/HDRFlowController.h
===================================================================
--- trunk/app/HDRFlow/HDRFlowController.h 2007-08-04 15:50:45 UTC (rev 225)
+++ trunk/app/HDRFlow/HDRFlowController.h 2007-08-04 18:12:56 UTC (rev 226)
@@ -12,13 +12,21 @@
@class ViewportOpenGLView;
@class PreferencesController;
+// forward declaration
+namespace hdrflow { class ScriptEngine; }
+
@interface HDRFlowController : NSObject
{
ScriptEditorController* scriptEditor;
+ PreferencesController* preferences;
+
IBOutlet ViewportOpenGLView* openGLView;
- PreferencesController* preferences;
+
+ hdrflow::ScriptEngine* engine;
}
+- ( id ) init;
+
- ( BOOL ) acceptsFirstResponder;
- ( BOOL ) becomesFirstResponder;
- ( BOOL ) resignFirstResponder;
Modified: trunk/app/HDRFlow/HDRFlowController.mm
===================================================================
--- trunk/app/HDRFlow/HDRFlowController.mm 2007-08-04 15:50:45 UTC (rev 225)
+++ trunk/app/HDRFlow/HDRFlowController.mm 2007-08-04 18:12:56 UTC (rev 226)
@@ -5,12 +5,29 @@
// Released under the GPL.
// For more information, see http://www.cryogenicgraphics.com/hdrflow.
+#import "ScriptEngine.hpp"
+
#import "HDRFlowController.h"
#import "ViewportOpenGLView.h"
#import "PreferencesController.h"
+#import "ScriptEditorController.h"
@implementation HDRFlowController
+- ( id ) init
+{
+ [ super init ];
+ engine = new hdrflow::ScriptEngine( );
+ return self;
+}
+
+- ( void ) dealloc
+{
+ delete engine;
+ [ scriptEditor dealloc ];
+ [ super dealloc ];
+}
+
#pragma mark ---- IB actions ----
- ( void ) openPanelDidEnd: ( NSOpenPanel* ) panel returnCode: ( int ) rc contextInfo: ( void* ) ctx
@@ -42,7 +59,10 @@
- ( IBAction ) scriptEditor: ( id ) sender
{
if( scriptEditor == nil )
+ {
scriptEditor = [ [ ScriptEditorController alloc ] initWithWindowNibName: @"ScriptEditor" ];
+ [ scriptEditor setScriptEngine: engine ];
+ }
[ scriptEditor showWindow: self ];
}
@@ -75,10 +95,4 @@
return YES;
}
-- ( void ) dealloc
-{
- [ scriptEditor dealloc ];
- [ super dealloc ];
-}
-
@end
Modified: trunk/app/HDRFlow/ScriptEditorController.h
===================================================================
--- trunk/app/HDRFlow/ScriptEditorController.h 2007-08-04 15:50:45 UTC (rev 225)
+++ trunk/app/HDRFlow/ScriptEditorController.h 2007-08-04 18:12:56 UTC (rev 226)
@@ -16,9 +16,11 @@
IBOutlet NSTextView* scriptOutput_;
IBOutlet NSTextField* scriptStatus_;
- hdrflow::ScriptEngine* engine_;
+ hdrflow::ScriptEngine* engine;
}
+- ( void ) setScriptEngine: ( hdrflow::ScriptEngine* ) scriptEngine;
+
- ( void ) executeScript;
- ( void ) clearScript;
Modified: trunk/app/HDRFlow/ScriptEditorController.mm
===================================================================
--- trunk/app/HDRFlow/ScriptEditorController.mm 2007-08-04 15:50:45 UTC (rev 225)
+++ trunk/app/HDRFlow/ScriptEditorController.mm 2007-08-04 18:12:56 UTC (rev 226)
@@ -11,6 +11,11 @@
@implementation ScriptEditorController
+- ( void ) setScriptEngine: ( hdrflow::ScriptEngine* ) scriptEngine
+{
+ engine = scriptEngine;
+}
+
#pragma mark ---- IB actions ----
- ( IBAction ) executeScript: ( id ) sender
@@ -25,13 +30,11 @@
- ( id ) initWithWindowNibName: ( NSString* ) windowNibName
{
- engine_ = new hdrflow::ScriptEngine( );
return [ super initWithWindowNibName: windowNibName ];
}
- ( void ) dealloc
{
- delete engine_;
[ super dealloc ];
}
@@ -39,12 +42,12 @@
{
NSString* script = [ scriptEdit_ string ];
- if( engine_->eval( [ script UTF8String ] ) )
+ if( engine->eval( [ script UTF8String ] ) )
[ scriptStatus_ setStringValue: @"Script successful." ];
else
[ scriptStatus_ setStringValue: @"Script failed." ];
- NSString* out = [ [ [ NSString alloc ] initWithUTF8String: engine_->result( ).c_str( ) ] autorelease ];
+ NSString* out = [ [ [ NSString alloc ] initWithUTF8String: engine->result( ).c_str( ) ] autorelease ];
[ scriptOutput_ setEditable: YES ];
[ scriptOutput_ insertText: out ];
[ scriptOutput_ setEditable: NO ];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|