]> Creatis software - creaMaracasVisu.git/commitdiff
creaButtonContainer & creaPanelButtonContainer: Deep errors have been solved!! ready...
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Tue, 24 May 2011 19:17:35 +0000 (19:17 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Tue, 24 May 2011 19:17:35 +0000 (19:17 +0000)
18 files changed:
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.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/functor.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/functor.txx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx

index bb28d530ea03bef373e3a83959eb561b139e1f56..3af5eaf82efddcf7fb54ee6d78ebc7bf307f42dc 100644 (file)
@@ -19,7 +19,6 @@ namespace creaButtonContainer
                // ----------------------------------------------------------------------------------
                ButtonContainerController::~ButtonContainerController( )
                {
-                       delete this->m_BCPanel;
                }
                // ----------------------------------------------------------------------------------
                void
@@ -51,7 +50,7 @@ namespace creaButtonContainer
                                        }//rof
                                }//rof
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr << "ButtonContainerController::AddEvents( ) exception: "
                                    << e.what( ) << std::endl;
@@ -81,7 +80,7 @@ namespace creaButtonContainer
                                }//fi esle
                                this->m_BCPanel->FitSizer( );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) exception: "
@@ -98,10 +97,11 @@ namespace creaButtonContainer
                                    this->m_BCPanel->m_ButtonGroupList.begin( ); it
                                    != this->m_BCPanel->m_ButtonGroupList.end( ); ++it )
                                {
-                                       ( *it )->GetButton( event.GetId( ) )->Execute( );
+                                       if ( ( *it )->GetButton( event.GetId( ) ) != NULL )
+                                               ( *it )->GetButton( event.GetId( ) )->Execute( );
                                }//rof
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: "
index 167bade8e9e6cb42b281695037e7a3b7f37b6831..395f12d3b763246c42dff8369d400832283b2d76 100644 (file)
@@ -24,31 +24,28 @@ namespace creaButtonContainer
                ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,
                    ButtonGroupModel* settings )
                {
-                       ButtonGroupContainer groupView;
                        try
                        {
+                               ButtonGroupContainer groupView;
                                ButtonGroupMap map = settings->GetButtonGroupContainer( );
                                for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it )
                                {
-                                       //using wxWidgets.
                                        wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );
                                        wxStaticText* wxGroupName = new wxStaticText( parent, -1,
                                            groupNameAux, wxDefaultPosition, wxDefaultSize, 0,
-                                           _T( "GroupText" ) );
-                                       //creating a wxButtonGroup.
+                                           _T("GroupText") );
                                        ButtonGroup* group = new ButtonGroup( wxGroupName,
                                            this->GetButtons( parent, ( *it ).second ) );
-                                       //adding the group to the container.
                                        groupView.push_back( group );
-                               }//rof
+                               }
+                               return ( groupView );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent,   ButtonGroupModel* settings )"
                                    << " exception: " << e.what( ) << std::endl;
                        }//chtac
-                       return ( groupView );
                }
                // ----------------------------------------------------------------------------------
                ButtonGroupFactory::ButtonContainer
@@ -57,6 +54,7 @@ namespace creaButtonContainer
                        ButtonContainer buttonList;
                        try
                        {
+                               ButtonContainer buttonList;
                                for( ButtonList::iterator it = buttonModel.begin( ); it
                                    != buttonModel.end( ); ++it )
                                {
@@ -65,7 +63,7 @@ namespace creaButtonContainer
                                }
                                return ( buttonList );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )"
index 10e387a71764ddccdbbf33386295331da857c81e..a4e18f90bf721e50f352799816b8ee3c2ff186f0 100644 (file)
@@ -66,7 +66,7 @@ namespace creaButtonContainer
                                this->m_GroupNameList.push_back( groupName );
                                this->m_ButtonGroupContainer[ groupName ].push_back( pair );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ContainerSettings::AddButton( const std::string & groupName,"
@@ -96,7 +96,7 @@ namespace creaButtonContainer
                                this->m_GroupNameList.push_back( info->groupName );
                                this->m_ButtonGroupContainer[ info->groupName ].push_back( pair );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "void ContainerSettings::AddButton( BCSettingsStruct* info ) "
@@ -115,7 +115,7 @@ namespace creaButtonContainer
                                        this->AddButton( *it );
                                }//rof
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ContainerSettings::AddButtons( BCStructVectorType infoList ) "
index 7a84073a14b563757e8685d014e7ab9401df151a..e180dc12d5fa4fb0dd2bd4c6aeae75b62e7123ac 100644 (file)
@@ -12,6 +12,7 @@
 #include <map>
 #include <vector>
 #include <iostream>
