Example #1
0
/*
	FileClose: Handles user close request.
*/
void FileClose(HWND sheet, HWND control)
{
	HWND page = (HWND)SendMessage(sheet, PSM_GETCURRENTPAGEHWND, 0, 0);
	int sel = IDYES;

	if (!control)
		SendMessage(page, AOKTS_Closing, 0, 0);

	if (scen.needsave())
	{
		sel = MessageBox(sheet, "Do you want to save your changes?", "Save", MB_YESNOCANCEL);
		if (sel == IDYES)
			FileSave(sheet, false, true);
		else if (sel == IDCANCEL)
			return;	//stop closing
	}
	scen.reset();
	*setts.ScenPath = '\0';

	if (!control)
		SendMessage(page, AOKTS_Loading, 0, 0);

	SetSaveState(sheet, MF_ENABLED);
	SetWindowText(propdata.statusbar, "Scenario reset.");
	SendMessage(propdata.mapview, MAP_Reset, 0, 0);

	SetWindowText(sheet, szTitle);
}
Example #2
0
/*
	Sheet_HandleCommand: Handles all commands routed to property sheet (mostly menuitem stuff).
*/
bool Sheet_HandleCommand(HWND sheet, WORD code, WORD id, HWND control)
{
	bool ret = true;
	Player *p = propdata.p;

	switch (id)
	{
	case ID_FILE_REOPEN:
		FileOpen(sheet, false, 0);
		break;

	case ID_TS_FILE_OPEN:
		FileOpen(sheet, true, -1);
		break;

	case ID_TS_FILE_NEW:
	case ID_TS_FILE_CLOSE:
		FileClose(sheet, control);
		break;

	case ID_TS_APP_EXIT:
		if (scen.needsave())
		{
			int sel = MessageBox(sheet, "Do you want to save your changes?", "Save", MB_YESNOCANCEL);
			if (sel == IDYES)
				FileSave(sheet, false, true);
			else if (sel == IDCANCEL)
				break;	//stop closing
		}
		DestroyWindow(sheet);
		break;

	case ID_TS_FILE_SAVE:
		FileSave(sheet, false, true);
		break;

	case ID_TS_FILE_SAVE_AS:
		FileSave(sheet, true, true);
		break;

	case ID_TS_FILE_SAVE_AS2:
		FileSave(sheet, true, false);

	case ID_FILE_DUMP:
		if (!scen.exFile("dump", -1))
		{
			MessageBox(sheet, "Dump failed.", "Scenario Dump", MB_ICONWARNING);
		} else {
		    SetWindowText(propdata.statusbar, "Per files saved to disk");
		}
		break;

	case IDC_U_CLEARAICPVC:
	    scen.clearaicpvc();
		SetWindowText(propdata.statusbar, "Removed All AI, City Plan and VC files");
	    SendMessage(PropSheet_GetCurrentPageHwnd(sheet), AOKTS_Loading, 0, 0);
		break;

	case IDC_U_RANDOMIZE_ROT:
	    scen.randomize_unit_frames();
		SetWindowText(propdata.statusbar, "Randomized unit frames and rotations");
		break;

	case ID_UNITS_TERRAIN_ELEV:
	    scen.set_unit_z_to_map_elev();
		SetWindowText(propdata.statusbar, "Unit z positions set to terrain elevation");
		break;

	case ID_UNITS_DELETE_ALL:
		scen.delete_player_units(propdata.pindex);
		SetWindowText(propdata.statusbar, "Player's units deleted");
	    SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_MAP_WATER_CLIFF_INVISIBLE:
		scen.water_cliffs_visibility(FALSE);
		SetWindowText(propdata.statusbar, "Water cliffs are now invisible");
		break;

	case ID_MAP_WATER_CLIFF_VISIBLE:
		scen.water_cliffs_visibility(TRUE);
		SetWindowText(propdata.statusbar, "Water cliffs are now visible");
		break;

	case ID_TRIGGERS_SORT_CONDS_EFFECTS:
		scen.sort_conds_effects();
		SetWindowText(propdata.statusbar, "Trigger contitions and effects sorted alphanumerically");
		break;

	case ID_TRIGGERS_NOINSTRUCTIONSSOUND:
		scen.instructions_sound_text_set();
		SetWindowText(propdata.statusbar, "Sound text set to null");
		break;

	case ID_TRIGGERS_NOINSTRUCTIONSSOUNDID:
		scen.instructions_sound_id_set(-1);
		SetWindowText(propdata.statusbar, "Sound ID set to -1 for all display instructions effects");
		break;

	case ID_TRIGGERS_ZEROINSTRUCTIONSSOUNDID:
		scen.instructions_sound_id_set(0);
		SetWindowText(propdata.statusbar, "Sound ID set to 0 for all display instructions effects");
		break;

	case ID_TRIGGERS_NOPANEL:
		scen.instructions_panel_set(-1);
		SetWindowText(propdata.statusbar, "Panel ID removed from all display instructions effects");
		break;

	case ID_TRIGGERS_ZEROPANEL:
		scen.instructions_panel_set(0);
		SetWindowText(propdata.statusbar, "Panel ID set to 0 for all display instructions effects");
		break;

	case ID_TRIGGERS_ZERODI:
		scen.instructions_string_zero();
		SetWindowText(propdata.statusbar, "String ID set to 0 for all display instructions effects");
		break;

	case ID_TRIGGERS_RESETDI:
		scen.instructions_string_reset();
		SetWindowText(propdata.statusbar, "String ID set to -1 for all display instructions effects");
		break;

	case ID_TRIGGERS_HIDENAMES:
		scen.remove_trigger_names();
		SetWindowText(propdata.statusbar, "Trigger names removed");
		break;

	case ID_TRIGGERS_COPY_SCRAWL:
	    {
            std::ostringstream ss;
	        scen.accept(TrigScrawlVisitor(ss));
            std::string scrawl = std::string("");
	        scrawl.append(ss.str());

	        const char* output = scrawl.c_str();
            const size_t len = strlen(output) + 1;
            HGLOBAL hMem =  GlobalAlloc(GMEM_MOVEABLE, len);
            memcpy(GlobalLock(hMem), output, len);
            GlobalUnlock(hMem);
            OpenClipboard(0);
            EmptyClipboard();
            SetClipboardData(CF_TEXT, hMem);
            CloseClipboard();
		    SetWindowText(propdata.statusbar, "Copied trigger scrawl");
		}
		break;

	case ID_TRIGGERS_SAVE_PSEUDONYMS:
		scen.save_pseudonyms();
		SetWindowText(propdata.statusbar, "Pseudonyms saved");
		break;

	case ID_TRIGGERS_PREFIX_DISPLAY_ORDER:
		scen.prefix_display_order();
		SetWindowText(propdata.statusbar, "Prefixing display order to trigger names");
		break;

	case ID_TRIGGERS_REMOVE_DISPLAY_ORDER_PREFIX:
		scen.remove_display_order_prefix();
		SetWindowText(propdata.statusbar, "Prefixing display order to trigger names");
		break;

	case ID_TRIGGERS_HIDE_DESCRIPTIONS:
		scen.remove_trigger_descriptions();
		SetWindowText(propdata.statusbar, "Trigger descriptions removed");
		break;

	case ID_TRIGGERS_SWAP_NAMES_DESCRIPTIONS:
		scen.swap_trigger_names_descriptions();
		SetWindowText(propdata.statusbar, "Trigger names swapped with descriptions");
		break;

	case ID_TRIGGERS_FIXTRIGGEROUTLIERS:
		scen.fix_trigger_outliers();
		SetWindowText(propdata.statusbar, "Triggers outside of map have been put within the boundaries");
		break;

	case ID_FILE_TRIGWRITE:
		OnFileTrigWrite(sheet);
		break;

	case ID_FILE_TRIGREAD:
		OnFileTrigRead(sheet);
		break;

	case IDC_P_TOUP:
        if (MessageBox(sheet, "Normally, you will be asked to do this later when you save the scenario to a different format.\nThis menu for fixing broken scenarios. Are you sure you want to do this?", "Convert", MB_YESNOCANCEL) == IDYES) {
		    scen.hd_to_up();
		    SetWindowText(propdata.statusbar, "Trigger effects converted from AoHD to UserPatch");
		}
		break;

	case IDC_P_TOHD:
        if (MessageBox(sheet, "Normally, you will be asked to do this later when you save the scenario to a different format.\nThis menu for fixing broken scenarios. Are you sure you want to do this?", "Convert", MB_YESNOCANCEL) == IDYES) {
		    scen.up_to_hd();
		    SetWindowText(propdata.statusbar, "Trigger effects converted from UserPatch to AoHD");
		}
		break;

	case IDC_P_TOAOFE:
        if (MessageBox(sheet, "Normally, you will be asked to do this later when you save the scenario to a different format.\nThis menu for fixing broken scenarios. Are you sure you want to do this?", "Convert", MB_YESNOCANCEL) == IDYES) {
		    scen.up_to_aofe();
		    SetWindowText(propdata.statusbar, "Trigger effects converted from UserPatch to AoFE");
		}
		break;

	case IDC_P_TO1C:
        if (MessageBox(sheet, "Normally, you will be asked to do this later when you save the scenario to a different format.\nThis menu for fixing broken scenarios. Are you sure you want to do this?", "Convert", MB_YESNOCANCEL) == IDYES) {
		    scen.up_to_10c();
		    SetWindowText(propdata.statusbar, "Trigger effects converted from UserPatch to 1.0c");
		}
		break;

	case ID_FILE_RECENT1:
	case ID_FILE_RECENT2:
	case ID_FILE_RECENT3:
	case ID_FILE_RECENT4:
		FileOpen(sheet, false, id - ID_FILE_RECENT1);
		break;

	case IDCANCEL:
	case IDOK:
		assert(true);
		break;

	case ID_VIEW_STATISTICS:
		DialogBoxParam(aokts, MAKEINTRESOURCE(IDD_STATS), sheet, StatsDialogProc, 0);
		break;

	case ID_VIEW_STAT_BAR:
		if (GetMenuState(GetMenu(sheet), ID_VIEW_STAT_BAR, MF_BYCOMMAND) & MF_CHECKED)
		{
			ShowWindow(propdata.statusbar, SW_HIDE);
			CheckMenuItem(GetMenu(sheet), ID_VIEW_STAT_BAR, MF_BYCOMMAND);
		}
		else
		{
			ShowWindow(propdata.statusbar, SW_SHOW);
			CheckMenuItem(GetMenu(sheet), ID_VIEW_STAT_BAR, MF_BYCOMMAND | MF_CHECKED);
		}
		break;

	case ID_VIEW_MAP:
		if (GetMenuState(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND) & MF_CHECKED)
		{
			// hide window
			ShowWindow(propdata.mapview, SW_HIDE);
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND);
		}
		else
		{
			ShowWindow(propdata.mapview, SW_SHOW);
			CheckMenuItem(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND | MF_CHECKED);
		}
		break;

	case ID_DRAW_TERRAIN:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_TERRAIN, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawterrain = false;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_TERRAIN, MF_BYCOMMAND);
		}
		else
		{
		    setts.drawterrain = true;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_TERRAIN, MF_BYCOMMAND | MF_CHECKED);
		}
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_DRAW_ELEVATION:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_ELEVATION, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawelevation = false;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_ELEVATION, MF_BYCOMMAND);
		}
		else
		{
		    setts.drawelevation = true;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_ELEVATION, MF_BYCOMMAND | MF_CHECKED);
		}
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_DRAW_TRIGGERS:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_TRIGGERS, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawconds = false;
		    setts.draweffects = false;
		    setts.drawlocations = false;
		}
		else
		{
		    setts.drawconds = true;
		    setts.draweffects = true;
		    setts.drawlocations = true;
		}
		SetDrawTriggerCheckboxes(sheet);
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_DRAW_CONDITIONS:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_CONDITIONS, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawconds = false;
		}
		else
		{
		    setts.drawconds = true;
		}
		SetDrawTriggerCheckboxes(sheet);
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_DRAW_EFFECTS:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_EFFECTS, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.draweffects = false;
		}
		else
		{
		    setts.draweffects = true;
		}
		SetDrawTriggerCheckboxes(sheet);
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_DRAW_LOCATIONS:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_LOCATIONS, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawlocations = false;
		}
		else
		{
		    setts.drawlocations = true;
		}
		SetDrawTriggerCheckboxes(sheet);
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_EDIT_ALL:
		if (GetMenuState(GetMenu(sheet), ID_EDIT_ALL, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.editall = false;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_EDIT_ALL, MF_BYCOMMAND);
		}
		else
		{
		    setts.editall = true;
			CheckMenuItem(GetMenu(sheet), ID_EDIT_ALL, MF_BYCOMMAND | MF_CHECKED);
		}
		break;

	case ID_TOOLS_COMPRESS:
		OnCompressOrDecompress(sheet, true);
		break;

	case ID_TOOLS_DECOMPRESS:
		OnCompressOrDecompress(sheet, false);
		break;

	case ID_TS_HELP:
		WinHelp(sheet, "ts.hlp", HELP_CONTENTS, 0);
		break;

	case ID_TS_APP_ABOUT:
		DialogBoxParam(aokts, (LPCSTR)IDD_ABOUT, sheet, DefaultDialogProc, 0L);
		break;

	default:
		ret = false;
	}

	return ret;
}
Example #3
0
/*
	FileOpen: Handles a request to open a file. (Either by menu or generated by the app.)

	Parameters:
	HWND sheet: Handle to the property sheet.
	bool ask:	Should AOKTS ask the user which file?
	int recent:	Optionally open from one of the recent file entries. (-1 to disable.)
*/
void FileOpen(HWND sheet, bool ask, int recent)
{
	OPENFILENAME ofn;
	struct RecentFile *file = NULL;	//the file info will be stored here one way or another
	char titleBuffer[100];
	const char *filename;
	Game version = scen.game;

	HWND page = PropSheet_GetCurrentPageHwnd(sheet);

	//save the scenario if changes have been made (NOT FUNCTIONAL)
	if (scen.needsave())
	{
		int sel = MessageBox(sheet, askSaveChanges, "Save", MB_YESNOCANCEL);

		if (sel == IDYES)
			FileSave(sheet, false, true);

		else if (sel == IDCANCEL)
			return;	//stop closing
	}

    // Hint about whether to open as AOC or SGWB
	if (setts.recent_first) {
	     scen.game = (Game)setts.recent_first->game;
	}

	/* Using a recent file... */
	if (recent >= 0)
	{
		ofn.Flags = 0;	//make sure no random flags set
		file = setts.recent_first;

		/* Parse the linked list to find the one we want */
		while (recent--)
		{
			if (file)
				file = file->next;
			else
			{
				MessageBox(sheet,
					"Warning: Recent File open failed.",
					"Open Warning", MB_ICONWARNING);
			}
		}

		strcpy(setts.ScenPath, file->path);
		version = (Game)file->game;
	}
	/* Prompt the user for a filename. */
	else if (ask)
	{
		struct RecentFile *r_parse;
		char dir[_MAX_PATH];
		strcpy(dir, setts.BasePath);
		strcat(dir, "Scenario");

		ofn.lStructSize =	sizeof(OPENFILENAME);
		ofn.hwndOwner =		sheet;
		//ofn.hInstance unused
		ofn.lpstrFilter =	extOpen;
		ofn.lpstrCustomFilter = NULL;	//user should not set custom filters
		ofn.lpstrFile =		setts.ScenPath;
		ofn.nMaxFile =		_MAX_PATH;
		ofn.lpstrFileTitle = NULL;
		ofn.lpstrInitialDir = dir;
		ofn.lpstrTitle =	NULL;
		ofn.Flags =			OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON | OFN_NOCHANGEDIR;

		if (scen.header.header_type == HT_AOE2SCENARIO) {
		    ofn.nFilterIndex =	1;
		    ofn.lpstrDefExt =	"aoe2scenario";
		} else {
		    switch (scen.game) {
		    case AOK:
		    case AOC:
		    case AOHD:
		    case AOF:
		    case AOHD4:
		    case AOF4:
		    case AOHD6:
		    case AOF6:
		        ofn.nFilterIndex =	1;
		        ofn.lpstrDefExt =	"scx";
		        break;
		    case SWGB:
		    case SWGBCC:
		        ofn.nFilterIndex =	2;
		        ofn.lpstrDefExt =	"scx";
		        break;
		    }
		}

		if (!GetOpenFileName(&ofn))
			return;

		switch (ofn.nFilterIndex) {
		case 1:
		    version = AOC;
		    printf_log("Selected %d, AOE 2.\n", ofn.nFilterIndex);
		    break;
		case 2:
		    version = SWGB;
		    printf_log("Selected %d, Star Wars.\n", ofn.nFilterIndex);
		    break;
		}

		/* Now check if selected file is already on recent list. */
		r_parse = setts.recent_first;
		while (r_parse)
		{
			if (!strcmp(r_parse->path, setts.ScenPath))
			{
				file = r_parse;
				break;
			}
			r_parse = r_parse->next;
		}
	}

	/* Open it! */
	SendMessage(page, AOKTS_Closing, 0, 0);
	// set hourglass, might take more than 1ms
	HCURSOR previous = SetCursor(LoadCursor(NULL, IDC_WAIT));
	scen.reset();
	try
	{
		version = scen.open(setts.ScenPath, setts.TempPath, version);

	    /* Handle recent file stuff */
	    if (!file)
	    {
		    file = setts.recent_getnext();
		    strcpy(file->path, setts.ScenPath);
		    strcpy(file->display, PathFindFileName(setts.ScenPath));
		    file->game = (int)version;
	    }
	    setts.recent_push(file);
	    UpdateRecentMenu(propdata.menu);

		SetCursor(previous);
		// for some reason this is always read only. on Wine at least
		//SetSaveState(sheet, ofn.Flags & OFN_READONLY ? MF_GRAYED : MF_ENABLED);
		SetSaveState(sheet, ofn.Flags & OFN_READONLY ? MF_ENABLED : MF_ENABLED);

		// set status bar text
		SetWindowTextW(propdata.statusbar, L"Scenario loaded successfully.");

	    SendMessage(page, AOKTS_Loading, 0, 0);
        SendMessageW(propdata.mapview, MAP_Recreate, 0, 0);
	    MapView_Reset(propdata.mapview, true);

	    filename = getFilenameFromPath(setts.ScenPath);

	    _snprintf(titleBuffer, sizeof(titleBuffer),
		        "%s - %s", szTitle, filename);

	    SetWindowText(sheet, titleBuffer);
	}
	catch (std::exception &ex)
	{
		// TODO: better atomic cursor handling?
		SetCursor(previous);

		// set status bar text
		SetWindowText(propdata.statusbar, ex.what());

		// report error to user
		std::string desc = "Failed to open as ";

        desc.append(gameName(scen.game));
		desc.append(" scenario file.\n");

		switch (scen.game) {
		case AOC:
		    desc.append("Try opening as a SWGB scx file instead\nusing File->Open\n");
		    break;
		case SWGB:
		    desc.append("Try opening as a Conquerors scx file instead\nusing File->Open\n");
		    break;
		}

		desc.append("\nThe problem: ");
		desc.append(ex.what());

		desc.append("\n\nIf the game is able to open the scenario,\nplease report this error. Thanks.");
		printf_log("User message: %s\n", desc.c_str());
		MessageBox(sheet, desc.c_str(), "Scenario Load Error", MB_ICONWARNING);

		// unless it's a debug build, clear the bad data
	#ifndef _DEBUG
		scen.reset();
		SendMessage(page, AOKTS_Closing, 0, 0);
	#endif

	    /* Updates*/
	    SendMessage(page, AOKTS_Loading, 0, 0);

	    _snprintf(titleBuffer, sizeof(titleBuffer),
		        "%s", szTitle);

	    SetWindowText(sheet, titleBuffer);
	}

	//report errors to logfile
	fflush(stdout);
}
Example #4
0
/*
	Sheet_HandleCommand: Handles all commands routed to property sheet (mostly menuitem stuff).
*/
bool Sheet_HandleCommand(HWND sheet, WORD code, WORD id, HWND control)
{
	bool ret = true;

	switch (id)
	{
	case ID_FILE_REOPEN:
		FileOpen(sheet, false, 0);
		break;

	case ID_TS_FILE_OPEN:
		FileOpen(sheet, true, -1);
		break;

	case ID_TS_FILE_NEW:
	case ID_TS_FILE_CLOSE:
		FileClose(sheet, control);
		break;

	case ID_TS_APP_EXIT:
		if (scen.needsave())
		{
			int sel = MessageBox(sheet, "Do you want to save your changes?", "Save", MB_YESNOCANCEL);
			if (sel == IDYES)
				FileSave(sheet, false, true);
			else if (sel == IDCANCEL)
				break;	//stop closing
		}
		DestroyWindow(sheet);
		break;

	case ID_TS_FILE_SAVE:
		FileSave(sheet, false, true);
		break;

	case ID_TS_FILE_SAVE_AS:
		FileSave(sheet, true, true);
		break;

	case ID_TS_FILE_SAVE_AS2:
		FileSave(sheet, true, false);

	case ID_FILE_DUMP:
		if (!scen.exFile("dump", -1))
		{
			MessageBox(sheet, "Dump failed.", "Scenario Dump", MB_ICONWARNING);
		} else {
		    SetWindowText(propdata.statusbar, "Per files saved to disk");
		}
		break;

	case IDC_U_RANDOMIZE_ROT:
	    scen.randomize_unit_frames();
		SetWindowText(propdata.statusbar, "Randomized unit frames and rotations");
		break;

	case ID_UNITS_TERRAIN_ELEV:
	    scen.set_unit_z_to_map_elev();
		SetWindowText(propdata.statusbar, "Unit z positions set to terrain elevation");
		break;

	case ID_UNITS_DELETE_ALL:
		scen.delete_player_units(propdata.pindex);
		SetWindowText(propdata.statusbar, "Player's units deleted");
	    SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_MAP_WATER_CLIFF_INVISIBLE:
		scen.water_cliffs_visibility(FALSE);
		SetWindowText(propdata.statusbar, "Water cliffs are now invisible");
		break;

	case ID_MAP_WATER_CLIFF_VISIBLE:
		scen.water_cliffs_visibility(TRUE);
		SetWindowText(propdata.statusbar, "Water cliffs are now visible");
		break;

	case ID_TRIGGERS_SORT_CONDS_EFFECTS:
		scen.sort_conds_effects();
		SetWindowText(propdata.statusbar, "Trigger contitions and effects sorted alphanumerically");
		break;

	case ID_TRIGGERS_NOINSTRUCTIONSSOUND:
		scen.instructions_sound_text_set();
		SetWindowText(propdata.statusbar, "Sound text set to null");
		break;

	case ID_TRIGGERS_NOINSTRUCTIONSSOUNDID:
		scen.instructions_sound_id_set(-1);
		SetWindowText(propdata.statusbar, "Sound ID set to -1 for all display instructions effects");
		break;

	case ID_TRIGGERS_ZEROINSTRUCTIONSSOUNDID:
		scen.instructions_sound_id_set(0);
		SetWindowText(propdata.statusbar, "Sound ID set to 0 for all display instructions effects");
		break;

	case ID_TRIGGERS_NOPANEL:
		scen.instructions_panel_set(-1);
		SetWindowText(propdata.statusbar, "Panel ID removed from all display instructions effects");
		break;

	case ID_TRIGGERS_ZEROPANEL:
		scen.instructions_panel_set(0);
		SetWindowText(propdata.statusbar, "Panel ID set to 0 for all display instructions effects");
		break;

	case ID_TRIGGERS_ZERODI:
		scen.instructions_string_zero();
		SetWindowText(propdata.statusbar, "String ID set to 0 for all display instructions effects");
		break;

	case ID_TRIGGERS_RESETDI:
		scen.instructions_string_reset();
		SetWindowText(propdata.statusbar, "String ID set to -1 for all display instructions effects");
		break;

	case ID_TRIGGERS_HIDENAMES:
		scen.remove_trigger_names();
		SetWindowText(propdata.statusbar, "Trigger names removed");
		break;

	case ID_TRIGGERS_SAVE_PSEUDONYMS:
		scen.save_pseudonyms();
		SetWindowText(propdata.statusbar, "Pseudonyms saved");
		break;

	case ID_TRIGGERS_HIDE_DESCRIPTIONS:
		scen.remove_trigger_descriptions();
		SetWindowText(propdata.statusbar, "Trigger descriptions removed");
		break;

	case ID_TRIGGERS_SWAP_NAMES_DESCRIPTIONS:
		scen.swap_trigger_names_descriptions();
		SetWindowText(propdata.statusbar, "Trigger names swapped with descriptions");
		break;

	case ID_TRIGGERS_FIXTRIGGEROUTLIERS:
		scen.fix_trigger_outliers();
		SetWindowText(propdata.statusbar, "Triggers outside of map have been put within the boundaries");
		break;

	case ID_FILE_TRIGWRITE:
		OnFileTrigWrite(sheet);
		break;

	case ID_FILE_TRIGREAD:
		OnFileTrigRead(sheet);
		break;

	case IDC_P_TOUP:
		scen.hd_to_up();
		SetWindowText(propdata.statusbar, "Trigger effects converted from AoHD to UserPatch");
		break;

	case IDC_P_TOHD:
		scen.up_to_hd();
		SetWindowText(propdata.statusbar, "Trigger effects converted from UserPatch to AoHD");
		break;

	case IDC_P_TOAOFE:
		scen.up_to_aofe();
		SetWindowText(propdata.statusbar, "Trigger effects converted from UserPatch to AoFE");
		break;

	case IDC_P_TO1C:
		scen.up_to_10c();
		SetWindowText(propdata.statusbar, "Trigger effects converted from UserPatch to 1.0c");
		break;

	case ID_FILE_RECENT1:
	case ID_FILE_RECENT2:
	case ID_FILE_RECENT3:
	case ID_FILE_RECENT4:
		FileOpen(sheet, false, id - ID_FILE_RECENT1);
		break;

	case IDCANCEL:
	case IDOK:
		assert(true);
		break;

	case ID_VIEW_STATISTICS:
		DialogBoxParam(aokts, MAKEINTRESOURCE(IDD_STATS), sheet, StatsDialogProc, 0);
		break;

	case ID_VIEW_STAT_BAR:
		if (GetMenuState(GetMenu(sheet), ID_VIEW_STAT_BAR, MF_BYCOMMAND) & MF_CHECKED)
		{
			ShowWindow(propdata.statusbar, SW_HIDE);
			CheckMenuItem(GetMenu(sheet), ID_VIEW_STAT_BAR, MF_BYCOMMAND);
		}
		else
		{
			ShowWindow(propdata.statusbar, SW_SHOW);
			CheckMenuItem(GetMenu(sheet), ID_VIEW_STAT_BAR, MF_BYCOMMAND | MF_CHECKED);
		}
		break;

	case ID_VIEW_MAP:
		if (GetMenuState(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND) & MF_CHECKED)
		{
			// hide window
			ShowWindow(propdata.mapview, SW_HIDE);
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND);
		}
		else
		{
			ShowWindow(propdata.mapview, SW_SHOW);
			CheckMenuItem(GetMenu(sheet), ID_VIEW_MAP, MF_BYCOMMAND | MF_CHECKED);
		}
		break;

	case ID_DRAW_TERRAIN:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_TERRAIN, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawterrain = false;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_TERRAIN, MF_BYCOMMAND);
		}
		else
		{
		    setts.drawterrain = true;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_TERRAIN, MF_BYCOMMAND | MF_CHECKED);
		}
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_DRAW_ELEVATION:
		if (GetMenuState(GetMenu(sheet), ID_DRAW_ELEVATION, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.drawelevation = false;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_ELEVATION, MF_BYCOMMAND);
		}
		else
		{
		    setts.drawelevation = true;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_DRAW_ELEVATION, MF_BYCOMMAND | MF_CHECKED);
		}
		SendMessage(propdata.mapview, MAP_Reset, 0, 0);
		break;

	case ID_EDIT_ALL:
		if (GetMenuState(GetMenu(sheet), ID_EDIT_ALL, MF_BYCOMMAND) & MF_CHECKED)
		{
		    setts.editall = false;
			// clear check
			CheckMenuItem(GetMenu(sheet), ID_EDIT_ALL, MF_BYCOMMAND);
		}
		else
		{
		    setts.editall = true;
			CheckMenuItem(GetMenu(sheet), ID_EDIT_ALL, MF_BYCOMMAND | MF_CHECKED);
		}
		break;

	case ID_TOOLS_COMPRESS:
		OnCompressOrDecompress(sheet, true);
		break;

	case ID_TOOLS_DECOMPRESS:
		OnCompressOrDecompress(sheet, false);
		break;

	case ID_TS_HELP:
		WinHelp(sheet, "ts.hlp", HELP_CONTENTS, 0);
		break;

	case ID_TS_APP_ABOUT:
		DialogBoxParam(aokts, (LPCSTR)IDD_ABOUT, sheet, DefaultDialogProc, 0L);
		break;

	default:
		ret = false;
	}

	return ret;
}