]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx
creaButtonContainer & creaPanelButtonContainer: Deep errors have been solved!! ready...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaPanelButtonContainer / buttonContainerSettings.cxx
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