X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FcreaPanelButtonContainer%2FbuttonContainerSettings.cxx;h=80dee9a41172b129d35786b893cc58862311e880;hb=65c158dc171f8d3114ee3544b2a94a1f41880df0;hp=7dcd9a42cc24fb862ee7949874359585bcec92c6;hpb=de7a931d43b373fdbaba530ae326a64d45148ae9;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx index 7dcd9a4..80dee9a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx @@ -2,11 +2,10 @@ * @file buttonContainerSettings.cxx * @brief Implements the ButtonContainerSettings class. * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) - * @date 2011-05-24 + * @date 2011-06-02 */ #include "buttonContainerSettings.h" -#include namespace creaPanelButtonContainer { @@ -33,7 +32,7 @@ namespace creaPanelButtonContainer // ---------------------------------------------------------------------------------- //GetButtonPanel returns the panel associated to the buttonAction ButtonContainerSettings::PanelButton - ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) + ButtonContainerSettings::GetPanelButton( const StringType &buttonName ) { try { @@ -53,18 +52,18 @@ namespace creaPanelButtonContainer catch ( std::exception& e ) { std::cerr - << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) " + << "ButtonContainerSettings::GetPanelButton( const StringType &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 ) { @@ -80,9 +79,8 @@ namespace creaPanelButtonContainer catch ( std::exception& e ) { std::cerr - << "ButtonContainerSettings::GetPanelButton( const std::string &buttonName ) " + << "ButtonContainerSettings::GetPanelButton( const StringType &buttonName ) " << "exception: " << e.what( ) << std::endl; - return ( NULL ); }//hctac } // ---------------------------------------------------------------------------------- @@ -100,13 +98,20 @@ namespace creaPanelButtonContainer } // ---------------------------------------------------------------------------------- void - ButtonContainerSettings::AddButton( const std::string & groupName, - const std::string &buttonName, const std::string &iconpath, - const std::string &buttonDescription, PanelButton panel ) + ButtonContainerSettings::AddButton( const StringType & groupName, + const StringType &buttonName, const StringType &iconpath, + const StringType &buttonDescription, PanelButton panel ) { 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,12 +128,12 @@ 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," - << "const std::string &buttonName, const std::string &iconpath," - << "const std::string &buttonDescription, PanelButton panel ) " + << "ButtonContainerSettings::AddButton( const StringType & groupName," + << "const StringType &buttonName, const StringType &iconpath," + << "const StringType &buttonDescription, PanelButton panel ) " << "exception: " << e.what( ) << std::endl; }//hctac } @@ -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