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

Method DoFileNew

Src/MainFrm.cpp:2069–2096  ·  view source on GitHub ↗

* @brief Open two new empty docs, 'Scratchpads' * * Allows user to open two empty docs, to paste text to * compare from clipboard. * @note File filenames are set emptys and filedescriptors * are loaded from resource. * @sa CMergeDoc::OpenDocs() * @sa CMergeDoc::TrySaveAs() */

Source from the content-addressed store, hash-verified

2067 * @sa CMergeDoc::TrySaveAs()
2068 */
2069bool CMainFrame::DoFileNew(UINT nID, int nPanes,
2070 const fileopenflags_t dwFlags[], const String strDesc[],
2071 const PrediffingInfo *infoPrediffer /*= nullptr*/,
2072 const OpenFileParams *pOpenParams)
2073{
2074 // Load emptyfile descriptors and open empty docs
2075 // Use default codepage
2076 FileLocation fileloc[3];
2077 String strDesc2[3];
2078 if (nPanes == 2)
2079 {
2080 strDesc2[0] = _("Untitled Left");
2081 strDesc2[1] = _("Untitled Right");
2082 }
2083 else
2084 {
2085 strDesc2[0] = _("Untitled Left");
2086 strDesc2[1] = _("Untitled Middle");
2087 strDesc2[2] = _("Untitled Right");
2088 }
2089 for (int i = 0; i < nPanes; ++i)
2090 {
2091 if (strDesc && !strDesc[i].empty())
2092 strDesc2[i] = strDesc[i];
2093 fileloc[i].encoding.SetCodepage(ucr::getDefaultCodepage());
2094 }
2095 return ShowMergeDoc(nID, nullptr, nPanes, fileloc, dwFlags, strDesc2, _T(""), nullptr, infoPrediffer, pOpenParams);
2096}
2097
2098/**
2099 * @brief Open Filters dialog

Callers 2

ParseArgsAndDoOpenMethod · 0.80
TESTFunction · 0.80

Calls 3

getDefaultCodepageFunction · 0.85
emptyMethod · 0.45
SetCodepageMethod · 0.45

Tested by 1

TESTFunction · 0.64