Example #1
0
void move_stone( void )
{
	int move;
	
	move=(int)Kbshift(-1);
	if (move&0x0001)		/* Shift rechts: Rechts */
	{
		stonex+=1;
		if (collide_stone())
			stonex-=1;
	}
	else if (move & 0x0002)	/* Shift links: Links */
	{
		stonex-=1;
		if (collide_stone())
			stonex+=1;
	}
	if (move & 0x0008)		/* Alternate: Mutiere (Rotiere) */
	{
		int old_mutation;
		
		old_mutation=mutation;
		mutation=(mutation+1)&0x3;
		if (collide_stone())
			mutation=old_mutation;
	}
}
Example #2
0
void AtariIkbd_InitOSKeymap(_THIS)
{
	int i;

	SDL_memset(SDL_AtariIkbd_keyboard, KEY_UNDEFINED, ATARIBIOS_MAXKEYS);

	/* Initialize keymap */
	for ( i=0; i<sizeof(keymap); i++ )
		keymap[i] = SDLK_UNKNOWN;

	/* Functions keys */
	for ( i = 0; i<10; i++ )
		keymap[SCANCODE_F1 + i] = SDLK_F1+i;

	/* Cursor keypad */
	keymap[SCANCODE_HELP] = SDLK_HELP;
	keymap[SCANCODE_UNDO] = SDLK_UNDO;
	keymap[SCANCODE_INSERT] = SDLK_INSERT;
	keymap[SCANCODE_CLRHOME] = SDLK_HOME;
	keymap[SCANCODE_UP] = SDLK_UP;
	keymap[SCANCODE_DOWN] = SDLK_DOWN;
	keymap[SCANCODE_RIGHT] = SDLK_RIGHT;
	keymap[SCANCODE_LEFT] = SDLK_LEFT;

	/* Special keys */
	keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE;
	keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE;
	keymap[SCANCODE_TAB] = SDLK_TAB;
	keymap[SCANCODE_ENTER] = SDLK_RETURN;
	keymap[SCANCODE_DELETE] = SDLK_DELETE;
	keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL;
	keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
	keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
	keymap[SCANCODE_LEFTALT] = SDLK_LALT;
	keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;

	/* Read XBIOS tables for scancode -> ascii translation */
	curtables=Keytbl(KT_NOCHANGE, KT_NOCHANGE, KT_NOCHANGE);
	tab_unshift=curtables->unshift;
	tab_shift=curtables->shift;
	tab_caps=curtables->caps;

	/* Set Caps lock initial state */
	caps_state=(Kbshift(-1) & (1<<K_CAPSLOCK));

	/* Now install our handler */
	SDL_AtariIkbd_mouseb = SDL_AtariIkbd_mousex = SDL_AtariIkbd_mousey = 0;
	atari_prevmouseb = 0;

	Supexec(SDL_AtariIkbdInstall);
}
Example #3
0
void AtariGemdos_PumpEvents(_THIS)
{
	int i;
	SDL_keysym keysym;

	/* Update pressed keys */
	SDL_memset(gemdos_currentkeyboard, 0, ATARIBIOS_MAXKEYS);

	while (Cconis()!=DEV_BUSY) {
		unsigned long key_pressed;
		unsigned char scancode, asciicode;

		key_pressed=Cnecin();

		asciicode = key_pressed;
		scancode = key_pressed >> 16;

		gemdos_currentkeyboard[scancode]=0xFF;
		gemdos_currentascii[scancode]=asciicode;
	}

	/* Read special keys */
	UpdateSpecialKeys(Kbshift(-1));

	/* Now generate events */
	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
		/* Key pressed ? */
		if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i])
			SDL_PrivateKeyboard(SDL_PRESSED,
				TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_TRUE));
			
		/* Key unpressed ? */
		if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
			SDL_PrivateKeyboard(SDL_RELEASED,
				TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_FALSE));
	}

	if (use_dev_mouse) {
		SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
	} else {
		SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
	}

	/* Will be previous table */
	SDL_memcpy(gemdos_previouskeyboard, gemdos_currentkeyboard, ATARIBIOS_MAXKEYS);
}
Example #4
0
void AtariBios_PumpEvents(_THIS)
{
	int i;
	SDL_keysym keysym;

	SDL_AtariMint_BackgroundTasks();

	/* Update pressed keys */
	SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);

	while (Bconstat(_CON)) {
		unsigned long key_pressed;
		key_pressed=Bconin(_CON);
		bios_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
	}

	/* Read special keys */
	UpdateSpecialKeys(Kbshift(-1));

	/* Now generate events */
	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
		/* Key pressed ? */
		if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
			SDL_PrivateKeyboard(SDL_PRESSED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
			
		/* Key unpressed ? */
		if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
			SDL_PrivateKeyboard(SDL_RELEASED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
	}

	if (use_dev_mouse) {
		SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
	} else {
		SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
	}

	/* Will be previous table */
	SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, sizeof(bios_previouskeyboard));
}
Example #5
0
/*
 *  Count up to a maximum of NUM_ACCS desk accessories, saving
 *  their names in acc_name[].
 */
