Ejemplo n.º 1
0
/*---------------------------------------------------*/
void quit_all()
{
wind_update(END_MCTRL);
wind_update(END_UPDATE);
(void)rsrc_free();
(void)appl_exit();
exit(0);
}
Ejemplo n.º 2
0
void handle_events(OUTPUT_WINDOW *window) {
    short int mx, my, button, keystate, dummy;
    unsigned short int key;
    short int breturn;
    short int top_wind;           /* Top window handle */
    short int type = 0, out = 0;
    short int time_remaining = 1000;
    short int base_clip[4];                    
    short messages[16];

    while (out != 1) {
        type = 0;
        while (!(type & MU_KEYBD) && !(type & MU_MESAG) && 
               !(type & MU_BUTTON) && !(type & MU_TIMER)) {

            type = evnt_multi(
                (MU_KEYBD | MU_MESAG | MU_BUTTON | MU_TIMER), 0x182, 3, 3,
                0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 
                messages, time_remaining, &mx, &my,
                &button, &keystate, &key, &breturn);
        }

        /*wind_get(win_handle, WF_TOP, &top_wind, &dummy, &dummy, &dummy);
        if (top_wind != win_handle) {
            if (game_state == ACTIVE) game_state == FROZEN;
        }

        // Base clip region is the screen
        base_clip[0] = base_clip[1] = 0;
        base_clip[2] = SCw - 1;
        base_clip[3] = SCh - 1;
        vs_clip(handle, 1, base_clip);*/

        wind_update(BEG_UPDATE);

        if (type & MU_KEYBD) {
            switch(key) {
                case 0x011B:    /* Esc Pause Game */
                    out = 1;
                    break;
                default:
                    break;
            }
            type &= ~MU_KEYBD;
        }

        if (type & MU_MESAG) {
            out = message_handler(messages, window);
            type &= ~MU_MESAG;
        }

        wind_update(END_UPDATE);
    }
    return;
}
Ejemplo n.º 3
0
static int unlock( GEM_PLOTTER self )
{
	LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
	if( (self->flags & PLOT_FLAG_LOCKED) == 0 )
		return(1);
	self->flags &=  ~PLOT_FLAG_LOCKED;
	wind_update(END_MCTRL);
	wind_update(END_UPDATE);
	graf_mouse(M_ON, NULL);
	return( 1 );
}
Ejemplo n.º 4
0
void redraw( GRECT *clip, WORD obj, WORD depth )
{
	GRECT *win;
	
	wind_update(BEG_UPDATE);
	win = cpxGetFirstRect(xcpb,clip);
	while (win)
	{	objc_draw(dog,obj,depth,win->g_x,win->g_y,win->g_w,win->g_h);
		win = cpxGetNextRect(xcpb);
	}
	wind_update(END_UPDATE);
}
Ejemplo n.º 5
0
static void GEM_LockScreen(_THIS)
{
    if (!GEM_locked) {
        /* Reserve memory space, used to be sure of compatibility */
        form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
        /* Lock AES */
        wind_update(BEG_UPDATE);
        wind_update(BEG_MCTRL);

        GEM_locked=SDL_TRUE;
    }
}
Ejemplo n.º 6
0
static void GEM_UnlockScreen(_THIS)
{
    if (GEM_locked) {
        /* Restore screen memory, and send REDRAW to all apps */
        form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
        /* Unlock AES */
        wind_update(END_MCTRL);
        wind_update(END_UPDATE);

        GEM_locked=SDL_FALSE;
    }
}
Ejemplo n.º 7
0
static void do_slider(OBJECT *tree, SLIDER *sl, XDINFO *info)
{
	int newpos;
	long lines;

	wind_update(BEG_MCTRL);
	newpos = graf_slidebox(tree, sl->sparent, sl->slider, 1);
	wind_update(END_MCTRL);

	lines = (long) (sl->n - sl->lines);
	sl->line = (int) (((long) newpos * lines + 500L) / 1000L);
	sl_set_slider(tree, sl, info);
}
Ejemplo n.º 8
0
/*! Free form */
void formulaire(void) {
	OBJECT *adr;
	int quit = FALSE;
	char *adr_bakrsc = 0L;			/* ptr form state */
	MFDB img;

	img.fd_addr = NULL;
	if(_app)
		menu_tnormal(adr_menu, T_FICHIER, 0); 	/* Inverser titre */
	else {
		win[WINDACC].w_bar[T_FICHIER + 3].ob_state |= SELECTED;
		draw_object(T_FICHIER + 3, WINDACC);
	}
	wind_update(BEG_MCTRL);								/* Bloquer menu */
	adr = ir_trindex[FORMULAIRE];
	if(work_display.n_color >= 16) {
		adr->ob_spec.obspec.interiorcol = 8;
		adr->ob_spec.obspec.fillpattern = 7;
		adr[TXT1].ob_spec.tedinfo->te_color = 8;
		adr[TXT1].ob_spec.tedinfo->te_color |= 7 << 4;
		adr[TXT1].ob_spec.tedinfo->te_color |=(1 << 8);
		adr[TXT2].ob_spec.tedinfo->te_color = 8;
		adr[TXT2].ob_spec.tedinfo->te_color |= 7 << 4;
		adr[TXT2].ob_spec.tedinfo->te_color |=(1 << 8);
	}
	bak_rsc(adr, &adr_bakrsc);
	formm_draw(adr, TXT1, TRUE, &img);
	do {
		if(dialog(DLG_FORM, adr, FALSE, FALSE, BLANK, &img, TRUE)) {
			switch(object) {
			case P_CONFIRME :
				quit = TRUE;
				break;
			case P_ANNULE :
				quit = TRUE;
				res_rsc(adr, &adr_bakrsc);
				break;
			}
		}
	} while(NOT quit);
	formm_undraw(adr, &img);
	if(adr_bakrsc)							/* Si état formulaire sauvegardé */
		free(adr_bakrsc);
	wind_update(END_MCTRL);								/* Débloquer menu */
	if(_app)
		menu_tnormal(adr_menu, T_FICHIER, 1); 	/* Inverser titre */
	else {
		win[WINDACC].w_bar[T_FICHIER + 3].ob_state &= ~SELECTED;
		draw_object(T_FICHIER + 3, WINDACC);
	}
}	/* end of formulaire() */
Ejemplo n.º 9
0
/* up date the number of file or directory in the dialog box */
VOID
updatnum( int index, int num )
{
	if ( d_display )
	{
	  f_str( cpbox, index, num );
	  if ( wind_update( 0x0101 ) )
	  {
	    if ( w_draw_fld( whandle, cpbox, index ) == WM_CLOSE )
	      f_cancel = TRUE;

	    wind_update(0);
	  }
	}
}
Ejemplo n.º 10
0
static int lock( GEM_PLOTTER self )
{
	LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
	if( (self->flags & PLOT_FLAG_LOCKED) != 0 )
		return(1);
	self->flags |= PLOT_FLAG_LOCKED;
	if( !wind_update(BEG_UPDATE|0x100) )
		return(0);
	if( !wind_update(BEG_MCTRL|0x100) ){
		wind_update(END_UPDATE);
		return(0);
	}
	graf_mouse(M_OFF, NULL);
	return( 1 );
}
Ejemplo n.º 11
0
/* ***Dialog neu zeichnen, Rechteckliste beachten*** */
void wdial_redraw(int dwhndl, OBJECT *tree, GRECT *redrwrect)
{
 GRECT clip;               /* F�r Rechtecksliste */

 wind_update(BEG_UPDATE); graf_mouse(M_OFF, 0L);

 wind_get(dwhndl, WF_FIRSTXYWH, &clip.g_x, &clip.g_y, &clip.g_w, &clip.g_h);
 while(clip.g_w!=0 && clip.g_h!=0)
  {
   if( rc_intersect(redrwrect, &clip) )
     objc_draw(tree, ROOT, MAX_DEPTH, clip.g_x, clip.g_y, clip.g_w, clip.g_h);
   wind_get(dwhndl, WF_NEXTXYWH, &clip.g_x, &clip.g_y, &clip.g_w, &clip.g_h);
  }

 graf_mouse(M_ON, 0L); wind_update(END_UPDATE);
}
Ejemplo n.º 12
0
VOID
updatname( int index, char *str )
{
	if ( d_display )
	{
	  pack(str,0);
	  strcpy(str, (BYTE *)((TEDINFO *)(cpbox[index].ob_spec))->te_ptext);
	  pack(str,1);
	  if ( wind_update( 0x0101 ) )
	  {
	    if ( w_draw_fld( whandle, cpbox, index ) == WM_CLOSE )
	      f_cancel = TRUE;

	    wind_update(0);	
	  }
	}
}
Ejemplo n.º 13
0
void deinit_popup(POPUP_DATA *pop)
{
  int counter=NOLL;

  form_dial(FMD_FINISH,0,0,0,0,poptree[ROOT].ob_x-5,poptree[ROOT].ob_y-5,poptree[ROOT].ob_width+10,poptree[ROOT].ob_height+10);
  wind_update(END_MCTRL);
  wind_update(END_UPDATE);
  /******************************************************************/
  /* Change the 0 terminated strings back to '|' terminated         */
  /******************************************************************/
  while(counter<pop->size)
  {
    if(pop->string[counter]==NOLL)
      pop->string[counter]='|';
    counter++;
  }
}
Ejemplo n.º 14
0
VOID
updatbox( char *str)
{
	if ( d_display )
	{
	  pack(str,0);
	  strcpy(str, (BYTE *)((TEDINFO *)(cpbox[CPDIR].ob_spec))->te_ptext);
	  pack(str,1);
	  strcpy("_", (BYTE *)((TEDINFO *)(cpbox[CPFILE].ob_spec))->te_ptext);
	  wind_update( 1 );
	  draw_loop( whandle,cpbox,HIDECBOX,MAX_DEPTH,0,0,full.g_w,full.g_h );
	  wind_update( 0 );

	  if ( wait_msg( whandle, cpbox ) == WM_CLOSE )
	    f_cancel = TRUE;
	}
}
Ejemplo n.º 15
0
static void redraw(int start, int depth, int x, int y, int w, int h)
{
	GRECT		r, r1;
	
	r.g_x = x; r.g_y = y; r.g_w = w; r.g_h = h;
	wind_update(BEG_UPDATE);
	hide_mouse_if_needed(&r);
	wind_get_grect(akt_handle, WF_FIRSTXYWH, &r1);
	while (r1.g_w != 0 && r1.g_h != 0)
	{
		if (rc_intersect(&r, &r1))
			objc_draw(aktion, start, depth, r1.g_x, r1.g_y, r1.g_w, r1.g_h);
		wind_get_grect(akt_handle, WF_NEXTXYWH, &r1);
	}
	show_mouse();
	wind_update(END_UPDATE);
}
Ejemplo n.º 16
0
/* rub_wait()
 *==========================================================================
 * Wait for mouse button event or mouse rectangle event...
 *
 * IN:  GRECT *obj:		- GRECT for rect hot spot
 *	int   dir:		- Direction looking for
 *				  0 = entry	1 = exit
 *	int   state:		- button state looking for
 *
 * OUT: returns 0 if button event occurred
 */
