#include <Fireworks/Core/interface/FWSelectionManager.h>
Description: Manages the list of selected Model items
Usage: <usage>
Definition at line 35 of file FWSelectionManager.h.
FWSelectionManager::FWSelectionManager | ( | FWModelChangeManager * | iCM | ) |
Definition at line 36 of file FWSelectionManager.cc.
References FWModelChangeManager::changeSignalsAreDone_, finishedAllSelections(), and m_changeManager.
: m_changeManager(iCM), m_wasChanged(false) { assert(0!=m_changeManager); m_changeManager->changeSignalsAreDone_.connect(boost::bind(&FWSelectionManager::finishedAllSelections,this)); }
FWSelectionManager::FWSelectionManager | ( | const FWSelectionManager & | ) | [private] |
void FWSelectionManager::clearItemSelection | ( | ) |
Definition at line 82 of file FWSelectionManager.cc.
References m_itemSelection.
Referenced by clearSelection().
{ //may need this in the future //FWChangeSentry sentry(*m_changeManager); std::set<FWEventItem*> items; items.swap(m_itemSelection); for(std::set<FWEventItem*>::iterator it = items.begin(), itEnd = items.end(); it != itEnd; ++it) { //NOTE: this will cause (*it)->unselectItem(); } }
void FWSelectionManager::clearModelSelectionLeaveItem | ( | ) |
Definition at line 97 of file FWSelectionManager.cc.
References m_changeManager, and m_selection.
{ FWChangeSentry sentry(*m_changeManager); for(std::set<FWModelId>::iterator it = m_selection.begin(), itEnd = m_selection.end(); it != itEnd; ++it) { //NOTE: this will cause it->unselect(); } }
void FWSelectionManager::clearSelection | ( | ) |
Definition at line 69 of file FWSelectionManager.cc.
References clearItemSelection(), m_changeManager, and m_selection.
Referenced by FWCollectionSummaryWidget::infoClicked(), FWCollectionSummaryWidget::labelClicked(), FWTableView::modelSelected(), FWCollectionSummaryWidget::modelSelected(), FWEveViewManager::selectionCleared(), FWCollectionSummaryWidget::stateClicked(), and CmsShowMain::~CmsShowMain().
{ FWChangeSentry sentry(*m_changeManager); for(std::set<FWModelId>::iterator it = m_selection.begin(), itEnd = m_selection.end(); it != itEnd; ++it) { //NOTE: this will cause it->unselect(); } clearItemSelection(); }
void FWSelectionManager::finishedAllSelections | ( | ) | [private] |
Definition at line 109 of file FWSelectionManager.cc.
References m_newSelection, m_selection, m_wasChanged, and selectionChanged_.
Referenced by FWSelectionManager().
{ if(m_wasChanged) { m_selection=m_newSelection; selectionChanged_(*this); m_wasChanged = false; } }
void FWSelectionManager::itemChanged | ( | const FWEventItem * | iItem | ) | [private] |
Definition at line 153 of file FWSelectionManager.cc.
References FWEventItem::id(), m_itemConnectionCount, m_newSelection, m_selection, and m_wasChanged.
Referenced by select().
{ assert(0!=iItem); assert(m_itemConnectionCount.size() > iItem->id()); //if this appears in any of our models we need to remove them FWModelId low(iItem,0); FWModelId high(iItem,0x7FFFFFFF); //largest signed 32 bit number bool someoneChanged = false; { std::set<FWModelId>::iterator itL=m_newSelection.lower_bound(low), itH=m_newSelection.upper_bound(high); if(itL!=itH) { m_wasChanged =true; someoneChanged=true; m_newSelection.erase(itL,itH); } } { std::set<FWModelId>::iterator itL=m_selection.lower_bound(low), itH=m_selection.upper_bound(high); if(itL!=itH) { m_wasChanged =true; someoneChanged = true; //Don't need to erase here since will happen in 'finishedAllSelection' } } assert(someoneChanged); m_itemConnectionCount[iItem->id()].second.disconnect(); m_itemConnectionCount[iItem->id()].first = 0; }
const FWSelectionManager& FWSelectionManager::operator= | ( | const FWSelectionManager & | ) | [private] |
void FWSelectionManager::select | ( | const FWModelId & | iId | ) | [private] |
Definition at line 119 of file FWSelectionManager.cc.
References FWEventItem::id(), FWModelId::item(), itemChanged(), m_itemConnectionCount, m_newSelection, m_wasChanged, and FWEventItem::preItemChanged_.
Referenced by FWEventItem::select(), and FWEventItem::toggleSelect().
{ bool changed = m_newSelection.insert(iId).second; m_wasChanged |=changed; if(changed) { //if this is new, we need to connect to the 'item' just incase it changes if(m_itemConnectionCount.size()<= iId.item()->id()) { m_itemConnectionCount.resize(iId.item()->id()+1); } if(1 ==++(m_itemConnectionCount[iId.item()->id()].first) ) { //want to know early about item change so we can send the 'selectionChanged' message // as part of the itemChange message from the ChangeManager // This way if more than one Item has changed, we still only send one 'selectionChanged' message m_itemConnectionCount[iId.item()->id()].second = iId.item()->preItemChanged_.connect(boost::bind(&FWSelectionManager::itemChanged,this,_1)); } } }
const std::set< FWModelId > & FWSelectionManager::selected | ( | ) | const |
Definition at line 200 of file FWSelectionManager.cc.
References m_selection.
Referenced by FWInvMassDialog::Calculate(), FWModelContextMenuHandler::chosenItem(), FWModelContextMenuHandler::colorChangeRequested(), CmsShowModelPopup::fillModelPopup(), FWViewContextMenuHandlerGL::select(), FWModelContextMenuHandler::showSelectedModelContext(), and FWGUIManager::showSelectedModelContextMenu().
{ return m_selection; }
const std::set< FWEventItem * > & FWSelectionManager::selectedItems | ( | ) | const |
Definition at line 206 of file FWSelectionManager.cc.
References m_itemSelection.
Referenced by CmsShowEDI::fillEDIFrame().
{ return m_itemSelection; }
void FWSelectionManager::selectItem | ( | FWEventItem * | iItem | ) | [private] |
Definition at line 185 of file FWSelectionManager.cc.
References itemSelectionChanged_, and m_itemSelection.
Referenced by FWEventItem::selectItem(), and FWEventItem::toggleSelectItem().
{ m_itemSelection.insert(iItem); itemSelectionChanged_(*this); }
void FWSelectionManager::unselect | ( | const FWModelId & | iId | ) | [private] |
Definition at line 139 of file FWSelectionManager.cc.
References FWEventItem::id(), FWModelId::item(), m_itemConnectionCount, m_newSelection, and m_wasChanged.
Referenced by FWEventItem::destroy(), FWEventItem::toggleSelect(), and FWEventItem::unselect().
{ bool changed = (0 != m_newSelection.erase(iId)); m_wasChanged |=changed; if(changed) { assert(m_itemConnectionCount.size() > iId.item()->id()); //was this the last model selected for this item? if(0 ==--(m_itemConnectionCount[iId.item()->id()].first)) { m_itemConnectionCount[iId.item()->id()].second.disconnect(); } } }
void FWSelectionManager::unselectItem | ( | FWEventItem * | iItem | ) | [private] |
Definition at line 191 of file FWSelectionManager.cc.
References itemSelectionChanged_, and m_itemSelection.
Referenced by FWEventItem::toggleSelectItem(), and FWEventItem::unselectItem().
{ m_itemSelection.erase(iItem); itemSelectionChanged_(*this); }
friend class FWEventItem [friend] |
Definition at line 38 of file FWSelectionManager.h.
sigc::signal<void, const FWSelectionManager&> FWSelectionManager::itemSelectionChanged_ |
Definition at line 55 of file FWSelectionManager.h.
Referenced by CmsShowEDI::CmsShowEDI(), selectItem(), and unselectItem().
Definition at line 71 of file FWSelectionManager.h.
Referenced by clearModelSelectionLeaveItem(), clearSelection(), and FWSelectionManager().
std::vector<std::pair<int,sigc::connection> > FWSelectionManager::m_itemConnectionCount [private] |
Definition at line 75 of file FWSelectionManager.h.
Referenced by itemChanged(), select(), and unselect().
std::set<FWEventItem*> FWSelectionManager::m_itemSelection [private] |
Definition at line 76 of file FWSelectionManager.h.
Referenced by clearItemSelection(), selectedItems(), selectItem(), and unselectItem().
std::set<FWModelId> FWSelectionManager::m_newSelection [private] |
Definition at line 73 of file FWSelectionManager.h.
Referenced by finishedAllSelections(), itemChanged(), select(), and unselect().
std::set<FWModelId> FWSelectionManager::m_selection [private] |
Definition at line 72 of file FWSelectionManager.h.
Referenced by clearModelSelectionLeaveItem(), clearSelection(), finishedAllSelections(), itemChanged(), and selected().
bool FWSelectionManager::m_wasChanged [private] |
Definition at line 74 of file FWSelectionManager.h.
Referenced by finishedAllSelections(), itemChanged(), select(), and unselect().
sigc::signal<void, const FWSelectionManager&> FWSelectionManager::selectionChanged_ |
Definition at line 54 of file FWSelectionManager.h.
Referenced by CmsShowModelPopup::CmsShowModelPopup(), finishedAllSelections(), and FWSummaryManager::FWSummaryManager().