// Please see the README file or the LEGAL NOTES-section in the manual before modifying, compiling or using 'xmrm'
//   Idea: Manfred Kopp
//   Programming: Gerhard Waldhör, Andreas Artmann

// *****
// *** PIXMAP DATA IS SET IN xmrm_main.cc in main() OTHERWISE ERROR (WE DON´T KNOW EHY) ***
// *****

/* Form definition file generated with fdesign. */

#include <stdlib.h>
#include <forms.h>
#include "xmrm.h"
#include "io.h"
#include "morphvec.h"
#include "const.h"

FL_OBJECT *obj_s, *obj_d, *obj_vs, *obj_vd, *obj_m, *obj_a;

FD_MRM *create_form_MRM(void)
{
  FL_OBJECT *obj;
  FD_MRM *fdui = (FD_MRM *) fl_calloc(1, sizeof(*fdui));

  fdui->MRM = fl_bgn_form(FL_NO_BOX, 800, 560);
  fdui->mrm = obj = fl_add_box(FL_FRAME_BOX,0,0,800,560,"");

// OBJECTS ARE SORTED LIKE THIS:

// BUTTONS             BT
// CHECKBUTTONS        CB
// CHECKBUTTON-GROUPS  GR
// COUNTERS            CT
// FRAMES              --
// FREE FORMS + BOXES  --
// MENUS               MN
// SLIDERS             SL
// TEXT BOX            --

//******************************** BUTTONS *************************************************************
  fdui->BT_Load_Prj = obj = fl_add_button(FL_NORMAL_BUTTON,460,100,110,30,"Load Project");
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Buttons,28);
  fdui->BT_Save_Prj = obj = fl_add_button(FL_NORMAL_BUTTON,460,140,110,30,"Save Project");
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Buttons,29);
  fdui->BT_Save_Prj_as = obj = fl_add_button(FL_NORMAL_BUTTON,460,170,110,30,"Save Project as...");
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Buttons,30);

  fdui->BT_Load_Source = obj = fl_add_button(FL_NORMAL_BUTTON,20,60,70,30,"Load\nSource");
    fl_set_object_callback(obj,callback_Buttons,1);
  fdui->BT_Load_Dest = obj = fl_add_button(FL_NORMAL_BUTTON,90,60,70,30,"Load\nDestination");
    fl_set_object_callback(obj,callback_Buttons,2);

  fdui->BT_Load_Vecs =  obj = fl_add_button(FL_NORMAL_BUTTON,170,60,70,30,"Load\nVectors");
    fl_set_object_callback(obj,callback_Buttons,3);
  fdui->BT_Save_Vecs =  obj = fl_add_button(FL_NORMAL_BUTTON,240,60,70,30,"Save\nVectors");
    fl_set_object_callback(obj,callback_Buttons,4);
  fdui->BT_Save_Vecs_as = obj = fl_add_button(FL_NORMAL_BUTTON,310,60,70,30,"Save\nVectors as...");
    fl_set_object_callback(obj,callback_Buttons,15);
  fdui->BT_Del_Vecs = obj = fl_add_button(FL_NORMAL_BUTTON,380,60,70,30,"Delete\nVectors");
    fl_set_object_callback(obj,callback_Buttons,10);
  fdui->BT_Swap_Vecs = obj = fl_add_button(FL_NORMAL_BUTTON,380,100,70,30,"Swap");
    fl_set_object_callback(obj,callback_Buttons,11);

  fdui->BT_Load_Area = obj = fl_add_button(FL_NORMAL_BUTTON,460,60,70,30,"Load\nDetail Map");
    fl_set_object_callback(obj,callback_Buttons,31);

  fdui->BT_About = obj = fl_add_button(FL_NORMAL_BUTTON,770,530,20,20,"C");
    fl_set_object_callback(obj,callback_Buttons,7);
  fdui->BT_Exit = obj = fl_add_button(FL_NORMAL_BUTTON,540,60,30,30,"EXIT");
    fl_set_button_shortcut(obj,"X#X^X",1);
    fl_set_object_callback(obj,callback_Buttons,5);

  fdui->BT_Calculate = obj = fl_add_button(FL_NORMAL_BUTTON,600,30,180,40,"CALCULATE");
    fl_set_object_callback(obj,callback_Buttons,12);
  fdui->BT_Animate = obj = fl_add_button(FL_NORMAL_BUTTON,710,240,70,40,"ANIMATE");
    fl_set_object_callback(obj,callback_Buttons,13);

  fdui->BT_Create_MPEG = obj = fl_add_button(FL_NORMAL_BUTTON,700,480,90,40,"Execute\nxmrm_mpeg");
    fl_set_object_callback(obj,callback_Buttons,9);

  fdui->BT_Load_Anim = obj = fl_add_button(FL_NORMAL_BUTTON,590,480,90,40,"Load\nAnimation");
    fl_set_object_callback(obj,callback_Buttons,6);

  fdui->BT_Filename = obj = fl_add_button(FL_NORMAL_BUTTON,600,380,180,30,"CHOOSE FILENAME");
    fl_set_object_callback(obj,callback_Buttons,14);

  fdui->BT_Level[0] = obj = fl_add_button(FL_PUSH_BUTTON,20,210,20,30,"1"); // Level Buttons
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,16);
  fdui->BT_Level[1] = obj = fl_add_button(FL_PUSH_BUTTON,40,210,20,30,"2");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,17);
  fdui->BT_Level[2] = obj = fl_add_button(FL_PUSH_BUTTON,60,210,20,30,"3");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,18);
  fdui->BT_Level[3] = obj = fl_add_button(FL_PUSH_BUTTON,80,210,20,30,"4");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,19);
  fdui->BT_Level[4] = obj = fl_add_button(FL_PUSH_BUTTON,100,210,20,30,"5");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,20);
  fdui->BT_Level[5] = obj = fl_add_button(FL_PUSH_BUTTON,120,210,20,30,"6");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,21);
  fdui->BT_Level[6] = obj = fl_add_button(FL_PUSH_BUTTON,140,210,20,30,"7");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,22);
  fdui->BT_Level[7] = obj = fl_add_button(FL_PUSH_BUTTON,160,210,20,30,"8");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,23);
  fdui->BT_Level[8] = obj = fl_add_button(FL_PUSH_BUTTON,180,210,20,30,"9");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,24);
  fdui->BT_Level[9] = obj = fl_add_button(FL_PUSH_BUTTON,200,210,20,30,"10");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_COL1,FL_LEFT_BCOL);
    fl_set_object_callback(obj,callback_Buttons,25);

