Example #1
0
void
ModList::deselectCB(void *ptrToThis, SoPath *path)
{
    ModList		*me = (ModList *)ptrToThis;
    Modulate		*obj;
    int			oldCount;
    int			i;
    int			id;

    id = findToken(path);

    if (id < 0) {

#ifdef PCP_DEBUG
	if (pmDebug & DBG_TRACE_APPL1)
	    cerr << "ModList::deselectCB: Nothing deselected" << endl;
#endif

	return;
	/*NOTREACHED*/
    }

    obj = me->_list[id];

#ifdef PCP_DEBUG
    if (pmDebug & DBG_TRACE_APPL1)
	cerr << "ModList::deselectCB: Deselected [" << id << "] = "
	     << *obj << endl;
#endif

    oldCount = me->_selList[id];
    me->_selList[id] = obj->remove(path);
    me->_numSel -= oldCount - me->_selList[id];
    if (me->_numSel == 1) {
	for (i = 0; i < me->_selList.size(); i++)
	    if (me->_selList[i] == 1)
		me->_oneSel = i;
    }

    if (me->_numSel == 0)
	me->_current = me->_list.size();

    if (me->_numSel < 2)
	(*(me->_selCB))(me, true);

    if (me->_deselInvCB != NULL)
	(*(me->_deselInvCB))(me, path);

#ifdef PCP_DEBUG
    if (pmDebug & DBG_TRACE_APPL1) {
	cerr << "ModList::deselectCB: selection state:" << endl;
	me->dumpSelections(cerr);
    }
#endif
}
Example #2
0
void
ModList::selCB(void *ptrToThis, SoPath *path)
{
    ModList		*me = (ModList *)ptrToThis;
    Modulate		*obj;
    int			oldCount;
    int			id;

    if (!me->_allFlag)
	id = ModList::findToken(path);
    else
	id = me->_allId;
    
    if (id < 0) {

#ifdef PCP_DEBUG
	if (pmDebug & DBG_TRACE_APPL1)
	    cerr << "ModList::selCB: Nothing selected" << endl;
#endif

	return;
	/*NOTREACHED*/
    }
    else if (!me->_allFlag) {

	obj = me->_list[id];
	oldCount = me->_selList[id];

#ifdef PCP_DEBUG
	if (pmDebug & DBG_TRACE_APPL1)
	    cerr << "ModList::selCB: Before Selected [" << id << "] = "
		 << *obj << endl 
		 << "oldCount = " << oldCount << ", _numSel = "
		 << me->_numSel << ", _allFlag = false" << endl; 
#endif

	me->_selList[id] = obj->select(path);

	me->_numSel += me->_selList[id] - oldCount;
	if (me->_numSel == 1)
	    me->_oneSel = id;
    }

    if (!me->_allFlag)
	(*(me->_selCB))(me, true);

    if (me->_selInvCB != NULL)
	(*(me->_selInvCB))(me, path);

#ifdef PCP_DEBUG
    if (pmDebug & DBG_TRACE_APPL1) {
	cerr << "ModList::selCB: After Selected [" << id << "] " << endl
	     << "oldCount = " << oldCount << ", _numSel = "
	     << me->_numSel << ", _allFlag = " 
	     << (me->_allFlag == true ? "true" : "false") << ", _allId = "
	     << me->_allId << endl;
	cerr << "ModList::selCB: selection state:" << endl;
	me->dumpSelections(cerr);
    }
#endif
}