Exemplo n.º 1
0
/*
================
GEOptionsDlg_GeneralProc

Dialog procedure for the general options tab
================
*/
static INT_PTR CALLBACK GEOptionsDlg_GeneralProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
		case WM_INITDIALOG:
			ColorButton_SetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR),
			                     RGB(gApp.GetOptions().GetSelectionColor()[0]*255,
			                         gApp.GetOptions().GetSelectionColor()[1]*255,
			                         gApp.GetOptions().GetSelectionColor()[2]*255));
			CheckDlgButton(hwnd, IDC_GUIED_IGNOREDESKTOP, gApp.GetOptions().GetIgnoreDesktopSelect()?BST_CHECKED:BST_UNCHECKED);
			break;

		case WM_COMMAND:

			switch (LOWORD(wParam)) {
				case IDC_GUIED_SELECTIONCOLOR: {
					CHOOSECOLOR col;
					ZeroMemory(&col, sizeof(col));
					col.lStructSize = sizeof(col);
					col.lpCustColors = gApp.GetOptions().GetCustomColors();
					col.hwndOwner = hwnd;
					col.hInstance = NULL;
					col.Flags = CC_RGBINIT;
					col.rgbResult = ColorButton_GetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR));

					if (ChooseColor(&col)) {
						ColorButton_SetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR), col.rgbResult);
					}

					break;
				}
			}

			break;

		case WM_DRAWITEM:
			ColorButton_DrawItem(GetDlgItem(hwnd, wParam), (LPDRAWITEMSTRUCT)lParam);
			return TRUE;

		case WM_NOTIFY:

			switch (((NMHDR FAR *) lParam)->code) {
				case PSN_APPLY:
					gApp.GetOptions().SetLastOptionsPage(PropSheet_HwndToIndex(GetParent(hwnd), PropSheet_GetCurrentPageHwnd(GetParent(hwnd))));
					gApp.GetOptions().SetSelectionColor(ColorButton_GetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR)));
					gApp.GetOptions().SetIgnoreDesktopSelect(IsDlgButtonChecked(hwnd, IDC_GUIED_IGNOREDESKTOP) != 0);
					break;
			}

			break;
	}

	return FALSE;
}
Exemplo n.º 2
0
/*
================
GEOptionsDlg_GridProc

Dialog procedure for the grid settings tab
================
*/
static INT_PTR CALLBACK GEOptionsDlg_GridProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
	switch ( msg )
	{
		case WM_INITDIALOG:
			// Copy the options information to the dialog controls
			ColorButton_SetColor ( GetDlgItem ( hwnd, IDC_GUIED_GRIDCOLOR ), RGB(gApp.GetOptions().GetGridColor()[0]*255,gApp.GetOptions().GetGridColor()[1]*255,gApp.GetOptions().GetGridColor()[2]*255) );
			SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_SPACINGWIDTH ), va("%d", gApp.GetOptions().GetGridWidth ( ) ) );
			SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_SPACINGHEIGHT ), va("%d", gApp.GetOptions().GetGridHeight ( ) ) );
			CheckDlgButton ( hwnd, IDC_GUIED_GRIDVISIBLE, gApp.GetOptions().GetGridVisible()?BST_CHECKED:BST_UNCHECKED );
			CheckDlgButton ( hwnd, IDC_GUIED_GRIDSNAP, gApp.GetOptions().GetGridSnap()?BST_CHECKED:BST_UNCHECKED );
			return TRUE;
	
		case WM_DRAWITEM:
			ColorButton_DrawItem ( GetDlgItem ( hwnd, wParam ), (LPDRAWITEMSTRUCT)lParam );			
			return TRUE;
		
		case WM_NOTIFY:
			switch (((NMHDR FAR *) lParam)->code)
			{
				case PSN_APPLY:
				{
					char temp[32];
					
					// Copy the dialog control data back to the options
					GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_SPACINGWIDTH ), temp, 32 );
					gApp.GetOptions().SetGridWidth(atol(temp));
					GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_SPACINGHEIGHT ), temp, 32 );
					gApp.GetOptions().SetGridHeight(atol(temp));
					gApp.GetOptions().SetGridVisible ( IsDlgButtonChecked ( hwnd, IDC_GUIED_GRIDVISIBLE ) != 0 );
					gApp.GetOptions().SetGridSnap ( IsDlgButtonChecked ( hwnd, IDC_GUIED_GRIDSNAP ) != 0 );
					gApp.GetOptions().SetGridColor ( ColorButton_GetColor ( GetDlgItem ( hwnd, IDC_GUIED_GRIDCOLOR ) ) );
					break;
				}
			}
			break;
		
		case WM_COMMAND:
			switch ( LOWORD ( wParam ) )
			{
				case IDC_GUIED_GRIDCOLOR:
				{
					CHOOSECOLOR col;
					ZeroMemory ( &col, sizeof(col) );
					col.lStructSize = sizeof(col);
					col.lpCustColors = gApp.GetOptions().GetCustomColors ( );
					col.hwndOwner = hwnd;
					col.hInstance = NULL;
					col.Flags = CC_RGBINIT;
					col.rgbResult = RGB(gApp.GetOptions().GetGridColor()[0]*255,gApp.GetOptions().GetGridColor()[1]*255,gApp.GetOptions().GetGridColor()[2]*255);
					if ( ChooseColor ( &col ) )
					{
						ColorButton_SetColor ( GetDlgItem ( hwnd, IDC_GUIED_GRIDCOLOR ), col.rgbResult );
					}
					break;
				}
			}
			return TRUE;
	}	

	return FALSE;
}