//***************************** CHECKBUTTONS ***********************************************************
  fdui->CB_Advanced_Mode = obj = fl_add_checkbutton(FL_PUSH_BUTTON,210,110,150,30,"Advanced Mode");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,5);
    fl_set_button(obj,0);                
  fdui->CB_Border_Vecs = obj = fl_add_checkbutton(FL_PUSH_BUTTON,210,150,150,30,"Border Vectors");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,4);    
    fl_set_button(obj,1);
  fdui->CB_High_Quality = obj = fl_add_checkbutton(FL_PUSH_BUTTON,210,130,150,30,"High Quality");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,13);
    fl_set_button(obj,0);            
  fdui->CB_Use_Wavelets = obj = fl_add_checkbutton(FL_PUSH_BUTTON,210,170,150,30,"Use Wavelets");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,14);
    fl_set_button(obj,1);            
  fdui->CB_Anim_Cycle = obj = fl_add_checkbutton(FL_PUSH_BUTTON,610,230,60,30,"Cycle"); // Animation cycle
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,8);
    fl_set_button(obj,0);
  fdui->BT_Drop = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON,380,140,65,60,"");
    fl_set_object_callback(obj,callback_Buttons,37);

//************************** CHECKBUTTON-GROUPS ********************************************************
  fdui->GR_Morph_Mode = fl_bgn_group();
  fdui->CB_Warp = obj = fl_add_checkbutton(FL_RADIO_BUTTON,30,150,160,30,"Warp Source Image");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,2);
    fl_set_button(obj,0);                
  fdui->CB_Simple_Morph = obj = fl_add_checkbutton(FL_RADIO_BUTTON,30,110,160,30,"Simple Morph");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,1);
    fl_set_button(obj,1);                
  fdui->CB_Animate_Detail = obj = fl_add_checkbutton(FL_RADIO_BUTTON,30,170,160,30,"Animate Detail");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,3);
    fl_set_button(obj,0);                
  fdui->CB_Area_Morph = obj = fl_add_checkbutton(FL_RADIO_BUTTON,30,130,160,30,"Detail Map Morph");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,11);
    fl_set_button(obj,0);                
  fl_end_group();

  fdui->GR_Save_From = fl_bgn_group();
  fdui->CB_Save_Calculation = obj = fl_add_checkbutton(FL_RADIO_BUTTON,600,350,180,30,"Save Pics when calculate");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,9);
    fl_set_button(obj,0);
  fdui->CB_Save_Animation = obj = fl_add_checkbutton(FL_RADIO_BUTTON,600,330,180,30,"Save Pics from animation");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,10);
    fl_set_button(obj,1);
  fl_end_group();
  
  fdui->GR_Anim_Control = fl_bgn_group();
  fdui->CB_Animation = obj = fl_add_checkbutton(FL_RADIO_BUTTON,610,180,160,30,"Animation Sequence");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,6);
    fl_set_button(obj,1);
  fdui->CB_Single_Frame = obj = fl_add_checkbutton(FL_RADIO_BUTTON,610,200,160,30,"Frame Preview");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_CheckButtons,7);
    fl_set_button(obj,0);
  fl_end_group();
  
