home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / timeline / instrumn.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  10.6 KB  |  229 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/TimeLine/RCS/instrument.h,v 1.11 92/09/24 17:11:22 drapeau Exp $ */
  25. /* $Log:    instrument.h,v $
  26.  * Revision 1.11  92/09/24  17:11:22  drapeau
  27.  * A new field was added to the MediaSegment structure: the "setupTime" field
  28.  * was added to hold synchronization information for each note on the TimeLine.
  29.  * The field indicates an estimate of the time (in milliseconds) it will take
  30.  * to perform the note to which the MediaSegment belongs.
  31.  * Other changes are cosmetic, to improve readability.
  32.  * 
  33.  * Revision 1.10  92/05/29  14:42:09  drapeau
  34.  * Modified code to track new name of the MAEstro "Selection" structure;
  35.  * it is now named "MAESelection".
  36.  * 
  37.  * Revision 1.0  91/09/30  17:03:26  chua
  38.  * Update to version 1.0
  39.  * 
  40.  * Revision 0.62  91/09/25  13:43:27  chua
  41.  * Changed the name InstrumentInfo to EditInfo
  42.  * 
  43.  * Revision 0.61  91/09/19  17:28:51  chua
  44.  * Make sure that variables are initialized properly.  Change formatting slightly,
  45.  * so that (if, for, while) statements with only one statement in them will not have
  46.  * braces.
  47.  * 
  48.  * Revision 0.60  91/09/17  17:20:27  chua
  49.  * Renamed Region to tlRegion.
  50.  * 
  51.  * Revision 0.59  91/08/16  13:50:43  chua
  52.  * In the instrument data structure, have a new variable, icon, which will store the
  53.  * icon for the instrument so that it need not be created each time.
  54.  * 
  55.  * Revision 0.58  91/08/14  12:11:29  chua
  56.  * In the Instrument data structure, include a new variable initialNote, which indicates if 
  57.  * the current note is the first in a play operation.
  58.  * 
  59.  * Revision 0.57  91/07/30  11:23:52  chua
  60.  * In the Region structure, change the type of label from int to char.
  61.  * 
  62.  * Revision 0.56  91/07/26  17:18:42  chua
  63.  * Added a new data structure, Region, to deal with annotated regions.
  64.  * 
  65.  * Revision 0.55  91/07/22  15:23:30  chua
  66.  * Added a new data structure, Pause, which serves as the nodes for the Pause linked list 
  67.  * which keeps track of where all the pause markers are.
  68.  * 
  69.  * Revision 0.54  91/07/17  10:07:58  chua
  70.  * Deleted the constant definition of AnchorWidth as it is no longer required.
  71.  * 
  72.  * Revision 0.53  91/06/26  16:46:29  chua
  73.  * Added a new field, partialNote to the instrument structure, which indicates if a partial note
  74.  * has been chosen for playing during the TimerNotify procedure.
  75.  * 
  76.  * Deleted the HalfSecondScale constant (replaced it by the value 5 wherever it appears in code).
  77.  * 
  78.  * Revision 0.52  91/06/04  17:37:17  chua
  79.  * Added the copyright comments in the beginning of the file.
  80.  * 
  81.  * Revision 0.51  91/05/28  12:10:56  chua
  82.  * 
  83.  * 
  84.  * Revision 0.50  91/05/24  16:36:45  chua
  85.  * *** empty log message ***
  86.  * 
  87.  * Revision 0.49  91/05/23  17:39:21  chua
  88.  * *** empty log message ***
  89.  * 
  90.  * Revision 0.48  91/05/22  16:40:12  chua
  91.  * 
  92.  * 
  93.  * Revision 0.47  91/05/22  13:56:11  chua
  94.  * 
  95.  * 
  96.  * Revision 0.46  91/05/22  11:52:09  chua
  97.  * *** empty log message ***
  98.  * 
  99.  * Revision 0.45  91/05/17  16:56:12  chua
  100.  * *** empty log message ***
  101.  * 
  102.  * Revision 0.44  91/05/17  16:56:06  chua
  103.  * *** empty log message ***
  104.  * 
  105.  * Revision 0.43  91/05/17  16:56:02  chua
  106.  * *** empty log message ***
  107.  * 
  108.  * Revision 0.42  91/05/17  16:55:57  chua
  109.  * *** empty log message ***
  110.  * 
  111.  * Revision 0.41  1991/04/08  21:07:41  chua
  112.  * A new include file "InstrumentInfo_ui.h" is included as this is the header file generated by Guide for
  113.  * the instrument info pop-up window.
  114.  *
  115.  * New additions to the Note data structure:
  116.  * int startMin, startSec, endMin, endSec, durationMin, durationSec
  117.  *
  118.  * These fields are used for displaying the panel list information in the info pop-up windows.  The use of
  119.  * these fields avoid having to compute the values each time a panel list is to be updated.
  120.  *
  121.  * New additions to the Instrument data structure:
  122.  * Note *infoNote - points to the note structure that is currently selected in the info panel list for this
  123.  *                  instrument.
  124.  * int selectedInfoNote - gives the relative position of the selected note in the notes list of the instrument.
  125.  * InstrumentInfo_InstrumentInfoWindow_objects *instInfo - Object pointer to the instrument info pop-up window.
  126.  *
  127.  * Revision 0.40  1991/03/29  00:01:51  chua
  128.  * This file contains the definitions for the data structures used in keeping track of the information entered
  129.  * by the user (Notes) as well as those obtained from the PortManager and the 'remote' applications.  It also has
  130.  * the constant definitions of values used for drawing the notes, cables and icons on the canvases.
  131.  *
  132.  * Each application that is checked in with the PortManager is represented by an Instrument data structure.  This
  133.  * data structure holds information on what port the application is listening on, the sender to that port, a list
  134.  * of Notes for this application and some other miscellaneous data for drawing and playback purposes.  Each
  135.  * application will be represented by its icon on the left side of the TimeLine application, and there will be a
  136.  * cable associated with each instrument where the user can insert new Notes.
  137.  *
  138.  * A Note data structure consists of the current selection in the 'remote' application at the time the user inserts
  139.  * this note.  It stores information on where the note is on the screen, as well as a MediaSegment data structure,
  140.  * which stores information obtained via the LinkProtocol from the application, such as the document name,
  141.  * the Selection data structure and duration of the note.
  142.  * */
  143.  
  144. static char instrumentHrcsid[] = "$Header: /Source/Media/collab/TimeLine/RCS/instrument.h,v 1.11 92/09/24 17:11:22 drapeau Exp $";
  145.  
  146. #ifndef _instrument_
  147. #define _instrument_
  148. #include "EditInfo_ui.h"
  149.  
  150.  
  151. /*
  152.  * Constants for drawing the notes, cables, icons on the canvases.
  153.  * The numbers refer to pixel values. 
  154.  */
  155.  
  156. #define MaxLabelLength          256
  157. #define PixelsPerSecond         10                    /* Number of pixels representing 1 second in lowest zoom level */
  158. #define FirstCableYPosition     36                    /* Starting Y position of the first cable */
  159. #define CableHeight        4                    /* A cable is the line on which notes are drawn */
  160. #define NoteHeight          14                    /* Specifies the height of a note */
  161. #define IconHeight              64                    /* Height of an application icon (instrument icon) */
  162. #define IconGap                 8                    /* gap between application icons */
  163. #define IconXOffset             12                    /* X offset for start position of apps icons */
  164. #define TimeLineInterval    5                    /* Time interval in seconds between time markers on timeline */
  165. #define TimeLineY        20                    /* Y position of the timeline on the TimeCanvas */
  166. #define MarkerWidth        2                    /* Width of a time marker on the timeline */
  167. #define MarkerHeight        8                    /* Height of a time marker on the timeline */
  168.  
  169. typedef struct MediaSegment                        /* Stores the information about a note.  This information... */
  170. {                                    /* ...is obtained from an app through the network protocol. */
  171.   char*        documentName;                        /* Name of the file to be opened for the remote application */
  172.   MAESelection*    selection;                        /* Contains info necessary for the remote app to playback... */
  173.                                     /* ...the note.  The duration field here is in milliseconds. */
  174.   long       duration;                        /* Application set duration (in half seconds) */
  175.   int        setupTime;                        /* Time (in milliseconds) taken to perform OpenDoc and... */
  176.                                     /* ...SetSelection methods.  Used for synchronization hints. */
  177. } MediaSegment;
  178.  
  179. typedef struct Note 
  180. {
  181.   int        start;                            /* X-coordinate of the start point of the note on the canvas */
  182.   int        end;                            /* X-coordinate of the end point of the note on the canvas */
  183.   int        startMin, startSec, endMin, endSec;            /* Fields used for the info pop-up window */
  184.   int        durationMin, durationSec;
  185.   MediaSegment*    ms;                            /* Contains information necessary for playback of the note */
  186.   struct Note*    next;
  187. } Note;
  188.  
  189. typedef struct Instrument 
  190. {
  191.   int                    relativePosition;        /* Position of this instrument in the instrument list */
  192.   int                    cableStart;            /* Starting Y position of the cable for this instrument */
  193.   Pixmap                icon;                /* Stores the pixmap image of the application icon */
  194.   int                    numnotes;            /* Number of notes in this instrument */
  195.   int                    playNote;            /* Flag to indicate if there is a note to be played now */
  196.   int                    initialNote;            /* Indicates if 1st note from where play begins is being played */
  197.   int                    partialNote;            /* Indicates if a partial note is chosen */
  198.   Note*                    firstNote;            /* Pointer to 1st note in list of notes for this instrument */
  199.   Note*                    currentNote;            /* Points to the current note in playback */
  200.   Note*                    infoNote;            /* Points to the selected note in the info pop-up window */
  201.   int                    selectedInfoNote;        /* Relative position of selected note in the info pop-up window */
  202.   Port*                    port;                /* Used to get names, icons, etc. */
  203.   Sender*                sender;                /* Sender to the open app */
  204.   EditInfo_EditInfoWindow_objects*    editInfo;            /* Object pointer to the instrument info pop-up window */
  205.   struct Instrument*            next;    
  206. } Instrument;
  207.  
  208. typedef struct Pause 
  209. {
  210.   int position;                                /* Position of the pause marker in terms of pixels */
  211.   int min;                                /* Minutes portion of time for the position of the pause marker */
  212.   int sec;                                /* Seconds portion of time for the position of the pause marker */
  213.   struct Pause *next;
  214. } Pause;
  215.  
  216. typedef struct tlRegion                            /* Data structure for the region info list */
  217. {
  218.   int startX;                                /* Starting and ending x positions in pixels */
  219.   int endX;
  220.   int startMin;                                /* Starting and ending X positions in min/secs */
  221.   int startSec;
  222.   int endMin;
  223.   int endSec;
  224.   char label[MaxLabelLength];
  225.   struct tlRegion *next;
  226. } tlRegion;
  227.  
  228. #endif
  229.