void CConfRightDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) { int nSel; CRect r; CWnd* pNewPage; CuPageInformation* pPageInfo; CWnd* pParent1 = GetParent(); // The view: CConfViewRight ASSERT (pParent1); CSplitterWnd* pParent2 = (CSplitterWnd*)pParent1->GetParent(); // The Splitter ASSERT (pParent2); CConfigFrame* pFrame = (CConfigFrame*)pParent2->GetParent(); // The Frame Window ASSERT (pFrame); if (!pFrame->IsAllViewsCreated()) return; if (!m_pCurrentProperty) return; CWaitCursor waitCursor; m_cTab1.GetClientRect (r); m_cTab1.AdjustRect (FALSE, r); nSel = m_cTab1.GetCurSel(); m_pCurrentProperty->SetCurSel(nSel); pPageInfo = m_pCurrentProperty->GetPageInfo(); try { pNewPage = GetPage (pPageInfo->GetDlgID (nSel)); if (!pNewPage) return; } catch (CMemoryException* e) { VCBF_OutOfMemoryMessage(); e->Delete(); return; } catch (CResourceException* e) { AfxMessageBox (_T("Fail to load resource")); e->Delete(); return; } if (m_pCurrentPage) { // // Try to save (and validate) the data that has been changed // in the old page before displaying a new page. m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem()); m_pCurrentPage->ShowWindow (SW_HIDE); } m_pCurrentPage = pNewPage; m_pCurrentPage->MoveWindow (r); m_pCurrentPage->ShowWindow(SW_SHOW); m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, 0, (LPARAM)pPageInfo->GetCbfItem()); *pResult = 0; }
BOOL CuDlgIpmTabCtrl::ChangeTab() { int nSel; CRect r; CWnd* pNewPage; CuPageInformation* pPageInfo; CWnd* pParent1 = GetParent(); // The view: CImView2 ASSERT (pParent1); CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame(); // The Frame Window ASSERT (pFrame); CdIpmDoc* pDoc = (CdIpmDoc*)((CView*)pParent1)->GetDocument(); ASSERT (pDoc); if (!pFrame->IsAllViewCreated()) return FALSE; if (!m_pCurrentProperty) return FALSE; CWaitCursor doWaitCursor; m_cTab1.GetClientRect (r); m_cTab1.AdjustRect (FALSE, r); nSel = m_cTab1.GetCurSel(); m_pCurrentProperty->SetCurSel(nSel); pPageInfo = m_pCurrentProperty->GetPageInfo(); try { pNewPage = GetPage (pPageInfo->GetDlgID (nSel)); } catch (CMemoryException* e) { theApp.OutOfMemoryMessage(); e->Delete(); return FALSE; } catch (CResourceException* e) { AfxMessageBox (IDS_E_LOAD_RESOURCE);//"Fail to load resource" e->Delete(); return FALSE; } if (m_pCurrentPage) m_pCurrentPage->ShowWindow (SW_HIDE); m_pCurrentPage = pNewPage; m_pCurrentPage->MoveWindow (r); m_pCurrentPage->ShowWindow(SW_SHOW); // // Properties: UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID; m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (WPARAM)nMask, (LPARAM)&(pDoc->GetProperty())); // // Update Data: m_pCurrentPage->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)pDoc, (LPARAM)pPageInfo->GetUpdateParam()); return TRUE; }
UINT CuDlgIpmTabCtrl::GetCurrentPageID() { if (!m_pCurrentProperty) return 0; CuPageInformation* pPageInfo = m_pCurrentProperty->GetPageInfo(); if (!pPageInfo) return 0; if (pPageInfo->GetNumberOfPage() == 0) return 0; UINT* pArrayID = pPageInfo->GetDlgID(); if (!pArrayID) return 0; int index = m_pCurrentProperty->GetCurSel(); if (index >= 0 && index < pPageInfo->GetNumberOfPage()) return pArrayID [index]; return 0; }
void CuDlgIpmTabCtrl::LoadPage (CuIpmProperty* pCurrentProperty) { CRect r; TC_ITEM item; int i, nPages; UINT* nTabID; UINT* nDlgID; CString strTab; CString strTitle; UINT nIDD; CWnd* pDlg; CuPageInformation* pPageInfo = NULL; if (m_pCurrentProperty) { m_pCurrentProperty->SetPageInfo (NULL); delete m_pCurrentProperty; } pPageInfo = pCurrentProperty->GetPageInfo(); m_pCurrentProperty = new CuIpmProperty (pCurrentProperty->GetCurSel(), pPageInfo); // // Set up the Title: pPageInfo->GetTitle (strTitle); m_staticHeader.SetWindowText (strTitle); UINT uFlags = SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER; if (!strTitle.IsEmpty()) { switch (pPageInfo->GetImageType()) { case 0: m_staticHeader.ResetBitmap (pPageInfo->GetIconImage()); break; case 1: m_staticHeader.ResetBitmap (pPageInfo->GetBitmapImage(), pPageInfo->GetImageMask()); break; default: m_staticHeader.ResetBitmap (NULL); } } else m_staticHeader.ResetBitmap (NULL); m_staticHeader.SetWindowPos(NULL, 0, 0, 0, 0, uFlags); nPages = pPageInfo->GetNumberOfPage(); if (nPages < 1) { m_pCurrentPage = NULL; return; } // // Construct the Tab(s) nTabID = pPageInfo->GetTabID(); nDlgID = pPageInfo->GetDlgID(); memset (&item, 0, sizeof (item)); item.mask = TCIF_TEXT; item.cchTextMax = 32; m_cTab1.DeleteAllItems(); for (i=0; i<nPages; i++) { strTab.LoadString (nTabID [i]); item.pszText = (LPTSTR)(LPCTSTR)strTab; m_cTab1.InsertItem (i, &item); } // // Display the selected page. nIDD = pPageInfo->GetDlgID (pCurrentProperty->GetCurSel()); pDlg = GetPage (nIDD); m_cTab1.SetCurSel (pCurrentProperty->GetCurSel()); m_cTab1.GetClientRect (r); m_cTab1.AdjustRect (FALSE, r); pDlg->MoveWindow (r); pDlg->ShowWindow(SW_SHOW); m_pCurrentPage = pDlg; // // Display the content (data) of this page. CuIpmPropertyData* pData = pCurrentProperty->GetPropertyData(); pData->NotifyLoad (m_pCurrentPage); // // Properties: CView* pView = (CView*)GetParent(); ASSERT (pView); CdIpmDoc* pDoc = (CdIpmDoc*)pView->GetDocument(); ASSERT (pDoc); if (pDoc) { UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID; m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (WPARAM)nMask, (LPARAM)&(pDoc->GetProperty())); } }
UINT CConfigFrame::GetHelpID() { ASSERT (m_bAllViewCreated == TRUE); CConfRightDlg* pConfigRightDlg = GetCConfRightDlg(); CConfLeftDlg* pConfigLeftDlg = GetCConfLeftDlg(); ASSERT (pConfigLeftDlg); if (!pConfigLeftDlg) return 0; HTREEITEM hTreeItem = pConfigLeftDlg->m_tree_ctrl.GetSelectedItem(); // // Nothing has been selected in the left pane, the help is the one // of the left pane: if (!hTreeItem) return IDD_CONFIG_LEFT; // // If there is a selected item in the left pane, then check to see // if there is no pane in the right side, if so we must handle the special case: CuPageInformation* pPageInfo = NULL; CuCbfListViewItem* pItem = (CuCbfListViewItem*)pConfigLeftDlg->m_tree_ctrl.GetItemData (hTreeItem); if (!pItem) return IDD_CONFIG_LEFT; if (pItem && pItem->GetPageInformation() && pItem->GetPageInformation()->GetNumberOfPage() == 0) { // // No page in the right pane: pPageInfo = pItem->GetPageInformation(); if (pPageInfo->GetClassName().CompareNoCase (_T("RECOVER")) == 0) return IDHELP_RECOVER; if (pPageInfo->GetClassName().CompareNoCase (_T("ARCHIVE")) == 0) return IDHELP_ACHIVER; if (pPageInfo->GetClassName().CompareNoCase (_T("RMCMD")) == 0) return IDHELP_RMCMD; } UINT nIDHelp = 0; ASSERT (pConfigRightDlg); if (!pConfigRightDlg) return nIDHelp; CuCbfProperty* pProp = pConfigRightDlg->GetCurrentProperty(); if (!pProp) return nIDHelp; pPageInfo = pProp->GetPageInfo(); if (!pPageInfo) return nIDHelp; int nCurSel = pProp->GetCurSel(); if (nCurSel>=0 && nCurSel<pPageInfo->GetNumberOfPage() && pPageInfo->GetNumberOfPage()>0) nIDHelp = pPageInfo->GetDlgID(nCurSel); // // For the cache page the are three sub-panes (cache buffer, parameter, derived): if (nIDHelp == IDD_DBMS_PAGE_CACHE) { CuDlgDbmsCache* pCachePage = (CuDlgDbmsCache*)pConfigRightDlg->GetCurrentPage(); if (pCachePage) { CvDbmsCacheViewLeft* pCacheBuffer = pCachePage->GetLeftPane(); if (pCacheBuffer) { CuCacheCheckListCtrl* pListBuffer = pCacheBuffer->GetCacheListCtrl(); // // Cache buffer: if (pListBuffer->GetSelectedCount() == 0) nIDHelp = IDD_CACHE_LIST; else { CvDbmsCacheViewRight* pCacheRightPane = pCachePage->GetRightPane(); if (pCacheRightPane) { CuDlgCacheTab* pTab = pCacheRightPane->GetCacheTabDlg(); if (pTab) nIDHelp = pTab->GetHelpID(); } } } } } return nIDHelp; }