int
rub_wait( GRECT *obj, int dir, int state )
{
    int which, kr;
    int mb, ks, br;
    int mx, my;

    wind_update( BEG_MCTRL );
    which = evnt_multi( EVNT_MASK,0x01, 0x01, state,
                        dir, obj->g_x, obj->g_y, obj->g_w, obj->g_h,
                        0,0,0,0,0,
                        0L,
                        0,0,
                        &mx, &my, &mb, &ks, &kr, &br);

    wind_update( END_MCTRL );
    return( which & MU_BUTTON );
}
Ejemplo n.º 17
0
/*******************************************************************************
	_fselect
********************************************************************************
	int _fselect(char *pfname,char *pname,char *fname,char *ext,char *title)

	Funktion:	Ruft den FileSelector in komfortabler Art und Weise auf. Dabei
					kann man alle Parts (Filename, Pathname, etc.) einzeln
					�bergeben. Man kann aber auch Pathname und den kompletten Namen
					in `pfname' �bergeben. Diese Routine sucht sich schon das, was
					ihr fehlt in bestimmten Grenzen selbst heraus.
					Diese Funktion unterst�tzt den FSEL-Cookie und l�uft
					auch ohne Selectric.

	Parameter:	*pfname	Enth�lt abschlie�end den fertigen Pfad, den
								man sofort in ein `open' einsetzen kann.
					*pname	Der Startpfad (ohne Wildcards!).
					*fname	Ein voreingestellte Filenamen.
					*ext		Eine Extension.
					*title	Einen Boxtitel. Dabei wird a) die TOS-Version
								als auch der FSEL-Cookie �berpr�ft.

	Return:		Der Button mit dem der Selector verlassen wurde.

	Bemerkung:	Beim Aufruf aus Accessories nicht vergessen ein
					BEG/END_UPDATE um diesen Aufruf zu legen!!!!!!!!!!
					Die meisten File-Selector Clones (incl. Selectric)
					machen das eh, nicht aber das Original ...
*******************************************************************************/
int _fselect(char *pfname,char *pname,char *fname,char *ext,char *title)
{
	int		but;
	char		*p;

	if (!fname[0])
	{
		p=strrchr(pfname,'\\');
		if (p)
			strcpy(fname,p+1);
		else
			strcpy(fname,pfname);
	}
	if (!pname[0])
	{
		p=strrchr(pfname,'\\');
		if (p)
		{
			p[1]='\0';
			strcpy(pname,pfname);
		}
	}
	else if (pname[strlen(pname)-1] != '\\')
		strcat(pname,"\\");
	strcat(pname,ext);

	wind_update(BEG_MCTRL);
	form_dial(FMD_START,0,0,0,0,glb.aes.desk.x,glb.aes.desk.y,glb.aes.desk.w,glb.aes.desk.h);
	if (_fsel_check() || (_vTOS() >= 0x0104))
		fsel_exinput(pname,fname,&but,title);
	else
		fsel_input(pname,fname,&but);
	form_dial(FMD_FINISH,0,0,0,0,glb.aes.desk.x,glb.aes.desk.y,glb.aes.desk.w,glb.aes.desk.h);
	_clearAesBuffer();
	wind_update(END_MCTRL);

	p=strrchr(pname,'\\');
	if (p)
		*p='\0';
	strcpy(pfname,pname);
	strcat(pfname,"\\");
	strcat(pfname,fname);
	return but;
}
Ejemplo n.º 18
0
void  main()

