示例#1
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;
}
示例#2
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;
}