home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / videofrm / videofrm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  28.6 KB  |  1,091 lines

  1. /*
  2.  * Copyright (c) 1992 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/drapeau/VideoFrame/RCS/VideoFrame.c,v 1.1 92/07/14 14:38:08 drapeau Exp $ */
  25. /* $Log:    VideoFrame.c,v $
  26.  * Revision 1.1  92/07/14  14:38:08  drapeau
  27.  * Initial revision
  28.  *  */
  29.  
  30. /*
  31.  * Parts of this file were generated by `gxv' from `VideoFrame.G'.
  32.  */
  33.  
  34. static char videoFrameRcsid[] = "$Header: /Source/Media/drapeau/VideoFrame/RCS/VideoFrame.c,v 1.1 92/07/14 14:38:08 drapeau Exp $";
  35.  
  36. #include "VideoFrame.h"
  37.  
  38. VideoFrame_mainWindow_objects    *VideoFrame_mainWindow;            /* Global object definitions. */
  39. VideoFrame_inputWindow1_objects    *VideoFrame_inputWindow1;
  40. VideoFrame_inputWindow2_objects    *VideoFrame_inputWindow2;
  41.  
  42. VideoIn        videoIn1 = (VideoIn)NULL;
  43. VideoIn        videoIn2 = (VideoIn)NULL;
  44. EditList    editList;
  45. Edit        currentSelection;
  46. int        numEdits = 0;
  47. int        unsavedChanges = False;
  48. int        currentEdit = NoCurrentEdit;
  49. char*        editListFileName;     
  50. Sender*        sender;
  51. Receiver*    receiver;
  52. Port        senderPort;
  53. int        receiverPortNumber;
  54.  
  55. void    HideWindow(Panel_item, int, Event *);
  56. void    ShowWindow(Panel_item, int, Event *);
  57. void    CropWindow(Panel_item, int, Event *);
  58. void    SqueezeWindow(Panel_item, int, Event *);
  59. void    SetAspectAny(Panel_item, int, Event *);
  60. void    SetAspect4to3(Panel_item, int, Event *);
  61. void    ResizeHandler(Xv_window, Event *, Notify_arg, Notify_event_type);
  62.  
  63.  
  64. #ifdef MAIN
  65.  
  66. /*
  67.  * Instance XV_KEY_DATA key.  An instance is a set of related
  68.  * user interface objects.  A pointer to an object's instance
  69.  * is stored under this key in every object.  This must be a
  70.  * global variable.
  71.  */
  72. Attr_attribute    INSTANCE;
  73.  
  74. main(argc, argv)
  75.      int    argc;
  76.      char    **argv;
  77. {
  78.   Rect            tempRect;
  79.   static DispatchTable  DT = 
  80.   {
  81.     OpenDoc,
  82.     GetDoc,
  83.     GetSelection,
  84.     SetSelection,                            /* SetSelection */
  85.     PerformSelection,                            /* PerformSelection */
  86.     NULL,
  87.     NULL,
  88.     NULL,
  89.     NULL,
  90.     NULL,
  91.     NULL,
  92.     NULL,                                /* HaltSelection */
  93.     NULL,                                /* PauseSelection */
  94.     NULL,                                /* ResumeSelection */
  95.     HideApplication,
  96.     ShowApplication,
  97.     GetAppIcon
  98.     };
  99.   
  100.   xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);            /* Initialize XView. */
  101.   INSTANCE = xv_unique_key();
  102.   
  103.   VideoFrame_mainWindow =                        /* Initialize user interface components. */
  104.     VideoFrame_mainWindow_objects_initialize(NULL, NULL);        /* Do NOT edit the object initializations by hand. */
  105.   
  106.   VideoFrame_inputWindow1 =
  107.     VideoFrame_inputWindow1_objects_initialize(NULL, NULL);
  108.   
  109.   VideoFrame_inputWindow2 =
  110.     VideoFrame_inputWindow2_objects_initialize(NULL, NULL);
  111.  
  112.   frame_get_rect(VideoFrame_mainWindow->mainWindow, &tempRect);
  113.   tempRect.r_left = 215;
  114.   tempRect.r_top = 370;
  115.   frame_set_rect(VideoFrame_mainWindow->mainWindow, &tempRect);
  116.  
  117.   frame_get_rect(VideoFrame_inputWindow1->inputWindow1, &tempRect);
  118.   tempRect.r_left = 10;
  119.   tempRect.r_top = 40; 
  120.   frame_set_rect(VideoFrame_inputWindow1->inputWindow1, &tempRect);
  121.   xv_set(VideoFrame_inputWindow1->inputWindow1,
  122.      FRAME_SHOW_HEADER, FALSE, NULL);
  123.  
  124.   frame_get_rect(VideoFrame_inputWindow2->inputWindow2, &tempRect);
  125.   tempRect.r_left = 500;
  126.   tempRect.r_top = 215; 
  127.   frame_set_rect(VideoFrame_inputWindow2->inputWindow2, &tempRect);
  128.   xv_set(VideoFrame_inputWindow2->inputWindow2,
  129.      FRAME_SHOW_HEADER, FALSE, NULL);
  130.  
  131.   editListFileName = malloc(MAXPATHLEN);
  132.   sprintf(editListFileName, "Untitled");
  133.   sender = (Sender*)NULL;
  134.   receiver = (Receiver*)NULL;
  135.   senderPort.hostName = (char *) malloc(MAXPATHLEN);
  136.   sprintf(senderPort.hostName, "localhost");                /* Set default values for hostname and port number */
  137.   senderPort.portNumber = PortMgrPortNumber;
  138.   receiverPortNumber = AnyPort;
  139.   sender = NewSender(&senderPort);
  140.   if (sender != (Sender*)NULL)
  141.     receiver = NewReceiver(sender, "VideoFrame", receiverPortNumber);
  142.   BuildDispatchTable (&DT);
  143.   (void) notify_enable_rpc_svc (TRUE);                    /* Tell the toolkit to listen for network messages */
  144.   notify_interpose_destroy_func(VideoFrame_mainWindow->mainWindow,  /* Interpose the destroy function */
  145.                 QuitHandler);
  146.   notify_interpose_destroy_func(VideoFrame_inputWindow1->inputWindow1, /* Interpose the destroy function */
  147.                 QuitHandler);
  148.   notify_interpose_destroy_func(VideoFrame_inputWindow2->inputWindow2, /* Interpose the destroy function */
  149.                 QuitHandler);
  150.   CreateBrowse(OpenEditList, SaveEditList,
  151.            VideoFrame_mainWindow->mainWindow);
  152.   InitXVideoCanvases();                            /* Initialize the Parallax XVideo board inputs */
  153.   xv_main_loop(VideoFrame_mainWindow->mainWindow);
  154.   exit(0);
  155. }
  156.  
  157. #endif
  158.  
  159.  
  160.  
  161. /*
  162.  * Menu handler for `documentMenu (New)'.
  163.  */
  164. Menu_item
  165.   NewHandler(Menu_item item, Menu_generate op)
  166. {
  167.   VideoFrame_mainWindow_objects * ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  168.   
  169.   switch (op)
  170.   {
  171.    case MENU_DISPLAY:
  172.     break;
  173.     
  174.    case MENU_DISPLAY_DONE:
  175.     break;
  176.     
  177.    case MENU_NOTIFY:
  178.     fputs("VideoFrame: NewHandler: MENU_NOTIFY\n", stderr);
  179.     
  180.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  181.     
  182.     /* gxv_end_connections */
  183.     
  184.     break;
  185.     
  186.    case MENU_NOTIFY_DONE:
  187.     break;
  188.   }
  189.   return item;
  190. }
  191.  
  192.  
  193.  
  194. /*
  195.  * Menu handler for `documentMenu (Open...)'.
  196.  */
  197. Menu_item
  198.   OpenHandler(Menu_item item, Menu_generate op)
  199. {
  200.   VideoFrame_mainWindow_objects * ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  201.   
  202.   switch (op)
  203.   {
  204.    case MENU_DISPLAY:
  205.     break;
  206.     
  207.    case MENU_DISPLAY_DONE:
  208.     break;
  209.     
  210.    case MENU_NOTIFY:
  211.     Browse(NULL, BrowseOpen, 0, VideoFrameDocument, "VideoFrame");
  212.     
  213.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  214.     
  215.     /* gxv_end_connections */
  216.     
  217.     break;
  218.     
  219.    case MENU_NOTIFY_DONE:
  220.     break;
  221.   }
  222.   return item;
  223. }
  224.  
  225.  
  226.  
  227. /*
  228.  * Menu handler for `documentMenu (Save)'.
  229.  */
  230. Menu_item
  231.   SaveHandler(Menu_item item, Menu_generate op)
  232. {
  233.   VideoFrame_mainWindow_objects * ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  234.   
  235.   switch (op)
  236.   {
  237.    case MENU_DISPLAY:
  238.     break;
  239.     
  240.    case MENU_DISPLAY_DONE:
  241.     break;
  242.     
  243.    case MENU_NOTIFY:
  244.     if (strcmp(editListFileName, "Untitled") == 0)
  245.     {
  246.       Browse(NULL, BrowseSave, 0, VideoFrameDocument, "VideoFrame");
  247.     }
  248.     else
  249.     {
  250.       Browse(editListFileName, BrowseCheckSave, 0, VideoFrameDocument, "VideoFrame");
  251.     }
  252.     
  253.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  254.     
  255.     /* gxv_end_connections */
  256.     
  257.     break;
  258.     
  259.    case MENU_NOTIFY_DONE:
  260.     break;
  261.   }
  262.   return item;
  263. }
  264.  
  265.  
  266.  
  267. /*
  268.  * Menu handler for `documentMenu (Save As...)'.
  269.  */
  270. Menu_item
  271.   SaveAsHandler(Menu_item item, Menu_generate op)
  272. {
  273.   VideoFrame_mainWindow_objects * ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  274.   
  275.   switch (op)
  276.   {
  277.    case MENU_DISPLAY:
  278.     break;
  279.     
  280.    case MENU_DISPLAY_DONE:
  281.     break;
  282.     
  283.    case MENU_NOTIFY:
  284.     Browse(NULL, BrowseSave, 0, VideoFrameDocument, "VideoFrame");
  285.     
  286.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  287.     
  288.     /* gxv_end_connections */
  289.     
  290.     break;
  291.     
  292.    case MENU_NOTIFY_DONE:
  293.     break;
  294.   }
  295.   return item;
  296. }
  297.  
  298.  
  299.  
  300. /*
  301.  * Menu handler for `documentMenu (Close)'.
  302.  */
  303. Menu_item
  304.   CloseHandler(Menu_item item, Menu_generate op)
  305. {
  306.   VideoFrame_mainWindow_objects * ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  307.   
  308.   switch (op)
  309.   {
  310.    case MENU_DISPLAY:
  311.     break;
  312.     
  313.    case MENU_DISPLAY_DONE:
  314.     break;
  315.     
  316.    case MENU_NOTIFY:
  317.     fputs("VideoFrame: CloseHandler: MENU_NOTIFY\n", stderr);
  318.     
  319.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  320.     
  321.     /* gxv_end_connections */
  322.     
  323.     break;
  324.     
  325.    case MENU_NOTIFY_DONE:
  326.     break;
  327.   }
  328.   return item;
  329. }
  330.  
  331.  
  332.  
  333. /*
  334.  * Menu handler for `documentMenu (Quit)'.
  335.  */
  336. Menu_item
  337.   QuitHandler(Menu_item item, Menu_generate op)
  338. {
  339.   VideoFrame_mainWindow_objects * ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  340.   
  341.   switch (op)
  342.   {
  343.    case MENU_DISPLAY:
  344.     break;
  345.     
  346.    case MENU_DISPLAY_DONE:
  347.     break;
  348.     
  349.    case MENU_NOTIFY:
  350.     if ((sender != (Sender*)NULL)  && (receiver != (Receiver*)NULL))
  351.       DestroyReceiver(sender, receiver);
  352.     xv_destroy_safe(VideoFrame_mainWindow->mainWindow);
  353.     xv_destroy_safe(VideoFrame_inputWindow1->inputWindow1);
  354.     xv_destroy_safe(VideoFrame_inputWindow2->inputWindow2);
  355.     exit(0);
  356.     
  357.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  358.     
  359.     /* gxv_end_connections */
  360.     
  361.     break;
  362.     
  363.    case MENU_NOTIFY_DONE:
  364.     break;
  365.   }
  366.   return item;
  367. }
  368.  
  369.  
  370.  
  371. /*
  372.  * Notify callback function for `editList'.
  373.  */
  374. int
  375. EditListHandler(Panel_item item, char *string, Xv_opaque client_data, Panel_list_op op, Event *event, int row)
  376. {
  377.   int    editNumber;
  378.   
  379.   switch(op)
  380.   {
  381.    case PANEL_LIST_OP_DESELECT:
  382.     xv_set(VideoFrame_mainWindow->modifyButton, PANEL_INACTIVE, TRUE, NULL); /* Set the modify, delete buttons to inactive */
  383.     xv_set(VideoFrame_mainWindow->deleteButton, PANEL_INACTIVE, TRUE, NULL);
  384.     break;
  385.     
  386.    case PANEL_LIST_OP_SELECT:
  387.     sscanf(string, "%d", &editNumber);
  388.     LoadCurrentSelection(editNumber - 1);
  389.     xv_set(VideoFrame_mainWindow->modifyButton, PANEL_INACTIVE, FALSE, NULL); /* Set the modify, delete buttons to active */
  390.     xv_set(VideoFrame_mainWindow->deleteButton, PANEL_INACTIVE, FALSE, NULL);
  391.     break;
  392.     
  393.    case PANEL_LIST_OP_VALIDATE:
  394.     break;
  395.     
  396.    case PANEL_LIST_OP_DELETE:
  397.     break;
  398.   }
  399.   
  400.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  401.   
  402.   /* gxv_end_connections */
  403.   
  404.   return XV_OK;
  405. }
  406.  
  407.  
  408.  
  409. /*
  410.  * Notify callback function for `addButton'.
  411.  */
  412. void
  413.   AddHandler(Panel_item item, Event *event)
  414. {
  415.   Rect    tempRect;
  416.   char    theString[LabelLength + 16];
  417.   
  418.   if (numEdits >= MaxNumberEditListItems)
  419.     return;
  420.   if (videoIn1 != (VideoIn)NULL)                    /* Get rect for input 1 */
  421.   {
  422.     frame_get_rect(VideoFrame_inputWindow1->inputWindow1,        /* Get the size of 1st video input window */
  423.            &tempRect);
  424.     currentSelection.input1.x = tempRect.r_left;
  425.     currentSelection.input1.y = tempRect.r_top;
  426.     currentSelection.input1.width = tempRect.r_width;
  427.     currentSelection.input1.height = tempRect.r_height;
  428.   }
  429.   if (videoIn2 != (VideoIn)NULL)                    /* Get rect for input 2 */
  430.   {
  431.     frame_get_rect(VideoFrame_inputWindow2->inputWindow2,        /* Get the size of 2nd video input window */
  432.            &tempRect);
  433.     currentSelection.input2.x = tempRect.r_left;
  434.     currentSelection.input2.y = tempRect.r_top;
  435.     currentSelection.input2.width = tempRect.r_width;
  436.     currentSelection.input2.height = tempRect.r_height;
  437.   }
  438.   sprintf(editList.item[numEdits].label, "%s",
  439.       xv_get(VideoFrame_mainWindow->labelField, PANEL_VALUE));
  440.   
  441.   editList.item[numEdits].input1.shown = currentSelection.input1.shown;
  442.   editList.item[numEdits].input1.cropped = currentSelection.input1.cropped;
  443.   editList.item[numEdits].input1.aspectRatio = currentSelection.input1.aspectRatio;
  444.   editList.item[numEdits].input1.brightness = currentSelection.input1.brightness;
  445.   editList.item[numEdits].input1.contrast = currentSelection.input1.contrast;
  446.   editList.item[numEdits].input1.saturation = currentSelection.input1.saturation;
  447.   editList.item[numEdits].input1.hue = currentSelection.input1.hue;
  448.   editList.item[numEdits].input1.width = currentSelection.input1.width;
  449.   editList.item[numEdits].input1.height = currentSelection.input1.height;
  450.   editList.item[numEdits].input1.x = currentSelection.input1.x;
  451.   editList.item[numEdits].input1.y = currentSelection.input1.y;
  452.   
  453.   editList.item[numEdits].input2.shown = currentSelection.input2.shown;
  454.   editList.item[numEdits].input2.cropped = currentSelection.input2.cropped;
  455.   editList.item[numEdits].input2.aspectRatio = currentSelection.input2.aspectRatio;
  456.   editList.item[numEdits].input2.brightness = currentSelection.input2.brightness;
  457.   editList.item[numEdits].input2.contrast = currentSelection.input2.contrast;
  458.   editList.item[numEdits].input2.saturation = currentSelection.input2.saturation;
  459.   editList.item[numEdits].input2.hue = currentSelection.input2.hue;
  460.   editList.item[numEdits].input2.width = currentSelection.input2.width;
  461.   editList.item[numEdits].input2.height = currentSelection.input2.height;
  462.   editList.item[numEdits].input2.x = currentSelection.input2.x;
  463.   editList.item[numEdits].input2.y = currentSelection.input2.y;
  464.   
  465.   FormatEntry(numEdits, &(editList.item[numEdits]), theString);
  466.   
  467.   xv_set (VideoFrame_mainWindow->editList,
  468.       PANEL_LIST_INSERT, numEdits,
  469.       PANEL_LIST_STRING, numEdits, theString,
  470.       NULL);
  471.   xv_set(VideoFrame_mainWindow->editList,
  472.      PANEL_LIST_SELECT, numEdits, TRUE,
  473.      NULL);
  474.   numEdits++;                                /* Indicate that an edit was added to the list */
  475.   editList.numEdits = numEdits;
  476.   unsavedChanges = True;
  477.   UpdateHeader();
  478.   
  479.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  480.   /* gxv_end_connections */
  481. }                                    /* end function AddHandler */
  482.  
  483.  
  484.  
  485. /*
  486.  * Notify callback function for `modifyButton'.
  487.  */
  488. void
  489.   ModifyHandler(Panel_item item, Event *event)
  490. {
  491.   Rect    tempRect;
  492.   
  493.   if (videoIn1 != (VideoIn)NULL)                    /* Get rect for input 1 */
  494.   {
  495.     frame_get_rect(VideoFrame_inputWindow1->inputWindow1, &tempRect); /* Get the size of 1st video input window */
  496.     currentSelection.input1.x = tempRect.r_left;
  497.     currentSelection.input1.y = tempRect.r_top;
  498.     currentSelection.input1.width = tempRect.r_width;
  499.     currentSelection.input1.height = tempRect.r_height;
  500.   }
  501.   if (videoIn2 != (VideoIn)NULL)                    /* Get rect for input 2 */
  502.   {
  503.     frame_get_rect(VideoFrame_inputWindow2->inputWindow2, &tempRect); /* Get the size of 2nd video input window */
  504.     currentSelection.input2.x = tempRect.r_left;
  505.     currentSelection.input2.y = tempRect.r_top;
  506.     currentSelection.input2.width = tempRect.r_width;
  507.     currentSelection.input2.height = tempRect.r_height;
  508.   }
  509.   
  510.   editList.item[currentEdit].input1.shown = currentSelection.input1.shown;
  511.   editList.item[currentEdit].input1.cropped = currentSelection.input1.cropped;
  512.   editList.item[currentEdit].input1.aspectRatio = currentSelection.input1.aspectRatio;
  513.   editList.item[currentEdit].input1.brightness = currentSelection.input1.brightness;
  514.   editList.item[currentEdit].input1.contrast = currentSelection.input1.contrast;
  515.   editList.item[currentEdit].input1.saturation = currentSelection.input1.saturation;
  516.   editList.item[currentEdit].input1.hue = currentSelection.input1.hue;
  517.   editList.item[currentEdit].input1.width = currentSelection.input1.width;
  518.   editList.item[currentEdit].input1.height = currentSelection.input1.height;
  519.   editList.item[currentEdit].input1.x = currentSelection.input1.x;
  520.   editList.item[currentEdit].input1.y = currentSelection.input1.y;
  521.   
  522.   editList.item[currentEdit].input2.shown = currentSelection.input2.shown;
  523.   editList.item[currentEdit].input2.cropped = currentSelection.input2.cropped;
  524.   editList.item[currentEdit].input2.aspectRatio = currentSelection.input2.aspectRatio;
  525.   editList.item[currentEdit].input2.brightness = currentSelection.input2.brightness;
  526.   editList.item[currentEdit].input2.contrast = currentSelection.input2.contrast;
  527.   editList.item[currentEdit].input2.saturation = currentSelection.input2.saturation;
  528.   editList.item[currentEdit].input2.hue = currentSelection.input2.hue;
  529.   editList.item[currentEdit].input2.width = currentSelection.input2.width;
  530.   editList.item[currentEdit].input2.height = currentSelection.input2.height;
  531.   editList.item[currentEdit].input2.x = currentSelection.input2.x;
  532.   editList.item[currentEdit].input2.y = currentSelection.input2.y;
  533.   unsavedChanges = True;
  534.   UpdateHeader();
  535.  
  536.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  537.   
  538.   /* gxv_end_connections */
  539. }                                    /* end function ModifyHandler */
  540.  
  541.  
  542.  
  543. /*
  544.  * Notify callback function for `deleteButton'.
  545.  */
  546. void
  547.   DeleteHandler(Panel_item item, Event *event)
  548. {
  549.   VideoFrame_mainWindow_objects *ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  550.   
  551.   fputs("VideoFrame: DeleteHandler\n", stderr);
  552.   
  553.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  554.   
  555.   /* gxv_end_connections */
  556.   
  557. }
  558.  
  559.  
  560.  
  561. /*
  562.  * Notify callback function for `deleteAllButton'.
  563.  */
  564. void
  565.   DeleteAllHandler(Panel_item item, Event *event)
  566. {
  567.   VideoFrame_mainWindow_objects *ip = (VideoFrame_mainWindow_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  568.   
  569.   fputs("VideoFrame: DeleteAllHandler\n", stderr);
  570.   
  571.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  572.   
  573.   /* gxv_end_connections */
  574.   
  575. }
  576.  
  577.  
  578.  
  579. /*
  580.  * Notify callback function for `input1ShownChoice'.
  581.  */
  582. void
  583.   VideoFrame_mainWindow_input1ShownChoice_notify_callback(Panel_item item, int     value, Event *event)
  584. {
  585.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  586.   
  587.   if (value == 1)
  588.   {
  589.     HideWindow(item, value, event);
  590.   }
  591.   
  592.   if (value == 0)
  593.   {
  594.     ShowWindow(item, value, event);
  595.   }
  596.   
  597.   /* gxv_end_connections */
  598. }
  599.  
  600.  
  601.  
  602. /*
  603.  * User-defined action for `input1ShownChoice'.
  604.  */
  605. void
  606.   HideWindow(Panel_item item, int     value, Event *event)
  607. {
  608.   if (item == (Panel_item)VideoFrame_mainWindow->input1ShownChoice)
  609.   {
  610.     if (videoIn1 != (VideoIn)NULL)
  611.       xv_set(VideoFrame_inputWindow1->inputWindow1,
  612.          XV_SHOW, FALSE,
  613.          NULL);
  614.     currentSelection.input1.shown = False;
  615.   }
  616.   else
  617.   {
  618.     if (videoIn2 != (VideoIn)NULL)
  619.       xv_set(VideoFrame_inputWindow2->inputWindow2,
  620.          XV_SHOW, FALSE,
  621.          NULL);
  622.     currentSelection.input2.shown = False;
  623.   }
  624. }                                    /* end function HideWindow */
  625.  
  626.  
  627.  
  628. /*
  629.  * User-defined action for `input1ShownChoice'.
  630.  */
  631. void
  632.   ShowWindow(Panel_item item, int     value, Event *event)
  633. {
  634.   if (item == (Panel_item)VideoFrame_mainWindow->input1ShownChoice)
  635.   {
  636.     if (videoIn1 != (VideoIn)NULL)
  637.     {
  638.       if (xv_get(VideoFrame_inputWindow1->inputWindow1,            /*  If the 1st video window is closed, open it... */
  639.          FRAME_CLOSED) == TRUE)
  640.       {
  641.     xv_set(VideoFrame_inputWindow1->inputWindow1,
  642.            FRAME_CLOSED, FALSE, NULL);
  643.       }
  644.       xv_set(VideoFrame_inputWindow1->inputWindow1,
  645.          XV_SHOW, TRUE, NULL);
  646.     }
  647.     currentSelection.input1.shown = True;
  648.   }
  649.   else
  650.   {
  651.     if (videoIn2 != (VideoIn)NULL)
  652.     {
  653.       if (xv_get(VideoFrame_inputWindow2->inputWindow2,            /*  If the 2nd video window is closed, open it... */
  654.          FRAME_CLOSED) == TRUE)
  655.       {
  656.     xv_set(VideoFrame_inputWindow2->inputWindow2,
  657.            FRAME_CLOSED, FALSE, NULL);
  658.       }
  659.       xv_set(VideoFrame_inputWindow2->inputWindow2,
  660.          XV_SHOW, TRUE, NULL);
  661.     }                                    /* end if (videoIn2... */
  662.     currentSelection.input2.shown = True;
  663.   }                                    /* end else... */
  664. }                                    /* end function ShowWindow */
  665.  
  666.  
  667.  
  668. /*
  669.  * Notify callback function for `input1CroppedChoice'.
  670.  */
  671. void
  672.   VideoFrame_mainWindow_input1CroppedChoice_notify_callback(Panel_item item, int     value, Event *event)
  673. {
  674.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  675.   
  676.   if (value == 0)
  677.   {
  678.     CropWindow(item, value, event);
  679.   }
  680.   
  681.   if (value == 1)
  682.   {
  683.     SqueezeWindow(item, value, event);
  684.   }
  685.   
  686.   /* gxv_end_connections */
  687. }
  688.  
  689.  
  690.  
  691. /*
  692.  * User-defined action for `input1CroppedChoice'.
  693.  */
  694. void
  695.   CropWindow(Panel_item item, int     value, Event *event)
  696. {
  697.   if (item == (Panel_item)VideoFrame_mainWindow->input1CroppedChoice)
  698.   {
  699.     if (videoIn1 != (VideoIn)NULL)
  700.     {
  701.       xv_set(videoIn1, VIDEO_SQUEEZE, FALSE, NULL);            /* Set video window to crop instead of squeeze */
  702.     }
  703.     currentSelection.input1.cropped = True;
  704.   }
  705.   else
  706.   {
  707.     if (videoIn2 != (VideoIn)NULL)
  708.     {
  709.       xv_set(videoIn2, VIDEO_SQUEEZE, FALSE, NULL);            /* Set video window to crop instead of squeeze */
  710.     }                                    /* end if (videoIn2... */
  711.     currentSelection.input2.cropped = True;
  712.   }                                    /* end else... */
  713. }                                    /* end function CropWindow */
  714.  
  715.  
  716.  
  717.  
  718. /*
  719.  * User-defined action for `input1CroppedChoice'.
  720.  */
  721. void
  722.   SqueezeWindow(Panel_item item, int     value, Event *event)
  723. {
  724.   if (item == (Panel_item)VideoFrame_mainWindow->input1CroppedChoice)
  725.   {
  726.     if (videoIn1 != (VideoIn)NULL)
  727.     {
  728.       xv_set(videoIn1, VIDEO_SQUEEZE, TRUE, NULL);            /* Set video window to crop instead of squeeze */
  729.     }
  730.     currentSelection.input1.cropped = False;
  731.   }
  732.   else
  733.   {
  734.     if (videoIn2 != (VideoIn)NULL)
  735.     {
  736.       xv_set(videoIn2, VIDEO_SQUEEZE, TRUE, NULL);            /* Set video window to crop instead of squeeze */
  737.     }                                    /* end if (videoIn2... */
  738.     currentSelection.input2.cropped = False;
  739.   }                                    /* end else... */
  740. }
  741.  
  742.  
  743.  
  744. /*
  745.  * Notify callback function for `input1AspectChoice'.
  746.  */
  747. void
  748.   VideoFrame_mainWindow_input1AspectChoice_notify_callback(Panel_item item, int     value, Event *event)
  749. {
  750.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  751.   
  752.   if (value == 0)
  753.   {
  754.     SetAspectAny(item, value, event);
  755.   }
  756.   
  757.   if (value == 1)
  758.   {
  759.     SetAspect4to3(item, value, event);
  760.   }
  761.   
  762.   /* gxv_end_connections */
  763. }
  764.  
  765.  
  766.  
  767. /*
  768.  * User-defined action for `input1AspectChoice'.
  769.  */
  770. void
  771.   SetAspectAny(Panel_item item, int     value, Event *event)
  772. {
  773.   if (item == (Panel_item)VideoFrame_mainWindow->input1AspectChoice)
  774.   {
  775.     if (videoIn1 != (VideoIn)NULL)
  776.     {
  777.       xv_set(videoIn1, VIDEO_NORMAL_ASPECT, FALSE, NULL);
  778.     }
  779.     currentSelection.input1.aspectRatio = Any;
  780.   }
  781.   else
  782.   {
  783.     if (videoIn2 != (VideoIn)NULL)
  784.     {
  785.       xv_set(videoIn2, VIDEO_NORMAL_ASPECT, FALSE, NULL);
  786.     }                                    /* end if (videoIn2... */
  787.     currentSelection.input2.aspectRatio = Any;
  788.   }                                    /* end else... */
  789. }                                    /* end function SetAspectAny */
  790.  
  791.  
  792.  
  793. /*
  794.  * User-defined action for `input1AspectChoice'.
  795.  */
  796. void
  797. SetAspect4to3(Panel_item item, int     value, Event *event)
  798. {
  799.   if (item == (Panel_item)VideoFrame_mainWindow->input1AspectChoice)
  800.   {
  801.     if (videoIn1 != (VideoIn)NULL)
  802.     {
  803.       xv_set(videoIn1, VIDEO_NORMAL_ASPECT, TRUE, NULL);
  804.     }
  805.     currentSelection.input1.aspectRatio = Fixed;
  806.   }
  807.   else
  808.   {
  809.     if (videoIn2 != (VideoIn)NULL)
  810.     {
  811.       xv_set(videoIn2, VIDEO_NORMAL_ASPECT, TRUE, NULL);
  812.     }                                    /* end if (videoIn2... */
  813.     currentSelection.input2.aspectRatio = Fixed;
  814.   }                                    /* end else... */
  815. }                                    /* end function SetAspect4to3 */
  816.  
  817.  
  818.  
  819. /*
  820.  * Notify callback function for `input1BrightSlider'.
  821.  */
  822. void
  823.   BrightnessHandler(Panel_item item, int value, Event *event)
  824. {
  825.   if (item == (Panel_item)VideoFrame_mainWindow->input1BrightSlider)
  826.   {
  827.     if (videoIn1 != (VideoIn)NULL)
  828.     {
  829.       xv_set(videoIn1, VIDEO_BRIGHTNESS, value, NULL);
  830.     }
  831.     currentSelection.input1.brightness = value;
  832.   }
  833.   else
  834.   {
  835.     if (videoIn2 != (VideoIn)NULL)
  836.     {
  837.       xv_set(videoIn2, VIDEO_BRIGHTNESS, value, NULL);
  838.     }                                    /* end if (videoIn2... */
  839.     currentSelection.input2.brightness = value;
  840.   }                                    /* end else... */
  841.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  842.   
  843.   /* gxv_end_connections */
  844. }                                    /* end function BrightnessHandler */
  845.  
  846.  
  847.  
  848. /*
  849.  * Notify callback function for `input1ContrastSlider'.
  850.  */
  851. void
  852.   ContrastHandler(Panel_item item, int value, Event *event)
  853. {
  854.   if (item == (Panel_item)VideoFrame_mainWindow->input1ContrastSlider)
  855.   {
  856.     if (videoIn1 != (VideoIn)NULL)
  857.     {
  858.       xv_set(videoIn1, VIDEO_CONTRAST, value, NULL);
  859.     }
  860.     currentSelection.input1.contrast = value;
  861.   }
  862.   else
  863.   {
  864.     if (videoIn2 != (VideoIn)NULL)
  865.     {
  866.       xv_set(videoIn2, VIDEO_CONTRAST, value, NULL);
  867.     }                                    /* end if (videoIn2... */
  868.     currentSelection.input2.contrast = value;
  869.   }                                    /* end else... */
  870.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  871.   
  872.   /* gxv_end_connections */
  873.   
  874. }
  875.  
  876.  
  877.  
  878. /*
  879.  * Notify callback function for `input1SaturationSlider'.
  880.  */
  881. void
  882.   SaturationHandler(Panel_item item, int value, Event *event)
  883. {
  884.   if (item == (Panel_item)VideoFrame_mainWindow->input1SaturationSlider)
  885.   {
  886.     if (videoIn1 != (VideoIn)NULL)
  887.     {
  888.       xv_set(videoIn1, VIDEO_SATURATION, value, NULL);
  889.     }
  890.     currentSelection.input1.saturation = value;
  891.   }
  892.   else
  893.   {
  894.     if (videoIn2 != (VideoIn)NULL)
  895.     {
  896.       xv_set(videoIn2, VIDEO_SATURATION, value, NULL);
  897.     }                                    /* end if (videoIn2... */
  898.     currentSelection.input2.saturation = value;
  899.   }                                    /* end else... */
  900.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  901.   
  902.   /* gxv_end_connections */
  903. }                                    /* end function SaturationHandler */
  904.  
  905.  
  906.  
  907. /*
  908.  * Notify callback function for `input1HueSlider'.
  909.  */
  910. void
  911.   HueHandler(Panel_item item, int value, Event *event)
  912. {
  913.   if (item == (Panel_item)VideoFrame_mainWindow->input1HueSlider)
  914.   {
  915.     if (videoIn1 != (VideoIn)NULL)
  916.     {
  917.       xv_set(videoIn1, VIDEO_HUE, value, NULL);
  918.     }
  919.     currentSelection.input1.hue = value;
  920.   }
  921.   else
  922.   {
  923.     if (videoIn2 != (VideoIn)NULL)
  924.     {
  925.       xv_set(videoIn2, VIDEO_HUE, value, NULL);
  926.     }                                    /* end if (videoIn2... */
  927.     currentSelection.input2.hue = value;
  928.   }                                    /* end else... */
  929.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  930.   
  931.   /* gxv_end_connections */
  932. }                                    /* end function HueHandler */
  933.  
  934.  
  935.  
  936. /*
  937.  * Notify callback function for `input2ShownChoice'.
  938.  */
  939. void
  940.   VideoFrame_mainWindow_input2ShownChoice_notify_callback(Panel_item item, int     value, Event *event)
  941. {
  942.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  943.   
  944.   if (value == 0)
  945.   {
  946.     ShowWindow(item, value, event);
  947.   }
  948.   
  949.   if (value == 1)
  950.   {
  951.     HideWindow(item, value, event);
  952.   }
  953.   
  954.   /* gxv_end_connections */
  955. }
  956.  
  957.  
  958.  
  959. /*
  960.  * Notify callback function for `input2CroppedChoice'.
  961.  */
  962. void
  963.   VideoFrame_mainWindow_input2CroppedChoice_notify_callback(Panel_item item, int     value, Event *event)
  964. {
  965.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  966.   
  967.   if (value == 0)
  968.   {
  969.     CropWindow(item, value, event);
  970.   }
  971.   
  972.   if (value == 1)
  973.   {
  974.     SqueezeWindow(item, value, event);
  975.   }
  976.   
  977.   /* gxv_end_connections */
  978. }
  979.  
  980.  
  981.  
  982. /*
  983.  * Notify callback function for `input2AspectChoice'.
  984.  */
  985. void
  986.   VideoFrame_mainWindow_input2AspectChoice_notify_callback(Panel_item item, int     value, Event *event)
  987. {
  988.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  989.   
  990.   if (value == 0)
  991.   {
  992.     SetAspectAny(item, value, event);
  993.   }
  994.   
  995.   if (value == 1)
  996.   {
  997.     SetAspect4to3(item, value, event);
  998.   }
  999.   
  1000.   /* gxv_end_connections */
  1001. }
  1002.  
  1003.  
  1004.  
  1005. /*
  1006.  * Event callback function for `inputWindow1'.
  1007.  */
  1008. Notify_value
  1009.   VideoFrame_inputWindow1_event_callback(Xv_window win, Event *event, Notify_arg arg, Notify_event_type type)
  1010. {
  1011.   
  1012.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  1013.   
  1014.   if (event_action(event) == WIN_RESIZE)
  1015.   {
  1016.     ResizeHandler(win, event, arg, type);
  1017.   }
  1018.   
  1019.   /* gxv_end_connections */
  1020.   
  1021.   return notify_next_event_func(win, (Notify_event) event, arg, type);
  1022. }
  1023.  
  1024.  
  1025.  
  1026. /*
  1027.  * User-defined action for `inputWindow1'.
  1028.  */
  1029. void
  1030.   ResizeHandler(Xv_window win, Event *event, Notify_arg arg, Notify_event_type type)
  1031. {
  1032.   Rect                    tempRect;
  1033.   VideoFrame_inputWindow1_objects*    ip =
  1034.     (VideoFrame_inputWindow1_objects *) xv_get(win, XV_KEY_DATA, INSTANCE);
  1035.   
  1036.   if (win == (Xv_window)VideoFrame_inputWindow1->inputWindow1)        /* Get rect for input 1 */
  1037.   {
  1038.     frame_get_rect(VideoFrame_inputWindow1->inputWindow1,        /* Get new size & position of input1 window */
  1039.            &tempRect);
  1040.     currentSelection.input1.x = tempRect.r_left;
  1041.     currentSelection.input1.y = tempRect.r_top;
  1042.     currentSelection.input1.width = tempRect.r_width;
  1043.     currentSelection.input1.height = tempRect.r_height;
  1044.   }
  1045.   else
  1046.   {
  1047.     frame_get_rect(VideoFrame_inputWindow2->inputWindow2,        /* Get new size & position of input2 window */
  1048.            &tempRect);
  1049.     currentSelection.input2.x = tempRect.r_left;
  1050.     currentSelection.input2.y = tempRect.r_top;
  1051.     currentSelection.input2.width = tempRect.r_width;
  1052.     currentSelection.input2.height = tempRect.r_height;
  1053.   }
  1054. }                                    /* end function ResizeHandler */
  1055.  
  1056.  
  1057.  
  1058. /*
  1059.  * Event callback function for `inputWindow2'.
  1060.  */
  1061. Notify_value
  1062.   VideoFrame_inputWindow2_event_callback(Xv_window win, Event *event, Notify_arg arg, Notify_event_type type)
  1063. {
  1064.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  1065.   
  1066.   if (event_action(event) == WIN_RESIZE)
  1067.   {
  1068.     ResizeHandler(win, event, arg, type);
  1069.   }
  1070.   
  1071.   /* gxv_end_connections */
  1072.   
  1073.   return notify_next_event_func(win, (Notify_event) event, arg, type);
  1074. }
  1075.  
  1076.  
  1077.  
  1078. /*
  1079.  * Notify callback function for `labelField'.
  1080.  */
  1081. Panel_setting
  1082.   LabelFieldHandler(Panel_item item, Event *event)
  1083. {
  1084.   AddHandler(item, event);
  1085.   /* gxv_start_connections DO NOT EDIT THIS SECTION */
  1086.   
  1087.   /* gxv_end_connections */
  1088.   
  1089.   return panel_text_notify(item, event);
  1090. }
  1091.