{
   OBJECT  *tree;
   int     tree_cnt, count;

   appl_init();

   graf_mouse (ARROW, NULL);

   if (rsrc_load ("CTRL.RSC") == 0) {
        form_alert (1, "[1][ |  Couldn't locate CTRL.RSC !  ][ Ooops ]");
        appl_exit();
        return;
      }

   for (tree_cnt = 0; tree_cnt < 3; tree_cnt++) {
        rsrc_gaddr (R_TREE, tree_cnt, & tree);
        do {
             if (tree->ob_type & 0x7f00)
                  if ((tree->ob_state & CROS_CHK) == CROS_CHK) {
                       tree->ob_type = G_USERDEF;
                       tree->ob_spec.userblk = &my_user_block;
                       tree->ob_state &= ~ CROS_CHK;
                     }
          } while ((tree++->ob_flags & LASTOB) == 0);
      }

   if (init_data() == 0) {
        rsrc_free();
        appl_exit();
        return;
      }

   wind_update (BEG_UPDATE);

   gem_prgm();

   wind_update (END_UPDATE);

   rsrc_free();
   appl_exit();
 }
Ejemplo n.º 19
0
/* Do_Redraw();
 * ================================================================
 */
void
Do_Redraw( OBJECT *tree, GRECT *area )
{
   GRECT rect;

   graf_mouse( M_OFF, 0L );
   wind_update( BEG_UPDATE );
   wind_get( wid, WF_FIRSTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );

   while( rect.g_w && rect.g_h )
   {
     if( rc_intersect( area, &rect ) )
         ObjcDraw( tree, ROOT, MAX_DEPTH, &rect );

     wind_get( wid, WF_NEXTXYWH,&rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );
   }
   wind_update( END_UPDATE );
   graf_mouse( M_ON, 0L );
}
Ejemplo n.º 20
0
void
iconize(WIND w)
{
	char	*s, name[9];
	ICONWIND iw;
	WORD	e, i, msg[8];

	s = strrchr(w->name, '\\');
	if (!s) s = w->name;
	strncpy(name, s+1, 8);
	name[8] = '\0';
	if ((s = strchr(name, '.'))
	||  (s = strchr(name, ' ')))
		*s = 0;
	i = iw_new(wsid, w->rwind.g_x, w->rwind.g_y, name,
				viewfile, BLACK, WHITE, w);
	if (i > 0)
	{
		iw = (ICONWIND)w_lookup(i);
		iw->w.do_button = iw_button;
		w_closed(w, msg);
		w->info[0] = 0;
		wind_sstr(w->id, WF_INFO, w->info);
		for(;;) {
			e = evnt_multi(MU_MESAG|MU_TIMER, 0,0,0,
							0,0,0,0,0, 0,0,0,0,0,
							msg, 100,0, &i, &i, &i, &i, &i, &i);
			if (e & MU_MESAG)
				do_msg(msg);
			else if ((e & MU_TIMER) && wind_update(TRY_UPDATE))
				break;
		}
		wind_update(END_UPDATE);

		graf_mouse(M_OFF, NULL);
		iw_drag(iw, 0, 0);
		graf_mouse(M_ON, NULL);

		wind_open(iw->w.id, iw->w.rwind.g_x, iw->w.rwind.g_y,
				  iw->w.rwind.g_w, iw->w.rwind.g_h);
	}
}
Ejemplo n.º 21
0
VOID
open_def( )
{
    REG WORD	i;
    REG WINDOW	*win;

    wind_update(1);

    win = winpd;

    for ( i = 0; i < MAXWIN; i++ )
    {
        if ( win[i].w_path[0] )
        {
            if ( !open_disk( 0, win[i].w_path, FALSE ) )
                win[i].w_path[0] = 0;
        }
    }

    wind_update(0);
}
Ejemplo n.º 22
0
void update_objects(WINDFORM *wind,int obj_id,int depth, int pipe[8])
{
	CORDS2 r,u,o;
	CORDS t;

	if(pipe)
	{
		o.x1=pipe[4];
		o.y1=pipe[5];
		o.x2=pipe[4]+pipe[6]-1;
		o.y2=pipe[5]+pipe[7]-1;
	}

	graf_mouse(M_OFF,0);
	wind_update(BEG_UPDATE);
	wind_get(wind->whandle,WF_FIRSTXYWH,&t.x,&t.y,&t.w,&t.h);
	while(t.w || t.h)
	{
		if(pipe)
		{
			r.x1=t.x;				r.y1=t.y;
			r.x2=t.x+t.w-1;		r.y2=t.y+t.h-1;
			u.x1=max(r.x1,o.x1);	u.y1=max(r.y1,o.y1);
			u.x2=min(r.x2,o.x2);	u.y2=min(r.y2,o.y2);
		}
		else
		{
			u.x1=t.x;				u.y1=t.y;
			u.x2=t.x+t.w-1;		u.y2=t.y+t.h-1;
		}
		
		if((u.x2>=u.x1) && (u.y2>=u.y1)) 
			objc_draw(wind->formtree,obj_id,depth,
				u.x1, u.y1, u.x2-u.x1+1, u.y2-u.y1+1);
		wind_get(wind->whandle,WF_NEXTXYWH,&t.x,&t.y,&t.w,&t.h);
	}
	wind_update(END_UPDATE);
	graf_mouse(M_ON,0);
}
Ejemplo n.º 23
0
void
iw_drag(ICONWIND iw, WORD xoff, WORD yoff)
{
	UWORD	e;
	WORD	mx, my, mb, i;

	wind_update(BEG_MCTRL);
	graf_mkstate(&mx, &my, &mb, &i);
	do {
		iw->w.rwind.g_x = min(max(mx + xoff, desk.g_x),
							  desk.g_x + desk.g_w - iw->w.rwind.g_w);
		iw->w.rwind.g_y = min(max(my + yoff, desk.g_y),
							  desk.g_y + desk.g_h - iw->w.rwind.g_h);
		iw_xdraw(iw);
		e = evnt_multi(MU_BUTTON|MU_M1, 1,1,!mb,
						1,mx,my,1,1,  0,0,0,0,0,
						NULL, 0,0, &mx, &my, &i, &i, &i, &i);
		iw_xdraw(iw);
	} while (!(e & MU_BUTTON));
	wind_update(END_MCTRL);
	iw->w.sizecalc(&iw->w, &iw->w.rwind);
}
Ejemplo n.º 24
0
/*---------------------------------------------------*/
void redraw(int obn)
{
	int x[4],xs[4], /* xw[4], xy[4],*/ xc[4];

	(void)wind_get(wid,WF_WORKXYWH,&xs[0],&xs[1],&xs[2],&xs[3]);
	(void)wind_get(wid,WF_FIRSTXYWH,&x[0],&x[1],&x[2],&x[3]);
	(void)wind_get(wid,WF_CURRXYWH,&xc[0],&xc[1],&xc[2],&xc[3]);
	rs_object[TREE1].ob_x=xs[0];
	rs_object[TREE1].ob_y=xs[1];

/*	objc_offset(rs_object,obn,&xw[0],&xw[1]);
	xw[2]=rs_object[obn].ob_width;
	xw[3]=rs_object[obn].ob_height; */
	/* Warum???????????? Funktioniert nicht mit 3D-Objs (da
		wird zu wenig neu gezeichnet, weil die Objekte gr”žer sind,
		als ob_width und ob_height angeben...!
		
		In Wirklichkeit muž man mit dem Redraw-Rechteck clippen,
		welches man mit der Redraw-Message bekommt!
		
		Bei der komischen (aber effizienten!) Methode, die Du
		verwendest (nicht Koordinaten, sonder Objekte werden
		neu gezeichnet, sehr interessant!) lass ich am besten das
		intersect-ionieren weg. objc_draw selber weiž schliesslich
		am besten, wie grož seine Objekte sind, oder?!?
	*/
	
	wind_update(BEG_UPDATE);
	while((x[2]!=0)||(x[3]!=0))
	{
/*		if ((intersect(xw,x,xs))) */
		objc_draw(rs_object,obn,42,x[0],x[1],x[2],x[3]);
		(void)wind_get(wid,WF_NEXTXYWH,&x[0],&x[1],&x[2],&x[3]);
	}
	wind_update(END_UPDATE);
}
Ejemplo n.º 25
0
/* gem_exit()
 * ================================================================
 * Clean exit.
 */
