void DocHistory::SetDocument(const doc_id& di) { //wxASSERT(m_catalyst.IsOk(di)); // Check if we are invalidating the view if (!di.IsOk()) { Clear(); return; } if (m_sourceDoc != di) { cxLOCKDOC_WRITE(m_doc) doc.SetDocument(di); // Get the document m_document_id = di.IsDraft() ? doc.GetParent().document_id : di.document_id; cxENDLOCK m_sourceDoc = di; // Check if we need to rebuild the tree ReBuildTree(); } Select(m_selectedNode); MakeItemVisible(m_selectedNode); }
void DiffBar::Swap() { for (list<cxMatch>::iterator p = m_matchlist.begin(); p != m_matchlist.end(); ++p) { const size_t temp = p->offset1; p->offset1 = p->offset2; p->offset2 = temp; } EditorCtrl* temp = m_leftEditor; m_leftEditor = m_rightEditor; m_rightEditor = temp; m_leftStyler.SwapSide(); m_rightStyler.SwapSide(); // Re-set the editor callbacks SetCallbacks(); // Re-set document callbacks DocumentWrapper& doc1 = m_leftEditor->GetDocument(); DocumentWrapper& doc2 = m_rightEditor->GetDocument(); cxLOCKDOC_WRITE(doc1) Document& d2 = doc2.GetDoc(); doc.SetChangeCallback(OnLeftDocumentChanged, this); d2.SetChangeCallback(OnRightDocumentChanged, this); cxENDLOCK TransformMatchlist(); m_needRedraw = true; }