Пример #1
0
/****************************************************************
*																*
*				sauve le tampon dans un fichier					*
*																*
****************************************************************/
void sauver_tampon(void)
{
	int handle;
	char nom[FILENAME_MAX] = "", text[FILENAME_MAX];

	if(!selecteur(nom, "*.BUF", Messages(TAMPON_6)))
		return;

	sprintf(text, Messages(TAMPON_7), nom);
	ajoute(Firstwindow, text);

	if ((handle = (int)Fcreate(nom, 0)) >= 0)
	{
		int err;

		if ((err = (int)Fwrite(handle, 512L, Tampon -> fonction.tampon.secteurBin)) < 0)
			error_msg(err);
		else
			ajoute(Firstwindow, Messages(TAMPON_8));

		Fclose(handle);
	}
	else
		ajoute(Firstwindow, Messages(TAMPON_9));
} /* sauver_tampon */
Пример #2
0
/****************************************************************
*																*
*			cr‚e un fichier vide d'une taille donn‚e			*
*																*
****************************************************************/
void creer_fichier(void)
{
	OBJECT *file_size;
	char nom[FILENAME_MAX] = "EMPTY.NEW", text[FILENAME_MAX];
	int ex, size, handle;

	if(!selecteur(nom, NULL, Messages(TAMPON_1)))
		return;

	sprintf(text, Messages(TAMPON_2), nom);
	ajoute(Firstwindow, text);

	rsrc_gaddr(R_TREE, TAILLE_FICHIER, &file_size);
	strcpy(file_size[CREATE_FILE_SIZE].ob_spec.tedinfo -> te_ptext, "1");

	ex = xdialog(Dialog[TAILLE_FICHIER].tree, NULL, NULL, NULL, TRUE, TRUE, DialogInWindow ? AUTO_DIAL|MODAL|NO_ICONIFY : FLY_DIAL|MODAL|NO_ICONIFY|SMART_FRAME);

	if (ex == CREATE_FILE_ANNU)
	{
		ajoute(Firstwindow, Messages(TAMPON_3));
		return;
	}

	size = atoi(file_size[CREATE_FILE_SIZE].ob_spec.tedinfo -> te_ptext);

	if ((handle = (int)Fcreate(nom, 0)) >! 0)
	{
		int i, err;
		char buffer[512];

		for (i=0; i<512; i++)	/* efface le buffer */
			buffer[i] = '\0';

		for (i=0; i<size; i++)	/* copie 'size' fois le buffer */
			if ((err = (int)Fwrite(handle, 512L, buffer)) < 0)
			{
				error_msg(err);
				break;
			}

		Fclose(handle);

		sprintf(text, Messages(TAMPON_4), nom, size*512L);
		ajoute(Firstwindow, text);

		if (nom[1] == ':')
			change_disque(toupper(nom[0]) -'A', TRUE);
	}
	else
	{
		error_msg(handle);
		sprintf(text, Messages(TAMPON_5), nom);
		ajoute(Firstwindow, text);
	}
} /* creer_fichier */
Пример #3
0
/****************************************************************
*																*
*				met un secteur dans le tampon					*
*																*
****************************************************************/
void copier_tampon(windowptr thewin)
{
	int i;
	char scrap_path[FILENAME_MAX];

	switch (thewin -> type)
	{
		case SECTEUR:
		case FICHIER:
		case FICHIER_FS:
		case RAW_FLOPPY:
		case RAW_HARD:
			for (i=0; i<512; i++)
				Tampon -> fonction.tampon.secteurBin[i] = (thewin -> fonction.secteur.page*512L + thewin -> fonction.secteur.secteurBin)[i];

			/* update la fenˆtre Tampon */
			if (Menu[OUVRIR_TAMPON].ob_state & DISABLED) /* la fenˆtre est d‚j… ouverte */
			{
				convert_sect(Tampon -> fonction.secteur.secteurBin, Tampon -> fonction.text.Ligne, Tampon -> fonction.secteur.ascii);

				Efface = FALSE;
				redraw_window(Tampon -> win, &Tampon -> win -> work);
			}
			ajoute(Firstwindow, Messages(TAMPON_10));

		case TEXT:
		case TAMPON:
			if (ClipBoard && scrp_read(scrap_path))
				copier_clipboard(thewin, scrap_path);
			break;
	}
} /* copier_tampon */
Пример #4
0
/****************************************************************
*																*
*					met le tampon dans un secteur				*
*																*
****************************************************************/
void coller_tampon(windowptr thewin)
{
	int i;
	char scrap_path[FILENAME_MAX];

	/* charge le tampon avec le ClipBoard */
	if (ClipBoard && scrp_read(scrap_path))
		coller_clipboard(scrap_path);

	switch (thewin -> type)
	{
		case SECTEUR:
		case FICHIER:
		case FICHIER_FS:
		case RAW_FLOPPY:
		case RAW_HARD:
			for (i=0; i<512; i++)
				(thewin -> fonction.secteur.page*512L + thewin -> fonction.secteur.secteurBin)[i] = Tampon -> fonction.tampon.secteurBin[i];

			thewin -> fonction.secteur.dirty = TRUE;
			secteur_window_update(thewin, FALSE);

			ajoute(Firstwindow, Messages(TAMPON_11));
			break;
	}
} /* coller_tampon */
Пример #5
0
/****************************************************************
*																*
*					echange un secteur et le tampon				*
*																*
****************************************************************/
void echanger_tampon(windowptr thewin)
{
	char c;
	int i;

	switch (thewin -> type)
	{
		case SECTEUR:
		case FICHIER:
		case FICHIER_FS:
		case RAW_FLOPPY:
		case RAW_HARD:
			for (i=0; i<512; i++)
			{
				c = (thewin -> fonction.secteur.page*512L + thewin -> fonction.secteur.secteurBin)[i];
				(thewin -> fonction.secteur.page*512L + thewin -> fonction.secteur.secteurBin)[i] = Tampon -> fonction.tampon.secteurBin[i];
				Tampon -> fonction.tampon.secteurBin[i] = c;
			}

			thewin -> fonction.secteur.dirty = TRUE;
			secteur_window_update(thewin, FALSE);

			/* update la fenˆtre Tampon */
			if (Menu[OUVRIR_TAMPON].ob_state & DISABLED)
			{
				convert_sect(Tampon -> fonction.secteur.secteurBin, Tampon -> fonction.text.Ligne, Tampon -> fonction.secteur.ascii);

				Efface = FALSE;
				redraw_window(Tampon -> win, &Tampon -> win -> work);
			}

			ajoute(Firstwindow, Messages(TAMPON_12));
	}
} /* echanger_tampon */
Пример #6
0
//---------------------------------------------------------------------------
void TActionLog::AddFailure(Exception * E)
{
  std::auto_ptr<TStrings> Messages(ExceptionToMoreMessages(E));
  if (Messages.get() != nullptr)
  {
    AddFailure(Messages.get());
  }
}
        int handle()
        {
            CExeFile &ExeFile = gKeenFiles.exeFile;
            int version = ExeFile.getEXEVersion();
            unsigned char *p_exedata = ExeFile.getRawData();

            if( mEp == 1 && version == 134)
            {
                gLogging.ftextOut("This version of the game is not supported!<br>");
                return 0;
            }

            // Patch the EXE-File-Data directly in the memory.
            CPatcher Patcher(ExeFile, gpBehaviorEngine->mPatchFname);
            Patcher.process();

            mLoader.setPermilage(100);

            gTimer.setLPS(DEFAULT_LPS_VORTICON);

            gpBehaviorEngine->readTeleporterTable(p_exedata);

            if( (mFlags & LOADGFX) == LOADGFX )
            {
                // Decode the entire graphics for the game (EGALATCH, EGASPRIT, etc.)
                // This will also read the Tile-Properties
                CEGAGraphicsVort graphics(mEp, mDataPath);
                graphics.loadData(version, p_exedata);
                mLoader.setPermilage(400);
                mLoader.setStyle(PROGRESS_STYLE_BITMAP);
            }

            if( (mFlags & LOADSTR) == LOADSTR )
            {
                // load the strings.
                CMessages Messages(p_exedata, mEp, version);
                Messages.extractGlobalStrings();
                mLoader.setPermilage(500);
            }

            if( (mFlags & LOADSND) == LOADSND )
            {
                // Load the sound data
                setupAudio();
                mLoader.setPermilage(800);
            }

            gpBehaviorEngine->getPhysicsSettings().loadGameConstants(mEp, p_exedata);
            mLoader.setPermilage(900);

            // If there are patches left that must be apllied later, do it here!
            Patcher.postProcess();

            mLoader.setPermilage(1000);

            gEventManager.add(new FinishedLoadingResources());
            return 1;
        }
