Skip to content
Snippets Groups Projects
Commit ff9b7164 authored by stefan's avatar stefan
Browse files

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
parent 4d675ea9
Branches
Tags
No related merge requests found
......@@ -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]);
}
}
......
......@@ -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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment