Renaissance—A Cross-Platform Development Tool for Linux and Mac OS X
Listing 1. TiffViewer.gsmarkup
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<window id="window"
title="Tiff Viewer"
closable="yes">
<hbox>
<image id="imageView"
scaling="toFit"
hasFrame="yes"
width="300" height="300"
valign="expand" halign="expand"/>
</hbox>
</window>
</objects>
<connectors>
<outlet source="#NSOwner"
target="#window"
key="window"/>
<outlet source="#NSOwner"
target="#imageView"
key="imageView"/>
</connectors>
</gsmarkup>
In Listing 1, we tell Renaissance to create a closable window with the ID window. Then, we place an image view inside this window with such initial properties as the width and height of 300 points. We also specify that we want this image view to be resizable horizontally and vertically. Renaissance understands this and propagates the information up to the window to make it automatically resizable. We then define the connections for those two UI elements. We connect the window with our window outlet and the imageView with our imageView outlet. Those two outlets previously were defined in the file AppController.h.
Once the creation of the main gsmarkup file has been finished, we create the gsmarkup file (Listing 2) to hold the application menu used under GNUstep. In Listing 2, we define three menu items: Load Image, Hide and Quit. Each of them has an associated action that is invoked if the menu item is clicked on.
Listing 2. GNUstep-Menu.gsmarkup
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<menu type="main">
<menuItem title="Load Image"
action="loadImage:"/>
<menuItem title="Hide"
key="h"
action="hide:"/>
<menuItem title="Quit"
key="q"
action="terminate:"/>
</menu>
</objects>
</gsmarkup>
Once those two files have been created, we modify our initial GNUmakefile and replace the reference to the Gorm files with our two newly created gsmarkup files. We also add the Renaissance framework in our list of linked frameworks. The GNUmakefile now should look like Listing 3.
Listing 3. GNUmakefile
include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME = TiffViewer
TiffViewer_OBJC_FILES = AppController.m ImageModel.m
TiffViewer_RESOURCE_FILES = TiffViewer.gsmarkup \
GNUstep-Menu.gsmarkup
ADDITIONAL_GUI_LIBS += -lRenaissance
ADDITIONAL_OBJCFLAGS = -Wall -Wno-import
include $(GNUSTEP_MAKEFILES)/application.make
Then, we modify our initial TiffViewerInfo.plist to remove the reference to MainMenu.nib. The file now should contain the content shown in Listing 4.
Listing 4. TiffViewerInfo.plist
{
ApplicationName = "Tiff Viewer";
ApplicationDescription = "A small image viewer.";
}
The last step we must take before compiling the application is to implement two delegate methods in our application's controller. Those methods are responsible for loading the main gsmarkup file (TiffViewer.gsmarkup) and the one used for the application menu (GNUstep-Menu.gsmarkup). They need to be invoked automatically upon the application's startup on both GNUstep and Mac OS X. To do so, use an editor to open the AppController.m file and modify it so it has the content shown in Listing 5.
Listing 5. AppController.m
#import "AppController.h"
#import <Renaissance/Renaissance.h>
@implementation AppController
...
- (void) dealloc
{
[model release];
[super dealloc];
}
- (void) applicationDidFinishLaunching:
(NSNotification *) theNotification
{
[NSBundle loadGSMarkupNamed: @"TiffViewer"
owner: self];
}
- (void) applicationWillFinishLaunching:
(NSNotification *) theNotification
{
#ifdef GNUSTEP
[NSBundle loadGSMarkupNamed: @"GNUstep-Menu"
owner: self];
#else
[NSBundle loadGSMarkupNamed: @"Cocoa-Menu"
owner: self];
#endif
}
- (void) loadImage: (id)sender
{
NSOpenPanel *oPanel;
int result;
oPanel = [NSOpenPanel openPanel];
...
Here, only two methods were added, -applicationDidFinishLaunching: and -applicationWillFinishLaunching:. This shows yet another strength of Renaissance—unobtrusive integration with current code bases.
Finally, compile and start the small application:
# make # openapp TiffViewer.app
Once the application starts, click on the Load Image menu item and select a TIFF file. It should display the image properly in the window, as shown in Figure 1.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- A Topic for Discussion - Open Source Feature-Richness?
- Dynamic DNS—an Object Lesson in Problem Solving
- Tech Tip: Really Simple HTTP Server with Python
- Please correct the URL for Salt Stack's web site
2 hours 12 min ago - Android is Linux -- why no better inter-operation
4 hours 27 min ago - Connecting Android device to desktop Linux via USB
4 hours 56 min ago - Find new cell phone and tablet pc
5 hours 54 min ago - Epistle
7 hours 23 min ago - Automatically updating Guest Additions
8 hours 31 min ago - I like your topic on android
9 hours 18 min ago - This is the easiest tutorial
15 hours 54 min ago - Ahh, the Koolaid.
21 hours 32 min ago - git-annex assistant
1 day 3 hours ago





Comments
John Mckay
Has somebody worked with these application development tools?
It seems they have solutions for Linux but I wanted to know if somebody has experience with any of the tools