Exemple #1
0
INT_PTR CControllerManager::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			const size_t NumControllers=m_ControllerList.size();
			if (NumControllers>0) {
				m_CurSettingsList.resize(NumControllers);
				int Sel=0;
				for (size_t i=0;i<NumControllers;i++) {
					const ControllerInfo &Info=m_ControllerList[i];

					DlgComboBox_AddString(hDlg,IDC_CONTROLLER_LIST,Info.pController->GetText());
					if (!m_CurController.empty()
							&& ::lstrcmpi(m_CurController.c_str(),Info.pController->GetName())==0)
						Sel=(int)i;
					m_CurSettingsList[i]=Info.Settings;
				}
				DlgComboBox_SetCurSel(hDlg,IDC_CONTROLLER_LIST,Sel);
			}
			EnableDlgItem(hDlg,IDC_CONTROLLER_LIST,NumControllers>0);

			HWND hwndList=::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN);
			ListView_SetExtendedListViewStyle(hwndList,
				LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_LABELTIP);
			LV_COLUMN lvc;
			lvc.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
			lvc.fmt=LVCFMT_LEFT;
			lvc.cx=120;
			lvc.pszText=TEXT("ボタン");
			ListView_InsertColumn(hwndList,0,&lvc);
			lvc.pszText=TEXT("コマンド");
			ListView_InsertColumn(hwndList,1,&lvc);

			const CCommandList &CommandList=GetAppClass().CommandList;
			TCHAR szText[CCommandList::MAX_COMMAND_NAME];
			DlgComboBox_AddString(hDlg,IDC_CONTROLLER_COMMAND,TEXT("なし"));
			for (int i=0;i<CommandList.NumCommands();i++) {
				CommandList.GetCommandName(i,szText,lengthof(szText));
				DlgComboBox_AddString(hDlg,IDC_CONTROLLER_COMMAND,szText);
			}

			m_Tooltip.Create(hDlg);
			m_Tooltip.SetFont(GetWindowFont(hDlg));

			InitDlgItems();
			SetDlgItemStatus();
		}
		return TRUE;

	case WM_PAINT:
		{
			if (m_hbmController==NULL)
				break;

			const CController *pController=GetCurController();
			if (pController==NULL)
				break;

			int CurButton=ListView_GetNextItem(::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN),-1,LVNI_SELECTED);

			PAINTSTRUCT ps;
			BITMAP bm;
			RECT rc;
			HDC hdcMem;
			HBITMAP hbmOld;

			::BeginPaint(hDlg,&ps);
			::GetObject(m_hbmController,sizeof(BITMAP),&bm);
			::GetWindowRect(::GetDlgItem(hDlg,IDC_CONTROLLER_IMAGEPLACE),&rc);
			MapWindowRect(NULL,hDlg,&rc);
			::FillRect(ps.hdc,&rc,static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH)));
			hdcMem=::CreateCompatibleDC(ps.hdc);
			hbmOld=static_cast<HBITMAP>(::SelectObject(hdcMem,m_hbmController));
			::BitBlt(ps.hdc,m_ImageRect.left,m_ImageRect.top,
							bm.bmWidth,bm.bmHeight,hdcMem,0,0,SRCCOPY);
			if (CurButton>=0 && m_hbmSelButtons!=NULL) {
				CController::ButtonInfo Button;

				pController->GetButtonInfo(CurButton,&Button);
				::SelectObject(hdcMem,m_hbmSelButtons);
				::GdiTransparentBlt(ps.hdc,
					m_ImageRect.left+Button.ImageButtonRect.Left,
					m_ImageRect.top+Button.ImageButtonRect.Top,
					Button.ImageButtonRect.Width,
					Button.ImageButtonRect.Height,
					hdcMem,
					Button.ImageSelButtonPos.Left,
					Button.ImageSelButtonPos.Top,
					Button.ImageButtonRect.Width,
					Button.ImageButtonRect.Height,
					RGB(255,0,255));
			}
			::SelectObject(hdcMem,hbmOld);
			::DeleteDC(hdcMem);
			::EndPaint(hDlg,&ps);
		}
		return TRUE;

	case WM_LBUTTONDOWN:
		{
			POINT pt;

			pt.x=GET_X_LPARAM(lParam);
			pt.y=GET_Y_LPARAM(lParam);
			if (m_hbmSelButtons!=NULL
					&& ::PtInRect(&m_ImageRect,pt)) {
				const CController *pController=GetCurController();
				if (pController==NULL)
					return TRUE;

				const int NumButtons=pController->NumButtons();
				for (int i=0;i<NumButtons;i++) {
					CController::ButtonInfo Button;
					RECT rc;

					pController->GetButtonInfo(i,&Button);
					rc.left=m_ImageRect.left+Button.ImageButtonRect.Left;
					rc.top=m_ImageRect.top+Button.ImageButtonRect.Top;
					rc.right=rc.left+Button.ImageButtonRect.Width;
					rc.bottom=rc.top+Button.ImageButtonRect.Height;
					if (::PtInRect(&rc,pt)) {
						HWND hwndList=::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN);

						ListView_SetItemState(hwndList,i,
											  LVIS_FOCUSED | LVIS_SELECTED,
											  LVIS_FOCUSED | LVIS_SELECTED);
						ListView_EnsureVisible(hwndList,i,FALSE);
						::SetFocus(hwndList);
						break;
					}
				}
			}
		}
		return TRUE;

	case WM_SETCURSOR:
		if (LOWORD(lParam)==HTCLIENT) {
			if (m_hbmSelButtons!=NULL) {
				POINT pt;

				::GetCursorPos(&pt);
				::ScreenToClient(hDlg,&pt);
				if (::PtInRect(&m_ImageRect,pt)) {
					const CController *pController=GetCurController();
					if (pController==NULL)
						break;

					const int NumButtons=pController->NumButtons();
					for (int i=0;i<NumButtons;i++) {
						CController::ButtonInfo Button;
						RECT rc;

						pController->GetButtonInfo(i,&Button);
						rc.left=m_ImageRect.left+Button.ImageButtonRect.Left;
						rc.top=m_ImageRect.top+Button.ImageButtonRect.Top;
						rc.right=rc.left+Button.ImageButtonRect.Width;
						rc.bottom=rc.top+Button.ImageButtonRect.Height;
						if (::PtInRect(&rc,pt)) {
							::SetCursor(::LoadCursor(NULL,IDC_HAND));
							::SetWindowLongPtr(hDlg,DWLP_MSGRESULT,TRUE);
							return TRUE;
						}
					}
				}
			}
		}
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_CONTROLLER_LIST:
			if (HIWORD(wParam)==CBN_SELCHANGE) {
				const CController *pCurController=GetCurController();

				InitDlgItems();
				if (pCurController!=NULL) {
					m_CurController=pCurController->GetName();
					m_fChanged=true;
				}
			}
			return TRUE;

		case IDC_CONTROLLER_ACTIVEONLY:
			{
				int CurController=(int)DlgComboBox_GetCurSel(hDlg,IDC_CONTROLLER_LIST);

				if (CurController>=0) {
					m_CurSettingsList[CurController].fActiveOnly=
						DlgCheckBox_IsChecked(hDlg,IDC_CONTROLLER_ACTIVEONLY);
				}
			}
			return TRUE;

		case IDC_CONTROLLER_COMMAND:
			if (HIWORD(wParam)==CBN_SELCHANGE) {
				HWND hwndList=::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN);
				int Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);

				if (Sel>=0) {
					int Command=(int)DlgComboBox_GetCurSel(hDlg,IDC_CONTROLLER_COMMAND);

					SetButtonCommand(hwndList,Sel,
						Command<=0?0:GetAppClass().CommandList.GetCommandID(Command-1));
				}
			}
			return TRUE;

		case IDC_CONTROLLER_DEFAULT:
			{
				const CController *pController=GetCurController();
				if (pController==NULL)
					return TRUE;

				HWND hwndList=::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN);
				const int NumButtons=pController->NumButtons();
				for (int i=0;i<NumButtons;i++) {
					CController::ButtonInfo Button;

					pController->GetButtonInfo(i,&Button);
					SetButtonCommand(hwndList,i,Button.DefaultCommand);
				}
				SetDlgItemStatus();
			}
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case LVN_ITEMCHANGED:
			SetDlgItemStatus();
			::InvalidateRect(hDlg,&m_ImageRect,FALSE);
			break;

		case LVN_KEYDOWN:
			{
				LPNMLVKEYDOWN pnmlvk=reinterpret_cast<LPNMLVKEYDOWN>(lParam);

				if (pnmlvk->wVKey==VK_BACK || pnmlvk->wVKey==VK_DELETE) {
					HWND hwndList=::GetDlgItem(hDlg,IDC_CONTROLLER_ASSIGN);
					int Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);

					if (Sel>=0)
						SetButtonCommand(hwndList,Sel,0);
				}
			}
			break;

		case PSN_APPLY:
			{
				for (size_t i=0;i<m_ControllerList.size();i++) {
					ControllerInfo &Info=m_ControllerList[i];
					ControllerSettings &CurSettings=m_CurSettingsList[i];

					if (Info.Settings!=CurSettings) {
						if (Info.pController->IsEnabled()) {
							if (CurSettings.fActiveOnly!=Info.Settings.fActiveOnly) {
								Info.pController->Enable(false);
								Info.Settings.fActiveOnly=CurSettings.fActiveOnly;
								Info.pController->Enable(true);
							}
						}
						Info.Settings=CurSettings;
						Info.fSettingsChanged=true;
					}
				}
			}
			break;
		}
		break;

	case WM_DESTROY:
		{
			if (m_hbmController!=NULL) {
				::DeleteObject(m_hbmController);
				m_hbmController=NULL;
			}
			if (m_hbmSelButtons!=NULL) {
				::DeleteObject(m_hbmSelButtons);
				m_hbmSelButtons=NULL;
			}
			m_CurSettingsList.clear();
			m_Tooltip.Destroy();
		}
		return TRUE;
	}

	return FALSE;
}
Exemple #2
0
INT_PTR CEpgOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			CLogoManager &LogoManager=GetAppClass().LogoManager;

			DlgCheckBox_Check(hDlg,IDC_EPGOPTIONS_SAVEEPGFILE,m_fSaveEpgFile);
			::EnableDlgItems(hDlg,IDC_EPGOPTIONS_EPGFILENAME_LABEL,
					IDC_EPGOPTIONS_EPGFILENAME_BROWSE,m_fSaveEpgFile);
			::SendDlgItemMessage(hDlg,IDC_EPGOPTIONS_EPGFILENAME,
								 EM_LIMITTEXT,MAX_PATH-1,0);
			::SetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGFILENAME,m_szEpgFileName);
			DlgCheckBox_Check(hDlg,IDC_EPGOPTIONS_UPDATEWHENSTANDBY,m_fUpdateWhenStandby);
			DlgCheckBox_Check(hDlg,IDC_EPGOPTIONS_UPDATEBSEXTENDED,m_fUpdateBSExtended);
			DlgCheckBox_Check(hDlg,IDC_EPGOPTIONS_UPDATECSEXTENDED,m_fUpdateCSExtended);
			DlgCheckBox_Check(hDlg,IDC_EPGOPTIONS_USEEPGDATA,m_fUseEDCBData);
			::SendDlgItemMessage(hDlg,IDC_EPGOPTIONS_EPGDATAFOLDER,EM_LIMITTEXT,MAX_PATH-1,0);
			::SetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGDATAFOLDER,m_szEDCBDataFolder);
			EnableDlgItems(hDlg,IDC_EPGOPTIONS_EPGDATAFOLDER_LABEL,
								IDC_EPGOPTIONS_EPGDATAFOLDER_BROWSE,
						   m_fUseEDCBData);

			DlgCheckBox_Check(hDlg,IDC_LOGOOPTIONS_SAVEDATA,m_fSaveLogoFile);
			::SendDlgItemMessage(hDlg,IDC_LOGOOPTIONS_DATAFILENAME,EM_LIMITTEXT,MAX_PATH-1,0);
			::SetDlgItemText(hDlg,IDC_LOGOOPTIONS_DATAFILENAME,m_szLogoFileName);
			EnableDlgItems(hDlg,IDC_LOGOOPTIONS_DATAFILENAME_LABEL,
								IDC_LOGOOPTIONS_DATAFILENAME_BROWSE,
						   m_fSaveLogoFile);
			DlgCheckBox_Check(hDlg,IDC_LOGOOPTIONS_SAVERAWLOGO,LogoManager.GetSaveLogo());
			DlgCheckBox_Check(hDlg,IDC_LOGOOPTIONS_SAVEBMPLOGO,LogoManager.GetSaveLogoBmp());
			::SendDlgItemMessage(hDlg,IDC_LOGOOPTIONS_LOGOFOLDER,EM_LIMITTEXT,MAX_PATH-1,0);
			::SetDlgItemText(hDlg,IDC_LOGOOPTIONS_LOGOFOLDER,LogoManager.GetLogoDirectory());

			m_CurEventInfoFont=m_EventInfoFont;
			TVTest::StyleUtil::SetFontInfoItem(hDlg,IDC_EVENTINFOOPTIONS_FONT_INFO,m_CurEventInfoFont);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_EPGOPTIONS_SAVEEPGFILE:
			EnableDlgItemsSyncCheckBox(hDlg,
									   IDC_EPGOPTIONS_EPGFILENAME_LABEL,
									   IDC_EPGOPTIONS_EPGFILENAME_BROWSE,
									   IDC_EPGOPTIONS_SAVEEPGFILE);
			return TRUE;

		case IDC_EPGOPTIONS_EPGFILENAME_BROWSE:
			{
				OPENFILENAME ofn;
				TCHAR szFileName[MAX_PATH],szInitialDir[MAX_PATH];

				::GetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGFILENAME,
								 szFileName,lengthof(szFileName));
				ofn.lStructSize=sizeof(OPENFILENAME);
				ofn.hwndOwner=hDlg;
				ofn.lpstrFilter=TEXT("すべてのファイル\0*.*\0");
				ofn.lpstrCustomFilter=NULL;
				ofn.nFilterIndex=1;
				ofn.lpstrFile=szFileName;
				ofn.nMaxFile=lengthof(szFileName);
				ofn.lpstrFileTitle=NULL;
				if (szFileName[0]=='\0' || ::PathIsFileSpec(szFileName)) {
					::GetModuleFileName(NULL,szInitialDir,lengthof(szInitialDir));
					::PathRemoveFileSpec(szInitialDir);
					ofn.lpstrInitialDir=szInitialDir;
				} else
					ofn.lpstrInitialDir=NULL;
				ofn.lpstrTitle=TEXT("EPGファイル名");
				ofn.Flags=OFN_EXPLORER | OFN_HIDEREADONLY;
				ofn.lpstrDefExt=NULL;
