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

Method OnCommand

Src/FileFilterHelperMenu.cpp:238–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238std::optional<String> CFileFilterHelperMenu::OnCommand(const String& masks, int command, CWnd* pParentWnd)
239{
240 const String Sides[] = { _T(""), _T("Left"), _T("Middle"), _T("Right") };
241 const String DiffSides1[] = { _T("Left"), _T("Left"), _T("Middle") };
242 const String DiffSides2[] = { _T("Right"), _T("Middle"), _T("Right") };
243 std::optional<String> result;
244 if (command == ID_FILTERMENU_MASK_CLEAR)
245 {
246 result = _T("");
247 }
248 else if (command == ID_FILTERMENU_MASK_REMOVE_LAST)
249 {
250 std::vector<String> filterGroups = FileFilterHelper::SplitFilterGroups(masks);
251 filterGroups.pop_back();
252 result = FileFilterHelper::JoinFilterGroups(filterGroups);
253 }
254 else if (command == ID_FILTERMENU_MASK_ALL)
255 {
256 result = _T("*.*");
257 }
258 else if (command == ID_FILTERMENU_FILE_SYS)
259 {
260 result = masks.empty() ? masks : masks + _T(";");
261 *result += _T("!pagefile.sys;!hiberfil.sys;!swapfile.sys;!Thumbs.db;!desktop.ini");
262 }
263 else if (command == ID_FILTERMENU_FILE_BACKUP)
264 {
265 result = masks.empty() ? masks : masks + _T(";");
266 *result += _T("!*.bak;!*.old;!*.orig;!*.swp;!*.swo;!*.tmp;!*.temp;!*.save;!*.backup;!*.*~");
267 }
268 else if (command == ID_FILTERMENU_FILE_BIN)
269 {
270 result = masks.empty() ? masks : masks + _T(";");
271 *result += _T("!*.exe;!*.dll;!*.ocx;!*.sys;!*.drv;!*.cpl;!*.scr;!*.com;!*.jar;!*.war;!*.obj;!*.o;!*.lib;!*.so;!*.a;!*.class;!*.pyc;!*.pyo");
272 }
273 else if (command == ID_FILTERMENU_FILE_LOG)
274 {
275 result = masks.empty() ? masks : masks + _T(";");
276 *result += _T("!*.log;!*.out;!*.err;!*.trace");
277 }
278 else if (command == ID_FILTERMENU_FILE_TEMP)
279 {
280 result = masks.empty() ? masks : masks + _T(";");
281 *result += _T("!*.tmp;!*.temp;!*.cache;!*.dmp;!*.swp");
282 }
283 else if (command == ID_FILTERMENU_FOLDER_VCS)
284 {
285 result = masks.empty() ? masks : masks + _T(";");
286 *result += _T("!.git\\;!.svn\\;!.hg\\");
287 }
288 else if (command == ID_FILTERMENU_FOLDER_BUILD)
289 {
290 result = masks.empty() ? masks : masks + _T(";");
291 *result += _T("!build\\;!bin\\;!obj\\;!out\\;!dist\\;!release\\;!debug\\;!target\\;!temp\\;!cache\\");
292 }
293 else if (command == ID_FILTERMENU_FOLDER_IDE)
294 {
295 result = masks.empty() ? masks : masks + _T(";");

Callers

nothing calls this directly

Calls 6

format_string1Function · 0.50
format_string2Function · 0.50
pop_backMethod · 0.45
emptyMethod · 0.45
DoModalMethod · 0.45
ShowMenuMethod · 0.45

Tested by

no test coverage detected