From: davila Date: Mon, 26 Jan 2015 13:33:21 +0000 (+0100) Subject: #2507 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e1c23d053ffe93035f13802efdb19dc116e4b46c;p=creaMaracasVisu.git #2507 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel --- e1c23d053ffe93035f13802efdb19dc116e4b46c diff --cc bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx index 3f30cba,85f630b..882d3d0 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx @@@ -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 ); diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx index cbba163,cbba163..515784a --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx @@@ -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); } @@@ -359,7 -359,7 +359,7 @@@ 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 , diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx index 18f7699,7b640cd..45d2932 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx @@@ -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, @@@ -176,105 -164,7 +165,6 @@@ }//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 diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h index 54f9ce9,7aa3dc5..2302977 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h @@@ -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: diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.cxx index d6ce526,54559d9..91df61b --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.cxx @@@ -99,7 -89,5 +89,6 @@@ namespace creaButtonContaine } // ---------------------------------------------------------------------------------- }//ecapseman - }//ecapseman + }//ecapseman*/ + - */ diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h index 69c3d2d,7473726..987a565 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h @@@ -39,27 -39,11 +39,13 @@@ #include #include #include "functor.h" - //EED-MLER #include - //EED-MLER #include - /*! @namespace - * @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. diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h index 4426590,7696062..5e14541 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h @@@ -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: @@@ -178,12 -184,12 +186,14 @@@ public: friend class creaButtonContainer::controller::ButtonContainerController; private: - GroupManagerList m_GroupManagerList; //!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*/ ++ + - */ diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx index 6eb86d8,9fd986b..5de552c --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx @@@ -24,47 -24,61 +24,64 @@@ # ------------------------------------------------------------------------ */ + - //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"<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 diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h index 056e4e8,bb00f7d..9f3e524 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h @@@ -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( ); @@@ -234,23 -230,25 +232,17 @@@ * @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; //!