00001 /*************************************************************************** 00002 * Copyright (c) 2011 Juergen Riegel <FreeCAD@juergen-riegel.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 #endif 00028 00029 #include "ui_TaskHoleParameters.h" 00030 #include "TaskHoleParameters.h" 00031 #include <Gui/Application.h> 00032 #include <Gui/Document.h> 00033 #include <Gui/BitmapFactory.h> 00034 #include <Gui/ViewProvider.h> 00035 #include <Gui/WaitCursor.h> 00036 #include <Base/Console.h> 00037 #include <Gui/Selection.h> 00038 #include <Gui/Command.h> 00039 00040 00041 using namespace PartDesignGui; 00042 using namespace Gui; 00043 00044 /* TRANSLATOR PartDesignGui::TaskHoleParameters */ 00045 00046 TaskHoleParameters::TaskHoleParameters(QWidget *parent) 00047 : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("TaskHoleParameters"),true, parent) 00048 { 00049 // we need a separate container widget to add all controls to 00050 proxy = new QWidget(this); 00051 ui = new Ui_TaskHoleParameters(); 00052 ui->setupUi(proxy); 00053 QMetaObject::connectSlotsByName(this); 00054 00055 this->groupLayout()->addWidget(proxy); 00056 00057 Gui::Selection().Attach(this); 00058 } 00059 00060 TaskHoleParameters::~TaskHoleParameters() 00061 { 00062 delete ui; 00063 Gui::Selection().Detach(this); 00064 } 00065 00066 void TaskHoleParameters::changeEvent(QEvent *e) 00067 { 00068 TaskBox::changeEvent(e); 00069 if (e->type() == QEvent::LanguageChange) { 00070 ui->retranslateUi(proxy); 00071 } 00072 } 00073 00075 void TaskHoleParameters::OnChange(Gui::SelectionSingleton::SubjectType &rCaller, 00076 Gui::SelectionSingleton::MessageType Reason) 00077 { 00078 if (Reason.Type == SelectionChanges::AddSelection || 00079 Reason.Type == SelectionChanges::RmvSelection || 00080 Reason.Type == SelectionChanges::SetSelection || 00081 Reason.Type == SelectionChanges::ClrSelection) { 00082 } 00083 } 00085 00086 //************************************************************************** 00087 //************************************************************************** 00088 // TaskDialog 00089 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00090 00091 TaskDlgHoleParameters::TaskDlgHoleParameters(ViewProviderHole *HoleView) 00092 : TaskDialog(),HoleView(HoleView) 00093 { 00094 assert(HoleView); 00095 parameter = new TaskHoleParameters(); 00096 00097 Content.push_back(parameter); 00098 } 00099 00100 TaskDlgHoleParameters::~TaskDlgHoleParameters() 00101 { 00102 00103 } 00104 00105 //==== calls from the TaskView =============================================================== 00106 00107 00108 void TaskDlgHoleParameters::open() 00109 { 00110 00111 } 00112 00113 void TaskDlgHoleParameters::clicked(int) 00114 { 00115 00116 } 00117 00118 bool TaskDlgHoleParameters::accept() 00119 { 00120 return true; 00121 } 00122 00123 bool TaskDlgHoleParameters::reject() 00124 { 00125 Gui::Command::openCommand("Hole changed"); 00126 Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); 00127 Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); 00128 Gui::Command::commitCommand(); 00129 00130 return true; 00131 } 00132 00133 void TaskDlgHoleParameters::helpRequested() 00134 { 00135 00136 } 00137 00138 00139 00140 00141 #include "moc_TaskHoleParameters.cpp"