From ff9b7164da1bdfe9fd89247148e6f21d5f1e5dcc Mon Sep 17 00:00:00 2001 From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Tue, 15 Jun 2010 09:18:48 +0000 Subject: [PATCH] SceneWin ContextMenu, fix deleting scene node, fix not_scene flag git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2401 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/gui/src/scene_selection.cc | 11 +++------ modules/gui/src/scene_win/context_menu.cc | 12 ++++++---- modules/gui/src/scene_win/context_menu.hh | 29 ++++++++++++----------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/modules/gui/src/scene_selection.cc b/modules/gui/src/scene_selection.cc index 7beeadc58..72e8f4f55 100644 --- a/modules/gui/src/scene_selection.cc +++ b/modules/gui/src/scene_selection.cc @@ -117,18 +117,13 @@ void SceneSelection::CenterOnObjects() { } void SceneSelection::Delete() { - QList<gfx::GfxObjP> selected_objects; + QList<gfx::GfxNodeP> selected_objects; for(unsigned int i = 0; i < nodes_.size(); i++){ gfx::GfxNodeP node = nodes_[i]; - if (node) { - gfx::GfxObjP obj = dyn_cast<gfx::GfxObj> (node); - if (obj) { - selected_objects.append(obj); - } - } + selected_objects.append(node); } for(int i=0; i < selected_objects.size(); i++){ - gfx::Scene::Instance().Remove(selected_objects[i]); + gfx::Scene::Instance().Remove(selected_objects[i]); } } diff --git a/modules/gui/src/scene_win/context_menu.cc b/modules/gui/src/scene_win/context_menu.cc index e69b943bc..dff6fbee6 100644 --- a/modules/gui/src/scene_win/context_menu.cc +++ b/modules/gui/src/scene_win/context_menu.cc @@ -28,6 +28,8 @@ #include <ost/dyn_cast.hh> +#include <ost/gfx/scene.hh> + #include <ost/gui/scene_selection.hh> #include <ost/gui/query_dialog.hh> @@ -66,14 +68,14 @@ ContextMenu::ContextMenu(QTreeView* view, SceneWinModel* model): action = new QAction("Delete",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Delete())); - this->AddAction(action, GFX_OBJECT|NOT_SCENE); + this->AddAction(action, GFX_NODE|NOT_SCENE); action = new QAction("Show",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Show())); - this->AddAction(action, GFX_OBJECT|NOT_VISIBLE); + this->AddAction(action, GFX_NODE|NOT_VISIBLE); action = new QAction("Hide",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Hide())); - this->AddAction(action, GFX_OBJECT|NOT_HIDDEN); + this->AddAction(action, GFX_NODE|NOT_HIDDEN); action = new QAction("Show",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(MakeVisible())); @@ -149,7 +151,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) else{ flags &= ~NOT_VISIBLE; } - if(gfx_node->GetType()==0){flags &= ~NOT_SCENE;} + if(gfx::Scene::Instance().GetRootNode() == gfx_node){flags &= ~NOT_SCENE;} if(!dyn_cast<gfx::GfxObj> (gfx_node)){flags &= ~GFX_OBJECT;} if(!dyn_cast<gfx::Entity> (gfx_node)){flags &= ~ENTITY;} #if OST_IMG_ENABLED @@ -175,7 +177,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) #endif // OST_IMG_ENABLED } else{ - flags &= ~(GFX_OBJECT | ENTITY + flags &= ~(GFX_NODE | GFX_OBJECT | ENTITY #if OST_IMG_ENABLED | MAP #endif diff --git a/modules/gui/src/scene_win/context_menu.hh b/modules/gui/src/scene_win/context_menu.hh index b8a99f6f0..06890baea 100644 --- a/modules/gui/src/scene_win/context_menu.hh +++ b/modules/gui/src/scene_win/context_menu.hh @@ -35,21 +35,22 @@ namespace ost { namespace gui { enum ContextActionType { - GFX_OBJECT=0x1, - ENTITY=0x2, - ENTITY_VIEW=0x4, - CUSTOM_VIEW=0x8, - NOT_VISIBLE=0x10, - NOT_HIDDEN=0x20, - NOT_SCENE=0x40, - SINGLE=0x80, - MULTI=0x100, - VIEWS_SAME_OBJECT=0x200 + GFX_NODE=0x1, + GFX_OBJECT=0x2, + ENTITY=0x4, + ENTITY_VIEW=0x8, + CUSTOM_VIEW=0x10, + NOT_VISIBLE=0x20, + NOT_HIDDEN=0x40, + NOT_SCENE=0x80, + SINGLE=0x100, + MULTI=0x200, + VIEWS_SAME_OBJECT=0x400 #if OST_IMG_ENABLED - ,MAP=0x400, - MAP_ORIGINAL=0x800, - MAP_DOWNSAMPLED=0x1000, - MAP_DSAMPLED_AVAIL=0x2000 + ,MAP=0x800, + MAP_ORIGINAL=0x1000, + MAP_DOWNSAMPLED=0x2000, + MAP_DSAMPLED_AVAIL=0x4000 #endif }; Q_DECLARE_FLAGS(ContextActionTypes, ContextActionType) -- GitLab