Exemplo n.º 1
0
Arquivo: event.c Projeto: n4cht/kwm
/** ExposeEvent handle event
 * \param ev XExposeEvent pointer
*/
static void
expose(XExposeEvent *ev)
{
     Client *c;
     int i, sc;

     /* InfoBar member */
     for(sc = 0; sc < screen_count(); ++sc)
     {
          if(ev->window == infobar[sc].bar->win)
               barwin_refresh(infobar[sc].bar);
          if(ev->window == infobar[sc].layout_button->win)
               barwin_refresh(infobar[sc].layout_button);
          if(conf.bars.selbar && ev->window == infobar[sc].selbar->win)
               barwin_refresh(infobar[sc].selbar);
          for(i = 1; i < conf.ntag[sc] + 1; ++i)
               if(ev->window == infobar[sc].tags[i]->win)
                    barwin_refresh(infobar[sc].tags[i]);
     }

     /* Client frame */
     if((c = client_gb_titlebar(ev->window)))
          frame_update(c);

     return;
}
Exemplo n.º 2
0
void Window::frame_callback(int in)
{
    play(false);

    _frame = in;

    frame_update();
}
Exemplo n.º 3
0
Window::Window(const String & in) :
    _play(false),
    _frame(0),
    _idle_init(false),
    _idle_frame(0)
{
    DJV_DEBUG(String_Format("Window::Window(%%)").arg(int64_t(this)));

    // Initialize.

    try
    {
        _movie.init(in);
    }
    catch (Error in)
    {
        DJV_AUDIO_APP->error(in);
    }

    _widget = new Image_View;
    _play_widget = new Tool_Button("playback_forward");
    _play_widget->type(Tool_Button::TOGGLE);
    _slider = new Int_Slider;

    Layout_V * layout = new Layout_V(this);
    layout->margin(0);
    layout->spacing(0);
    layout->add(_widget);
    layout->stretch(_widget);
    Layout_H * layout_h = new Layout_H(layout);
    layout_h->margin(0);
    layout_h->add(_play_widget);
    layout_h->add(_slider);
    layout_h->stretch(_slider);

    _slider->range(0, static_cast<int>(_movie.info_time().list.size()) - 1);

    dirty();
    size(_movie.info().size + V2i(0, size_min().y));

    frame_update();
    play_update();

    _play_widget->signal.set(this, play_callback);
    _slider->signal.set(this, frame_callback);
    close_signal.set(this, close_callback);

    show();
}
Exemplo n.º 4
0
void video_manager::screenless_update_callback(void *ptr, int param)
{
	// force an update
	frame_update(false);
}
Exemplo n.º 5
0
void Window::idle()
{
    DJV_DEBUG(String_Format("Window::idle(%%)").arg(int64_t(this)));

    if (_audio.get())
    {
        int size = _audio_buffer.size();
        DJV_DEBUG_PRINT("audio size = " << size);

        if (! size)
        {
            // Reset audio.

            _audio->stop();
            _audio_buffer.clear();
            _movie.audio_seek(_frame);
            _idle_init = false;
        }

        // Fill audio buffer.

        const int min = _audio_buffer.min();

        do
        {
            int16_t * p = _audio_buffer.push();

            if (! p)
            {
                break;
            }

            _movie.audio(
                p,
                _audio_buffer.chunk() / _movie.info_audio().channel);
        }
        while (++size < min)
            ;
    }

    if (! _idle_init)
    {
        DJV_DEBUG_PRINT("init");

        if (_audio.get())
        {
            _audio->start();
        }

        _idle_timer.start();
        _idle_frame = 0;
        _idle_init = true;
    }
    else
    {
        _idle_timer.check();
    }

    const double time = _audio.get() ? _audio->time() : _idle_timer.seconds();
    DJV_DEBUG_PRINT("time = " << time);

    if (time > 0.0)
    {
        const int64_t absolute_frame = Math::floor(time *
            Image_Speed::speed_to_float(_movie.info_time().speed));
        int inc = absolute_frame - _idle_frame;
        _idle_frame = absolute_frame;
        DJV_DEBUG_PRINT("absolute frame = " << absolute_frame);
        DJV_DEBUG_PRINT("inc = " << inc);

        if (inc)
        {
            _frame += inc;

            if (_frame >= static_cast<int>(_movie.info_time().list.size()))
            {
                _frame = 0;

                if (_audio.get())
                {
                    _audio->stop();
                }

                _audio_buffer.clear();

                _idle_init = false;
            }

            frame_update();
        }
    }
}
Exemplo n.º 6
0
void
mouse_resize(Client *c)
{
     XRectangle geo = c->geo, ogeo = c->geo;
     Position pos = Right;
     XEvent ev;
     Window w;
     int d, u, omx, omy;
     XGCValues xgc;
     GC gci;
     float mwf = tags[selscreen][seltag[selscreen]].mwfact;

     if((c->flags & MaxFlag)
        || (c->flags & LMaxFlag)
        || (c->flags & FSSFlag))
          return;

     XQueryPointer(dpy, ROOT, &w, &w, &omx, &omy, &d, &d, (uint *)&u);

     if((omx - c->geo.x) < (c->geo.width / 2))
          pos = Left;

     if(XGrabPointer(dpy, ROOT, False, MouseMask, GrabModeAsync, GrabModeAsync, None,
                     cursor[((c->flags & TileFlag) ? CurResize : ((pos == Right) ? CurRightResize : CurLeftResize))],
                     CurrentTime) != GrabSuccess)
          return;

     if(!(c->flags & TileFlag))
          XGrabServer(dpy);

     /* Set the GC for the rectangle */
     xgc.function = GXinvert;
     xgc.subwindow_mode = IncludeInferiors;
     xgc.line_width = BORDH;
     gci = XCreateGC(dpy, ROOT, GCFunction | GCSubwindowMode | GCLineWidth, &xgc);

     if(!(c->flags & TileFlag))
     {
          if(pos == Right)
               XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->geo.width + conf.client.borderheight, c->geo.height);
          else
               XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, 0, c->geo.height);
          mouse_dragborder(c->geo, gci);
     }

     do
     {
          XMaskEvent(dpy, MouseMask | SubstructureRedirectMask, &ev);

          if(ev.type == MotionNotify)
          {
               /* To resize MWFACT in tile mode */
               if((c->flags & TileFlag)
                  && tags[selscreen][seltag[selscreen]].layout.func != grid_vertical
                  && tags[selscreen][seltag[selscreen]].layout.func != grid_horizontal)
               {
                    if(tags[selscreen][seltag[selscreen]].layout.func == tile)
                         mwf += (ROUND(ev.xmotion.x_root) - omx) / (sgeo[c->screen].width);
                    else if(tags[selscreen][seltag[selscreen]].layout.func == tile_left)
                         mwf -= (ROUND(ev.xmotion.x_root) - omx) / (sgeo[c->screen].width);
                    else if(tags[selscreen][seltag[selscreen]].layout.func == tile_top)
                         mwf -= (ROUND(ev.xmotion.y_root) - omy) / (sgeo[c->screen].height);
                    else
                         mwf += (ROUND(ev.xmotion.y_root) - omy) / (sgeo[c->screen].height);

                    omx = ROUND(ev.xmotion.x_root);
                    omy = ROUND(ev.xmotion.y_root);

                    tags[selscreen][seltag[selscreen]].mwfact = (mwf < 0.05) ? 0.05 : ((mwf > 0.95) ? 0.95 : mwf);
               }
               /* Free mode */
               else if(!(c->flags & TileFlag))
               {
                    mouse_dragborder(geo, gci);

                    if(pos == Right)
                    {
                         geo.width = ((ev.xmotion.x - c->geo.x < c->minw) ? c->minw : ev.xmotion.x - c->geo.x);
                         geo.height = ((ev.xmotion.y - c->geo.y < c->minh) ? c->minh : ev.xmotion.y - c->geo.y);
                    }
                    else
                    {
                         geo.x = (geo.width != c->maxw) ? c->geo.x - (c->geo.x - ev.xmotion.x) : geo.x;
                         geo.width  = ((c->geo.width + (c->geo.x - geo.x) < c->minw)
                                       ? c->minw && (geo.x = (c->geo.x + c->geo.width) - c->minw)
                                       : c->geo.width + (c->geo.x - geo.x));
                         geo.height = ((ev.xmotion.y - c->geo.y <= c->minh) ? c->minh : ev.xmotion.y - c->geo.y);
                    }

                    client_geo_hints(&geo, c);

                    mouse_dragborder((ogeo = geo), gci);

                    XSync(dpy, False);
               }
          }
     }
     while(ev.type != ButtonRelease);

     if(!(c->flags & TileFlag))
     {
          mouse_dragborder(ogeo, gci);
          client_moveresize(c, geo, True);
          frame_update(c);
          XUngrabServer(dpy);
     }
     else
          tags[selscreen][seltag[selscreen]].layout.func(c->screen);

     client_update_attributes(c);
     XUngrabPointer(dpy, CurrentTime);
     XFreeGC(dpy, gci);

     return;
}
Exemplo n.º 7
0
/** Move the client with the mouse
 * \param c Client pointer
*/
static void
mouse_move(Client *c)
{
     int ocx, ocy, mx, my;
     int dint;
     uint duint;
     Window dw;
     XRectangle geo = c->geo;
     XGCValues xgc;
     GC gci;
     XEvent ev;

     if((c->flags & MaxFlag) || (c->flags & FSSFlag))
          return;

     ocx =  c->geo.x;
     ocy =  c->geo.y;

     if(XGrabPointer(dpy, ROOT, False, MouseMask, GrabModeAsync, GrabModeAsync,
                     None, cursor[CurMove], CurrentTime) != GrabSuccess)
          return;

     if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
          XGrabServer(dpy);

     /* Set the GC for the rectangle */
     xgc.function = GXinvert;
     xgc.subwindow_mode = IncludeInferiors;
     xgc.line_width = BORDH;
     gci = XCreateGC(dpy, ROOT, GCFunction | GCSubwindowMode | GCLineWidth, &xgc);

     if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
          mouse_dragborder(c->geo, gci);

     XQueryPointer(dpy, ROOT, &dw, &dw, &mx, &my, &dint, &dint, &duint);

     do
     {
          XMaskEvent(dpy, MouseMask | SubstructureRedirectMask, &ev);
          screen_get_sel();

          if(ev.type == MotionNotify)
          {
              mouse_move_tile_client(&c);
              mouse_move_tag_client(c);

               /* To move a client normally, in freelayout */
               if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
               {
                    mouse_dragborder(geo, gci);

                    geo.x = (ocx + (ev.xmotion.x - mx));
                    geo.y = (ocy + (ev.xmotion.y - my));

                    /*
                     * Need to draw 2 times the same rectangle because
                     * it is draw with the revert color; revert + revert = normal
                     */
                    mouse_dragborder(geo, gci);
               }
          }
          else if(ev.type == MapRequest
                  || ev.type == ConfigureRequest)
               getevent(ev);
     }
     while(ev.type != ButtonRelease);

     /* One time again to delete all the trace on the window */
     if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
     {
          mouse_dragborder(geo, gci);
          client_moveresize(c, geo, False);
          frame_update(c);
          XUngrabServer(dpy);
     }
     client_update_attributes(c);
     XUngrabPointer(dpy, CurrentTime);
     XFreeGC(dpy, gci);

     return;
}
Exemplo n.º 8
0
void bootup(char *modeptr, int enumber)
/*****************************/
{
    char	 autodir[MAXPATH];
    char         parampath[MAXPATH];
    char         plotname[STR64];
    char         mstr[MAXPATH];
    char         rtautocmd[2 * MAXPATH + 20];
    char	 estring[5];
    extern char  PlotterName[];
    extern char  PrinterName[];
    int do_rt = 0;
    int lval;
    endian_tester et;

    (void) modeptr;
    et.my_int = 0x0a0b0c0d;
    BigEndian = (et.my_bytes[0] == 0x0a) ? 1:0;
    psg_pid = 0;		/* set pids to zero */

    if ( !Bnmr )
       disp_status("BOOTUP  ");

/*  May 18, 1987.  Addition to read the system global parameters.
    If a problem occurs, the program exits immediately, for this
    should not happen.  The CONPAR file is on the distribution tape.	*/

    strcpy(parampath,systemdir);
#ifdef UNIX
    strcat(parampath,"/conpar");
#else 
    strcat(parampath,"conpar");
#endif 
    if (P_read(SYSTEMGLOBAL,parampath)) 
    {
	fprintf(stderr,"problem loading system global parameters from %s\n",
		parampath);
	exit(1);
    }
    openVnmrInfo(systemdir);

/*  If automation mode, use value of autodir to establish path to experiment  */

    if (mode_of_vnmr == AUTOMATION)
    {
      getAutoDir(autodir, MAXPATH);
      if (strlen(autodir) == 0)
      {
	  fprintf( stderr, "unable to access 'autodir' parameter\n" );
	  exit(1);
      }
    }

    /* setup signal handlers to catch these signals */
    if (Wissun())		/* Only do this if using SUN console */
    {
        set_acqi_signal();
    }
    else if (mode_of_vnmr == FOREGROUND) /* Only creat a Vnmr socket if foreground */
    {

	setupVnmrAsync(AcqSocketIsRead);
    }

#ifndef VNMRJ
    if (Wishds())
	last_line = 19;
    else
#endif
	last_line = 20;

    /* load parameters in global file */
    /* moved 9 lines to read GLOBAL before EXP, this way we can use
       curexpdir to restart Vnmr in the last exp used. May 17, 1997 */

    strcpy(parampath,userdir);
    strcat(parampath,"/global");
    if (P_read(GLOBAL,parampath)) 
	Werrprintf("problem loading global parameters");
#ifdef VNMRJ
   // set curexpdir based on jcurwin of viewport 1
   jcurwin_init(curexpdir);
#endif

     // load unshared globalX for viewport X if foreground
     if (!Bnmr)
     {
        sprintf(parampath,"%s/global%d",userdir,VnmrJViewId);
        /* Don't complain if unshared globals are missing */
        P_read(GLOBAL,parampath);
     }

    // set OperatorName 
    if ( (P_getstring(GLOBAL,"operator",OperatorName,1,MAXSTR) != 0) ||
         ( ! strcmp(OperatorName, "") ) )
	strcpy(OperatorName, UserName);

/*  If lock fails, and program is running in foreground mode, set
    current experiment to be EXP0, which doesn't exist.  The user
    can then join another experiment or use other techniques to
    unlock the desired experiment.

    If running in any other mode, exit immediately with an error
    message.							*/

/* May 19, 1997. Use curexpdir to set the enumber, check if directory
   still exists, if not make it exp1. Only done if FOREGROUND Vnmr.
   Acqproc, autoproc, and other procs determine enumber themselves.
   Note that curexpdir is overwritten below, when we read exp parameters */

#ifdef VNMRJ
   jviewport_init();
   P_setstring(GLOBAL,"curexp",curexpdir,1);
#else 
   P_getstring(GLOBAL,"curexp",curexpdir,1,MAXPATH);
#endif 
   if (mode_of_vnmr == FOREGROUND)
   {
      enumber = expdir_to_expnum(curexpdir);
      if (enumber == 0)
         lval = -1;
      else if ( ! access(curexpdir,F_OK))
        lval = lockExperiment( enumber, FOREGROUND);
      else
        lval = -1;
   }
#ifdef SUN
   else if (mode_of_vnmr == ACQUISITION)
      lval = (enumber == 0) ? -2 :checkAcqLock( enumber );
   else if ( Bnmr && (enumber == 0) )
      lval = -2;
   else
#endif
      lval = lockExperiment( enumber, mode_of_vnmr );

    if (lval != 0)
    {
        if ((mode_of_vnmr != FOREGROUND) && (lval != -2) )
        {
	    fprintf( stderr, "unable to lock experiment %d\n", enumber);
	    exit(1);
	}
        if (enumber == 0)
        {
#ifdef VNMRJ
           if (VnmrJViewId != 1)
           {
	      P_getstring(GLOBAL, "jviewportlabel", mstr, VnmrJViewId, MAXPATH);
	      Werrprintf( "No experiment selected for the %s viewport.",mstr);
           }
           jcurwin_setexp( "0" , -1 );
#else 
           if (lval != -2)
	      Werrprintf( "No experiment selected.");
#endif 
        }
        else
        {
#ifdef VNMRJ
           if (VnmrJViewId == 1)
	      Werrprintf( "Unable to lock experiment %d", enumber );
           else
           {
	      P_getstring(GLOBAL, "jviewportlabel", mstr, VnmrJViewId, MAXPATH);
	      Werrprintf( "Unable to lock experiment %d for the %s viewport.",enumber, mstr);
           }
           jcurwin_setexp( "0", -1 );
#else 
	   Werrprintf( "Unable to lock experiment %d", enumber );
#endif 
        }
        strcpy( curexpdir, userdir );
#ifdef UNIX
        strcat( curexpdir, "/exp0" );
#else 
	vms_fname_cat( curexpdir, "[.exp0]" );
#endif 
#ifdef VNMRJ
        if (mode_of_vnmr != AUTOMATION)
        { 
           sprintf(mstr,"exp0 %s",curexpdir);
           writelineToVnmrJ("expn",mstr);
        }
#endif
    }

/*  Only read in parameters if the target experiment was locked.  */

    else
    {
	if (mode_of_vnmr == AUTOMATION)
	  strcpy( curexpdir, &autodir[ 0 ] );
	else
          strcpy( curexpdir, userdir );

	sprintf(estring, "%d", enumber);
#ifdef UNIX
        strcat(curexpdir, "/exp");
	strcat(curexpdir, estring);
#else 
        vms_fname_cat(curexpdir, "[.exp");
        vms_fname_cat(curexpdir, estring);
        vms_fname_cat(curexpdir, "]");
#endif 

        if (mode_of_vnmr == AUTOMATION)
        {
	    lval = strlen( &datadir[ 0 ] );
	    if (lval > MAXPATH-8)
	    {
	        fprintf(stderr, "data pathname too long in automation mode");
	        exit(1);
	    }
            else if (lval > 1)
            {
                int ex;

                sprintf(rtautocmd, "cp %s.fid/sampleinfo %s/sampleinfo",
                        datadir,curexpdir);
                system(rtautocmd);
                ex = 0;
                /* Wait up to 0.5 secs for fid to appear */
                while ( access(rtautocmd,R_OK) && (ex < 50) )
                {
                   struct timespec timer;

                   timer.tv_sec=0;
                   timer.tv_nsec = 10000000;   /* 10 msec */
#ifdef __INTERIX
				   usleep(timer.tv_nsec/1000);
#else
                   nanosleep( &timer, NULL);
#endif
                   ex++;
                }
	        sprintf( &rtautocmd[ 0 ], "%s('%s','nodg')\n",
                         (acqStartUseRtp) ? "RTP" : "RT", &datadir[ 0 ] );
                do_rt = 1; /* do the rt command after reading global tree */
            }
            else  /* read curpar parameters only from the automation exp */
            {
                D_getparfilepath(CURRENT, parampath, curexpdir);
                if (P_read(CURRENT,parampath))
                {  /* if no parameters in current experiment */
                   strcpy(parampath,systemdir);
#ifdef UNIX
                   strcat(parampath,"/stdpar/H1.par/procpar");
#else 
                   vms_fname_cat(parampath,"[.stdpar.H1_par]procpar");
#endif 
                   if (P_read(CURRENT,parampath))
	              Werrprintf("problem loading current parameters");
                }
                P_copy(CURRENT,PROCESSED);
            }
        }
	else       /* if (mode_of_vnmr != AUTOMATION) */
        {
           /* load parameters in curexp/curpar file */
           D_getparfilepath(CURRENT, parampath, curexpdir);
           if (P_read(CURRENT,parampath))
	       Werrprintf("problem loading current parameters from \"%s\"",
                           parampath);
           /* load parameters in curexp/procpar file */
           D_getparfilepath(PROCESSED, parampath, curexpdir);
           if (P_read(PROCESSED,parampath))
	       Werrprintf("problem loading processed parameters from \"%s\"",
                           parampath);
#ifdef VNMRJ
	   sprintf(mstr,"exp%s %s",estring,curexpdir);
	   writelineToVnmrJ("expn",mstr);
#endif 
        }
    }


    /* May 17, 1997. We read GLOBAL parameters earlier */
    setGlobalPars();
#ifdef VNMRJ
    if (!Bnmr)
       saveViewPortAddr();
#endif 
    bufferscale = getbufscale();	/* obtain the value for bufferscale */
    finddatainfo();
    DEBUGPRINT1("bufferscale set to %d\n", bufferscale);
    D_init();				/* initialize the data file handler;
					   bufferscale must be known before
					   D_init() is called.		    */

    /* setAppdirs needs to happen after operator is set in setGlobalPars but before
     * any macros are called
     */
#ifdef VNMRJ
    if (VnmrJViewId == 1)
#endif 
    {
       setAppdirs();
    }

    specIndex = 1;
    if (mode_of_vnmr == AUTOMATION)
    {
      if (do_rt)
      {
        turnOffFixpar();
        execString( &rtautocmd[ 0 ] );
      }
      else
      {
        Werrprintf( "Spectrometer in automation mode" );
      }
    }
    else if (enumber || (mode_of_vnmr != BACKGROUND) )
    {
       disp_expno();
    }
    init_proc2d();
    strcpy(dconi_runstring,"dcon\n");

    /* Assign some function pointers for the */
    /* graphics module                       */
    set_bootup_gfcn_ptrs();
    if (Bnmr)
       init_colors();  /* set default colors for graphics and plotters */

    set_automount_dir();

    /*  Set up plotting parameters */
    /*  If there is trouble setting plottin parameters (ie plotting device
        doesn't exist or devicetable/devicenames is bad, set to "none" device */
    if (P_getstring(GLOBAL,"plotter" ,plotname, 1,32))
    {  P_setstring(GLOBAL,"plotter","none",0);
       strcpy(PlotterName,"none");
    }
    if (!setPlotterName(plotname))
    {  P_setstring(GLOBAL,"plotter","none",0);
       strcpy(PlotterName,"none");
    }

    /*  Set up printing parameters */
    /*  If there is trouble setting printing parameters (ie printing device
        doesn't exist or devicetable/devicenames is bad, set to "none" device */
    if (P_getstring(GLOBAL,"printer" ,plotname, 1,32))
    {  P_setstring(GLOBAL,"printer","none",0);
       strcpy(PrinterName,"none");
    }
    if (!setPrinterName(plotname))
    {  P_setstring(GLOBAL,"Printer","none",0);
       strcpy(PrinterName,"none");
    }

#ifdef SUN
/*
 *  Set up signal handler to exit VNMR
 *  The function nmr_quit will be called when Vnmr exits
 */
    set_nmr_quit_signal();
#endif 
    check_datastation();

#ifdef VNMRJ
    writelineToVnmrJ("bootup","");
    /* create a frame for graphics display */
    frame_update("init", "");
#endif 

/*  The extra space in the first Wscrprintf is essential for
    the scrollable text subwindow to work correctly.			*/

/* ---  print revision ID and Date, Compiled within revdate.c --- */
    P_setstring( SYSTEMGLOBAL, "rev", &RevID[ 0 ], 1);
    P_setstring( SYSTEMGLOBAL, "revdate", &RevDate[ 0 ], 1);
    if (!Bnmr) /* only execute the bootup macro if we are in forground */
    {
	Wscrprintf("\n              %s\n",RevID);
        Wscrprintf("              %s\n",RevDate);

        Wscrprintf("              %s\n\n",Copyright);
        if (strlen(PlotterName) > 0)
           Wscrprintf( "              Plotting Device is set to %s\n",PlotterName);
        else
           Wscrprintf( "              Plotting Device is set to ''\n");
        if (strlen(PrinterName) > 0)
           Wscrprintf( "              Printing Device is set to %s\n\n",PrinterName);
        else
           Wscrprintf( "              Printing Device is set to ''\n\n");

        disp_current_seq();
        if (Wissun())
           sendTripleEscToMaster( 'C',"bootup(0)");
        else
	   execString("bootup(0)\n");
        disp_status("        ");
    }
    else if (enumber)
    {
	execString("bootup(1)\n");
    }

    p11_init();
}
Exemplo n.º 9
0
void nmr_exit(char *modeptr)
/********/
/* exit from nmr program */
{   
    static int exiting = 0;  /* prevent interrupts from re-scheduling this routine */
    int enumber;

   (void) modeptr;
   if (!exiting)
   {
      exiting = 1;
#ifdef SUN
      interact_kill("");	/* Kill all interactive acquisition progs */
#endif 
#ifdef VNMRJ
      frame_update("exit", "closeFrames");
      stop_acqi( 1 );
      autoqMsgOff();
#endif 
      flush(99,NULL,0,NULL);
      if (mode_of_vnmr == FOREGROUND)
         WrestoreTerminal();

      enumber = expdir_to_expnum(curexpdir);

      if (enumber > 0)
        unlockExperiment( enumber, mode_of_vnmr );

/*  If the current experiment is not purged (delete older versions of a file)
    excess copies of curpar, procpar, etc. accumulate.				*/

      closeVnmrInfo();
#ifdef X11
      save_vnmr_geom();
#endif 
#ifdef VNMRJ
      unlink_alphafile();
      if (access( Jvbgname, 0 ) == 0)
         unlink( Jvbgname );
      if (!Bnmr)
      {
         char path[MAXPATH];
         sprintf(path,"%s/persistence/.vp_%d_%d", userdir, jParent, jcurwin_cexpn());
         unlink(path);
      }
#endif 
      kill_all_childs();
#ifndef VNMRJ
      exitTclInfo();
#endif 
      clear_acq();

      if(part11System) p11_saveAuditTrail();
      if ( (mode_of_vnmr == BACKGROUND) && autoDelExp)
      {
         char *argv[1];

         argv[0] = "autoDELEXP";
         delexp(1,argv,0,NULL);
      }

      exit(0);
   }
}