]> Creatis software - creaMaracasVisu.git/commitdiff
#2507 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Mon, 26 Jan 2015 13:33:21 +0000 (14:33 +0100)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Mon, 26 Jan 2015 13:33:21 +0000 (14:33 +0100)
1  2 
bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h

index 3f30cba3e6e3675a08b280fbbdbf51dce3b10a07,85f630b0b402d553d57d05829aef89790a328451..882d3d0d675cb402b6ec07afe81de64fedac567f
@@@ -43,14 -43,10 +43,9 @@@ PanelButtonContainer::Process( 
        ButtonContainerSettings* settings = new ButtonContainerSettings( );
        printf("EED PanelButtonContainer::Process %d\n", bbGetInputIn( ).size() );
  
-       if(bbGetInputType()== "1")
-       {
- //EED-MLER       settings->AddItems( bbGetInputIn() );
-       }
-       else {
-         settings->AddButtons( bbGetInputIn() );
-       }       
+         settings->AddButtons(bbGetInputIn( ), bbGetInputType());
  
 -
        
        PBContainer* panel = new PBContainer( myPanel, settings, bbGetInputType() );
        wxBoxSizer* sizer  = new wxBoxSizer( wxHORIZONTAL );
index cbba163e24222ba889e5b5523b03627f940770a2,cbba163e24222ba889e5b5523b03627f940770a2..515784ac9bafcd641b0e7ec0a7272af50b657dda
@@@ -345,7 -345,7 +345,7 @@@ void ColorLayerImageView::ConfigLookupT
        delta = GetGreyLevelBoundaries(1) - GetGreyLevelBoundaries(0);
        for (int ii = 1; ii <= delta ; ii++)
        {
--        thresholdTable->SetTableValue( GetGreyLevelBoundaries(0) + ii, GetBaseColors(0) * ii/delta,
++        thresholdTable->SetTableValue( (GetGreyLevelBoundaries(0) + ii), GetBaseColors(0) * ii/delta,
                                         GetBaseColors(1) * ii/delta, GetBaseColors(2) * ii/delta, 1);
        }
            
              for (int ii = 1; ii <= delta; ii++)
                {
                  // Color computation : previous_color + (current_color - previous_color)/delta * ii
--                thresholdTable->SetTableValue(GetGreyLevelBoundaries(i) + ii,
++                thresholdTable->SetTableValue((GetGreyLevelBoundaries(i) + ii),
                                                GetBaseColors((i-1)*3) + (GetBaseColors(i*3) - GetBaseColors((i-1)*3)) / delta * ii , 
                                                GetBaseColors((i-1)*3 + 1) + (GetBaseColors(i*3 + 1) - GetBaseColors((i-1)*3 + 1)) / delta * ii ,
                                                GetBaseColors((i-1)*3 + 2) + (GetBaseColors(i*3 + 2) - GetBaseColors((i-1)*3 + 2)) / delta * ii ,
index 18f769916826774a5ad0967ed790ec76294c1a1f,7b640cd6d32cf8fd3e36535574a2d80fdaf0451e..45d2932a4cc9f2c5ee8a15f9aa69504c07cc7fcd
@@@ -72,25 -77,8 +77,9 @@@ namespace creaButtonContaine
                }
                
                // ----------------------------------------------------------------------------------
- //EED-MLER
- /*
-               ListGroupMap
-               ContainerSettings::GetListGroupContainer( )
-               {
-                       return ( this->m_ListGroupContainer );
-               }
  
-               void
-               ContainerSettings::SetListGroupContainer( ListGroupMap lstContainer )
-               {
-                       this->m_ListGroupContainer = lstContainer;
-               }
- */
  
-               // ----------------------------------------------------------------------------------
 +
-               // ----------------------------------------------------------------------------------
                void
                ContainerSettings::AddButton( const StringType & groupName,
                    const StringType &buttonName, const wxBitmap &icon,
                        }//hctac
                }
  
- //EED-MLER
- /*
-               void
-               ContainerSettings::AddItems(BCStructVectorType infoList)
-               {
-                       try
-                       {
-                               for( BCStructVectorType::iterator it = infoList.begin( ); it
-                                   != infoList.end( ); ++it )
-                               {
-                                       this->AddItem(*it);
-                               }//rof
-                       }//yrt
-                       catch ( const std::exception& e )
-                       {
-                               std::cerr
-                           << "ContainerSettings::AddButtons( BCStructVectorType infoList ) "
-                           << "exception: " << e.what( ) << std::endl;
-                       }//hctac
-               }
-               //-----------------------------------------------------------------------------------
-                       void
-                               ContainerSettings::AddItem(const StringType & groupName)
-                               {
-                               //Es importante hacer un test, recibiendo como parametro la info de un item.
-                                       wxListItem* item;
-                                       item->SetId(1);
-                                       item->SetText(wxT("monica"));
-                                       creaButtonContainer::view::ListWx l;
-                                       l.setItems(item);
-                                       try
-                                       {
-                                               for( KeyMapList::iterator it = this->m_GroupNameList.begin( );
-                                                        it!= this->m_GroupNameList.end( ); ++it )
-                                               {
-                                                       if(( *it ).compare( groupName ) == 0 )
-                                                       {
-                                                               this->m_ListGroupContainer[ groupName ].push_back(l);
-                                                               return;
-                                                       }
-                                               }
-                                               this->m_GroupNameList.push_back( groupName );
-                                               this->m_ListGroupContainer[ groupName ].push_back( l );
-                                       }
-                                       catch ( const std::exception& e )
-                                       {
-                                               std::cerr
-                                               << "ContainerSettings::AddButton( const std::string & groupName,"
-                                               << "const std::string buttonName, const std::string iconpath,"
-                                               << "const std::string buttonDescription, FunctionEventType event ) exception: "
-                                               << e.what( ) << std::endl;
-                                       }//hctac
-                               }
-                               void
-                               ContainerSettings::AddItem( BCSettingsStruct* info )
-                               {
-                                       wxListItem* item;
-                                       wxString myString((info->buttonName).c_str(),wxConvUTF8);
-                                       item->SetText(myString);
-                                       creaButtonContainer::view::ListWx l;
-                                       l.setItems(item);
-                                       try
-                                       {
-                                               for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
-                                                       != this->m_GroupNameList.end( ); ++it )
-                                               {
-                                                       if ( ( *it ).compare( info->groupName ) == 0 )
-                                                       {
-                                                               this->m_ListGroupContainer[ info->groupName ].push_back( l );
-                                                               return;
-                                                       }//fi
-                                               }//rof
-                                               this->m_GroupNameList.push_back( info->groupName );
-                                               this->m_ListGroupContainer[ info->groupName ].push_back( l );
-                                       }
-                                       catch (const std::exception& e)
-                                       {
-                                               std::cerr
-                                               << "void ContainerSettings::AddItem( BCSettingsStruct* info ) "
-                                               << "exception: " << e.what( ) << std::endl;
-                                       }
-                               }
- */
--
        // ----------------------------------------------------------------------------------
        }//ecapseman
  }//ecapseman
index 54f9ce9c9de7a4e051afb4e646e9d14d26dca4d0,7aa3dc5663a3e89c03b7458936152f61072a7d58..23029770c283b5f5a3b1a7c2be2c256df5a914e2
@@@ -163,18 -152,16 +154,9 @@@ namespace creaButtonContaine
                                void
                                AddButtons( BCStructVectorType infoList );
  
- //EED-MLER
- /*
                                // ----------------------------------------------------------------------------------
-                               void
 -                      /*      void
--                              AddItem(const StringType & groupName);
 -
 -                              void
 -                              AddItem( BCSettingsStruct* info );
 -
 -                              void
+                               AddItems( BCStructVectorType infoList );*/
  
-                               void
-                               AddItem( BCSettingsStruct* info );
-                               void
-                               AddItems( BCStructVectorType infoList );
- */
                                // ----------------------------------------------------------------------------------
                                // ----------------------------------------------------------------------------------
                        private:
index d6ce52652d65ac0291c4a10306ed6a9bc8298a8d,54559d904b6953b166917dd19f5fcc5a773bdfb9..91df61b8e6fca5cdee8c5d297ee05f7bc5b93e3b
@@@ -99,7 -89,5 +89,6 @@@ namespace creaButtonContaine
                }
        // ----------------------------------------------------------------------------------
        }//ecapseman
- }//ecapseman
+ }//ecapseman*/
  
- */
 +
index 69c3d2d8d7f6b5ec616003b065b4088694fce614,747372613949f1e913f1ee7ca049c7657fe9f39a..987a5653342625a0f7c5b19c7b605bcb42367643
  #include <exception>
  #include <string>
  #include "functor.h"
- //EED-MLER #include <listWx.h>
- //EED-MLER #include <wx/listctrl.h>
  
  
- /*!   @namespace <creaButtonContainer>
-  *    @brief Contains the creaButtonContainer library included in creaMaracasVisu.
-  */
- /*namespace creaButtonContainer
+ namespace creaButtonContainer
  {
-       namespace view
-       {
-               typedef std::list< ListWx* > ListLst;
-               typedef std::map< StringType, ListLst > ListGroupMap; // ex: grupo A,lista A,lista B
-       }
 +
+       //using namespace view;
 +
- }*/
- namespace creaButtonContainer
- {
- //EED-MLER    using namespace view;
        // ----------------------------------------------------------------------------------
        /*!     @typedef std::string* StringType;
         *      @brief Defines the StringType type.
index 4426590c5b873395cc08272ea9bd952b6400ad70,7696062979c0a7256f4f28a212110c35be76580c..5e145418c67106d564e33a79487b905346fbffe0
@@@ -133,12 -133,14 +133,16 @@@ namespace creaButtonContaine
                                typedef creaButtonContainer::controller::ButtonContainerController
                                    BCController;
  
- //EED-MLER                            typedef creaButtonContainer::view::ListGroup ListGroup;
 +
- //EED-MLER                            typedef std::list< ListGroup* > ListGroupList;
+                               //typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
+                               //typedef creaButtonContainer::view::ListGroup ListGroup;
+                               //typedef std::list< ListGroup* > ListGroupList;
+                               //typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
  
- //EED-MLER                            typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
 +
                                // ----------------------------------------------------------------------------------
                                //end of typedef definition
                        public:
                        public:
                                friend class creaButtonContainer::controller::ButtonContainerController;
                        private:
 -                              GroupManagerList m_GroupManagerList; //!<The container of managers.
 -                              ButtonGroupList m_ButtonGroupList; //!<The list of button groups.
 -                              BCController* m_ButtonCController; //!<Pontier to controller.
 -                              Sizer* m_Sizer; //!<Pointer to wxSizer
 +                              GroupManagerList        m_GroupManagerList; //!<The container of managers.
 +                              ButtonGroupList         m_ButtonGroupList; //!<The list of button groups.
 +                              BCController*           m_ButtonCController; //!<Pontier to controller.
 +                              Sizer*                          m_Sizer; //!<Pointer to wxSizer
 +
- //EED-MLER                            ListGroupList m_ListGroupList;
+                               //ListGroupList m_ListGroupList;
++
                        DECLARE_EVENT_TABLE() //!<Event Table declaration.
                };
        }//ecapseman
index 9d6fbe6e907c7ca6e41772298e50bc80c408b731,9ba6cee0e3386a3065da0ba4a54eddd486135fe4..04686b098403493fce4faf03d6edf47b7f954744
@@@ -66,10 -56,41 +56,43 @@@ namespace creaButtonContaine
                }
  
                // ----------------------------------------------------------------------------------
+               ListGroup::IdButtonContainer
+               ListGroup::GetButtonIdContainer( )
+               {
+                       IdButtonContainer idContainer;
+                       try
+                       {
+                               for( ButtonContainer::iterator it = this->m_Buttons.begin( ); it
+                                   != this->m_Buttons.end( ); ++it )
+                               {
+                                       idContainer.push_back( ( *it ).first );
+                               }//rof
+                       }//yrt
+                       catch ( std::exception& e )
+                       {
+                               std::cerr << "ButtonGroup::GetButtonIdContainer( )" << "exception: "
+                                   << e.what( ) << std::endl;
+                       }//hctac
+                       return ( idContainer );
+               }
  
+               // ----------------------------------------------------------------------------------
+               ListGroup::Button*
+               ListGroup::GetButton( long id )
+               {
+                       try
+                       {
+                               //return ( this->m_Buttons[ id ] ); // JPR
+                       }//yrt
+                       catch ( std::exception& e )
+                       {
+                               std::cerr << "ButtonGroup::GetButton( long id )" << "exception: "
+                                   << e.what( ) << std::endl;
+                       }//hctac
+                       return ( this->m_Buttons[ id ] );// JPR
+               }
        // ----------------------------------------------------------------------------------
        }//ecapseman
- }//ecapseman
+ }//ecapseman*/
++
 +
- */
index 6eb86d8b0cf81036287fef25f1ba33ac648f8332,9fd986bbfa1604cec070aca5faa724175adb3ab7..5de552c2ff816d48b423f769209fda1f4c9b92f2
  # ------------------------------------------------------------------------ */
  
  
- //EED-MLER
- /*
 +
  #include "listWx.h"
  
  namespace creaButtonContainer
  {
        namespace view
        {
-               ListWx::ListWx(wxWindow* parent, ItemsList items)
+               // ----------------------------------------------------------------------------------
+               ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id)
                {
-                       wxListCtrl* lstCtrl = new wxListCtrl (parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
  
-                       this->m_items                   = items;
-                       lstCtrl->InsertItem(0,(*items.front()).GetText());
-               }
-               //-------------------------------------------------------
+                       std::cout<< "MLER | ListWx::ListWx()" << std::endl;
+                       this->m_itemsMap = iMap;
  
-               tList::~tList( )
-               {
-               }
+                       this->functor = functor;
+                       int i = 0;
+                       for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it)
+                       {
  
-               //-------------------------------------------------------
+                               std::string key = it->first;
+                               long index = this->InsertItem(i, wxString(key.c_str(), wxConvUTF8));
  
-               ItemsList getItems() const
-               {
-                       return m_items;
+                               std::cout << "index" << index << std::endl;
+                               this->Connect( -1, wxEVT_COMMAND_LIST_ITEM_SELECTED,
+                                                wxListEventHandler(ListWx::ListEvent) );
+                               i++;
+                       }
                }
  
-               void setItems(ItemsList items)
+               // ----------------------------------------------------------------------------------
+               ListWx::~ListWx( )
                {
-                       m_items = items;
                }
  
+               void
+               ListWx::ListEvent( wxListEvent& event )
+               {
+                       try
+                       {
+                               std::cout<< "MLER | ListWx::ListEvent( wxListEvent& event )" << std::endl;
  
+                               wxString itemNom = event.GetItem().GetText();
  
-       }
+                               std::string itemNomC = std::string(itemNom.mb_str());
  
- }
+                               this->functor->Call(itemNomC);
+                               std::cout<<"mmmmmmmmmmmmmmmmmmmmmmm"<<std::endl;
  
- */
+                       }//yrt
+                       catch ( const std::exception& e )
+                       {
+                               std::cerr
+                                   << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: "
+                                   << e.what( ) << std::endl;
+                       }//hctac
+               }
+       // ----------------------------------------------------------------------------------
+       }//ecapseman
+ }//ecapseman
 +
 +
index 879be81aaddcb4dab32d4b01ff9cd0441abb9041,cc82378b606649f6426f3264b20b7f52e1651da6..e93c87a03fcc78994b6dda0b3a478429507dd985
@@@ -237,66 -281,43 +281,65 @@@ namespace creaPanelButtonContaine
                }//hctac
        }
  
 +
 +//EED-MLER
 +/*
        void
-               ButtonContainerSettings::AddItem(BCPSettingsStruct* info)
+       ButtonContainerSettings::AddItems(BCPSettingsStruct* info)
+       {
+               try
                {
-                       if(info->panel == NULL)
+                       std::cout<< "MLER | ButtonContainerSettings:: AddItems(BCPSettingsStruct* info)" << std::endl;
+                       //builds the button information
+                       //I don't know the try catch doesn't work!!
+                       if ( info->panel == NULL )
                        {
-                               std::cerr
-                               << "ButtonContainerSettings::AddItem"
-                               << "exception: NULL Pointer in panel" << std::endl;
-                               exit(1);
+                               std::cerr << "ButtonContainerSettings::AddButton"
+                                   << "exception: NULL Pointer in panel " << std::endl;
+                               exit( 1 );
                        }
  
-                       wxListItem item;
-                       wxString myString((info->buttonName).c_str(),wxConvUTF8);
-                       item.SetText(myString);
+                       info->panel->Show( false );
  
-                       try
-                               {
-                                       for(KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
-                                           != this->m_GroupNameList.end( ); ++it )
-                                       {
-                                               if((*it).compare(info->groupName) == 0)
-                                               {
-                                                       this->m_ListGroupContainer[info->groupName].push_back(item);
-                                                       return;
-                                               }
-                                       }//rof
-                                       this->m_GroupNameList.push_back(info->groupName);
-                                       this->m_ListGroupContainer[info->groupName].push_back(item);
-                               }//yrt
-                               catch ( const std::exception& e )
-                               {
-                                       std::cerr
-                                   << "ContainerSettings::AddButtons( BCStructVectorType infoList ) "
-                                   << "exception: " << e.what( ) << std::endl;
-                               }//hctac
-                       }
+                       std::string mapKey = info->groupName + ":" + info->buttonName;
+                       m_itemsMap[mapKey] = info->panel;
  
-       void
-               ButtonContainerSettings::AddItems(BCStructVectorType infoList)
+               }//yrt
+               catch ( const std::exception& e )
                {
++<<<<<<< HEAD
 +                      try
 +                      {
 +                              for( BCStructVectorType::iterator it = infoList.begin( ); it
 +                                  != infoList.end( ); ++it )
 +                              {
 +                                      this->AddItem(*it);
 +                              }//rof
 +                      }//yrt
 +                      catch ( const std::exception& e )
 +                      {
 +                              std::cerr
 +                          << "ContainerSettings::AddButtons( BCStructVectorType infoList ) "
 +                          << "exception: " << e.what( ) << std::endl;
 +                      }//hctac
 +              }
 +*/
++=======
+                       std::cerr
+                       << "ButtonContainerSettings::AddButton( BCPSettingsStruct* info )"
+                       << "exception: " << e.what( ) << std::endl;
+                       exit( 1 );
+               }//hctac
+       }
+       ButtonContainerSettings::ItemsMap
+       ButtonContainerSettings::GetItemsMap()
+       {
+               std::cout<< "MLER | ButtonContainerSettings:: GetItemsMap()" << std::endl;
+               return m_itemsMap;
+       }
++>>>>>>> b8c5a565c70ac0def1f21518afa2d847a9582d79
  
  // ----------------------------------------------------------------------------------
  }//ecapseman
index 056e4e87e89a6e61ac25b3506f4333be9897d091,bb00f7dff81a165f03ff055861531a7f3b23adad..9f3e5245db7d7f17cdb1cfc1e433f710951ecfb9
@@@ -126,11 -126,7 +126,9 @@@ namespace creaPanelButtonContaine
                         *      @brief This class contains the settings of the button container.
                         */
  
- //EED-MLER                    typedef wxListItem Item;
- //EED-MLER                    typedef std::list < tList* > ItemsList;
- //EED-MLER                    typedef std::map< StringType, ListLst > ListGroupMap;
 +
+                       typedef std::map< std::string, wxPanel* > ItemsMap;
 +
                public:
                        // ----------------------------------------------------------------------------------
                        /*! @fn ButtonContainerSettings( );
                         * @exception std::bad_alloc
                         */
                        void
-                       AddButtons( BCStructVectorType infoList );
- //EED-MLER
- /*
-                       void
-                       AddItem (BCPSettingsStruct* info);
-                       void
-                       AddItems( BCStructVectorType infoList );
- */
+                       AddButtons( BCStructVectorType infoList, int type );
  
 -                      void
 -                      AddItems(BCPSettingsStruct* info);
 -
 -                      ItemsMap
 -                      GetItemsMap();
 -
 -                      PanelButton
 -                      GetPanelList( const StringType &buttonName );
 -
 -
                        // ----------------------------------------------------------------------------------
                private:
                        ButtonGroupMap m_ButtonGroupContainer; //!<This is the map with the groups of buttons.
                        KeyMapList m_GroupNameList; //!<This is a container with the name of the groups.
  
- //EED-MLER                    ListGroupMap m_ListGroupContainer;
-       };
++
+                       //MLER
+                       ItemsMap m_itemsMap; //This is the map with the name and the wPanel
+               };
++
  }//ecapseman
  #endif /* BUTTONCONTAINERSETTINGS_H_ */