void
gem_exit( int code )
{
	int ignore[8];

/*
 * Go into an endless loop if we're a desk accessory...
 */
	if( !_app ) for(;;) evnt_mesag( ignore );

/*
 * Otherwise, clean up and call the exit hooks
 */
	wind_update( END_UPDATE );
	close_vwork();
	wind_exit();   
	appl_exit();
	exit( code );
}
Ejemplo n.º 26
0
cz1pars()
{
   FDB savefdb;
   int mousex,mousey,mstate,i,kstate;
   int done=0;
   int mbefore=0;
   int key,event;

/* grab mouse control off of AES */
   wind_update(3);
/* turn clipping off during all of module 7 */
   vs_clip(gl_hand,0,&dummy);   

/* save screen which will lie under cz1pars window */
   savefdb.fd_addr= saveptr;
   savefdb.fd_w= 640;
   savefdb.fd_h= 200*rez;
   savefdb.fd_wdwidth= 40;
   savefdb.fd_stand= 0;
   if (rez==1)
      savefdb.fd_nplanes= 2;
   else
      savefdb.fd_nplanes= 1;
   xyarray[0]= cz1_xy[0]; xyarray[1]= rez*cz1_xy[1]; 
   xyarray[2]= cz1_xy[2]; xyarray[3]= rez*cz1_xy[7];
   xyarray[4]= 0;   xyarray[5]= 0;
   xyarray[6]= cz1_xy[2]-cz1_xy[0];   xyarray[7]= rez*(cz1_xy[7]-cz1_xy[1]);
   v_hide_c(gl_hand);   
   if (saveptr) vro_cpyfm(gl_hand,3,xyarray,&scrfdb,&savefdb);
   v_show_c(gl_hand,0); 
   graf_growbox((cz1_xy[0]+cz1_xy[2])/2,rez*(cz1_xy[1]+cz1_xy[5])/2,1,1,
                cz1_xy[0],cz1_xy[1],
                cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1);
   cz1_wind();     /* put up cz1pars window */

/* executive loop */
   while (!done)
   {
      vq_mouse(gl_hand,&mstate,&mousex,&mousey);
      kstate=Kbshift(0xffff);
      if ((mstate&3)&&!mbefore)
         done= do_cz1(mousex,mousey,mstate,kstate);
      event= evnt_multi(MU_TIMER|MU_KEYBD,0,0,0,0,0,0,0,0,0,0,0,0,0,
             &dummy,1,0,&mousex,&mousey,&dummy,&dummy,&key,&dummy);    
      if ((event & MU_KEYBD)&&(key==0x6100)) cz1_undo(mousex,mousey);
      mbefore=mstate;
   }

   vs_clip(gl_hand,0,&dummy);   /* turn clipping off (clobbered by redraw */
/* restore the screen */
   xyarray[0]= 0;    xyarray[1]= 0;   
   xyarray[2]= cz1_xy[2]-cz1_xy[0];   xyarray[3]= rez*(cz1_xy[7]-cz1_xy[1]);
   xyarray[4]= cz1_xy[0];  xyarray[5]= rez*cz1_xy[1];  
   xyarray[6]= cz1_xy[2];  xyarray[7]= rez*cz1_xy[7];
   if (saveptr)
   {
      v_hide_c(gl_hand);
      vro_cpyfm(gl_hand,3,xyarray,&savefdb,&scrfdb);
      v_show_c(gl_hand,0);
   }
   else
      redraw(ws_hand,cz1_xy[0],rez*cz1_xy[1],
             cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1);
   graf_shrinkbox((cz1_xy[0]+cz1_xy[2])/2,rez*(cz1_xy[1]+cz1_xy[5])/2,1,1,
                cz1_xy[0],cz1_xy[1],
                cz1_xy[2]-cz1_xy[0]+1,rez*(cz1_xy[7]-cz1_xy[1])+1);   
/* return mouse control to AES */
   wind_update(2);

} /* end cz1pars() */
Ejemplo n.º 27
0
/*
 * Get a single event, process it, and return.
 *
 */
