/* WaveTableList.h */

#ifndef Included_WaveTableList_h
#define Included_WaveTableList_h

/* WaveTableList module depends on */
/* MiscInfo.h */
/* Audit */
/* Debug */
/* Definitions */
/* Screen */
/* EventLoop */
/* StringList */
/* Array */
/* Memory */
/* Alert */
/* DataMunging */
/* WaveTableObject */
/* SampleConsts */
/* FixedPoint */
/* MainWindowStuff */
/* BufferedFileInput */
/* BufferedFileOutput */
/* Files */
/* Scrap */

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

struct WaveTableListRec;
typedef struct WaveTableListRec WaveTableListRec;

/* forward declarations */
struct MainWindowRec;
struct CodeCenterRec;
struct WaveTableObjectRec;
struct BufferedInputRec;
struct BufferedOutputRec;
struct FileType;

/* create a new wave table list */
WaveTableListRec*		NewWaveTableList(struct MainWindowRec* MainWindow,
											struct CodeCenterRec* CodeCenter, WinType* ScreenID,
											OrdType XLoc, OrdType YLoc, OrdType Width, OrdType Height);

/* delete the wave table list and all of the wave tables it contains */
void								DisposeWaveTableList(WaveTableListRec* WaveTableList);

/* change the location of the wave table list in the window */
void								SetWaveTableListLocation(WaveTableListRec* WaveTableList,
											OrdType XLoc, OrdType YLoc, OrdType Width, OrdType Height);

/* redraw the wave table list */
void								WaveTableListRedraw(WaveTableListRec* WaveTableList);

/* see if the specified coordinates falls inside the wave table list rectangle */
MyBoolean						WaveTableListHitTest(WaveTableListRec* WaveTableList,
											OrdType XLoc, OrdType YLoc);

/* handle a mouse down event for the wave table list */
void								WaveTableListDoMouseDown(WaveTableListRec* WaveTableList,
											OrdType XLoc, OrdType YLoc, ModifierFlags Modifiers);

/* called when the window becomes active */
void								WaveTableListBecomeActive(WaveTableListRec* WaveTableList);

/* called when the window becomes inactive */
void								WaveTableListBecomeInactive(WaveTableListRec* WaveTableList);

/* called when a selection is made in another list, so that this list */
/* is deselected */
void								WaveTableListDeselect(WaveTableListRec* WaveTableList);

/* check to see if there is a selection in this list */
MyBoolean						WaveTableListIsThereSelection(WaveTableListRec* WaveTableList);

/* check to see if any of the wave tables contained in this list need to be saved */
MyBoolean						DoesWaveTableListNeedToBeSaved(WaveTableListRec* WaveTableList);

/* open an edit window for the selected wave table */
void								WaveTableListOpenSelection(WaveTableListRec* WaveTableList);

/* create a new wave table and open a window for it */
void								WaveTableListNewWaveTable(WaveTableListRec* WaveTableList);

/* delete the selected wave table */
void								WaveTableListDeleteSelection(WaveTableListRec* WaveTableList);

/* delete the explicitly specified wave table */
void								WaveTableListDeleteWaveTable(WaveTableListRec* WaveTableList,
											struct WaveTableObjectRec* TheWaveTable);

/* the name of a wave table has changed, so the name in the scrolling */
/* list must also be changed */
void								WaveTableListWaveTableNameChanged(WaveTableListRec* WaveTableList,
											struct WaveTableObjectRec* TheWaveTable);

/* look for a specified wave table.  returns NIL if not found.  the name is NOT null */
/* terminated */
struct WaveTableObjectRec*	WaveTableListLookupNamedWaveTable(
											WaveTableListRec* WaveTableList, char* Name);

/* the document's name changed, so the windows need to be updated */
void								WaveTableListGlobalNameChange(WaveTableListRec* WaveTableList,
											char* NewFilename);

/* use the provided data to open a new wave table with the specified attributes. */
/* this is used when opening an algorithmic wave table as a data wave table. */
/* RawData MUST be valid. */
struct WaveTableObjectRec*	WaveTableListCopyRawWaveTableAndOpen(
											WaveTableListRec* WaveTableList, char* RawData,
											NumBitsType NumBits, long NumTables, long FramesPerTable);

/* get the frame count for the named wave table */
SampleErrors				WaveTableListGetWaveTableFrameCount(WaveTableListRec* WaveTableList,
											char* WaveName, long* FrameCountOut);

/* get the table count for the named wave table */
SampleErrors				WaveTableListGetWaveTableTableCount(WaveTableListRec* WaveTableList,
											char* WaveName, long* TableCountOut);

/* get the table array for the named wave table */
SampleErrors				WaveTableListGetWaveTableArray(WaveTableListRec* WaveTableList,
											char* WaveName, largefixedsigned** TableOut);

/* read wave table objects from a file.  returns True if completely successful. */
FileLoadingErrors		WaveTableListReadData(WaveTableListRec* WaveTableList,
											struct BufferedInputRec* Input);

/* write wave table objects to a file.  returns True if completely successful. */
FileLoadingErrors		WaveTableListWriteData(WaveTableListRec* WaveTableList,
											struct BufferedOutputRec* Output);

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

/* copy the selected object in the list to the clipboard.  return False if failed. */
MyBoolean						WaveTableListCopyObject(WaveTableListRec* WaveTableList);

/* try to paste the clipboard in as a wave table object.  returns False if */
/* it failed or the clipboard did not contain a wave table object. */
MyBoolean						WaveTableListPasteObject(WaveTableListRec* WaveTableList);

/* try to paste the wave table object in from the file */
MyBoolean						WaveTableListPasteFromFile(WaveTableListRec* WaveTableList,
											struct FileType* File);

/* find out how many wave tables there are in this list */
long								WaveTableListHowMany(WaveTableListRec* WaveTableList);

/* get an indexed wave tables from the list */
struct WaveTableObjectRec*	WaveTableListGetIndexedWaveTable(
											WaveTableListRec* WaveTableList, long Index);

#endif
