/**
 *  Wechselt zwischen selektiert/nicht selektiert
 *
 *  @author jh
 */
void ctrlMultiSelectGroup::ToggleSelection(unsigned short selection, bool notify)
{
    if (IsSelected(selection))
        RemoveSelection(selection, notify);
    else
        AddSelection(selection, notify);
}
Ejemplo n.º 2
0
NODESIZE CNodeFloat::Draw( const PVIEWINFO View, int x, int y )
{
    int tx;
    NODESIZE DrawSize;
    float* Data;

    if (m_bHidden)
        return DrawHidden( View, x, y );

    Data = (float*)(View->Data + m_Offset);
    AddSelection( View, 0, y, g_FontHeight );
    AddDelete( View, x, y );
    AddTypeDrop( View, x, y );
    //AddAdd(View,x,y);

    tx = x + TXOFFSET;
    tx = AddIcon( View, tx, y, ICON_FLOAT, HS_NONE, HS_NONE );
    tx = AddAddressOffset( View, tx, y );
    tx = AddText( View, tx, y, g_clrType, HS_NONE, _T( "float " ) );
    tx = AddText( View, tx, y, g_clrName, HS_NAME, _T( "%s" ), m_strName );
    tx = AddText( View, tx, y, g_clrName, HS_NONE, _T( " = " ) );
    //tx = AddText(View,tx,y,g_clrValue,0,"%.4f",pMemory[0]) + FontWidth;

    //if ( *pMemory > -99999.0f && *pMemory < 99999.0f )
    //	*pMemory = 0;

    tx = AddText( View, tx, y, g_clrValue, HS_EDIT, _T( "%4.3f" ), *Data ) + g_FontWidth;
    tx = AddComment( View, tx, y );

    DrawSize.x = tx;
    DrawSize.y = y + g_FontHeight;
    return DrawSize;
}
Ejemplo n.º 3
0
NODESIZE CNodeWord::Draw( const PVIEWINFO View, int x, int y )
{
    int tx;
    NODESIZE DrawSize;
    WORD *Data;

    if (m_bHidden)
        return DrawHidden( View, x, y );

    Data = (WORD*)(View->Data + m_Offset);

    AddSelection( View, 0, y, g_FontHeight );
    AddDelete( View, x, y );
    AddTypeDrop( View, x, y );
    //AddAdd(View,x,y);

    tx = x + TXOFFSET;
    tx = AddIcon( View, tx, y, ICON_UNSIGNED, HS_NONE, HS_NONE );
    tx = AddAddressOffset( View, tx, y );
    tx = AddText( View, tx, y, g_clrType, HS_NONE, _T( "WORD  " ) );
    tx = AddText( View, tx, y, g_clrName, HS_NAME, _T( "%s" ), m_strName );
    tx = AddText( View, tx, y, g_clrName, HS_NONE, _T( " = " ) );
    tx = AddText( View, tx, y, g_clrValue, HS_EDIT, g_bUnsignedHex ? _T( "0x%X" ) : _T( "%u" ), *Data ) + g_FontWidth;
    tx = AddComment( View, tx, y );

    DrawSize.x = tx;
    DrawSize.y = y + g_FontHeight;
    return DrawSize;
}
Ejemplo n.º 4
0
void SceneSelectionSystem::SetSelection(DAVA::Entity *entity)
{
	if(!IsLocked())
	{
		Clear();

		// add new selection
		if(NULL != entity)
		{
			AddSelection(entity);
		}

		UpdateHoodPos();
	}
}
void ListControlExtendedMultipleSelectStrategy::SelectItemsByMouseEventWithControlKey(std::size_t current_index, bool is_mouse_moving) {

    if (! is_mouse_moving) {

        focused_index_ = current_index;

        orginally_recorded_index_ = 0;
        orginally_recorded_count_ = 0;
        orginally_selected_indexes_.clear();
    }

    std::size_t select_index = 0;
    std::size_t select_count = 0;
    MakeSelectionRange(current_index, focused_index_, select_index, select_count);

    //Recover orginally selection states not in current selection range.
    RecoverSelectionStatesNotInRange(select_index, select_count);

    //Record orginally selection states in current selection range.
    RecordSelectionStatesInRange(select_index, select_count);

    if (! is_mouse_moving) {
        is_focused_index_orginally_selected_ = 
            orginally_selected_indexes_.find(current_index) != orginally_selected_indexes_.end();
    }

    auto list_control = GetListControl();
    if (list_control != nullptr) {
    
        //Add or remove newly selection.
        if (is_focused_index_orginally_selected_) {
            list_control->RemoveSelection(select_index, select_count);
        }
        else {
            list_control->AddSelection(select_index, select_count);
        }

        list_control->ScrollToItemAtIndex(current_index);
    }
}
void ListControlExtendedMultipleSelectStrategy::RecoverSelectionStatesNotInRange(std::size_t index, std::size_t count) {

    auto list_control = GetListControl();
    if (list_control == nullptr) {
        return;
    }

    for (std::size_t current_index = orginally_recorded_index_;
         current_index != orginally_recorded_index_ + orginally_recorded_count_;
         ++current_index) {

        if ((current_index < index) || (index + count <= current_index)) {

            if (orginally_selected_indexes_.find(current_index) == orginally_selected_indexes_.end()) {
                list_control->RemoveSelection(current_index, 1);
            }
            else {
                list_control->AddSelection(current_index, 1);
            }
        }
    }
}
Ejemplo n.º 7
0
NODESIZE CNodeHex64::Draw( const PVIEWINFO View, int x, int y )
{
    int tx;
    NODESIZE DrawSize;
    const UCHAR* Data;

    if (m_bHidden)
        return DrawHidden( View, x, y );

    Data = (const UCHAR*)(View->Data + m_Offset);
    AddSelection( View, 0, y, g_FontHeight );
    AddDelete( View, x, y );
    AddTypeDrop( View, x, y );
    //AddAdd(View,x,y);

    tx = x + TXOFFSET + 16;
    tx = AddAddressOffset( View, tx, y );

    if (g_bText)
    {
        CStringA AsciiMemory = GetStringFromMemoryA( (const char*)Data, 8 ) + " ";
        tx = AddText( View, tx, y, g_clrChar, HS_NONE, "%s", AsciiMemory.GetBuffer( ) );
    }

    tx = AddText( View, tx, y, g_clrHex, 0, _T( "%0.2X" ), Data[0] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 1, _T( "%0.2X" ), Data[1] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 2, _T( "%0.2X" ), Data[2] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 3, _T( "%0.2X" ), Data[3] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 4, _T( "%0.2X" ), Data[4] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 5, _T( "%0.2X" ), Data[5] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 6, _T( "%0.2X" ), Data[6] ) + g_FontWidth;
    tx = AddText( View, tx, y, g_clrHex, 7, _T( "%0.2X" ), Data[7] ) + g_FontWidth;
    tx = AddComment( View, tx, y );

    DrawSize.x = tx;
    DrawSize.y = y + g_FontHeight;
    return DrawSize;
}
Ejemplo n.º 8
0
void SceneSelectionSystem::ProcessUIEvent(DAVA::UIEvent *event)
{
	if (IsLocked() || !selectionAllowed)
	{
		return;
	}

	if(DAVA::UIEvent::PHASE_BEGAN == event->phase)
	{
		// we can select only if mouse isn't over hood axis
		// or if hood is invisible now
		// or if current mode is NORMAL (no modification)
		if(!hoodSystem->IsVisible() ||
			ST_MODIF_OFF == hoodSystem->GetModifMode() ||
			ST_AXIS_NONE == hoodSystem->GetPassingAxis())
		{
			if(event->tid == DAVA::UIEvent::BUTTON_1)
			{
				const EntityGroup* collisionEntities = collisionSystem->ObjectsRayTestFromCamera();
				EntityGroup selectableItems = GetSelecetableFromCollision(collisionEntities);

				DAVA::Entity *firstEntity = selectableItems.GetEntity(0);
				DAVA::Entity *nextEntity = selectableItems.GetEntity(0);

                // sequent selection?
                if(SettingsManager::GetValue(Settings::Scene_SelectionSequent).AsBool())
                {
				    // search possible next item only if now there is no selection or is only single selection
				    if(curSelections.Size() <= 1)
				    {
					    // find first after currently selected items
					    for(size_t i = 0; i < selectableItems.Size(); i++)
					    {
						    DAVA::Entity *entity = selectableItems.GetEntity(i);
						    if(curSelections.HasEntity(entity))
						    {
							    if((i + 1) < selectableItems.Size())
							    {
								    nextEntity = selectableItems.GetEntity(i + 1);
								    break;
							    }
						    }
					    }
				    }
                }

				int curKeyModifiers = QApplication::keyboardModifiers();
				if(curKeyModifiers & Qt::ControlModifier)
				{
					AddSelection(firstEntity);
				}
				else if(curKeyModifiers & Qt::AltModifier)
				{
					RemSelection(firstEntity);
				}
				else
				{
					// if new selection is NULL or is one of already selected items
					// we should change current selection only on phase end
					if(nextEntity == NULL || NULL != curSelections.IntersectedEntity(&selectableItems))
					{
						applyOnPhaseEnd = true;
						lastSelection = nextEntity;
					}
					else
					{
						SetSelection(nextEntity);
					}
				}
			}
		}
	}
	else if(DAVA::UIEvent::PHASE_ENDED == event->phase)
	{
		if(event->tid == DAVA::UIEvent::BUTTON_1)
		{
			if(applyOnPhaseEnd)
			{
				applyOnPhaseEnd = false;
				SetSelection(lastSelection);
			}
		}
	}
}
Ejemplo n.º 9
0
NODESIZE CNodePtrArray::Draw( const PVIEWINFO View, int x, int y )
{
    int tx;
    NODESIZE DrawSize;
    NODESIZE ChildDrawSize;
    ULONG ClassSize;

    if (m_bHidden)
        return DrawHidden( View, x, y );

    DrawSize.x = 0;
    DrawSize.y = 0;

    AddSelection( View, 0, y, g_FontHeight );
    AddDelete( View, x, y );
    AddTypeDrop( View, x, y );

    x = AddOpenClose( View, x, y );
    x = AddIcon( View, x, y, ICON_ARRAY, -1, -1 );

    tx = x;
    tx = AddAddressOffset( View, tx, y );

    tx = AddText( View, tx, y, g_clrType, HS_NONE, _T( "ArrayOfPointers " ) );
    tx = AddText( View, tx, y, g_clrName, HS_NAME, _T( "%s" ), m_strName );
    tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( "[" ) );
    tx = AddText( View, tx, y, g_clrIndex, HS_EDIT, _T( "%u" ), m_ulPtrCount );
    tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( "]" ) );

    tx = AddIcon( View, tx, y, ICON_LEFT, HS_SELECT, HS_CLICK );
    tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( "(" ) );
    tx = AddText( View, tx, y, g_clrIndex, 1, _T( "%i" ), m_iCurrentIndex );
    tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( ")" ) );
    tx = AddIcon( View, tx, y, ICON_RIGHT, HS_DROP, HS_CLICK );

    tx = AddText( View, tx, y, g_clrValue, HS_NONE, _T( "<%s* Size=%u>" ), m_pNodePtr->GetClass( )->GetName( ), GetMemorySize( ) );
    tx = AddIcon( View, tx, y, ICON_CHANGE, HS_CLICK, HS_CHANGE_X );

    tx += g_FontWidth;
    tx = AddComment( View, tx, y );

    y += g_FontHeight;
    if (m_LevelsOpen[View->Level])
    {
        if (IsMemory( View->Address + m_Offset + (sizeof( ULONG_PTR ) * m_iCurrentIndex) ))
        {
            ClassSize = m_pNodePtr->GetClass( )->GetMemorySize( );
            m_pNodePtr->Memory( )->SetSize( ClassSize );

            VIEWINFO NewView;
            memcpy( &NewView, View, sizeof( NewView ) );
            NewView.Data = m_pNodePtr->Memory( )->Data( );
            NewView.Address = *(ULONG_PTR*)(View->Data + m_Offset + (sizeof( ULONG_PTR ) * m_iCurrentIndex));

            ReClassReadMemory( (LPVOID)NewView.Address, (LPVOID)NewView.Data, ClassSize );

            ChildDrawSize = m_pNodePtr->GetClass( )->Draw( &NewView, x, y );

            y = ChildDrawSize.y;
            if (ChildDrawSize.x > DrawSize.x)
                DrawSize.x = ChildDrawSize.x;
        }
    }

    DrawSize.y = y;
    return DrawSize;
}
Ejemplo n.º 10
0
void
ObjectViewContainer::Select(ObjectView *obj)
{
	DeSelectAll();
	AddSelection(obj);
}