bool Manager::load( const std::string fname ) { if ( !dock_ ) return false; std::string loadName = fname; if ( fname.empty() ) { char buffer[MAX_PATH+1]; GetCurrentDirectory( sizeof( buffer ), buffer ); strcat( buffer, "\\layout.xml" ); loadName = buffer; std::replace( loadName.begin(), loadName.end(), '\\', '/' ); } lastLayoutFile_ = loadName; DataResource file( loadName, RESOURCE_TYPE_XML ); DataSectionPtr section = file.getRootSection(); if ( !section ) return false; if ( !dock_->empty() ) removePanels(); if ( !dock_->load( section->openSection( "Dock" ) ) ) { removePanels(); return false; } return true; }
CInputDocView::~CInputDocView() { removePanels(); if( m_pBaseStream) delete m_pBaseStream; if(m_pFindDlg) delete m_pFindDlg; }
void CInputDocView::populatePanels() { int iSelectedTab = m_tabCtrl.GetCurSel(); removePanels(); CInputDoc* pDoc = (CInputDoc*) GetDocument(); // add the base file (which will be: // source file for a parsing operation // ana or ptext for a transfer or synthesis operation //CResultStream* pBaseStream = pDoc->getBaseStream(); #ifndef rde270 // the first panel (i.e. the file we're processing), should be synchronously streamed in // (the meaning of the 3rd parameter), since it has to be closed (finished loading into // the control) by the time we try to process it. addPanel(m_pBaseStream, kBasePanelID+0, true); #else addPanel(m_pBaseStream, kBasePanelID+0); #endif //delete pBaseStream; // add the various result panels CProcessStatus* pResults = pDoc->getProcessResults(); if(pResults) { CPrefsInputDocDisplay* pPrefs = pDoc->getDisplayPrefs(); int iPanelCount=1; // one for the input file for (int i =0; i< pResults->m_pResultStreams.GetSize(); i++) { CResultStreamDescriptor* pD =pResults->m_pResultStreams[i]->getDescriptor() ; if( pPrefs->getShowPanel(pD)) { iPanelCount++; addPanel(pResults->m_pResultStreams[i], kBasePanelID+i+1/*id 0 is the basestream */); } } // try to reselect the tab the user had before // this is simplistic, and could be redone to store the descriptor // they had chosen and reselect that. if(iPanelCount > iSelectedTab) // iSelectedTab is zero-based { m_tabCtrl.SetCurSel(iSelectedTab); tabSelected(iSelectedTab); // don't know why this isn't triggered } else { m_tabCtrl.SetCurSel(0); // should always at least be the source panel tabSelected(0); // don't know why this isn't triggered } } }