Re: [MacRuby-devel] MacRuby on Mavericks

2013-11-10 Thread rob ista
 path.split( '/' ).last.split( '.' ).first
>   item= self.template_menu.addItemWithTitle( title, 
> action:"open_engine_template:", keyEquivalent:"" )
>   item.setTarget( self )
>   end
> 
>   examples= bundle.pathsForResourcesOfType( "cnc", 
> inDirectory:"Examples" )
>   examples.each do | path |
>   title   = path.split( '/' ).last.split( '.' ).first
>   item= self.example_menu.addItemWithTitle( title, 
> action:"open_document_template:", keyEquivalent:"" )
>   item.setTarget( self )
>   end
>   end
> 
>   def makeNewMachine( sender )
>   makeNewDocument( "Machine" )
>   end
>   
>   def makeNewEngine( sender )
>   makeNewDocument( "Engine" )
>   end
>   
>   def makeNewDocument( type )
>   ErrorLog.instance.warn( "makeNewDocument #{ type }" )
>   
>   nserror = Pointer.new( :object )
>   controller  = NSDocumentController.sharedDocumentController
>   document= controller.makeUntitledDocumentOfType( type, 
> error:nserror )
>   if document
>   controller.addDocument( document )
>   document.makeWindowControllers
>   document.showWindows
>   
>   else
>   ErrorLog.instance.error( "Error creating new #{ type } 
> Document" )
>   end
>   
>   document
>   end
> 
>   def open_engine_template( sender )
>   open_file( NSBundle.mainBundle.pathForResource( sender.title, 
> ofType:"engine", inDirectory:"Templates" ) )
>   end
>   
>   def open_machine_template( sender )
>   open_file( NSBundle.mainBundle.pathForResource( sender.title, 
> ofType:"machine", inDirectory:"Templates" ) )
>   end
>   
>   def open_document_template( sender )
>   open_file( NSBundle.mainBundle.pathForResource( sender.title, 
> ofType:"cnc", inDirectory:"Examples" ) )
>   end
>   
>   def open_file( path )
>   url = NSURL.fileURLWithPath( path )
>   nserror = Pointer.new( :object )
>   
> NSDocumentController.sharedDocumentController.openDocumentWithContentsOfURL( 
> url,
>   display:true, error:nserror )
>   end
>   
> end
> 
> 
> 
> -- next part --
> An HTML attachment was scrubbed...
> URL: 
> <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20131110/7846250a/attachment.html>
> 
> --
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> https://lists.macosforge.org/mailman/listinfo/macruby-devel
> 
> 
> End of MacRuby-devel Digest, Vol 66, Issue 12
> *

___
MacRuby-devel mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macruby-devel


Re: [MacRuby-devel] MacRuby on Mavericks

2013-11-10 Thread Robert Carl Rice
Thanks Rob,

I wasn't familiar with that syntax.

I like referencing the Obj-C property from the documentation perspective.
It distinguishes my references to IBOutlets from references to ruby class 
variables.

Bob


On Nov 10, 2013, at 4:19 AM, rob ista  wrote:

> Isn’t it enough to have a Class.h file as company of the Ruby.rb file like:
> //  AppDelegate.h
> 
> #import 
> 
> @interface AppDelegate : NSWindowController {
> 
> IBOutlet NSWindow   *window;
> IBOutlet NSButton   *homeButton;
> . . . etc etc
> }
> 
> - (IBAction)loadStore:(id)sender;
> - (IBAction)sortContacts:(id)sender;
> . . . etc etc
> 
> @end
> 
> 
> At least the IB is triggered by this but I admit i still don't have a big app 
> running on Mavericks :)
> 
> cheers, Rob

___
MacRuby-devel mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macruby-devel


Re: [MacRuby-devel] MacRuby on Mavericks

2013-11-10 Thread Robert Carl Rice
Hi Rob,

One other comment on your example.

I see that you have subclassed NSWindowController in your AppDelegate. That is 
good for the window to be restorable. However, NSWindowController will define 
it's own window property as an IBOutlet so you don't want to override that with 
your own window IBOutlet.

Bob Rice


On Nov 10, 2013, at 4:19 AM, rob ista  wrote:

> Isn’t it enough to have a Class.h file as company of the Ruby.rb file like:
> //  AppDelegate.h
> 
> #import 
> 
> @interface AppDelegate : NSWindowController {
> 
> IBOutlet NSWindow   *window;
> IBOutlet NSButton   *homeButton;
> . . . etc etc
> }
> 
> - (IBAction)loadStore:(id)sender;
> - (IBAction)sortContacts:(id)sender;
> . . . etc etc
> 
> @end
> 
> 
> At least the IB is triggered by this but I admit i still don't have a big app 
> running on Mavericks :)
> 
> cheers, Rob
> 

___
MacRuby-devel mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macruby-devel