BOOL SettingsDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM /*lParam*/)
{
	switch(message)
	{
		case WM_INITDIALOG:
			_hSelf = hWnd;
			initialiseOptions();
			return TRUE;

		case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
				case IDOK:
					setOptions();

				case IDCANCEL:
					::EndDialog(hWnd, 0);
			}
			return TRUE;
		}

		default:
			return FALSE;
	}



}
Exemplo n.º 2
0
BOOL CALLBACK ConfigDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	LRESULT result;

	switch (Message) 
	{
        case WM_INITDIALOG :
		{
			initialiseOptions();
			goToCenter();
			return TRUE;
		}
		
	

		case WM_COMMAND : 
		{
			
				
				switch (LOWORD(wParam))
				{
					case IDC_RADIOSORTREMEMBER:
					case IDC_RADIOSORTINDEX:
					case IDC_RADIOSORTPATH:
					case IDC_RADIOSORTFILENAME:
						result = ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTREMEMBER, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
						{
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKRESETSORTORDER), FALSE);
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKSORTDESCENDING), FALSE);
						}
						else
						{
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKRESETSORTORDER), TRUE);
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKSORTDESCENDING), TRUE);
						}

						break;

					case IDC_CHECKOVERRIDESORTWHENTABBING:
						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKOVERRIDESORTWHENTABBING, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
						{
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKREVERTSORTORDERDURINGTABBING), TRUE);
						}
						else
						{
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKREVERTSORTORDERDURINGTABBING), FALSE);
						}
						break;

					case IDC_CHECKAUTOSIZECOLUMNS:
						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKAUTOSIZECOLUMNS, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
						{
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKAUTOSIZEWINDOW), TRUE);
						}
						else
						{
							EnableWindow(GetDlgItem(_hSelf, IDC_CHECKAUTOSIZEWINDOW), FALSE);
						}
						break;
					case IDOK :
						_options->searchFlags = 0;


						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKSTARTONLY, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->searchFlags |= SEARCHFLAG_STARTONLY;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKCASE, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->searchFlags |= SEARCHFLAG_CASESENSITIVE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEPATH, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->searchFlags |= SEARCHFLAG_INCLUDEPATH;


						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEFILENAME, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->searchFlags |= SEARCHFLAG_INCLUDEFILENAME;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEINDEX, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->searchFlags |= SEARCHFLAG_INCLUDEINDEX;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKINCLUDEVIEW, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->searchFlags |= SEARCHFLAG_INCLUDEVIEW;


						result = ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTFILENAME, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->defaultSortOrder = FILENAME;

						result = ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTPATH, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->defaultSortOrder = PATH;

						result = ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTINDEX, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->defaultSortOrder = INDEX;

						result = ::SendDlgItemMessage(_hSelf, IDC_RADIOSORTREMEMBER, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->defaultSortOrder = ALWAYSREMEMBER;
						else 
						{
							result = ::SendDlgItemMessage(_hSelf, IDC_CHECKSORTDESCENDING, BM_GETCHECK, 0, 0);
							if (BST_CHECKED == result)
								_options->defaultSortOrder |= REVERSE_SORT_ORDER;
						}

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKRESETSORTORDER, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->resetSortOrder = TRUE;
						else
							_options->resetSortOrder = FALSE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKOVERRIDESORTWHENTABBING, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->overrideSortWhenTabbing = TRUE;
						else
							_options->overrideSortWhenTabbing = FALSE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKREVERTSORTORDERDURINGTABBING, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->revertSortWhenTabbing = TRUE;
						else
							_options->revertSortWhenTabbing = FALSE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKONLYCURRENTVIEW, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->onlyUseCurrentView = TRUE;
						else
							_options->onlyUseCurrentView = FALSE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKAUTOSIZECOLUMNS, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->autoSizeColumns = TRUE;
						else
							_options->autoSizeColumns = FALSE;


						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKAUTOSIZEWINDOW, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->autoSizeWindow = TRUE;
						else
							_options->autoSizeWindow = FALSE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKSEPARATECOLUMNFORVIEW, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->columnForView = TRUE;
						else
							_options->columnForView = FALSE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKDIALOGFORCTRLTAB, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->noDialogForCtrlTab = FALSE;
						else
							_options->noDialogForCtrlTab = TRUE;

						result = ::SendDlgItemMessage(_hSelf, IDC_CHECKUSEHOMEFOREDIT, BM_GETCHECK, 0, 0);
						if (BST_CHECKED == result)
							_options->useHomeForEdit = TRUE;
						else
							_options->useHomeForEdit = FALSE;

						

					case IDCANCEL :
						if (_isModal)
							EndDialog(hWnd, 0);
						else
							display(FALSE);
						return TRUE;

					default :
						break;
				}
			
		}
	}
	return FALSE;
}