BOOL CMergeDoc::Rescan()
{
+ BOOL ltMod = m_ltBuf.IsModified();
+ BOOL rtMod = m_rtBuf.IsModified();
struct file_data inf[2];
char *free0=NULL,*free1=NULL;
char dir0[MAX_PATH],dir1[MAX_PATH], name0[MAX_PATH], name1[MAX_PATH];
mf->m_pLeft->GoToLine(nResumeTopLine, FALSE);
mf->m_pRight->GoToLine(nResumeTopLine, FALSE);
}
+ m_ltBuf.SetModified(ltMod);
+ m_rtBuf.SetModified(rtMod);
return bResult;
}
m_ltBuf.SaveToFile(m_strTempLeftFile, CRLF_STYLE_AUTOMATIC, FALSE);
if (m_rtBuf.IsModified())
m_rtBuf.SaveToFile(m_strTempRightFile, CRLF_STYLE_AUTOMATIC, FALSE);
- CWnd *pFocus = mf->m_pLeft->GetFocus();
- mf->m_pLeft->PushCursor();
- mf->m_pRight->PushCursor();
- Rescan();
- mf->m_pLeft->PopCursor();
- mf->m_pRight->PopCursor();
- if (pFocus!=NULL)
- pFocus->SetFocus();
+
+ CMDIFrameWnd* mainWnd = dynamic_cast<CMDIFrameWnd*>(AfxGetMainWnd());
+ CMDIChildWnd* diffWnd = dynamic_cast<CMDIChildWnd*>(mainWnd->MDIGetActive());
+ CCrystalEditView* curView = dynamic_cast<CCrystalEditView*>(diffWnd->GetActiveView());
+
+ if(curView)
+ {
+ curView->PushCursor();
+ Rescan();
+ UpdateAllViews(NULL);
+ curView->PopCursor();
+ }
+ else
+ {
+ Rescan();
+ UpdateAllViews(NULL);
+ }
}
void CMergeDoc::OnFileSave()
ON_UPDATE_COMMAND_UI(ID_PREVDIFF, OnUpdatePrevdiff)
ON_WM_LBUTTONDBLCLK()
ON_WM_LBUTTONUP()
- ON_WM_CHAR()
ON_COMMAND(ID_ALL_LEFT, OnAllLeft)
ON_UPDATE_COMMAND_UI(ID_ALL_LEFT, OnUpdateAllLeft)
ON_COMMAND(ID_ALL_RIGHT, OnAllRight)
GetMaxLineLength();
}
-void CMergeEditView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
-{
-
- BOOL mod = m_pTextBuffer->IsModified();
- m_pTextBuffer->SetModified(FALSE);
-
- CCrystalEditViewEx::OnChar(nChar, nRepCnt, nFlags);
-
- if (m_pTextBuffer->IsModified())
- {
- CPoint pos = GetCursorPos();
- DWORD flags = m_pTextBuffer->GetLineFlags(pos.y);
- if ((flags&LF_WINMERGE_FLAGS)==0)
- {
- GetDocument()->FlushAndRescan();
- m_pTextBuffer->SetModified(TRUE);
- }
- }
- else
- m_pTextBuffer->SetModified(mod);
-}
-
void CMergeEditView::OnL2r()
{
GetDocument()->ListCopy(true);
pCmdUI->Enable(GetDocument()->m_nDiffs!=0);
}
+void CMergeEditView::OnEditOperation(int nAction, LPCTSTR pszText)
+{
+ CCrystalEditViewEx::OnEditOperation(nAction, pszText);
+ GetDocument()->FlushAndRescan();
+}
// Operations
public:
+ virtual void OnEditOperation(int nAction, LPCTSTR pszText);
void UpdateLineLengths();
BOOL IsLineInCurrentDiff(int nLine);
void SelectNone();
afx_msg void OnUpdatePrevdiff(CCmdUI* pCmdUI);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnAllLeft();
afx_msg void OnUpdateAllLeft(CCmdUI* pCmdUI);
afx_msg void OnAllRight();