コード例 #1
0
ファイル: OSATARI.C プロジェクト: JohnW71/garglk
/*
 * Cleanup -- restore palette and sane VT52 state.
 */
vt_cleanup()
{
    /*
     * Restore desktop resolution (if we switched).
     */
    if (drez != Getrez())
        Setscreen(-1L, -1L, drez);

    if (drez != 2) {
        /*
         * Restore desktop palette.
         */
        Setpalette(dpalette);

        Cconws("\033b");
        Cconout(3 + VTC);
        Cconws("\033c");
        Cconout(0 + VTC);
    }

    /*
     * Bring the mouse back
     */
    graf_mouse(M_ON, NULL);

    /*
     * Make the cursor visible
     */
    curs_show();
}
コード例 #2
0
ファイル: acsi.c プロジェクト: atarijookie/ce-atari
void showCmdLog(void)
{
    int i, j, len;
    (void) Cconws("\n\r\n\rCMD log:\n\r");
    
    for(i=0; i<5; i++) {
        if((cmdLog[i * 12] & 0x1f) == 0x1f) {
            len = 11;
        } else {
            len = 6;
        }
    
        for(j=0; j<len; j++) {
            showHexByte(cmdLog[i * 12 + j]);        // show cmd
            Cconout(' ');
        }
        
        for(j=0; j<(11 - len); j++) {               // pad with spaces
            (void) Cconws("   ");
        }
        
        (void) Cconws(" - ");
        showHexByte(cmdLog[i * 12 + 11]);           // show res
        (void) Cconws("\n\r");
    }
}
コード例 #3
0
ファイル: FORMDO.C プロジェクト: daemqn/Atari_ST_Sources
/* ---------------------
	 | Form-do in window |
	 --------------------- */
