Allow the automagical embedding of images from control plugin into the IDE.app 
and build.app bundles

Plugin controls often use images for their GUI. For example, an image in the 
bundle plugin (Cocoa/Carbon) can easily be loaded using the bundleForClass or 
the mainBundle, like:

- (id) initWithFrame: (NSRect) frame
{
  self = [super initWithFrame: frame];
  if (self)
  {
          /* we can use */
         NSBundle* bundle = [NSBundle bundleForClass: [InfoBar class]];
        /* or */
        NSBundle* bundle = [NSBundle mainBundle];  
        NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"png" 
inDirectory: nil];
        mBackground = [[[NSImage alloc] initWithContentsOfFile: path] retain];
        if (![mBackground isValid]) 
        {
      NSLog(@"Background image for info bar is invalid.");
        } 

        mScaleFactor = 1.0;
        mCurrentCaretX = 0;
        mCurrentCaretY = 0;
        [self createItems];
        
  }
  return self;
}

Obviously, this fails when in the IDE, and we then need to supply an image that 
may be proprietary to a third-party library, leading to a violation. Another 
way is to use dynamic access in the IDE (design-time), getting the Application 
class instance of the IDE. This then allows access to the plugins folder. The 
plugin then copies its rbx to another location, digs into the rbx hierarchy, 
copies the image file, and then present it to the above init procedure. This 
works, but we are not done yet.

How to get the proprietary image in the build app? There is no mechanism and we 
are forced to expose the image to the user, who then should embed it in their 
project. This is in fact not an option.

Alfred
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to