/***********************************************************************
* 
*               *****   ***    ***
*                  *   *   *  *   *
*                 *     ***    ***
*                *     *   *  *   *
*               *****   ***    ***
*
* A FREE Finite Elements Analysis Program in ANSI C for the UNIX OS.
*
* Composed and edited and copyright by 
* Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
*
* eMail: 
* frank.rieg@uni-bayreuth.de
* dr.frank.rieg@t-online.de
* 
* V11.0  December 12, 2003
*
* Z88 should compile and run under any UNIX OS and Motif 2.0.
*
* 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, 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; see the file COPYING.  If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
***********************************************************************/ 
/*****************************************************************************
* Callbacks fuer z88com
* 9.2.2004 Rieg
*****************************************************************************/

/*****************************************************************************
* Includes
*****************************************************************************/
/*----------------------------------------------------------------------------
* UNIX
*---------------------------------------------------------------------------*/
#ifdef FR_UNIX
#include <z88com.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Xm/XmAll.h>
#endif

/*****************************************************************************
* Functions
*****************************************************************************/

/*----------------------------------------------------------------------------
* CB_WER
*---------------------------------------------------------------------------*/
void CB_WER(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern FR_INT4  LANG;

extern int      IBELL;

Widget   	hInfo;
Arg      	args[10];
Cardinal 	n;

XmString 	cxstring = NULL;
char            cstring[256];

/*============================================================================
* Los geht's
*===========================================================================*/
XBell(XtDisplay(hcallw),IBELL);

n = 0;

XtSetArg(args[n], XmNautoUnmanage, TRUE);                 n++;
XtSetArg(args[n], XmNdialogStyle,  XmDIALOG_MODELESS);    n++;
XtSetArg(args[n], XmNdialogType,   XmDIALOG_INFORMATION); n++;

if(LANG==1) strcpy (cstring,
"Z88COM V11.0 fuer UNIX\n\
von Univ.Prof.Dr.-Ing. Frank Rieg 2004\n\
Universitaet Bayreuth\n\
frank.rieg@uni-bayreuth.de\n\
dr.frank.rieg@t-online.de");

if(LANG==2) strcpy (cstring,
"Z88COM V11.0 for UNIX\n\
by Prof.Dr. Frank Rieg 2004\n\
University of Bayreuth, Germany\n\
frank.rieg@uni-bayreuth.de\n\
dr.frank.rieg@t-online.de");

cxstring = XmStringCreateLtoR(cstring, XmFONTLIST_DEFAULT_TAG);
XtSetArg(args[n], XmNmessageString, cxstring); n++;

hInfo = XmCreateInformationDialog(hcallw, "z88com", args, n);

XtUnmanageChild(XmMessageBoxGetChild(hInfo,XmDIALOG_HELP_BUTTON));
XtUnmanageChild(XmMessageBoxGetChild(hInfo,XmDIALOG_CANCEL_BUTTON));

XtManageChild(hInfo);

if(cxstring) XmStringFree(cxstring);
}

/*----------------------------------------------------------------------------
* CB_EXIT
*---------------------------------------------------------------------------*/
void  CB_EXIT(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern FILE *fwlo;

fclose(fwlo);
exit(0);
}

/*----------------------------------------------------------------------------
* CB_HELP
*---------------------------------------------------------------------------*/
void CB_HELP(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern Pixel bg,fg;

extern int ifhelp;

Arg args[10];
Cardinal n;

if(ifhelp == 0) ifhelp= 1;
else            ifhelp= 0;

if(ifhelp == 1)
  {
  n = 0;
  XtSetArg(args[n], XmNbackground, fg); n++;
  XtSetArg(args[n], XmNforeground, bg); n++;
  XtSetValues(hw[4], args, n);
  }
else
  {
  n = 0;
  XtSetArg(args[n], XmNbackground, bg); n++;
  XtSetArg(args[n], XmNforeground, fg); n++;
  XtSetValues(hw[4], args, n);
  }
  
}