//******************************** COUNTERS ************************************************************
  fdui->CT_Level_Select = obj = fl_add_counter(FL_SIMPLE_COUNTER,230,210,70,30,""); // wavelets
    fl_set_object_boxtype(obj,FL_FRAME_BOX);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Counters,1);    
    fl_set_counter_bounds(obj,1,MAX_LEVELS);
    fl_set_counter_step(obj,1,10);      
    fl_set_counter_precision(obj,0);
    fl_set_counter_value(obj,1);            
  fdui->CT_Frame_Nr = obj = fl_add_counter(FL_NORMAL_COUNTER,600,250,180,40,"Select Frame");
    fl_set_counter_bounds(obj,1,999);
    fl_set_counter_step(obj,1,10);      
    fl_set_counter_value(obj,1);    
    fl_set_counter_precision(obj,0);    
    fl_set_object_boxtype(obj,FL_FRAME_BOX);
    fl_set_object_color(obj,FL_COL1,FL_WHITE);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Counters,3);
  fdui->CT_Frames = obj = fl_add_counter(FL_NORMAL_COUNTER,600,100,180,40,"Number of Frames:");
    fl_set_counter_bounds(obj,1,999);
    fl_set_counter_step(obj,1,10);    
    fl_set_counter_value(obj,1);
    fl_set_counter_precision(obj,0);        
    fl_set_object_boxtype(obj,FL_FRAME_BOX);
    fl_set_object_color(obj,FL_COL1,FL_WHITE);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Counters,2);
  fdui->CT_Save_Step = obj = fl_add_counter(FL_SIMPLE_COUNTER,700,420,80,30,"Stepsize");
    fl_set_counter_bounds(obj,CT_STEP_MIN,CT_STEP_MAX);
    fl_set_counter_step(obj,1,10);
    fl_set_counter_value(obj,1);
    fl_set_counter_precision(obj,0);
    fl_set_object_boxtype(obj,FL_FRAME_BOX);
    fl_set_object_color(obj,FL_COL1,FL_WHITE);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Counters,5);
  fdui->CT_Save_Start = obj = fl_add_counter(FL_SIMPLE_COUNTER,600,420,80,30,"Start with #");
    fl_set_counter_bounds(obj,CT_START_MIN,CT_START_MAX);
    fl_set_counter_step(obj,1,10);
    fl_set_counter_value(obj,0);
    fl_set_counter_precision(obj,0);
    fl_set_object_boxtype(obj,FL_FRAME_BOX);
    fl_set_object_color(obj,FL_COL1,FL_WHITE);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Counters,4);

//********************************* FRAMES *************************************************************
  obj = fl_add_frame(FL_BORDER_FRAME,20,20,550,30,""); // frame around menu
  
  obj = fl_add_frame(FL_ENGRAVED_FRAME,200,100,160,100,""); // frame around e.g. 'Set border vec'
    fl_set_object_color(obj,FL_COL1,FL_COL1);

  obj = fl_add_labelframe(FL_BORDER_FRAME,10,10,570,510,"MAIN CONTROLS");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
  obj = fl_add_labelframe(FL_ENGRAVED_FRAME,20,100,170,100,"Morph Mode");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
  obj = fl_add_labelframe(FL_BORDER_FRAME,590,320,200,150,"Save Control");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
  obj = fl_add_labelframe(FL_BORDER_FRAME,590,170,200,130,"Animation Control");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
  obj = fl_add_labelframe(FL_BORDER_FRAME,590,10,200,140,"Calculation Control");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);