+#include <exception>
 #include "structBCSettings.h"
 #include "system.h"
 #include "functor.h"
index f895a8204e54af9d93f3f06871950f27e921d032..9cee15dcabf40128125f9d0a3d74ebf14c605640 100644 (file)
@@ -9,6 +9,7 @@
 #define TFUNCTOR_H_
 
 #include <string>
+#include <exception>
 
 /*!    @namespace <creaButtonContainer>
  *     @brief Contains the creaButtonContainer library included in creaMaracasVisu.
index 2c761358f1f489622e617ddfb68765097791eca5..e37abe53d3e367930eaab8bda53ee5cfeeb6b01e 100644 (file)
@@ -29,7 +29,7 @@ namespace creaButtonContainer
            {
                  ( *pt2Object.*fpt )( buttonName );
            }//yrt
-           catch ( std::exception& e )
+           catch ( const std::exception& e )
            {
                  std::cerr<< "TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName )"
                                  <<" exception: " << e.what( ) << std::endl;
@@ -45,7 +45,7 @@ namespace creaButtonContainer
            {
                  ( *pt2Object.*fpt )( buttonName );
            }//yrt
-           catch ( std::exception& e )
+           catch ( const std::exception& e )
            {
                  std::cerr<< "TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName )"
                                  <<" exception: " << e.what( ) << std::endl;
index e0601fc98b3758e57f873ed3efa8ca9e5b65f7bc..51db3bd5c136fa16fd6dcc7eca647bb4ac4bc601 100644 (file)
@@ -11,6 +11,7 @@
 #include <list>
 #include <map>
 #include <iostream>
+#include <exception>
 #include "functor.h"
 
 /*!    @namespace <creaButtonContainer>
index d45f9c21fac05bad7b4a6b44107c3169c31ddb7f..40b1697c46ea85d32feca11aa50fcb17a284bd3c 100644 (file)
@@ -62,7 +62,7 @@ namespace creaButtonContainer
                                { this->m_ButtonPair->second->second };
                                vTable[ 0 ]->Call( this->m_ButtonPair->first->first );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
                        }//hctac
index 71662a200a1fa78c30e3b82404cc165975143940..45aeb4f4d83ee54e988c8cdf82275ff8169fc836 100644 (file)
 #include <wx/string.h>
 #include <string>
 #include <iostream>
+#include <exception>
 #include "functor.h"
 #include "system.h"
 
+
 /*!    @namespace <creaButtonContainer>
  *     @brief Contains the creaButtonContainer library included in creaMaracasVisu.
  */
index 7aad096a42810495ffb4822687b2e121e9758e51..3265447de31e53d75e8c3703609f2918acda461b 100644 (file)
@@ -59,7 +59,7 @@ namespace creaButtonContainer
                                this->SetSizer( this->m_Sizer );
                                this->FitSizer( );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr << "ButtonContainerPanel::PanelInit( ) " << "exception: "
                                    << e.what( ) << std::endl;
index 063b9d5466bff8662bb0e75d543c6877879ebb05..579ac83941551e2a99bcbb470d003693f0c56e83 100644 (file)
@@ -13,6 +13,7 @@
 #include <wx/sizer.h>
 #include <list>
 #include <map>
+#include <exception>
 
 #include "buttonGroup.h"
 #include "groupManager.h"
@@ -49,6 +50,7 @@ namespace creaButtonContainer
                /*! @class ButtonContainerPanel buttonContainerPanel.h "buttonContainerPanel.h"
                 *  @brief This class is the container of the creaButtonContainer.
                 *  @details This class derives from wxScrolledWindow and manages the view of the buttonContainer.
+                *  @bug The scrolled it doesn't work! (to be changed soon)
                 *  @see <a href="http://docs.wxwidgets.org/stable/wx_wxscrolledwindow.html">wxScrolledWindow</a>
                 */
                class ButtonContainerPanel : public wxScrolledWindow