/*----------------------------------------------------------------------------
* CB_HELPGEN
*---------------------------------------------------------------------------*/
void CB_HELPGEN(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern FR_INT4 LANG;

extern char CBROWSER[], CPREFIX[];

char command[320];

strcpy(command,CBROWSER);
strcat(command," ");
strcat(command,CPREFIX);
if(LANG == 1) strcat(command,"g88ix.htm");
if(LANG == 2) strcat(command,"e88ix.htm");
system(command);
}

/*----------------------------------------------------------------------------
* CB_OK
*---------------------------------------------------------------------------*/
void CB_OK(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern FILE *fwlo;

extern int IALERT, IDEATH;

if(IDEATH == 1) /* Das war Ihr Leben */
  { 
  fclose(fwlo);
  exit(1);
  }
 
IALERT= 0;
}

/*----------------------------------------------------------------------------
* CB_Z88V
*---------------------------------------------------------------------------*/
void CB_Z88V(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0) 
  {
  system("z88v");
  n = 0;
  if(LANG == 1) strcpy(cstring,"Filechecker Z88V gelaufen");
  if(LANG == 2) strcpy(cstring,"Filechecker Z88V done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88v.htm");
  if(LANG == 2) strcat(command,"e88v.htm");
  system(command);
  }
}

/*----------------------------------------------------------------------------
* CB_Z88N
*---------------------------------------------------------------------------*/
void CB_Z88N(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0) 
  {
  system("z88n");
  n = 0;
  if(LANG == 1) strcpy(cstring,"Netzgenerator Z88N gelaufen");
  if(LANG == 2) strcpy(cstring,"Net Generator Z88N done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88n.htm");
  if(LANG == 2) strcat(command,"e88n.htm");
  system(command);
  }
}

/*----------------------------------------------------------------------------
* CB_Z88D
*---------------------------------------------------------------------------*/
void CB_Z88D(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0) 
  {
  system("z88d");
  n = 0;
  if(LANG == 1) strcpy(cstring,"Spannungsprozessor Z88D gelaufen");
  if(LANG == 2) strcpy(cstring,"Stress Calculation Z88D done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88d.htm");
  if(LANG == 2) strcat(command,"e88d.htm");
  system(command);
  }
}

/*----------------------------------------------------------------------------
* CB_Z88E
*---------------------------------------------------------------------------*/
void CB_Z88E(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0) 
  {
  system("z88e");
  n = 0;
  if(LANG == 1) strcpy(cstring,"Knotenkraftprozessor Z88E gelaufen");
  if(LANG == 2) strcpy(cstring,"Nodal Forces Calculation Z88E done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88e.htm");
  if(LANG == 2) strcat(command,"e88e.htm");
  system(command);
  }
}

/*----------------------------------------------------------------------------
* CB_Z88G
*---------------------------------------------------------------------------*/
void CB_Z88G(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0) 
  {
  system("z88g");
  n = 0;
  if(LANG == 1) strcpy(cstring,"COSMOS- Konverter Z88G gelaufen");
  if(LANG == 2) strcpy(cstring,"COSMOS converter Z88G done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88g.htm");
  if(LANG == 2) strcat(command,"e88g.htm");
  system(command);
  }
}

/*----------------------------------------------------------------------------
* CB_Z88H
*---------------------------------------------------------------------------*/
void CB_Z88H(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0) 
  {
  system("z88h");
  n = 0;
  if(LANG == 1) strcpy(cstring,"Cuthill-McKee Programm Z88H gelaufen");
  if(LANG == 2) strcpy(cstring,"Cuthill-McKee program Z88H done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88h.htm");
  if(LANG == 2) strcat(command,"e88h.htm");
  system(command);
  }
}

/*----------------------------------------------------------------------------
* CB_STARTEDITIN
*---------------------------------------------------------------------------*/
void CB_STARTEDITIN(Widget hcallw,XtPointer data,
                    XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifedin,ifhelp;

extern char CEDITOR[], CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifedin == IDM_Z88DYN) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88.dyn");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88dy.htm");
    if(LANG == 2) strcat(command,"e88dy.htm");
    system(command);
    }
  }

if(ifedin == IDM_Z88FCD) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88.fcd");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88mr.htm");
    if(LANG == 2) strcat(command,"e88mr.htm");
    system(command);
    }
  }

