Download src/Mod/Material/Gui/Command.cpp from AbdulElahGwaith/FreeCAD: direct link, hf CLI and curl.
- Browser
- Download file 8.08 kB
-
https://huggingface.co/AbdulElahGwaith/FreeCAD/resolve/main/src/Mod/Material/Gui/Command.cpp
- Command line
-
hf download hf://AbdulElahGwaith/FreeCAD/src/Mod/Material/Gui/Command.cpp
-
curl -L -o Command.cpp https://huggingface.co/AbdulElahGwaith/FreeCAD/resolve/main/src/Mod/Material/Gui/Command.cpp
8.08 kB
| // SPDX-License-Identifier: LGPL-2.1-or-later | |
| /*************************************************************************** | |
| * Copyright (c) 2023 David Carter <dcarter@david.carter.ca> * | |
| * * | |
| * This file is part of FreeCAD. * | |
| * * | |
| * FreeCAD is free software: you can redistribute it and/or modify it * | |
| * under the terms of the GNU Lesser General Public License as * | |
| * published by the Free Software Foundation, either version 2.1 of the * | |
| * License, or (at your option) any later version. * | |
| * * | |
| * FreeCAD is distributed in the hope that it will be useful, but * | |
| * WITHOUT ANY WARRANTY; without even the implied warranty of * | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | |
| * Lesser General Public License for more details. * | |
| * * | |
| * You should have received a copy of the GNU Lesser General Public * | |
| * License along with FreeCAD. If not, see * | |
| * <https://www.gnu.org/licenses/>. * | |
| * * | |
| **************************************************************************/ | |
| //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
| //=========================================================================== | |
| // Material_Edit | |
| //=========================================================================== | |
| DEF_STD_CMD_A(CmdMaterialEdit) | |
| CmdMaterialEdit::CmdMaterialEdit() | |
| : Command("Material_Edit") | |
| { | |
| sAppModule = "Material"; | |
| sGroup = QT_TR_NOOP("Material"); | |
| sMenuText = QT_TR_NOOP("Edit"); | |
| sToolTipText = QT_TR_NOOP("Edits material properties"); | |
| sWhatsThis = "Material_Edit"; | |
| sStatusTip = sToolTipText; | |
| sPixmap = "Material_Edit"; | |
| } | |
| void CmdMaterialEdit::activated(int iMsg) | |
| { | |
| Q_UNUSED(iMsg); | |
| static QPointer<QDialog> dlg = nullptr; | |
| if (!dlg) { | |
| dlg = new MatGui::MaterialsEditor(Gui::getMainWindow()); | |
| } | |
| dlg->setAttribute(Qt::WA_DeleteOnClose); | |
| dlg->show(); | |
| } | |
| bool CmdMaterialEdit::isActive() | |
| { | |
| // return (hasActiveDocument() && !Gui::Control().activeDialog()); | |
| return true; | |
| } | |
| //=========================================================================== | |
| // Std_SetAppearance | |
| //=========================================================================== | |
| DEF_STD_CMD_A(StdCmdSetAppearance) | |
| StdCmdSetAppearance::StdCmdSetAppearance() | |
| : Command("Std_SetAppearance") | |
| { | |
| sGroup = "Standard-View"; | |
| sMenuText = QT_TR_NOOP("&Appearance"); | |
| sToolTipText = QT_TR_NOOP("Sets the display properties of the selected object"); | |
| sWhatsThis = "Std_SetAppearance"; | |
| sStatusTip = QT_TR_NOOP("Sets the display properties of the selected object"); | |
| sPixmap = "Std_SetAppearance"; | |
| sAccel = "Ctrl+D"; | |
| eType = Alter3DView; | |
| } | |
| void StdCmdSetAppearance::activated(int iMsg) | |
| { | |
| Q_UNUSED(iMsg); | |
| Gui::Control().showDialog(new MatGui::TaskDisplayProperties()); | |
| } | |
| bool StdCmdSetAppearance::isActive() | |
| { | |
| return (Gui::Control().activeDialog() == nullptr) && (Gui::Selection().size() != 0); | |
| } | |
| //=========================================================================== | |
| // Std_SetMaterial | |
| //=========================================================================== | |
| DEF_STD_CMD_A(StdCmdSetMaterial) | |
| StdCmdSetMaterial::StdCmdSetMaterial() | |
| : Command("Std_SetMaterial") | |
| { | |
| sGroup = "Standard-View"; | |
| sMenuText = QT_TR_NOOP("&Material"); | |
| sToolTipText = QT_TR_NOOP("Sets the material of the selected object"); | |
| sWhatsThis = "Std_SetMaterial"; | |
| sStatusTip = QT_TR_NOOP("Sets the material of the selected object"); | |
| sPixmap = "Material_Edit"; | |
| // sAccel = "Ctrl+D"; | |
| // eType = Alter3DView; | |
| } | |
| void StdCmdSetMaterial::activated(int iMsg) | |
| { | |
| Q_UNUSED(iMsg); | |
| Gui::Control().showDialog(new MatGui::TaskMaterial()); | |
| } | |
| bool StdCmdSetMaterial::isActive() | |
| { | |
| return (Gui::Control().activeDialog() == nullptr) && (Gui::Selection().size() != 0); | |
| } | |
| //=========================================================================== | |
| // Materials_InspectAppearance | |
| //=========================================================================== | |
| DEF_STD_CMD_A(CmdInspectAppearance) | |
| CmdInspectAppearance::CmdInspectAppearance() | |
| : Command("Materials_InspectAppearance") | |
| { | |
| sGroup = "Standard-View"; | |
| sMenuText = QT_TR_NOOP("Inspect Appearance"); | |
| sToolTipText = QT_TR_NOOP("Inspects the appearance properties of the selected object"); | |
| sWhatsThis = "Materials_InspectAppearance"; | |
| sStatusTip = QT_TR_NOOP("Inspect the appearance properties of the selected object"); | |
| // sPixmap = "Material_Edit"; | |
| } | |
| void CmdInspectAppearance::activated(int iMsg) | |
| { | |
| Q_UNUSED(iMsg); | |
| Gui::Control().showDialog(new MatGui::TaskInspectAppearance()); | |
| } | |
| bool CmdInspectAppearance::isActive() | |
| { | |
| return (Gui::Control().activeDialog() == nullptr); | |
| } | |
| //=========================================================================== | |
| // Materials_InspectMaterial | |
| //=========================================================================== | |
| DEF_STD_CMD_A(CmdInspectMaterial) | |
| CmdInspectMaterial::CmdInspectMaterial() | |
| : Command("Materials_InspectMaterial") | |
| { | |
| sGroup = "Standard-View"; | |
| sMenuText = QT_TR_NOOP("Inspect Material"); | |
| sToolTipText = QT_TR_NOOP("Inspects the material properties of the selected object"); | |
| sWhatsThis = "Materials_InspectMaterial"; | |
| sStatusTip = QT_TR_NOOP("Inspect the material properties of the selected object"); | |
| // sPixmap = "Material_Edit"; | |
| } | |
| void CmdInspectMaterial::activated(int iMsg) | |
| { | |
| Q_UNUSED(iMsg); | |
| Gui::Control().showDialog(new MatGui::TaskInspectMaterial()); | |
| } | |
| bool CmdInspectMaterial::isActive() | |
| { | |
| return (Gui::Control().activeDialog() == nullptr); | |
| } | |
| //=========================================================================== | |
| // Materials_MigrateToDatabase | |
| //=========================================================================== | |
| DEF_STD_CMD_A(CmdMigrateToExternal) | |
| CmdMigrateToExternal::CmdMigrateToExternal() | |
| : Command("Materials_MigrateToExternal") | |
| { | |
| sGroup = "Standard-View"; | |
| sMenuText = QT_TR_NOOP("Migrate"); | |
| sToolTipText = QT_TR_NOOP("Migrates the materials to the external materials manager"); | |
| sWhatsThis = "Materials_MigrateToDatabase"; | |
| sStatusTip = QT_TR_NOOP("Migrate existing materials to the external materials manager"); | |
| // sPixmap = "Materials_Edit"; | |
| } | |
| void CmdMigrateToExternal::activated(int iMsg) | |
| { | |
| Q_UNUSED(iMsg); | |
| MatGui::TaskMigrateExternal* dlg = new MatGui::TaskMigrateExternal(); | |
| Gui::Control().showDialog(dlg); | |
| } | |
| bool CmdMigrateToExternal::isActive() | |
| { | |
| return true; | |
| } | |
| //--------------------------------------------------------------- | |
| void CreateMaterialCommands() | |
| { | |
| Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager(); | |
| rcCmdMgr.addCommand(new CmdMaterialEdit()); | |
| rcCmdMgr.addCommand(new StdCmdSetAppearance()); | |
| rcCmdMgr.addCommand(new StdCmdSetMaterial()); | |
| rcCmdMgr.addCommand(new CmdInspectAppearance()); | |
| rcCmdMgr.addCommand(new CmdInspectMaterial()); | |
| rcCmdMgr.addCommand(new CmdMigrateToExternal()); | |
| } | |