FreeCAD

Форк
0
/
Workbench.cpp 
212 строк · 7.2 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2005 Werner Mayer <wmayer[at]users.sourceforge.net>     *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
6
 *   This library is free software; you can redistribute it and/or         *
7
 *   modify it under the terms of the GNU Library General Public           *
8
 *   License as published by the Free Software Foundation; either          *
9
 *   version 2 of the License, or (at your option) any later version.      *
10
 *                                                                         *
11
 *   This library  is distributed in the hope that it will be useful,      *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU Library General Public License for more details.                  *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Library General Public     *
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23

24
#include "PreCompiled.h"
25

26
#include "Workbench.h"
27
#include <Gui/MenuManager.h>
28
#include <Gui/ToolBarManager.h>
29

30
using namespace PartGui;
31

32
#if 0 // needed for Qt's lupdate utility
33
    qApp->translate("Workbench", "&Part");
34
    qApp->translate("Workbench", "&Simple");
35
    qApp->translate("Workbench", "&Parametric");
36
    qApp->translate("Workbench", "Solids");
37
    qApp->translate("Workbench", "Part tools");
38
    qApp->translate("Workbench", "Boolean");
39
    qApp->translate("Workbench", "Primitives");
40
    qApp->translate("Workbench", "Join");
41
    qApp->translate("Workbench", "Split");
42
    qApp->translate("Workbench", "Compound");
43
    qApp->translate("Workbench", "Create a copy");
44
#endif
45

46
/// @namespace PartGui @class Workbench
47
TYPESYSTEM_SOURCE(PartGui::Workbench, Gui::StdWorkbench)
48

49
Workbench::Workbench() = default;
50

51
Workbench::~Workbench() = default;
52

53
Gui::MenuItem* Workbench::setupMenuBar() const
54
{
55
    Gui::MenuItem* root = StdWorkbench::setupMenuBar();
56
    Gui::MenuItem* item = root->findItem("&Windows");
57

58
    Gui::MenuItem* prim = new Gui::MenuItem;
59
    prim->setCommand("Primitives");
60
    *prim << "Part_Box"
61
          << "Part_Cylinder"
62
          << "Part_Sphere"
63
          << "Part_Cone"
64
          << "Part_Torus"
65
          << "Separator"
66
          << "Part_Tube";
67

68
    Gui::MenuItem* copy = new Gui::MenuItem;
69
    copy->setCommand("Create a copy");
70
    *copy << "Part_SimpleCopy"
71
          << "Part_TransformedCopy"
72
          << "Part_ElementCopy"
73
          << "Part_RefineShape";
74

75
    Gui::MenuItem* bop = new Gui::MenuItem;
76
    bop->setCommand("Boolean");
77
    *bop << "Part_Boolean"
78
         << "Part_Cut"
79
         << "Part_Fuse"
80
         << "Part_Common";
81

82
    Gui::MenuItem* join = new Gui::MenuItem;
83
    join->setCommand("Join");
84
    *join << "Part_JoinConnect"
85
          << "Part_JoinEmbed"
86
          << "Part_JoinCutout";
87

88
    Gui::MenuItem* split = new Gui::MenuItem;
89
    split->setCommand("Split");
90
    *split << "Part_BooleanFragments"
91
           << "Part_SliceApart"
92
           << "Part_Slice"
93
           << "Part_XOR";
94

95
    Gui::MenuItem* compound = new Gui::MenuItem;
96
    compound->setCommand("Compound");
97
    *compound << "Part_Compound"
98
              << "Part_ExplodeCompound"
99
              << "Part_CompoundFilter";
100

101
    Gui::MenuItem* part = new Gui::MenuItem;
102
    root->insertItem(item, part);
103
    part->setCommand("&Part");
104
    *part << "Part_Import"
105
          << "Part_Export"
106
          << "Separator"
107
          << "Part_BoxSelection"
108
          << "Separator";
109
    *part << prim
110
          << "Part_Primitives"
111
          << "Part_Builder"
112
          << "Separator"
113
          << "Part_ShapeFromMesh"
114
          << "Part_PointsFromMesh"
115
          << "Part_MakeSolid"
116
          << "Part_ReverseShape"
117
          << copy
118
          << "Part_CheckGeometry"
119
          << "Part_Defeaturing"
120
          << "Materials_InspectAppearance"
121
          << "Materials_InspectMaterial"
122
          << "Separator"
123
          << bop << join << split << compound
124
          << "Separator"
125
          << "Sketcher_NewSketch"
126
          << "Part_Extrude"
127
          << "Part_Revolve"
128
          << "Part_Mirror"
129
          << "Part_Scale"
130
          << "Part_Fillet"
131
          << "Part_Chamfer"
132
          << "Part_MakeFace"
133
          << "Part_RuledSurface"
134
          << "Part_Loft"
135
          << "Part_Sweep"
136
          << "Part_Section"
137
          << "Part_CrossSections"
138
          << "Part_Offset"
139
          << "Part_Offset2D"
140
          << "Part_Thickness"
141
          << "Part_ProjectionOnSurface"
142
          << "Separator"
143
          << "Part_EditAttachment";
144

145
    Gui::MenuItem* view = root->findItem("&View");
146
    if (view) {
147
        Gui::MenuItem* appr = view->findItem("Std_RandomColor");
148
        appr = view->afterItem(appr);
149
        Gui::MenuItem* face = new Gui::MenuItem();
150
        face->setCommand("Part_ColorPerFace");
151
        view->insertItem(appr, face);
152
    }
153

154
    return root;
155
}
156

157
Gui::ToolBarItem* Workbench::setupToolBars() const
158
{
159
    Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
160

161
    Gui::ToolBarItem* solids = new Gui::ToolBarItem(root);
162
    solids->setCommand("Solids");
163
    *solids << "Part_Box"
164
            << "Part_Cylinder"
165
            << "Part_Sphere"
166
            << "Part_Cone"
167
            << "Part_Torus"
168
            << "Part_Tube"
169
            << "Part_Primitives"
170
            << "Part_Builder";
171

172
    Gui::ToolBarItem* tool = new Gui::ToolBarItem(root);
173
    tool->setCommand("Part tools");
174
    *tool << "Sketcher_NewSketch"
175
          << "Part_Extrude"
176
          << "Part_Revolve"
177
          << "Part_Mirror"
178
          << "Part_Scale"
179
          << "Part_Fillet"
180
          << "Part_Chamfer"
181
          << "Part_MakeFace"
182
          << "Part_RuledSurface"
183
          << "Part_Loft"
184
          << "Part_Sweep"
185
          << "Part_Section"
186
          << "Part_CrossSections"
187
          << "Part_CompOffset"
188
          << "Part_Thickness"
189
          << "Part_ProjectionOnSurface"
190
          << "Part_ColorPerFace";  // See issues #0477 and #1954 in the tracker
191

192
    Gui::ToolBarItem* boolop = new Gui::ToolBarItem(root);
193
    boolop->setCommand("Boolean");
194
    *boolop << "Part_CompCompoundTools"
195
            << "Part_Boolean"
196
            << "Part_Cut"
197
            << "Part_Fuse"
198
            << "Part_Common"
199
            << "Part_CompJoinFeatures"
200
            << "Part_CompSplitFeatures"
201
            << "Part_CheckGeometry"
202
            << "Part_Defeaturing";
203

204
    return root;
205
}
206

207
Gui::ToolBarItem* Workbench::setupCommandBars() const
208
{
209
    // Part tools
210
    Gui::ToolBarItem* root = new Gui::ToolBarItem;
211
    return root;
212
}
213

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.