/* TrackList.h */

#ifndef Included_TrackList_h
#define Included_TrackList_h

/* TrackList module depends on */
/* MiscInfo.h */
/* Audit */
/* Debug */
/* Definitions */
/* Screen */
/* EventLoop */
/* StringList */
/* Array */
/* Memory */
/* TrackObject */
/* Alert */
/* DataMunging */
/* Menus */
/* MainWindowStuff */
/* BufferedFileInput */
/* BufferedFileOutput */
/* Files */
/* Scrap */
/* TrackBackgroundSaver */

#include "Screen.h"
#include "EventLoop.h"
#include "MainWindowStuff.h"

struct TrackListRec;
typedef struct TrackListRec TrackListRec;

/* forward declarations */
struct MainWindowRec;
struct CodeCenterRec;
struct TrackObjectRec;
struct MenuType;
struct MenuItemType;
struct ArrayRec;
struct BufferedInputRec;
struct BufferedOutputRec;
struct FileType;

/* create a new track list */
TrackListRec*				NewTrackList(struct MainWindowRec* MainWindow,
											struct CodeCenterRec* CodeCenter, WinType* ScreenID,
											OrdType XLoc, OrdType YLoc, OrdType Width, OrdType Height);

/* delete the track list and all of the tracks it contains */
void								DisposeTrackList(TrackListRec* TrackList);

/* change the location of the track list in the window */
void								SetTrackListLocation(TrackListRec* TrackList,
											OrdType XLoc, OrdType YLoc, OrdType Width, OrdType Height);

/* redraw the list */
void								TrackListRedraw(TrackListRec* TrackList);

/* see if the specified coordinates falls inside the track list rectangle */
MyBoolean						TrackListHitTest(TrackListRec* TrackList,
											OrdType XLoc, OrdType YLoc);

/* handle a mouse down event for the track list */
void								TrackListDoMouseDown(TrackListRec* TrackList,
											OrdType XLoc, OrdType YLoc, ModifierFlags Modifiers);

/* called when the window becomes active */
void								TrackListBecomeActive(TrackListRec* TrackList);

/* called when the window becomes inactive */
void								TrackListBecomeInactive(TrackListRec* TrackList);

/* called when a selection is made in another list, so that this list */
/* is deselected */
void								TrackListDeselect(TrackListRec* TrackList);

/* check to see if there is a selection in this list */
MyBoolean						TrackListIsThereSelection(TrackListRec* TrackList);

/* check to see if any of the tracks contained in this list need to be saved */
MyBoolean						DoesTrackListNeedToBeSaved(TrackListRec* TrackList);

/* open an edit window for the selected track */
void								TrackListOpenSelection(TrackListRec* TrackList);

/* create a new track and open a window for it */
void								TrackListNewTrack(TrackListRec* TrackList);

/* delete the selected track */
void								TrackListDeleteSelection(TrackListRec* TrackList);

/* delete the explicitly specified track */
void								TrackListDeleteTrack(TrackListRec* TrackList,
											struct TrackObjectRec* TheTrack);

/* the name of an track has changed, so the name in the scrolling */
/* list must also be changed */
void								TrackListTrackNameChanged(TrackListRec* TrackList,
											struct TrackObjectRec* TheTrack);

/* look for a specified track.  returns NIL if not found.  the name is */
/* NOT null terminated */
struct TrackObjectRec*	TrackListLookupNamedTrack(TrackListRec* TrackList, char* Name);

/* cancel dependencies where objects have the specified object listed in the */
/* background.  this is called by the specified object when it is dying */
void								TrackListDelinkBackgroundInstances(TrackListRec* TrackList,
											struct TrackObjectRec* TheTrack);

/* get the track menu */
struct MenuType*		TrackListGetTrackMenu(TrackListRec* TrackList);

/* enable all of the menu items on the menu associated with this track list */
void								TrackListEnableMenuItems(TrackListRec* TrackList);

/* return the track object associated with the specified menu item or NIL if */
/* there is no such track object */
struct TrackObjectRec*	TrackListLookupMenuItem(TrackListRec* TrackList,
											struct MenuItemType* MenuItem);

/* put a checkmark on all track menu items that occur in this list */
void								TrackListMenuItemCheckmarks(TrackListRec* TrackList,
											struct ArrayRec* TrackObjList);

/* the document's name changed, so we need to update the windows */
void								TrackListGlobalNameChange(TrackListRec* TrackList, char* NewFilename);

/* get an array of all of the tracks.  it must be disposed of by the caller */
struct ArrayRec*		TrackListGetListOfAllTracks(TrackListRec* TrackList);

/* read track data from a file.  returns True if completely successful. */
FileLoadingErrors		TrackListReadData(TrackListRec* TrackList,
											struct BufferedInputRec* Input);

/* write track data to a file.  returns True if completely successful. */
FileLoadingErrors		TrackListWriteData(TrackListRec* TrackList,
											struct BufferedOutputRec* Output);

/* after a file has been saved, this is called to mark all objects as not modified. */
void								TrackListMarkAllObjectsSaved(TrackListRec* TrackList);

/* copy the selected object in the list to the clipboard.  return False if failed. */
MyBoolean						TrackListCopyObject(TrackListRec* TrackList);

/* try to paste the clipboard in as a track.  returns False if it failed or the */
/* clipboard did not contain a track. */
MyBoolean						TrackListPasteObject(TrackListRec* TrackList);

/* try to paste the track object in from the file */
MyBoolean						TrackListPasteFromFile(TrackListRec* TrackList,
											struct FileType* File);

#endif