Пример #8
0
/****************************************************************
*																*
*				Actif ou D‚sactive le ClipBoard GEM				*
*																*
****************************************************************/
void clipboard_gem(windowptr thewin)
{
	char scrap_path[FILENAME_MAX];

	if (!(ClipBoard || scrp_read(scrap_path)))
	{
		error_msg(Z_CLIPBOARD_NOT_INSTALLED);
		return;
	}

	if (test_scrap_path(scrap_path))
		return;

	ClipBoard = 1-ClipBoard;

	if (ClipBoard)
	{
		char text[80];

		ajoute(Firstwindow, Messages(TAMPON_15));

		sprintf(text, Messages(TAMPON_16), scrap_path);
		ajoute(Firstwindow, text);
	}
	else
		ajoute(Firstwindow, Messages(TAMPON_17));

	menu_icheck(Menu, CLIPBOARD_GEM, ClipBoard);
	make_frontwin(thewin);

	if (ClipBoard)
		coller_clipboard(scrap_path);

	/* update la fenˆtre Tampon */
	if (Menu[OUVRIR_TAMPON].ob_state & DISABLED)
	{
		convert_sect(Tampon -> fonction.secteur.secteurBin, Tampon -> fonction.text.Ligne, Tampon -> fonction.secteur.ascii);

		Efface = FALSE;
		redraw_window(Tampon -> win, &Tampon -> win -> work);
	}
} /* clipboard_gem */
Пример #9
0
void TActionLog::AddFailure(Exception *E)
{
  std::unique_ptr<TStrings> Messages(ExceptionToMoreMessages(E));
  if (Messages.get() != nullptr)
  {
    try__finally
    {
      AddFailure(Messages.get());
    }
    __finally
    {
#if 0
      delete Messages;
#endif // #if 0
    };
  }
Пример #10
0
/****************************************************************
*																*
*				recherche la chaŒne suivante					*
*																*
****************************************************************/
void search_next(windowptr thewin)
{
	int diff_majmin;

	{
		char text[160];

		sprintf(text, Messages(SEARCH_5), thewin -> title);
		ajoute(Firstwindow, text);
	}

	diff_majmin = Dialog[SEARCH].tree[DIFF_MAJ_MIN].ob_state & SELECTED;

	switch (thewin -> type)
	{
		case SECTEUR:
			if (SavePos)
				marquer_position(thewin);

			search_secteur(thewin, diff_majmin, TRUE);

			if (thewin -> fonction.secteur.fichier)
				print_secteur_file(thewin);
			break;

		case FICHIER:
		case FICHIER_FS:
		case RAW_FLOPPY:
		case RAW_HARD:
			if (SavePos)
				marquer_position(thewin);

			search_secteur(thewin, diff_majmin, TRUE);
			break;

		case TAMPON:
			search_tampon(thewin, diff_majmin);
	}
} /* search_next */
Пример #11
0
/****************************************************************
*																*
*					recherche une chaŒne						*
*																*
****************************************************************/
void search_first(windowptr thewin)
{
	OBJECT *search = Dialog[SEARCH].tree;
	static int first_time = TRUE;

	{
		char text[160];

		sprintf(text, Messages(SEARCH_5), thewin -> title);
		ajoute(Firstwindow, text);
	}

	if (first_time)
	{
		search[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] = '\0';
		search[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] = '\0';
		first_time = FALSE;
	}

	Dialog[SEARCH].proc = search_proc;
	Dialog[SEARCH].thewin = thewin;
	my_open_dialog(&Dialog[SEARCH], AUTO_DIAL, ob_isstate(search, ASCII_ACTIF, SELECTED) ? SEARCH_ASCII : SEARCH_HEXA);
} /* search_first */
Пример #12
0
/****************************************************************
*																*
*					boŒte de pr‚sentation (gestion)				*
*																*
****************************************************************/
boolean presentation_proc(t_dialog *dialog, int exit)
{
	switch (exit)
	{
		case PRESENTATION_OK:
			return TRUE;

		case PRESENTATION_INF:
			/* Exit-Objekt selektiert? */
			if (ob_isstate(dialog -> info -> di_tree, exit, SELECTED))
			{
				/* angew„hltes Objekt deselektieren und neu zeichnen */
				ob_undostate(dialog -> info -> di_tree, exit, SELECTED);
				ob_draw_chg(dialog -> info, exit, NULL, FAIL);
			}

			my_alert(1, FAIL, X_ICN_INFO, Messages(PRESENTATION_1), NULL);
/*			my_alert(1, FAIL, X_ICN_INFO, Messages(PRESENTATION_2), NULL);
			my_alert(1, FAIL, X_ICN_INFO, Messages(PRESENTATION_3), NULL);
			my_alert(1, FAIL, X_ICN_INFO, Messages(PRESENTATION_4), NULL);*/
	}

	return FALSE;
} /* presentation_proc */
Пример #13
0
/****************************************************************
*																*
*					cree la fenˆtre du tampon					*
*																*
****************************************************************/
void creer_tampon(void)
{
	register int k;
	register windowptr thewin;

	/* Allocate space for window record. */
	if ((Tampon = (windowptr)malloc(sizeof(windowrec))) == NULL)
		return;

	thewin = Tampon;

	/* Initialize window data structure. */
	thewin -> next = NULL;
	thewin -> kind_c = SIZER | MOVER | FULLER | CLOSER | NAME | UPARROW | DNARROW | VSLIDE | LFARROW | RTARROW | HSLIDE;
	thewin -> type = TAMPON;
	thewin -> menu_entry = FAIL;
	thewin -> place = 0;
	strcpy(thewin -> title, Messages(TAMPON_14));

	if ((thewin -> fonction.tampon.secteurBin = sector_alloc(512)) == NULL)
	{
		free(thewin);
		Tampon = NULL;
		return;
	}

	if ((thewin -> fonction.tampon.Text = malloc((size_t)SECTEURSIZE)) == NULL)
	{
		error_msg(Z_NOT_ENOUGH_MEMORY);
		free(thewin -> fonction.tampon.secteurBin);
		free(thewin);
		Tampon = NULL;
		return;
	}

	if ((thewin -> fonction.tampon.Ligne = (char **)malloc((size_t)SECTEURLINE * sizeof(char *))) == NULL)
	{
		error_msg(Z_NOT_ENOUGH_MEMORY);
		free(thewin -> fonction.tampon.secteurBin);
		free(thewin -> fonction.tampon.Text);
		free(thewin);
		Tampon = NULL;
		return;
	}

	/* le bloc contient d‚ja toutes les lignes remplies */
	thewin -> fonction.tampon.TextSize = SECTEURSIZE;
	thewin -> fonction.tampon.LineNumberMax = SECTEURLINE;
	thewin -> fonction.tampon.LineNumber = SECTEURLINE-2;
	thewin -> fonction.tampon.CurrentLine = SECTEURLINE-2;
	thewin -> fonction.tampon.taille_pt = gr_ch == 8 ? 9 : 10;
	thewin -> fonction.tampon.taille_w = gr_cw;
	thewin -> fonction.tampon.taille_h = gr_ch;
	thewin -> fonction.tampon.PrintLine = SECTEURLINE-3;
	thewin -> fonction.tampon.ligne = SECTEURLINE-3;
	thewin -> fonction.tampon.colonne = 0;

	/* chaque ligne … 0 */
	*thewin -> fonction.tampon.Text = '\0';

	for (k=1; k<SECTEURLINE; k++)	/* la premiŠre ligne est deux fois plus grande */
		thewin -> fonction.tampon.Text[(k+1) * SECTEURLINESIZE] = '\0';

	/* un pointeur sur chaque ligne */
	thewin -> fonction.tampon.Ligne[0] = thewin -> fonction.tampon.Text;

	for (k=1; k<SECTEURLINE; k++)
		thewin -> fonction.tampon.Ligne[k] = &thewin -> fonction.tampon.Text[(k+1) * SECTEURLINESIZE];

	thewin -> fonction.tampon.ascii = TRUE;
	thewin -> fonction.tampon.curseur_x = thewin -> fonction.tampon.curseur_y = FAIL;
	thewin -> fonction.tampon.page = 0;

	/* les champs suivant ne sont pas utilis‚ mais sont initialis‚s quand mˆme au cas ou... */
	thewin -> fonction.tampon.dirty = FALSE;
	thewin -> fonction.tampon.slide = NULL;
	thewin -> fonction.tampon.goto_liste = NULL;
	thewin -> fonction.tampon.max = 1;
	thewin -> fonction.tampon.secteur = 0;
	thewin -> fonction.tampon.sector_size = 1;

	/* secteur … 0 */
	memset(thewin -> fonction.tampon.secteurBin, 0, 512L);

	strncpy(thewin -> fonction.tampon.Ligne[0], "  Tampon", SECTEURLINESIZE*2);
	strncpy(thewin -> fonction.tampon.Ligne[1], "      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[2], "      0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[3], "                                                                    ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[4], "0000  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[5], "0020  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[6], "0040  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[7], "0060  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[8], "0080  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[9], "00A0  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[10], "00C0  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[11], "00E0  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[12], "0100  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[13], "0120  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[14], "0140  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[15], "0160  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[16], "0180  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[17], "01A0  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[18], "01C0  ", SECTEURLINESIZE);
	strncpy(thewin -> fonction.tampon.Ligne[19], "01E0  ", SECTEURLINESIZE);
} /* creer_tampon */
Пример #14
0
/****************************************************************
*																*
*					ouvre la fenˆtre du tampon					*
*																*
****************************************************************/
void ouvrir_tampon(void)
{
	windowptr thewin = Tampon;
	WIN *win;
	GRECT rect;
	t_win_coord *window;
	int dummy;

	/* demande la taille de la fenˆtre */
	window = get_info(1, Tampon, &rect);

	thewin -> fonction.secteur.couleur_curseur = window -> fonction.texte.curseur_c;
	thewin -> fonction.secteur.trame_curseur = window -> fonction.texte.curseur_t;
	thewin -> fonction.text.couleur_texte = window -> fonction.texte.texte_c;
	thewin -> fonction.text.taille_pt = window -> fonction.texte.texte_pt;
	thewin -> fonction.text.couleur_fond = window -> fonction.texte.background_c;
	thewin -> fonction.text.trame_fond = window -> fonction.texte.background_t;

	/* Create the information for the window.  Max size is the desktop. */
	win = open_window(thewin -> title, thewin -> title, NULL, NULL, window -> type, TRUE, 10, 10, &desk, &rect, NULL, secteurproc, NULL, 0);

	/* Check for error. */
	if (win == NULL)
	{
		error_msg(Z_NO_MORE_WINDOW);
		return;
	}

	if (!open_work(&win -> vdi_handle, work_out))
	{
		my_alert(1, FAIL, X_ICN_STOP, Messages(MAIN_9), NULL);
		close_window(win, FALSE);
		return;
	}

	thewin -> win = win;

	vst_point(win -> vdi_handle, thewin -> fonction.text.taille_pt, &dummy, &dummy, &thewin -> fonction.text.taille_w, &thewin -> fonction.text.taille_h);
	vst_color(win -> vdi_handle, thewin -> fonction.secteur.couleur_texte);
	vsf_interior(win -> vdi_handle, FIS_SOLID);
	vswr_mode(win -> vdi_handle, MD_REPLACE);
	vsf_perimeter(win -> vdi_handle, 0);

	/* Insert into windowlist. */
	{
		register windowptr winptr = (windowptr)&Firstwindow;

		while(winptr -> next)
		{
			winptr = winptr -> next;
			winptr -> place++;
		}
	
		winptr -> next = thewin;
	}

	convert_sect(thewin -> fonction.secteur.secteurBin, thewin -> fonction.text.Ligne, thewin -> fonction.secteur.ascii);

	/* initialise les ascenseurs */
	wind_set(win -> handle, WF_HSLSIZE, (int)(thewin -> win -> work.g_w *1000. / max_w), 0, 0, 0);

	wind_set(win -> handle, WF_VSLSIZE, 1000, 0, 0, 0);
	wind_set(win -> handle, WF_VSLIDE, 1000, 0, 0, 0);

	/* entr‚e dans le menu */
	get_menu_entry(thewin, thewin -> title +1);

	make_frontwin(thewin);

	menu_ienable(Menu, OUVRIR_TAMPON, 0);
	ajoute(Firstwindow, Messages(TAMPON_13));
} /* ouvrir_tampon */
Пример #15
0
/********************************************************************
*																	*
*					cherche une chaŒne (gestion)					*
*																	*
********************************************************************/
boolean search_proc(t_dialog *dialog, int exit)
{
	char *text;
	int c, i;

	switch (exit)
	{
		case SEARCH_ANNULER:
			return TRUE;

		case ASCII_ACTIF:
			ob_set_cursor(dialog -> info, SEARCH_ASCII, MAX_EDIT, TRUE);
			break;

		case HEXA_ACTIF:
			ob_set_cursor(dialog -> info, SEARCH_HEXA, MAX_EDIT, TRUE);
			break;

		case SEARCH_CALC:
			if (dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0' && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
				break;

			if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED) && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
			{
				ob_dostate(dialog -> tree, HEXA_ACTIF, SELECTED);
				ob_undostate(dialog -> tree, ASCII_ACTIF, SELECTED);
				ob_set_cursor(dialog -> info, SEARCH_HEXA, MAX_EDIT, TRUE);

				ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
				ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
			}
			else
				if (ob_isstate(dialog -> tree, HEXA_ACTIF, SELECTED) && dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0')
				{
					ob_undostate(dialog -> tree, HEXA_ACTIF, SELECTED);
					ob_dostate(dialog -> tree, ASCII_ACTIF, SELECTED);
					ob_set_cursor(dialog -> info, SEARCH_ASCII, MAX_EDIT, TRUE);

					ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
					ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
				}

			if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED))
			{
				strcpy(SearchString, dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext);
				SearchLength = (int)strlen(SearchString);
			}
			else
			{
				text = dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext;
				for (i=0; i<SEARCH_PATTERN_SIZE && text[i*2]; i++)
				{
					sscanf(&text[i*2], "%02x", &c);
					SearchString[i] = c;
				}
				SearchString[i] = '\0';
				SearchLength = i;
			}

			text = dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext;
			for (i=0; i<SearchLength; i++)
				if (SearchString[i])
					text[i] = (unsigned char)SearchString[i];
				else
					text[i] = '.';
			text[i] = '\0';

			text = dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext;
			for (i=0; i<min(20, SearchLength); i++)
				sprintf(&text[i*2], "%02X", (unsigned char)SearchString[i]);
			text[2*i] = '\0';

			ob_draw(dialog -> info, SEARCH_ASCII);
			ob_draw(dialog -> info, SEARCH_HEXA);

			/* Exit-Objekt selektiert? */
			if (ob_isstate(dialog -> tree, exit, SELECTED))
			{
				/* angew„hltes Objekt deselektieren und neu zeichnen */
				ob_undostate(dialog -> tree, exit, SELECTED);
				ob_draw_chg(dialog -> info, exit, NULL, FAIL);
			}
			break;
	}

	if (exit == SEARCH_GO)
	{
		/* Exit-Objekt selektiert? */
		if (ob_isstate(dialog -> tree, exit, SELECTED))
		{
			/* angew„hltes Objekt deselektieren und neu zeichnen */
			ob_undostate(dialog -> tree, exit, SELECTED);
			ob_draw_chg(dialog -> info, exit, NULL, FAIL);
		}

		my_close_dialog(dialog);

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

		if (dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0' && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
		{
			menu_ienable(Menu, CHERCHER_NOUVEAU, 0);
			my_alert(1, FAIL, X_ICN_STOP, Messages(SEARCH_4), NULL);
			return TRUE;
		}

		if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED) && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
		{
			ob_dostate(dialog -> tree, HEXA_ACTIF, SELECTED);
			ob_undostate(dialog -> tree, ASCII_ACTIF, SELECTED);
			ob_set_cursor(dialog -> info, SEARCH_HEXA, MAX_EDIT, TRUE);

			ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
			ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
		}
		else
			if (ob_isstate(dialog -> tree, HEXA_ACTIF, SELECTED) && dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0')
			{
				ob_undostate(dialog -> tree, HEXA_ACTIF, SELECTED);
				ob_dostate(dialog -> tree, ASCII_ACTIF, SELECTED);
				ob_set_cursor(dialog -> info, SEARCH_ASCII, MAX_EDIT, TRUE);

				ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
				ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
			}

		if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED))
		{
			strcpy(SearchString, dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext);
			SearchLength = (int)strlen(SearchString);
		}
		else
		{
			text = dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext;
			for (i=0; i<20 && text[i*2]; i++)
			{
				sscanf(&text[i*2], "%02x", &c);
				SearchString[i] = c;
			}
			SearchString[i] = '\0';
			SearchLength = i;
		}

		menu_ienable(Menu, CHERCHER_NOUVEAU, 1);

		switch (dialog -> thewin -> type)
		{
			case SECTEUR:
				if (SavePos)
					marquer_position(dialog -> thewin);

				search_secteur(dialog -> thewin, ob_isstate(dialog -> tree, DIFF_MAJ_MIN, SELECTED), TRUE);

				if (dialog -> thewin -> fonction.secteur.fichier)
					print_secteur_file(dialog -> thewin);
				break;

			case FICHIER:
			case FICHIER_FS:
			case RAW_FLOPPY:
			case RAW_HARD:
				if (SavePos)
					marquer_position(dialog -> thewin);

				search_secteur(dialog -> thewin, ob_isstate(dialog -> tree, DIFF_MAJ_MIN, SELECTED), TRUE);
				break;

			case TAMPON:
				search_tampon(dialog -> thewin, ob_isstate(dialog -> tree, DIFF_MAJ_MIN, SELECTED));
		}

		return TRUE;
	}

	return FALSE;
} /* search_proc */
Пример #16
0
void Graphic::Update( unsigned int diffTime )
{
	Messages();

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glLoadIdentity();

	glUseProgram( shaderProgram );

	float angle = 90; // degres
	glm::mat4 modelMatrix( glm::mat4( 1.0f ) );
	modelMatrix = glm::rotate( modelMatrix, angle, glm::vec3( 0.0f, 1.0f, 0.0f ) );

	glm::mat4 modelViewMatrix = viewMatrix * modelMatrix;
	glUniformMatrix4fv( glGetUniformLocation( shaderProgram, "modelViewMatrix" ), 1, GL_FALSE, &modelViewMatrix[0][0] );

	glm::mat3 tempMatrix = glm::inverseTranspose( (glm::mat3)modelViewMatrix );
	glUniformMatrix3fv( glGetUniformLocation( shaderProgram, "normalInverseTranspose"), 1, GL_FALSE, &tempMatrix[0][0] );

	/// handle the light position
	glm::vec4 lightPosition( -1.0f, 1.0f, 0.0f, 1.0f );
	lightPosition = viewMatrix * lightPosition;
	glUniform1fv( glGetUniformLocation( shaderProgram, "lightPosition"), 1, &lightPosition[0] );

	// TEXTURE
	GLuint texture;
	glGenTextures( 1, &texture );
	glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
	glBindTexture( GL_TEXTURE_2D, texture );

	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );

	glTexImage2D( GL_TEXTURE_2D, 0, 3, textures[0].width, textures[0].height, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, textures[0].t );

	glBindTexture( GL_TEXTURE_2D, texture );
	// END TEXTURE

	// MODEL
	GLuint Vbo[2];
	glGenBuffers(2, Vbo);

	int size = models[0].num * sizeof( float );

	// Vertex, normal, texture
	glBindBuffer(GL_ARRAY_BUFFER, Vbo[0]); 
	glBufferData(GL_ARRAY_BUFFER, size * 3, models[0].vertexs, GL_STATIC_DRAW);

	glBindBuffer(GL_ARRAY_BUFFER, Vbo[1]);
	glBufferData(GL_ARRAY_BUFFER, size * 3, models[0].normals, GL_STATIC_DRAW);
	
	glBindBuffer(GL_ARRAY_BUFFER, Vbo[2]);
	glBufferData(GL_ARRAY_BUFFER, size * 2, models[0].textureCoordinates, GL_STATIC_DRAW);

	// create 1 VAO
	GLuint Vao;
	glGenVertexArrays(1, &Vao);
	glBindVertexArray(Vao);

	// Vertex, normal, texture
	glEnableVertexAttribArray(0);
	glEnableVertexAttribArray(1);
	glEnableVertexAttribArray(2);

	GLubyte* null = 0;

	glBindBuffer(GL_ARRAY_BUFFER, Vbo[0]);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, null);

	glBindBuffer(GL_ARRAY_BUFFER, Vbo[1]);
	glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, null);

	glBindBuffer(GL_ARRAY_BUFFER, Vbo[2]);
	glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, null);

	glBindVertexArray(Vao);
	glDrawArrays( GL_TRIANGLES, 0, models[0].num );
	// END MODEL

	glUseProgram(0);
	glBindVertexArray(0);

	SDL_GL_SwapBuffers();
}
Пример #17
0
void MainWindow::setErrors(TabbedWidget* tab, 
	const QStringList& errors, const QStringList& warnings, 
	const QStringList& linker, const QStringList& verbose)
{
	m_messages.insert(tab, Messages(errors, warnings, linker, verbose));
}
Пример #18
0
/****************************************************************
*																*
*					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 */
///
// This is used for loading all the resources of the game the use has chosen.
// It loads graphics, sound and text into the memory
///
bool CGameLauncherMenu::loadResources( const std::string& DataDirectory, const int& Episode, const Uint8 flags )
{
	int version;
	unsigned char *p_exedata;
	unsigned char *p_exeheader;

	CExeFile &ExeFile = g_pBehaviorEngine->m_ExeFile;

    version = ExeFile.getEXEVersion();
	p_exedata = ExeFile.getRawData();
	p_exeheader = ExeFile.getHeaderData();

	g_pLogFile->ftextOut("Commander Keen Episode %d (Version %d.%d) was detected.<br>", Episode, version/100, version%100);
	if( Episode == 1 && version == 134) g_pLogFile->ftextOut("This version of the game is not supported!<br>");

	if(p_exeheader == NULL) {
		g_pLogFile->textOut(RED, "CGameControl::loadResources: Could not load data from the EXE File<br>");
		return false;
	}

	// Patch the EXE-File-Data directly in the memory.
	CPatcher Patcher(ExeFile, g_pBehaviorEngine->m_is_a_mod);
	Patcher.patchMemory();

	g_pBehaviorEngine->setEpisode(Episode);

	if( Episode == 1 || Episode == 2 || Episode == 3 ) // Vorticon resources
	{
		g_pBehaviorEngine->readTeleporterTable(p_exedata);

		if( (flags & LOADGFX) == LOADGFX )
		{
			// Decode the entire graphics for the game (EGALATCH, EGASPRIT, etc.)
			// This will also read the Tile-Properties
			mp_EGAGraphics.tryDeleteData(); // except for the first start of a game this always happens
			mp_EGAGraphics = new vorticon::CEGAGraphicsVort(Episode, DataDirectory);
			if(!mp_EGAGraphics.get())
				return false;

			mp_EGAGraphics->loadData( version, p_exedata );
		}

		if( (flags & LOADSTR) == LOADSTR )
		{
			// load the strings.
			CMessages Messages(p_exedata, Episode, version);
			Messages.extractGlobalStrings();
		}

		if( (flags & LOADSND) == LOADSND )
		{
			// Load the sound data
			g_pSound->loadSoundData(ExeFile);
		}

		g_pBehaviorEngine->getPhysicsSettings().loadGameConstants(Episode, p_exedata);

		return true;
	}
	else if( Episode == 4 || Episode == 5 || Episode == 6 ) // Galaxy resources
	{
		// TODO: Lots of coding
		if( (flags & LOADGFX) == LOADGFX )
		{
			// Decode the entire graphics for the game (Only EGAGRAPH.CK?)
			mp_EGAGraphics.tryDeleteData();

			mp_EGAGraphics = new galaxy::CEGAGraphicsGalaxy(ExeFile); // Path is relative to the data directory
			if(!mp_EGAGraphics.get())
				return false;

			mp_EGAGraphics->loadData();
		}

		if( (flags & LOADSTR) == LOADSTR )
		{
			// load the strings.
			CMessages Messages(p_exedata, Episode, version);
			Messages.extractGlobalStrings();
		}

		if( (flags & LOADSND) == LOADSND )
		{
			// Load the sound data
			g_pSound->loadSoundData(ExeFile);
		}
	}
	return true;
}
Пример #20
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 */
Пример #21
0
                            invoked++;
                            return IsPrime(x);
                        }));
                }
            );

            THEN("the output only contains primes"){
                m::RecordedT items[] = {
                    m::OnNext(230, 3),
                    m::OnNext(340, 5),
                    m::OnNext(390, 7),
                    m::OnNext(580, 11),
                    m::OnCompleted(600)
                };
                auto required = m::ToVector(items);
                auto actual = res->Messages();
                REQUIRE(required == actual);
            }

            THEN("there was one subscription and one unsubscription"){
                rx::Subscription items[] = {
                    m::Subscribe(200, 600)
                };
                auto required = m::ToVector(items);
                auto actual = xs->Subscriptions();
                REQUIRE(required == actual);
            }

            THEN("where was called until completed"){
                REQUIRE(9 == invoked);
            }