示例#1
0
void CDeviceUI::Remove(CDeviceView *pView)
{
	if (pView == NULL)
		return;

	int i = GetViewIndex(pView);
	if (i < 0 || i >= GetNumViews())
	{
		assert(0);
		return;
	}

	if (pView == m_pCurView)
		m_pCurView = NULL;

	if (m_arpView[i] != NULL)
	{
		m_arpView[i]->RemoveAll();
		delete m_arpView[i];
	}
	m_arpView[i] = NULL;

	m_arpView.RemoveAt(i);

	if (m_arpView.GetSize() < 1)
		RequireAtLeastOneView();
	else if (m_pCurView == NULL)
	{
		SetView(0);
		NumViewsChanged();
	}
}
void DisplayElementsPanel::SelectView(const std::string& name)
{
    if (mSeqData->NumFrames() == 0) return;
    ListCtrlViews->SetChecked(mSequenceElements->GetCurrentView(),false);
    int selected_view = GetViewIndex(name);
    if( selected_view > 0 )
    {
        std::string modelsString = mSequenceElements->GetViewModels(name);
        mSequenceElements->AddMissingModelsToSequence(modelsString);
        mSequenceElements->PopulateView(modelsString, selected_view);
    }
    mSequenceElements->SetCurrentView(selected_view);
    mSequenceElements->SetTimingVisibility(name);
    PopulateModels();
    ListCtrlViews->SetChecked(mSequenceElements->GetCurrentView(),true);
    MainViewsChoice->SetSelection(MainViewsChoice->FindString(name));
    wxCommandEvent eventForceRefresh(EVT_FORCE_SEQUENCER_REFRESH);
    wxPostEvent(GetParent(), eventForceRefresh);
}
/*
========================
idMenuWidget_DevList::NavigateForward
========================
*/
void idMenuWidget_DevList::NavigateForward( const int optionIndex ) {
	if ( devMenuList == NULL ) {
		return;
	}

	const int focusedIndex = GetViewOffset() + optionIndex;

	const idDeclDevMenuList::idDevMenuOption & devOption = devMenuList->devMenuList[ focusedIndex ];
	if ( ( devOption.devMenuDisplayName.Length() == 0 ) || ( devOption.devMenuDisplayName.Cmp( "..." ) == 0 ) ) {
		return;
	}

	if ( devOption.devMenuSubList != NULL ) {
		indexInfo_t & indexes = devMapListInfos.Alloc();
		indexes.name = devOption.devMenuSubList->GetName();
		indexes.focusIndex = GetFocusIndex();
		indexes.viewIndex = GetViewIndex();
		indexes.viewOffset = GetViewOffset();

		RecalculateDevMenu();

		SetViewIndex( 0 );
		SetViewOffset( 0 );

		Update();

		// NOTE: This must be done after the Update() because it MAY change the sprites that
		// children refer to
		GetChildByIndex( 0 ).SetState( WIDGET_STATE_SELECTED );
		ForceFocusIndex( 0 );
		SetFocusIndex( 0 );

		gameLocal->GetMainMenu()->ClearWidgetActionRepeater();
	} else {
		cmdSystem->AppendCommandText( va( "loadDevMenuOption %s %d\n", devMapListInfos[ devMapListInfos.Num() - 1 ].name, focusedIndex ) );
	}
}
示例#4
0
int CDeviceUI::GetCurViewIndex()
{
	return GetViewIndex(m_pCurView);
}