#if _WIN32_WINNT>=0x500
				ofn.pvReserved=NULL;
				ofn.dwReserved=0;
				ofn.FlagsEx=0;
#endif
				if (FileOpenDialog(&ofn))
					::SetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGFILENAME,szFileName);
			}
			return TRUE;

		case IDC_EPGOPTIONS_USEEPGDATA:
			EnableDlgItemsSyncCheckBox(hDlg,
									   IDC_EPGOPTIONS_EPGDATAFOLDER_LABEL,
									   IDC_EPGOPTIONS_EPGDATAFOLDER_BROWSE,
									   IDC_EPGOPTIONS_USEEPGDATA);
			return TRUE;

		case IDC_EPGOPTIONS_EPGDATAFOLDER_BROWSE:
			{
				TCHAR szFolder[MAX_PATH];

				::GetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGDATAFOLDER,szFolder,lengthof(szFolder));
				if (BrowseFolderDialog(hDlg,szFolder,TEXT("EPGデータのフォルダ")))
					::SetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGDATAFOLDER,szFolder);
			}
			return TRUE;

		case IDC_LOGOOPTIONS_SAVEDATA:
			EnableDlgItemsSyncCheckBox(hDlg,
									   IDC_LOGOOPTIONS_DATAFILENAME_LABEL,
									   IDC_LOGOOPTIONS_DATAFILENAME_BROWSE,
									   IDC_LOGOOPTIONS_SAVEDATA);
			return TRUE;

		case IDC_LOGOOPTIONS_DATAFILENAME_BROWSE:
			{
				OPENFILENAME ofn;
				TCHAR szFileName[MAX_PATH],szInitialDir[MAX_PATH];

				::GetDlgItemText(hDlg,IDC_LOGOOPTIONS_DATAFILENAME,szFileName,lengthof(szFileName));
				ofn.lStructSize=sizeof(OPENFILENAME);
				ofn.hwndOwner=hDlg;
				ofn.lpstrFilter=TEXT("すべてのファイル\0*.*\0");
				ofn.lpstrCustomFilter=NULL;
				ofn.nFilterIndex=1;
				ofn.lpstrFile=szFileName;
				ofn.nMaxFile=lengthof(szFileName);
				ofn.lpstrFileTitle=NULL;
				if (szFileName[0]=='\0' || ::PathIsFileSpec(szFileName)) {
					::GetModuleFileName(NULL,szInitialDir,lengthof(szInitialDir));
					::PathRemoveFileSpec(szInitialDir);
					ofn.lpstrInitialDir=szInitialDir;
				} else
					ofn.lpstrInitialDir=NULL;
				ofn.lpstrTitle=TEXT("ロゴファイル名");
				ofn.Flags=OFN_EXPLORER | OFN_HIDEREADONLY;
				ofn.lpstrDefExt=NULL;
#if _WIN32_WINNT>=0x500
				ofn.pvReserved=NULL;
				ofn.dwReserved=0;
				ofn.FlagsEx=0;
#endif
				if (FileOpenDialog(&ofn))
					::SetDlgItemText(hDlg,IDC_LOGOOPTIONS_DATAFILENAME,szFileName);
			}
			return TRUE;

		case IDC_LOGOOPTIONS_LOGOFOLDER_BROWSE:
			{
				TCHAR szFolder[MAX_PATH];

				::GetDlgItemText(hDlg,IDC_LOGOOPTIONS_LOGOFOLDER,szFolder,lengthof(szFolder));
				if (BrowseFolderDialog(hDlg,szFolder,TEXT("ロゴのフォルダ")))
					::SetDlgItemText(hDlg,IDC_LOGOOPTIONS_LOGOFOLDER,szFolder);
			}
			return TRUE;

		case IDC_EVENTINFOOPTIONS_FONT_CHOOSE:
			if (TVTest::StyleUtil::ChooseStyleFont(hDlg,&m_CurEventInfoFont))
				TVTest::StyleUtil::SetFontInfoItem(hDlg,IDC_EVENTINFOOPTIONS_FONT_INFO,m_CurEventInfoFont);
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				CLogoManager &LogoManager=GetAppClass().LogoManager;
				TCHAR szPath[MAX_PATH];

				m_fSaveEpgFile=
					DlgCheckBox_IsChecked(hDlg,IDC_EPGOPTIONS_SAVEEPGFILE);
				::GetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGFILENAME,
								 m_szEpgFileName,lengthof(m_szEpgFileName));
				m_fUpdateWhenStandby=
					DlgCheckBox_IsChecked(hDlg,IDC_EPGOPTIONS_UPDATEWHENSTANDBY);
				m_fUpdateBSExtended=
					DlgCheckBox_IsChecked(hDlg,IDC_EPGOPTIONS_UPDATEBSEXTENDED);
				m_fUpdateCSExtended=
					DlgCheckBox_IsChecked(hDlg,IDC_EPGOPTIONS_UPDATECSEXTENDED);
				bool fUseEpgData=
					DlgCheckBox_IsChecked(hDlg,IDC_EPGOPTIONS_USEEPGDATA);
				::GetDlgItemText(hDlg,IDC_EPGOPTIONS_EPGDATAFOLDER,
					m_szEDCBDataFolder,lengthof(m_szEDCBDataFolder));
				if (!m_fUseEDCBData && fUseEpgData) {
					m_fUseEDCBData=fUseEpgData;
					AsyncLoadEDCBData();
				}
				m_fUseEDCBData=fUseEpgData;

				m_fSaveLogoFile=DlgCheckBox_IsChecked(hDlg,IDC_LOGOOPTIONS_SAVEDATA);
				::GetDlgItemText(hDlg,IDC_LOGOOPTIONS_DATAFILENAME,
								 m_szLogoFileName,lengthof(m_szLogoFileName));
				LogoManager.SetSaveLogo(DlgCheckBox_IsChecked(hDlg,IDC_LOGOOPTIONS_SAVERAWLOGO));
				LogoManager.SetSaveLogoBmp(DlgCheckBox_IsChecked(hDlg,IDC_LOGOOPTIONS_SAVEBMPLOGO));
				::GetDlgItemText(hDlg,IDC_LOGOOPTIONS_LOGOFOLDER,szPath,lengthof(szPath));
				LogoManager.SetLogoDirectory(szPath);

				if (m_EventInfoFont!=m_CurEventInfoFont) {
					m_EventInfoFont=m_CurEventInfoFont;
					SetGeneralUpdateFlag(UPDATE_GENERAL_EVENTINFOFONT);
				}

				m_fChanged=true;
			}
			break;
		}
		break;
	}

	return FALSE;
}
Exemple #3
0
INT_PTR CGeneralOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			CAppMain &App=GetAppClass();

			::SendDlgItemMessage(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,EM_LIMITTEXT,MAX_PATH-1,0);
			::SetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,m_BonDriverDirectory.c_str());

			// BonDriver
			::CheckRadioButton(hDlg,IDC_OPTIONS_DEFAULTDRIVER_NONE,
									IDC_OPTIONS_DEFAULTDRIVER_CUSTOM,
							   (int)m_DefaultDriverType+IDC_OPTIONS_DEFAULTDRIVER_NONE);
			EnableDlgItems(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
								IDC_OPTIONS_DEFAULTDRIVER_BROWSE,
						   m_DefaultDriverType==DEFAULT_DRIVER_CUSTOM);

			const CDriverManager &DriverManager=App.DriverManager;
			DlgComboBox_LimitText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,MAX_PATH-1);
			for (int i=0;i<DriverManager.NumDrivers();i++) {
				DlgComboBox_AddString(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
									  DriverManager.GetDriverInfo(i)->GetFileName());
			}
			::SetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,m_DefaultBonDriverName.c_str());

			DlgCheckBox_Check(hDlg,IDC_OPTIONS_RESIDENT,m_fResident);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_KEEPSINGLETASK,m_fKeepSingleTask);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_STANDALONEPROGRAMGUIDE,m_fStandaloneProgramGuide);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_ENABLE1SEGFALLBACK,m_fEnable1SegFallback);

			if (Util::OS::IsWindows7OrLater()) {
				DlgCheckBox_Check(hDlg,IDC_OPTIONS_USEUNIQUEAPPID,
								  App.TaskbarOptions.GetUseUniqueAppID());
				DlgCheckBox_Check(hDlg,IDC_OPTIONS_ENABLEJUMPLIST,
								  App.TaskbarOptions.GetEnableJumpList());
				DlgCheckBox_Check(hDlg,IDC_OPTIONS_JUMPLISTKEEPSINGLETASK,
								  App.TaskbarOptions.GetJumpListKeepSingleTask());
				EnableDlgItem(hDlg,IDC_OPTIONS_JUMPLISTKEEPSINGLETASK,
							  App.TaskbarOptions.GetEnableJumpList());
			} else {
				EnableDlgItems(hDlg,
							   IDC_OPTIONS_ENABLEJUMPLIST,
							   IDC_OPTIONS_USEUNIQUEAPPID,
							   false);
			}
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_OPTIONS_DRIVERDIRECTORY_BROWSE:
			{
				TCHAR szDirectory[MAX_PATH];

				if (::GetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,szDirectory,lengthof(szDirectory))>0) {
					if (::PathIsRelative(szDirectory)) {
						TCHAR szTemp[MAX_PATH];

						GetAppClass().GetAppDirectory(szTemp);
						::PathAppend(szTemp,szDirectory);
						::PathCanonicalize(szDirectory,szTemp);
					}
				} else {
					GetAppClass().GetAppDirectory(szDirectory);
				}
				if (BrowseFolderDialog(hDlg,szDirectory,TEXT("BonDriver の検索フォルダを選択してください。")))
					::SetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,szDirectory);
			}
			return TRUE;

		case IDC_OPTIONS_DEFAULTDRIVER_NONE:
		case IDC_OPTIONS_DEFAULTDRIVER_LAST:
		case IDC_OPTIONS_DEFAULTDRIVER_CUSTOM:
			EnableDlgItemsSyncCheckBox(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
									   IDC_OPTIONS_DEFAULTDRIVER_BROWSE,
									   IDC_OPTIONS_DEFAULTDRIVER_CUSTOM);
			return TRUE;

		case IDC_OPTIONS_DEFAULTDRIVER_BROWSE:
			{
				OPENFILENAME ofn;
				TCHAR szFileName[MAX_PATH],szInitDir[MAX_PATH];
				CFilePath FilePath;

				::GetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,szFileName,lengthof(szFileName));
				FilePath.SetPath(szFileName);
				if (FilePath.GetDirectory(szInitDir)) {
					::lstrcpy(szFileName,FilePath.GetFileName());
				} else {
					GetAppClass().GetAppDirectory(szInitDir);
				}
				InitOpenFileName(&ofn);
				ofn.hwndOwner=hDlg;
				ofn.lpstrFilter=
					TEXT("BonDriver(BonDriver*.dll)\0BonDriver*.dll\0")
					TEXT("すべてのファイル\0*.*\0");
				ofn.lpstrFile=szFileName;
				ofn.nMaxFile=lengthof(szFileName);
				ofn.lpstrInitialDir=szInitDir;
				ofn.lpstrTitle=TEXT("BonDriverの選択");
				ofn.Flags=OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER;
				if (FileOpenDialog(&ofn))
					::SetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,szFileName);
			}
			return TRUE;

		case IDC_OPTIONS_ENABLEJUMPLIST:
			EnableDlgItemSyncCheckBox(hDlg,
									  IDC_OPTIONS_JUMPLISTKEEPSINGLETASK,
									  IDC_OPTIONS_ENABLEJUMPLIST);
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				TCHAR szDirectory[MAX_PATH];
				::GetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,
								 szDirectory,lengthof(szDirectory));
				m_BonDriverDirectory=szDirectory;

				m_DefaultDriverType=(DefaultDriverType)
					(GetCheckedRadioButton(hDlg,IDC_OPTIONS_DEFAULTDRIVER_NONE,
										   IDC_OPTIONS_DEFAULTDRIVER_CUSTOM)-
					IDC_OPTIONS_DEFAULTDRIVER_NONE);

				TCHAR szDefaultBonDriver[MAX_PATH];
				::GetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
								 szDefaultBonDriver,lengthof(szDefaultBonDriver));
				m_DefaultBonDriverName=szDefaultBonDriver;

				bool fResident=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_RESIDENT);
				if (fResident!=m_fResident) {
					m_fResident=fResident;
					SetUpdateFlag(UPDATE_RESIDENT);
				}

				m_fKeepSingleTask=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_KEEPSINGLETASK);

				m_fStandaloneProgramGuide=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_STANDALONEPROGRAMGUIDE);

				bool fEnable1SegFallback=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ENABLE1SEGFALLBACK);
				if (fEnable1SegFallback!=m_fEnable1SegFallback) {
					m_fEnable1SegFallback=fEnable1SegFallback;
					SetUpdateFlag(UPDATE_1SEGFALLBACK);
				}

				if (Util::OS::IsWindows7OrLater()) {
					CTaskbarOptions &TaskbarOptions=GetAppClass().TaskbarOptions;

					TaskbarOptions.SetUseUniqueAppID(
						DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_USEUNIQUEAPPID));
					TaskbarOptions.SetEnableJumpList(
						DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ENABLEJUMPLIST));
					TaskbarOptions.SetJumpListKeepSingleTask(
						DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_JUMPLISTKEEPSINGLETASK));
					TaskbarOptions.SetChanged();
				}

				m_fChanged=true;
			}
			return TRUE;
		}
		break;
	}

	return FALSE;
}
Exemple #4
0
INT_PTR CLogger::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			HWND hwndList=GetDlgItem(hDlg,IDC_LOG_LIST);
			LVCOLUMN lvc;
			LVITEM lvi;

			ListView_SetExtendedListViewStyle(hwndList,LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
			lvc.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
			lvc.fmt=LVCFMT_LEFT;
			lvc.cx=80;
			lvc.pszText=TEXT("日時");
			ListView_InsertColumn(hwndList,0,&lvc);
			lvc.pszText=TEXT("内容");
			ListView_InsertColumn(hwndList,1,&lvc);

			lvi.iItem=0;
			lvi.mask=LVIF_TEXT;
			m_Lock.Lock();
			ListView_SetItemCount(hwndList,(int)m_LogList.size());
			for (auto itr=m_LogList.begin();itr!=m_LogList.end();++itr) {
				const CLogItem *pLogItem=*itr;
				TCHAR szTime[64];

				lvi.iSubItem=0;
				pLogItem->FormatTime(szTime,lengthof(szTime));
				lvi.pszText=szTime;
				ListView_InsertItem(hwndList,&lvi);
				lvi.iSubItem=1;
				lvi.pszText=const_cast<LPTSTR>(pLogItem->GetText());
				ListView_SetItem(hwndList,&lvi);
				lvi.iItem++;
			}
			for (int i=0;i<2;i++)
				ListView_SetColumnWidth(hwndList,i,LVSCW_AUTOSIZE_USEHEADER);
			if (!m_LogList.empty())
				ListView_EnsureVisible(hwndList,(int)m_LogList.size()-1,FALSE);
			m_Lock.Unlock();

			DlgCheckBox_Check(hDlg,IDC_LOG_OUTPUTTOFILE,m_fOutputToFile);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_LOG_CLEAR:
			ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_LOG_LIST));
			Clear();
			return TRUE;

		case IDC_LOG_COPY:
			CopyToClipboard(GetAppClass().GetUICore()->GetMainWindow());
			return TRUE;

		case IDC_LOG_SAVE:
			{
				TCHAR szFileName[MAX_PATH];

				GetDefaultLogFileName(szFileName);
				if (!SaveToFile(szFileName,false)) {
					::MessageBox(hDlg,TEXT("保存ができません。"),NULL,MB_OK | MB_ICONEXCLAMATION);
				} else {
					TCHAR szMessage[MAX_PATH+64];

					StdUtil::snprintf(szMessage,lengthof(szMessage),
									  TEXT("ログを \"%s\" に保存しました。"),szFileName);
					::MessageBox(hDlg,szMessage,TEXT("ログ保存"),MB_OK | MB_ICONINFORMATION);
				}
			}
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				bool fOutput=DlgCheckBox_IsChecked(hDlg,IDC_LOG_OUTPUTTOFILE);

				if (fOutput!=m_fOutputToFile) {
					CBlockLock Lock(&m_Lock);

					if (fOutput && m_LogList.size()>0) {
						TCHAR szFileName[MAX_PATH];

						GetDefaultLogFileName(szFileName);
						SaveToFile(szFileName,true);
					}
					m_fOutputToFile=fOutput;

					m_fChanged=true;
				}
			}
			return TRUE;
		}
		break;
	}

	return FALSE;
}
INT_PTR COperationOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_DISPLAYDRAGMOVE,m_fDisplayDragMove);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_HIDECURSOR,m_fHideCursor);

			InitWheelSettings(IDC_OPTIONS_WHEELMODE,m_WheelCommand);
			InitWheelSettings(IDC_OPTIONS_WHEELSHIFTMODE,m_WheelShiftCommand);
			InitWheelSettings(IDC_OPTIONS_WHEELCTRLMODE,m_WheelCtrlCommand);
			InitWheelSettings(IDC_OPTIONS_WHEELTILTMODE,m_WheelTiltCommand);

			DlgCheckBox_Check(hDlg,IDC_OPTIONS_WHEELVOLUMEREVERSE,m_fWheelVolumeReverse);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_WHEELCHANNELREVERSE,m_fWheelChannelReverse);
			DlgEdit_SetUInt(hDlg,IDC_OPTIONS_WHEELCHANNELDELAY,m_WheelChannelDelay);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_STATUSBARWHEEL,m_fStatusBarWheel);

			int LeftDoubleClick=0,RightClick=0,MiddleClick=0;
			for (int i=IDC_OPTIONS_MOUSECOMMAND_FIRST;i<=IDC_OPTIONS_MOUSECOMMAND_LAST;i++) {
				DlgComboBox_AddString(hDlg,i,TEXT("なし"));
				DlgComboBox_SetItemData(hDlg,i,0,0);
			}
			int NumCommands=m_pCommandList->NumCommands();
			for (int i=0;i<NumCommands;i++) {
				TCHAR szText[CCommandList::MAX_COMMAND_NAME];
				int Command=m_pCommandList->GetCommandID(i);

				m_pCommandList->GetCommandName(i,szText,lengthof(szText));
				for (int j=IDC_OPTIONS_MOUSECOMMAND_FIRST;j<=IDC_OPTIONS_MOUSECOMMAND_LAST;j++) {
					int Index=(int)DlgComboBox_AddString(hDlg,j,szText);
					DlgComboBox_SetItemData(hDlg,j,Index,Command);
				}
				if (Command==m_LeftDoubleClickCommand)
					LeftDoubleClick=i+1;
				if (Command==m_RightClickCommand)
					RightClick=i+1;
				if (Command==m_MiddleClickCommand)
					MiddleClick=i+1;
			}
			DlgComboBox_SetCurSel(hDlg,IDC_OPTIONS_LEFTDOUBLECLICKCOMMAND,LeftDoubleClick);
			DlgComboBox_SetCurSel(hDlg,IDC_OPTIONS_RIGHTCLICKCOMMAND,RightClick);
			DlgComboBox_SetCurSel(hDlg,IDC_OPTIONS_MIDDLECLICKCOMMAND,MiddleClick);

			DlgEdit_SetInt(hDlg,IDC_OPTIONS_VOLUMESTEP,m_VolumeStep);
			DlgUpDown_SetRange(hDlg,IDC_OPTIONS_VOLUMESTEP_UD,1,100);

			DlgEdit_SetInt(hDlg,IDC_OPTIONS_AUDIODELAYSTEP,m_AudioDelayStep);
			DlgUpDown_SetRange(hDlg,IDC_OPTIONS_AUDIODELAYSTEP_UD,1,1000);
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				m_fDisplayDragMove=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_DISPLAYDRAGMOVE);
				m_fHideCursor=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_HIDECURSOR);

				m_WheelCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_WHEELMODE,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_WHEELMODE));
				m_WheelShiftCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_WHEELSHIFTMODE,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_WHEELSHIFTMODE));
				m_WheelCtrlCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_WHEELCTRLMODE,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_WHEELCTRLMODE));
				m_WheelTiltCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_WHEELTILTMODE,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_WHEELTILTMODE));

				m_fWheelVolumeReverse=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_WHEELVOLUMEREVERSE);
				m_fWheelChannelReverse=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_WHEELCHANNELREVERSE);
				m_WheelChannelDelay=DlgEdit_GetUInt(hDlg,IDC_OPTIONS_WHEELCHANNELDELAY);
				if (m_WheelChannelDelay<WHEEL_CHANNEL_DELAY_MIN)
					m_WheelChannelDelay=WHEEL_CHANNEL_DELAY_MIN;
				m_fStatusBarWheel=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_STATUSBARWHEEL);

				m_LeftDoubleClickCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_LEFTDOUBLECLICKCOMMAND,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_LEFTDOUBLECLICKCOMMAND));
				m_RightClickCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_RIGHTCLICKCOMMAND,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_RIGHTCLICKCOMMAND));
				m_MiddleClickCommand=
					(int)DlgComboBox_GetItemData(hDlg,IDC_OPTIONS_MIDDLECLICKCOMMAND,
						DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_MIDDLECLICKCOMMAND));

				m_VolumeStep=DlgEdit_GetInt(hDlg,IDC_OPTIONS_VOLUMESTEP);
				m_AudioDelayStep=DlgEdit_GetInt(hDlg,IDC_OPTIONS_AUDIODELAYSTEP);

				m_fChanged=true;
			}
			break;
		}
		break;
	}

	return FALSE;
}
Exemple #6
0
INT_PTR CSideBarOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			DlgCheckBox_Check(hDlg,IDC_SIDEBAR_SHOWPOPUP,m_fShowPopup);

			::SendDlgItemMessage(hDlg,IDC_SIDEBAR_OPACITY_SLIDER,
								 TBM_SETRANGE,TRUE,MAKELPARAM(OPACITY_MIN,OPACITY_MAX));
			::SendDlgItemMessage(hDlg,IDC_SIDEBAR_OPACITY_SLIDER,
								 TBM_SETPOS,TRUE,m_PopupOpacity);
			::SendDlgItemMessage(hDlg,IDC_SIDEBAR_OPACITY_SLIDER,
								 TBM_SETPAGESIZE,0,10);
			::SendDlgItemMessage(hDlg,IDC_SIDEBAR_OPACITY_SLIDER,
								 TBM_SETTICFREQ,10,0);
			DlgEdit_SetInt(hDlg,IDC_SIDEBAR_OPACITY_INPUT,m_PopupOpacity);
			DlgUpDown_SetRange(hDlg,IDC_SIDEBAR_OPACITY_SPIN,OPACITY_MIN,OPACITY_MAX);
			EnableDlgItems(hDlg,IDC_SIDEBAR_OPACITY_LABEL,IDC_SIDEBAR_OPACITY_UNIT,
						   m_fShowPopup && Util::OS::IsWindows8OrLater());

			DlgCheckBox_Check(hDlg,IDC_SIDEBAR_SHOWTOOLTIPS,m_fShowToolTips);
			DlgCheckBox_Check(hDlg,IDC_SIDEBAR_SHOWCHANNELLOGO,m_fShowChannelLogo);

			const COLORREF IconColor=::GetSysColor(COLOR_WINDOWTEXT);
			const int IconWidth=::GetSystemMetrics(SM_CXSMICON);
			const int IconHeight=::GetSystemMetrics(SM_CYSMICON);
			SIZE sz;
			HBITMAP hbmIcons=CreateImage(IconWidth<=16 && IconHeight<=16?ICON_SIZE_SMALL:ICON_SIZE_BIG,&sz);
			TVTest::Theme::IconList Bitmap;
			Bitmap.Create(hbmIcons,sz.cx,sz.cy,IconWidth,IconHeight);
			::DeleteObject(hbmIcons);
			m_himlIcons=Bitmap.CreateImageList(IconColor);
			Bitmap.Destroy();

			m_IconIDMap.clear();
			for (int i=0;i<lengthof(ItemList);i++)
				m_IconIDMap.insert(std::pair<int,int>(ItemList[i].Command,ItemList[i].Icon));
			const CCommandList *pCommandList=m_pSideBar->GetCommandList();
			for (size_t i=lengthof(ItemList);i<m_AvailItemList.size();i++) {
				const int ID=m_AvailItemList[i].Command;
				if (ID>=CM_PLUGIN_FIRST && ID<=CM_PLUGIN_LAST) {
					CPlugin *pPlugin=GetAppClass().PluginManager.GetPluginByCommand(ID);
					if (pPlugin!=NULL && pPlugin->GetIcon().IsCreated()) {
						HICON hIcon=pPlugin->GetIcon().ExtractIcon(IconColor);
						if (hIcon!=NULL) {
							int Icon=ImageList_AddIcon(m_himlIcons,hIcon);
							::DestroyIcon(hIcon);
							m_IconIDMap.insert(std::pair<int,int>(ID,Icon));
						}
					}
				} else if (ID>=CM_PLUGINCOMMAND_FIRST && ID<=CM_PLUGINCOMMAND_LAST) {
					LPCTSTR pszCommand;
					CPlugin *pPlugin=GetAppClass().PluginManager.GetPluginByPluginCommand(
						pCommandList->GetCommandTextByID(ID),&pszCommand);
					if (pPlugin!=NULL) {
						CPlugin::CPluginCommandInfo *pCommandInfo=
							pPlugin->GetPluginCommandInfo(pszCommand);
						if (pCommandInfo!=NULL && pCommandInfo->GetIcon().IsCreated()) {
							HICON hIcon=pCommandInfo->GetIcon().ExtractIcon(IconColor);
							if (hIcon!=NULL) {
								int Icon=ImageList_AddIcon(m_himlIcons,hIcon);
								::DestroyIcon(hIcon);
								m_IconIDMap.insert(std::pair<int,int>(ID,Icon));
							}
						}
					}
				}
			}

			HWND hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST);
			ListView_SetExtendedListViewStyle(hwndList,LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
			ListView_SetImageList(hwndList,m_himlIcons,LVSIL_SMALL);
			RECT rc;
			::GetClientRect(hwndList,&rc);
			rc.right-=::GetSystemMetrics(SM_CXVSCROLL);
			LVCOLUMN lvc;
			lvc.mask=LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
			lvc.fmt=LVCFMT_LEFT;
			lvc.cx=rc.right;
			lvc.iSubItem=0;
			ListView_InsertColumn(hwndList,0,&lvc);
			SetItemList(hwndList,&m_ItemList[0],(int)m_ItemList.size());
			hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_COMMANDLIST);
			ListView_SetExtendedListViewStyle(hwndList,LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
			ListView_SetImageList(hwndList,m_himlIcons,LVSIL_SMALL);
			::GetClientRect(hwndList,&rc);
			rc.right-=::GetSystemMetrics(SM_CXVSCROLL);
			lvc.cx=rc.right;
			ListView_InsertColumn(hwndList,0,&lvc);
			std::vector<int> List;
			List.resize(m_AvailItemList.size());
			for (size_t i=0;i<m_AvailItemList.size();i++)
				List[i]=m_AvailItemList[i].Command;
			SetItemList(hwndList,List.data(),(int)List.size());
		}
		return TRUE;

	case WM_HSCROLL:
		if (reinterpret_cast<HWND>(lParam)==::GetDlgItem(hDlg,IDC_SIDEBAR_OPACITY_SLIDER)) {
			SyncEditWithTrackBar(hDlg,
								 IDC_SIDEBAR_OPACITY_SLIDER,
								 IDC_SIDEBAR_OPACITY_INPUT);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_SIDEBAR_SHOWPOPUP:
			EnableDlgItems(hDlg,IDC_SIDEBAR_OPACITY_LABEL,IDC_SIDEBAR_OPACITY_UNIT,
				DlgCheckBox_IsChecked(hDlg,IDC_SIDEBAR_SHOWPOPUP) && Util::OS::IsWindows8OrLater());
			return TRUE;

		case IDC_SIDEBAR_OPACITY_INPUT:
			if (HIWORD(wParam)==EN_CHANGE) {
				SyncTrackBarWithEdit(hDlg,
									 IDC_SIDEBAR_OPACITY_INPUT,
									 IDC_SIDEBAR_OPACITY_SLIDER);
			}
			return TRUE;

		case IDC_SIDEBAR_UP:
		case IDC_SIDEBAR_DOWN:
			{
				bool fUp=LOWORD(wParam)==IDC_SIDEBAR_UP;
				HWND hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST);
				int Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);

				if ((fUp && Sel>0) || (!fUp && Sel<ListView_GetItemCount(hwndList)-1)) {
					LVITEM lvi;
					TCHAR szText[CCommandList::MAX_COMMAND_TEXT];

					lvi.mask=LVIF_STATE | LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
					lvi.iItem=Sel;
					lvi.iSubItem=0;
					lvi.stateMask=~0U;
					lvi.pszText=szText;
					lvi.cchTextMax=lengthof(szText);
					ListView_GetItem(hwndList,&lvi);
					ListView_DeleteItem(hwndList,Sel);
					if (fUp)
						lvi.iItem--;
					else
						lvi.iItem++;
					ListView_InsertItem(hwndList,&lvi);
				}
			}
			return TRUE;

		case IDC_SIDEBAR_REMOVE:
			{
				HWND hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST);
				int Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);

				if (Sel>=0)
					ListView_DeleteItem(hwndList,Sel);
			}
			return TRUE;

		case IDC_SIDEBAR_DEFAULT:
			SetItemList(::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST),
						DefaultItemList,lengthof(DefaultItemList));
			return TRUE;

		case IDC_SIDEBAR_ADD:
			{
				HWND hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_COMMANDLIST);
				int Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);

				if (Sel>=0) {
					LVITEM lvi;
					TCHAR szText[CCommandList::MAX_COMMAND_TEXT];

					lvi.mask=LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
					lvi.iItem=Sel;
					lvi.iSubItem=0;
					lvi.pszText=szText;
					lvi.cchTextMax=lengthof(szText);
					ListView_GetItem(hwndList,&lvi);
					hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST);
					Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);
					lvi.iItem=Sel>=0?Sel:ListView_GetItemCount(hwndList);
					lvi.state=LVIS_SELECTED | LVIS_FOCUSED;
					lvi.stateMask=LVIS_SELECTED | LVIS_FOCUSED;
					ListView_InsertItem(hwndList,&lvi);
				}
			}
			return TRUE;

		case IDC_SIDEBAR_SEPARATOR:
			{
				HWND hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST);
				int Sel=ListView_GetNextItem(hwndList,-1,LVNI_SELECTED);
				LVITEM lvi;

				lvi.mask=LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
				lvi.iItem=Sel>=0?Sel:ListView_GetItemCount(hwndList);
				lvi.iSubItem=0;
				lvi.pszText=TEXT("(区切り)");
				lvi.iImage=-1;
				lvi.lParam=ITEM_SEPARATOR;
				ListView_InsertItem(hwndList,&lvi);
			}
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case LVN_ITEMCHANGED:
			{
				LPNMLISTVIEW pnmlv=reinterpret_cast<LPNMLISTVIEW>(lParam);
				int Sel=ListView_GetNextItem(pnmlv->hdr.hwndFrom,-1,LVNI_SELECTED);

				if (pnmlv->hdr.idFrom==IDC_SIDEBAR_ITEMLIST) {
					EnableDlgItem(hDlg,IDC_SIDEBAR_UP,Sel>0);
					EnableDlgItem(hDlg,IDC_SIDEBAR_DOWN,Sel>=0 && Sel<ListView_GetItemCount(pnmlv->hdr.hwndFrom)-1);
					EnableDlgItem(hDlg,IDC_SIDEBAR_REMOVE,Sel>=0);
				} else {
					EnableDlgItem(hDlg,IDC_SIDEBAR_ADD,Sel>=0);
				}
			}
			break;

		case NM_RCLICK:
			{
				LPNMITEMACTIVATE pnmia=reinterpret_cast<LPNMITEMACTIVATE>(lParam);

				if (pnmia->hdr.idFrom==IDC_SIDEBAR_ITEMLIST) {
					if (pnmia->iItem>=0) {
						static const int MenuIDs[] = {
							IDC_SIDEBAR_UP,
							IDC_SIDEBAR_DOWN,
							0,
							IDC_SIDEBAR_REMOVE,
						};
						PopupMenuFromControls(hDlg,MenuIDs,lengthof(MenuIDs),TPM_RIGHTBUTTON);
					}
				} else {
					if (pnmia->iItem>=0) {
						static const int MenuIDs[] = {
							IDC_SIDEBAR_ADD,
						};
						PopupMenuFromControls(hDlg,MenuIDs,lengthof(MenuIDs),TPM_RIGHTBUTTON);
					}
				}
			}
			break;

		case PSN_APPLY:
			{
				m_fShowPopup=DlgCheckBox_IsChecked(hDlg,IDC_SIDEBAR_SHOWPOPUP);
				if (Util::OS::IsWindows8OrLater()) {
					int Opacity=DlgEdit_GetInt(hDlg,IDC_SIDEBAR_OPACITY_INPUT);
					m_PopupOpacity=CLAMP(Opacity,OPACITY_MIN,OPACITY_MAX);
				}
				m_fShowToolTips=DlgCheckBox_IsChecked(hDlg,IDC_SIDEBAR_SHOWTOOLTIPS);
				m_pSideBar->ShowToolTips(m_fShowToolTips);
				bool fShowChannelLogo=DlgCheckBox_IsChecked(hDlg,IDC_SIDEBAR_SHOWCHANNELLOGO);
				if (m_fShowChannelLogo!=fShowChannelLogo) {
					m_fShowChannelLogo=fShowChannelLogo;
					m_pSideBar->Invalidate();
				}

				HWND hwndList=::GetDlgItem(hDlg,IDC_SIDEBAR_ITEMLIST);
				std::vector<int> ItemList;
				int i,Count;
				LVITEM lvi;

				Count=ListView_GetItemCount(hwndList);
				lvi.mask=LVIF_PARAM;
				lvi.iSubItem=0;
				for (i=0;i<Count;i++) {
					lvi.iItem=i;
					ListView_GetItem(hwndList,&lvi);
					ItemList.push_back((int)lvi.lParam);
				}
				if (ItemList!=m_ItemList) {
					m_ItemList=ItemList;

					const CCommandList *pCommandList=m_pSideBar->GetCommandList();
					m_ItemNameList.clear();
					for (int i=0;i<Count;i++) {
						const int ID=m_ItemList[i];
						if (ID==ITEM_SEPARATOR) {
							m_ItemNameList.push_back(TVTest::String());
						} else {
							m_ItemNameList.push_back(TVTest::String(pCommandList->GetCommandTextByID(ID)));
						}
					}

					ApplyItemList();
				}

				m_fChanged=true;
			}
			break;
		}
		break;

	case WM_DESTROY:
		if (m_himlIcons!=NULL) {
			::ImageList_Destroy(m_himlIcons);
			m_himlIcons=NULL;
		}
		m_IconIDMap.clear();
		return TRUE;
	}

	return FALSE;
}
Exemple #7
0
INT_PTR CPanelOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			DlgCheckBox_Check(hDlg,IDC_PANELOPTIONS_SNAPATMAINWINDOW,
												m_fSnapAtMainWindow);
			DlgCheckBox_Check(hDlg,IDC_PANELOPTIONS_ATTACHTOMAINWINDOW,
												m_fAttachToMainWindow);

			// Opacity
			::SendDlgItemMessage(hDlg,IDC_PANELOPTIONS_OPACITY_TB,
										TBM_SETRANGE,TRUE,MAKELPARAM(20,100));
			::SendDlgItemMessage(hDlg,IDC_PANELOPTIONS_OPACITY_TB,
										TBM_SETPOS,TRUE,m_Opacity);
			::SendDlgItemMessage(hDlg,IDC_PANELOPTIONS_OPACITY_TB,
										TBM_SETPAGESIZE,0,10);
			::SendDlgItemMessage(hDlg,IDC_PANELOPTIONS_OPACITY_TB,
										TBM_SETTICFREQ,10,0);
			::SetDlgItemInt(hDlg,IDC_PANELOPTIONS_OPACITY_EDIT,m_Opacity,TRUE);
			::SendDlgItemMessage(hDlg,IDC_PANELOPTIONS_OPACITY_UD,
										UDM_SETRANGE,0,MAKELPARAM(100,20));

			m_CurSettingFont=m_Font;
			SetFontInfo(hDlg,IDC_PANELOPTIONS_FONTINFO,&m_Font);
			DlgCheckBox_Check(hDlg,IDC_PANELOPTIONS_SPECCAPTIONFONT,m_fSpecCaptionFont);
			EnableDlgItems(hDlg,IDC_PANELOPTIONS_CAPTIONFONT_INFO,
						   IDC_PANELOPTIONS_CAPTIONFONT_CHOOSE,
						   m_fSpecCaptionFont);
			m_CurSettingCaptionFont=m_CaptionFont;
			SetFontInfo(hDlg,IDC_PANELOPTIONS_CAPTIONFONT_INFO,&m_CaptionFont);

			m_ItemListView.Attach(::GetDlgItem(hDlg,IDC_PANELOPTIONS_ITEMLIST));
			m_ItemListView.InitCheckList();
			PanelItemInfoList ItemList(m_ItemList);
			for (size_t i=0;i<m_AvailItemList.size();i++) {
				const TVTest::String &ID=m_AvailItemList[i].ID;
				if (std::find_if(ItemList.begin(),ItemList.end(),
						[&](const PanelItemInfo &Item) -> bool {
							return CompareID(Item.ID,ID); })==ItemList.end()) {
					PanelItemInfo Item;
					Item.ID=ID;
					Item.fVisible=m_AvailItemList[i].fVisible;
					ItemList.push_back(Item);
				}
			}
			int ItemCount=0;
			for (int i=0;i<(int)ItemList.size();i++) {
				const PanelItemInfo &Item=ItemList[i];
				int ID=GetItemIDFromIDText(Item.ID);
				if (ID>=0) {
					m_ItemListView.InsertItem(ItemCount,m_AvailItemList[ID].Title.c_str(),ID);
					m_ItemListView.CheckItem(ItemCount,Item.fVisible);
					ItemCount++;
				}
			}
			UpdateItemListControlsState();

			DlgComboBox_AddString(hDlg,IDC_PANELOPTIONS_FIRSTTAB,TEXT("最後に表示したタブ"));
			int Sel=0;
			if (!m_InitialTab.empty()) {
				LPTSTR p;
				long IDNum=std::_tcstol(m_InitialTab.c_str(),&p,10);
				if (*p==_T('\0')) {
					if (IDNum>=0 && (size_t)IDNum<m_AvailItemList.size())
						Sel=IDNum+1;
				}
			}
			for (size_t i=0;i<m_AvailItemList.size();i++) {
				DlgComboBox_AddString(hDlg,IDC_PANELOPTIONS_FIRSTTAB,m_AvailItemList[i].Title.c_str());
				if (Sel==0 && CompareID(m_AvailItemList[i].ID,m_InitialTab))
					Sel=(int)i+1;
			}
			DlgComboBox_SetCurSel(hDlg,IDC_PANELOPTIONS_FIRSTTAB,Sel);

			static const LPCTSTR TabStyleList[] = {
				TEXT("文字のみ"),
				TEXT("アイコンのみ"),
				TEXT("アイコンと文字"),
			};
			for (int i=0;i<lengthof(TabStyleList);i++)
				DlgComboBox_AddString(hDlg,IDC_PANELOPTIONS_TABSTYLE,TabStyleList[i]);
			DlgComboBox_SetCurSel(hDlg,IDC_PANELOPTIONS_TABSTYLE,(int)m_TabStyle);

			DlgCheckBox_Check(hDlg,IDC_PANELOPTIONS_TABTOOLTIP,m_fTabTooltip);
		}
		return TRUE;

	case WM_HSCROLL:
		if (reinterpret_cast<HWND>(lParam)==
				::GetDlgItem(hDlg,IDC_PANELOPTIONS_OPACITY_TB)) {
			SyncEditWithTrackBar(hDlg,IDC_PANELOPTIONS_OPACITY_TB,
									  IDC_PANELOPTIONS_OPACITY_EDIT);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_PANELOPTIONS_OPACITY_EDIT:
			if (HIWORD(wParam)==EN_CHANGE)
				SyncTrackBarWithEdit(hDlg,IDC_PANELOPTIONS_OPACITY_EDIT,
										  IDC_PANELOPTIONS_OPACITY_TB);
			return TRUE;

		case IDC_PANELOPTIONS_ITEMLIST_UP:
		case IDC_PANELOPTIONS_ITEMLIST_DOWN:
			{
				int From=m_ItemListView.GetSelectedItem(),To;

				if (LOWORD(wParam)==IDC_PANELOPTIONS_ITEMLIST_UP)
					To=From-1;
				else
					To=From+1;
				if (To<0 || To>=m_ItemListView.GetItemCount())
					return TRUE;
				m_ItemListView.MoveItem(From,To);
				UpdateItemListControlsState();
			}
			return TRUE;

		case IDC_PANELOPTIONS_CHOOSEFONT:
			if (ChooseFontDialog(hDlg,&m_CurSettingFont))
				SetFontInfo(hDlg,IDC_PANELOPTIONS_FONTINFO,&m_CurSettingFont);
			return TRUE;

		case IDC_PANELOPTIONS_SPECCAPTIONFONT:
			EnableDlgItemsSyncCheckBox(hDlg,IDC_PANELOPTIONS_CAPTIONFONT_INFO,
									   IDC_PANELOPTIONS_CAPTIONFONT_CHOOSE,
									   IDC_PANELOPTIONS_SPECCAPTIONFONT);
			return TRUE;

		case IDC_PANELOPTIONS_CAPTIONFONT_CHOOSE:
			if (ChooseFontDialog(hDlg,&m_CurSettingCaptionFont))
				SetFontInfo(hDlg,IDC_PANELOPTIONS_CAPTIONFONT_INFO,&m_CurSettingCaptionFont);
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				CMainPanel &Panel=GetAppClass().Panel;

				m_fSnapAtMainWindow=
					DlgCheckBox_IsChecked(hDlg,IDC_PANELOPTIONS_SNAPATMAINWINDOW);
				m_fAttachToMainWindow=
					DlgCheckBox_IsChecked(hDlg,IDC_PANELOPTIONS_ATTACHTOMAINWINDOW);
				m_Opacity=::GetDlgItemInt(hDlg,IDC_PANELOPTIONS_OPACITY_EDIT,NULL,TRUE);
				Panel.Frame.SetPanelOpacity(m_Opacity*255/100);

				bool fFontChanged=!CompareLogFont(&m_Font,&m_CurSettingFont);
				if (fFontChanged) {
					m_Font=m_CurSettingFont;
					Panel.Form.SetTabFont(&m_Font);
					Panel.Form.SetPageFont(&m_Font);
				}

				bool fChangeCaptionFont=false;
				bool fSpecCaptionFont=DlgCheckBox_IsChecked(hDlg,IDC_PANELOPTIONS_SPECCAPTIONFONT);
				if (m_fSpecCaptionFont!=fSpecCaptionFont) {
					m_fSpecCaptionFont=fSpecCaptionFont;
					fChangeCaptionFont=true;
				}
				if (!CompareLogFont(&m_CaptionFont,&m_CurSettingCaptionFont)) {
					m_CaptionFont=m_CurSettingCaptionFont;
					if (m_fSpecCaptionFont)
						fChangeCaptionFont=true;
				} else if (m_fSpecCaptionFont && fFontChanged) {
					fChangeCaptionFont=true;
				}
				if (fChangeCaptionFont) {
					CPanelForm::CPage *pCaptionPanel=Panel.Form.GetPageByID(PANEL_ID_CAPTION);
					if (pCaptionPanel!=NULL)
						pCaptionPanel->SetFont(m_fSpecCaptionFont?
											   &m_CaptionFont:&m_Font);
				}

				const int ItemCount=m_ItemListView.GetItemCount();
				m_ItemList.clear();
				m_ItemList.resize(ItemCount);
				for (int i=0;i<ItemCount;i++) {
					const PanelItemInfo &ItemInfo=m_AvailItemList[m_ItemListView.GetItemParam(i)];
					m_ItemList[i].ID=ItemInfo.ID;
					m_ItemList[i].fVisible=m_ItemListView.IsItemChecked(i);
				}
				ApplyItemList(&Panel.Form);

				int InitialTab=(int)DlgComboBox_GetCurSel(hDlg,IDC_PANELOPTIONS_FIRSTTAB);
				if (InitialTab==0) {
					m_InitialTab.clear();
				} else if (InitialTab>0) {
					m_InitialTab=m_AvailItemList[InitialTab-1].ID;
				}

				int TabStyleSel=(int)DlgComboBox_GetCurSel(hDlg,IDC_PANELOPTIONS_TABSTYLE);
				if (TabStyleSel>=0) {
					m_TabStyle=static_cast<CPanelForm::TabStyle>(TabStyleSel);
					Panel.Form.SetTabStyle(m_TabStyle);
				}

				m_fTabTooltip=
					DlgCheckBox_IsChecked(hDlg,IDC_PANELOPTIONS_TABTOOLTIP);
				Panel.Form.EnableTooltip(m_fTabTooltip);

				m_fChanged=true;
			}
			break;

		case LVN_ITEMCHANGED:
			UpdateItemListControlsState();
			return TRUE;
		}
		break;

	case WM_DESTROY:
		m_ItemListView.Detach();
		return TRUE;
	}

	return FALSE;
}
Exemple #8
0
INT_PTR CViewOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			// ウィンドウ設定
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_SNAPATWINDOWEDGE,
							  m_fSnapAtWindowEdge);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_ADJUSTASPECTRESIZING,
							  m_fAdjustAspectResizing);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NEARCORNERRESIZEORIGIN,
							  m_fNearCornerResizeOrigin);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_ZOOMKEEPASPECTRATIO,m_fZoomKeepAspectRatio);
			{
				static const LPCTSTR AdjustWindowModeList[] = {
					TEXT("サイズを変えない"),
					TEXT("幅のみ変える"),
					TEXT("幅と高さを変える"),
				};
				for (int i=0;i<lengthof(AdjustWindowModeList);i++) {
					DlgComboBox_AddString(hDlg,IDC_OPTIONS_PANSCANADJUSTWINDOW,
										  AdjustWindowModeList[i]);
				}
				DlgComboBox_SetCurSel(hDlg,IDC_OPTIONS_PANSCANADJUSTWINDOW,
									  m_PanScanAdjustWindowMode);
			}
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_REMEMBER1SEGWINDOWSIZE,m_fRemember1SegWindowSize);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_MINIMIZETOTRAY,m_fMinimizeToTray);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_MINIMIZEDISABLEPREVIEW,
							  m_fDisablePreviewWhenMinimized);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_USELOGOICON,
							  m_fUseLogoIcon);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_SHOWTITLEEVENTTIME,
							  m_fShowTitleEventTime);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_SHOWLOGO,m_fShowLogo);
			::SetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,m_szLogoFileName);
			::SendDlgItemMessage(hDlg,IDC_OPTIONS_LOGOFILENAME,EM_LIMITTEXT,MAX_PATH-1,0);
			::EnableDlgItems(hDlg,IDC_OPTIONS_LOGOFILENAME,IDC_OPTIONS_LOGOFILENAME_BROWSE,
							 m_fShowLogo);

			// 抑止設定
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NOSCREENSAVER,m_fNoScreenSaver);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NOMONITORLOWPOWER,m_fNoMonitorLowPower);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY,
							  m_fNoMonitorLowPowerActiveOnly);
			EnableDlgItem(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY,m_fNoMonitorLowPower);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_OPTIONS_SHOWLOGO:
			EnableDlgItemsSyncCheckBox(hDlg,IDC_OPTIONS_LOGOFILENAME,IDC_OPTIONS_LOGOFILENAME_BROWSE,
									   IDC_OPTIONS_SHOWLOGO);
			return TRUE;

		case IDC_OPTIONS_LOGOFILENAME_BROWSE:
			{
				OPENFILENAME ofn;
				TCHAR szFileName[MAX_PATH],szInitDir[MAX_PATH];
				CFilePath FilePath;

				::GetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,szFileName,lengthof(szFileName));
				FilePath.SetPath(szFileName);
				if (FilePath.GetDirectory(szInitDir)) {
					::lstrcpy(szFileName,FilePath.GetFileName());
				} else {
					GetAppClass().GetAppDirectory(szInitDir);
				}
				InitOpenFileName(&ofn);
				ofn.hwndOwner=hDlg;
				ofn.lpstrFilter=
					TEXT("BMPファイル(*.bmp)\0*.bmp\0")
					TEXT("すべてのファイル\0*.*\0");
				ofn.lpstrFile=szFileName;
				ofn.nMaxFile=lengthof(szFileName);
				ofn.lpstrInitialDir=szInitDir;
				ofn.lpstrTitle=TEXT("ロゴ画像の選択");
				ofn.Flags=OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER;
				if (::GetOpenFileName(&ofn)) {
					::SetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,szFileName);
				}
			}
			return TRUE;

		case IDC_OPTIONS_NOMONITORLOWPOWER:
			EnableDlgItemSyncCheckBox(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY,
									  IDC_OPTIONS_NOMONITORLOWPOWER);
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				CAppMain &App=GetAppClass();
				bool f;

				m_fSnapAtWindowEdge=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_SNAPATWINDOWEDGE);
				m_fAdjustAspectResizing=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ADJUSTASPECTRESIZING);
				m_fNearCornerResizeOrigin=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NEARCORNERRESIZEORIGIN);
				m_fZoomKeepAspectRatio=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ZOOMKEEPASPECTRATIO);
				m_PanScanAdjustWindowMode=(AdjustWindowMode)
					DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_PANSCANADJUSTWINDOW);
				m_fRemember1SegWindowSize=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_REMEMBER1SEGWINDOWSIZE);
				m_fMinimizeToTray=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_MINIMIZETOTRAY);
				m_fDisablePreviewWhenMinimized=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_MINIMIZEDISABLEPREVIEW);
				f=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_USELOGOICON);
				if (m_fUseLogoIcon!=f) {
					m_fUseLogoIcon=f;
					App.UICore.UpdateIcon();
				}
				f=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_SHOWTITLEEVENTTIME);
				if (m_fShowTitleEventTime!=f) {
					m_fShowTitleEventTime=f;
					App.UICore.UpdateTitle();
				}
				{
					bool fLogo=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_SHOWLOGO);
					TCHAR szFileName[MAX_PATH];

					::GetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,szFileName,MAX_PATH);
					if (fLogo!=m_fShowLogo
							|| ::lstrcmp(szFileName,m_szLogoFileName)!=0) {
						m_fShowLogo=fLogo;
						::lstrcpy(m_szLogoFileName,szFileName);
						SetUpdateFlag(UPDATE_LOGO);
					}
				}

				m_fNoScreenSaver=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NOSCREENSAVER);
				m_fNoMonitorLowPower=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NOMONITORLOWPOWER);
				m_fNoMonitorLowPowerActiveOnly=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY);
				App.UICore.PreventDisplaySave(true);

				m_fChanged=true;
			}
			break;
		}
		break;
	}

	return FALSE;
}