예제 #1
0
INT_PTR CALLBACK ResetDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	BOOL resetFilters  = FALSE;
	BOOL resetGames    = FALSE;
	BOOL resetUI	   = FALSE;
	BOOL resetDefaults = FALSE;

	switch (Msg)
	{
	case WM_INITDIALOG:
		return TRUE;

	case WM_HELP:
		/* User clicked the ? from the upper right on a control */
		HelpFunction((HWND)((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs());
		break;

	case WM_CONTEXTMENU:
		HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());

		break;

	case WM_COMMAND :
		switch (GET_WM_COMMAND_ID(wParam, lParam))
		{
		case IDOK :
			resetFilters  = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_FILTERS));
			resetGames	  = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_GAMES));
			resetDefaults = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_DEFAULT));
			resetUI 	  = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_UI));
			if (resetFilters || resetGames || resetUI || resetDefaults)
			{

				TCHAR temp[400];
				_tcscpy(temp, TEXT(MAMEUINAME));
				_tcscat(temp, TEXT(" will now reset the following\n"));
				_tcscat(temp, TEXT("to the default settings:\n\n"));

				if (resetDefaults)
					_tcscat(temp, TEXT("Global game options\n"));
				if (resetGames)
					_tcscat(temp, TEXT("Individual game options\n"));
				if (resetFilters)
					_tcscat(temp, TEXT("Custom folder filters\n"));
				if (resetUI)
				{
					_tcscat(temp, TEXT("User interface settings\n\n"));
					_tcscat(temp, TEXT("Resetting the User Interface options\n"));
					_tcscat(temp, TEXT("requires exiting "));
					_tcscat(temp, TEXT(MAMEUINAME));
					_tcscat(temp, TEXT(".\n"));
				}
				_tcscat(temp, TEXT("\nDo you wish to continue?"));
				if (MessageBox(hDlg, temp, TEXT("Restore Settings"), IDOK) == IDOK)
				{
					if (resetFilters)
						ResetFilters();

					if (resetGames)
						ResetAllGameOptions();

					if (resetDefaults)
						ResetGameDefaults();

					// This is the only case we need to exit and restart for.
					if (resetUI)
					{
						ResetGUI();
						EndDialog(hDlg, 1);
						return TRUE;
					} else {
						EndDialog(hDlg, 0);
						return TRUE;
					}
				} else {
					// Give the user a chance to change what they want to reset.
					break;
				}
			}
		// Nothing was selected but OK, just fall through
		case IDCANCEL :
			EndDialog(hDlg, 0);
			return TRUE;
		}
		break;
	}
	return 0;
}
예제 #2
0
파일: dialogs.cpp 프로젝트: Robbbert/store1
INT_PTR CALLBACK ResetDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	switch (Msg)
	{
		case WM_INITDIALOG:
			CenterWindow(hDlg);
			hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON));
			SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
			hBrush = CreateSolidBrush(RGB(240, 240, 240));
			DisableVisualStylesReset(hDlg);
			return true;

		case WM_CTLCOLORDLG:
			return (LRESULT) hBrush;	
		
		case WM_CTLCOLORSTATIC:
		case WM_CTLCOLORBTN:
			hDC = (HDC)wParam;
			SetBkMode(hDC, TRANSPARENT);
			SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
			return (LRESULT) hBrush;

		case WM_COMMAND:
			switch (GET_WM_COMMAND_ID(wParam, lParam))
			{
				case IDOK:
				{
					bool resetFilters = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_FILTERS));
					bool resetGames = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_GAMES));
					bool resetDefaults = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_DEFAULT));
					bool resetUI = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_UI));
					bool resetInternalUI = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_MAME_UI));

					if (resetFilters || resetGames || resetUI || resetDefaults || resetInternalUI)
					{
						char temp[512];
						strcpy(temp, MAMEUINAME);
						strcat(temp, " will now reset the following\n");
						strcat(temp, "to the default settings:\n\n");

						if (resetDefaults)
							strcat(temp, "Global games options\n");

						if (resetInternalUI)
							strcat(temp, "Internal MAME interface options\n");

						if (resetGames)
							strcat(temp, "Individual game options\n");

						if (resetFilters)
							strcat(temp, "Custom folder filters\n");

						if (resetUI)
						{
							strcat(temp, "User interface settings\n\n");
							strcat(temp, "Resetting the user interface options\n");
							strcat(temp, "requires exiting ");
							strcat(temp, MAMEUINAME);
							strcat(temp, ".\n");
						}

						strcat(temp, "\nDo you wish to continue?");

						if (win_message_box_utf8(hDlg, temp, "Restore settings", MB_ICONQUESTION | MB_YESNO) == IDYES)
						{
							DestroyIcon(hIcon);
							DeleteObject(hBrush);

							if (resetFilters)
								ResetFilters();

							if (resetGames)
								ResetAllGameOptions();

							if (resetDefaults)
								ResetGameDefaults();

							if (resetInternalUI)
								ResetInternalUI();

							// This is the only case we need to exit and restart for.
							if (resetUI)
							{
								ResetInterface();
								EndDialog(hDlg, 1);
								return true;
							}
							else 
							{
								EndDialog(hDlg, 0);
								return true;
							}
						}
						else 
							// Give the user a chance to change what they want to reset.
							break;
					}
				}
		
				// Nothing was selected but OK, just fall through
				case IDCANCEL:
					DeleteObject(hBrush);
					DestroyIcon(hIcon);
					EndDialog(hDlg, 0);
					return true;
			}

			break;
	}

	return false;
}