static WORD count_accs(void)
{
    WORD i, rc;

    /* if Control is held down, skip loading of accessories */
    if ((Kbshift(-1) & MODE_CTRL))
        return 0;

    strcpy(D.g_work,"*.ACC");
    dos_sdta(&D.g_dta);

    for (i = 0; i < NUM_ACCS; i++)
    {
        rc = (i==0) ? dos_sfirst(D.g_work,F_RDONLY) : dos_snext();
        if (rc < 0)
            break;
        strlcpy(acc_name[i],D.g_dta.d_fname,LEN_ZFNAME);
    }

    return i;
}
void AtariBios_PumpEvents(_THIS)
{
    int i;
    SDL_keysym keysym;


    SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);

    while (Bconstat(_CON)) {
        unsigned long key_pressed;
        key_pressed=Bconin(_CON);
        bios_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
    }


    UpdateSpecialKeys(Kbshift(-1));


    for (i=0; i<ATARIBIOS_MAXKEYS; i++) {

        if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
            SDL_PrivateKeyboard(SDL_PRESSED,
                                SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));


        if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
            SDL_PrivateKeyboard(SDL_RELEASED,
                                SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
    }

    if (use_dev_mouse) {
        SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
    } else {
        SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
    }


    SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, sizeof(bios_previouskeyboard));
}
Example #7
0
/********************************************************************
*																	*
*						 Gestion du menu							*
*																	*
********************************************************************/
boolean MenuSelect(int object, int scan, int state, int button)
{
	int index, entree, key;

	if (object < 0)
	{
		/* attend qu'on relache la souris */
		NoClick();

		if (button < 0)
		{
			/* regarde la touche */
			key = scantoascii(scan);
			if (key == 0)
				key = scan & 0xFF00;	/* scan code */
			else
				key = UpperChar(key);

			for (index = 0; index < NbMenus; index++)
				for (entree = 0; entree < MenuShortCuts[index].nb_entrees; entree++)
					if (MenuShortCuts[index].menu[entree].key == key && MenuShortCuts[index].menu[entree].state == state)
					{
						if (ob_isstate(Menu, MenuShortCuts[index].menuid, DISABLED) == 0 && ob_isstate(Menu, MenuShortCuts[index].menu[entree].itemid, DISABLED) == 0)
						{
							object = MenuShortCuts[index].menu[entree].itemid;
							index = NbMenus;
						}
						break;
					}
		}
	}

	if (object < 0)
		return FALSE;	/* kein entsprechender Eintrag gefunden */

	/* Men�punkte 'Fenster wechseln' und 'Fenster schliežen' werden
	   inklusive der dazugeh”rigen Hotkeys automatisch verwaltet */

	switch (object)
	{
						/* menu Zorg */

		case INFORMATIONS:
			presentation();
			break;

						/* menu Etat */

		case INFORMATION:
			informations(Drive);
			break;

		case REPERTOIRE_LOUPE:
			if (ManageVFAT)
				open_directory_vfat();
			else
				open_directory_short();
			break;

		case TEST_STRUCTURE:
			if (ManageVFAT)
				structure_test_vfat(Drive);
			else
				structure_test_short(Drive);
			break;

		case STATISTIQUES:
			statistiques(Drive);
			break;

		case OCCUPATION:
			occupation(Drive);
			break;

		case TRACE_UN_FICHIER:
			trace_file();
			break;

		case QUITTER:
			if (Reset)
			{
				if (my_alert(1, 2, X_ICN_QUESTION, Messages(MENU_1), Messages(BOOT_32)) == 0)
					shutdown(TRUE);
			}
			else
			{
				button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_2), Messages(MENU_4));
				if (button == 0 || button == 1 && (int)xbios(0x11) % 2)
					shutdown(FALSE);
			}
			break;

					/* menu Ouvre */

		case UNITE_LOGIQUE:
			open_disk();
			break;

		case OUVRE_DISQUETTE:
			raw_floppy(FALSE);
			break;

		case OUVRE_DISQUE_DUR:
			raw_hard(FALSE);
			break;

		case OUVRE_FICHIER:
			open_file();
			break;

		case OUVRE_FICHIER_FS:
			open_file_other_fs();
			break;

		case OUVRE_FICH_TEXTE:
			voir_fichier();
			break;

		case CREER_FICHIER:
			creer_fichier();
			break;

		case FERMER:
			fermer(Thefrontwin -> win -> handle);
			break;

		case LIRE_BOOT:
			lire_boot();
			break;

		case CHARGER_BOOT:
			charger_boot();
			break;

		case SAUVER_BOOT:
			sauver_boot();
			break;

		case ECRIRE_BOOT:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			ecrire_boot();