int win_formdo(OBJECT *tree, int start_fld, int wind_id)
{
    int edit_obj;
    int next_obj;
    int which, cont;
    int idx;
    int mx, my, mb, ks, kr, br, msg[8];
    int x, y, w, h;

    if (start_fld != -1)
        next_obj = fm_inifld(tree, start_fld);
    else
        next_obj = 0;

    edit_obj = 0;
    cont = TRUE;
    while(cont)
    {
        if (next_obj && edit_obj != next_obj)
        {
            edit_obj = next_obj;
            next_obj = 0;

            objc_edit(tree, edit_obj, 0, &idx, ED_INIT);
        }

        if (start_fld == -1)
            which = evnt_multi(MU_MESAG|MU_TIMER|MU_KEYBD,
                               0, 0, 0,
                               0, 0, 0, 0, 0,
                               0, 0, 0, 0, 0,
                               msg,
                               100, 0,
                               &mx, &my, &mb, &ks, &kr, &br);
        else
            which = evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG,
                               0x02, 0x01, 0x01,
                               0, 0, 0, 0, 0,
                               0, 0, 0, 0, 0,
                               msg,
                               0, 0,
                               &mx, &my, &mb, &ks, &kr, &br);

        if (which & MU_KEYBD)
        {
            wind_update(BEG_UPDATE);

            cont = form_keybd(tree, edit_obj, next_obj, kr, &next_obj, &kr);
            if (kr)
                objc_edit(tree, edit_obj, kr, &idx, ED_CHAR);

            wind_update(END_UPDATE);
        }

        if (which & MU_BUTTON)
        {
            wind_update(BEG_UPDATE);

            next_obj = objc_find(tree, ROOT, MAX_DEPTH, mx, my);
            if (next_obj == NIL)
            {
                Cconout(0x7);
                next_obj = 0;
            }
            else
                cont = form_button(tree, next_obj, br, &next_obj);

            wind_update(END_UPDATE);
        }

        if (which & MU_MESAG)
        {
            switch(msg[0])
            {
            case WM_REDRAW:
                red_x = msg[4];
                red_y = msg[5];
                red_w = msg[6];
                red_h = msg[7];

                if (msg[3] == wind_id)
                {
                    if (edit_obj)
                        objc_edit(tree, edit_obj, 0, &idx, ED_END);

                    dialog_window(wind_id, tree, RDW_DIA, ROOT);

                    if (edit_obj)
                        objc_edit(tree, edit_obj, 0, &idx, ED_INIT);
                }
                else
                {
                    sample_redraw(msg[3]);
                    seqs_redraw(msg[3]);
                }
                break;

            case WM_MOVED:
                if (msg[3] == wind_id)
                {
                    wind_set(wind_id, WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
                    wind_get(wind_id, WF_WORKXYWH, &x, &y, &w, &h);
                    tree[ROOT].ob_x = x;
                    tree[ROOT].ob_y = y;
                }
                break;
            }
        }

        if (!cont || (next_obj && next_obj != edit_obj))
            objc_edit(tree, edit_obj, 0, &idx, ED_END);

        if (start_fld == -1 && which == MU_TIMER)
            break;

        if (start_fld == -1 && which == MU_KEYBD)
            break;
    }

    if (start_fld == -1)
        return ((kr & 0xFF) == 0x1B);
    else
        return(next_obj);
}
コード例 #4
0
ファイル: SEARCH.C プロジェクト: daemqn/Atari_ST_Sources
/****************************************************************
*																*
*					cherche une chaŒne 							*
*																*
****************************************************************/
void search_secteur(windowptr thewin, boolean diff_majmin, boolean start_to_end)
{
	char *buffer, *buffer_frontiere;
	OBJECT *search = Dialog[WAIT].tree;
	int taille, start;
	long secteur = thewin -> fonction.secteur.secteur, max = thewin -> fonction.secteur.max;
	int width, i;
	char *secteur_text;
	char pattern[SEARCH_PATTERN_SIZE];
	long offset;
	int size_buff_sect;
	int dummy;

#ifndef TEST_VERSION
	if (thewin -> fonction.secteur.dirty && write_secteur(thewin, MENU_DEPLACEMENT))
			return;
#endif

	thewin -> fonction.secteur.dirty = FALSE;

	/* attend la fin des redessins */
	Event_Timer(0, 0, TRUE);

	search[WAIT_MESSAGE].ob_spec.free_string = Messages(SEARCH_2);
	search[WAIT_INFO].ob_spec.tedinfo -> te_ptext = Messages(REORG_14);

	width = search[SLIDE_PERE].ob_width -3;
	search[SLIDE_FILS].ob_width = (int)((long)width * secteur / max) +3;

	secteur_text = search[INDICATEUR_WAIT].ob_spec.tedinfo -> te_ptext;
	sprintf(secteur_text, "%ld", secteur);
	sprintf(search[MAX_WAIT].ob_spec.free_string, "/%ld", max);

	my_open_dialog(&Dialog[WAIT], AUTO_DIAL|NO_ICONIFY|MODAL, FAIL);

	/* attend la fin des redessins */
	Event_Timer(0, 0, TRUE);

	/* allocation des buffers, on d‚passe un peu … cause de l'approximation de la taille dans and_buffer() */
	buffer = malloc(20L+ 512L * (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP : SIZEBUFHARD));
	if (buffer == NULL)
	{
		error_msg(Z_NOT_ENOUGH_MEMORY);
		return;
	}

	if ((buffer_frontiere = malloc(20L+ SEARCH_PATTERN_SIZE*2L + 16L)) == NULL)
	{
		free(buffer);
		error_msg(Z_NOT_ENOUGH_MEMORY);
		return;
	}
	/* mise … z‚ro */
	memset(buffer_frontiere, 0, 20L+ SEARCH_PATTERN_SIZE*2L + 16L);

	/* pr‚pare le pattern */
	if (diff_majmin)
		for (i=0; i<SearchLength; i++)
			pattern[i] = SearchString[i];
	else
		for (i=0; i<SearchLength; i++)
			pattern[i] = SearchString[i] & ~('a'-'A');

	/* octet de d‚part */
	start = thewin -> fonction.secteur.curseur_x < 0 ? thewin -> fonction.secteur.page *512 : thewin -> fonction.secteur.page *512 + thewin -> fonction.secteur.curseur_y*32 + thewin -> fonction.secteur.curseur_x/2 +1;

	/* recherche d'abord dans le secteur en m‚moire */
	memcpy(buffer, thewin -> fonction.secteur.secteurBin, thewin -> fonction.secteur.sector_size*512L);
	if ((offset = search_pattern(buffer + start, thewin -> fonction.secteur.sector_size*512L - start, pattern, diff_majmin, start_to_end)) >= 0)
	{
		my_close_dialog(&Dialog[WAIT]);
		free(buffer_frontiere);
		free(buffer);
		search_found(thewin, secteur, offset + start);
		return;
	}

	/* remplis de n'importe quoi sauf du motif recherch‚ */
	memset(buffer_frontiere, SearchString[0] ^ 0xAA, (long)SEARCH_PATTERN_SIZE);

	/* nombre max de secteurs … lire */
	size_buff_sect = (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP : SIZEBUFHARD) / thewin -> fonction.secteur.sector_size;

	/* taille du bloc … lire */
	if (max - secteur > (long)size_buff_sect)
		taille = size_buff_sect;
	else
		taille = (int)(max - secteur);

	while (taille > 0)
	{
		/* charge le buffer */
		if ((taille = load_buffer(thewin, buffer, secteur, taille, start_to_end)) < 0)
		{	/* erreur */
			my_close_dialog(&Dialog[WAIT]);
			free(buffer);
			return;
		}

		/* recherche sur la frontiŠre */
		memcpy(buffer_frontiere + SEARCH_PATTERN_SIZE, buffer, (long)SEARCH_PATTERN_SIZE);
		if ((offset = search_pattern(buffer_frontiere, SEARCH_PATTERN_SIZE, pattern, diff_majmin, start_to_end)) >= 0)
		{
			my_close_dialog(&Dialog[WAIT]);
			free(buffer_frontiere);
			free(buffer);
			search_found(thewin, secteur-taille, offset + (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP*512L - SEARCH_PATTERN_SIZE : SIZEBUFHARD*512L - SEARCH_PATTERN_SIZE));
			return;
		}

		/* recherche en cours */
		if ((offset = search_pattern(buffer+start, taille * thewin -> fonction.secteur.sector_size * 512L - start, pattern, diff_majmin, start_to_end)) >= 0)
		{
			my_close_dialog(&Dialog[WAIT]);
			free(buffer_frontiere);
			free(buffer);
			search_found(thewin, secteur, offset+start);
			return;
		}

		/* on n'a un d‚calage que la premiŠre fois */
		start = 0;

		/* copie la fin du bloc pour la frontiŠre */
		memcpy(buffer_frontiere, buffer + (thewin -> fonction.secteur.device < 2 ? SIZEBUFFLOP*512L - SEARCH_PATTERN_SIZE : SIZEBUFHARD*512L - SEARCH_PATTERN_SIZE), (long)SEARCH_PATTERN_SIZE);

		/* on avance */
		secteur += taille;

		/* taille du bloc … lire */
		if (max - secteur > (long)size_buff_sect)
			taille = size_buff_sect;
		else
			taille = (int)(max - secteur);

		/* test les boutons */
		if (evnt_multi(MU_TIMER | MU_BUTTON,
		 256+1, 3, 0,	/* button */
		 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* mouse */
		 NULL,	/* message */
		 1, 0,	/* timer */
		 &dummy, &dummy, &dummy, &dummy, &dummy, &dummy) == MU_BUTTON
		 && my_alert(1, 2, X_ICN_QUESTION, Messages(SEARCH_3), Messages(BOOT_32)) == 0)
		{	/* on n'a pas trouv‚ mais on s'arrˆte */
			my_close_dialog(&Dialog[WAIT]);
			free(buffer_frontiere);
			free(buffer);
			search_found(thewin, secteur, -1L);
			return;
		}

		/* met … jour la barre */
		search[SLIDE_FILS].ob_width = (int)((long)width * secteur / max) +3;
		ob_draw(Dialog[WAIT].info, SLIDE_FILS);

		/* met … jour le compteur */
		sprintf(secteur_text, "%ld", secteur);
		ob_draw(Dialog[WAIT].info, INDICATEUR_WAIT);

		/* attend la fin des redessins */
		Event_Timer(0, 0, TRUE);
	}

	free(buffer_frontiere);
	free(buffer);

	my_close_dialog(&Dialog[WAIT]);

	/* un petit bruit */
	if (Sound)
		Cconout(7);
} /* search_secteur */