index ce064285e47a6bea4a4e51fc9e3452e61b580ca8..b3285692378b1fe7be551e9ca19027954bb308d0 100644 (file)
@@ -12,6 +12,7 @@
 #include <map>
 #include <list>
 #include <wx/stattext.h>
+#include <exception>
 
 #include "button.h"
 
index d85596953dd3cd4abd5196c3b161dd5032c7ba42..38a4c6b38a2e5d874b5ba0db790501f6eb4385ea 100644 (file)
@@ -25,7 +25,7 @@ namespace creaButtonContainer
                                this->SetGroupName( buttonGroup->GetGroupName( ) );
                                this->SetButtonManager( buttonGroup->GetButtonContainer( ) );
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
                        }//hctac
@@ -57,7 +57,7 @@ namespace creaButtonContainer
                                        this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
                                }
                        }//yrt
-                       catch ( std::exception& e )
+                       catch ( const std::exception& e )
                        {
                                std::cerr
                                    << "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )"
index d08cbdc63e3479fea4b1c607c79b02c782c6f437..15127e92ae3a0a38b1edb7bfc2e1d8cf8a59b740 100644 (file)
@@ -13,6 +13,7 @@
 #include <wx/stattext.h>
 #include <wx/string.h>
 #include <map>
+#include <exception>
 #include "button.h"
 #include "buttonGroup.h"
 
index c7d2ca5309cbd336e6b92946a71eaced01c395c5..969b7a487d2e63ef304473cb605adf01091aa009 100644 (file)
@@ -14,6 +14,7 @@
 #include <wx/event.h>
 #include <list>
 #include <iostream>
+#include <exception>
 #include "buttonManager.h"
 #include "buttonGroup.h"
 #include <wx/event.h>
index 7dcd9a42cc24fb862ee7949874359585bcec92c6..8ca88d0e7200ab5d08dd1d66ab7e38f80aaa4754 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "buttonContainerSettings.h"
-#include <iostream>
 
 namespace creaPanelButtonContainer
 {
@@ -55,16 +54,16 @@ namespace creaPanelButtonContainer
                        std::cerr
                            << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) "
                            << "exception: " << e.what( ) << std::endl;
-                       return ( NULL );
                }//hctac
+               return ( NULL );
        }
        // ----------------------------------------------------------------------------------
        ButtonContainerSettings::ButtonGroupSettings*
        ButtonContainerSettings::GetButtonGroupSettings( TFunctor* functor )
        {
-               ButtonGroupSettings* settings = new ButtonGroupSettings( );
                try
                {
+                       ButtonGroupSettings* settings = new ButtonGroupSettings( );
                        for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
                            != this->m_GroupNameList.end( ); ++it )
                        {
@@ -82,7 +81,6 @@ namespace creaPanelButtonContainer
                        std::cerr
                            << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) "
                            << "exception: " << e.what( ) << std::endl;
-                       return ( NULL );
                }//hctac
        }
        // ----------------------------------------------------------------------------------
@@ -107,6 +105,13 @@ namespace creaPanelButtonContainer
                try
                {
                        //builds the button information
+                       //I don't know the try catch doesn't work!!
+                       if ( panel == NULL )
+                       {
+                               std::cerr << "ButtonContainerSettings::AddButton"
+                                   << "exception: NULL Pointer in panel " << std::endl;
+                               exit( 1 );
+                       }
                        panel->Show( false );
                        ButtonPair* pair = new ButtonPair(
                            new ButtonInfo( buttonName, iconpath ),
@@ -123,7 +128,7 @@ namespace creaPanelButtonContainer
                        this->m_GroupNameList.push_back( groupName );
                        this->m_ButtonGroupContainer[ groupName ].push_back( pair );
                }//yrt
-               catch ( std::exception& e )
+               catch ( const std::exception& e )
                {
                        std::cerr
                            << "ButtonContainerSettings::AddButton( const std::string & groupName,"
@@ -139,6 +144,13 @@ namespace creaPanelButtonContainer
                try
                {
                        //builds the button information
+                       //I don't know the try catch doesn't work!!
+                       if ( info->panel == NULL )
+                       {
+                               std::cerr << "ButtonContainerSettings::AddButton"
+                                   << "exception: NULL Pointer in panel " << std::endl;
+                               exit( 1 );
+                       }
                        info->panel->Show( false );
                        ButtonPair* pair = new ButtonPair(
                            new ButtonInfo( info->buttonName, info->iconpath ),
@@ -154,12 +166,13 @@ namespace creaPanelButtonContainer
                        }//rof
                        this->m_GroupNameList.push_back( info->groupName );
                        this->m_ButtonGroupContainer[ info->groupName ].push_back( pair );
-               }
-               catch ( std::exception& e )
+               }//yrt
+               catch ( const std::exception& e )
                {
                        std::cerr
                            << "ButtonContainerSettings::AddButton( BCPSettingsStruct* info )"
                            << "exception: " << e.what( ) << std::endl;
+                       exit( 1 );
                }//hctac
        }
        // ----------------------------------------------------------------------------------
@@ -173,7 +186,7 @@ namespace creaPanelButtonContainer
                        {
                                this->AddButton( *it );
                        }//rof
-               }
+               }//yrt
                catch ( std::exception& e )
                {
                        std::cerr
index ff61b632ec557618d10371a7cee18e9444555a36..fa94fd1d2342afb5d266d2643d07de944b847918 100644 (file)
@@ -12,6 +12,7 @@
 #include <map>
 #include <wx/panel.h>
 #include <vector>
+#include <iostream>
 
 #include "structBCPSettings.h"
 #include "containerSettings.h"
index 133a214ddbd67baad7e14875ea08dd0500ccce8f..a9318da37b1040c04fd24a6a64e9d923d9c86329 100644 (file)
@@ -20,19 +20,24 @@ namespace creaPanelButtonContainer
        {
                this->m_ButtonContainerSettings = bcSettings;
                this->m_ButtonPanel = new wxPanel( this );
+
                //Class that manages the cartobutton event!!!
                TConcreteFunctor* functor = new TConcreteFunctor( this,
                    &PanelButtonContainer::GenericButtonEvent );
                //end of the event definition
+
                this->m_ButtonContainerPanel = new ButtonContainerPanel( this,
                    this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
+
                //Using AuiManager to Manage the Panels
                this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
+
                // CartoSettingsPanel Management
                this->m_AuiManager->AddPane(
                    this->m_ButtonPanel,
                    wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible( ).CloseButton(
                        false ).Left( ).MinSize( wxSize( 300, 300 ) ) );
+
                //CartoButtonPanel Management
                this->m_AuiManager->AddPane(
                    this->m_ButtonContainerPanel,
@@ -40,7 +45,6 @@ namespace creaPanelButtonContainer
                        _("creaButtonContainer") ). CaptionVisible( ).CloseButton( false ).Left( ) .MinSize(
                        wxSize( 300, 300 ) ) );
                this->m_AuiManager->Update( );
-               //this->createGimmick();
        }
        // ----------------------------------------------------------------------------------
        PanelButtonContainer::~PanelButtonContainer( )
@@ -50,16 +54,27 @@ namespace creaPanelButtonContainer
        void
        PanelButtonContainer::UpdatePanel( const std::string &buttonName )
        {
-               //Hiding the last CartoSettingsPanel
-               this->m_ButtonPanel->Show( false );
-               //Finding the CartoSettingsPanel of the ButtonClicket
-               this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(
-                   buttonName );
-               //CartoSettingsPanel Management
-               this->m_AuiManager->GetPane( _T("ButtonPanel") ).window
-                   = this->m_ButtonPanel;
-               //Updating the manager
-               this->m_AuiManager->Update( );
+               try
+               {
+                       //Hiding the last CartoSettingsPanel
+                       this->m_ButtonPanel->Show( false );
+                       //Finding the CartoSettingsPanel of the ButtonClicket
+                       this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(
+                           buttonName );
+                       //CartoSettingsPanel Management
+                       this->m_AuiManager->GetPane( _T("ButtonPanel") ).window
+                           = this->m_ButtonPanel;
+                       //Updating the manager
+                       this->m_AuiManager->Update( );
+               }//yrt
+               catch ( const std::exception& e )
+               {
+                       std::cerr
+                           << "PanelButtonContainer::UpdatePanel( const std::string &buttonName )"
+                           << "exception: " << e.what( ) << std::endl;
+                       std::cout<<"Maybe the panel of the button is NULL"<<std::endl;
+                       exit(1);
+               }//hctac
        }
        // ----------------------------------------------------------------------------------
        void