Beispiel #1
0
/////////////////////////////////////////////////////////////////////////////
// 加载DockingPane
// nID = -1表示加载所有自动加载的
/////////////////////////////////////////////////////////////////////////////
BOOL CPlugIn::LoadDockingPane(int nID, BOOL bProjectLoad)
{
	CMainFrame* pMainFrame = (CMainFrame*)(AfxGetMainWnd());
	if(nID == -1)
	{
		// 2007-09-09修改,不需要事先加载OWM,在窗口要显示时候会自动加载
		// 此段代码取消--如果组件尚未加载就先加载--
		//if((m_arDockingPane.GetSize() > 0) && (m_pVciObj == NULL))
		//{
		//	LoadOwmPlugIn();
		//}

		for(int i=0; i<m_arDockingPane.GetSize(); i++)
		{
			CXTPDockingPane* pPane = pMainFrame->GetPaneManager()->FindPane(m_arDockingPane[i].m_nId);
			// 如果需要自动创建,或者工程打开时创建(并且工程正在打开),或者Pane已经存在,则执行创建动作
			if(m_arDockingPane[i].m_bAutoCreate || (m_arDockingPane[i].m_bProjectCreate && bProjectLoad) || pPane)
			{
				CString strIconPath = m_arDockingPane[i].m_strIcon;
				if(strIconPath.Find(":") == -1)
				{
					strIconPath = m_strPath+"\\"+m_arDockingPane[i].m_strIcon;
				}
				WORD wIndex = 0;
				HICON hIcon = ::ExtractAssociatedIcon(theApp.m_hInstance,
					strIconPath.GetBuffer(0), &wIndex);
				strIconPath.ReleaseBuffer();
				if(m_arDockingPane[i].m_bAutoCreate || (m_arDockingPane[i].m_bProjectCreate && bProjectLoad))
				{
					pMainFrame->CreateDockingBar(m_arDockingPane[i].m_nId,
						m_arDockingPane[i].m_nDirection, hIcon);
				}else
				if(hIcon)
				{
					pMainFrame->GetPaneManager()->SetIcon(m_arDockingPane[i].m_nId,
						CXTPImageManagerIconHandle(hIcon));
				}
			}
		}
	}else
	{
		for(int i=0; i<m_arDockingPane.GetSize(); i++)
		{
			if(m_arDockingPane[i].m_nId == nID)
			{
				if(m_pVciObj == NULL)
				{
					LoadOwmPlugIn();
				}

				CString strIconPath = m_arDockingPane[i].m_strIcon;
				if(strIconPath.Find(":") == -1)
				{
					strIconPath = m_strPath+"\\"+m_arDockingPane[i].m_strIcon;
				}
				WORD wIndex = 0;
				HICON hIcon = ::ExtractAssociatedIcon(theApp.m_hInstance,
					strIconPath.GetBuffer(0), &wIndex);
				strIconPath.ReleaseBuffer();
				pMainFrame->CreateDockingBar(m_arDockingPane[i].m_nId,
					m_arDockingPane[i].m_nDirection, hIcon);
				return TRUE;
			}
		}
	}
	return TRUE;
}