domulti(){
    int event;
    
    event = evnt_multi(MU_MESAG,
			1,1,butdown,
			0,0,0,0,0,
			0,0,0,0,0,
			msgbuff,0,0,&mx,&my,&ret,&ret,&keycode,&ret);

    if (event & MU_MESAG) {
    	wind_update(TRUE);
	switch (msgbuff[0]) {
	    case WM_REDRAW:
		do_redraw(msgbuff[4],msgbuff[5],msgbuff[6],msgbuff[7]);
		break;

	    case MN_SELECTED:
	        BEE_MOUSE;
		switch(msgbuff[3]) {
		    case MNDISK:
			switch (msgbuff[4]) {
			    case DIFORM:
		        	if ((needscan) && (rescan(0,0) == ERROR))	{
						break;	/* don't report medium changed */
					}
			        tformat = TRUE;
					needscan = FALSE;
			        dodiform();
			        tformat = FALSE;
			        break;
			    case DIPART:
		        	if ((needscan)&&(rescan(0,0) == ERROR))	{
						break;	/* don't report medium changed */
					}
					needscan = FALSE;
			        dodipart(-1, NULL, NULL);
			    	break;
			    case DIZERO:
					if (pnf)	{
						err(needboot);
					} else {
		        		if ((needscan)&&(rescan(0,1) == ERROR))	{
							break;	/* don't report medium changed */
						}
						needscan = FALSE;
			        	dodizero();
					}
			        break;
			    case DIMARK:
					if (pnf)	{
						err(needboot);
					} else {
		        		if ((needscan)&&(rescan(0,1) == ERROR))	{
							break;	/* don't report medium changed */
						}
						needscan = FALSE;
			        	dodimark();
					}
			        break;
			    case DISHIP:
		        	if ((needscan)&&(rescan(0,0) == ERROR))	{
						break;	/* don't report medium changed */
					}
					needscan = FALSE;
			        dodiship();
			        break;
			    default:	    break;
			}
			break;

		    case MNFILE:
			switch (msgbuff[4]) {
			    case FIQUIT:
				running = 0;
				break;

			    default:
				break;
			}
			break;
			
		    case MNDESK:
			if(msgbuff[4] == DEABOUT) {
			    strcpy(abtdial[ABVERSN].ob_spec, "Version 3.5");
			    abtdial[ABOK].ob_state = NORMAL;
			    execform(abtdial);
			}
			break;		/* "cannot happen" */
		}

		menu_tnormal(menuobj, msgbuff[3], 1);	/* back to normal */
	        ARROW_MOUSE;
		break;
		
	    case WM_NEWTOP:
	    case WM_TOPPED:
		wind_set(wi_handle, WF_TOP, 0, 0, 0, 0);
		break;

	    case WM_CLOSED:
		running = FALSE;
		break;

	    default:
		break;
	}
	wind_update(FALSE);
    }
}
Ejemplo n.º 28
0
/* ................................................................
 * Handle user interaction with a form in open window `w'.
 *
 * Initial conditions are as follows:
 * w->x is the address of the form.
 * window is open, with appropriate WINFO rects & coordinates set
 * form is drawn within window, at correct virtual coordinates
 * ROOT object of form has correct x,y coordinates
 *
 * This routine works just like form_do, but dispatches window
 * events, redrawing and fixing up the object tree as appropriate,
 * and maintaining the various rects and coordinates in the WINFO struct.
 *
 * Returns exit object selected, |= 0x8000 if double clicked a TOUCHEXIT,
 * OR -1 if a message was received which couldn't be handled.
 * In the latter case, the `puntmsg' array is filled with the message buffer
 * which xform_do() couldn't handle, and the application is responsible for
 * picking up where xform_do() left off.  A cop-out, I know.
 *
 * NOTE: form_dial( FMD_START,... ) and form_dial( FMD_FINISH,... )
 *		should NOT be used with xform_do().
 *
 * User defined objects could cause problems with this routine, as
 * the boundary of the object may lie outside the window coordinates.
 * Caveat programmer.
 */
