*** If you haven't seen rapidapp before, run the tutorial (start rapidapp, from the Help menu select Tutorial)
 

Hint: at any time, you can cycle through your widget list using SHIFT-Right mouse button
You can cut&paste using CTRL-X, CTRL-V
 

Start with an empty directory. run rapidapp
 

Create a VkWindow.
In the resource panel, edit :
autoRouteCallbacks : FALSE
defaultClassName: mainWindow
hideHelpMenu : TRUE
title : morph - CS426 fall 98

Click on the Containers tab
Click on Spring Box - drop the rubber band inside your VkWindow
Edit the springbox resources:
Instance Name: bigBox
defaultHorizontalLayout XmSTRETCH_FIRST
defaultVerticalLayout XmDISTRIBUTE
orientation XmVertical

Click on the Controls tab. Create a Scale and drop in into your SpringBox
Resources:
decimalPoints:3
maximum: 1000
titleString: Interpolator
valueChangedCallback: performMorph()
 

Go to the Containers tab, create a new SpringBox. Drop it in your other box
you should see it as a tiny red line. press CTRL-U to move it above the slider (or Edit menu -> Up/Left)
Change resources:
Instance Name: viewers
Vertical Spring: 100  (you should now see this as a box)

Go to the Inventor tab.
Create 3 Plane Viewers and drop them in the small SpringBox
Name them viewerInitial, viewerMorphed, viewerFinal (Instance Name)
For each of them , set the following resources:
click on decoration->FALSE.  The graphic border should go away.
set horizontal and vertical springs to 100, other springs to 0

press CTRL-P to select the <viewers> spring box. set the bottom & top springs to 0
select the scale (by clicking on it). set the top and bottom springs to 0

click on the Otions menu. press CTRL-X to get rid of it
click on the Edit menu. press CTRL-X to get rid of it.
click on the File menu. click on the Print option. Press CTRL-X.
Delete also the Close menu option
Add menu 4 entries. Name them (edit the InstanceName resource) InitialImg, FinalImg, SaveFrame, SaveMovie.

create a Radio Pulldown inside the View menu. change its options to be
WarpedInitial, Morphed, WarpedFinal. Delete the default view options.
Add a toggle and name it interpLines

Go to the File menu and save your project
Under File, click Preferences.
Change the Application name to morph
Click on the Code Style and disable the Use VkEZ toggle button

Under the Project menu, select Generate C++
after generation is complete, select Run Application

 Note: before running, rapidapp will pull up a Build window, in which you will be able to see the compilation of your application. There will be quite a few warnings (both compile and link warnings). Ignore them. There should not be, however, any errors.

 If the application ran ok, it's time to start editing the code.
Copy in the application directory the file InventorStuff.h, InventorStuff.C, morph.h, morph.C
  Edit the file BigBox.C (it should have been generated by rapidapp).
  After the line that says
//---- Start editable code block: headers and declarations
  add the lines
#include "InvetorStuff.h"
#include "morph.h"
#include <Vk/VkErrorDialog.h>
 

  In the BigBox constructor function (after the line with <//Start editable code ...>), add the lines
    initImageGraph(_viewerInitial,0);
    initImageGraph(_viewerMorphed,1);
    initImageGraph(_viewerFinal,2);
 

  Scroll down and find the PerformMorph(..) function. Comment out the VkUnimplemented(...) line. Under it add

     char *msg = morph::morphAtParameter((float)(cbs->value)/1000);
     if(msg) theErrorDialog->post(msg);

 These should be all your changes to BigBox.C

 Edit the file mainWindow.C  Add the same include files that you added to BigBox.C
Scroll down and find the line that says
// The following functions are called from callbacks
 Make all the functions that follow to call the appropiate functions from the morph static class. Comment out the VkUnimplemented(...) lines.

  Edit the Makefile. Set
USERLIBS= -lInventor -lm
USERFILES = morph.C InventorStuff.C
WOFF= -woff 3262 -woff 1174 -woff 1401 -woff 3322
 

  These should be about all the changes you should make to the code produced by rapidapp.  Write the "useful" code for your assignment inside morph.C (or create new C++ files).
  You may want to implement an image class. It should have methods for setting a pixel, getting a pixel, saving to file and loading from file.
  If you make few changes to the user interface files, and limit your code changes and additions to the indicated sections, it will be very easy to change the UI later, even after you have written and integrated all the morphing code. Just start rapidapp, load your .uil file, make changes, and <Generate C++>