#endif
			break;

					/* menu Edition */

		case SAUVER_SECTEUR:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			save_secteur(Thefrontwin, MENU_EDITION);
#endif
			break;

		case COPIER_SECTEUR:
			copier_tampon(Thefrontwin);
			break;

		case COLLER_SECTEUR:
			coller_tampon(Thefrontwin);
			break;

		case ECHANGER_TAMPON:
			echanger_tampon(Thefrontwin);
			break;

		case RETOUR_INITIAL:
			load_secteur(Thefrontwin, MENU_EDITION);
			break;

		case OUVRIR_TAMPON:
			ouvrir_tampon();
			break;

		case SAUVER_TAMPON:
			sauver_tampon();
			break;

		case CHARGER_TB_ASCII:
			ascii_tampon();
			break;

		case EFFACER_TAMPON:
			effacer_tampon();
			break;

					/* menu Structure */

		case DEFRAGMENTATION:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			reconnect(Drive);
#endif
			break;

		case UNIQUE_LIBRE:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			compresse(Drive);
#endif
			break;

		case RESTO_COMPLETE:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

		/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			restauration_complete(Drive);
#endif
			break;

		case VIDE_CLST_LIBRES:
			nettoie_clusters_libres(Drive);
			break;

		case NETTOIE_REPERTOI:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			nettoie_repertoire(Drive);