WORD
cdecl
xform_do( OBJECT *tree, WORD start_field, WORD puntmsg[] )
{
	WORD	next_obj, edit_obj, idx;
	BOOLEAN	cont, doedit;
	WORD	event;
	MRETS	m;
	WORD	key, clicks;
	DIRS	direction; /* form_keybd */
	GRECT	rect;
		
	cpx_tree = tree;
	SetAccCloseState( FALSE );
	SetWmCloseState( FALSE );
	/*
	 * Get the next editable object
	 */
	if( start_field == 0 )
		next_obj = find_obj( tree, 0, FORWARD );
	else
		next_obj = start_field;

	edit_obj = 0;
	cont = TRUE;
	
	cursor = FALSE;
	
	while( cont ) {

		/*
		 * Put the cursor in the edit field
		 * Note: This is skipped if there is only one field.
		 */
		if( (next_obj != 0) && (edit_obj != next_obj) ) {
			edit_obj = next_obj;
			next_obj = 0;
			doedit = can_edit( tree, edit_obj );
			if( doedit && !cursor )
			{
				objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT );
				cursor = TRUE;
			}	
		}
		wind_update( FALSE );
		/*
		 * Wait...
		 */
		event = Evnt_multi( MU_KEYBD|MU_BUTTON|MU_MESAG, 2, 1, 1,
							NULL, NULL, msg, 0L, &m, &key, &clicks );
		wind_update( TRUE );

		if( EvMessage() ) {
			switch( MsgType(msg) ) {
				case AC_OPEN:   acc_open( (int *)msg );
						break;
						
				case WM_TOPPED:
				case WM_NEWTOP:
					        Wm_Topped( ( int *)msg );
						doedit = can_edit( tree, edit_obj );
					        if( doedit && !cursor )
					        {
					           objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT );
						   cursor = TRUE;
					        }
						break;
						
				case WM_SIZED:
					doedit = can_edit( tree, edit_obj );
					
				/* fall through */
				case WM_MOVED:	/* if moving, that means we are on top, therefore, cursor is already on */
						doedit = can_edit( tree, edit_obj );
						if( !doedit )
							cursor = FALSE;
				case WM_REDRAW:
				case WM_FULLED:
				case WM_ARROWED:
				case WM_HSLID:
				case WM_VSLID:
				/* redraw 'n' shit */
						
					if( edit_obj && ( msg[0] == WM_REDRAW ))
					{
					    NoEdit( edit_obj );
					    rect = ObRect( edit_obj );
					    objc_offset( tree, edit_obj, &rect.g_x, &rect.g_y );

					    /* The offsets will take care of the blinking cursor
					     * area that needs to be redraw to erase it.
					     */
					    rect.g_y -= 3;
					    rect.g_w += 3;
					    rect.g_h += 6;

					    /* Clip the rectangle to the work area of the form.*/
					    rc_intersect( &w.work, &rect ); 

					    /* The redraw is necessary to turn off the blinking cursor.
					     * We are going to need to send a redraw message to the calling
					     * cpx in case they have any custom redraws that need to be done.
					     */
					    Redraw_XForm_Do( &rect );
					    
					    if( msg[0] == WM_REDRAW )
					    {	
					       for( idx = 0; idx < 8; idx++ )
						   puntmsg[idx] = msg[idx];
					    }

					}
					/* Here we redraw/move the area that is dirtied */    
					do_windows( (int *)msg, (int *)&event );
					if( edit_obj )
					    MakeEditable( edit_obj );
					doedit = can_edit( tree, edit_obj );
					if( !doedit )
						cursor = FALSE;
					if( msg[0] == WM_REDRAW )
					{	
					   for( idx = 0; idx < 8; idx++ )
						   puntmsg[idx] = msg[idx];
					   return -1;
					}
				break;

				default:if( msg[0] == AC_CLOSE )
						SetAccCloseState( TRUE );
					if( msg[0] == AP_TERM )
					{
					    SetAccCloseState( TRUE );
					    msg[0] = AC_CLOSE;
					}
					if( msg[0] == WM_CLOSED )
					        SetWmCloseState( TRUE );
					for( idx = 0; idx < 8; idx++ )
						puntmsg[idx] = msg[idx];
					return -1;
			}
		}


