[macruby-changes] [253] MacRuby/trunk/sample-macruby
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 5 21:19:05 PDT 2008
Revision: 253
http://trac.macosforge.org/projects/ruby/changeset/253
Author: lsansonetti at apple.com
Date: 2008-06-05 21:19:04 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
new sample, PhotocastViewer, a rewrite of RubyCocoa's RSSPhotoViewer using PubSub
Modified Paths:
--------------
MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf
Added Paths:
-----------
MacRuby/trunk/sample-macruby/PhotocastViewer/
MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/
MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/InfoPlist.strings
MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/
MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/classes.nib
MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/info.nib
MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/keyedobjects.nib
MacRuby/trunk/sample-macruby/PhotocastViewer/Info.plist
MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewer.xcodeproj/
MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewer.xcodeproj/project.pbxproj
MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewerController.rb
MacRuby/trunk/sample-macruby/PhotocastViewer/main.m
MacRuby/trunk/sample-macruby/PhotocastViewer/rb_main.rb
Modified: MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf
===================================================================
--- MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf 2008-06-06 00:42:18 UTC (rev 252)
+++ MacRuby/trunk/sample-macruby/About MacRuby Examples.rtf 2008-06-06 04:19:04 UTC (rev 253)
@@ -42,6 +42,10 @@
\b0 Path operations (circles, rectangles, B\'e9zier paths)\
\
+\b PhotocastViewer
+\b0 ImageKit and PubSub frameworks\
+\
+
\b ViewModelDemo
\b0 NSView, NSTimer\
\
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)
Property changes on: MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/InfoPlist.strings
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/classes.nib
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/classes.nib (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/classes.nib 2008-06-06 04:19:04 UTC (rev 253)
@@ -0,0 +1,59 @@
+<?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>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>IKImageBrowserView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>_dataSource</key>
+ <string>id</string>
+ <key>_delegate</key>
+ <string>id</string>
+ <key>_dragDestinationDelegate</key>
+ <string>id</string>
+ <key>_horizontalScroller</key>
+ <string>NSScroller</string>
+ <key>_verticalScroller</key>
+ <string>NSScroller</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSObject</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>parse</key>
+ <string>id</string>
+ <key>zoomChanged</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>PhotocastViewerController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/info.nib
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/info.nib (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/info.nib 2008-06-06 04:19:04 UTC (rev 253)
@@ -0,0 +1,20 @@
+<?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>IBFramework Version</key>
+ <string>629</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../../PhotocastViewer.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>231</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9A581</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
+</dict>
+</plist>
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Property changes on: MacRuby/trunk/sample-macruby/PhotocastViewer/English.lproj/MainMenu.nib/keyedobjects.nib
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/Info.plist
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/Info.plist (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/Info.plist 2008-06-06 04:19:04 UTC (rev 253)
@@ -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.PhotocastViewer</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/PhotocastViewer/Info.plist
___________________________________________________________________
Name: svn:executable
+ *
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewer.xcodeproj/project.pbxproj
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewer.xcodeproj/project.pbxproj (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewer.xcodeproj/project.pbxproj 2008-06-06 04:19:04 UTC (rev 253)
@@ -0,0 +1,281 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 44;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 4D3CB8F50DF8C15800AC5F00 /* PhotocastViewerController.rb in Resources */ = {isa = PBXBuildFile; fileRef = 4D3CB8F40DF8C15800AC5F00 /* PhotocastViewerController.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>"; };
+ 4D3CB8F40DF8C15800AC5F00 /* PhotocastViewerController.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = PhotocastViewerController.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 /* PhotocastViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PhotocastViewer.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 = (
+ 4D3CB8F40DF8C15800AC5F00 /* PhotocastViewerController.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 /* PhotocastViewer.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* PhotocastViewer */ = {
+ isa = PBXGroup;
+ children = (
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = PhotocastViewer;
+ 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 /* PhotocastViewer */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "PhotocastViewer" */;
+ buildPhases = (
+ 8D1107290486CEB800E47090 /* Resources */,
+ 8D11072C0486CEB800E47090 /* Sources */,
+ 8D11072E0486CEB800E47090 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = PhotocastViewer;
+ productInstallPath = "$(HOME)/Applications";
+ productName = PhotocastViewer;
+ productReference = 8D1107320486CEB800E47090 /* PhotocastViewer.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 "PhotocastViewer" */;
+ compatibilityVersion = "Xcode 3.0";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* PhotocastViewer */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D1107260486CEB800E47090 /* PhotocastViewer */,
+ );
+ };
+/* 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 */,
+ 4D3CB8F50DF8C15800AC5F00 /* PhotocastViewerController.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 = PhotocastViewer;
+ 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 = PhotocastViewer;
+ 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 "PhotocastViewer" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4B08A954540054247B /* Debug */,
+ C01FCF4C08A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "PhotocastViewer" */ = {
+ 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/PhotocastViewer/PhotocastViewer.xcodeproj/project.pbxproj
___________________________________________________________________
Name: svn:executable
+ *
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewerController.rb
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewerController.rb (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/PhotocastViewerController.rb 2008-06-06 04:19:04 UTC (rev 253)
@@ -0,0 +1,80 @@
+class PhotocastViewerController < NSWindowController
+
+ ib_outlet :imageBrowserView
+
+ def awakeFromNib
+ @cache = []
+ @imageBrowserView.animates = true
+ @imageBrowserView.dataSource = self
+ @imageBrowserView.delegate = self
+
+ NSNotificationCenter.defaultCenter.addObserver self,
+ selector:'feedRefreshed:',
+ name:PSFeedRefreshingNotification,
+ object:nil
+ end
+
+ # Actions
+
+ def zoomChanged(sender)
+ @imageBrowserView.zoomValue = sender.floatValue
+ end
+
+ def parse(sender)
+ urlString = sender.stringValue
+ url = NSURL.URLWithString(urlString)
+ feed = PSFeed.alloc.initWithURL(url)
+ feed.refresh(nil)
+ end
+
+ def feedRefreshed(notification)
+ feed = notification.object
+ @results = feed.entryEnumeratorSortedBy(nil).allObjects
+ @cache.clear
+ @imageBrowserView.reloadData
+ end
+
+ # Image browser datasource/delegate
+
+ def numberOfItemsInImageBrowser(browser)
+ @results ? @results.size : 0
+ end
+
+ def imageBrowser(browser, itemAtIndex:index)
+ photo = @cache[index]
+ if photo.nil?
+ entry = @results[index]
+ url = entry.content.HTMLString.scan(/<img\s+src="([^"]+)"/)[0][0]
+ photo = RSSPhoto.new(url)
+ @cache[index] = photo
+ end
+ return photo
+ end
+
+ def imageBrowser_cellWasDoubleClickedAtIndex(browser, index)
+ NSWorkspace.sharedWorkspace.openURL @cache[index].url
+ end
+end
+
+class RSSPhoto
+ attr_reader :url
+
+ def initialize(url)
+ @urlString = url
+ @url = NSURL.alloc.initWithString url
+ end
+
+ # IKImageBrowserItem protocol conformance
+
+ def imageUID
+ @urlString
+ end
+
+ def imageRepresentationType
+ :IKImageBrowserNSImageRepresentationType
+ end
+
+ def imageRepresentation
+ @image ||= NSImage.alloc.initByReferencingURL @url
+ end
+end
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/main.m
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/main.m (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/main.m 2008-06-06 04:19:04 UTC (rev 253)
@@ -0,0 +1,14 @@
+//
+// main.m
+// PhotocastViewer
+//
+// 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/PhotocastViewer/main.m
___________________________________________________________________
Name: svn:executable
+ *
Added: MacRuby/trunk/sample-macruby/PhotocastViewer/rb_main.rb
===================================================================
--- MacRuby/trunk/sample-macruby/PhotocastViewer/rb_main.rb (rev 0)
+++ MacRuby/trunk/sample-macruby/PhotocastViewer/rb_main.rb 2008-06-06 04:19:04 UTC (rev 253)
@@ -0,0 +1,24 @@
+#
+# rb_main.rb
+# PhotocastViewer
+#
+# 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'
+framework 'Quartz'
+framework 'PubSub'
+
+# 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/PhotocastViewer/rb_main.rb
___________________________________________________________________
Name: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080605/70e8450e/attachment-0001.htm
More information about the macruby-changes
mailing list