Commit 19400372 authored by Mike Kremer's avatar Mike Kremer

Fixed some memory and consistency issues in Move-Plugin.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6989 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7ec63ba5
......@@ -91,7 +91,7 @@ void MovePlugin::showProps(){
BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) {
if ( object->manipulatorNode()->visible() ) {
const TriMesh::Point pos = object->manipulatorNode()->center();
const OpenMesh::Vec3d pos = object->manipulatorNode()->center();
QString num;
......@@ -99,7 +99,7 @@ void MovePlugin::showProps(){
num = QString::number(pos[1]); pW->posy->setText(num);
num = QString::number(pos[2]); pW->posz->setText(num);
TriMesh::Point direction = object->manipulatorNode()->directionX();
OpenMesh::Vec3d direction = object->manipulatorNode()->directionX();
num = QString::number(direction[0]); pW->dirxx->setText(num);
num = QString::number(direction[1]); pW->dirxy->setText(num);
num = QString::number(direction[2]); pW->dirxz->setText(num);
......
......@@ -86,6 +86,28 @@ MovePlugin::MovePlugin() :
allTargets_ = false;
}
/** \brief Deconstructor
*
*/
MovePlugin::~MovePlugin() {
if(contextAction_) {
delete contextAction_;
}
if(toAllTargets_) {
delete toAllTargets_;
}
for(QList<movePropsWidget*>::iterator it = propsWindows_.begin();
it != propsWindows_.end(); ++it) {
if(*it) {
delete *it;
}
}
}
/*******************************************************************************
BaseInterface implementation
......@@ -164,12 +186,12 @@ void MovePlugin::pluginsInitialized() {
pickToolbar_->addSeparator ();
ratateTranslateAction_ = new QAction(tr("Rotate/Translate object"), pickToolBarActions_);
ratateTranslateAction_->setStatusTip(tr("Rotate/Translate object."));
ratateTranslateAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"move-translaterotate.png") );
ratateTranslateAction_->setCheckable(true);
ratateTranslateAction_->setChecked(true);
pickToolbar_->addAction(ratateTranslateAction_);
rotateTranslateAction_ = new QAction(tr("Rotate/Translate object"), pickToolBarActions_);
rotateTranslateAction_->setStatusTip(tr("Rotate/Translate object."));
rotateTranslateAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"move-translaterotate.png") );
rotateTranslateAction_->setCheckable(true);
rotateTranslateAction_->setChecked(true);
pickToolbar_->addAction(rotateTranslateAction_);
resizeAction_ = new QAction(tr("Resize object"), pickToolBarActions_);
resizeAction_->setStatusTip(tr("Resize object. <Control>"));
......@@ -179,11 +201,11 @@ void MovePlugin::pluginsInitialized() {
pickToolbar_->addSeparator ();
ratateManipAction_ = new QAction(tr("Rotate manipulator"), pickToolBarActions_);
ratateManipAction_->setStatusTip(tr("Rotate manipulator. <Shift>"));
ratateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"move-maniprotate.png") );
ratateManipAction_->setCheckable(true);
pickToolbar_->addAction(ratateManipAction_);
rotateManipAction_ = new QAction(tr("Rotate manipulator"), pickToolBarActions_);
rotateManipAction_->setStatusTip(tr("Rotate manipulator. <Shift>"));
rotateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"move-maniprotate.png") );
rotateManipAction_->setCheckable(true);
pickToolbar_->addAction(rotateManipAction_);
smallerManipAction_ = new QAction(tr("Decrease size of manipulator"), pickToolBarActions_);
smallerManipAction_->setStatusTip(tr("Make manipulator smaller. <Mouse wheel up>"));
......@@ -438,18 +460,18 @@ void MovePlugin::setManipMode (QtTranslationManipulatorNode::ManipulatorMode _mo
{
case QtTranslationManipulatorNode::Resize:
resizeAction_->setChecked (true);
ratateManipAction_->setChecked (false);
ratateTranslateAction_->setChecked (false);
rotateManipAction_->setChecked (false);
rotateTranslateAction_->setChecked (false);
break;
case QtTranslationManipulatorNode::LocalRotation:
resizeAction_->setChecked (false);
ratateManipAction_->setChecked (true);
ratateTranslateAction_->setChecked (false);
rotateManipAction_->setChecked (true);
rotateTranslateAction_->setChecked (false);
break;
case QtTranslationManipulatorNode::TranslationRotation:
resizeAction_->setChecked (false);
ratateManipAction_->setChecked (false);
ratateTranslateAction_->setChecked (true);
rotateManipAction_->setChecked (false);
rotateTranslateAction_->setChecked (true);
break;
}
}
......@@ -1335,12 +1357,12 @@ void MovePlugin::slotSetMoveMode(QAction* _action) {
void MovePlugin::slotPickToolbarAction(QAction* _action)
{
if (_action == ratateTranslateAction_)
if (_action == rotateTranslateAction_)
{
setManipMode (QtTranslationManipulatorNode::TranslationRotation);
}
if (_action == ratateManipAction_)
if (_action == rotateManipAction_)
{
setManipMode (QtTranslationManipulatorNode::LocalRotation);
}
......
......@@ -143,7 +143,7 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface,
MovePlugin();
/// Destructor
~MovePlugin() {};
~MovePlugin();
/// Initialize the toolbar (create a widget in the right side toolbox)
bool initializeToolbox(QWidget*& _widget);
......@@ -239,8 +239,8 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface,
QToolBar *pickToolbar_;
QAction* placeAction_;
QAction* ratateTranslateAction_;
QAction* ratateManipAction_;
QAction* rotateTranslateAction_;
QAction* rotateManipAction_;
QAction* resizeAction_;
QAction* biggerManipAction_;
......@@ -381,9 +381,6 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface,
void slotUpdateContextMenuNode( int _nodeId );
private:
/// Move context menu
QMenu* contextMenu_;
/// List of properties dialogs (each corresponding to one manipulator)
QList<movePropsWidget*> propsWindows_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment