1 /////////////////////////////////////////////////////////////////////////////
2 // WinMerge: an interactive diff/merge utility
3 // Copyright (C) 1997-2000 Thingamahoochie Software
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /////////////////////////////////////////////////////////////////////////////
22 * @file HexMergeDoc.cpp
24 * @brief Implementation file for CHexMergeDoc
29 #include "HexMergeDoc.h"
31 #include "UnicodeString.h"
32 #include "HexMergeFrm.h"
33 #include "HexMergeView.h"
35 #include "FolderCmp.h"
36 #include "DiffContext.h" // FILE_SAME
38 #include "DirActions.h"
39 #include "OptionsDef.h"
40 #include "DiffFileInfo.h"
41 #include "SaveClosingDlg.h"
44 #include "OptionsMgr.h"
45 #include "FileOrFolderSelect.h"
46 #include "DiffWrapper.h"
47 #include "SyntaxColors.h"
49 #include "Constants.h"
56 int CHexMergeDoc::m_nBuffersTemp = 2;
58 static void UpdateDiffItem(int nBuffers, DIFFITEM &di, CDiffContext *pCtxt);
59 static int Try(HRESULT hr, UINT type = MB_OKCANCEL|MB_ICONSTOP);
62 * @brief Update diff item
64 static void UpdateDiffItem(int nBuffers, DIFFITEM &di, CDiffContext *pCtxt)
66 di.diffcode.setSideNone();
67 for (int nBuffer = 0; nBuffer < nBuffers; nBuffer++)
69 di.diffFileInfo[nBuffer].ClearPartial();
70 if (pCtxt->UpdateInfoFromDiskHalf(di, nBuffer))
71 di.diffcode.diffcode |= DIFFCODE::FIRST << nBuffers;
74 di.diffcode.diffcode &= ~(DIFFCODE::TEXTFLAGS | DIFFCODE::COMPAREFLAGS | DIFFCODE::COMPAREFLAGS3WAY);
77 di.diffcode.diffcode |= folderCmp.prepAndCompareFiles(pCtxt, di);
81 * @brief Issue an error popup if passed in HRESULT is nonzero
83 static int Try(HRESULT hr, UINT type)
85 return hr ? CInternetException(hr).ReportError(type) : 0;
88 /////////////////////////////////////////////////////////////////////////////
91 IMPLEMENT_DYNCREATE(CHexMergeDoc, CDocument)
93 BEGIN_MESSAGE_MAP(CHexMergeDoc, CDocument)
94 //{{AFX_MSG_MAP(CHexMergeDoc)
95 ON_COMMAND(ID_FILE_SAVE, OnFileSave)
96 ON_COMMAND(ID_FILE_SAVE_LEFT, OnFileSaveLeft)
97 ON_COMMAND(ID_FILE_SAVE_RIGHT, OnFileSaveRight)
98 ON_COMMAND(ID_FILE_SAVEAS_LEFT, OnFileSaveAsLeft)
99 ON_COMMAND(ID_FILE_SAVEAS_RIGHT, OnFileSaveAsRight)
100 ON_UPDATE_COMMAND_UI(ID_STATUS_DIFFNUM, OnUpdateStatusNum)
101 ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_LEFT, OnUpdateFileSaveLeft)
102 ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_RIGHT, OnUpdateFileSaveRight)
103 ON_UPDATE_COMMAND_UI(ID_FILE_SAVE, OnUpdateFileSave)
104 ON_COMMAND(ID_RESCAN, OnFileReload)
105 ON_COMMAND(ID_L2R, OnL2r)
106 ON_COMMAND(ID_R2L, OnR2l)
107 ON_COMMAND(ID_COPY_FROM_LEFT, OnCopyFromLeft)
108 ON_COMMAND(ID_COPY_FROM_RIGHT, OnCopyFromRight)
109 ON_COMMAND(ID_ALL_LEFT, OnAllLeft)
110 ON_COMMAND(ID_ALL_RIGHT, OnAllRight)
111 ON_COMMAND(ID_VIEW_ZOOMIN, OnViewZoomIn)
112 ON_COMMAND(ID_VIEW_ZOOMOUT, OnViewZoomOut)
113 ON_COMMAND(ID_VIEW_ZOOMNORMAL, OnViewZoomNormal)
114 ON_COMMAND(ID_REFRESH, OnRefresh)
115 ON_COMMAND(ID_MERGE_COMPARE_TEXT, OnFileRecompareAsText)
119 /////////////////////////////////////////////////////////////////////////////
120 // CHexMergeDoc construction/destruction
123 * @brief Constructor.
125 CHexMergeDoc::CHexMergeDoc()
128 m_nBuffers = m_nBuffersTemp;
129 m_filePaths.SetSize(m_nBuffers);
130 std::fill_n(m_pView, m_nBuffers, static_cast<CHexMergeView *>(NULL));
131 std::fill_n(m_nBufferType, m_nBuffers, BUFFER_NORMAL);
137 * Informs associated dirdoc that mergedoc is closing.
139 CHexMergeDoc::~CHexMergeDoc()
142 m_pDirDoc->MergeDocClosing(this);
146 * @brief Return active merge edit view (or left one if neither active)
148 CHexMergeView * CHexMergeDoc::GetActiveMergeView() const
150 CView * pActiveView = GetParentFrame()->GetActiveView();
151 CHexMergeView * pHexMergeView = dynamic_cast<CHexMergeView *>(pActiveView);
153 pHexMergeView = m_pView[0]; // default to left view (in case some location or detail view active)
154 return pHexMergeView;
158 * @brief Update associated diff item
160 int CHexMergeDoc::UpdateDiffItem(CDirDoc *pDirDoc)
162 // If directory compare has results
163 if (pDirDoc && pDirDoc->HasDiffs())
165 const String &pathLeft = m_filePaths.GetLeft();
166 const String &pathRight = m_filePaths.GetRight();
167 CDiffContext &ctxt = pDirDoc->GetDiffContext();
168 if (UINT_PTR pos = FindItemFromPaths(ctxt, pathLeft, pathRight))
170 DIFFITEM &di = ctxt.GetDiffRefAt(pos);
171 ::UpdateDiffItem(m_nBuffers, di, &ctxt);
175 int lengthFirst = m_pView[0]->GetLength();
176 void *bufferFirst = m_pView[0]->GetBuffer(lengthFirst);
177 for (int nBuffer = 1; nBuffer < m_nBuffers; nBuffer++)
179 int length = m_pView[nBuffer]->GetLength();
180 if (lengthFirst != length)
184 void *buffer = m_pView[nBuffer]->GetBuffer(length);
185 bDiff = (memcmp(bufferFirst, buffer, lengthFirst) != 0);
190 GetParentFrame()->SetLastCompareResult(bDiff);
191 return bDiff ? 1 : 0;
195 * @brief Asks and then saves modified files
197 BOOL CHexMergeDoc::PromptAndSaveIfNeeded(BOOL bAllowCancel)
199 bool bLModified = false, bMModified = false, bRModified = false;
203 bLModified = !!m_pView[0]->GetModified();
204 bMModified = !!m_pView[1]->GetModified();
205 bRModified = !!m_pView[2]->GetModified();
209 bLModified = !!m_pView[0]->GetModified();
210 bRModified = !!m_pView[1]->GetModified();
212 if (!bLModified && !bMModified && !bRModified)
215 const String &pathLeft = m_filePaths.GetLeft();
216 const String &pathMiddle = m_filePaths.GetMiddle();
217 const String &pathRight = m_filePaths.GetRight();
220 bool bLSaveSuccess = false, bMSaveSuccess = false, bRSaveSuccess = false;
223 dlg.DoAskFor(bLModified, bMModified, bRModified);
225 dlg.m_bDisableCancel = true;
226 if (!pathLeft.empty())
227 dlg.m_sLeftFile = pathLeft;
229 dlg.m_sLeftFile = m_strDesc[0];
232 if (!pathMiddle.empty())
233 dlg.m_sMiddleFile = pathMiddle;
235 dlg.m_sMiddleFile = m_strDesc[1];
237 if (!pathRight.empty())
238 dlg.m_sRightFile = pathRight;
240 dlg.m_sRightFile = m_strDesc[1];
242 if (dlg.DoModal() == IDOK)
246 if (dlg.m_leftSave == SaveClosingDlg::SAVECLOSING_SAVE)
248 switch (Try(m_pView[0]->SaveFile(pathLeft.c_str())))
251 bLSaveSuccess = TRUE;
260 m_pView[0]->SetSavePoint();
265 if (dlg.m_middleSave == SaveClosingDlg::SAVECLOSING_SAVE)
267 switch (Try(m_pView[1]->SaveFile(pathMiddle.c_str())))
270 bMSaveSuccess = TRUE;
279 m_pView[1]->SetSavePoint();
284 if (dlg.m_rightSave == SaveClosingDlg::SAVECLOSING_SAVE)
286 switch (Try(m_pView[m_nBuffers - 1]->SaveFile(pathRight.c_str())))
289 bRSaveSuccess = TRUE;
298 m_pView[m_nBuffers - 1]->SetSavePoint();
307 // If file were modified and saving was successfull,
308 // update status on dir view
309 if (bLSaveSuccess || bMSaveSuccess || bRSaveSuccess)
311 UpdateDiffItem(m_pDirDoc);
318 * @brief Save modified documents
320 BOOL CHexMergeDoc::SaveModified()
322 return PromptAndSaveIfNeeded(TRUE);
326 * @brief Saves both files
328 void CHexMergeDoc::OnFileSave()
330 for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
334 void CHexMergeDoc::DoFileSave(int nBuffer)
336 if (m_pView[nBuffer]->GetModified())
338 if (m_nBufferType[nBuffer] == BUFFER_UNNAMED)
339 DoFileSaveAs(nBuffer);
342 const String &path = m_filePaths.GetPath(nBuffer);
343 if (Try(m_pView[nBuffer]->SaveFile(path.c_str())) == IDCANCEL)
346 UpdateDiffItem(m_pDirDoc);
350 void CHexMergeDoc::DoFileSaveAs(int nBuffer)
352 const String &path = m_filePaths.GetPath(nBuffer);
356 title = _("Save Left File As");
357 else if (nBuffer == m_nBuffers - 1)
358 title = _("Save Right File As");
360 title = _("Save Middle File As");
361 if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, FALSE, path.c_str(), title))
363 if (Try(m_pView[nBuffer]->SaveFile(strPath.c_str())) == IDCANCEL)
367 // We are saving scratchpad (unnamed file)
368 m_nBufferType[nBuffer] = BUFFER_UNNAMED_SAVED;
369 m_strDesc[nBuffer].erase();
372 m_filePaths.SetPath(nBuffer, strPath);
373 UpdateDiffItem(m_pDirDoc);
374 UpdateHeaderPath(nBuffer);
379 * @brief Saves left-side file
381 void CHexMergeDoc::OnFileSaveLeft()
387 * @brief Saves middle-side file
389 void CHexMergeDoc::OnFileSaveMiddle()
395 * @brief Saves right-side file
397 void CHexMergeDoc::OnFileSaveRight()
399 DoFileSave(m_nBuffers - 1);
403 * @brief Saves left-side file with name asked
405 void CHexMergeDoc::OnFileSaveAsLeft()
411 * @brief Saves right-side file with name asked
413 void CHexMergeDoc::OnFileSaveAsMiddle()
419 * @brief Saves right-side file with name asked
421 void CHexMergeDoc::OnFileSaveAsRight()
423 DoFileSaveAs(m_nBuffers - 1);
427 * @brief Update diff-number pane text
429 void CHexMergeDoc::OnUpdateStatusNum(CCmdUI* pCmdUI)
432 pCmdUI->SetText(s.c_str());
436 * @brief DirDoc gives us its identity just after it creates us
438 void CHexMergeDoc::SetDirDoc(CDirDoc * pDirDoc)
440 ASSERT(pDirDoc && !m_pDirDoc);
445 * @brief Return pointer to parent frame
447 CHexMergeFrame * CHexMergeDoc::GetParentFrame() const
449 return static_cast<CHexMergeFrame *>(m_pView[0]->GetParentFrame());
453 * @brief DirDoc is closing
455 void CHexMergeDoc::DirDocClosing(CDirDoc * pDirDoc)
457 ASSERT(m_pDirDoc == pDirDoc);
462 * @brief DirDoc commanding us to close
464 bool CHexMergeDoc::CloseNow()
466 // Allow user to cancel closing
467 if (!PromptAndSaveIfNeeded(TRUE))
470 GetParentFrame()->CloseNow();
475 * @brief Load one file
477 HRESULT CHexMergeDoc::LoadOneFile(int index, LPCTSTR filename, BOOL readOnly, const String& strDesc)
481 if (Try(m_pView[index]->LoadFile(filename), MB_ICONSTOP) != 0)
483 m_pView[index]->SetReadOnly(readOnly);
484 m_filePaths.SetPath(index, filename);
485 ASSERT(m_nBufferType[index] == BUFFER_NORMAL); // should have been initialized to BUFFER_NORMAL in constructor
486 if (!strDesc.empty())
488 m_strDesc[index] = strDesc;
489 m_nBufferType[index] = BUFFER_NORMAL_NAMED;
494 m_nBufferType[index] = BUFFER_UNNAMED;
495 m_strDesc[index] = strDesc;
497 UpdateHeaderPath(index);
498 m_pView[index]->ResizeWindow();
503 * @brief Load files and initialize frame's compare result icon
505 bool CHexMergeDoc::OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], int nPane)
507 CHexMergeFrame *pf = GetParentFrame();
509 bool bSucceeded = true;
511 for (nBuffer = 0; nBuffer < nFiles; nBuffer++)
513 if (FAILED(LoadOneFile(nBuffer, fileloc[nBuffer].filepath.c_str(), bRO[nBuffer], strDesc ? strDesc[nBuffer] : _T(""))))
519 if (nBuffer == nFiles)
521 // An extra ResizeWindow() on the left view aligns scroll ranges, and
522 // also triggers initial diff coloring by invalidating the client area.
523 m_pView[0]->ResizeWindow();
527 if (GetOptionsMgr()->GetBool(OPT_SCROLL_TO_FIRST))
528 m_pView[0]->SendMessage(WM_COMMAND, ID_FIRSTDIFF);
532 // Use verify macro to trap possible error in debug.
533 VERIFY(pf->DestroyWindow());
538 void CHexMergeDoc::CheckFileChanged(void)
540 for (int pane = 0; pane < m_nBuffers; ++pane)
542 if (m_pView[pane]->IsFileChangedOnDisk(m_filePaths[pane].c_str()))
544 String msg = strutils::format_string1(_("Another application has updated file\n%1\nsince WinMerge scanned it last time.\n\nDo you want to reload the file?"), m_filePaths[pane]);
545 if (AfxMessageBox(msg.c_str(), MB_YESNO | MB_ICONWARNING) == IDYES)
555 * @brief Write path and filename to headerbar
556 * @note SetText() does not repaint unchanged text
558 void CHexMergeDoc::UpdateHeaderPath(int pane)
560 CHexMergeFrame *pf = GetParentFrame();
564 if (m_nBufferType[pane] == BUFFER_UNNAMED ||
565 m_nBufferType[pane] == BUFFER_NORMAL_NAMED)
567 sText = m_strDesc[pane];
571 sText = m_filePaths.GetPath(pane);
573 m_pDirDoc->ApplyDisplayRoot(pane, sText);
575 if (m_pView[pane]->GetModified())
576 sText.insert(0, _T("* "));
577 pf->GetHeaderInterface()->SetText(pane, sText);
584 * @brief Customize a heksedit control's settings
586 static void Customize(IHexEditorWindow::Settings *settings)
588 settings->bSaveIni = FALSE;
589 //settings->iAutomaticBPL = FALSE;
590 //settings->iBytesPerLine = 16;
591 //settings->iFontSize = 8;
595 * @brief Customize a heksedit control's colors
597 static void Customize(IHexEditorWindow::Colors *colors)
599 COptionsMgr *pOptionsMgr = GetOptionsMgr();
600 colors->iSelBkColorValue = RGB(224, 224, 224);
601 colors->iDiffBkColorValue = pOptionsMgr->GetInt(OPT_CLR_DIFF);
602 colors->iSelDiffBkColorValue = pOptionsMgr->GetInt(OPT_CLR_SELECTED_DIFF);
603 colors->iDiffTextColorValue = pOptionsMgr->GetInt(OPT_CLR_DIFF_TEXT);
604 if (colors->iDiffTextColorValue == 0xFFFFFFFF)
605 colors->iDiffTextColorValue = 0;
606 colors->iSelDiffTextColorValue = pOptionsMgr->GetInt(OPT_CLR_SELECTED_DIFF_TEXT);
607 if (colors->iSelDiffTextColorValue == 0xFFFFFFFF)
608 colors->iSelDiffTextColorValue = 0;
609 SyntaxColors *pSyntaxColors = theApp.GetMainSyntaxColors();
610 colors->iTextColorValue = pSyntaxColors->GetColor(COLORINDEX_NORMALTEXT);
611 colors->iBkColorValue = pSyntaxColors->GetColor(COLORINDEX_BKGND);
612 colors->iSelTextColorValue = pSyntaxColors->GetColor(COLORINDEX_SELTEXT);
613 colors->iSelBkColorValue = pSyntaxColors->GetColor(COLORINDEX_SELBKGND);
617 * @brief Customize a heksedit control's settings and colors
619 static void Customize(IHexEditorWindow *pif)
621 Customize(pif->get_settings());
622 Customize(pif->get_colors());
623 //LANGID wLangID = (LANGID)GetThreadLocale();
624 //pif->load_lang(wLangID);
627 void CHexMergeDoc::RefreshOptions()
629 for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
631 IHexEditorWindow *pif = m_pView[nBuffer]->GetInterface();
632 pif->read_ini_data();
634 pif->resize_window();
639 * @brief Update document filenames to title
641 void CHexMergeDoc::SetTitle(LPCTSTR lpszTitle)
650 for (int nBuffer = 0; nBuffer < m_filePaths.GetSize(); nBuffer++)
651 sFileName[nBuffer] = !m_strDesc[nBuffer].empty() ? m_strDesc[nBuffer] : paths::FindFileName(m_filePaths[nBuffer]);
652 if (std::count(&sFileName[0], &sFileName[0] + m_nBuffers, sFileName[0]) == m_nBuffers)
653 sTitle = sFileName[0] + strutils::format(_T(" x %d"), m_nBuffers);
655 sTitle = strutils::join(&sFileName[0], &sFileName[0] + m_nBuffers, _T(" - "));
657 CDocument::SetTitle(sTitle.c_str());
661 * @brief We have two child views (left & right), so we keep pointers directly
662 * at them (the MFC view list doesn't have them both)
664 void CHexMergeDoc::SetMergeViews(CHexMergeView *pView[])
666 for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
668 ASSERT(pView[nBuffer] && !m_pView[nBuffer]);
669 m_pView[nBuffer] = pView[nBuffer];
670 m_pView[nBuffer]->m_nThisPane = nBuffer;
675 * @brief Called when "Save left" item is updated
677 void CHexMergeDoc::OnUpdateFileSaveLeft(CCmdUI* pCmdUI)
679 pCmdUI->Enable(m_pView[0]->GetModified());
683 * @brief Called when "Save middle" item is updated
685 void CHexMergeDoc::OnUpdateFileSaveMiddle(CCmdUI* pCmdUI)
687 pCmdUI->Enable(m_nBuffers == 3 && m_pView[1]->GetModified());
691 * @brief Called when "Save right" item is updated
693 void CHexMergeDoc::OnUpdateFileSaveRight(CCmdUI* pCmdUI)
695 pCmdUI->Enable(m_pView[m_nBuffers - 1]->GetModified());
699 * @brief Called when "Save" item is updated
701 void CHexMergeDoc::OnUpdateFileSave(CCmdUI* pCmdUI)
703 BOOL bModified = FALSE;
704 for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
705 bModified |= m_pView[nBuffer]->GetModified();
706 pCmdUI->Enable(bModified);
710 * @brief Reloads the opened files
712 void CHexMergeDoc::OnFileReload()
714 if (!PromptAndSaveIfNeeded(true))
717 FileLocation fileloc[3];
719 for (int pane = 0; pane < m_nBuffers; pane++)
721 fileloc[pane].setPath(m_filePaths[pane]);
722 bRO[pane] = !!m_pView[pane]->GetReadOnly();
724 int nActivePane = GetActiveMergeView()->m_nThisPane;
725 OpenDocs(m_nBuffers, fileloc, bRO, m_strDesc, nActivePane);
729 * @brief Copy selected bytes from left to right
731 void CHexMergeDoc::OnL2r()
733 int dstPane = (GetActiveMergeView()->m_nThisPane < m_nBuffers - 1) ? GetActiveMergeView()->m_nThisPane + 1 : m_nBuffers - 1;
734 int srcPane = dstPane - 1;
735 CHexMergeView::CopySel(m_pView[srcPane], m_pView[dstPane]);
739 * @brief Copy selected bytes from right to left
741 void CHexMergeDoc::OnR2l()
743 int dstPane = (GetActiveMergeView()->m_nThisPane > 0) ? GetActiveMergeView()->m_nThisPane - 1 : 0;
744 int srcPane = dstPane + 1;
745 CHexMergeView::CopySel(m_pView[srcPane], m_pView[dstPane]);
749 * @brief Copy selected bytes from left to active pane
751 void CHexMergeDoc::OnCopyFromLeft()
753 int dstPane = GetActiveMergeView()->m_nThisPane;
754 int srcPane = (dstPane - 1 < 0) ? 0 : dstPane - 1;
755 CHexMergeView::CopySel(m_pView[srcPane], m_pView[dstPane]);
759 * @brief Copy selected bytes from right to active pane
761 void CHexMergeDoc::OnCopyFromRight()
763 int dstPane = GetActiveMergeView()->m_nThisPane;
764 int srcPane = (dstPane + 1 > m_nBuffers - 1) ? m_nBuffers - 1 : dstPane + 1;
765 CHexMergeView::CopySel(m_pView[srcPane], m_pView[dstPane]);
769 * @brief Copy all bytes from left to right
771 void CHexMergeDoc::OnAllRight()
773 int dstPane = (GetActiveMergeView()->m_nThisPane < m_nBuffers - 1) ? GetActiveMergeView()->m_nThisPane + 1 : m_nBuffers - 1;
774 int srcPane = dstPane - 1;
775 CHexMergeView::CopyAll(m_pView[srcPane], m_pView[dstPane]);
779 * @brief Copy all bytes from right to left
781 void CHexMergeDoc::OnAllLeft()
783 int dstPane = (GetActiveMergeView()->m_nThisPane > 0) ? GetActiveMergeView()->m_nThisPane - 1 : 0;
784 int srcPane = dstPane + 1;
785 CHexMergeView::CopyAll(m_pView[srcPane], m_pView[dstPane]);
789 * @brief Called when user selects View/Zoom In from menu.
791 void CHexMergeDoc::OnViewZoomIn()
793 for (int pane = 0; pane < m_nBuffers; pane++)
794 m_pView[pane]->ZoomText(1);
798 * @brief Called when user selects View/Zoom Out from menu.
800 void CHexMergeDoc::OnViewZoomOut()
802 for (int pane = 0; pane < m_nBuffers; pane++)
803 m_pView[pane]->ZoomText(-1);
807 * @brief Called when user selects View/Zoom Normal from menu.
809 void CHexMergeDoc::OnViewZoomNormal()
811 for (int pane = 0; pane < m_nBuffers; pane++)
812 m_pView[pane]->ZoomText(0);
815 void CHexMergeDoc::OnRefresh()
817 if (UpdateDiffItem(m_pDirDoc) == 0)
818 LangMessageBox(IDS_FILESSAME, MB_ICONINFORMATION | MB_DONT_DISPLAY_AGAIN);
821 void CHexMergeDoc::OnFileRecompareAsText()
823 FileLocation fileloc[3];
826 int nBuffers = m_nBuffers;
827 CDirDoc *pDirDoc = m_pDirDoc->GetMainView() ? m_pDirDoc :
828 static_cast<CDirDoc*>(theApp.m_pDirTemplate->CreateNewDocument());
829 for (int nBuffer = 0; nBuffer < nBuffers; ++nBuffer)
831 fileloc[nBuffer].setPath(m_filePaths[nBuffer]);
832 dwFlags[nBuffer] = m_pView[nBuffer]->GetReadOnly() ? FFILEOPEN_READONLY : 0;
833 strDesc[nBuffer] = m_strDesc[nBuffer];
836 GetMainFrame()->ShowMergeDoc(pDirDoc, nBuffers, fileloc, dwFlags, strDesc);