]> Creatis software - bbtkGEditor.git/commitdiff
Change in colors and middle button to select executable box(es)
authorcorredor <>
Mon, 26 Apr 2010 12:39:20 +0000 (12:39 +0000)
committercorredor <>
Mon, 26 Apr 2010 12:39:20 +0000 (12:39 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBlackBoxModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBlackBoxView.h

index e58e73aebfef1f301a2fd0023bdfec9728feba0d..deeb4900f45d2a945f3622b904daac2ee27fdb71 100644 (file)
@@ -43,6 +43,7 @@ namespace bbtk
        //=========================================================================
        GBlackBoxModel::GBlackBoxModel()
        {               
+               _isExecutable = false;
        }
 
        //=========================================================================
@@ -109,7 +110,6 @@ namespace bbtk
        }
        
        //=========================================================================
-
        
        std::string GBlackBoxModel::getBBTKPackage()
        {
@@ -125,6 +125,20 @@ namespace bbtk
 
        //=========================================================================
        
+       bool GBlackBoxModel::isExecutable()
+       {
+               return _isExecutable;
+       }
+
+       //=========================================================================
+
+       void GBlackBoxModel::setExecutable(bool executable)
+       {
+               _isExecutable = executable;
+       }
+
+       //=========================================================================
+       
        std::string GBlackBoxModel::getStatusText()
        {
                std::string temp = "";
index 209af977ce1c21c20357dc2466f4a4b47f017509..82214a4ad29c4818c145a6d4ca81b205ca09de35 100644 (file)
@@ -82,11 +82,15 @@ namespace bbtk
 
                virtual std::string getStatusText();
 
+               bool isExecutable();
+               void setExecutable(bool executable);
+
        private:
 
                //Private Attributes
                std::vector<GPortModel*> _inputs;
                std::vector<GPortModel*> _outputs;
+               bool _isExecutable;
 
                //Private Methods
 
index eafadc4a5a392501c910cba66afd5537c1adb8e9..0d3c8260df25cb6c28f4f5ddaf9b174b414ac604 100644 (file)
@@ -100,8 +100,8 @@ namespace bbtk
        const double BOXFILL_NH_B=0.15;
 
        const double BOXFILL_HIGHLIGHTED_R=0.05;
-       const double BOXFILL_HIGHLIGHTED_G=0.45;
-       const double BOXFILL_HIGHLIGHTED_B=0.65;
+       const double BOXFILL_HIGHLIGHTED_G=0.30;
+       const double BOXFILL_HIGHLIGHTED_B=0.45;
 
        const double BOXFILL_DRAG_R=0.75;
        const double BOXFILL_DRAG_G=0.75;
index f1f1fed1e047a0ab667d5f178a6c9842c147b749..22d89775f66482ed7e0434caa6e5351cb1ef2649 100644 (file)
@@ -66,7 +66,7 @@ namespace bbtk
        void wxVtkSceneManager::disconnectDrop()
        {
                _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
-       }
+       }
 
        //=========================================================================
 
index bafa37f019402b0de5a36bc0c19179e6334afe1a..efe5ba8e6ae4df12697f7cfa3c5ac65b1bf37210 100644 (file)
@@ -140,8 +140,37 @@ namespace bbtk
        
        //=========================================================================
        
-       bool GBlackBoxController::OnRightButtonDown()
+       bool GBlackBoxController::OnRightButtonUp()
        {
+               GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
+               if(bbmodel->isExecutable())
+               {
+                       bbmodel->setExecutable(false);
+               }
+               
+               return true;
+       }
+
+       //=========================================================================
+
+       bool GBlackBoxController::OnMiddleButtonDown()
+       {
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+               int state  = _view->getState();
+
+               //Evaluate new state
+               if(_view->isPointInside(X,Y))
+               {
+                       GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
+                       _view->setState(HIGHLIGHTED);
+                       bbmodel->setExecutable(true);
+                       bbmodel->notifyObservers(_id);
+               }
+                       
                return true;
        }
 
index 66ca3659aa0155b224bb58c53bbed4e2174cb25a..d5e34459764819812ac0e1832c78f029708ade3c 100644 (file)
@@ -46,6 +46,7 @@ Version:   $Revision$
 //Includes same project
 #include "GlobalConstants.h"
 #include "GObjectController.h"
+#include "GBlackBoxModel.h"
 
 //Includes creaMaracasVisu
 
@@ -66,11 +67,7 @@ namespace bbtk
                ~GBlackBoxController();
                
                //Public methods
-               virtual bool  OnMouseMove();
-               virtual bool  OnLeftButtonDown(); 
-               virtual bool  OnLeftButtonUp();
-               virtual bool  OnLeftDClick();
-               virtual bool  OnRightButtonDown();
+               
 
 
        private:
@@ -80,6 +77,13 @@ namespace bbtk
                //Private Methods
 
        protected:
+               virtual bool  OnMouseMove();
+               virtual bool  OnLeftButtonDown(); 
+               virtual bool  OnLeftButtonUp();
+               virtual bool  OnMiddleButtonDown(); 
+               virtual bool  OnLeftDClick();
+               virtual bool  OnRightButtonUp();
+
 
        };
 
index 7926e68ca20b4050a064ddd4c2cc3a5c3c02616e..3ba353c6b689e72607f8ded1ef13d5c424fa9826 100644 (file)
@@ -124,6 +124,13 @@ namespace bbtk
                return true;
        }
 
+       //=========================================================================
+       
+       bool GObjectController::OnMiddleButtonDown()//virtual
+       {
+               return true;
+       }
+
        //=========================================================================
 
        void GObjectController::moveObject(int X,int Y)
index 6c5fe8d0b189b312bacb604ec6bc05dc7d0d3382..ed826a413633994fb7ab3718fb41c7ded057d9a8 100644 (file)
@@ -98,6 +98,7 @@ namespace bbtk
                virtual bool  OnLeftButtonDown(); 
                virtual bool  OnLeftButtonUp();
                virtual bool  OnLeftDClick();
+               virtual bool  OnMiddleButtonDown(); 
 
                virtual void moveObject(int X,int Y);
 
index 70aed5fc40e4c8e92e34bf7e119f97a59d1d0fd1..34e4f90f1b591ca1b962fdc64dda45fad81a47a0 100644 (file)
@@ -196,11 +196,19 @@ namespace bbtk
                        _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,BOXFILL_NH_G,BOXFILL_NH_B);
                        _nameActor->GetTextProperty()->SetColor(BOXTEXT_NH_R,BOXTEXT_NH_G,BOXTEXT_NH_B);
                        _typeActor->GetTextProperty()->SetColor(BOXTEXT_NH_R,BOXTEXT_NH_G,BOXTEXT_NH_B);
+
+                       GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
+                       if(bbmodel->isExecutable())
+                       {
+                               _borderObjectActor->GetProperty()->SetColor(BOXBORDER_NH_R,0.9,BOXBORDER_HIGHLIGHTED_B);
+                               _fillObjectActor->GetProperty()->SetColor(BOXFILL_NH_R,0.9,BOXFILL_HIGHLIGHTED_B);
+                       }
                        
                }
                else if(_state==HIGHLIGHTED)
                {
                        _borderObjectActor->GetProperty()->SetLineWidth(2);
+                       
                        _borderObjectActor->GetProperty()->SetColor(BOXBORDER_HIGHLIGHTED_R,BOXBORDER_HIGHLIGHTED_G,BOXBORDER_HIGHLIGHTED_B);
                        _fillObjectActor->GetProperty()->SetColor(BOXFILL_HIGHLIGHTED_R,BOXFILL_HIGHLIGHTED_G,BOXFILL_HIGHLIGHTED_B);
                        _nameActor->GetTextProperty()->SetColor(BOXTEXT_HIGHLIGHTED_R,BOXTEXT_HIGHLIGHTED_G,BOXTEXT_HIGHLIGHTED_B);
index 46505030d50bbef2168b59804a84a32f5d0a0d66..67b2a26fc1bbf34e3215f26260fab4e4e332ca90 100644 (file)
@@ -46,6 +46,7 @@ Version:   $Revision$
 //Includes same project
 #include "GlobalConstants.h"
 #include "vtkGObjectView.h"
+#include "GBlackBoxModel.h"
 
 //Includes creaMaracasVisu