From 1856edacd4c4ec97dd5fd394010cc709387ca79c Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Mon, 26 Apr 2010 04:17:02 +0000 Subject: [PATCH] modified edit_vase.h/cpp to use a simpler single action setup. Modified the edit_scan adding a file saver (and a bug report for meshlab as EDITs support layers in read_only) to the gui --- src/meshlabplugins/edit_vase/edit_vase.cpp | 11 +++-------- src/meshlabplugins/edit_vase/edit_vase.h | 22 +++++++--------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/meshlabplugins/edit_vase/edit_vase.cpp b/src/meshlabplugins/edit_vase/edit_vase.cpp index 41fa4d5aa..a1331d0ca 100644 --- a/src/meshlabplugins/edit_vase/edit_vase.cpp +++ b/src/meshlabplugins/edit_vase/edit_vase.cpp @@ -2,16 +2,11 @@ #include "wrap/gui/trackball.h" #include "wrap/qt/trackball.h" //QT2VCG trackball function -Vase::Vase(){ - action = new QAction(QIcon(":/images/vase.png"),"Volume Aware Surface Extraction", this); - action->setCheckable(true); +bool Vase::StartEdit(MeshModel &m, GLArea* gla){ + gui = new VaseWidget( gla->window(), m, gla ); + return true; } - - - - - //--- Trackball controls similarly to the ones in non-edit mode void Vase::mousePressEvent(QMouseEvent* e, MeshModel &, GLArea* gla){ gla->trackball.MouseDown(e->x(),gla->height()-e->y(), QT2VCG(e->button(), e->modifiers() ) ); diff --git a/src/meshlabplugins/edit_vase/edit_vase.h b/src/meshlabplugins/edit_vase/edit_vase.h index 04c11eef7..b8fc6753b 100644 --- a/src/meshlabplugins/edit_vase/edit_vase.h +++ b/src/meshlabplugins/edit_vase/edit_vase.h @@ -8,6 +8,9 @@ using namespace vcg; +// This plugin only defines one action +static QAction act(QIcon(":/images/vase.png"),"Volume Aware Surface Extraction", NULL); + class Vase : public QObject, public MeshEditInterface, public MeshEditInterfaceFactory{ Q_OBJECT Q_INTERFACES(MeshEditInterface) @@ -16,31 +19,20 @@ class Vase : public QObject, public MeshEditInterface, public MeshEditInterfaceF private: // Instance of dialog window VaseWidget* gui; - // Plugin defines this single action - QAction* action; public: //--- Dummy implementation of MeshEditInterface, passes all control to Widget static const QString Info(){ return tr("VASE"); } - virtual bool StartEdit(MeshModel &m, GLArea* gla){ - gui = new VaseWidget( gla->window(), m, gla ); - // Try to force the widget on the right hand side - //addDockWidget( Qt::RightDockWidgetArea, gui ); - return true; - } + virtual bool StartEdit(MeshModel &m, GLArea* gla); virtual void EndEdit(MeshModel &, GLArea*){ delete gui; } virtual void Decorate(MeshModel& m, GLArea* gla){ gui->decorate(m,gla); } virtual void mousePressEvent(QMouseEvent *, MeshModel &, GLArea * ); virtual void mouseMoveEvent(QMouseEvent *, MeshModel &, GLArea* ); virtual void mouseReleaseEvent(QMouseEvent *, MeshModel &, GLArea* ); - //--- Dummy implementation of MeshEditInterfaceFactory, passes control to this MeshEditInterface - Vase(); - virtual ~Vase(){ delete action; } - virtual QList actions() const{ - QList actionList; - return actionList << action; - } + Vase(){}; + virtual ~Vase(){} + virtual QList actions() const{ QList actionList; return actionList << &act; } virtual MeshEditInterface* getMeshEditInterface(QAction* ){ return this; } virtual QString getEditToolDescription(QAction *){ return this->Info(); } };