CommandParametric.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) Jürgen Riegel          (juergen.riegel@web.de) 2002     *
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 <QDir>
00028 # include <QFileInfo>
00029 # include <QLineEdit>
00030 #endif
00031 
00032 #include <Gui/Application.h>
00033 #include <Gui/Command.h>
00034 #include <Gui/MainWindow.h>
00035 
00036 //===========================================================================
00037 // Part_Cylinder
00038 //===========================================================================
00039 DEF_STD_CMD_A(CmdPartCylinder);
00040 
00041 CmdPartCylinder::CmdPartCylinder()
00042   : Command("Part_Cylinder")
00043 {
00044     sAppModule    = "Part";
00045     sGroup        = QT_TR_NOOP("Part");
00046     sMenuText     = QT_TR_NOOP("Cylinder");
00047     sToolTipText  = QT_TR_NOOP("Create a Cylinder");
00048     sWhatsThis    = sToolTipText;
00049     sStatusTip    = sToolTipText;
00050     sPixmap       = "Part_Cylinder";
00051 }
00052 
00053 void CmdPartCylinder::activated(int iMsg)
00054 {
00055     openCommand("Create cylinder");
00056     doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cylinder\",\"Cylinder\")");
00057     commitCommand();
00058     updateActive();
00059     doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
00060 }
00061 
00062 bool CmdPartCylinder::isActive(void)
00063 {
00064     if (getActiveGuiDocument())
00065         return true;
00066     else
00067         return false;
00068 }
00069 
00070 //===========================================================================
00071 // Part_Box
00072 //===========================================================================
00073 DEF_STD_CMD_A(CmdPartBox);
00074 
00075 CmdPartBox::CmdPartBox()
00076   : Command("Part_Box")
00077 {
00078     sAppModule    = "Part";
00079     sGroup        = QT_TR_NOOP("Part");
00080     sMenuText     = QT_TR_NOOP("Box");
00081     sToolTipText  = QT_TR_NOOP("Create a box solid");
00082     sWhatsThis    = "Part_Box";
00083     sStatusTip    = sToolTipText;
00084     sPixmap       = "Part_Box";
00085 }
00086 
00087 void CmdPartBox::activated(int iMsg)
00088 {
00089     openCommand("Create box");
00090     doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Box\",\"Box\")");
00091     commitCommand();
00092     updateActive();
00093     doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
00094 }
00095 
00096 bool CmdPartBox::isActive(void)
00097 {
00098     if (getActiveGuiDocument())
00099         return true;
00100     else
00101         return false;
00102 }
00103 
00104 //===========================================================================
00105 // Part_Sphere
00106 //===========================================================================
00107 DEF_STD_CMD_A(CmdPartSphere);
00108 
00109 CmdPartSphere::CmdPartSphere()
00110   : Command("Part_Sphere")
00111 {
00112     sAppModule    = "Part";
00113     sGroup        = QT_TR_NOOP("Part");
00114     sMenuText     = QT_TR_NOOP("Sphere");
00115     sToolTipText  = QT_TR_NOOP("Create a sphere solid");
00116     sWhatsThis    = "Part_Sphere";
00117     sStatusTip    = sToolTipText;
00118     sPixmap       = "Part_Sphere";
00119 }
00120 
00121 void CmdPartSphere::activated(int iMsg)
00122 {
00123     openCommand("Create sphere");
00124     doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Sphere\",\"Sphere\")");
00125     commitCommand();
00126     updateActive();
00127     doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
00128 }
00129 
00130 bool CmdPartSphere::isActive(void)
00131 {
00132     if (getActiveGuiDocument())
00133         return true;
00134     else
00135         return false;
00136 }
00137 
00138 //===========================================================================
00139 // Part_Cone
00140 //===========================================================================
00141 DEF_STD_CMD_A(CmdPartCone);
00142 
00143 CmdPartCone::CmdPartCone()
00144   : Command("Part_Cone")
00145 {
00146     sAppModule    = "Part";
00147     sGroup        = QT_TR_NOOP("Part");
00148     sMenuText     = QT_TR_NOOP("Cone");
00149     sToolTipText  = QT_TR_NOOP("Create a cone solid");
00150     sWhatsThis    = "Part_Cone";
00151     sStatusTip    = sToolTipText;
00152     sPixmap       = "Part_Cone";
00153 }
00154 
00155 void CmdPartCone::activated(int iMsg)
00156 {
00157     openCommand("Create cone");
00158     doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cone\",\"Cone\")");
00159     commitCommand();
00160     updateActive();
00161     doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
00162 }
00163 
00164 bool CmdPartCone::isActive(void)
00165 {
00166     if (getActiveGuiDocument())
00167         return true;
00168     else
00169         return false;
00170 }
00171 
00172 //===========================================================================
00173 // Part_Torus
00174 //===========================================================================
00175 DEF_STD_CMD_A(CmdPartTorus);
00176 
00177 CmdPartTorus::CmdPartTorus()
00178   : Command("Part_Torus")
00179 {
00180     sAppModule    = "Part";
00181     sGroup        = QT_TR_NOOP("Part");
00182     sMenuText     = QT_TR_NOOP("Torus");
00183     sToolTipText  = QT_TR_NOOP("Create a torus solid");
00184     sWhatsThis    = "Part_Torus";
00185     sStatusTip    = sToolTipText;
00186     sPixmap       = "Part_Torus";
00187 }
00188 
00189 void CmdPartTorus::activated(int iMsg)
00190 {
00191     openCommand("Create cone");
00192     doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Torus\",\"Torus\")");
00193     commitCommand();
00194     updateActive();
00195     doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
00196 }
00197 
00198 bool CmdPartTorus::isActive(void)
00199 {
00200     if (getActiveGuiDocument())
00201         return true;
00202     else
00203         return false;
00204 }
00205 
00206 
00207 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00208 
00209 void CreateParamPartCommands(void)
00210 {
00211     Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
00212     rcCmdMgr.addCommand(new CmdPartCylinder());
00213     rcCmdMgr.addCommand(new CmdPartBox());
00214     rcCmdMgr.addCommand(new CmdPartSphere());
00215     rcCmdMgr.addCommand(new CmdPartCone());
00216     rcCmdMgr.addCommand(new CmdPartTorus());
00217 }

Generated on Wed Nov 23 19:00:03 2011 for FreeCAD by  doxygen 1.6.1