Mod/Mesh/Gui/Workbench.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2005 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 
00026 #ifndef _PreComp_
00027 # include <qobject.h>
00028 #endif
00029 
00030 #include "Workbench.h"
00031 #include <Gui/MenuManager.h>
00032 #include <Gui/ToolBarManager.h>
00033 #include <Gui/Selection.h>
00034 
00035 #include "../App/MeshFeature.h"
00036 
00037 using namespace MeshGui;
00038 
00039 #if 0 // needed for Qt's lupdate utility
00040     qApp->translate("Workbench", "Analyze");
00041     qApp->translate("Workbench", "Boolean");
00042     qApp->translate("Workbench", "&Meshes");
00043     qApp->translate("Workbench", "Mesh tools");
00044 #endif
00045 
00047 TYPESYSTEM_SOURCE(MeshGui::Workbench, Gui::StdWorkbench)
00048 
00049 Workbench::Workbench()
00050 {
00051 }
00052 
00053 Workbench::~Workbench()
00054 {
00055 }
00056 
00057 void Workbench::setupContextMenu(const char* recipient,Gui::MenuItem* item) const
00058 {
00059     StdWorkbench::setupContextMenu( recipient, item );
00060     if (Gui::Selection().countObjectsOfType(Mesh::Feature::getClassTypeId()) > 0)
00061     {
00062         *item << "Separator" << "Mesh_Import" << "Mesh_Export" << "Mesh_VertexCurvature";
00063     }
00064 }
00065 
00066 Gui::MenuItem* Workbench::setupMenuBar() const
00067 {
00068     Gui::MenuItem* root = StdWorkbench::setupMenuBar();
00069     Gui::MenuItem* item = root->findItem("&Windows");
00070     Gui::MenuItem* mesh = new Gui::MenuItem;
00071     root->insertItem( item, mesh );
00072 
00073     // analyze
00074     Gui::MenuItem* analyze = new Gui::MenuItem;
00075     analyze->setCommand("Analyze");
00076     *analyze << "Mesh_Evaluation" << "Mesh_EvaluateFacet" << "Mesh_CurvatureInfo" << "Separator" 
00077              << "Mesh_EvaluateSolid" << "Mesh_BoundingBox";
00078 
00079     // boolean
00080     Gui::MenuItem* boolean = new Gui::MenuItem;
00081     boolean->setCommand("Boolean");
00082     *boolean << "Mesh_Union" << "Mesh_Intersection" << "Mesh_Difference";
00083  
00084     mesh->setCommand("&Meshes");
00085     *mesh << "Mesh_Import" << "Mesh_Export" << "Mesh_FromGeometry" << "Separator"
00086           << analyze << "Mesh_HarmonizeNormals" << "Mesh_FlipNormals" << "Separator" 
00087           << "Mesh_FillupHoles" << "Mesh_FillInteractiveHole" << "Mesh_RemoveComponents"
00088           << "Mesh_RemoveCompByHand" << "Mesh_AddFacet" << "Mesh_Smoothing" << "Separator" 
00089           << "Mesh_BuildRegularSolid" << boolean << "Separator" << "Mesh_PolySelect" << "Mesh_PolyCut"
00090           << "Mesh_PolySplit" << "Mesh_PolySegm" << /*"Mesh_ToolMesh" <<*/ "Mesh_VertexCurvature";
00091     return root;
00092 }
00093 
00094 Gui::ToolBarItem* Workbench::setupToolBars() const
00095 {
00096     Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
00097     Gui::ToolBarItem* mesh = new Gui::ToolBarItem(root);
00098     mesh->setCommand("Mesh tools");
00099     *mesh << "Mesh_Import" << "Mesh_Export" << "Separator" << "Mesh_PolyCut" << "Mesh_VertexCurvature";
00100     return root;
00101 }
00102 
00103 Gui::ToolBarItem* Workbench::setupCommandBars() const
00104 {
00105     // Mesh tools
00106     Gui::ToolBarItem* root = new Gui::ToolBarItem;
00107     Gui::ToolBarItem* mesh;
00108 
00109     mesh = new Gui::ToolBarItem( root );
00110     mesh->setCommand("Mesh tools");
00111     *mesh << "Mesh_Import" << "Mesh_Export" << "Mesh_PolyCut";
00112 
00113     mesh = new Gui::ToolBarItem( root );
00114     mesh->setCommand("Mesh test suite");
00115     *mesh << "Mesh_Demolding" << "Mesh_Transform" << "Separator" ;
00116 
00117     return root;
00118 }
00119 

Generated on Wed Nov 23 19:01:11 2011 for FreeCAD by  doxygen 1.6.1