예제 #1
0
/* ***Fenster �ffnen*** */
int open_window(void)
{
 wind_calc(WC_WORK, SWIGADGETS, deskx, desky, deskw, deskh, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h);
 wi.g_w=wi.g_w&0xFFF0; wi.g_h=wi.g_h&0xFFF0;
 wind_calc(WC_BORDER, SWIGADGETS, wi.g_x, wi.g_y, wi.g_w, wi.g_h, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h);
 wihndl=wind_create(SWIGADGETS, deskx, desky, wi.g_w, wi.g_h);
 if(wihndl<0)
  {
   form_alert(1, "[3][Could not create|the windows!][Cancel]");
   return(-1);
  }

 wind_set(wihndl, WF_NAME, "STED", 0L);
 wind_set(wihndl, WF_INFO, " Spielfeld editieren", 0L);

 wind_calc(WC_BORDER, SWIGADGETS, 32, 32, rww<<4, rwh<<4,
			&wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h);
 wi.g_x=deskx+(deskw-wi.g_w)/2;
 wi.g_y=desky+(deskh-wi.g_h)/2;

 if(aesversion>=0x0300)
  {
   wind_set(wihndl, WF_BEVENT, 1, 0, 0L);
  }

 /* Fenster �ffnen: */
 wind_open(wihndl, wi.g_x, wi.g_y, wi.g_w, wi.g_h);
 wind_get(wihndl, WF_WORKXYWH, &wi.g_x, &wi.g_y, &wi.g_w, &wi.g_h);

 return(0);
}
예제 #2
0
/* SetIntroWindow()
 * ================================================================
 * RETURN: if < 0, error
 */