/*
 * What about hot keys?? AIEEE!!
 */
		if( EvKey() ) {

			/*
			 * form_keybd() encapsulated here
			 */
			direction = NODIR;
			switch( key ) {

				case K_RETURN:
				case K_ENTER:
					next_obj = 0;
					direction = DEFAULTDIR;
					break;

				case K_BACKTAB:
				case K_UP:
					direction = BACKWARD;
					break;

				case K_TAB:
				case K_DOWN:
					direction = FORWARD;
					break;
			}

			if( direction != NODIR ) {
				key = 0;
				next_obj = find_obj( tree, edit_obj, direction );
				if( (direction == DEFAULTDIR) && (next_obj != 0) ) {
					Objc_change( tree, next_obj, &w.work,
 				        ObState(next_obj)|SELECTED, TRUE );
					cont = FALSE;
				}
			}
			/*
			 * End of form_keybd()
			 */

			/* The above code clears 'key', therefore, we'll
			 * check key FIRST, then test the ASCII and 
			 * scancode
			 */
			if( key && ( !( key & 0xff ) )  )
			{
			  if( ( key != K_UP     )  &&
			      ( key != K_DOWN   )  &&
			      ( key != K_RIGHT  )  &&
			      ( key != K_LEFT   )  &&
			      ( key != K_RETURN )  &&
			      ( key != K_ENTER  )  &&
			      ( key != K_TAB )	   &&
			      ( key != K_BACKTAB)
			    )
			    {
			      puntmsg[0] = CT_KEY;
			      puntmsg[3] = key;
			      return -1;
			    }  
			}

			if( key && doedit )
				objc_edit( tree, edit_obj, key, (int *)&idx, ED_CHAR );
		}

		if( EvButton() ) {
			next_obj = objc_find( tree, ROOT, MAX_DEPTH, m.x, m.y );
			if( next_obj == NIL ) {
				Bconout( 2, 7 );
				next_obj = 0;
			} else {
				cont = fm_button( tree, next_obj, clicks, &next_obj );
			}
		}

		if(  doedit && (!cont || (next_obj != 0)) && ( next_obj != edit_obj) )
		{
		   objc_edit( tree, edit_obj, 0, (int *)&idx, ED_END );
		   cursor = FALSE;
		}   		
	}

	return next_obj;
}
Ejemplo n.º 29
0
void init_manager(void)
{
	#ifdef DEBUG
	printf(DEBUG_ACTIVATED);
	#endif

	_GemParBlk.global[0]=0;
	ap_id = appl_init();
	if (!_GemParBlk.global[0]) exit(0);
	if (ap_id < 0) exit(0);

	if (!_app) wind_update(BEG_UPDATE);

	Pdomain(1);
	check_cookies();
	
	if (_GemParBlk.global[1] != 1) multitask = 1;
	if ((_GemParBlk.global[0] >= 0x0400) && (multitask)) multitos = 1;
	
	allocmode = GLOBAL;
	if (_app) allocmode |= 3;
	
	read_name();
	check_info();
	
	if ((!_app) || ((multitos) && (!magix)))
	{
		menu_id = menu_register(ap_id,STRING_MENUENTRY);
		
		if (menu_id < 0)
		{
			if (!_app) wind_update(END_UPDATE);
			
			if (multitos)
			{
				appl_exit();
				exit(0);
			}
			else
			{
				while (1) evnt_timer(0,1);
			}
		}
	}
	
	find_inf();

	if (!_app) wind_update(END_UPDATE);

	Psignal(SIGTERM,sig_handler);
	Psignal(SIGQUIT,sig_handler);
	
	if (!multitask)
	{
		char s[256];
		
		strcpy(s,"[0][OLGA v");
		strcat(s,OLGAVERSIONSTR);
		strcat(s,"  Rev ");
		strcat(s,OLGAREVISION);
		strcat(s," (");
		strcat(s,OLGADATE);
		strcat(s,") | |");
		strcat(s,MESSAGE_MULTITASKING);
		
		form_alert(1,s);
		
		if (_app)
		{
			#ifdef DEBUG
			printf(DEBUG_DEACTIVATED);
			#endif
			
			appl_exit();
			exit(0);
		}
	}
	
	if (shutdown) shel_write(9,1,0,NULL,NULL);
	
	broadcast_olenew();
}
Ejemplo n.º 30
0
WORD insa_dial(LONG tree, WORD nicon, WORD numics)
{
	WORD	firstslot, nstate, ystate, i;
	WORD	touchob, oicon, value;
	WORD	mx, my, kret, bret, cont;
	BYTE	*pstr, doctype[4];
	GRECT	pt;

	/* draw the form */
	show_hide(FMD_START, tree);
	/* init for while loop by forcing initial fs_newdir call */
	cont = TRUE;
	while ( cont )
	{
		firstslot = 6;
		for (i = 0; i < firstslot; i++)
		{
			pstr = &doctype[0];
			inf_sget(tree, APDFTYPE+i, pstr);
			if (*pstr == '\0')
				firstslot = i;
		}
		touchob = form_do((OBJECT FAR *)tree, APDFTYPE+firstslot);
		graf_mkstate(&mx, &my, &kret, &bret);

		value = nstate = ystate = 0;
		touchob &= 0x7fff;
		switch ( touchob )
		{
			case APINST:
			case APREMV:
			case APCNCL:
				cont = FALSE;
				break;
			case APFUPARO:
				value = -1;
				break;
			case APFDNARO:
				value = 1;
				break;
			case APGEM:
				nstate = SELECTED;
				ystate = DISABLED;
				break;
			case APDOS:
			case APPARMS:
				nstate = LWGET(OB_STATE(APNMEM));
				ystate = LWGET(OB_STATE(APYMEM));
				if ( ystate == DISABLED )
				{
					nstate = SELECTED;
					ystate = NORMAL;
				}
				break;
			case APFSVSLI:
				ob_actxywh(tree, APFSVELE, &pt);
				pt.g_x -= 3;
				pt.g_w += 6;
				if ( rc_inside(&pt, mx, my) )
					goto dofelev;
				value = (my <= pt.g_y) ? -1 : 1;
				break;
			case APFSVELE:
dofelev:		wind_update(3);
				ob_relxywh(tree, APFSVSLI, &pt);
				pt.g_x += 3;
				pt.g_w -= 6;
				LWSET(OB_X(APFSVSLI), pt.g_x);
				LWSET(OB_WIDTH(APFSVSLI), pt.g_w);
				value = graf_slidebox((OBJECT FAR *)tree, APFSVSLI, APFSVELE, TRUE);
				pt.g_x -= 3;
				pt.g_w += 6;
				LWSET(OB_X(APFSVSLI), pt.g_x);
				LWSET(OB_WIDTH(APFSVSLI), pt.g_w);
				wind_update(2);
#if M68000
				value = (WORD)((LONG)value * (LONG)(numics-1) / 1000) - nicon;
#else
				value = mul_div(value, numics-1, 1000) - nicon;
#endif
				break;
		}
		if (nstate != ystate)
		{
			LWSET(OB_STATE(APNMEM), nstate);
			LWSET(OB_STATE(APYMEM), ystate);
			draw_fld(tree, APMEMBOX);
		}
		if (value)
		{
			oicon = nicon;
			nicon += value;
			if (nicon < 0)
				nicon = 0;
			if (nicon >= numics)
				nicon = numics - 1;	
			if (oicon != nicon)
			{
				insa_elev(tree, nicon, numics);
				draw_fld(tree, APFTITLE);
				draw_fld(tree, APFSVSLI);
				draw_fld(tree, APFILEBO);
			}
		}
	}
	/* undraw the form	*/
	show_hide(FMD_FINISH, tree);
	return(nicon);
}