/* 
    NMX simple No Motif eXample for the usage of the TVscreenWidget

    Copyright (C) 1996,97 Marcus Metzler (mocm@thp.uni-koeln.de)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
#include <strstream.h>

#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/Xatom.h>
#include <X11/Xaw/Form.h>

#include "../XTV/TVscreen.h"
#include "../XTV/visual.h"


XtAppContext app_context;
Widget toplevel,screen;


/*                 */
/* Create toplevel */
/*                 */
void SetTop(XtAppContext &app_context,char *name,int argc,char **argv)
{
  toplevel= XtVaAppInitialize(&app_context,name,NULL,0
			      ,&argc,argv,NULL
			      ,XtNminWidth,    12
			      ,XtNminHeight ,  12
			      ,XtNmaxWidth,    800
			      ,XtNmaxHeight ,  650
			      ,XtNwidthInc,  4
			      ,XtNheightInc,  4 
			      ,XtNinput,(XtArgVal)True
			      ,NULL);

}




/*                    */
/* Create main window */
/*                    */
void MainWin(Widget &win,char *name)
{

  win = XtVaCreateManagedWidget(name,formWidgetClass,toplevel,NULL);
  screen=XtVaCreateManagedWidget("screen",tvscreenWidgetClass,win,NULL);
  
}


/*      */
/* MAIN */
/*      */
void main(int argc, char **argv)
{
  Widget win;
  Widget cw[2];

  SetTop(app_context,"NMX",argc,argv);
  MainWin(win,"Window");
  XtRealizeWidget(toplevel);

  cw[0]=screen;
  cw[1]=toplevel;
  XtSetWMColormapWindows(toplevel,cw,2);
  XtSetWMColormapWindows(screen,cw,2);


/* Setting some values to get a picture */
  XtVaSetValues(screen,
		XtNFREQ,10033,
		XtNNORM,PAL,
		XtNINPUT,0,
		XtNCAP,True,
		NULL);
  XtAppMainLoop(app_context);
  XtVaSetValues(screen,XtNCAP,FALSE,NULL); // switch off the capturing
}