//************************** FREE FORMS + BOXES ********************************************************
  fdui->Wave_Plot_Box = obj = fl_add_box(FL_DOWN_BOX,20,270,240,240,"Wavelet Interpolation Levels");
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fdui->Wave_Plot = obj = fl_add_free(FL_NORMAL_FREE,20+ABW,270+ABW,240-2*ABW,240-2*ABW,"",obj_wavelets_handler);
    fl_set_object_dblbuffer(obj,1);
  fdui->Morph_Plot = obj = fl_add_box(FL_DOWN_BOX,330,270,240,240,"Morphing-Progress");
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    obj = fl_add_free(FL_NORMAL_FREE,330+ABW,270+ABW,240-2*ABW,240-2*ABW,"",obj_akima_handler);
    fl_set_object_dblbuffer(obj,1);

//********************************* MENUS **************************************************************
  fdui->MN_File = obj = fl_add_menu(FL_PULLDOWN_MENU,30,25,70,20,"File F1"); // adjust numbers 2 and 4 manually !!!
//    fl_set_object_boxtype(obj,FL_NO_BOX);                                  // don't use this !!!!!!!!!!!!!!!!!!!!
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Menus,0);
    fl_set_object_shortcut(obj, "F#F^F&1", 1);
    fl_set_menu(obj, "Load Project...|Save Project|Save Project as...%l|Load Source...|Load Destination...%l|\
Load Detail Map...%l|Load Vectors...|Save Vectors|Save Vectors as...%l|Exit");
  fdui->MN_Wavelet_Type = obj = fl_add_menu(FL_PULLDOWN_MENU,100,25,130,20,"Wavelet Type F2");
    fl_set_object_shortcut(obj,"T#T^T&2",1);
//    fl_set_object_boxtype(obj,FL_NO_BOX);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
//WOIDL+
    fl_set_menu(obj, "Fast RTS-Transform|Biorthogonal Spline 1-3|Biorthogonal Spline 1-5|\
Biorthogonal Spline 3-3|Biorthogonal Spline 3-7|Biorthogonal Spline 2-4|Biorthogonal Spline 2-6|\
Pseudocoiflets|Battle Lemarie|Haar|Biortho Spline 3-3inv|Biortho Spline 3-1inv");
    fl_set_object_callback(obj,callback_Menus,1);
    fl_set_menu_item_mode(obj, 1, FL_PUP_RADIO+FL_PUP_CHECK);
    fl_set_menu_item_mode(obj, 2, FL_PUP_RADIO);
    fl_set_menu_item_mode(obj, 3, FL_PUP_RADIO);
    fl_set_menu_item_mode(obj, 4, FL_PUP_RADIO);
    fl_set_menu_item_mode(obj, 5, FL_PUP_RADIO);    
    fl_set_menu_item_mode(obj, 6, FL_PUP_RADIO);        
    fl_set_menu_item_mode(obj, 7, FL_PUP_RADIO);            
    fl_set_menu_item_mode(obj, 8, FL_PUP_RADIO);                
    fl_set_menu_item_mode(obj, 9, FL_PUP_RADIO);                
    fl_set_menu_item_mode(obj, 10, FL_PUP_RADIO);                
    fl_set_menu_item_mode(obj, 11, FL_PUP_RADIO);                            
    fl_set_menu_item_mode(obj, 12, FL_PUP_RADIO);                                
//WOIDL-
  fdui->MN_Windows = obj = fl_add_menu(FL_PULLDOWN_MENU,230,25,110,20,"Windows F3");
    fl_set_object_shortcut(obj,"W#W^W&3",1);