if(ifedin == IDM_Z88NI) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88ni.txt");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88ni.htm");
    if(LANG == 2) strcat(command,"e88ni.htm");
    system(command);
    }
  }

if(ifedin == IDM_Z88I1) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88i1.txt");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88i1.htm");
    if(LANG == 2) strcat(command,"e88i1.htm");
    system(command);
    }
  }

if(ifedin == IDM_Z88I2) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88i2.txt");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88i2.htm");
    if(LANG == 2) strcat(command,"e88i2.htm");
    system(command);
    }
  }

if(ifedin == IDM_Z88I3) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88i3.txt");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88i3.htm");
    if(LANG == 2) strcat(command,"e88i3.htm");
    system(command);
    }
  }

if(ifedin == IDM_Z88I4) 
  {
  if(ifhelp == 0)
    {
    strcpy(command,CEDITOR);
    strcat(command," z88i4.txt");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88i4.htm");
    if(LANG == 2) strcat(command,"e88i4.htm");
    system(command);
    }
  }

if(ifhelp == 0) 
  {
  n = 0;
  if(LANG == 1) strcpy(cstring,"Editieren Eingabedatei beendet");
  if(LANG == 2) strcpy(cstring,"Editing Input File done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }

}

/*----------------------------------------------------------------------------
* CB_STARTEDITOUT
*---------------------------------------------------------------------------*/
void CB_STARTEDITOUT(Widget hcallw,XtPointer data,
                     XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifedout,ifhelp;

extern char CEDITOR[], CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0)
  {
  if(ifedout == IDM_Z88O0) 
    {
    strcpy(command,CEDITOR);
    strcat(command," z88o0.txt");
    system(command);
    }
  if(ifedout == IDM_Z88O1) 
    {
    strcpy(command,CEDITOR);
    strcat(command," z88o1.txt");
    system(command);
    }
  if(ifedout == IDM_Z88O2) 
    {
    strcpy(command,CEDITOR);
    strcat(command," z88o2.txt");
    system(command);
    }
  if(ifedout == IDM_Z88O3) 
    {
    strcpy(command,CEDITOR);
    strcat(command," z88o3.txt");
    system(command);
    }
  if(ifedout == IDM_Z88O4) 
    {
    strcpy(command,CEDITOR);
    strcat(command," z88o4.txt");
    system(command);
    }
  if(ifedout == IDM_Z88O6) 
    {
    strcpy(command,CEDITOR);
    strcat(command," z88o6.txt");
    system(command);
    }
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88ge.htm");
  if(LANG == 2) strcat(command,"e88ge.htm");
  system(command);
  }

if(ifhelp == 0) 
  {
  n = 0;
  if(LANG == 1) strcpy(cstring,"Editieren Ausgabedatei beendet");
  if(LANG == 2) strcpy(cstring,"Editing Output File done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
  
}

/*----------------------------------------------------------------------------
* CB_STARTCAD
*---------------------------------------------------------------------------*/
void CB_STARTCAD(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifz88x,ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0)
  {
  if(ifz88x == IDM_I1TX) system("z88x -i1tx");
  if(ifz88x == IDM_IATX) system("z88x -iatx");
  if(ifz88x == IDM_NITX) system("z88x -nitx");
  if(ifz88x == IDM_I1FX) system("z88x -i1fx");
  if(ifz88x == IDM_IAFX) system("z88x -iafx");
  if(ifz88x == IDM_NIFX) system("z88x -nifx");
  n = 0;
  if(LANG == 1) strcpy(cstring,"CAD Konverter Z88X beendet");
  if(LANG == 2) strcpy(cstring,"CAD Converter Z88X done");
  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);
  if(LANG == 1) strcat(command,"g88x.htm");
  if(LANG == 2) strcat(command,"e88x.htm");
  system(command);
  }
  
}

