/** * Stores content of Active X Control in a custom pane into a file. * * @param iCustomPane: index of custom pane to store * (0..number of custom panes - 1) * strPath : File path * @return Error code * @exception - * @see */ HRESULT CWatchWindow::SaveCustomPane (int iCustomPane /*=-1*/, CString strPath /*=_T("")*/) { CWatchControlWrapper *pWrapper; if(iCustomPane < 0 || iCustomPane >= m_iCustomPaneCount) { iCustomPane = m_iContextMenuTab; if(iCustomPane < 0 || iCustomPane >= m_iCustomPaneCount) { return E_FAIL; } } if(strPath.IsEmpty()) { CString strFile; if(GetTabType(iCustomPane) != eAutomatic) { CString strLabel; strLabel = GetTabLabel(iCustomPane); strFile = strLabel + _T(".4cw"); } strPath = QueryWatchFile(true, strFile); } // Get Active X Control wrapper of custom pane. /////////////////////////////////////////////// pWrapper = GetCustomPaneWrapper (iCustomPane); if (pWrapper == NULL) { return (E_UNEXPECTED); } // Tell wrapper to store Active X Control content into a file. ////////////////////////////////////////////////////////////// HRESULT hr = pWrapper->Store(strPath); if(hr == S_OK) { CString strFileName; CString strTabName; int iFound = strPath.ReverseFind(_T('\\')); strFileName = strPath.Mid(iFound+1); iFound = strFileName.ReverseFind(_T('.')); if(iFound > 0) { strTabName = strFileName.Left(iFound); } // if(GetTabType(iCustomPane) < eManual) // { m_pTabWindow->RenameTab(iCustomPane, strTabName); SetTabType(iCustomPane, eImportExport); // } } return S_OK; }
/** * Removes a custom pane. * * @param iCustomPane: index of custom pane to remove * (0..number of custom panes - 1) * @return - * @exception - * @see */ void CWatchWindow::RemoveCustomPane (int iCustomPane) { int i; // Must be given the index of a custom pane tab. // Otherwise our caller did something wrong. //////////////////////////////////////////////// ASSERT (iCustomPane >= 0 && iCustomPane < m_iCustomPaneCount); if (iCustomPane < 0 || iCustomPane >= m_iCustomPaneCount) return; // Remove tab of custom pane. ///////////////////////////// RemoveTab (iCustomPane); // Obviously have to decrease number of custom panes. ///////////////////////////////////////////////////// --m_iCustomPaneCount; // Rename all tabs to the right (index has changed -> index depending name changes). //////////////////////////////////////////////////////////////////////////////////// // SIS: only automatic tabs are renamed ETabType eTabType; for (i = iCustomPane; i < m_iCustomPaneCount; ++i) { eTabType = GetTabType(i); if(eTabType == eAutomatic) { m_pTabWindow->RenameTab(i, BuildCustomPaneCaption (i)); } } // If we have a forced pane and we removed before the forced // pane we have to decrease the forced panes tab index. //////////////////////////////////////////////////////////// if (m_iForcedPaneTab != -1 && m_iForcedPaneTab >= 0) --m_iForcedPaneTab; }
int CMDITabChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (__super::OnCreate(lpCreateStruct) == -1) return -1; // Unfortunately, we can't update our title until we have a document - // which we do not have yet. So there will be a little visual glitch as // the tab is added, and *then* gets it title. CMainFrame *pFrame = static_cast<CMainFrame*>(AfxGetMainWnd()); if (pFrame) { pFrame->AddTab(this, GetTabType()); } return 0; }
/** * fill settings. * * @param [in] pWatchSettings: pointer to watch settings. * @return - * @exception - * @see - */ void CWatchWindow::FillSettings(CWatchSettings& rtWatchSettings) { CWatchControlWrapper *pWrapper; CString strName; CString strXMLString; int iNumPanes = m_pTabWindow->GetTabCount(); CString strLabel; ETabType eTabType; int iActiveTab; if(m_pTabWindow->GetActiveTab(iActiveTab)) { rtWatchSettings.SetActiveTab(iActiveTab); } // run over all panes for(int iPane = 0; iPane < iNumPanes; ++iPane) { strLabel = GetTabLabel(iPane); eTabType = GetTabType(iPane); // save name only if no automatic pane if(eTabType != eAutomatic) { strName = strLabel; } // 15.12.05 SIS >> // if automatic pane -> name must be empty else { strName.Empty(); } // 15.12.05 SIS << pWrapper = GetCustomPaneWrapper(iPane); pWrapper->SaveToXMLString(strXMLString); if(!strXMLString.IsEmpty()) { rtWatchSettings.AddPane(strName, strXMLString); } } }