[macruby-changes] [252] MacRuby/trunk/sample-macruby
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 5 17:42:19 PDT 2008
Revision: 252
http://trac.macosforge.org/projects/ruby/changeset/252
Author: lsansonetti at apple.com
Date: 2008-06-05 17:42:18 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
new sample code, ViewModelDemo, ported from RubyCocoa
Modified Paths:
--------------
MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf
Added Paths:
-----------
MacRuby/trunk/sample-macruby/ViewModelDemo/
MacRuby/trunk/sample-macruby/ViewModelDemo/Controller.rb
MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/
MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/InfoPlist.strings
MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/
MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/classes.nib
MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/info.nib
MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/objects.nib
MacRuby/trunk/sample-macruby/ViewModelDemo/Info.plist
MacRuby/trunk/sample-macruby/ViewModelDemo/Superview.rb
MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModel.rb
MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModelDemo.xcodeproj/
MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModelDemo.xcodeproj/project.pbxproj
MacRuby/trunk/sample-macruby/ViewModelDemo/main.m
MacRuby/trunk/sample-macruby/ViewModelDemo/rb_main.rb
Modified: MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf
===================================================================
--- MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf 2008-06-06 00:12:02 UTC (rev 251)
+++ MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf 2008-06-06 00:42:18 UTC (rev 252)
@@ -1,8 +1,8 @@
-{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270
+{\rtf1\ansi\ansicpg1252\cocoartf949
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 LucidaGrande;\f2\froman\fcharset0 Times-Roman;
}
{\colortbl;\red255\green255\blue255;}
-\vieww18720\viewh20420\viewkind0
+\vieww18720\viewh16000\viewkind0
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\li1120\fi-400\ri140\ql\qnatural
\f0\fs30 \cf0 \
@@ -41,6 +41,10 @@
\b PathDemo
\b0 Path operations (circles, rectangles, B\'e9zier paths)\
\
+
+\b ViewModelDemo
+\b0 NSView, NSTimer\
+\
You will also find some standalone scripts in the
\b Scripts
\b0 directory. These \
@@ -48,6 +52,6 @@
\pard\tx960\tx4320\tx5760\tx6720\tx7680\tx8640\tx9600\li4300\fi-3360\ri-1180\ql\qnatural
\cf0 \
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\li960\fi-20\ri-1180\ql\qnatural
-\cf0 The source code of all MacRuby examples is covered by the Ruby license, which can be found online at: {\field{\*\fldinst{HYPERLINK "http://www.ruby-lang.org/en/LICENSE.txt"}}{\fldrslt http://www.ruby-lang.org/en/LICENSE.txt}}\
+\cf0 The source code of all MacRuby examples, unless specified, is covered by the Ruby license, which can be found online at: {\field{\*\fldinst{HYPERLINK "http://www.ruby-lang.org/en/LICENSE.txt"}}{\fldrslt http://www.ruby-lang.org/en/LICENSE.txt}}\
\
}
\ No newline at end of file
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/Controller.rb
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/Controller.rb (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/Controller.rb 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,109 @@
+class Controller
+
+ ib_outlet :mySuperview, :numberText, :speedText, :numberSlider, :speedSlider
+
+ def init
+ super
+
+ @objs = [] # This will hold the ViewModel objects.
+
+ # A global flag to keep track of whether one of the subviews is moving.
+ # There is no particular reason why I used a global instead of a method call
+ # to mySuperview to retrieve an objMoving instance variable. A global
+ # just seems perfectly acceptable for this kind of thing.
+ $objMoving = false
+
+ self
+ end
+
+ def awakeFromNib
+ for n in 0..(@numberSlider.intValue-1)
+ addNewViewModel
+ end
+ end
+
+ def adjustNumberOfViewModels
+ desired = @numberSlider.intValue
+ current = @objs.length
+
+ if current < desired
+ for n in 1..(desired-current)
+ addNewViewModel
+ end
+ end
+
+ if current > desired
+ until @objs.length == desired
+ @objs.last.removeFromSuperview
+ @objs.pop
+ end
+ end
+ end
+
+ def addNewViewModel
+ myRect = getRandomViewRect
+ # Create a new ViewModel object, which is a subclass of NSView.
+ myObj = ViewModel.alloc.initWithFrame myRect
+ # Just for testing, the object knows its number.
+ myObj.setNum @objs.size
+ # Add it to the superview
+ @mySuperview.addSubview myObj
+ # Add it to the array
+ @objs.push myObj
+ end
+
+ ib_action :numberSliderAction do |sender|
+ number = @numberSlider.intValue
+ @numberText.stringValue = "Number: " + number.to_s
+ adjustNumberOfViewModels
+ end
+
+ ib_action :moveButtonAction do |sender|
+ # Assign new destinations to the objects
+ @objs.each do |obj|
+ destPt = getRandomViewPoint
+ obj.setMoveDestination destPt
+ speed = @speedSlider.floatValue
+ obj.setSpeed speed
+ obj.startMovement
+ end
+ end
+
+ ib_action :speedSliderAction do |sender|
+ # No need to store the speed in an instance variable, since the speed is read
+ # right from the control in moveButtonAction. Just update the speed text.
+ speed = @speedSlider.floatValue
+ @objs.each do |obj|
+ if obj.speed > 0 # object is moving
+ obj.setSpeed speed
+ end
+ end
+ speed = speed.to_i
+ @speedText.stringValue = "Speed: " + speed.to_s
+ end
+
+ def getRandomViewRect
+ rx = rand(@mySuperview.bounds.size.width - SQUARE_SIZE)
+ ry = rand(@mySuperview.bounds.size.height - SQUARE_SIZE)
+ NSRect.new(NSPoint.new(rx, ry), NSSize.new(SQUARE_SIZE, SQUARE_SIZE))
+ end
+
+ def getRandomViewPoint
+ rx = rand(@mySuperview.bounds.size.width - SQUARE_SIZE)
+ ry = rand(@mySuperview.bounds.size.height - SQUARE_SIZE)
+ NSPoint.new(rx, ry)
+ end
+
+ def handleEvents
+ app = NSApplication.sharedApplication
+ event = app.nextEventMatchingMask NSAnyEventMask,
+ untilDate:NSDate.dateWithTimeIntervalSinceNow(0.01),
+ inMode:OSX.NSDefaultRunLoopMode,
+ dequeue:true
+ if event
+ # Could put special event handling here.
+ app.sendEvent(event)
+ end
+ end
+
+end
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)
Property changes on: MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/InfoPlist.strings
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/classes.nib
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/classes.nib (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/classes.nib 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,26 @@
+{
+ IBClasses = (
+ {
+ ACTIONS = {moveButtonAction = id; numberSliderAction = id; speedSliderAction = id; };
+ CLASS = Controller;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ mySuperview = id;
+ numberSlider = id;
+ numberText = id;
+ speedSlider = id;
+ speedText = id;
+ };
+ SUPERCLASS = NSObject;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ ACTIONS = {shadowSwitchAction = id; };
+ CLASS = MySuperview;
+ LANGUAGE = ObjC;
+ OUTLETS = {controller = id; moveToTopSwitch = id; shadowSwitch = id; };
+ SUPERCLASS = NSView;
+ }
+ );
+ IBVersion = 1;
+}
\ No newline at end of file
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/info.nib
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/info.nib (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/info.nib 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,22 @@
+<?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>41 53 356 240 0 0 1680 1028 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>29</key>
+ <string>78 576 338 44 0 0 1680 1028 </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>
+ <string>8N1051</string>
+</dict>
+</plist>
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/objects.nib
===================================================================
(Binary files differ)
Property changes on: MacRuby/trunk/sample-macruby/ViewModelDemo/English.lproj/MainMenu.nib/objects.nib
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/Info.plist
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/Info.plist (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/Info.plist 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.ViewModelDemo</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
Property changes on: MacRuby/trunk/sample-macruby/ViewModelDemo/Info.plist
___________________________________________________________________
Name: svn:executable
+ *
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/Superview.rb
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/Superview.rb (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/Superview.rb 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,77 @@
+
+class MySuperview < NSView
+
+ ib_outlet :controller, :shadowSwitch, :moveToTopSwitch
+
+ attr_reader :shadowSwitch, :moveToTopSwitch
+
+ def initWithFrame(frame)
+ super
+ return self
+ end
+
+ def awakeFromNib
+ @timer = nil
+ end
+
+ def drawRect(rect)
+ # Draw the background only since the ViewModel objects (subviews) will
+ # draw themselves automatically.
+ # An appropriate rect passed in to this method will keep objects from
+ # unnecessarily drawing themselves.
+ NSColor.whiteColor.set
+ NSBezierPath.fillRect(rect)
+ end
+
+ def shadowSwitchAction(sender)
+ setNeedsDisplay true
+ end
+
+ def mouseDown(event)
+ puts "MySuperview clicked."
+ end
+
+ def moveSubviewToTop(mySubview)
+ # Moves the given subview to the top, for drawing order purposes
+ addSubview_positioned_relativeTo_(mySubview, NSWindowBelow, subviews.lastObject)
+ end
+
+ def moveSubviewToIndex(mySubview, i)
+ # An index of 0 will move it behind all others
+ addSubview_positioned_relativeTo_(mySubview, NSWindowBelow, subviews.objectAtIndex(i))
+ end
+
+ def startTimer
+ if @timer == nil
+ @timer = NSTimer.scheduledTimerWithTimeInterval 1.0/60.0,
+ target:self,
+ selector:'timerAction',
+ userInfo:nil,
+ repeats:true
+ puts "startTimer"
+ end
+ end
+
+ def timerAction
+ numMoving = 0
+ subviews.each do |sv|
+ # The move function returns 0 if object is not moving, 1 otherwise
+ numMoving += sv.moveToDestination
+ end
+
+ if numMoving == 0
+ endTimer
+ $objMoving = false
+ return
+ end
+
+ setNeedsDisplay true
+ end
+
+ def endTimer
+ puts "endTimer"
+ @timer.invalidate
+ @timer = nil
+ end
+
+end
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModel.rb
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModel.rb (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModel.rb 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,161 @@
+# This is an example of an combination object: model and view. A number of these are
+# created and added to the superview (see Controller).
+
+SQUARE_SIZE = 50
+STROKE_WIDTH = 10
+SHADOW_OFFSET = 5
+SHADOW_BLUR = 3
+
+class ViewModel < NSView
+
+ attr_reader :speed
+
+ def initWithFrame(frame)
+ super
+
+ @stroke = STROKE_WIDTH
+ @color = getRandomColor
+ @speed = 0
+ setupShadows
+ setupDrawRect
+
+ return self
+ end
+
+ def setNum(n)
+ @num = n
+ end
+
+ def setupShadows
+ # The shadow will automagically "mask" any white part in a drawn image.
+ # Shadows also work with drawn paths, but leave room for the shadow in the frame
+ # (if object drawing fills frame, then shadow won't be visible).
+
+ @onShadow = NSShadow.new
+ offset = NSSize.new(SHADOW_OFFSET, -SHADOW_OFFSET)
+ @onShadow.shadowOffset = offset # required to get a shadow.
+ @onShadow.shadowBlurRadius = SHADOW_BLUR # default is 0.
+ # The following is not needed since it matches the default. Change if desired.
+ @onShadow.shadowColor = NSColor.blackColor.colorWithAlphaComponent(0.33)
+
+ # For the off shadow, all that is needed is to create it. It defaults to "no shadow" settings.
+ @offShadow = NSShadow.new
+ end
+
+ def setupDrawRect
+ # The draw rect is smaller than the frame, to leave room for the shadow and the stroke width.
+ @drawRect = NSRect.new(NSPoint.new(@stroke/2, SHADOW_OFFSET + @stroke/2),
+ NSSize.new(bounds.size.width - SHADOW_OFFSET - @stroke, bounds.size.height - SHADOW_OFFSET - @stroke))
+ end
+
+ def getRandomColor
+ red = rand(256)/256.0 #forces float
+ green = rand(256)/256.0
+ blue = rand(256)/256.0
+ NSColor.colorWithCalibratedRed red, green:green, blue:blue, alpha:1.0
+ end
+
+ def drawRect(rect)
+ if superview.shadowSwitch.state == 1
+ @onShadow.set
+ else
+ @offShadow.set
+ end
+
+ @color.set
+ NSBezierPath.setDefaultLineWidth(@stroke)
+ NSBezierPath.strokeRect(@drawRect)
+ end
+
+ def mouseDown(event)
+ puts "mouseDown for obj #{@num}"
+
+ # It can be useful to keep this point so that the relationship (distance) between
+ # the object and the pointer can be maintained during a mouseDragged event.
+ # Object-local coordinates.
+ @mouseDownPoint = convertPoint event.locationInWindow, fromView:nil
+
+ # Put this subview on top, if control is set.
+ if superview.moveToTopSwitch.state == 1
+ superview.moveSubviewToTop(self)
+ # or, to move it behind the others:
+ #superview.moveSubviewToIndex(self, 0)
+ end
+ end
+
+ def mouseDragged(event)
+ myPoint = NSPoint.new(event.locationInWindow.x - superview.frame.origin.x,
+ event.locationInWindow.y - superview.frame.origin.y)
+ myPoint.x -= @mouseDownPoint.x
+ myPoint.y -= @mouseDownPoint.y
+
+ if @speed > 0 # was in the process of animating to a new location
+ @speed = 0 # stop the movement
+ end
+
+ # There is no need to redraw all the objects during a drag.
+ # This method keeps dragging very smooth, even with lots of objects on the screen.
+ # Mark the old rect as needing an update...
+ superview.needsDisplayInRect = frame
+ # ...update the position...
+ self.frameOrigin = myPoint
+ # ...and mark the new one too.
+ superview.needsDisplayInRect = frame
+ end
+
+ def setMoveDestination(destPt)
+ if destPt.x != frame.origin.x or destPt.y != frame.origin.y
+ @destPt = destPt
+ end
+ end
+
+ def setSpeed(speed)
+ @speed = speed
+ @angle = getAngleInRadians(frame.origin, @destPt)
+ @xDelta = Math.sin(@angle) * @speed
+ @yDelta = Math.cos(@angle) * @speed
+ end
+
+ def startMovement
+ # Set the global so the app knows that an object is moving
+ $objMoving = true
+ # start the timer (superview checks to see if it is already going)
+ superview.startTimer
+ end
+
+ def moveToDestination
+ return 0 if speed == 0
+ currPt = frame.origin
+ if currPt == @destPt # reached destination
+ @speed = 0
+ return 0
+ end
+
+ if (currPt.x - @destPt.x).abs < @speed
+ currPt.x = @destPt.x
+ else
+ currPt.x += @xDelta
+ end
+
+ if (currPt.y - @destPt.y).abs < @speed
+ currPt.y = @destPt.y
+ else
+ currPt.y += @yDelta
+ end
+
+ # Unlike with dragging, during animation it is inefficient for each object
+ # to call "setNeedsDisplay" as it moves. It is much better to just update the
+ # object's position and let the superview call setNeedsDisplay once.
+ self.frameOrigin = currPt
+
+ return 1 # yes, this object is still moving
+ end
+
+ def getAngleInRadians(p1, p2) # points
+ x = p2.x - p1.x
+ y = p2.y - p1.y
+ Math.atan2(x,y)
+ end
+
+end
+
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModelDemo.xcodeproj/project.pbxproj
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModelDemo.xcodeproj/project.pbxproj (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModelDemo.xcodeproj/project.pbxproj 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,289 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 44;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 4D3CB8A20DF8BB7E00AC5F00 /* Controller.rb in Resources */ = {isa = PBXBuildFile; fileRef = 4D3CB8A10DF8BB7E00AC5F00 /* Controller.rb */; };
+ 4D3CB8A40DF8BCF900AC5F00 /* Superview.rb in Resources */ = {isa = PBXBuildFile; fileRef = 4D3CB8A30DF8BCF900AC5F00 /* Superview.rb */; };
+ 4D3CB8A60DF8BD8E00AC5F00 /* ViewModel.rb in Resources */ = {isa = PBXBuildFile; fileRef = 4D3CB8A50DF8BD8E00AC5F00 /* ViewModel.rb */; };
+ 4DE339F70D74FCDD00ADB6EE /* rb_main.rb in Resources */ = {isa = PBXBuildFile; fileRef = 4DE339F60D74FCDD00ADB6EE /* rb_main.rb */; };
+ 4DE3BE140D8651D900ECA448 /* MacRuby.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DE3BE130D8651D900ECA448 /* MacRuby.framework */; };
+ 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 = (); }; };
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
+ 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>"; };
+ 4D3CB8A10DF8BB7E00AC5F00 /* Controller.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = Controller.rb; sourceTree = "<group>"; };
+ 4D3CB8A30DF8BCF900AC5F00 /* Superview.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = Superview.rb; sourceTree = "<group>"; };
+ 4D3CB8A50DF8BD8E00AC5F00 /* ViewModel.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = ViewModel.rb; sourceTree = "<group>"; };
+ 4DE339F60D74FCDD00ADB6EE /* rb_main.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = rb_main.rb; sourceTree = "<group>"; };
+ 4DE3BE130D8651D900ECA448 /* MacRuby.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MacRuby.framework; path = /Library/Frameworks/MacRuby.framework; sourceTree = "<absolute>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8D1107320486CEB800E47090 /* ViewModelDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ViewModelDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D11072E0486CEB800E47090 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ 4DE3BE140D8651D900ECA448 /* MacRuby.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 4D3CB8A10DF8BB7E00AC5F00 /* Controller.rb */,
+ 4D3CB8A30DF8BCF900AC5F00 /* Superview.rb */,
+ 4D3CB8A50DF8BD8E00AC5F00 /* ViewModel.rb */,
+ );
+ name = Classes;
+ sourceTree = "<group>";
+ };
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 4DE3BE130D8651D900ECA448 /* MacRuby.framework */,
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+ );
+ name = "Linked Frameworks";
+ sourceTree = "<group>";
+ };
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+ 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107320486CEB800E47090 /* ViewModelDemo.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* ViewModelDemo */ = {
+ isa = PBXGroup;
+ children = (
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = ViewModelDemo;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 4DE339F60D74FCDD00ADB6EE /* rb_main.rb */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
+ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D1107260486CEB800E47090 /* ViewModelDemo */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "ViewModelDemo" */;
+ buildPhases = (
+ 8D1107290486CEB800E47090 /* Resources */,
+ 8D11072C0486CEB800E47090 /* Sources */,
+ 8D11072E0486CEB800E47090 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ViewModelDemo;
+ productInstallPath = "$(HOME)/Applications";
+ productName = ViewModelDemo;
+ productReference = 8D1107320486CEB800E47090 /* ViewModelDemo.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ViewModelDemo" */;
+ compatibilityVersion = "Xcode 3.0";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* ViewModelDemo */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D1107260486CEB800E47090 /* ViewModelDemo */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D1107290486CEB800E47090 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
+ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+ 4DE339F70D74FCDD00ADB6EE /* rb_main.rb in Resources */,
+ 4D3CB8A20DF8BB7E00AC5F00 /* Controller.rb in Resources */,
+ 4D3CB8A40DF8BCF900AC5F00 /* Superview.rb in Resources */,
+ 4D3CB8A60DF8BD8E00AC5F00 /* ViewModel.rb in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D11072C0486CEB800E47090 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072D0486CEB800E47090 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 089C165DFE840E0CC02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 29B97319FDCFA39411CA2CEA /* English */,
+ );
+ name = MainMenu.nib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ C01FCF4B08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = ViewModelDemo;
+ WRAPPER_EXTENSION = app;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ C01FCF4C08A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Applications";
+ PRODUCT_NAME = ViewModelDemo;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_ENABLE_OBJC_GC = required;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_ENABLE_OBJC_GC = required;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "ViewModelDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4B08A954540054247B /* Debug */,
+ C01FCF4C08A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ViewModelDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
Property changes on: MacRuby/trunk/sample-macruby/ViewModelDemo/ViewModelDemo.xcodeproj/project.pbxproj
___________________________________________________________________
Name: svn:executable
+ *
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/main.m
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/main.m (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/main.m 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,14 @@
+//
+// main.m
+// ViewModelDemo
+//
+// Created by Laurent Sansonetti on 6/5/08.
+// Copyright __MyCompanyName__ 2008. All rights reserved.
+//
+
+#import <MacRuby/MacRuby.h>
+
+int main(int argc, char *argv[])
+{
+ return macruby_main("rb_main.rb", argc, argv);
+}
Property changes on: MacRuby/trunk/sample-macruby/ViewModelDemo/main.m
___________________________________________________________________
Name: svn:executable
+ *
Added: MacRuby/trunk/sample-macruby/ViewModelDemo/rb_main.rb
===================================================================
--- MacRuby/trunk/sample-macruby/ViewModelDemo/rb_main.rb (rev 0)
+++ MacRuby/trunk/sample-macruby/ViewModelDemo/rb_main.rb 2008-06-06 00:42:18 UTC (rev 252)
@@ -0,0 +1,22 @@
+#
+# rb_main.rb
+# ViewModelDemo
+#
+# Created by Laurent Sansonetti on 6/5/08.
+# Copyright __MyCompanyName__ 2008. All rights reserved.
+#
+
+# Loading the Cocoa framework. If you need to load more frameworks, you can
+# do that here too.
+framework 'Cocoa'
+
+# Loading all the Ruby project files.
+dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
+Dir.entries(dir_path).each do |path|
+ if path != File.basename(__FILE__) and path[-3..-1] == '.rb'
+ require(path)
+ end
+end
+
+# Starting the Cocoa main loop.
+NSApplicationMain(0, nil)
Property changes on: MacRuby/trunk/sample-macruby/ViewModelDemo/rb_main.rb
___________________________________________________________________
Name: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080605/a9712a47/attachment-0001.htm
More information about the macruby-changes
mailing list