#endif
			break;

					/* menu Deplacement */

		case SECTEUR_SUIVANT:
			next_secteur(Thefrontwin);
			break;

		case SECTEUR_PRECEDEN:
			previous_secteur(Thefrontwin);
			break;

		case BLOC_SUIVANT:
			next_bloc(Thefrontwin);
			break;

		case BLOC_PRECEDENT:
			previous_bloc(Thefrontwin);
			break;

		case MARQUER_POSITION:
			marquer_position(Thefrontwin);
			break;

		case ALLER_MARQUE:
			goto_marque(Thefrontwin);
			break;

		case ALLER_SECTEUR:
			goto_secteur(Thefrontwin);
			break;

		case CHERCHER_CHAINE:
			search_first(Thefrontwin);
			break;

		case CHERCHER_NOUVEAU:
			search_next(Thefrontwin);
			break;

					/* menu Fenˆtres */

		case CHOIX_FONTE:
			choix_fonte(Thefrontwin);
			break;

		case CHOIX_COULEURS:
			couleur(Thefrontwin);
			break;

		case TAILLE_IDEALE:
			taille_ideale(Thefrontwin);
			break;

		case ASCENSEURS:
			ascenseurs(Thefrontwin);
			break;

		case CYCLER_FENETRES:
			cycle_window();
			break;

		case WINDOW_LIST_1:
		case WINDOW_LIST_2:
		case WINDOW_LIST_3:
		case WINDOW_LIST_4:
		case WINDOW_LIST_5:
		case WINDOW_LIST_6:
		case WINDOW_LIST_7:
		case WINDOW_LIST_8:
		case WINDOW_LIST_9:
		case WINDOW_LIST_10:
			{
				windowptr thewin;

				for (thewin = Firstwindow; thewin; thewin = thewin -> next)
					if (thewin -> menu_entry == object - WINDOW_LIST_1)
						make_frontwin(thewin);
			}
			break;

						/* menu Options */

		case CONFIG_GENERALE:
			config_generale();
			break;

		case CONFIG_DSK:
			config_disques();
			break;

		case RACCOURCIS_CLAVI:
			raccourcis_clavier();
			break;

		case DONNEES_ZORG:
			from_zorg_inf(TRUE);
			break;

		case DONNEES_SYSTEME:
			from_zorg_inf(FALSE);
			break;

		case INVALIDE_CACHE:
			if (Kbshift(FAIL) & 4)
			{
				int i;

				for (i=0; i<MAX_DEVICES; i++)
					change_disque(i, FALSE);
			}
			else
				change_disque(Drive, TRUE);
			break;

		case UPDATE_SYSTEME:
			if (Kbshift(FAIL) & 4)
			{
				int i;

				for (i=0; i<MAX_DEVICES; i++)
					update_systeme(i);
			}
			else
				update_systeme(Drive);
			break;

		case VISU_TEXTE:
			really_voir_fichier(Thefrontwin -> fonction.fichier.nom);
			break;

		case VISU_ASCII:
			secteur_ascii(Thefrontwin);
			break;

		case VISU_HEXA:
			secteur_hexa(Thefrontwin);
			break;

		case AFFICHE_DECIMAL:
			affichage_decimal(Thefrontwin);
			break;

		case FICHIER_ASSOCIE:
			secteur_file(Thefrontwin);
			break;

		case CURSEUR_VISIBLE:
			curseur_on(Thefrontwin);
			break;

		case CLIPBOARD_GEM:
			clipboard_gem(Thefrontwin);
			break;

						/* menu Aide */

		case TABLE_ASCII:
			AsciiChar = m_ascii_box(AsciiChar, FALSE);
			break;

		case AIDE:
			aide();
			break;

		case EXECUTER_PROG:
			lance_prg();
			break;

		case RESET:
			if (Reset)
			{
				Reset = FALSE;
				menu_icheck(Menu, RESET, 0);
			}
			else
			{
				int button;

				button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_3), Messages(MENU_5));
				if (button == 1)
					shutdown(TRUE);
				else
					if (button == 0)
						reset();
			}
			break;
	}

	return TRUE;
} /* MenuSelect */
Example #8
0
BYTE loopForDownload(void)
{
    DWORD lastStatusCheckTime = 0;

    search.len = 0;                                                 // clear search string
    memset(search.text, 0, MAX_SEARCHTEXT_LEN + 1);
    search.pageCurrent  = 0;
    search.pagesCount   = 0;
    search.row          = 0;
    search.prevRow      = 0;

    destDir.isSet = 0;

    BYTE res = searchInit();                                        // try to initialize

    if(res == 0) {                                                  // failed to initialize? return to floppy config screen
        return KEY_F8;
    }

    getStatus();
    lastStatusCheckTime = getTicksAsUser();                         // fill status.doWeHaveStorage before 1st showMenuDownload()

    imageSearch();
    showMenuDownload(SHOWMENU_ALL);

    BYTE showMenuMask;
    BYTE gotoPrevPage, gotoNextPage;

    while(1) {
        BYTE key, kbshift;
        DWORD now = getTicksAsUser();

        gotoPrevPage = 0;
        gotoNextPage = 0;
        showMenuMask = 0;

        if(now >= (lastStatusCheckTime + 200)) {                    // if last check was at least a second ago, do new check
            BYTE refreshDataAndRedraw = FALSE;

            lastStatusCheckTime = now;
            getStatus();                                            // talk to CE to see the status

            if(status.downloadCount == 0 && status.prevDownloadCount > 0) {     // if we just finished downloading (not downloading now, but were downloading a while ago)
                refreshDataAndRedraw = TRUE;                            // do a refresh
            }

            if(status.doWeHaveStorage != status.prevDoWeHaveStorage) {  // if user attached / detached drive, redraw all
                refreshDataAndRedraw = TRUE;                            // do a refresh
            }

            if(refreshDataAndRedraw) {                              // should do a refresh?
                getResultsPage(search.pageCurrent);                 // refresh current page data
                showMenuDownload(SHOWMENU_ALL);                     // draw all on screen
            }
        }

        key = getKeyIfPossible();                                   // get key if one is waiting or just return 0 if no key is waiting

        if(key == 0) {                                              // no key? just go back to start
            continue;
        }

        kbshift = Kbshift(-1);

        if(key == KEY_F10 || key == KEY_F8) {                       // should quit or switch mode? 
            return key;
        }

        if(key == KEY_F1 || key == KEY_F2 || key == KEY_F3) {       // insert image into slot 1, 2, 3?
            insertCurrentIntoSlot(key);
            showMenuDownload(SHOWMENU_RESULTS_ROW);
            continue;
        }

        if(key == KEY_F4) {                                         // start downloading images?
            downloadCurrentToStorage();                             // start download
            continue;
        }

        if(key == KEY_F5) {                                         // refresh the list of images
            getResultsPage(search.pageCurrent);                     // refresh current page data
            showMenuDownload(SHOWMENU_ALL);                         // draw all on screen
            continue;
        }

        if(key >= 'A' && key <= 'Z') {								// upper case letter? to lower case!
            key += 32;
        }

        if((key >= 'a' && key <='z') || key == ' ' || (key >= 0 && key <= 9) || key == KEY_ESC || key == KEY_BACKSP) {
            res = handleWriteSearch(key);
            
            if(res) {                                               // if the search string changed, search for images
                imageSearch();

                showMenuMask = SHOWMENU_SEARCHSTRING | SHOWMENU_RESULTS_ALL;
            }
        }

        if((kbshift & (K_RSHIFT | K_LSHIFT)) != 0) {                // shift pressed? 
            if(key == KEY_PAGEUP) {                                 // shift + arrow up = page up
                gotoPrevPage = 1;
            }

            if(key == KEY_PAGEDOWN) {                               // shift + arrow down = page down
                gotoNextPage = 1;
            }
        } else {                                                    // shift not pressed?
            if(key == KEY_UP) {                                     // arrow up?
                if(search.row > 0) {                                // not the top most line? move one line up
                    setSelectedRow(search.row - 1);
                    showMenuMask = SHOWMENU_RESULTS_ROW;            // just change the row highlighting
                } else {                                            // this is the top most line
                    gotoPrevPage = 1;
                }
            }

            if(key == KEY_DOWN) {                                   // arrow up?
                if(search.row < 14) {                               // not the bottom line? move one line down
                    setSelectedRow(search.row + 1);
                    showMenuMask = SHOWMENU_RESULTS_ROW;            // just change the row highlighting
                } else {                                            // this is the top most line
                    gotoNextPage = 1;
                }
            }
        }

        if(gotoPrevPage) {
            if(search.pageCurrent > 0) {                            // not the first page? move to previous page
                search.pageCurrent--;                               // 
                     
                getResultsPage(search.pageCurrent);                 // get previous results
                showMenuMask = SHOWMENU_RESULTS_ALL;                // redraw all results
                setSelectedRow(14);                                 // move to last row
            }
        }

        if(gotoNextPage) {
            if(search.pageCurrent < (search.pagesCount - 1)) {      // not the last page? move to next page
                search.pageCurrent++;                               // 
                     
                getResultsPage(search.pageCurrent);                 // get next results
                showMenuMask = SHOWMENU_RESULTS_ALL;                // redraw all results
                setSelectedRow(0);                                  // move to first row
            }
        }

        showMenuDownload(showMenuMask);
    }
}
Example #9
0
void check_ende( void )
{
	if (4==Kbshift(-1))
		ende=1;
}
Example #10
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() */
Example #11
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);
}
Example #12
0
/*******************************************************************************
	CHARGEMENT ET AFFICHAGE
*******************************************************************************/
static void affiche(char *nom,int wx,int wy,int ww,int wh)
{
/*	int		col[3];*/
	double	xratio,yratio;
	MFDB		src,dst;
	IMG		sld;
	long		count,flen;
	int		pxy[8],xy[8];
	int		xcar,ycar,wcar,hcar,xaff,yaff;
	int		idst,pdst;
	int		pmem,imem;
	int		r,ret;
	int		mask;
	int		i,n;
	int		*ps;
	char		*q;
	char		txt[FILENAME_MAX];

	ret=RIM_NEXT;
	n=0;
	while (ret==RIM_NEXT)
	{
		if (Kbshift(-1)!=shift)
			return;
		ret=_rimLoad(FALSE,nom,&flen,(MFDB *)&sld.mfdb,(char *)sld.type,&imem,&pmem,n);
		if (Kbshift(-1)!=shift)
			return;

		if (ret!=RIM_OK && ret!=RIM_NEXT)
		{
			if (imem!=NO_MEMORY)
				_mFree(imem);
			if (pmem!=NO_MEMORY)
				_mFree(pmem);
			return;
		}
		n+=1;

		idst=NO_MEMORY;
		pdst=NO_MEMORY;

		src.fd_w			=	sld.mfdb.w;
		src.fd_wdwidth	=	sld.mfdb.wdw;
		src.fd_h			=	sld.mfdb.h;
		src.fd_stand	=	sld.mfdb.stand;
		src.fd_nplanes	=	sld.mfdb.nplanes;

		if (sld.mfdb.w>ww || sld.mfdb.h>wh)			/*	Si l'image est plus	*/
		{														/*	grande que l'‚cran en W ou H	*/
			if (glb.opt.sl_zdec)							/*	Zoom diminution ?					*/
			{
				xratio=(double)ww/(double)sld.mfdb.w;
				yratio=(double)wh/(double)sld.mfdb.h;

				if (xratio>=yratio)			/*	Pleine hauteur	*/
				{
					sld.mfdb.w=(int)( (double)sld.mfdb.w * (double)wh / (double)sld.mfdb.h );
					sld.mfdb.h=wh;
					sld.mfdb.wdw=_word(sld.mfdb.w);
				}
				else								/*	Pleine largeur	*/
				{
					sld.mfdb.h=(int)( (double)sld.mfdb.h * (double)ww / (double)sld.mfdb.w );
					sld.mfdb.w=ww;
					sld.mfdb.wdw=_word(sld.mfdb.w);
				}
			}
		}
		else									/*	Alors l'image est plus petite que l'‚cran	*/
		{
			if (glb.opt.sl_zinc)							/*	Zoom Agrandissement ?			*/
			{
				xratio=(double)ww/(double)sld.mfdb.w;
				yratio=(double)wh/(double)sld.mfdb.h;

				if (xratio>=yratio)			/*	Pleine hauteur	*/
				{
					sld.mfdb.w=(int)( (double)sld.mfdb.w * (double)wh / (double)sld.mfdb.h );
					sld.mfdb.h=wh;
					sld.mfdb.wdw=_word(sld.mfdb.w);
				}
				else								/*	Pleine largeur	*/
				{
					sld.mfdb.h=(int)( (double)sld.mfdb.h * (double)ww / (double)sld.mfdb.w );
					sld.mfdb.w=ww;
					sld.mfdb.wdw=_word(sld.mfdb.w);
				}
			}
		}

		dst.fd_w			=	sld.mfdb.w;
		dst.fd_wdwidth	=	sld.mfdb.wdw;
		dst.fd_h			=	sld.mfdb.h;
		dst.fd_stand	=	0;
		dst.fd_nplanes	=	glb.vdi.extnd[4];

		if (Kbshift(-1)!=shift)
			return;
		mask=TRM_IMPORT|TRM_SUGG_PAL|TRM_AUTO;
		r=_trmConvert(FALSE,imem,&idst,pmem,&pdst,&src,&dst,mask,glb.parx.d_trm,0);
		if (Kbshift(-1)!=shift)
			return;

		if (r!=TRM_OK)
		{
			if (imem!=NO_MEMORY)
				_mFree(imem);
			if (pmem!=NO_MEMORY)
				_mFree(pmem);
			if (idst!=NO_MEMORY)
				_mFree(idst);
			if (pdst!=NO_MEMORY)
				_mFree(pdst);
			return;
		}

		if (imem!=idst)
		{
			_mFree(imem);
			imem=idst;
		}
		if (pmem!=pdst)
		{
			_mFree(pmem);
			pmem=pdst;
		}

		if (Kbshift(-1)!=shift)
			return;
		if (!r)
		{
			if (imem!=NO_MEMORY)
				_mFree(imem);
			if (pmem!=NO_MEMORY)
				_mFree(pmem);
			graf_mouse(ARROW,0);
			return;
		}

		r=-1;

		sld.mfdb.seek		=	0L;
		sld.mfdb.w			=	dst.fd_w;
		sld.mfdb.h			=	dst.fd_h;
		sld.mfdb.wdw		=	dst.fd_wdwidth;
		sld.mfdb.stand		=	dst.fd_stand;
		sld.mfdb.nplanes	=	dst.fd_nplanes;
		sld.flag				=	1;
		sld.x					=	0;
		sld.y					=	0;
		sld.w					=	sld.mfdb.w;
		sld.h					=	sld.mfdb.h;

		if (sld.w>ww || sld.h>wh)					/*	Si l'image est plus	*/
		{													/*	grande que l'‚cran en W ou H	*/
			if (sld.w>ww)								/*	Largeur plus grande				*/
			{
				xcar=(sld.w-ww)/2;
				xaff=wx;
				wcar=ww;
			}
			else
			{
				xaff=wx+(ww-sld.w)/2;
				xcar=0;
				wcar=sld.w;
			}
			if (sld.h>wh)								/*	Hauteur plus grande				*/
			{
				ycar=(sld.h-wh)/2;
				yaff=wy;
				hcar=wh;
			}
			else
			{
				yaff=wy+(wh-sld.h)/2;
				ycar=0;
				hcar=sld.h;
			}
		}
		else									/*	Alors l'image est plus petite que l'‚cran	*/
		{
			if (sld.w>ww)					/*	Largeur plus grande				*/
			{
				xcar=(sld.w-ww)/2;
				xaff=wx;
				wcar=ww;
			}
			else
			{
				xaff=wx+(ww-sld.w)/2;
				xcar=0;
				wcar=sld.w;
			}

			if (sld.h>wh)								/*	Hauteur plus grande				*/
			{
				ycar=(sld.h-wh)/2;
				yaff=wy;
				hcar=wh;
			}
			else
			{
				yaff=wy+(wh-sld.h)/2;
				ycar=0;
				hcar=sld.h;
			}
		}

		sld.mfdb.seek	=	(long)glb.mem.adr[imem];
		sld.mfdb.wdw	=	_word(sld.mfdb.w);
		dst.fd_addr		=	0;
		dst.fd_w			=	0;
		dst.fd_h			=	0;
		dst.fd_wdwidth	=	0;
		dst.fd_stand	=	0;
		dst.fd_nplanes	=	0;

		pxy[0]	=	xcar;				pxy[4]	=	xaff;
		pxy[1]	=	ycar;				pxy[5]	=	yaff;
		pxy[2]	=	xcar+wcar-1;	pxy[6]	=	xaff+wcar-1;
		pxy[3]	=	ycar+hcar-1;	pxy[7]	=	yaff+hcar-1;

		time(&t1);
		if (Kbshift(-1)!=shift)
			return;
		if(glb.opt.sl_pause)
		{
			count=1000L*max( 0 , (long)glb.opt.sl_ptime - difftime(t1,t2) );
			evnt_timer( (int)(count&0xFFFFUL) , (int)(count>>16) );
		}
		else
Example #13
0
/*******************************************************************************
	BALAYAGE D'UN DOSSIER
*******************************************************************************/
static int Balaie_Path(char *directory,int wx,int wy,int ww,int wh)
{
	char		old_path[FILENAME_MAX];
	int		old_drv;
	char		pfn[FILENAME_MAX];
	DTA		*mydta;
	int		i,Fin=0;
	int		cnt,pos;
/*	long		count;*/

	t2=0;
	old_drv=Dgetdrv();
	Dgetpath(old_path,1+old_drv);
	mydta=Fgetdta();
	if (directory[1]==':')
		Dsetdrv((int)directory[1]-65);

	strcpy(pfn,directory);
	strcat(pfn,"\\*.*");
	if (glb.opt.sl_rec)
		i=Fsfirst(pfn,FA_READONLY|FA_SUBDIR|FA_ARCHIVE);
	else
		i=Fsfirst(pfn,FA_READONLY|FA_ARCHIVE);
	pos=0;
loop1:
	cnt=0;
	while (!i)
	{
		cnt+=1;
		if (mydta->d_fname[0]!='.' && cnt>pos)
		{
			strcpy(pfn,directory);
			strcat(pfn,"\\");
			strcat(pfn,mydta->d_fname);
			if (mydta->d_attrib&FA_SUBDIR)
			{
				pos=cnt;
				if (Balaie_Path(pfn,wx,wy,ww,wh))
					return TRUE;
				strcpy(pfn,directory);
				strcat(pfn,"\\*.*");
				if (glb.opt.sl_rec)
					i=Fsfirst(pfn,FA_READONLY|FA_SUBDIR|FA_ARCHIVE);
				else
					i=Fsfirst(pfn,FA_READONLY|FA_ARCHIVE);
				goto loop1;
			}
		}
		if (Kbshift(-1)!=shift)
			return TRUE;
		i=Fsnext();
/*
		if (i!=0)
			{
				time(&t1);
				if(glb.opt.sl_pause)
				{
					count=1000L*max( 0 , (long)glb.opt.sl_ptime - (t1-t2) );
					evnt_timer( (int)(count&0xFFFFUL),(int)(count>>16) );
				}
				else
					count=0;
			}
*/
	}


	strcpy(pfn,directory);
	strcat(pfn,"\\");
	strcat(pfn,glb.opt.sl_name);

	if (glb.opt.sl_rec)
		i=Fsfirst(pfn,FA_READONLY|FA_SUBDIR|FA_ARCHIVE);
	else
		i=Fsfirst(pfn,FA_READONLY|FA_ARCHIVE);
	pos=0;
	cnt=0;
	while (!i)
	{
		cnt+=1;
		if (mydta->d_fname[0]!='.' && cnt>pos)
		{
			strcpy(pfn,directory);
			strcat(pfn,"\\");
			strcat(pfn,mydta->d_fname);
			if (!(mydta->d_attrib&FA_SUBDIR))
				affiche(pfn,wx,wy,ww,wh);
		}
		if (Kbshift(-1)!=shift)
			return TRUE;
		i=Fsnext();
/*
		if (i!=0)
			{
				time(&t1);
				if(glb.opt.sl_pause)
					count=1000L*max( 0 , (long)glb.opt.sl_ptime - (t1-t2) );
				else
					count=0;
				evnt_timer( (int)(count&0xFFFFUL),(int)(count>>16) );
			}
*/
	}


	Dsetdrv(old_drv);
	Dsetpath(old_path);
	return Fin;
}