/*----------------------------------------------------------------------------
* CB_STARTFEA
*---------------------------------------------------------------------------*/
void CB_STARTFEA(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FILE *fwlo;

extern FR_INT4 LANG;

extern int ifz88f,ifhelp,icount;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0)
  {
  if(ifz88f == IDM_Z88FCOM) 
    {
    system("z88f -c");
    if(LANG == 1) strcpy(cstring,"Direkter Solver Z88F -C beendet");
    if(LANG == 2) strcpy(cstring,"direct solver Z88F -C done");
    }

  if(ifz88f == IDM_Z88FTES) 
    {
    system("z88f -t");
    if(LANG == 1) strcpy(cstring,"Direkter Solver Z88F -T beendet");
    if(LANG == 2) strcpy(cstring,"direct solver Z88F -T done");
    }

  if(ifz88f == IDM_Z88FNEU) 
    {
    system("z88f -n");
    if(LANG == 1) strcpy(cstring,"Direkter Solver Z88F -N beendet");
    if(LANG == 2) strcpy(cstring,"direct solver Z88F -N done");
    }

  if(ifz88f == IDM_Z88FALT) 
    {
    system("z88f -a");
    if(LANG == 1) strcpy(cstring,"Direkter Solver Z88F -A beendet");
    if(LANG == 2) strcpy(cstring,"direct solver Z88F -A done");
    }

  if(ifz88f == IDM_Z88II1) 
    {
    system("z88i1");
    if(LANG == 1) strcpy(cstring,"Iterations-Solver Part 1 beendet");
    if(LANG == 2) strcpy(cstring,"iteration solver part 1 done");
    }

  if(ifz88f == IDM_Z88II2C) 
    {
    system("z88i2 -c");
    if(LANG == 1) strcpy(cstring,"Iterations-Solver Part 2 -C beendet");
    if(LANG == 2) strcpy(cstring,"iteration solver part 2 -C done");
    }

  if(ifz88f == IDM_Z88II2S) 
    {
    system("z88i2 -s");
    if(LANG == 1) strcpy(cstring,"Iterations-Solver Part 2 -S beendet");
    if(LANG == 2) strcpy(cstring,"iteration solver part 2 -S done");
    }

  n = 0;

  cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
  XtSetArg(args[n], XmNlabelString, cxstring); n++;
  XtSetValues(hw[64], args, n);
  }
else
  {
  strcpy(command,CBROWSER);
  strcat(command," ");
  strcat(command,CPREFIX);

  if(ifz88f == IDM_Z88FCOM || ifz88f == IDM_Z88FTES ||
     ifz88f == IDM_Z88FNEU || ifz88f == IDM_Z88FALT)
    {
    if(LANG == 1) strcat(command,"g88f.htm");
    if(LANG == 2) strcat(command,"e88f.htm");
    system(command);
    }

  if(ifz88f == IDM_Z88II1  || 
     ifz88f == IDM_Z88II2C || ifz88f == IDM_Z88II2S)
    {
    if(LANG == 1) strcat(command,"g88ite.htm");
    if(LANG == 2) strcat(command,"e88ite.htm");
    system(command);
    }

  }
  
}

