Changeset 463

Show
Ignore:
Timestamp:
03/05/2008 03:52:04 (6 months ago)
Author:
why
Message:
  • lib/shoes.rb: on osx, file open dialog was coming up despite "open documents" event.
  • platform/mac/Info.plist: default file assoc for .shy.
  • shoes/app.c: the Shoes.APPS method for getting a list of open windows.
Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/shoes.rb

    r461 r463  
    177177 
    178178  def self.args! 
    179     if ARGV.empty? 
    180       fname = ask_open_file 
    181       if fname 
    182         ARGV << fname 
    183       else 
    184         return false 
     179    if PLATFORM !~ /darwin/ 
     180      if ARGV.empty? 
     181        fname = ask_open_file 
     182        if fname 
     183          ARGV << fname 
     184        else 
     185          return false 
     186        end 
    185187      end 
    186188    end 
  • trunk/platform/mac/Info.plist

    r447 r463  
    3232                        <key>CFBundleTypeIconFile</key> 
    3333                        <string>Shoes.icns</string> 
     34      <key>CFBundleTypeMIMETypes</key> 
     35      <array> 
     36        <string>application/x-shy</string> 
     37      </array> 
    3438                        <key>CFBundleTypeName</key> 
    3539      <string>Shoes Package</string> 
    3640                        <key>CFBundleTypeRole</key> 
    3741                        <string>Viewer</string> 
     42      <key>LSIsAppleDefaultForType</key> 
     43      <true/> 
    3844                </dict> 
    3945                <dict> 
  • trunk/shoes/app.c

    r462 r463  
    6868  rb_ary_push(shoes_world->apps, app); 
    6969  return app; 
     70} 
     71 
     72VALUE 
     73shoes_apps_get(VALUE self) 
     74{ 
     75  return rb_ary_dup(shoes_world->apps); 
    7076} 
    7177 
     
    737743  long numberOFiles; 
    738744  FSRef fr; 
    739   char _path[SHOES_BUFSIZE], bootup[SHOES_BUFSIZE]; 
     745  char _path[SHOES_BUFSIZE]; 
    740746 
    741747  if (!(err = AEGetParamDesc(appleEvt, keyDirectObject, typeAEList, &fileDesc))) 
     
    751757        { 
    752758          FSRefMakePath(&fr, &_path, SHOES_BUFSIZE); 
    753           shoes_load(RSTRING(_path)); 
     759          printf("Opening %s\n", _path); 
     760          shoes_load(_path); 
    754761        } 
    755762      } 
     
    766773  QuitApplicationEventLoop(); 
    767774  return 128; 
     775} 
     776 
     777void  
     778shoes_app_quartz_install() 
     779{ 
     780  AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,  
     781    NewAEEventHandlerUPP(shoes_app_quartz_quit), 0, false); 
     782 
     783  AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,  
     784    NewAEEventHandlerUPP(shoes_app_quartz_open), 0, false); 
    768785} 
    769786 
     
    15661583  InitCursor(); 
    15671584 
    1568   err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,  
    1569     NewAEEventHandlerUPP(shoes_app_quartz_quit), 0, false); 
    1570   if (err != noErr) 
    1571   { 
    1572     QUIT("Out of memory.", 0); 
    1573   } 
    1574  
    1575   err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,  
    1576     NewAEEventHandlerUPP(shoes_app_quartz_open), 0, false); 
    1577   if (err != noErr) 
    1578   { 
    1579     QUIT("Out of memory.", 0); 
    1580   } 
    1581  
    15821585  gTestWindowEventProc = NewEventHandlerUPP(shoes_app_quartz_handler); 
    15831586  if (gTestWindowEventProc == NULL) 
  • trunk/shoes/app.h

    r457 r463  
    4949VALUE shoes_app_alloc(VALUE); 
    5050VALUE shoes_app_new(VALUE); 
     51VALUE shoes_apps_get(VALUE); 
    5152#ifdef SHOES_WIN32 
    5253shoes_code shoes_classex_init(); 
     54#endif 
     55#ifdef SHOES_QUARTZ 
     56void shoes_app_quartz_install(); 
    5357#endif 
    5458shoes_code shoes_app_start(VALUE, char *); 
  • trunk/shoes/ruby.c

    r461 r463  
    38843884  ); 
    38853885 
     3886  rb_define_singleton_method(cShoes, "APPS", CASTHOOK(shoes_apps_get), 0); 
    38863887  rb_define_singleton_method(cShoes, "app", CASTHOOK(shoes_app_main), -1); 
    38873888  rb_define_singleton_method(cShoes, "p", CASTHOOK(shoes_p), 1); 
  • trunk/shoes/world.c

    r459 r463  
    5252  shoes_ruby_init(); 
    5353#ifdef SHOES_QUARTZ 
     54  shoes_app_quartz_install(); 
    5455  shoes_slot_quartz_register(); 
    5556#endif