Пример #1
0
void CIpmCtrl::DoPropExchange(CPropExchange* pPX)
{
	ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
	COleControl::DoPropExchange(pPX);

	PX_Long (pPX, _T("TimeOut"),          m_timeOut,           DEFAULT_TIMEOUT);
	PX_Long (pPX, _T("RefreshFrequency"), m_refreshFrequency,  DEFAULT_REFRESHFREQUENCY);
	PX_Bool (pPX, _T("ActivateRefresh"),  m_activateRefresh,   DEFAULT_ACTIVATEREFRESH);
	PX_Bool (pPX, _T("ShowGrid"),         m_showGrid,          DEFAULT_GRID);
	PX_Long (pPX, _T("Unit"),             m_unit,              DEFAULT_UNIT);
	PX_Long (pPX, _T("MaxSession"),       m_maxSession,        DEFAULT_MAXSESSION);

	if (pPX->IsLoading() && m_pIpmFrame)
	{
		CdIpmDoc* pDoc = m_pIpmFrame->GetIpmDoc();
		ASSERT(pDoc);
		if (pDoc)
		{
			CaIpmProperty& property = pDoc->GetProperty();
			ConstructPropertySet (property);
		}
	}
}
Пример #2
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;
}
Пример #3
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;
	}
}
Пример #4
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()));
	}
}