MCPcopy Create free account
hub / github.com/WinMerge/winmerge / ShowIdenticalMessage

Method ShowIdenticalMessage

Src/MergeFrameCommon.cpp:182–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void CMergeFrameCommon::ShowIdenticalMessage(const PathContext& paths, bool bIdenticalAll, bool bExactCompareAsync)
183{
184 String s;
185 if (theApp.m_bExitIfNoDiff != MergeCmdLineInfo::ExitQuiet)
186 {
187 UINT nFlags = MB_ICONINFORMATION | MB_DONT_DISPLAY_AGAIN;
188
189 if (theApp.m_bExitIfNoDiff == MergeCmdLineInfo::Exit)
190 {
191 // Show the "files are identical" for basic "exit no diff" flag
192 // If user don't want to see the message one uses the quiet version
193 // of the "exit no diff".
194 nFlags &= ~MB_DONT_DISPLAY_AGAIN;
195 }
196 if ((paths.GetSize() == 2 && !paths.GetLeft().empty() && !paths.GetRight().empty() &&
197 strutils::compare_nocase(paths.GetLeft(), paths.GetRight()) == 0) ||
198 (paths.GetSize() == 3 && !paths.GetLeft().empty() && !paths.GetMiddle().empty() && !paths.GetRight().empty() &&
199 (strutils::compare_nocase(paths.GetLeft(), paths.GetRight()) == 0 ||
200 strutils::compare_nocase(paths.GetMiddle(), paths.GetRight()) == 0 ||
201 strutils::compare_nocase(paths.GetLeft(), paths.GetMiddle()) == 0)))
202 {
203 // compare file to itself, a custom message so user may hide the message in this case only
204 s = _("Same file is opened in both panes.");
205 AfxMessageBox(s.c_str(), nFlags, IDS_FILE_TO_ITSELF);
206 }
207 else if (bIdenticalAll)
208 {
209 s = _("Selected files are identical.");
210 if (bExactCompareAsync)
211 {
212 if (theApp.GetNonInteractive())
213 {
214 theApp.OutputConsole(s + _T(": Cancel"));
215 return;
216 }
217 s = _("Selected files are identical (with current settings).\r\nChecking binary identity...");
218 CMessageBoxDialog dlgMessageBox(nullptr, s.c_str(), _T(""), nFlags, IDS_FILESSAME);
219 dlgMessageBox.SetAsyncTask(std::make_shared<AsyncCompareTask>(paths));
220 dlgMessageBox.DoModal();
221 }
222 else
223 {
224 AfxMessageBox(s.c_str(), nFlags, IDS_FILESSAME);
225 }
226 }
227 }
228
229 if (bIdenticalAll)
230 {
231 // Exit application if files are identical.
232 if (theApp.m_bExitIfNoDiff == MergeCmdLineInfo::Exit ||
233 theApp.m_bExitIfNoDiff == MergeCmdLineInfo::ExitQuiet)
234 {
235 AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_APP_EXIT);
236 }
237 }
238}
239

Callers

nothing calls this directly

Calls 10

GetNonInteractiveMethod · 0.80
OutputConsoleMethod · 0.80
SetAsyncTaskMethod · 0.80
compare_nocaseFunction · 0.50
GetSizeMethod · 0.45
emptyMethod · 0.45
GetLeftMethod · 0.45
GetRightMethod · 0.45
GetMiddleMethod · 0.45
DoModalMethod · 0.45

Tested by

no test coverage detected