MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / createFileMenu

Function createFileMenu

src/gui2/imhex_overrides/main_menu_items.cpp:373–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371 }
372
373 static void createFileMenu() {
374
375 ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.file", 1000);
376
377 /* Create File */
378 ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.create_file" }, ICON_VS_FILE, 1050, CTRLCMD + Keys::N + AllowWhileTyping, [] {
379 auto newProvider = hex::ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
380 if (newProvider != nullptr && !newProvider->open())
381 hex::ImHexApi::Provider::remove(newProvider);
382 else
383 EventProviderOpened::post(newProvider);
384 }, noRunningTasks);
385
386 /* Open File */
387 ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_file" }, ICON_VS_FOLDER_OPENED, 1100, CTRLCMD + Keys::O + AllowWhileTyping + ShowOnWelcomeScreen, [] {
388 RequestOpenWindow::post("Open File");
389 }, noRunningTasks, ContentRegistry::Views::getViewByName("hex.builtin.view.hex_editor.name"));
390
391 /* Open Other */
392 ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_other"}, ICON_VS_TELESCOPE, 1150, [] {
393 for (const auto &[unlocalizedProviderName, icon] : ContentRegistry::Provider::impl::getEntries()) {
394 if (menu::menuItemEx(Lang(unlocalizedProviderName), icon))
395 ImHexApi::Provider::createProvider(unlocalizedProviderName);
396 }
397 }, noRunningTasks);
398
399 /* Reload Provider */
400 ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.reload_provider"}, ICON_VS_REFRESH, 1250, CTRLCMD + Keys::R + AllowWhileTyping, [] {
401 auto provider = ImHexApi::Provider::get();
402
403 provider->close();
404 if (!provider->open())
405 ImHexApi::Provider::remove(provider, true);
406
407 EventDataChanged::post(provider);
408 }, noRunningTaskAndValidProvider);
409
410
411 /* Project open / save */
412 ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.project" }, ICON_VS_NOTEBOOK, 1400, []{}, noRunningTasks);
413
414 ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.open" }, ICON_VS_ROOT_FOLDER_OPENED, 1410,
415 CTRL + ALT + Keys::O + AllowWhileTyping,
416 openProject, noRunningTasks);
417
418 ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.save" }, ICON_VS_SAVE, 1450,
419 CTRL + ALT + Keys::S + AllowWhileTyping,
420 saveProject, [&] { return noRunningTaskAndValidProvider() && ProjectFile::hasPath(); });
421
422 ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.save_as" }, ICON_VS_SAVE_AS, 1500,
423 ALT + SHIFT + Keys::S + AllowWhileTyping,
424 saveProjectAs, noRunningTaskAndValidProvider);
425
426
427 ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 2000);
428
429 /* Import */
430 {

Callers 1

registerMainMenuEntriesFunction · 0.85

Calls 4

menuItemExFunction · 0.85
openMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected