Beispiel #1
0
BOOL CuDlgIpmTabCtrl::OnInitDialog() 
{
	CDialog::OnInitDialog();
	VERIFY (m_staticHeader.SubclassDlgItem (IDC_STATIC, this));
	m_staticHeader.SetImage (-1); // No Image for Now

	CWnd* pParent1 = GetParent();    // The view: CImView2
	ASSERT (pParent1);
	CdIpmDoc* pDoc = (CdIpmDoc*)((CView*)pParent1)->GetDocument();
	ASSERT (pDoc);
	if (!pDoc->GetCurrentProperty())
		return TRUE;

	//
	// When the document is Loaded ...
	try
	{
		CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
		CvIpmLeft*  pIpmView1= (CvIpmLeft*)pFrame->GetLeftPane();
		CTreeCtrl& treeCtrl = pIpmView1->GetTreeCtrl();
		HTREEITEM  hSelected= treeCtrl.GetSelectedItem ();
		ASSERT (hSelected);
		if (!hSelected)
			return TRUE;
		CTreeItem* pItem = (CTreeItem*)treeCtrl.GetItemData (hSelected);
		CuPageInformation* pPageInfo = pDoc->GetCurrentProperty()->GetPageInfo();
		LPIPMUPDATEPARAMS pUps = pPageInfo->GetUpdateParam();
		pUps->nType   = pItem->GetType();
		pUps->pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		pUps->pSFilter= pDoc->GetFilter();

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = treeCtrl.GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && treeCtrl.GetItemImage(hSelected, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		pPageInfo->SetImage  (hIcon);

		LoadPage (pDoc->GetCurrentProperty());
		m_bIsLoading = TRUE;
		if (m_pCurrentPage)
		{
			UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID;
			m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (UINT)nMask, (LPARAM)&(pDoc->GetProperty()));
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage ();
		m_pCurrentPage     = NULL;
		m_pCurrentProperty = NULL;
		e->Delete();
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Beispiel #2
0
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;
}
Beispiel #3
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;
}
Beispiel #4
0
LONG CuDlgIpmTabCtrl::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	//
	// lParam containts the hint about the change.
	// Its value can be FILTER_RESOURCE_TYPE, FILTER_NULL_RESOURCES, ...
	if (m_pCurrentPage)
	{
		CuPageInformation* pPageInfo = m_pCurrentProperty->GetPageInfo();
		ASSERT (pPageInfo);
		LPIPMUPDATEPARAMS pUps = pPageInfo->GetUpdateParam();
		pUps->nIpmHint = (int)lParam;
		m_pCurrentPage->SendMessage (WM_USER_IPMPAGE_UPDATEING, wParam, (LPARAM)pUps);
	}
	return 0L;
}
Beispiel #5
0
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;
}
Beispiel #6
0
BOOL CIpmCtrl::SelectItem(LPCTSTR lpszNode, LPCTSTR lpszServer, LPCTSTR lpszUser, LPCTSTR lpszKey, VARIANT FAR* pArrayItem, short nShowTree)
{
	class CaLockDisplayRightPaneProperty
	{
	public:
		CaLockDisplayRightPaneProperty(CdIpmDoc* pDoc):m_pDoc(pDoc), m_bLock(FALSE){}
		~CaLockDisplayRightPaneProperty(){UnLock();}

		void Lock(){m_pDoc->SetLockDisplayRightPane(TRUE);}
		void UnLock(){m_pDoc->SetLockDisplayRightPane(FALSE);}

	protected:
		BOOL m_bLock;
		CdIpmDoc* m_pDoc;
	};

	CWaitCursor doWaitCursor ;
	BOOL bOK = FALSE;
	try 
	{
		CdIpmDoc* pDoc = new CdIpmDoc(lpszKey, pArrayItem, (BOOL)nShowTree);

		if (m_pIpmFrame)
		{
			m_pIpmFrame->ShowWindow (SW_HIDE);
			m_pIpmFrame->DestroyWindow();
			m_pIpmFrame = NULL;
		}

		CaIpmProperty& property = pDoc->GetProperty();
		ConstructPropertySet (property);

		SFILTER* pFilter = theApp.GetFilter();
		SFILTER* pDocFilter = pDoc->GetFilter();
		memcpy (pDocFilter, pFilter, sizeof(SFILTER));
		CaLockDisplayRightPaneProperty lock(pDoc);
		if (nShowTree == 1)
		{
			//
			// During the process of expanding tree up to search item,
			// prohibit the display of the properties of the selected tree item
			lock.Lock();
		}

		CWnd* pParent = this;
		CRect r;
		GetClientRect (r);
		m_pIpmFrame = new CfIpmFrame(pDoc);
		m_pIpmFrame->Create (
			NULL,
			NULL,
			WS_CHILD,
			r,
			pParent);
		if (!m_pIpmFrame)
			return FALSE;

		m_pIpmFrame->InitialUpdateFrame(NULL, TRUE);
		m_pIpmFrame->ShowWindow(SW_SHOW);
		bOK = pDoc->Initiate(lpszNode, lpszServer, lpszUser, NULL);
		if (!bOK)
			return FALSE;

		CTypedPtrList<CObList, CuIpmTreeFastItem*> listItemPath;
		bOK = IPM_BuildItemPath (pDoc, listItemPath);
		if (!bOK)
		{
			while (!listItemPath.IsEmpty())
				delete listItemPath.RemoveHead();
			return FALSE;
		}
		ExpandUpToSearchedItem(m_pIpmFrame, listItemPath, TRUE);
		lock.UnLock();
		//
		// Cleanup:
		while (!listItemPath.IsEmpty())
			delete listItemPath.RemoveHead();

		//
		// Fetch the selected tree item and display the corresponding right pane:
		IPMUPDATEPARAMS ups;
		CTreeGlobalData* pGD = pDoc->GetPTreeGD();
		ASSERT (pGD);
		if (!pGD)
			return FALSE;
		CTreeCtrl* pTree = pGD->GetPTree();
		ASSERT (pTree);
		if (!pTree)
			return FALSE;
		CuDlgIpmTabCtrl* pTabDlg  = (CuDlgIpmTabCtrl*)m_pIpmFrame->GetTabDialog();
		if (!pTabDlg)
			return FALSE;
		HTREEITEM hSelected = pTree->GetSelectedItem();
		if (!hSelected)
			return FALSE;
		//
		// Notify the container of sel change:
		ContainerNotifySelChange();
		memset (&ups, 0, sizeof (ups));
		CTreeItem* pItem = (CTreeItem*)pTree->GetItemData (hSelected);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			pTabDlg->DisplayPage (NULL);
			return TRUE;
		}
		if (pItem->ItemDisplaysNoPage()) 
		{
			CString caption = pItem->ItemNoPageCaption();
			pTabDlg->DisplayPage (NULL, caption);
			return TRUE;
		}

		if (pItem->HasReplicMonitor())
		{
			pDoc->InitializeReplicator(pItem->GetDBName());
		}

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && pTree->GetItemImage(hSelected, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		CuPageInformation* pPageInfo = pItem->GetPageInformation();
		ASSERT(pPageInfo);
		if (!pPageInfo)
			return FALSE;
		int nSelectTab = GetDefaultSelectTab (pDoc);

		CString strItem = pItem->GetRightPaneTitle();
		pItem->UpdateDataWhenSelChange(); // Has an effect only if the class has specialied the method.
		ups.nType   = pItem->GetType();
		ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		ups.pSFilter= pDoc->GetPTreeGD()->GetPSFilter();
		pPageInfo->SetUpdateParam (&ups);
		pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, pDoc);
		pPageInfo->SetImage  (hIcon);
		pTabDlg->DisplayPage (pPageInfo, NULL, nSelectTab);

		return TRUE;
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch(CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
	}
	catch(...)
	{
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
	}
	return FALSE;
}
Beispiel #7
0
BOOL CdIpmDoc::UpdateDisplay()
{
	TRACE0("CdIpmDoc::UpdateDisplay()\n");
	try
	{
		m_pTreeGD->RefreshAllTreeBranches(); // refresh left pane
		
		IPMUPDATEPARAMS ups;
		memset (&ups, 0, sizeof (ups));
		CTreeItem* pItem = NULL;
		CTreeCtrl* pTree = m_pTreeGD->GetPTree();
		ASSERT (pTree);
		HTREEITEM hSelectedItem = pTree->GetSelectedItem();
		if (!hSelectedItem)
			return FALSE;
		pItem = (CTreeItem*)pTree->GetItemData(hSelectedItem);
		ASSERT (pItem);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			m_pTabDialog->DisplayPage (NULL);
		}
		else 
		if (pItem->ItemDisplaysNoPage()) 
		{
			CString caption = pItem->ItemNoPageCaption();
			m_pTabDialog->DisplayPage (NULL, caption);
		}
		else 
		{
			int nImage = -1, nSelectedImage = -1;
			CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL);
			HICON hIcon = NULL;
			int nImageCount = pImageList? pImageList->GetImageCount(): 0;
			if (pImageList && pTree->GetItemImage(hSelectedItem, nImage, nSelectedImage))
			{
				if (nImage < nImageCount)
					hIcon = pImageList->ExtractIcon(nImage);
			}
			CuPageInformation* pPageInfo = pItem->GetPageInformation();
			CString strItem = pItem->GetRightPaneTitle();

			ups.nType   = pItem->GetType();
			ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
			ups.pSFilter= m_pTreeGD->GetPSFilter();
			pPageInfo->SetUpdateParam (&ups);
			pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, this);

			pPageInfo->SetImage  (hIcon);
			m_pTabDialog->DisplayPage (pPageInfo);
		}

		// Replicator Monitor special management
		// ASSUMES we did not change the current item!
		BOOL bReplMonWasOn = (m_hReplMonHandle != -1) ? TRUE: FALSE;
		BOOL bReplMonToBeOn = pItem->HasReplicMonitor();
		// 3 cases :
		//    - on to off ---> replicator has been uninstalled
		//    - off to on ---> replicator has been installed
		//    - on to on, or off to off: state has not changed
		if (bReplMonWasOn && !bReplMonToBeOn) 
		{
			BOOL bOK = TerminateReplicator();
			ASSERT (bOK);
		}
		else 
		if (!bReplMonWasOn && bReplMonToBeOn)
		{
			CString csDbName = pItem->GetDBName();
			BOOL bOK = InitializeReplicator(csDbName);
			ASSERT (bOK);
		}
		//
		// Refresh right pane
		CfIpmFrame* pIpmFrame = (CfIpmFrame*)pTree->GetParentFrame();
		UpdateAllViews((CView *)pIpmFrame->GetLeftPane());
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return FALSE;
	}
	catch(CResourceException* e)
	{
		//_T("Cannot load dialog box");
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
		return FALSE;
	}
	catch(...)
	{
		//_T("Cannot construct the property pane");
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
		return FALSE;
	}

	return TRUE;
}
Beispiel #8
0
void CuDlgIpmTabCtrl::DisplayPage (CuPageInformation* pPageInfo, LPCTSTR lpszHeader, int nSel)
{
	CRect   r;
	TCITEM  item;
	int     i, nPages;
	UINT*   nTabID;
	UINT*   nDlgID;
	CString strTab;
	CString strTitle;
	UINT    nIDD; 
	CWnd*   pDlg;
	try
	{
		CView*   pView = (CView*)GetParent();
		ASSERT (pView);
		CdIpmDoc* pDoc  = (CdIpmDoc*)pView->GetDocument();
		ASSERT (pDoc);
		
		if (m_bIsLoading)
		{
			m_bIsLoading = FALSE;
			pDoc->SetLoadDoc(FALSE);
			// Masqued Emb April 9, 97 for bug fix
			// return;
		}
		if (!pPageInfo)
		{
			if (m_pCurrentPage)
				m_pCurrentPage->ShowWindow (SW_HIDE);
			m_cTab1.DeleteAllItems();
			if (m_pCurrentProperty)
			{
				m_pCurrentProperty->SetPageInfo (NULL);
				delete m_pCurrentProperty;
				m_pCurrentProperty = NULL;
				m_pCurrentPage     = NULL;
			}

			if (lpszHeader)
				m_staticHeader.SetWindowText (lpszHeader);
			else
				m_staticHeader.SetWindowText (_T(""));
			UINT uFlags = SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER;
			m_staticHeader.ResetBitmap (NULL); // No Image
			m_staticHeader.SetWindowPos (NULL, 0, 0, 0, 0, uFlags);
			return;
		}
		ASSERT (!lpszHeader);
		if (!m_pCurrentProperty)
		{
			m_pCurrentProperty = new CuIpmProperty (0, 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 default (the first) page, except if context-driven specified tab
			int initialSel = (nSel != -1)? nSel: 0;
			if (initialSel >= nPages)
				initialSel = 0;

			nIDD = pPageInfo->GetDlgID (initialSel); 
			pDlg= GetPage (nIDD);
			m_cTab1.SetCurSel (initialSel);
			m_cTab1.GetClientRect (r);
			m_cTab1.AdjustRect (FALSE, r);
			pDlg->MoveWindow (r);
			pDlg->ShowWindow(SW_SHOW);
			m_pCurrentPage = pDlg;
			//
			// 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());
		}
		else // !m_pCurrentProperty
		{
			CuPageInformation* pCurrentPageInfo = m_pCurrentProperty->GetPageInfo();
			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);

			// Cloned from dgdomc02.cpp : pCurrentPageInfo can have become NULL
			// example: current selection was system obj, and system checkbox has been unchecked
			BOOL bNoMoreCurrentClassName = FALSE;
			CString CurrentClassName;
			if (pCurrentPageInfo)
				CurrentClassName = pCurrentPageInfo->GetClassName();
			else
			{
				bNoMoreCurrentClassName = TRUE;
				CurrentClassName = _T("No More Current Class Name!!!");
			}
			CString ClassName        = pPageInfo->GetClassName();
			if ((CurrentClassName == ClassName) && (!bNoMoreCurrentClassName) )
			{
				m_pCurrentProperty->SetPageInfo (pPageInfo);
				//
				// wParam, and lParam will contain the information needed
				// by the dialog to refresh itself.
				if (m_pCurrentPage) 
					m_pCurrentPage->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)pDoc, (LPARAM)pPageInfo->GetUpdateParam());
				//
				// Special re-initialize the Activity page of a Static Replication Item
				// It is not optimal, but we have to do like this due to no specification for replication.
				int i;
				for (i=0; i<pPageInfo->GetNumberOfPage(); i++)
				{
					nIDD = pPageInfo->GetDlgID (i); 
					if (nIDD == IDD_REPSTATIC_PAGE_ACTIVITY)
					{
						pDlg= GetPage (nIDD);
						//
						// Properties:
						UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID;
						pDlg->SendMessage (WMUSRMSG_CHANGE_SETTING, (WPARAM)nMask, (LPARAM)&(pDoc->GetProperty()));

						//
						// Update data:
						pDlg->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)pDoc, (LPARAM)pPageInfo->GetUpdateParam());
						break;
					}
				}
			}
			else
			{
				int initialSel = (nSel != -1)? nSel: 0;
				if (initialSel >= pPageInfo->GetNumberOfPage())
					initialSel = 0;
				if (m_pCurrentPage) 
					m_pCurrentPage->ShowWindow (SW_HIDE);
				m_cTab1.DeleteAllItems();
				nPages = pPageInfo->GetNumberOfPage();
				m_pCurrentProperty->SetPageInfo (pPageInfo);
				m_pCurrentProperty->SetCurSel (initialSel);
				
				if (nPages < 1)
				{
					m_pCurrentPage = NULL;
					return;
				}
				UINT nIDD; 
				CWnd* pDlg;
				//
				// 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 default (the first) page.
				nIDD = pPageInfo->GetDlgID (initialSel); 
				pDlg= GetPage (nIDD);
				m_cTab1.SetCurSel (initialSel);
				m_cTab1.GetClientRect (r);
				m_cTab1.AdjustRect (FALSE, r);
				pDlg->MoveWindow (r);
				pDlg->ShowWindow(SW_SHOW);
				m_pCurrentPage = pDlg;
				//
				// 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());
			}
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		if (m_pCurrentPage)
			m_pCurrentPage->ShowWindow (SW_HIDE);
		if (m_pCurrentProperty)
		{
			m_pCurrentProperty->SetPageInfo (NULL);
			delete m_pCurrentProperty;
		}
		m_pCurrentPage = NULL;
		m_pCurrentProperty = NULL;
		e->Delete();
		return;
	}
	catch (CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_RESOURCE);//"Load resource failed"
		if (m_pCurrentPage)
			m_pCurrentPage->ShowWindow (SW_HIDE);
		if (m_pCurrentProperty)
		{
			m_pCurrentProperty->SetPageInfo (NULL);
			delete m_pCurrentProperty;
		}
		m_pCurrentPage = NULL;
		m_pCurrentProperty = NULL;
		e->Delete();
		return;
	}
}
Beispiel #9
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()));
	}
}
Beispiel #10
0
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;
}
Beispiel #11
0
void CConfRightDlg::DisplayPage (CuPageInformation* pPageInfo)
{
	CRect   r;
	TC_ITEM item;
	int     i, nPages;
	UINT*   nTabID;
	UINT*   nDlgID;
	CString strTab;
	CString strTitle;
	UINT    nIDD; 
	CWnd* pDlg;
	CView*   pView = (CView*)GetParent();               ASSERT (pView);
	
	//
	// Set the default label of the two buttons: (Derfault, Restore)
	CWnd* pB1 = GetDlgItem (IDC_BUTTON1);
	CWnd* pB2 = GetDlgItem (IDC_BUTTON2);
	CString csButtonTitle;
	csButtonTitle.LoadString(IDS_BUTTON_EDIT_VALUE);
	pB1->SetWindowText (csButtonTitle);

	csButtonTitle.LoadString(IDS_BUTTON_RESTORE);
	pB2->SetWindowText (csButtonTitle);

	pB1->EnableWindow  (FALSE);
	pB2->EnableWindow  (FALSE);


	// hide buttons 1 and 2 if no page
	int showFlag = SW_HIDE;
	if (pPageInfo && pPageInfo->GetNumberOfPage() > 0)
		showFlag = SW_SHOW;
	pB1->ShowWindow(showFlag);
	pB2->ShowWindow(showFlag);

	// Always Hide the other buttons
	CWnd* pB3 = GetDlgItem (IDC_BUTTON3);
	CWnd* pB4 = GetDlgItem (IDC_BUTTON4);
	CWnd* pB5 = GetDlgItem (IDC_BUTTON5);
	pB3->ShowWindow(SW_HIDE); pB3->SetWindowText(_T("Button &3"));
	pB4->ShowWindow(SW_HIDE); pB4->SetWindowText(_T("Button &4"));
	pB5->ShowWindow(SW_HIDE); pB5->SetWindowText(_T("Button &5"));

	// always enable all buttons
	pB1->EnableWindow(TRUE);
	pB2->EnableWindow(TRUE);
	pB3->EnableWindow(TRUE);
	pB4->EnableWindow(TRUE);
	pB5->EnableWindow(TRUE);

	if (m_bIsLoading)
	{
		m_bIsLoading = FALSE;
	}
	if (!pPageInfo)
	{
		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)0);
			m_pCurrentPage->ShowWindow (SW_HIDE);
		}
		m_cTab1.DeleteAllItems();
		if (m_pCurrentProperty)
		{
			m_pCurrentProperty->SetPageInfo (NULL);
			delete m_pCurrentProperty;
			m_pCurrentProperty = NULL;
			m_pCurrentPage     = NULL;
		}
		return;
	}
	if (!m_pCurrentProperty)
	{
		try
		{
			m_pCurrentProperty = new CuCbfProperty (0, pPageInfo);
		}
		catch (CMemoryException* e)
		{
			VCBF_OutOfMemoryMessage();
			e->Delete();
			m_pCurrentPage = NULL;
			m_pCurrentProperty = NULL;
			return;
		}
		//
		// Set up the Title:
		pPageInfo->GetTitle (strTitle);
		
		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 default (the first in general) page,
		int iPage = pPageInfo->GetDefaultPage ();
		nIDD    = pPageInfo->GetDlgID (iPage);
		try 
		{
			pDlg= GetPage (nIDD);
			if (!pDlg)
				return;
		}
		catch (CMemoryException* e)
		{
			VCBF_OutOfMemoryMessage ();
			e->Delete();
			return;
		}
		catch (CResourceException* e)
		{
			AfxMessageBox (_T("Load resource failed"));
			e->Delete();
			return;
		}
		m_cTab1.SetCurSel (iPage);
		m_cTab1.GetClientRect (r);
		m_cTab1.AdjustRect (FALSE, r);
		pDlg->MoveWindow (r);
		pDlg->ShowWindow(SW_SHOW);
		m_pCurrentPage = pDlg;
		m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
	}
	else
	{
		CuPageInformation* pCurrentPageInfo = m_pCurrentProperty->GetPageInfo();
		if (pCurrentPageInfo->GetClassName()==pPageInfo->GetClassName())
		{
			m_pCurrentProperty->SetPageInfo (pPageInfo);
			//
			// In general, when the selection changes on the left-pane, 
			// and if the new selected item if the same class as the old one
			// then we keep the current selected page (Tab) at the right-pane.
			// Special case:
			// ------------
			// For the class LOGFILE, we use the default page setting !!!
			if (pCurrentPageInfo->GetClassName()== "LOGFILE")
			{
				int iPage = pPageInfo->GetDefaultPage ();
				nIDD      = pPageInfo->GetDlgID (iPage);
				CWnd* pDlg= GetPage (nIDD);
				if (!pDlg)
					return;
				m_cTab1.SetCurSel (iPage);
				m_cTab1.GetClientRect (r);
				m_cTab1.AdjustRect (FALSE, r);
				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)0);
					m_pCurrentPage->ShowWindow (SW_HIDE);
				}
				pDlg->MoveWindow (r);
				pDlg->ShowWindow(SW_SHOW);
				m_pCurrentPage = pDlg;
			}
			//
			// wParam, and lParam will contain the information needed
			// by the dialog to refresh itself.
			if (m_pCurrentPage) 
				m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
		}
		else
		{
			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)0);
				m_pCurrentPage->ShowWindow (SW_HIDE);
			}
			m_cTab1.DeleteAllItems();
			nPages = pPageInfo->GetNumberOfPage();
			m_pCurrentProperty->SetPageInfo (pPageInfo);
			m_pCurrentProperty->SetCurSel (0);
			
			if (nPages < 1)
			{
				m_pCurrentPage = NULL;
				return;
			}
			UINT nIDD; 
			CWnd* pDlg;
			//
			// 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 default (the first) page.
			int iPage = pPageInfo->GetDefaultPage ();
			nIDD    = pPageInfo->GetDlgID (iPage);
			try 
			{
				pDlg= GetPage (nIDD);
				if (!pDlg)
					return;
			}
			catch (CMemoryException* e)
			{
				VCBF_OutOfMemoryMessage();
				e->Delete();
				return;
			}
			catch (CResourceException* e)
			{
				AfxMessageBox (_T("Load resource failed"));
				e->Delete();
				return;
			}
			m_cTab1.SetCurSel (iPage);
			m_cTab1.GetClientRect (r);
			m_cTab1.AdjustRect (FALSE, r);
			pDlg->MoveWindow (r);
			pDlg->ShowWindow(SW_SHOW);
			m_pCurrentPage = pDlg;
			m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, (WPARAM)0, (LPARAM)pPageInfo->GetCbfItem());
		}
	}
}
Beispiel #12
0
void CvIpmLeft::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) 
{
	IPMUPDATEPARAMS ups;
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument();

	try 
	{
		ASSERT(pDoc);
		if (!pDoc)
			return;
		if (pDoc->GetLockDisplayRightPane())
			return;
		CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
		ASSERT (pFrame);
		if (!pFrame)
			return;
		if (!pFrame->IsAllViewCreated())
			return;

		CuDlgIpmTabCtrl* pTabDlg  = (CuDlgIpmTabCtrl*)pFrame->GetTabDialog();
		if (!pTabDlg)
			return;
		CWaitCursor doWaitCursor ;
		//
		// Notify the container of sel change:
		CIpmCtrl* pIpmCtrl = (CIpmCtrl*)pFrame->GetParent();
		if (pIpmCtrl)
			pIpmCtrl->ContainerNotifySelChange();

		memset (&ups, 0, sizeof (ups));
		CTreeCtrl& treeCtrl = GetTreeCtrl();
		CTreeItem* pItem = (CTreeItem*)treeCtrl.GetItemData (pNMTreeView->itemNew.hItem);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			pTabDlg->DisplayPage (NULL);
			*pResult = 0;
			return;
		}
		if (pItem->ItemDisplaysNoPage()) {
			CString caption = pItem->ItemNoPageCaption();
			pTabDlg->DisplayPage (NULL, caption);
			*pResult = 0;
			return;
		}

		if (pItem->HasReplicMonitor())
		{
			pDoc->InitializeReplicator(pItem->GetDBName());
		}

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = treeCtrl.GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && treeCtrl.GetItemImage(pNMTreeView->itemNew.hItem, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		CuPageInformation* pPageInfo = pItem->GetPageInformation();

		CString strItem = pItem->GetRightPaneTitle();
		pItem->UpdateDataWhenSelChange(); // Has an effect only if the class has specialied the method.
		ups.nType   = pItem->GetType();
		ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		ups.pSFilter= pDoc->GetPTreeGD()->GetPSFilter();
		pPageInfo->SetUpdateParam (&ups);
		pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, pDoc);

		pPageInfo->SetImage  (hIcon);
		pTabDlg->DisplayPage (pPageInfo);
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch(CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
	}
	catch(...)
	{
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
	}
	*pResult = 0;
}