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

  1. /*
  2.  * Copyright (c) 1990, 1991 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/collab/vcrEdit/RCS/vcrEditEdit.c,v 0.29 92/09/08 14:29:05 drapeau Exp $ */
  25. /* $Log:    vcrEditEdit.c,v $
  26.  * Revision 0.29  92/09/08  14:29:05  drapeau
  27.  * * Fixed errors in the way edit lists are read in, especially
  28.  *   in reading the label part of an edit.
  29.  * * Removed a test for minimum edit length of 3 seconds during
  30.  *   edit preview; this minimum length is based on a specific
  31.  *   limitation of the NEC PC-VCR.  The limitation is now encoded
  32.  *   in the NEC Driver, as it should be.
  33.  * 
  34.  * Revision 0.28  92/07/22  19:17:25  drapeau
  35.  * Fixed small error in OpenHandler(), introduced in the last
  36.  * revision.  The error was in a call to fscanf(); a classic error,
  37.  * passing in a variable as argument instead of a pointer to that
  38.  * variable.  The error is fixed now.
  39.  * 
  40.  * Revision 0.27  92/06/15  14:45:19  drapeau
  41.  * Minor changes, in function OpenHandler():
  42.  * In each line the third argument to the fscanf function is already the address
  43.  * of a string, so the additional & isn't necessary (it does work with the & because the
  44.  * compiler ignores any & before an array or function).  This fixed the corresponding
  45.  * warning messages.
  46.  * 
  47.  * Revision 0.26  92/05/14  00:00:35  drapeau
  48.  * Made several major additions and changes:
  49.  * * Added functions to implement menu items in the edit panel's
  50.  *   Document menu (Save, SaveAs, CloseFile, etc.).  Also, changed
  51.  *   the semantics of some of these functions to simplify the
  52.  *   interface.
  53.  * * Added a function UpdateHeader() to print the name of the current
  54.  *   document on the title bar of the edit list panel, and to print
  55.  *   the word "modified" along with the title if the document was
  56.  *   modified in any way.
  57.  * * Modified several functions that manipulate the edit list (EditAdd(),
  58.  *   EditModify(), etc.) to update modified status, and to call the
  59.  *   UpdateHeader() function to reflect that status in the interface.
  60.  * * Formatting changes to conform to coding standards.
  61.  * 
  62.  * Revision 0.25  92/01/03  18:00:04  drapeau
  63.  * Changed all calls to Browse() to use "0" instead of "NULL", to
  64.  * take into account ANSI-C definition of NULL as (void*)0.
  65.  * 
  66.  * Revision 0.24  91/09/26  12:32:27  lim
  67.  * 1. Did casting for xv_get's.
  68.  * 2. Corrected duration for SetDuration in the case when
  69.  * no device is installed.
  70.  * 
  71.  * Revision 0.23  91/08/28  17:02:41  lim
  72.  * Clears current selection panel in EditDeleteAll.
  73.  * 
  74.  * Revision 0.22  91/08/28  12:52:22  lim
  75.  * Corrected duration. 
  76.  * 
  77.  * Revision 0.21  91/08/24  18:00:05  lim
  78.  * Implemented PrintDiagnostics. With command line flag '-d', the 
  79.  * app will launch such that it prints all diag messages.
  80.  * 
  81.  * Revision 0.20  91/08/23  17:23:44  lim
  82.  * 1. Document format has changed.
  83.  * 2. Duration can be calculated regardless of whether
  84.  * myVideo has been initialized or not.
  85.  * 
  86.  * Revision 0.19  91/08/20  15:21:16  lim
  87.  * currTape is no longer reset to "NULL" if tape doesn't match edit file.
  88.  * 
  89.  * Revision 0.18  91/08/20  15:18:09  lim
  90.  * Fixed deleting old edits.
  91.  * 
  92.  * Revision 0.17  91/08/17  20:49:37  lim
  93.  * OpenPanel now called Browse.
  94.  * 
  95.  * Revision 0.16  91/08/16  13:02:50  lim
  96.  * Always display 2-digit numbers for hr, sec, min, frame.
  97.  * 
  98.  * Revision 0.15  91/08/16  12:33:19  lim
  99.  * Interface changes, such as merging editCurrSelMsg into editNewEditMsg.
  100.  * 
  101.  * Revision 0.14  91/08/11  18:44:14  lim
  102.  * Added warning message before loading new file and there are unsaved
  103.  * changes.
  104.  * 
  105.  * Revision 0.13  91/08/09  16:42:52  lim
  106.  * Included openPanel.
  107.  * 
  108.  * Revision 0.12  91/08/08  16:28:49  lim
  109.  * 1. Added instance pointer to each public videoObject function call.
  110.  * 2. DisplayError() now has 2 arguments.
  111.  * 3. currentAudio is used to denote current audio setting in edit list.
  112.  *    audioStg is set only when EditAdd() or EditModify() is called.
  113.  * 4. Checks if speed is zero when adding/modifying. This is disallowed.
  114.  * 
  115.  * Revision 0.11  91/07/20  11:43:53  lim
  116.  * Added code to support audio and speed settings for each edit.
  117.  * 
  118.  * Revision 0.10  91/07/16  16:16:24  lim
  119.  * Initial revision.
  120.  *  */
  121.  
  122. #include "vcrEdit.h"
  123.  
  124. static char editrcsid[] = "$Header: /Source/Media/collab/vcrEdit/RCS/vcrEditEdit.c,v 0.29 92/09/08 14:29:05 drapeau Exp $";
  125.  
  126. int currentAudio;
  127. char currentFilename[256];                        /* Name of file currently open in edit list */
  128.  
  129. /*     VIDEO EDIT FUNCTIONS (POPUP WINDOW 2)     */
  130.  
  131. /* format an edit entry for the panel list */
  132. void
  133. PrintOnList(current, buf)
  134.      int current;
  135.      char buf[70];
  136. {
  137.   char audio[7];
  138.  
  139.   switch (currentAudio)
  140.   {
  141.    case Stereo:
  142.     strcpy(audio, "Stereo");
  143.     break;
  144.    case Right:
  145.     strcpy(audio, "Right");
  146.     break;
  147.    case Left:
  148.     strcpy(audio, "Left");
  149.     break;
  150.    case Mute:
  151.     strcpy(audio, "Mute");
  152.     break;
  153.    default:
  154.     DisplayError("Invalid audio setting", " ");
  155.     return;
  156.   }
  157.   
  158.   sprintf (buf, " %5d.  %-26.22s%.11s %.11s   %-8s%d", 
  159.        current+1, label[current], startframe[current], 
  160.        endframe[current], audio, speedStg[current]);
  161. }
  162.  
  163. /* print the number of edit entries on the list */
  164. void
  165. PrintNumEdits()
  166. {
  167.   char edit[20];
  168.   
  169.   sprintf(edit, "No. of Edits : %d", lines);
  170.   xv_set(vcrEdit_editPopup->editNumEditMsg, PANEL_LABEL_STRING, 
  171.      edit, NULL);
  172. }
  173.  
  174. /* file error handling procedure */
  175. void 
  176. FileError(optype)
  177.      int optype;
  178. {
  179.   char buf[40];
  180.   
  181.   if (optype == SAVE) 
  182.     strcpy(buf, "Error in writing file.");
  183.   else 
  184.     switch(errno) 
  185.     {
  186.      case ENOTDIR:
  187.      case EFAULT: 
  188.      case ENOENT:    
  189.       strcpy(buf, "File or directory does not exist.");
  190.       break;
  191.      case EACCES: 
  192.       strcpy(buf, "File path search permission denied.");
  193.       break;
  194.      default:    
  195.       strcpy(buf, "Error in opening file.");
  196.        break;
  197.      }
  198.  
  199.   DisplayError(buf, " ");
  200. }
  201.  
  202. /*
  203.  * Menu handler for `DocMenu (Open)'.
  204.  */
  205. Menu_item
  206. FileLoad(item, op)
  207.     Menu_item    item;
  208.     Menu_generate    op;
  209. {
  210.   int result;
  211.  
  212.   if (op != MENU_NOTIFY)
  213.     return item;
  214.   
  215.   if ((change) && (lines > 0)) 
  216.   {
  217.     result = notice_prompt(vcrEdit_editPopup->editPopup, NULL,
  218.                NOTICE_MESSAGE_STRINGS,
  219.                "Unsaved changes exist in the edit list.",
  220.                "Loading a file will erase all changes.",
  221.                "Go ahead and load the file?",
  222.                NULL,
  223.                NOTICE_BUTTON_NO,    "Yes",
  224.                NOTICE_BUTTON_YES,    "No",
  225.                NULL);
  226.     if (result == NOTICE_YES)
  227.       return;
  228.   }
  229.   
  230.   Browse(NULL, BrowseOpen, 0, "#VCR Edit Document#", "vcrEdit");
  231.   return item;
  232. }
  233.  
  234.  
  235.  
  236. void
  237. DisplayEditList(oldlines, newlines)
  238.      int oldlines;
  239.      int newlines;
  240. {
  241.   char buf[70];
  242.   int i; 
  243.  
  244.   if (editnum != -1)                            /* Deselect any current selection */
  245.     xv_set(vcrEdit_editPopup->editScrollList,
  246.        PANEL_LIST_SELECT, editnum, FALSE,
  247.        NULL);
  248.   xv_set(vcrEdit_editPopup->editScrollList,                /* To prevent blinking of list, set XV_SHOW to FALSE first */
  249.      XV_SHOW, FALSE,
  250.      NULL);
  251.   for (i=0; i<oldlines; i++)                        /* Replace the old string by the new one */
  252.   {    
  253.     currentAudio = audioStg[i];
  254.     PrintOnList(i, buf);
  255.     xv_set (vcrEdit_editPopup->editScrollList,
  256.         PANEL_LIST_STRING, i, buf,
  257.         PANEL_LIST_FONT, i, font,
  258.         NULL);
  259.   }
  260.   if (oldlines < newlines)                        /* Insert the additional new strings */
  261.     for (i=oldlines; i<newlines; i++) 
  262.     {
  263.       currentAudio = audioStg[i];
  264.       PrintOnList(i, buf);
  265.       xv_set (vcrEdit_editPopup->editScrollList,
  266.           PANEL_LIST_INSERT, i,
  267.           PANEL_LIST_STRING, i, buf,
  268.           PANEL_LIST_FONT, i, font,
  269.           NULL);
  270.     }
  271.   else for (i=oldlines-1; i>newlines-1; i--)                /* Delete all additional old entries in the edit list */
  272.     xv_set(vcrEdit_editPopup->editScrollList,
  273.        PANEL_LIST_DELETE, i,
  274.        NULL);
  275.   xv_set(vcrEdit_editPopup->editScrollList,                /* Reshow the scrolling list */
  276.      XV_SHOW, TRUE,
  277.      NULL);
  278.   xv_set(vcrEdit_editPopup->editModButton,                /* Set modify, delete buttons to inactive */
  279.      PANEL_INACTIVE, TRUE, NULL);
  280.   xv_set(vcrEdit_editPopup->editDelButton,
  281.      PANEL_INACTIVE, TRUE, NULL);
  282.   PrintNumEdits();
  283.   editnum = -1;                                /* Housekeeping stuff */
  284.   change = 0;
  285.   sprintf(currentFilename, "Untitled");
  286. }                                    /* end function DisplayEditList */
  287.  
  288.  
  289. int 
  290.   OpenHandler(char* proposedPath, int id)
  291. {
  292.   int i;
  293.   int oldlines;
  294.   char header[MAX_LABELSIZE];
  295.   char tempLabel[32];
  296.   char tapeCode[10];
  297.   char tmp[25];
  298.   char diagMsg[30];
  299.   FILE* fp;
  300.   
  301.   fp = fopen(proposedPath, "r");                    /* Open file and load onto edit list */
  302.   fgets(header, 20, fp);    
  303.   
  304.   if (strcmp(header, "#VCR Edit Document#") != 0)            /* This isn't of correct file type */
  305.   {
  306.     fclose(fp);
  307.     return 1;
  308.   }
  309.   else
  310.   {
  311.     fscanf(fp, "%*s%*s%s\n", tapeCode);                    
  312.     oldlines = lines;
  313.     fscanf(fp, "%*s%*s%*s%d", &lines);
  314.     for (i=0; i<lines; i++) 
  315.     {
  316.       fscanf(fp, "%*s%*s%*d");                    
  317.       fscanf(fp, "%*s%*s%s\n", startframe[i]);
  318.       fscanf(fp, "%*s%*s%s\n", endframe[i]);
  319.       fscanf(fp, "%*s%*s%d\n", &(audioStg[i]));
  320.       fscanf(fp, "%*s%*s%*s%d\n", &(speedStg[i]));
  321.       fgets(tempLabel, 32, fp);
  322.       strncpy(label[i], &tempLabel[8], 22);
  323.       if (strlen(label[i]) < MAX_LABELSIZE)                /* Remove newline character if necessary */
  324.     label[i][strlen(label[i])-1] = '\0';
  325.       if ((strlen(label[i]) == MAX_LABELSIZE) &&
  326.       (label[i][MAX_LABELSIZE - 1] == '\n'))
  327.     label[i][MAX_LABELSIZE -1] = '\0';
  328.     }
  329.     fclose (fp);
  330.     change = 0;
  331.     DisplayEditList(oldlines, lines);                    /* Print the new file on edit list */
  332.     UpdateHeader(proposedPath, 0);                    /* Print new filename on the title bar */
  333.     xv_set(vcrEdit_editPopup->editNewEditMsg, PANEL_LABEL_STRING, 
  334.        "Current Selection : New Edit", NULL);
  335.     strcpy(currentFilename, proposedPath);                /* Copy filename into currentFilename */
  336.     return 0;                                /* Returns 0 to openPanel */
  337.   }
  338. }                                    /* end function OpenHandler */
  339.  
  340.  
  341. /*
  342.  * Menu handler for `DocMenu (Save)'.
  343.  */
  344. Menu_item
  345. FileSave(item, op)
  346.     Menu_item    item;
  347.     Menu_generate    op;
  348. {
  349.   if ((op == MENU_NOTIFY) && lines)
  350.     if (strcmp(currentFilename, "Untitled") != 0)
  351.       Browse(currentFilename, BrowseCheckSave, 1, 
  352.          "#VCR Edit Document#", "vcrEdit");
  353.     else
  354.       Browse(NULL, BrowseSave, 0, "#VCR Edit Document#", "vcrEdit");
  355.   
  356.   return item;
  357. }
  358.  
  359. /*
  360.  * Menu handler for `DocMenu (Save As ...)'.
  361.  */
  362. Menu_item
  363. FileSaveAs(item, op)
  364.     Menu_item    item;
  365.     Menu_generate    op;
  366. {
  367.   if ((op == MENU_NOTIFY) && lines)
  368.     Browse(NULL, BrowseSave, 0, "#VCR Edit Document#", "vcrEdit");
  369.   return item;
  370. }
  371.  
  372.  
  373.  
  374. int
  375. SaveHandler(proposedPath, id)
  376.      char* proposedPath;
  377.      int id;
  378. {
  379.   int i, result;
  380.   char header[20];
  381.   char buf[40];
  382.   struct stat stbuf;
  383.   FILE* fp;
  384.   
  385.   if (stat(proposedPath, &stbuf) == 0)                    /* check if file existed previously ... */
  386.   {                                    /* ...and if it is a vcr edit file */
  387.     fp = fopen(proposedPath, "r");
  388.     fgets(header, 20, fp);
  389.     fclose(fp);
  390.     if (strcmp(header, "#VCR Edit Document#") != 0) 
  391.       sprintf(buf, "This file is not a vcr edit file.");
  392.     else
  393.       sprintf(buf, "This vcr edit file exists.");
  394.     if (!id)
  395.     {
  396.       result = DisplayChoice(buf, "Do you wish to overwrite it?",
  397.                  "No", "Yes");
  398.       if (result == NOTICE_YES) 
  399.     return 1;                            /* Returns 1 to openPanel */
  400.     }
  401.   }
  402.   fp = fopen(proposedPath, "w");
  403.   if (fp == NULL) 
  404.   {
  405.     FileError(SAVE);
  406.     return 1;
  407.   }
  408.   lines = xv_get(vcrEdit_editPopup->editScrollList, PANEL_LIST_NROWS);
  409.   fprintf(fp, "#VCR Edit Document#\n");                    /* Open and write the file */
  410.   fprintf(fp, "#Tape Code:\tNULL\n");                    /* No longer check for medium identification */
  411.   fprintf(fp, "#Number of Edits:\t%d\n\n", lines);
  412.   for (i=0; i<lines; i++) 
  413.   {
  414.     fprintf(fp, "#Edit Number:\t%d\n", i+1);
  415.     fprintf(fp, "#Start Address:\t%.11s\n", startframe[i]);
  416.     fprintf(fp, "#End Address:\t%.11s\n", endframe[i]);
  417.     fprintf(fp, "#Audio Setting:\t%d\n", audioStg[i]);
  418.     fprintf(fp, "#Speed in frames/second:\t%d\n", speedStg[i]);
  419.     fprintf(fp, "#Label:\t%s\n\n", label[i]);
  420.   }
  421.   fclose (fp);
  422.  
  423.   xv_set(vcrEdit_editPopup->editPopup, XV_LABEL,            /* Changes title bar of window */
  424.      proposedPath, NULL);    
  425.   if (!id)                                /* Was a SaveAs */
  426.   {
  427.     bzero(currentFilename, 256);
  428.     strcpy(currentFilename, proposedPath);
  429.   }
  430.   change = 0;
  431.   UpdateHeader(currentFilename, 0);
  432.   return 0;
  433. }                                    /* end function SaveHandler */
  434.  
  435.  
  436.  
  437. /*
  438.  * Menu handler for `DocMenu (Close File)'.
  439.  */
  440. Menu_item
  441.   EditFileClose(item, op)
  442. Menu_item    item;
  443. Menu_generate    op;
  444. {
  445.   int result;
  446.   
  447.   if (op != MENU_NOTIFY)
  448.     return item; 
  449.   
  450.   if ((change) && (lines > 0)) 
  451.   {
  452.     result = notice_prompt(vcrEdit_editPopup->editPopup, NULL,
  453.                NOTICE_MESSAGE_STRINGS,
  454.                "Unsaved changes exist in the edit list.",
  455.                "Go ahead and close file without saving changes? ",
  456.                NULL,
  457.                NOTICE_BUTTON_NO,    "Yes",
  458.                NOTICE_BUTTON_YES,    "No",
  459.                NULL);
  460.     if (result == NOTICE_YES)
  461.       return item;
  462.   }            
  463.   DisplayEditList(lines, 0);                        /* Display new edit list which originally had 'lines'... */
  464.   lines = 0;                                /* ...and now has 0 lines. */
  465.   change = 0;
  466.   UpdateHeader("Untitled", 0);
  467.   xv_set(vcrEdit_editPopup->editNewEditMsg, 
  468.      PANEL_LABEL_STRING, "Current Selection : None", 
  469.      NULL);
  470.   xv_set(vcrEdit_editPopup->editStartTxt1, 
  471.      PANEL_VALUE, "00", NULL);
  472.   xv_set(vcrEdit_editPopup->editStartTxt2, 
  473.      PANEL_VALUE, "00", NULL);
  474.   xv_set(vcrEdit_editPopup->editStartTxt3, 
  475.      PANEL_VALUE, "00", NULL);
  476.   xv_set(vcrEdit_editPopup->editStartTxt4, 
  477.      PANEL_VALUE, "00", NULL);
  478.   xv_set(vcrEdit_editPopup->editEndTxt1, 
  479.      PANEL_VALUE, "00", NULL);
  480.   xv_set(vcrEdit_editPopup->editEndTxt2, 
  481.      PANEL_VALUE, "00", NULL);
  482.   xv_set(vcrEdit_editPopup->editEndTxt3, 
  483.      PANEL_VALUE, "00", NULL);
  484.   xv_set(vcrEdit_editPopup->editEndTxt4, 
  485.      PANEL_VALUE, "00", NULL);
  486.   xv_set(vcrEdit_editPopup->editDurTxt, 
  487.      PANEL_VALUE, "0", NULL);
  488.   xv_set(vcrEdit_editPopup->editLabelTxt, 
  489.      PANEL_VALUE, " ", NULL);
  490.   xv_set(vcrEdit_editPopup->editSpeedTxt, 
  491.      PANEL_VALUE, FrameRate, NULL);
  492.   return item;
  493. }                                    /* end function EditFileClose */
  494.  
  495.  
  496.  
  497. /*
  498.  * Menu handler for `DocMenu (Close Window)'.
  499.  */
  500. Menu_item
  501. EditCloseWindow(item, op)
  502.     Menu_item    item;
  503.     Menu_generate    op;
  504. {
  505.   if (op == MENU_NOTIFY)
  506.   {  
  507.     xv_set(vcrEdit_previewPopup->previewPopup, FRAME_CMD_PUSHPIN_IN, FALSE, NULL);
  508.     xv_set(vcrEdit_previewPopup->previewPopup, XV_SHOW, FALSE, NULL);
  509.     xv_set(vcrEdit_editPopup->editPopup, FRAME_CMD_PUSHPIN_IN, FALSE, NULL);
  510.     xv_set(vcrEdit_editPopup->editPopup, XV_SHOW, FALSE, NULL);
  511.   }
  512.  
  513.   return item;
  514. }
  515.  
  516. void
  517. EditDone(item, event)
  518.      Panel_item    item;
  519.      Event        *event;
  520. {
  521.   xv_set(vcrEdit_previewPopup->previewPopup, FRAME_CMD_PUSHPIN_IN, FALSE, NULL);
  522.   xv_set(vcrEdit_previewPopup->previewPopup, XV_SHOW, FALSE, NULL);
  523.   xv_set(vcrEdit_editPopup->editPopup, FRAME_CMD_PUSHPIN_IN, FALSE, NULL);
  524.   xv_set(vcrEdit_editPopup->editPopup, XV_SHOW, FALSE, NULL);
  525. }
  526.  
  527.  
  528.  
  529. /*
  530.  * Menu handler for `editAudioMenu (Stereo)'.
  531.  */
  532. Menu_item
  533. EditAudioStereo(item, op)
  534.     Menu_item    item;
  535.     Menu_generate    op;
  536. {
  537.   if (op == MENU_NOTIFY)
  538.   {
  539.     xv_set(vcrEdit_editPopup->editAudioMenuButton, PANEL_LABEL_STRING, "Stereo", NULL);
  540.     currentAudio = Stereo;
  541.   }
  542.  
  543.   return item;
  544. }
  545.  
  546.  
  547. /*
  548.  * Menu handler for `editAudioMenu (Right)'.
  549.  */
  550. Menu_item
  551. EditAudioRight(item, op)
  552.     Menu_item    item;
  553.     Menu_generate    op;
  554. {
  555.   if (op == MENU_NOTIFY)
  556.   {
  557.     xv_set(vcrEdit_editPopup->editAudioMenuButton, PANEL_LABEL_STRING, "Right", NULL);
  558.     currentAudio = Right;
  559.   }
  560.   
  561.   return item;
  562. }
  563.  
  564.  
  565. /*
  566.  * Menu handler for `editAudioMenu (Left)'.
  567.  */
  568. Menu_item
  569. EditAudioLeft(item, op)
  570.     Menu_item    item;
  571.     Menu_generate    op;
  572. {
  573.   if (op == MENU_NOTIFY)
  574.   {
  575.     xv_set(vcrEdit_editPopup->editAudioMenuButton, PANEL_LABEL_STRING, "Left", NULL);
  576.     currentAudio = Left;
  577.   }
  578.   return item;
  579. }
  580.  
  581.  
  582. /*
  583.  * Menu handler for `editAudioMenu (Mute)'.
  584.  */
  585. Menu_item
  586. EditAudioMute(item, op)
  587.     Menu_item    item;
  588.     Menu_generate    op;
  589. {
  590.   if (op == MENU_NOTIFY)
  591.   {
  592.     xv_set(vcrEdit_editPopup->editAudioMenuButton, PANEL_LABEL_STRING, "Mute", NULL);
  593.     currentAudio = Mute;
  594.   }
  595.  
  596.   return item;
  597. }
  598.  
  599. /*
  600.  * Notify callback function for `editSpeedTxt'.
  601.  */
  602. Panel_setting
  603. EditSpeedSet(item, event)
  604.     Panel_item    item;
  605.     Event        *event;
  606. {
  607.   if ((event_action(event) != '\r') && (event_action(event) != '\n'))
  608.     return panel_text_notify(item, event);
  609.  
  610.   if (editnum != -1)
  611.     speedStg[editnum]  =  xv_get(item, PANEL_VALUE);
  612.   SetDuration();
  613.   
  614.   return panel_text_notify(item, event);
  615. }
  616.  
  617.  
  618. /* Procedures to display addresses */
  619.  
  620. void 
  621. DisplayStartFrame(address)
  622.      int address;
  623. {
  624.   int hr;
  625.   int min;
  626.   int sec;
  627.   int fr;
  628.   char hour[2];
  629.   char minute[2];
  630.   char second[2];
  631.   char frame[2];
  632.   extern void ConvertToTime();
  633.   
  634.   ConvertToTime(&hr, &min, &sec, &fr,  address);
  635.   sprintf(hour, "%.2d", hr);
  636.   sprintf(minute, "%.2d", min);
  637.   sprintf(second, "%.2d", sec);
  638.   sprintf(frame, "%.2d", fr);
  639.   
  640.   xv_set(vcrEdit_editPopup->editStartTxt1, PANEL_VALUE, hour, NULL);
  641.   xv_set(vcrEdit_editPopup->editStartTxt2, PANEL_VALUE, minute, NULL);
  642.   xv_set(vcrEdit_editPopup->editStartTxt3, PANEL_VALUE, second, NULL);
  643.   xv_set(vcrEdit_editPopup->editStartTxt4, PANEL_VALUE, frame, NULL);
  644. }
  645.  
  646. /*
  647.   Button notify proc to get the start frame number (editGetStartButton)
  648.   */
  649. void
  650. GetStart(item, event)
  651.      Panel_item    item;
  652.      Event        *event;
  653. {
  654.   DisplayStartFrame(DevQueryFrame(myVideo));
  655. }
  656.  
  657.  
  658. void 
  659. DisplayEndFrame(address)
  660.      int address;
  661. {
  662.   int hr; 
  663.   int min;
  664.   int sec;
  665.   int fr;
  666.   char hour[2];
  667.   char minute[2];
  668.   char second[2];
  669.   char frame[2];
  670.   
  671.   ConvertToTime(&hr, &min, &sec, &fr, address);
  672.   sprintf(hour, "%.2d", hr);
  673.   sprintf(minute, "%.2d", min);
  674.   sprintf(second, "%.2d", sec);
  675.   sprintf(frame, "%.2d", fr);
  676.   
  677.   xv_set(vcrEdit_editPopup->editEndTxt1, PANEL_VALUE, hour, NULL);
  678.   xv_set(vcrEdit_editPopup->editEndTxt2, PANEL_VALUE, minute, NULL);
  679.   xv_set(vcrEdit_editPopup->editEndTxt3, PANEL_VALUE, second, NULL);
  680.   xv_set(vcrEdit_editPopup->editEndTxt4, PANEL_VALUE, frame, NULL);
  681.   SetDuration();
  682. }
  683.  
  684. /*
  685.   Button notify proc to get the end frame number (editGetEndButton)
  686.   */
  687. void
  688. GetEnd(item, event)
  689.      Panel_item    item;
  690.      Event        *event;
  691. {
  692.   DisplayEndFrame(DevQueryFrame(myVideo));
  693. }
  694.  
  695. /*
  696.  * Menu handler for `previewMenu (Play part of edit...)'.
  697.  */
  698. Menu_item
  699. EditPreview(item, op)
  700.      Menu_item       item;
  701.      Menu_generate   op;
  702. {
  703.   if (op == MENU_NOTIFY)
  704.   {
  705.     xv_set(vcrEdit_previewPopup->previewPopup, FRAME_CMD_PUSHPIN_IN, TRUE, NULL);
  706.     xv_set(vcrEdit_previewPopup->previewPopup, XV_SHOW, TRUE, NULL);
  707.   }
  708.   return item;
  709. }
  710.  
  711. /* Procedure to display the approximate duration of the current selection.
  712.  * Durations must be at least 3 seconds long.
  713.  * Returns 0 if end address less than start address.
  714.  */
  715. int
  716. SetDuration()
  717. {
  718.   int start, starthr, startmin, startsec, startfr;
  719.   int end, endhr, endmin, endsec, endfr;
  720.   int duration;
  721.   int speedInFrames;
  722.   int speedInDevice;
  723.   char hr[2];
  724.   char min[2];
  725.   char sec[2];
  726.   char frame[2];
  727.   char buf[80];
  728.   
  729.   starthr = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt1, PANEL_VALUE));
  730.   startmin = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt2, PANEL_VALUE));
  731.   startsec = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt3, PANEL_VALUE));
  732.   startfr = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt4, PANEL_VALUE));
  733.   start = ConvertToAddress(starthr, startmin, startsec, startfr);
  734.   
  735.   endhr = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt1, PANEL_VALUE));
  736.   endmin = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt2, PANEL_VALUE));
  737.   endsec = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt3, PANEL_VALUE));
  738.   endfr = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt4, PANEL_VALUE));
  739.   end = ConvertToAddress(endhr, endmin, endsec, endfr);
  740.   
  741.   if (end - start < 0) 
  742.   {
  743.     DisplayError("End address is less than start address.", " ");
  744.     return 0;
  745.   }    
  746.   speedInFrames =  xv_get(vcrEdit_editPopup->editSpeedTxt,
  747.                     PANEL_VALUE);
  748.   if (myVideo)
  749.   {
  750.     speedInDevice =  DevCalcSpeed(myVideo, speedInFrames, 1);
  751.     
  752.     if ((speedInDevice) && (end - start))
  753.       duration = ((((end - start)%speedInDevice)/speedInDevice > 0.5) ? /* Round to nearest second */
  754.           (((end - start)/speedInDevice) + 1) 
  755.           : ((end - start)/speedInDevice));       
  756.     else 
  757.       duration = 0;
  758.   }
  759.   else
  760.   {
  761.     if ((speedInFrames) && (end - start))
  762.       duration = ((end - start)/speedInFrames +1);    
  763.     else
  764.       duration = 0;
  765.   }
  766.   
  767.   sprintf (buf, "%d", duration);
  768.   xv_set(vcrEdit_editPopup->editDurTxt, PANEL_VALUE, buf, NULL);
  769.   return duration;
  770. }                                    /* end function SetDuration */
  771.  
  772.  
  773.  
  774. /*
  775.   Button notify proc to add the current selection to the edit list
  776.   (editAddButton)
  777.   */
  778. void
  779. EditAdd(item, event)
  780.      Panel_item    item;
  781.      Event        *event;
  782. {
  783.   char buf[70];
  784.   char s[30];
  785.   int starthr; 
  786.   int startmin;
  787.   int startsec;
  788.   int startfr;
  789.   int endhr;
  790.   int endmin;
  791.   int endsec;
  792.   int endfr;
  793.   char start[11];
  794.   char end[11];
  795.   
  796.   if ((int) xv_get(vcrEdit_editPopup->editSpeedTxt, PANEL_VALUE) <= 0)
  797.   {
  798.     DisplayError("Zero speed is not acceptable", "Please enter another value");
  799.     return;
  800.   }
  801.   starthr = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt1,   /* Get start frame and label */
  802.                 PANEL_VALUE));
  803.   startmin = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt2,
  804.                  PANEL_VALUE));
  805.   startsec = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt3,
  806.                  PANEL_VALUE));
  807.   startfr = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt4,
  808.                 PANEL_VALUE));
  809.  
  810.   endhr = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt1,        /* Get end frame & label */
  811.                   PANEL_VALUE));
  812.   endmin = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt2,
  813.                    PANEL_VALUE));
  814.   endsec = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt3,
  815.                    PANEL_VALUE));
  816.   endfr = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt4,
  817.                   PANEL_VALUE));
  818.   
  819.   if (!SetDuration())
  820.     return;
  821.   
  822.   sprintf(start, "%.2d:%.2d:%.2d:%.2d", starthr, startmin, 
  823.       startsec, startfr);    
  824.   sprintf(end, "%.2d:%.2d:%.2d:%.2d", endhr, endmin,
  825.       endsec, endfr);
  826.   strncpy(startframe[lines], start, 11);
  827.   strncpy(endframe[lines], end, 11);
  828.   strcpy(label[lines], 
  829.      (char *) xv_get (vcrEdit_editPopup->editLabelTxt, PANEL_VALUE));
  830.   speedStg[lines] =  xv_get (vcrEdit_editPopup->editSpeedTxt, PANEL_VALUE);
  831.   audioStg[lines] = currentAudio;
  832.  
  833.   xv_set(vcrEdit_editPopup->editScrollList,                /* To prevent blinking of list, set XV_SHOW to FALSE first */
  834.      XV_SHOW, FALSE,
  835.      NULL);
  836.  
  837.   PrintOnList(lines, buf);                        /* Add this entry to the edit list */
  838.   xv_set(vcrEdit_editPopup->editScrollList,
  839.      PANEL_LIST_INSERT, lines,
  840.      PANEL_LIST_STRING, lines, buf,
  841.      PANEL_LIST_FONT, lines, font,
  842.      NULL);
  843.   if (editnum != -1)
  844.     xv_set(vcrEdit_editPopup->editScrollList,
  845.        PANEL_LIST_SELECT, editnum, FALSE,
  846.        NULL);
  847.   xv_set(vcrEdit_editPopup->editScrollList,                /* Reshow the scrolling list */
  848.      XV_SHOW, TRUE,
  849.      NULL);
  850.   xv_set(vcrEdit_editPopup->editScrollList,                /* Select the newly added entry */
  851.      PANEL_LIST_SELECT, lines, TRUE,
  852.      NULL);
  853.   editnum = lines;
  854.   lines++;
  855.   xv_set(vcrEdit_editPopup->editModButton,                /* Make the modify and delete buttons active */
  856.      PANEL_INACTIVE, FALSE, NULL);
  857.   xv_set(vcrEdit_editPopup->editDelButton,
  858.      PANEL_INACTIVE, FALSE, NULL);
  859.   sprintf(s, "Current Selection : Edit #%d", lines);            /* Update edit status info */
  860.   xv_set(vcrEdit_editPopup->editNewEditMsg,
  861.      PANEL_LABEL_STRING, s, NULL);
  862.   PrintNumEdits();
  863.   change = 1;
  864.   UpdateHeader(currentFilename, 1);
  865. }                                    /* end function EditAdd */
  866.  
  867.  
  868.  
  869. /*
  870.   Button notify proc to delete the current selection from the edit list
  871.   (editDelButton)
  872.   */
  873. void
  874.   EditDelete(item, event)
  875. Panel_item      item;
  876. Event           *event;
  877. {
  878.   int i;
  879.   char buf[70];
  880.   
  881.   xv_set(vcrEdit_editPopup->editScrollList,                /* Delete the current selection */
  882.      PANEL_LIST_SELECT, editnum, FALSE,
  883.      NULL);
  884.   if (editnum != 0) 
  885.     xv_set(vcrEdit_editPopup->editScrollList,
  886.        PANEL_LIST_SELECT, editnum - 1, TRUE,
  887.        NULL);
  888.   xv_set(vcrEdit_editPopup->editScrollList,
  889.      PANEL_LIST_DELETE, editnum,
  890.      NULL);
  891.   xv_set(vcrEdit_editPopup->editScrollList,                /* To prevent blinking of list, set XV_SHOW to FALSE first */
  892.      XV_SHOW, FALSE,
  893.      NULL);
  894.   lines --;                                /* Shift all the following edit entries up by one */
  895.   for (i=editnum; i < lines;i++) 
  896.   {
  897.     strncpy(startframe[i], startframe[i+1], 11);
  898.     strncpy(endframe[i], endframe[i+1], 11);
  899.     strcpy(label[i], label[i+1]);
  900.     audioStg[i] = audioStg[i+1];
  901.     speedStg[i] = speedStg[i+1];
  902.     currentAudio = audioStg[i];
  903.     
  904.     PrintOnList(i, buf);
  905.     xv_set(vcrEdit_editPopup->editScrollList,
  906.        PANEL_LIST_STRING, i, buf,
  907.        PANEL_LIST_FONT, i, font,
  908.        NULL);
  909.   }
  910.   xv_set(vcrEdit_editPopup->editScrollList,                /* Reshow the scrolling list */
  911.      XV_SHOW, TRUE,
  912.      NULL);
  913.   
  914.   if (editnum != 0) 
  915.     xv_set(vcrEdit_editPopup->editScrollList,
  916.        PANEL_LIST_SELECT, editnum - 1, FALSE,
  917.        NULL);
  918.   xv_set(vcrEdit_editPopup->editNewEditMsg, PANEL_LABEL_STRING, 
  919.      "Current Selection : New Edit", NULL);
  920.   xv_set(vcrEdit_editPopup->editModButton,                /* Make the delete, modify buttons inactive */
  921.      PANEL_INACTIVE, TRUE, NULL);
  922.   xv_set(vcrEdit_editPopup->editDelButton,
  923.      PANEL_INACTIVE, TRUE, NULL);
  924.   PrintNumEdits();
  925.   change = 1;
  926.   editnum = -1;
  927.   UpdateHeader(currentFilename, 1);
  928. }                                    /* end function EditDelete */
  929.  
  930.  
  931.  
  932. /*
  933.   Button notify proc to modify the current selection (editModButton)
  934.   */
  935. void
  936.   EditModify(item, event)
  937. Panel_item    item;
  938. Event        *event;
  939. {
  940.   char buf[70];
  941.   char start[11];
  942.   char end[11];
  943.   int starthr;
  944.   int startmin; 
  945.   int startsec; 
  946.   int startfr;
  947.   int endhr;
  948.   int endmin; 
  949.   int endsec;
  950.   int endfr;
  951.   
  952.   if ((int) xv_get(vcrEdit_editPopup->editSpeedTxt, PANEL_VALUE) <= 0)
  953.   {
  954.     DisplayError("Zero speed is not acceptable", "Please enter another value");
  955.     return;
  956.   }
  957.   starthr = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt1, PANEL_VALUE));
  958.   startmin = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt2, PANEL_VALUE));
  959.   startsec = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt3, PANEL_VALUE));
  960.   startfr = atoi((char*) xv_get(vcrEdit_editPopup->editStartTxt4, PANEL_VALUE));
  961.   
  962.   endhr = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt1, PANEL_VALUE));
  963.   endmin = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt2, PANEL_VALUE));
  964.   endsec = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt3, PANEL_VALUE));
  965.   endfr = atoi((char*) xv_get(vcrEdit_editPopup->editEndTxt4, PANEL_VALUE));
  966.   
  967.   if (!SetDuration())
  968.     return;
  969.   sprintf(start, "%.2d:%.2d:%.2d:%.2d", starthr, startmin, 
  970.       startsec, startfr);
  971.   sprintf(end, "%.2d:%.2d:%.2d:%.2d", endhr, endmin,
  972.       endsec, endfr);
  973.   strncpy(startframe[editnum], start, 11);
  974.   strncpy(endframe[editnum], end, 11);
  975.   strcpy (label[editnum], (char *) xv_get(vcrEdit_editPopup->editLabelTxt,
  976.                       PANEL_VALUE));
  977.   speedStg[editnum] = xv_get(vcrEdit_editPopup->editSpeedTxt, PANEL_VALUE);
  978.   audioStg[editnum] = currentAudio;
  979.  
  980.   xv_set(vcrEdit_editPopup->editScrollList,                /* To prevent blinking of list, set XV_SHOW to FALSE first */
  981.      XV_SHOW, FALSE,
  982.      NULL);
  983.   PrintOnList(editnum, buf);
  984.   xv_set(vcrEdit_editPopup->editScrollList,
  985.      PANEL_LIST_STRING, editnum, buf,
  986.      PANEL_LIST_FONT, editnum, font,
  987.      NULL);
  988.   xv_set(vcrEdit_editPopup->editScrollList,                /* Reshow the scrolling list */
  989.      XV_SHOW, TRUE,
  990.      NULL);
  991.   change = 1;
  992.   UpdateHeader(currentFilename, 1);
  993. }                                    /* end function EditModify */
  994.  
  995.  
  996.  
  997. /*
  998.  * Notify callback function for `editScrollList'.
  999.  */
  1000. int
  1001. List(item, string, client_data, op, event)
  1002.      Panel_item    item;
  1003.      char        *string;
  1004.      Xv_opaque    client_data;
  1005.      Panel_list_op    op;
  1006.      Event        *event;
  1007. {
  1008.   int selection;
  1009.   char s[30];
  1010.   char starthr[2];
  1011.   char startmin[2];
  1012.   char startsec[2];
  1013.   char startfr[2];
  1014.   char endhr[2];
  1015.   char endmin[2];
  1016.   char endsec[2];
  1017.   char endfr[2];
  1018.   char audio[7];
  1019.  
  1020.   switch(op) 
  1021.   {
  1022.    case PANEL_LIST_OP_DESELECT:
  1023.     xv_set(vcrEdit_editPopup->editNewEditMsg, PANEL_LABEL_STRING, 
  1024.        "Current Selection : New Edit", NULL);
  1025.     xv_set(vcrEdit_editPopup->editModButton, PANEL_INACTIVE,        /* Make the modify, delete buttons inactive */
  1026.        TRUE, NULL);
  1027.     xv_set(vcrEdit_editPopup->editDelButton, PANEL_INACTIVE,
  1028.        TRUE, NULL);
  1029.     break;
  1030.     
  1031.    case PANEL_LIST_OP_SELECT:
  1032.     sscanf(string, "%d", &selection);
  1033.     editnum = selection - 1;
  1034.     sprintf(s, "Current Selection : Edit #%d", selection);
  1035.     
  1036.     sscanf(startframe[editnum], "%2s:%2s:%2s:%2s", 
  1037.        starthr, startmin, startsec, startfr);
  1038.     sscanf(endframe[editnum], "%2s:%2s:%2s:%2s", 
  1039.        endhr, endmin, endsec, endfr);
  1040.     xv_set(vcrEdit_editPopup->editNewEditMsg,                /* Load the appropriate values into the textfields */
  1041.        PANEL_LABEL_STRING, s, NULL);
  1042.     xv_set(vcrEdit_editPopup->editStartTxt1, PANEL_VALUE, starthr, 
  1043.        NULL);
  1044.     xv_set(vcrEdit_editPopup->editStartTxt2, PANEL_VALUE, startmin, 
  1045.        NULL);
  1046.     xv_set(vcrEdit_editPopup->editStartTxt3, PANEL_VALUE, startsec, 
  1047.        NULL);
  1048.     xv_set(vcrEdit_editPopup->editStartTxt4, PANEL_VALUE, startfr, 
  1049.        NULL);
  1050.     xv_set(vcrEdit_editPopup->editEndTxt1, PANEL_VALUE, endhr, 
  1051.        NULL);
  1052.     xv_set(vcrEdit_editPopup->editEndTxt2, PANEL_VALUE, endmin, 
  1053.        NULL);
  1054.     xv_set(vcrEdit_editPopup->editEndTxt3, PANEL_VALUE, endsec, 
  1055.        NULL);
  1056.     xv_set(vcrEdit_editPopup->editEndTxt4, PANEL_VALUE, endfr, 
  1057.        NULL);
  1058.     xv_set(vcrEdit_editPopup->editLabelTxt, PANEL_VALUE, label[editnum], NULL);
  1059.     xv_set(vcrEdit_editPopup->editSpeedTxt, PANEL_VALUE, (int) speedStg[editnum], NULL);
  1060.  
  1061.     switch (audioStg[editnum])
  1062.     {
  1063.      case Stereo:
  1064.       strcpy(audio, "Stereo");
  1065.       break;
  1066.      case Right:
  1067.       strcpy(audio, "Right");
  1068.       break;
  1069.      case Left:
  1070.       strcpy(audio, "Left");
  1071.       break;
  1072.      case Mute:
  1073.       strcpy(audio, "Mute");
  1074.       break;
  1075.      default:
  1076.       DisplayError("Invalid audio setting", " ");
  1077.       return XV_OK;
  1078.     }
  1079.     xv_set(vcrEdit_editPopup->editAudioMenuButton, PANEL_LABEL_STRING, audio, NULL);
  1080.     SetDuration();
  1081.     xv_set(vcrEdit_editPopup->editModButton,                /* Make the modify, delete buttons active */
  1082.        PANEL_INACTIVE, FALSE, NULL);
  1083.     xv_set(vcrEdit_editPopup->editDelButton,
  1084.        PANEL_INACTIVE, FALSE, NULL);
  1085.     break;
  1086.   }
  1087.   return XV_OK;
  1088. }                                    /* end function List */
  1089.  
  1090.  
  1091. /*
  1092.  * Notify callback function for `editDelAllButton'.
  1093.  * Delete all entries in the edit list
  1094.  */
  1095. void
  1096.   EditDeleteAll(item, event)
  1097. Panel_item      item;
  1098. Event           *event;
  1099. {
  1100.   int i;
  1101.   int result;
  1102.   char edit[20];
  1103.   
  1104.   if ((change) && (lines > 0))                        /* Check if unsaved changes exist in edit list */
  1105.   {
  1106.     result = DisplayChoice("Unsaved changes exist in the edit list.",
  1107.                "Go ahead and delete all entries in the edit list? ",
  1108.                "No", "Yes");
  1109.     if (result == NOTICE_YES)
  1110.       return;
  1111.   }
  1112.   xv_set(vcrEdit_editPopup->editScrollList,                /* To prevent blinking of list, set XV_SHOW to FALSE first */
  1113.      XV_SHOW, FALSE,
  1114.      NULL);
  1115.   for (i=0; i < lines; i++) 
  1116.     xv_set(vcrEdit_editPopup->editScrollList,
  1117.        PANEL_LIST_DELETE, 0,
  1118.        NULL);
  1119.   xv_set(vcrEdit_editPopup->editScrollList,                /* Reshow the scrolling list */
  1120.      XV_SHOW, TRUE,
  1121.      NULL);
  1122.   lines  = 0;
  1123.   editnum = -1;
  1124.   change = 0;
  1125.   sprintf(currentFilename, "Untitled");
  1126.   UpdateHeader(currentFilename, 0);
  1127.   PrintNumEdits();
  1128.   sprintf(edit, "No. of Edits : 0");
  1129.   xv_set(vcrEdit_editPopup->editNumEditMsg, PANEL_LABEL_STRING, 
  1130.      edit, NULL);
  1131.   xv_set(vcrEdit_editPopup->editNewEditMsg, PANEL_LABEL_STRING, 
  1132.      "Current Selection : New Edit", NULL);
  1133.   xv_set(vcrEdit_editPopup->editEndTxt1, PANEL_VALUE, "  ");        /* Clear out current selection */
  1134.   xv_set(vcrEdit_editPopup->editEndTxt2, PANEL_VALUE, "  ");
  1135.   xv_set(vcrEdit_editPopup->editEndTxt3, PANEL_VALUE, "  ");
  1136.   xv_set(vcrEdit_editPopup->editEndTxt4, PANEL_VALUE, "  ");
  1137.   
  1138.   xv_set(vcrEdit_editPopup->editStartTxt1, PANEL_VALUE, "  ");
  1139.   xv_set(vcrEdit_editPopup->editStartTxt2, PANEL_VALUE, "  ");
  1140.   xv_set(vcrEdit_editPopup->editStartTxt3, PANEL_VALUE, "  ");
  1141.   xv_set(vcrEdit_editPopup->editStartTxt4, PANEL_VALUE, "  ");
  1142.   
  1143.   xv_set(vcrEdit_editPopup->editLabelTxt, PANEL_VALUE, "  ");
  1144.   xv_set(vcrEdit_editPopup->editDurTxt, PANEL_VALUE, "  ");
  1145.   xv_set(vcrEdit_editPopup->editModButton,                /* Make modify, delete buttons inactive */
  1146.      PANEL_INACTIVE, TRUE, NULL);
  1147.   xv_set(vcrEdit_editPopup->editDelButton,
  1148.      PANEL_INACTIVE, TRUE, NULL);
  1149. }                                    /* end function EditDeleteAll */
  1150.  
  1151.  
  1152.  
  1153. void UpdateHeader (char* documentName, int modified)
  1154. {
  1155.   char    label[MAXPATHLEN+32];
  1156.   
  1157.   if (modified == 1)
  1158.   {
  1159.     sprintf(label, "%s (modified)",
  1160.         documentName);
  1161.   }
  1162.   else
  1163.   {
  1164.     sprintf(label, "%s", documentName);
  1165.   }
  1166.   xv_set(vcrEdit_editPopup->editPopup, XV_LABEL,            /* Print the new label string on the title bar */
  1167.      label, NULL);    
  1168. }                                    /* end function UpdateHeader */
  1169.