/*----------------------------------------------------------------------------
* CB_STARTPLOT
*---------------------------------------------------------------------------*/
void CB_STARTPLOT(Widget hcallw,XtPointer data,
                   XmPushButtonCallbackStruct *cbs)
{
extern Widget hw[];

extern FR_INT4 LANG;

extern int ifplot,ifhelp;

extern char CBROWSER[], CPREFIX[];

char command[320];
char cstring[80];

XmString cxstring = NULL;
Arg args[10];
Cardinal n;

if(ifhelp == 0)
  {
  if(ifplot == IDM_Z88O)
    {
    system("z88o");
    n = 0;
    if(LANG == 1) strcpy(cstring,"OpenGL-Plotprogramm Z88O beendet");
    if(LANG == 2) strcpy(cstring,"OpenGL Plot Program Z88O done");
    cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
    XtSetArg(args[n], XmNlabelString, cxstring); n++;
    XtSetValues(hw[64], args, n);
    }
  if(ifplot == IDM_Z88P)
    {
    system("z88p");
    n = 0;
    if(LANG == 1) strcpy(cstring,"X11-Plotprogramm Z88P beendet");
    if(LANG == 2) strcpy(cstring,"X11 Plot Program Z88P done");
    cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
    XtSetArg(args[n], XmNlabelString, cxstring); n++;
    XtSetValues(hw[64], args, n);
    }
  if(ifplot == IDM_RMSTO)
    {
    remove("z88p.sto");
    n = 0;
    if(LANG == 1) strcpy(cstring,"Z88P.STO geloescht");
    if(LANG == 2) strcpy(cstring,"Z88P.STO removed");
    cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
    XtSetArg(args[n], XmNlabelString, cxstring); n++;
    XtSetValues(hw[64], args, n);
    }
  if(ifplot == IDM_CATO6O7)
    {
    system("cat z88o7.txt >> z88o6.txt");
    n = 0;
    if(LANG == 1) strcpy(cstring,"Z88O6.TXT und Z88O7.TXT verkettet");
    if(LANG == 2) strcpy(cstring,"Z88O6.TXT and Z88O7.TXT concatenated");
    cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
    XtSetArg(args[n], XmNlabelString, cxstring); n++;
    XtSetValues(hw[64], args, n);
    }
  if(ifplot == IDM_PXON88)
    {
    system("pxon88");
    n = 0;
    if(LANG == 1) strcpy(cstring,"Xon/Xoff-Sequenz in Z88O6.TXT gegeben");
    if(LANG == 2) strcpy(cstring,"Xon/Xoff Command inserted in Z88O6.TXT");
    cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
    XtSetArg(args[n], XmNlabelString, cxstring); n++;
    XtSetValues(hw[64], args, n);
    }    
  if(ifplot == IDM_LASERJ88)
    {
    system("laserj88");
    n = 0;
    if(LANG == 1) strcpy(cstring,"LaserJet-Sequenz in Z88O6.TXT gegeben");
    if(LANG == 2) strcpy(cstring,"LaserJet Command inserted in Z88O6.TXT");
    cxstring = XmStringCreateLtoR(cstring, "cf_fsmall");
    XtSetArg(args[n], XmNlabelString, cxstring); n++;
    XtSetValues(hw[64], args, n);
    }    
  }
else
  {
  if(ifplot == IDM_Z88O)
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88o.htm");
    if(LANG == 2) strcat(command,"e88o.htm");
    system(command);
    }
  else
    {
    strcpy(command,CBROWSER);
    strcat(command," ");
    strcat(command,CPREFIX);
    if(LANG == 1) strcat(command,"g88p.htm");
    if(LANG == 2) strcat(command,"e88p.htm");
    system(command);
    }    
  }
}

/*----------------------------------------------------------------------------
* CB_EDITIN
*---------------------------------------------------------------------------*/
void CB_EDITIN(Widget hcallw,XtPointer data,
                   XmToggleButtonCallbackStruct *cbs)
{
extern int ifedin;

if(cbs->set) ifedin= (int)data;
}

/*----------------------------------------------------------------------------
* CB_EDITOUT
*---------------------------------------------------------------------------*/
void CB_EDITOUT(Widget hcallw,XtPointer data,
                   XmToggleButtonCallbackStruct *cbs)
{
extern int ifedout;

if(cbs->set) ifedout= (int)data;
}

/*----------------------------------------------------------------------------
* CB_Z88X
*---------------------------------------------------------------------------*/
void CB_Z88X(Widget hcallw,XtPointer data,
                   XmToggleButtonCallbackStruct *cbs)
{
extern int ifz88x;

if(cbs->set) ifz88x= (int)data;
}

/*----------------------------------------------------------------------------
* CB_PLOT
*---------------------------------------------------------------------------*/
void CB_PLOT(Widget hcallw,XtPointer data,
                   XmToggleButtonCallbackStruct *cbs)
{
extern int ifplot;

if(cbs->set) ifplot= (int)data;
}

/*----------------------------------------------------------------------------
* CB_Z88F
*---------------------------------------------------------------------------*/
void CB_Z88F(Widget hcallw,XtPointer data,
                   XmToggleButtonCallbackStruct *cbs)
{
extern int ifz88f;

if(cbs->set) ifz88f= (int)data;
}

/*----------------------------------------------------------------------------
* CB_NOOFIT
*---------------------------------------------------------------------------*/
void CB_NOOFIT(Widget hcallw,XtPointer data, 
                   XmTextVerifyCallbackStruct *cbs)
{
extern int icount;

char *count;

count= XmTextFieldGetString(hcallw);
icount= atoi(count);

XtFree(count);
}

