/*==================================================================
  ==================================================================
  ==	XMusic -- An Interactive Interface to Csound		  ==
  ==       Copyright (C) 1988 by George D. Drapeau                ==
  ==                  All Rights Reserved                         ==
  ==================================================================
  ==================================================================
*/
/* $Log:	musicWin.c,v $
 * Revision 1.2  89/08/06  18:13:28  drapeau
 * Changed the names of a couple of the widgets
 *  (commandBox and workSpaceWidget).
 *  */

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/VPaned.h>
#include <X11/Box.h>
#include <X11/Command.h>
#include <X11/Form.h>
#include "defs.h"
#include "externs.h"

void CreateXMusicWorkSpace()
{
  Widget		vPanedWidget,commandBox;
  Widget		quitCommand,helpCommand,writeCommand;
  Widget		saveCommand,removeCommand;
  Arg			argList[2];
  Dimension		workSpaceWidth,workSpaceHeight;
  
  vPanedWidget	= XtCreateManagedWidget("VPanedWidget",		    /* Create a VPaned widget to separate buttons from... */
			vPanedWidgetClass,			    /* ...the XMusic workspace. */
			topLevelShell,				    /* This widget is a child of the top level shell */
			NULL,NULL);
  commandBox	= XtCreateManagedWidget("commands",		    /* Create a box to hold several Command widgets */
					boxWidgetClass,		    /* This is a Box Widget */
					vPanedWidget,		    /* This widget is a child of the vPanedWidget */
					NULL,NULL);
  quitCommand	= XtCreateManagedWidget("Quit",			    /* Create command buttons to go inside the commandBox */
					commandWidgetClass,
					commandBox,
					NULL,NULL);
  helpCommand	= XtCreateManagedWidget("Help",
					commandWidgetClass,
					commandBox,
					NULL,NULL);
  writeCommand	= XtCreateManagedWidget("Write Csound File",
					commandWidgetClass,
					commandBox,
					NULL,NULL);
  saveCommand	= XtCreateManagedWidget("Save Diagram",
					commandWidgetClass,
					commandBox,
					NULL,NULL);
  removeCommand	= XtCreateManagedWidget("Remove A Tool",
					commandWidgetClass,
					commandBox,
					NULL,NULL);
  infoCommand	= XtCreateManagedWidget("Inspect A Tool",
					commandWidgetClass,
					commandBox,
					NULL,NULL);

  XtAddCallback(quitCommand,XtNcallback,ExitCallback,NULL);	    /* Add callbacks for the buttons in the workspace. */
  XtAddCallback(helpCommand,XtNcallback,Help,NULL);
  XtAddCallback(writeCommand,XtNcallback,WriteOrchFile,NULL);
  XtAddCallback(saveCommand,XtNcallback,SaveDiagram,NULL);
  XtAddCallback(removeCommand,XtNcallback,RemoveTool,NULL);
  XtAddCallback(infoCommand,XtNcallback,ToolInfo,NULL);
  GetDiagramSize(&workSpaceWidth,&workSpaceHeight);		    /* Determine best size of the workspace widget  */
  XtSetArg(argList[0],XtNwidth,workSpaceWidth);			    /* Set the argument list for the workspace widget */
  XtSetArg(argList[1],XtNheight,workSpaceHeight);
  workSpaceWidget= XtCreateManagedWidget("workspace",		    /* Create a widget in which to draw XMusic diagrams. */
					 formWidgetClass,
					 vPanedWidget,
					 argList,XtNumber(argList));
}								    /* end function CreateXMusicWorkSpace */