//    fl_set_object_boxtype(obj,FL_NO_BOX);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_menu(obj, "Animation|Source & Destination|Vector Edit Mode|Detail Map|Warp Parameters");
    fl_set_object_callback(obj,callback_Menus,2);
    fl_set_menu_item_mode(obj, 1, FL_PUP_BOX + FL_PUP_GREY);
    fl_set_menu_item_mode(obj, 2, FL_PUP_BOX + FL_PUP_GREY);
    fl_set_menu_item_mode(obj, 3, FL_PUP_BOX + FL_PUP_GREY);
    fl_set_menu_item_mode(obj, 4, FL_PUP_BOX);
    fl_set_menu_item_mode(obj, 5, FL_PUP_BOX);
  obj = fl_add_menu(FL_PULLDOWN_MENU,480,25,80,20,"Help F12");
    fl_set_object_shortcut(obj,"H#H^H&12",1);
//    fl_set_object_boxtype(obj,FL_NO_BOX);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_menu(obj, "HTML-Manual (Netscape)%l|ABOUT");
    fl_set_object_callback(obj,callback_Menus,3);

//******************************** SLIDERS *************************************************************
  fdui->SL_Level_Adjust = obj = fl_add_slider(FL_VERT_NICE_SLIDER,270,270,30,240,""); // wavelet interpol.
    fl_set_object_color(obj,FL_COL1,FL_RED);
    fl_set_object_callback(obj,callback_Sliders,4);
    fl_set_slider_precision(obj, 3);
    fl_set_slider_bounds(obj, SL_WAVE_MAX, SL_WAVE_MIN);
    fl_set_slider_value(obj, 0.500);    
     fl_set_slider_return(obj, FL_RETURN_CHANGED);
  fdui->SL_fps = obj = fl_add_valslider(FL_HOR_FILL_SLIDER,600,260,100,20,"fps");
    fl_set_object_color(obj,FL_COL1,FL_YELLOW);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Sliders,5);
    fl_set_slider_precision(obj, 0);
    fl_set_slider_bounds(obj, 1, 50);
    fl_set_slider_value(obj, 18);
    fl_set_slider_return(obj, FL_RETURN_CHANGED);

//****************************** TEXT BOX **************************************************************
  fdui->Infoline = obj = fl_add_text(FL_NORMAL_TEXT,10,530,750,20,""); // Statusline
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_MCOL,FL_MCOL);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE);

  fl_end_form();

  return fdui;
}
/*---------------------------------------*/

FD_MORPH *create_form_MORPH(void)
{
  FL_OBJECT *obj;
  FD_MORPH *fdui = (FD_MORPH *) fl_calloc(1, sizeof(*fdui));
  fdui->MORPH = fl_bgn_form(FL_NO_BOX, 820, 300);

  fdui->morph = obj = fl_add_box(FL_FLAT_BOX,0,0,820,300,"");
  obj = fl_add_frame(FL_ENGRAVED_FRAME,0,0,400,300,"");
    fl_set_object_color(obj,FL_RIGHT_BCOL,FL_RIGHT_BCOL);
    fl_set_object_gravity(obj, FL_West, FL_NoGravity);
  obj = fl_add_frame(FL_ENGRAVED_FRAME,420,0,400,300,"");
    fl_set_object_color(obj,FL_RIGHT_BCOL,FL_RIGHT_BCOL);
    fl_set_object_gravity(obj, FL_NoGravity, FL_East);

  obj_s = fl_add_free (FL_INACTIVE_FREE,0,0,400,300,"",obj_s_handler);
  obj_d = fl_add_free (FL_INACTIVE_FREE,420,0,400,300,"",obj_d_handler);

  obj_vs = fl_add_free (FL_NORMAL_FREE,0,0,400,300,"",obj_vs_handler);
  obj_vd = fl_add_free (FL_NORMAL_FREE,420,0,400,300,"",obj_vd_handler);

  fl_end_form();

  return fdui;
}

/*---------------------------------------*/

FD_RESULT *create_form_RESULT(void)
{
  FL_OBJECT *obj;
  FD_RESULT *fdui = (FD_RESULT *) fl_calloc(1, sizeof(*fdui));

  fdui->RESULT = fl_bgn_form(FL_NO_BOX, 400, 300);
  fdui->result = obj = fl_add_box(FL_FLAT_BOX,0,0,400,300,"");
  obj = fl_add_frame(FL_ENGRAVED_FRAME,0,0,400,300,"");  
  fl_set_object_color(obj,FL_RIGHT_BCOL,FL_RIGHT_BCOL);
    
  obj_m = fl_add_free (FL_INACTIVE_FREE,0,0,400,300,"",obj_m_handler);

  fl_end_form();

  return fdui;
}

