81 lines
4.3 KiB
C++
81 lines
4.3 KiB
C++
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#pragma once
|
|
|
|
#include <cstring>
|
|
|
|
#include "BIMDesktopCommands.h"
|
|
#include "BIMManagementCommands.h"
|
|
#include "BIMImagePlaneCommand.h"
|
|
#include "BIMSolidCommands.h"
|
|
|
|
struct BimDesktopCommandImplementation {
|
|
const char* name;
|
|
BimDesktopCommandRoute route;
|
|
const char* script;
|
|
};
|
|
|
|
static const BimDesktopCommandImplementation* bimDesktopCommandImplementation(const char* name)
|
|
{
|
|
static const BimDesktopCommandImplementation commands[] = {
|
|
{"BIM_EmptyTrash", BimDesktopCommandRoute::Document, bimEmptyTrashCommand},
|
|
{"BIM_Examples", BimDesktopCommandRoute::ExternalUrl, bimExamplesCommand},
|
|
{"BIM_Extrude", BimDesktopCommandRoute::Document, bimExtrudeCommand.c_str()},
|
|
{"BIM_Fuse", BimDesktopCommandRoute::Document, bimFuseCommand.c_str()},
|
|
{"BIM_Library", BimDesktopCommandRoute::Document, bimLibraryCommand},
|
|
{"BIM_LinkMake", BimDesktopCommandRoute::Document, bimLinkMakeCommand},
|
|
{"BIM_MoveView", BimDesktopCommandRoute::Document, bimMoveViewCommand},
|
|
{"BIM_Offset2D", BimDesktopCommandRoute::Document, bimOffset2DCommand},
|
|
{"BIM_Preflight", BimDesktopCommandRoute::Document, bimPreflightCommand},
|
|
{"BIM_Project", BimDesktopCommandRoute::Document, bimProjectCommand},
|
|
{"BIM_ProjectManager", BimDesktopCommandRoute::Document, bimProjectManagerCommand},
|
|
{"BIM_Reextrude", BimDesktopCommandRoute::Document, bimReextrudeCommand},
|
|
{"BIM_IfcProperties", BimDesktopCommandRoute::Document, bimIfcPropertiesCommand.c_str()},
|
|
{"BIM_IfcQuantities", BimDesktopCommandRoute::Document, bimManagementCommands},
|
|
{"BIM_ImagePlane", BimDesktopCommandRoute::Document, bimImagePlaneCommand},
|
|
{"BIM_Layers", BimDesktopCommandRoute::Document, bimManagementCommands},
|
|
{"BIM_Help", BimDesktopCommandRoute::ExternalUrl, bimHelpCommand},
|
|
{"BIM_Glue", BimDesktopCommandRoute::Document, bimGlueCommand},
|
|
{"BIM_IfcElements", BimDesktopCommandRoute::Document, bimIfcElementsCommand},
|
|
{"BIM_IfcExplorer", BimDesktopCommandRoute::Document, bimIfcExplorerCommand},
|
|
{"BIM_Leader", BimDesktopCommandRoute::Document, bimLeaderCommand},
|
|
{"BIM_Reorder", BimDesktopCommandRoute::Document, bimReorderCommand},
|
|
{"BIM_Report", BimDesktopCommandRoute::Document, bimReportCommand},
|
|
{"BIM_ResetCloneColors", BimDesktopCommandRoute::Document, bimResetCloneColorsCommand},
|
|
{"BIM_Views", BimDesktopCommandRoute::Document, bimViewsCommand},
|
|
{"BIM_Welcome", BimDesktopCommandRoute::Document, bimWelcomeCommand},
|
|
{"BIM_Rewire", BimDesktopCommandRoute::Document, bimRewireCommand},
|
|
{"BIM_Setup", BimDesktopCommandRoute::Document, bimSetupCommand},
|
|
{"BIM_SimpleCopy", BimDesktopCommandRoute::Document, bimSimpleCopyCommand},
|
|
{"BIM_Sketch", BimDesktopCommandRoute::Document, bimSketchCommand},
|
|
{"BIM_Slab", BimDesktopCommandRoute::Document, bimSlabCommand},
|
|
{"BIM_TDPage", BimDesktopCommandRoute::Document, bimTDPageCommand},
|
|
{"BIM_TDView", BimDesktopCommandRoute::Document, bimTDViewCommand},
|
|
{"BIM_Text", BimDesktopCommandRoute::Document, bimTextCommand},
|
|
{"BIM_TogglePanels", BimDesktopCommandRoute::Document, bimTogglePanelsCommand},
|
|
{"BIM_Trash", BimDesktopCommandRoute::Document, bimTrashCommand},
|
|
{"BIM_Tutorial", BimDesktopCommandRoute::Document, bimTutorialWorkflowCommand},
|
|
{"BIM_Unclone", BimDesktopCommandRoute::Document, bimUncloneCommand},
|
|
{"BIM_Ungroup", BimDesktopCommandRoute::Document, bimUngroupCommand},
|
|
{"BIM_Windows", BimDesktopCommandRoute::Document, bimWindowsCommand},
|
|
{"IFC_UpdateIOS", BimDesktopCommandRoute::Document, ifcUpdateIOSCommand},
|
|
};
|
|
for (const auto& command : commands) {
|
|
if (std::strcmp(name, command.name) == 0)
|
|
return &command;
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
static BimDesktopCommandRoute bimDesktopCommandRoute(const char* name)
|
|
{
|
|
const auto* command = bimDesktopCommandImplementation(name);
|
|
return command ? command->route : BimDesktopCommandRoute::Unhandled;
|
|
}
|
|
|
|
// Keep the desktop command table authoritative for commands whose implementations
|
|
// are supplied by the native BIM Python modules.
|
|
static bool bimDesktopCommandRegistered(const char* name)
|
|
{
|
|
return bimDesktopCommandImplementation(name) != nullptr;
|
|
}
|