int
SetIntroWindow( void )
{
   /* Open the Intro window */
   ad_tree = ad_intro;

   ActiveTree( ad_tree );
   FormCenter( ad_tree, &gl_work );
   ObX( ROOT ) = gl_work.g_x;
   ObY( ROOT ) = gl_work.g_y;

   wid = wind_create( MOVER | NAME | CLOSE, gl_full.g_x, gl_full.g_y,
		            		    gl_full.g_w, gl_full.g_h );

   if( wid > 0 )
   {
     wind_set( wid, WF_NAME, wtitle );
     wind_calc( WC_BORDER, MOVER | NAME | CLOSE,
	        gl_work.g_x, gl_work.g_y, gl_work.g_w, gl_work.g_h,
	        &gl_curr.g_x, &gl_curr.g_y, &gl_curr.g_w, &gl_curr.g_h );

     wind_open( wid, gl_curr.g_x, gl_curr.g_y, gl_curr.g_w, gl_curr.g_h );
   } else form_alert( 1, nowin );

   return( wid );
}
예제 #3
0
/* open window and enter event loop */
void start_program (void) {
	struct win_data wd;
	int fullx, fully, fullw, fullh;

	graf_mouse (ARROW, 0L); /* ensure mouse is an arrow */

	/* 1. set up and open our window */
	wind_get (0, WF_WORKXYWH, &fullx, &fully, &fullw, &fullh);
	wd.handle = wind_create (NAME|CLOSER, fullx, fully, fullw, fullh);
	wind_set (wd.handle, WF_NAME, "Example: Version 1", 0, 0);
	wind_open (wd.handle, fullx, fully, 300, 200);

	/* create any application-specific data: the string to show, in this case */
	wd.text = "Hello";

	/* display content in window */
	draw_example (app_handle, &wd);

	/* 2. process events for our window */
	event_loop (&wd);

	/* 3. close and remove our window */
	wind_close (wd.handle);
	wind_delete (wd.handle);
}
예제 #4
0
/*---------------------------------------------------*/
void open_w()
{
wid=wind_create(NAME|MOVER|CLOSER|
(_GemParBlk.global[0]>0x400?SMALLER:0),0,0,cw,ch);
if (wid<0) {open_f=0;return;}
if (wind_open(wid,cx,cy,cw,ch)) open_f=1;
wind_set(wid,WF_NAME,(long) windowname);
wind_set(wid,24,1);
}
예제 #5
0
/* ***Fenster anmelden + Dialog zeichnen*** */
int wdial_init(OBJECT *tree, char *title)
{
 short wx, wy, ww, wh;
 int dwhndl;

 form_center(tree, &wx, &wy, &ww, &wh);           /* Gr��e holen */
 wind_calc(WC_BORDER, NAME|MOVER, wx, wy, ww, wh, &wx, &wy, &ww, &wh);
 dwhndl=wind_create(NAME|MOVER, wx, wy, ww, wh);  /* Fenster anmelden */
 if(dwhndl<0)  return(NULL);
 wind_set(dwhndl, WF_NAME, title);                /* Name setzen */
 wind_open(dwhndl, wx, wy, ww, wh);               /* Fenster �ffnen */
 objc_draw(tree, ROOT, MAX_DEPTH, wx, wy, ww, wh);  /* Dialog zeichnen */

 return(dwhndl);
}
예제 #6
0
void xw_open(WINDOW *w, RECT *size)
{
	wind_open(w->xw_handle, size->x, size->y, size->w,
			  size->h);
	w->xw_size = *size;
	wind_get(w->xw_handle, WF_WORKXYWH, &w->xw_work.x,
			 &w->xw_work.y, &w->xw_work.w, &w->xw_work.h);

	xw_set_barpos(w);

	w->xw_opened = TRUE;

	if (w->xw_func->wd_top != 0L)
		w->xw_func->wd_top(w);
}
예제 #7
0
OUTPUT_WINDOW* setup_output_window(short workstation) {
    OUTPUT_WINDOW *window = calloc(1, sizeof(OUTPUT_WINDOW));
    window->obj_tree_length = 2;
    window->obj_tree = calloc(window->obj_tree_length, sizeof(OBJECT));
    window->workstation = workstation;
    window->text = "Llama llama llama\nllama duck\nllama llama llama llama llama llama\nHOLLLLLLAAAAAAAAAAAAAAAAAAAAAAAAAA";

    short x_loc;
    short y_loc;
    short height;
    short width;

    wind_get(0, WF_CURRXYWH, &x_loc, &y_loc, &width, &height);
    window->handle = wind_create(NAME, x_loc, y_loc, width, height);
    wind_open(window->handle, x_loc + 10, y_loc + 10, width / 2, height / 2);

    OBJECT *box = &window->obj_tree[0];
    box->ob_next = -1;
    box->ob_head = -1;
    box->ob_tail = -1;
    box->ob_type = G_BOX;
    wind_get(window->handle, WF_WORKXYWH, &box->ob_x, &box->ob_y, &box->ob_width, &box->ob_height);

    //Add our own multiline handling block
    OBJECT *text = &window->obj_tree[1];
    text->ob_next = -1;
    text->ob_head = -1;
    text->ob_tail = -1;

    USERBLK *user_block = malloc(sizeof(USERBLK));
    user_block->ub_code = &draw_multiline;
    user_block->ub_parm = (int)window;

    objc_add(window->obj_tree, 0, 1);
    text->ob_type = G_USERDEF;
    text->ob_width = box->ob_width - 1; //adjust for border
    text->ob_height = box->ob_height - 1;
    text->ob_spec.userblk = user_block;

    wind_set_str(window->handle, WF_NAME, "Twitter");
    return window;
}
예제 #8
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);
	}
}
예제 #9
0
main()
{
  gem_init();
  
  whandle = wind_create (4095, 20, 20, 280, 150);
            /* 4095 = tous les organes de commande */
  
  if (whandle < 0)
    form_alert (1, "[3][D‚sol‚!|Il ne reste plus de handle fenˆtre libre!][OK]"
);
  else
  {
    wind_open (whandle, 20, 20, 280, 150);
    
    /* Calcul de la zone de travail */
    
    wind_calc (1, 4095, 20, 20, 280, 150, &x, &y, &w, &h);
    
    /* Conversion de hauteur/largeur du deuxiŠme angle (x2/y2) */
    
    pxyarray[0] = x;          pxyarray[1] = y;
    pxyarray[2] = x+w-1;      pxyarray[3] = y+h-1;

    /* Effacer la zone de travail */
    
    vsf_interior (handle, 0);   /* Remplir avec couleur du fond */
    vsf_perimeter (handle, 0);  /* Pas de cadre */
    
    v_bar (handle, pxyarray);
    
    vsf_perimeter (handle, 1);  /* R‚activer le cadre */
    
    Crawcin();   /* Attendre appui touche */
    
    wind_close (whandle);
    wind_delete (whandle);
  }
  
  gem_exit();
}
예제 #10
0
SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
                              int width, int height, int bpp, Uint32 flags)
{
    int maxwidth, maxheight;
    Uint32 modeflags, screensize;
    SDL_bool use_shadow;

    GEM_FreeBuffers(this);

    /*--- Verify if asked mode can be used ---*/
    if (flags & SDL_FULLSCREEN) {
        maxwidth=VDI_w;
        maxheight=VDI_h;
    } else {
        /* Windowed mode */
        maxwidth=GEM_desk_w;
        maxheight=GEM_desk_h;
    }

    if ((maxwidth < width) || (maxheight < height) || (VDI_bpp != bpp)) {
        SDL_SetError("Couldn't find requested mode in list");
        return(NULL);
    }

    /*--- Allocate the new pixel format for the screen ---*/
    if ( ! SDL_ReallocFormat(current, VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, VDI_alphamask) ) {
        SDL_SetError("Couldn't allocate new pixel format for requested mode");
        return(NULL);
    }

    /*--- Allocate shadow buffer if needed ---*/
    use_shadow=SDL_FALSE;
    if (flags & SDL_FULLSCREEN) {
        if (!VDI_screen) {
            /* No access to real framebuffer, use shadow surface */
            use_shadow=SDL_TRUE;
        } else {
            if (VDI_format==VDI_FORMAT_INTER) {
                /* Real framebuffer, interleaved bitplanes,
                  use shadow surface */
                use_shadow=SDL_TRUE;
            } else if (flags & SDL_DOUBLEBUF) {
                /* Real framebuffer, double-buffered,
                  use shadow surface */
                use_shadow=SDL_TRUE;
                modeflags |= SDL_DOUBLEBUF;
            }
        }
    } else {
        /* Windowed mode, always with shadow surface */
        use_shadow=SDL_TRUE;
    }

    if (use_shadow) {
        screensize = width * height * VDI_pixelsize;

        GEM_buffer = Atari_SysMalloc(screensize, MX_PREFTTRAM);
        if (GEM_buffer==NULL) {
            fprintf(stderr,"Unable to allocate shadow buffer\n");
            return NULL;
        }
        memset(GEM_buffer, 0, screensize);
    }

    /*--- Initialize screen ---*/
    modeflags = 0;
    if (VDI_bpp == 8) {
        modeflags |= SDL_HWPALETTE;
    }

    if (flags & SDL_FULLSCREEN) {
        GEM_LockScreen(this);

        GEM_ClearScreen(this);

        modeflags |= SDL_FULLSCREEN;
        if (VDI_screen && (VDI_format==VDI_FORMAT_PACK) && !use_shadow) {
            modeflags |= SDL_HWSURFACE;
        } else {
            modeflags |= SDL_SWSURFACE;
        }
    } else {
        int posx,posy;
        short x2,y2,w2,h2;

        GEM_UnlockScreen(this);

        /* Center our window */
        posx = GEM_desk_x;
        posy = GEM_desk_y;
        if (width<GEM_desk_w)
            posx += (GEM_desk_w - width) >> 1;
        if (height<GEM_desk_h)
            posy += (GEM_desk_h - height) >> 1;

        /* Calculate our window size and position */
        if (!(flags & SDL_NOFRAME)) {
            GEM_win_type=NAME|MOVER|CLOSER|SMALLER;
            if (flags & SDL_RESIZABLE) {
                GEM_win_type |= FULLER|SIZER;
                modeflags |= SDL_RESIZABLE;
            }
        } else {
            GEM_win_type=0;
            modeflags |= SDL_NOFRAME;
        }

        if (!wind_calc(0, GEM_win_type, posx, posy, width, height, &x2, &y2, &w2, &h2)) {
            GEM_FreeBuffers(this);
            fprintf(stderr,"Can not calculate window attributes\n");
            return NULL;
        }

        /* Create window */
        GEM_handle=wind_create(GEM_win_type, x2, y2, w2, h2);
        if (GEM_handle<0) {
            GEM_FreeBuffers(this);
            fprintf(stderr,"Can not create window\n");
            return NULL;
        }

        /* Setup window name */
        wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);

        /* Open the window */
        wind_open(GEM_handle,x2,y2,w2,h2);

        modeflags |= SDL_SWSURFACE;
    }

    /* Set up the new mode framebuffer */
    current->flags = modeflags;
    current->w = width;
    current->h = height;
    if (use_shadow) {
        current->pixels = GEM_buffer;
        current->pitch = width * (VDI_bpp >> 3);
    } else {
예제 #11
0
int do_formstuff(int obj_id)
{
	int tfd;

	switch(obj_id)
	{
		case CTRL_STOP:
			if(Dsp_Hf1(-1))	/* If fast forwarding */
			{
				if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED)
					toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL);
				Dsp_Hf1(0);				
			}

			if(replay || replay_pause)
			{
				if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED)
					toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL);
				replay_pause=0;
				exit_replay();
				update_time();
			}
			break;
		case CTRL_PLAY:
			if(replay_pause || Dsp_Hf1(-1))
			{
				if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED)
					toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL);
				Dsp_Hf1(0);				

				if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED)
					toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL);
				continue_replay();
				replay_pause=0;
			}
			else
			{
				if(!replay && file_open)
				{
					replay_pause=0;
					init_replay();
				}
				else
				{
					if((tfd = open_file()) > 0)
					{
						int error;
						
						fd=tfd;
						if((error=getmp2info(fd))==MP2_NOERR)
						{
							replay_pause=0;
							update_time();
							setfilename(filename);
							init_replay();
						}
						else
						{
							show_mp2_error(error);
							close_file(fd);
							strcpy(windforms[WIND_CTRL].wind_title,"MPEG");
							wind_set(windforms[WIND_CTRL].whandle,WF_NAME,
								windforms[WIND_CTRL].wind_title);
							setfilename("MPEGFILE");
						}
	
					}
				}
			}
			break;
		case CTRL_PAUSE:

			if(replay_pause)
			{
				continue_replay();
				replay_pause=0;
			}
			else
			{
				if(replay)
				{
					pause_replay();
					replay_pause=1;
				}
			}

			break;
		case CTRL_LOAD:
			if((tfd = open_file()) > 0)
			{
				int error;
			
				if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED)
					toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL);
				replay_pause=0;

				if(Dsp_Hf1(-1))	/* If fast forwarding */
				{
					if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED)
						toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL);
					Dsp_Hf1(0);				
				}

				fd=tfd;
				if((error=getmp2info(tfd))==MP2_NOERR)
				{
					update_time();
					setfilename(filename);
				}
				else
				{
					show_mp2_error(error);
					close_file(fd);
					strcpy(windforms[WIND_CTRL].wind_title,"MPEG");
					wind_set(windforms[WIND_CTRL].whandle,WF_NAME,
						windforms[WIND_CTRL].wind_title);
					setfilename("MPEGFILE");
				}
			}
			break;
		case CTRL_LOOP:
			looping=(windforms[WIND_CTRL].formtree[CTRL_LOOP].ob_state & SELECTED);
			break;
		case CTRL_INFO:
			/* Open info window */
			if(windforms[WIND_INFO].wind_open)
				wind_set(windforms[WIND_INFO].whandle,WF_TOP);
			else
			{
				fg_init(&windforms[WIND_INFO]);
				wind_open(windforms[WIND_INFO].whandle,
					windforms[WIND_INFO].wind.x,windforms[WIND_INFO].wind.y,
					windforms[WIND_INFO].wind.w,windforms[WIND_INFO].wind.h);
				windforms[WIND_INFO].wind_open=1;
			}
			break;
		case CTRL_NEXT:
			if(file_open)
			{
				int o_replay,o_pause;
			
				if(Dsp_Hf1(-1))	/* If fast forwarding */
				{
					if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED)
						toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL);
					Dsp_Hf1(0);				
				}

				o_replay = replay;
				o_pause = replay_pause;
				exit_replay();
				while((tfd=next_song(path, filename, 1))!=0)
				{
					if(getmp2info(tfd)!=MP2_NOERR)
					{
						close_file(tfd);
					} 
					else
					{
						if(file_open)
							close_file(fd);
						fd = tfd;
						file_open=1;
						update_time();
						setfilename(filename);
						replay = o_replay;
						replay_pause = o_pause;
						if(replay)
							init_replay();
						if(replay_pause)
						{
							init_replay();
							pause_replay();
						}
						break;
					}
				}
				if(!tfd)
				{
					update_time();
				}
			}
			break;
		case CTRL_PREV:
			if(file_open)
			{
				int o_replay,o_pause;
				
				if(Dsp_Hf1(-1))	/* If fast forwarding */
				{
					if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED)
						toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL);
					Dsp_Hf1(0);				
				}

				o_replay = replay;
				o_pause = replay_pause;

				/* if more than or one second of the song
					has elapsed, go to the beginning of
					of the same song! */
				if(calc_time() > 0)
				{
					reset_file(fd);
					update_time();
					replay = o_replay;
					replay_pause = o_pause;
					if(replay)
						init_replay();
					if(replay_pause)
					{
						init_replay();
						pause_replay();
					}
				}
				else
				{
					exit_replay();
					while((tfd=next_song(path, filename, 0))!=0)
					{
						if(getmp2info(tfd)!=MP2_NOERR)
						{
							close_file(tfd);
						}
						else
						{
							if(file_open)
								close_file(fd);
							fd = tfd;
							file_open=1;
							update_time();
							setfilename(filename);
							replay = o_replay;
							replay_pause = o_pause;
							if(replay)
								init_replay();
							if(replay_pause)
							{
								init_replay();
								pause_replay();
							}
							break;
						}
					}
					if(!tfd)
					{
						update_time();
					}
				}
			}
			break;
		case CTRL_FF:
			if (windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED)
				Dsp_Hf1(1);
			else
				Dsp_Hf1(0);
			break;
		case CTRL_TIME:
			if(windforms[WIND_CTRL].formtree[CTRL_TIME].ob_state & SELECTED)
				count_dir = 0; /* count up */
			else
				count_dir = 1; /* count down */
			if(file_open)
				update_time();
			break;
		default:
			break;
	}
	return 0;
}
예제 #12
0
/* Form window open */
void fg_event_loop()
{
	int x,y,kstate,key,clicks,event,state;
	int pipe[8],obj_id;
	int fgexit=0,tmph,th;
	
	wind_open(windforms[WIND_CTRL].whandle,
		windforms[WIND_CTRL].wind.x,windforms[WIND_CTRL].wind.y,
		windforms[WIND_CTRL].wind.w,windforms[WIND_CTRL].wind.h);
	windforms[WIND_CTRL].wind_open=1;

#ifdef DEBUG
	form_alert(1,"[1][ACC fg][Ok]");
#endif
	do {
		event = evnt_multi( MU_MESAG | MU_TIMER | MU_BUTTON | MU_KEYBD,
							1, 0x3, 0x1,
							0, 0, 0, 0, 0,
							0, 0, 0, 0, 0,
							pipe,
							time_slice, 0,
							&x, &y, &state, &kstate, &key, &clicks );

		if (event & MU_TIMER)
			if (replay)
			{
				if(first_init)
					checkhang();
				load(1);
				update_time();
			}

		if(event & MU_KEYBD)
		{
			obj_id=key2button(key);
			if(obj_id < 0)
			{
				switch(-obj_id)
				{
					case CLOSE_WIND:
						wind_get(0, WF_TOP, &pipe[3]);
						pipe[0]=WM_CLOSED;
						fgexit=handle_message(pipe);
						break;
					case SWITCH_WIND:
						wind_get(0, WF_TOP, &tmph);
						/* find handle of next open window */
						th=tmph;
						while(((th=find_windform(th)+1)%N_WINDS)!=tmph)
						{
							if(windforms[th].wind_open)
							{
								wind_set(windforms[th].whandle,WF_TOP);
								break;
							}
						}
					default:
						break;
				}
			}
			else
				do_formstuff(obj_id);
		}

		if(!fgexit)
		{
			if (event & MU_MESAG)
				fgexit=handle_message(pipe);
	
			if (event & MU_BUTTON)
			{
				if(replay || replay_pause)
				{
					windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_flags |= KEEPSELECT;
					windforms[WIND_CTRL].formtree[CTRL_FF].ob_flags |= KEEPSELECT;
				}
				else
				{
					windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_flags &= ~KEEPSELECT;
					windforms[WIND_CTRL].formtree[CTRL_FF].ob_flags &= ~KEEPSELECT;
				}
				if(wind_find(x,y) == windforms[WIND_CTRL].whandle)
					if(ev2_loop(&windforms[WIND_CTRL],x,y))
						event=0;
			}
		}
		
		if(_app)
			quit=fgexit;
		else
			if(fgexit)
				fgbg=BG;

	} while ((replay || fgbg==FG) && !fgexit);
}
예제 #13
0
void slideshow()
{
	VEIL				*tv;
	LEDP				*led;
	int				i,j,k,l;
	typedef int		t_rgb[3];
	t_rgb				*col;
	int				pal;
	long				len;
	int				wha,wx,wy,ww,wh;

	wind_update(BEG_MCTRL);
	graf_mouse(M_OFF,NULL);
	time(&t2);
	shift=(int)Kbshift(-1);

	if (glb.opt.deskfull)
	{
		wx=glb.aes.desk.x;		wy=glb.aes.desk.y;
		ww=glb.aes.desk.w;		wh=glb.aes.desk.h;
	}
	else
	{
		wx=0;							wy=0;
		ww=1+glb.vdi.wscr;		wh=1+glb.vdi.hscr;
	}
	wha=wind_create(0,0,0,1+glb.vdi.wscr,1+glb.vdi.hscr);
	if (wha<=0)
	{
		form_alert(1,glb.rsc.head.frstr[NOWIN]);
		graf_mouse(M_ON,NULL);
		graf_mouse(ARROW,NULL);
		wind_update(END_MCTRL);
		return;
	}

	_menuBar(glb.aes.tree.menu,FALSE);

	wind_open(wha,wx,wy,ww,wh);
	wind_get(wha,WF_CURRXYWH,&wx,&wy,&ww,&wh);

	if (glb.opt.is_tv && glb.opt.sl_tv)
	{
		tv=(VEIL *)_cookie('VeiL');
		j=(int)tv->stop;
		tv->stop=0xFF;
	}
	if (glb.opt.is_led && glb.opt.sl_led)
	{
		led=(LEDP *)_cookie('LEDP');
		k=led->active;
		led->active&=~1;
	}

	len=(long)glb.vdi.out[13]*(long)sizeof(t_rgb);
	pal=_mAlloc(len,FALSE);
	glb.opt.mask=0;
	if (pal!=NO_MEMORY)
	{
		col=(t_rgb *)glb.mem.adr[pal];
		for (i=0;i<glb.vdi.out[13];i++)
			vq_color(glb.vdi.ha,i,1,(int *)col[i]);
	}

	glb.div.slide=TRUE;

	l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh);
	if (!l && glb.opt.sl_loop && num>0)
		do
		{
			l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh);
		}	while (!l);

	glb.div.slide=FALSE;
	updFreeMem();

	if (pal!=NO_MEMORY)
	{
		col=(t_rgb *)glb.mem.adr[pal];
		for (i=0;i<glb.vdi.out[13];i++)
			vs_color(glb.vdi.ha,i,(int *)col[i]);
		_mFree(pal);
	}

	if (glb.opt.is_tv && glb.opt.sl_tv)
	{
		tv=(VEIL *)_cookie('VeiL');
		tv->stop=j;
	}
	if (glb.opt.is_led && glb.opt.sl_led)
	{
		led=(LEDP *)_cookie('LEDP');
		led->active=k;
	}

	wind_close(wha);
	wind_delete(wha);

	_menuBar(glb.aes.tree.menu,TRUE);

	graf_mouse(M_ON,NULL);
	graf_mouse(ARROW,NULL);
	wind_update(END_MCTRL);
}
예제 #14
0
short main(int argc, char *argv[])
{
	MFDB dest;
	short my_AppId, x, y, w, h;
	short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2};
	short work_out[57], msg[16], w_id1;
	short open_windows = 1, dummy;
	short wx, wy, ww, wh, clip[4], pnt[4];
	char win1_name[20];
	unsigned short logo_trnfrm[LOGO_DATASIZE];
	GRECT dirty, walk;
	short e = 0, evx, evy, a, kc_shstate, kc_key, click_count;

	my_AppId = appl_init();
	my_handle = graf_handle(&x, &y, &w, &h);		/* Open a virtual workstation */
	v_opnvwk(work_in, &my_handle, work_out);

	logo_bm.fd_w = LOGO_W;
	logo_bm.fd_h = LOGO_H;
	logo_bm.fd_wdwidth = 12;
	logo_bm.fd_nplanes = 4;
	logo_bm.fd_stand = 1;
	dest = logo_bm;
	dest.fd_stand = 0;

	logo_bm.fd_addr = (void *)x_logo;
	dest.fd_addr = (void *)logo_trnfrm;
	vr_trnfm(my_handle, &logo_bm, &dest);
	logo_bm.fd_addr = (void *)logo_trnfrm;

	w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40);

	if (argc > 1)
		sprintf(win1_name,"%s", argv[1]);
	else
		sprintf(win1_name,"Welcome to...", argv[1]);
		
	wind_set(w_id1, WF_NAME, ADDR(win1_name));

	x = (work_out[0] - (LOGO_W + 40)) / 2;
	y = (work_out[1] - (LOGO_H + 40)) / 2;
	wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40);

	while((open_windows) && (!(e & MU_TIMER))) {
		e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count);

		if (e & MU_MESAG) {
			dummy = msg[0];
			switch(dummy) {
			case WM_CLOSED:	/* Did someone close one of our windows? */
				wind_close(msg[3]);
				open_windows--;
				break;
			case WM_MOVED:
				wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
				break;
			case WM_REDRAW:
				dirty.g_x = msg[4];
				dirty.g_y = msg[5];
				dirty.g_w = msg[6];
				dirty.g_h = msg[7];
				wind_update(BEG_UPDATE);
				wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh);
				walk.g_x = wx;
				walk.g_y = wy;
				walk.g_w = ww;
				walk.g_h = wh;
				pnt[0] = wx;
				pnt[1] = wy;
				pnt[2] = wx + ww;
				pnt[3] = wy + wh;
				wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h);
				rc_intersect(&walk, &dirty);
				graf_mouse(M_OFF, NULL);
				while(h) {
					walk.g_x = x;
					walk.g_y = y;
					walk.g_w = w;
					walk.g_h = h;
					if (rc_intersect(&dirty, &walk)) {
						clip[0] = walk.g_x;
						clip[1] = walk.g_y;
						clip[2] = walk.g_x + walk.g_w;
						clip[3] = walk.g_y + walk.g_h;
						vs_clip(my_handle, 1, clip);
						vsf_color(my_handle, LWHITE);
						v_bar(my_handle, pnt);
						display_bitmap(wx, wy);
					}
					wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h);
				}
				vs_clip(my_handle, 0, clip);
				graf_mouse(M_ON, NULL);
				wind_update(END_UPDATE);
				break;
			case WM_TOPPED:
				wind_set(msg[3], WF_TOP, 0, 0, 0, 0);
				break;
			case WM_BOTTOMED:
				wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0);
				break;
			}
		}
	}
	
	v_clsvwk(my_handle);
	
	appl_exit();
	
	return 0;
}
예제 #15
0
/* ***PopUp darstellen*** */
short wdial_popup(OBJECT *ptree, short *pitem, short popupx, short popupy, void (*msghndlr)(int msgbf[]), unsigned long msec, void (*tmrhndlr)())
{
 int mpopupret, pwhndl;
 int dx, dy, dw, dh;
 int newitem=-1, olditem=-1;
 int msgbuf[8]; int which;
 int mx, my, mb, br;

 wind_get(0, WF_WORKXYWH, &dx, &dy, &dw, &dh); /* Desktopgr��e */

 if(popupx+ptree->ob_width > dx+dw)
  popupx=dx+dw-ptree->ob_width;
 if(popupx<dx)  popupx=dx;
 ptree->ob_x=popupx;
 if(*pitem > 0)  popupy-=ptree[*pitem].ob_y;
 if(popupy+ptree->ob_height > dy+dh)
   popupy=dy+dh-ptree->ob_height;
 if(popupy<dy)  popupy=dy;
 ptree->ob_y=popupy;

 wind_calc(WC_BORDER, 0, ptree->ob_x, ptree->ob_y,
           ptree->ob_width, ptree->ob_height, &dx, &dy, &dw, &dh);
 pwhndl=wind_create(0, dx, dy, dw, dh);  /* Fenster anmelden */
 if(pwhndl<0)  return(FALSE);
 wind_open(pwhndl, dx, dy, dw, dh);               /* Fenster �ffnen */
 /*objc_draw(ptree, 0, 1, dx, dy, dw, dh); ->Durch WM_REDRAW zeichnen lassen*/

 do graf_mkstate(&mx, &my, &mb, &dx); while(mb);  /* Maustasten vorher loslassen */

 do
  {
   which=evnt_multi(MU_MESAG|MU_BUTTON|MU_TIMER, 1,1,1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    msgbuf, (short)msec,(short)(msec>>16), &mx, &my, &mb,
                    &dx, &dx, &br);

   if(which&MU_MESAG)
    {
     if(msgbuf[3]==pwhndl && msgbuf[0]>=WM_REDRAW && msgbuf[0]<=WM_NEWTOP)
      {
       switch(msgbuf[0])
        {
         case WM_REDRAW:
           wdial_redraw(pwhndl, ptree, (GRECT *)(&msgbuf[4]));
           break;
         case WM_TOPPED:
           wind_set(pwhndl, WF_TOP, 0L, 0L);
           break;
        }
      }
     else if( msghndlr )  msghndlr(msgbuf);
    }

   if(which&MU_TIMER)
    {
     newitem=objc_find(ptree, 0, 1, mx, my);
     if(newitem>0 && newitem!=olditem)
      {
       if( (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) )
        {
         GRECT prct;
         ptree[olditem].ob_state&=~SELECTED;
         ptree[newitem].ob_state|=SELECTED;
         prct.g_x=ptree->ob_x+ptree[olditem].ob_x;
         prct.g_y=ptree->ob_y+ptree[olditem].ob_y;
         prct.g_w=ptree[olditem].ob_width; prct.g_h=ptree[olditem].ob_height;
         wdial_redraw(pwhndl, ptree, &prct);
         prct.g_x=ptree->ob_x+ptree[newitem].ob_x;
         prct.g_y=ptree->ob_y+ptree[newitem].ob_y;
         prct.g_w=ptree[newitem].ob_width; prct.g_h=ptree[newitem].ob_height;
         wdial_redraw(pwhndl, ptree, &prct);
         olditem=newitem;
        }
        else
         newitem=olditem;
      }
      else
       newitem=olditem;
     if( tmrhndlr )  tmrhndlr();
    }

  }
 while(mb!=1);  /* Bis Maustaste gedr�ckt */

 newitem=objc_find(ptree, 0, 1, mx, my);
 if(newitem>0 && (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) )
  { *pitem=newitem; mpopupret=TRUE; }
  else { mpopupret=FALSE; }
 if(olditem>0) ptree[olditem].ob_state&=~SELECTED;

 wind_close(pwhndl);  wind_delete(pwhndl);        /* Fenster schliessen */

 return(mpopupret);
}