/*---------------------------------------*/

FD_AREAS *create_form_AREAS(void)
{
  FL_OBJECT *obj;
  FD_AREAS *fdui = (FD_AREAS *) fl_calloc(1, sizeof(*fdui));

  fdui->AREAS = fl_bgn_form(FL_NO_BOX, 400, 300);
  fdui->areas = obj = fl_add_box(FL_FLAT_BOX,0,0,400,300,"");
  obj = fl_add_frame(FL_ENGRAVED_FRAME,0,0,400,300,"");  
  fl_set_object_color(obj,FL_RIGHT_BCOL,FL_RIGHT_BCOL);  

  obj_a = fl_add_free (FL_INACTIVE_FREE,0,0,400,300,"",obj_a_handler);
  fl_end_form();

  return fdui;
}
/*---------------------------------------*/

FD_WAIT *create_form_WAIT(void)
{
  FL_OBJECT *obj;
  FD_WAIT *fdui = (FD_WAIT *) fl_calloc(1, sizeof(*fdui));

  fdui->WAIT = fl_bgn_form(FL_NO_BOX, 210, 110);
  fdui->wait = obj = fl_add_box(FL_UP_BOX,0,0,210,110,"");
  fdui->SL_Progress = obj = fl_add_slider(FL_HOR_FILL_SLIDER,10,60,190,40,"");
    fl_set_object_boxtype(obj,FL_FRAME_BOX);
    fl_set_object_color(obj,FL_COL1,FL_BLUE);
    fl_set_object_callback(obj,callback_Sliders,6);
  obj = fl_add_text(FL_NORMAL_TEXT,10,10,190,50,"CLICK THIS WINDOW\nTO STOP");
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
  fl_end_form();

  fdui->WAIT->fdui = fdui;

  return fdui;
}

/*---------------------------------------*/

FD_CREDITS *create_form_CREDITS(void)
{
  FL_OBJECT *obj;
  FD_CREDITS *fdui = (FD_CREDITS *) fl_calloc(1, sizeof(*fdui));

  fdui->CREDITS = fl_bgn_form(FL_NO_BOX, 480, 300);
  obj = fl_add_box(FL_UP_BOX,0,0,480,300,"");
  obj = fl_add_frame(FL_ENGRAVED_FRAME,10,10,460,240,"");
    fl_set_object_color(obj,FL_COL1,FL_COL1);
  obj = fl_add_text(FL_NORMAL_TEXT,100,130,100,30,"Programming:");
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
  obj = fl_add_text(FL_NORMAL_TEXT,80,70,320,30,"Multiresolution Image Metamorphosis");
    fl_set_object_lcolor(obj,FL_BLUE);
    fl_set_object_lsize(obj,FL_LARGE_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
  obj = fl_add_text(FL_NORMAL_TEXT,250,130,130,40,"Gerhard Waldhör\nAndreas Artmann");
    fl_set_object_lcolor(obj,FL_WHITE);
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
  obj = fl_add_text(FL_NORMAL_TEXT,100,100,140,30,"Idea and Concepts:");
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
  obj = fl_add_text(FL_NORMAL_TEXT,280,100,100,30,"Manfred Kopp");
    fl_set_object_lcolor(obj,FL_WHITE);
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
  obj = fl_add_text(FL_NORMAL_TEXT,90,210,250,30,"Vienna University of Technology");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
  obj = fl_add_button(FL_NORMAL_BUTTON,10,260,460,30,"Let's morph...");
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Buttons,8);
  fdui->BT_Drop = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON,20,180,65,60,"");
    fl_set_object_callback(obj,callback_Buttons,37);
  fdui->BT_TU_Logo = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON,340,180,120,60,"");
    fl_set_object_callback(obj,callback_Buttons,38);
  fdui->XPM_xmrm_logo = obj = fl_add_pixmap(FL_NORMAL_PIXMAP,170,20,158,50,"");
  obj = fl_add_text(FL_NORMAL_TEXT,90,180,210,30,"Institute of Computer Graphics");
    fl_set_object_lcolor(obj,FL_WHEAT);
    fl_set_object_lsize(obj,FL_MEDIUM_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
  fl_end_form();

  fdui->CREDITS->fdui = fdui;

  return fdui;
}
/*---------------------------------------*/

