Gui: Move Submenu Commands in Tool Menu (#20864)

* Moved tools submenu commands and title case

* Apply suggestions from code review

Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
This commit is contained in:
Kris
2025-06-18 23:33:36 -07:00
committed by GitHub
parent f7e932f575
commit 0090566724
6 changed files with 17 additions and 114 deletions

View File

@@ -379,9 +379,9 @@ StdCmdDlgParameter::StdCmdDlgParameter()
{
sGroup = "Tools";
sMenuText = QT_TR_NOOP("E&dit parameters...");
sToolTipText = QT_TR_NOOP("Opens a Dialog to edit the parameters");
sToolTipText = QT_TR_NOOP("Opens a dialog to edit the parameters");
sWhatsThis = "Std_DlgParameter";
sStatusTip = QT_TR_NOOP("Opens a Dialog to edit the parameters");
sStatusTip = QT_TR_NOOP("Opens a dialog to edit the parameters");
sPixmap = "Std_DlgParameter";
eType = 0;
}
@@ -404,9 +404,9 @@ StdCmdDlgPreferences::StdCmdDlgPreferences()
{
sGroup = "Tools";
sMenuText = QT_TR_NOOP("Prefere&nces ...");
sToolTipText = QT_TR_NOOP("Opens a Dialog to edit the preferences");
sToolTipText = QT_TR_NOOP("Opens a dialog to edit the preferences");
sWhatsThis = "Std_DlgPreferences";
sStatusTip = QT_TR_NOOP("Opens a Dialog to edit the preferences");
sStatusTip = QT_TR_NOOP("Opens a dialog to edit the preferences");
sPixmap = "preferences-system";
eType = 0;
sAccel = "Ctrl+,";

View File

@@ -718,24 +718,25 @@ MenuItem* StdWorkbench::setupMenuBar() const
// Tools
auto tool = new MenuItem( menuBar );
tool->setCommand("&Tools");
*tool << "Std_DlgParameter"
#ifdef BUILD_ADDONMGR
*tool << "Std_AddonMgr"
<< "Separator";
#endif
*tool << "Std_Measure"
<< "Std_UnitsCalculator"
<< "Separator"
<< "Std_ViewScreenShot"
<< "Std_ViewLoadImage"
<< "Std_ViewScreenShot"
<< "Std_TextDocument"
<< "Std_DemoMode"
<< "Separator"
<< "Std_SceneInspector"
<< "Std_DependencyGraph"
<< "Std_ExportDependencyGraph"
<< "Separator"
<< "Std_ProjectUtil"
<< "Separator"
<< "Std_TextDocument"
<< "Separator"
<< "Std_DemoMode"
<< "Std_UnitsCalculator"
<< "Separator"
<< "Std_DlgParameter"
<< "Std_DlgCustomize";
#ifdef BUILD_ADDONMGR
*tool << "Std_AddonMgr";
#endif
// Macro
auto macro = new MenuItem( menuBar );
@@ -811,7 +812,7 @@ ToolBarItem* StdWorkbench::setupToolBars() const
auto view = new ToolBarItem( root );
view->setCommand("View");
*view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_ViewGroup" << "Std_AlignToSelection"
<< "Separator" << "Std_DrawStyle" << "Std_TreeViewActions";
<< "Separator" << "Std_DrawStyle" << "Std_TreeViewActions" << "Std_Measure";
// Individual views
auto individualViews = new ToolBarItem(root, ToolBarItem::DefaultVisibility::Hidden);

View File

@@ -37,7 +37,6 @@
#include "ViewProviderMeasureAngle.h"
#include "ViewProviderMeasureDistance.h"
#include "ViewProviderMeasureBase.h"
#include "WorkbenchManipulator.h"
// use a different name to CreateCommand()
@@ -87,9 +86,6 @@ PyMOD_INIT_FUNC(MeasureGui)
PyObject* mod = MeasureGui::initModule();
Base::Console().log("Loading GUI of Measure module... done\n");
auto manip = std::make_shared<MeasureGui::WorkbenchManipulator>();
Gui::WorkbenchManipulator::installManipulator(manip);
// instantiating the commands
CreateMeasureCommands();

View File

@@ -50,8 +50,6 @@ SET(MeasureGui_SRCS
ViewProviderMeasureAngle.h
ViewProviderMeasureDistance.cpp
ViewProviderMeasureDistance.h
WorkbenchManipulator.cpp
WorkbenchManipulator.h
DlgPrefsMeasureAppearanceImp.ui
DlgPrefsMeasureAppearanceImp.cpp
DlgPrefsMeasureAppearanceImp.h

View File

@@ -1,51 +0,0 @@
/***************************************************************************
* Copyright (c) 2024 David Friedli <david[at]friedli-be.ch> *
* *
* 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/>. *
* *
**************************************************************************/
#include "PreCompiled.h"
#include "WorkbenchManipulator.h"
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
using namespace MeasureGui;
void WorkbenchManipulator::modifyMenuBar([[maybe_unused]] Gui::MenuItem* menuBar)
{
auto menuTools = menuBar->findItem("&Tools");
if (!menuTools) {
return;
}
auto itemMeasure = new Gui::MenuItem();
itemMeasure->setCommand("Std_Measure");
menuTools->appendItem(itemMeasure);
}
void WorkbenchManipulator::modifyToolBars(Gui::ToolBarItem* toolBar)
{
auto tbView = toolBar->findItem("View");
if (!tbView) {
return;
}
auto itemMeasure = new Gui::ToolBarItem();
itemMeasure->setCommand("Std_Measure");
tbView->appendItem(itemMeasure);
}

View File

@@ -1,41 +0,0 @@
/***************************************************************************
* Copyright (c) 2024 David Friedli <david[at]friedli-be.ch> *
* *
* 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/>. *
* *
**************************************************************************/
#ifndef MEASUREGUI_WORKBENCHMANIPULATOR_H
#define MEASUREGUI_WORKBENCHMANIPULATOR_H
#include <Gui/WorkbenchManipulator.h>
namespace MeasureGui
{
class WorkbenchManipulator: public Gui::WorkbenchManipulator
{
protected:
void modifyMenuBar(Gui::MenuItem* menuBar) override;
void modifyToolBars(Gui::ToolBarItem* toolBar) override;
};
} // namespace MeasureGui
#endif // MEASUREGUI_WORKBENCHMANIPULATOR_H