FD_SLID_CONTR *create_form_SLID_CONTR(void)
{
  FL_OBJECT *obj;
  FD_SLID_CONTR *fdui = (FD_SLID_CONTR *) fl_calloc(1, sizeof(*fdui));

  fdui->SLID_CONTR = fl_bgn_form(FL_NO_BOX, 300, 250);
  obj = fl_add_box(FL_UP_BOX,0,0,300,250,"");
  fdui->SL_Param_a = obj = fl_add_valslider(FL_HOR_NICE_SLIDER,20,30,260,30,"      a: Distance-from-vector Influence");
    fl_set_object_color(obj,FL_COL1,FL_YELLOW);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Sliders,1);
    fl_set_slider_bounds(obj, WARP_A_MIN, WARP_A_MAX);
    fl_set_slider_value(obj, WARP_A_MIN);
     fl_set_slider_return(obj, FL_RETURN_CHANGED);    
  fdui->SL_Param_b = obj = fl_add_valslider(FL_HOR_NICE_SLIDER,20,80,260,30,"b: Different-vectors Influence");
    fl_set_object_color(obj,FL_COL1,FL_YELLOW);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Sliders,2);
    fl_set_slider_bounds(obj, WARP_B_MIN, WARP_B_MAX);
    fl_set_slider_value(obj, WARP_B_MAX);
     fl_set_slider_return(obj, FL_RETURN_CHANGED);
  fdui->SL_Param_p = obj = fl_add_valslider(FL_HOR_NICE_SLIDER,20,130,260,30," p: Length-of-vector Influence");
    fl_set_object_color(obj,FL_COL1,FL_YELLOW);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_TOP);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Sliders,3);
    fl_set_slider_bounds(obj, WARP_P_MIN, WARP_P_MAX);
    fl_set_slider_value(obj, WARP_P_MIN);
     fl_set_slider_return(obj, FL_RETURN_CHANGED);
  fdui->Infoline = obj = fl_add_text(FL_NORMAL_TEXT,20,220,260,20,"");
    fl_set_object_boxtype(obj,FL_BORDER_BOX);
    fl_set_object_color(obj,FL_MCOL,FL_MCOL);
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
  obj = fl_add_button(FL_NORMAL_BUTTON,20,170,260,40,"OK");
    fl_set_object_lsize(obj,FL_NORMAL_SIZE);
    fl_set_object_lstyle(obj,FL_BOLD_STYLE);
    fl_set_object_callback(obj,callback_Buttons,32);

  fl_end_form();

  fdui->SLID_CONTR->fdui = fdui;

  return fdui;
}

/*---------------------------------------*/

FD_VEC_MENU *create_form_VEC_MENU(void)
{
  FL_OBJECT *obj;
  FD_VEC_MENU *fdui = (FD_VEC_MENU *) fl_calloc(1, sizeof(*fdui));

  fdui->VEC_MENU = fl_bgn_form(FL_NO_BOX, 90, 170);
  fdui->vec_menu = obj = fl_add_box(FL_UP_BOX,0,0,90,170,"");
  fdui->BT_SetVec = obj = fl_add_button(FL_PUSH_BUTTON,10,10,70,30,"Set Vector");
    fl_set_object_color(obj,FL_COL1,FL_GREEN);
    fl_set_object_callback(obj,callback_Buttons,33);
  fdui->BT_EditVec = obj = fl_add_button(FL_PUSH_BUTTON,10,90,70,30,"Edit Vector");
    fl_set_object_color(obj,FL_COL1,FL_YELLOW);
    fl_set_object_callback(obj,callback_Buttons,34);
  fdui->BT_SetLines = obj = fl_add_button(FL_PUSH_BUTTON,10,50,70,30,"Set Line");
    fl_set_object_color(obj,FL_COL1,FL_DODGERBLUE);
    fl_set_object_callback(obj,callback_Buttons,36);
  fdui->BT_DeleteVec = obj = fl_add_button(FL_PUSH_BUTTON,10,130,70,30,"Delete Vector");
    fl_set_object_color(obj,FL_COL1,FL_RED);
    fl_set_object_callback(obj,callback_Buttons,35);
  fl_end_form();

  fdui->VEC_MENU->fdui = fdui;

  return fdui;
}
/*---------------------------------------*/

