void CSelectedUnitsHandler::SelectCycle(const std::string& command)
{
	static std::set<int> unitIDs;
	static int lastID = -1;

	if (command == "restore") {
		ClearSelected();
		for (const int& unitID: unitIDs) {
			CUnit* unit = unitHandler->units[unitID];
			if (unit != NULL) {
				AddUnit(unit);
			}
		}
		return;
	}

	if (selectedUnits.size() >= 2) {
		// assign the cycle units
		unitIDs.clear();
		for (const CUnit* u: selectedUnits) {
			unitIDs.insert(u->id);
		}
		ClearSelected();
		lastID = *unitIDs.begin();
		AddUnit(unitHandler->units[lastID]);
		return;
	}

	// clean the list
	std::set<int> tmpSet;
	for (const int& unitID: unitIDs) {
		if (unitHandler->units[unitID] != NULL) {
			tmpSet.insert(unitID);
		}
	}
	unitIDs = tmpSet;
	if ((lastID >= 0) && (unitHandler->units[lastID] == NULL)) {
		lastID = -1;
	}

	// selectedUnits size is 0 or 1
	ClearSelected();
	if (!unitIDs.empty()) {
		std::set<int>::const_iterator fit = unitIDs.find(lastID);
		if (fit == unitIDs.end()) {
			lastID = *unitIDs.begin();
		} else {
			++fit;
			if (fit != unitIDs.end()) {
				lastID = *fit;
			} else {
				lastID = *unitIDs.begin();
			}
		}
		AddUnit(unitHandler->units[lastID]);
	}
}
Пример #2
0
void CreateTrack1(COMMAND_T* = NULL)
{
	ClearSelected();
	InsertTrackAtIndex(0, false);
	TrackList_AdjustWindows(false);
	GetSetMediaTrackInfo(CSurf_TrackFromID(1, false), "I_SELECTED", &g_i1);
	SetLTT();
}
Пример #3
0
void CPhylogenView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
    // TODO: Add your message handler code here and/or call default
    int Selection;
    int SelFlag;

    SelFlag = ClearSelected(&Selection);

    CScrollView::OnHScroll(nSBCode, nPos, pScrollBar);

    m_ScrollPos = GetScrollPosition();

    if ( SelFlag ) {
        SetSelected(Selection, 0);
    }
}
void CSelectedUnitsHandler::SelectGroup(int num)
{
	ClearSelected();
	selectedGroup=num;
	CGroup* group=grouphandlers[gu->myTeam]->groups[num];

	for (CUnit* u: group->units) {
		if (!u->noSelect) {
			u->isSelected = true;
			selectedUnits.insert(u);
			AddDeathDependence(u, DEPENDENCE_SELECTED);
		}
	}

	selectionChanged = true;
	possibleCommandsChanged = true;
}
void CSelectedUnits::SelectGroup(int num)
{
	ClearSelected();
	selectedGroup=num;
	CGroup* group=grouphandler->groups[num];

	set<CUnit*>::iterator ui;
	ENTER_MIXED;
	for(ui=group->units.begin();ui!=group->units.end();++ui){
		(*ui)->commandAI->selected=true;
		selectedUnits.insert(*ui);
		AddDeathDependence(*ui);
	}
	ENTER_UNSYNCED;

	possibleCommandsChanged=true;
	selectionChanged=true;
}
Пример #6
0
void InsertTrkAbove(COMMAND_T* = NULL)
{
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			InsertTrackAtIndex(i-1, false);
			ClearSelected();
			tr = CSurf_TrackFromID(i, false);
			TrackList_AdjustWindows(false);
			GetSetMediaTrackInfo(tr, "I_SELECTED", &g_i1);
			UpdateTimeline();
			Undo_OnStateChangeEx(__LOCALIZE("Insert track above selected track","sws_undo"), UNDO_STATE_ALL, -1);
			return;
		}
	}
}
Пример #7
0
//
// ICListBox::ICListBox
//
ICListBox::ICListBox(IControl *parent)
    : IControl(parent),
      listBoxStyle(0),
      selectedVar(NULL),
      indexVar(NULL),
      slider(NULL),
      itemConfig(NULL),
      sliderCfg(NULL),
      desiredTop(-1),
      reposition(FALSE),
      cellPad(2),
      updateVar(FALSE)
{
    // Default color
    SetColorGroup(IFace::data.cgClient);

    // Default styles
    controlStyle |= (STYLE_DROPSHADOW | STYLE_TABSTOP);

    // Default list bos styles
    listBoxStyle |= STYLE_VSLIDER;

    // Hook mouse click messages
    inputHook = TRUE;

    // Create container control
    container = new ListContainer(this);

    // Default sounds
    soundClick    = IFace::Sound::MENU_POPUP;
    soundDblClick = IFace::Sound::MENU_COMMAND;

    // Create local variables
    topVar = new IFaceVar(this, VarSys::CreateInteger(DynVarName("top"), 0, VarSys::DEFAULT, &top));
    VarSys::CreateInteger(DynVarName("count"), 0, VarSys::DEFAULT, &count);
    VarSys::CreateInteger(DynVarName("vis"), 0, VarSys::DEFAULT, &vis);

    // Update the range
    UpdateRange(TRUE);

    ClearSelected(FALSE);
}
Пример #8
0
void CSelectedUnits::SelectGroup(int num)
{
	GML_RECMUTEX_LOCK(grpsel); // SelectGroup - not needed? only reading group

	ClearSelected();
	selectedGroup=num;
	CGroup* group=grouphandlers[gu->myTeam]->groups[num];

	CUnitSet::iterator ui;
	for (ui = group->units.begin(); ui != group->units.end(); ++ui) {
		if (!(*ui)->noSelect) {
			(*ui)->commandAI->selected = true;
			selectedUnits.insert(*ui);
			AddDeathDependence(*ui);
		}
	}

	selectionChanged = true;
	possibleCommandsChanged = true;
}
void SAnimCompositePanel::Update()
{
	ClearSelected();
	if ( Composite != NULL )
	{
		SAnimCompositeEditor* Editor = CompositeEditor.Pin().Get();

		TSharedPtr<FTrackColorTracker> ColourTracker = MakeShareable(new FTrackColorTracker);
		ColourTracker->AddColor(FLinearColor(0.9f, 0.9f, 0.9f, 0.9f));
		ColourTracker->AddColor(FLinearColor(0.5f, 0.5f, 0.5f));

		FLinearColor NodeColor = FLinearColor(0.f, 0.5f, 0.0f, 0.5f);
		
		TSharedPtr<SVerticalBox> CompositeSlots;
		PanelArea->SetContent(
			SAssignNew( CompositeSlots, SVerticalBox )
			);

		TSharedRef<S2ColumnWidget> SectionTrack = Create2ColumnWidget(CompositeSlots.ToSharedRef());

		SectionTrack->LeftColumn->AddSlot()
			.AutoHeight()
			.VAlign(VAlign_Center)
			[
				SNew(SAnimSegmentsPanel)
				.AnimTrack(&Composite->AnimationTrack)
				.NodeSelectionSet(&SelectionSet)
				.ViewInputMin(ViewInputMin)
				.ViewInputMax(ViewInputMax)
				.ColorTracker(ColourTracker)
				.NodeColor(NodeColor)
				.ScrubPosition( Editor, &SAnimCompositeEditor::GetScrubValue )
				.TrackMaxValue(Composite->SequenceLength)
				.TrackNumDiscreteValues(Composite->GetNumberOfFrames())

				.OnAnimSegmentNodeClicked( this, &SAnimCompositePanel::ShowSegmentInDetailsView )
				.OnPreAnimUpdate( Editor, &SAnimCompositeEditor::PreAnimUpdate )
				.OnPostAnimUpdate( Editor, &SAnimCompositeEditor::PostAnimUpdate )
			];
	}
}
void GUIComponentManager::UpdateComponent(int id)
{
	GUIComponent *currentCreateGUIComponent = guiComponentFactory.CreateGUIComponent(guiPresentation->GetComponent(id));
	StoreGUIComponent(currentCreateGUIComponent, id);
	//qDebug() << guiComponents.at(index)->GetPosition();

	if(!CheckPoint(guiComponents.at(id)->GetPosition()))
	{
		QPointF point = guiPresentation->GetMousePoint();
		guiComponents.at(id)->setPos(point);
	}
	else
	{
		guiComponents.at(id)->setPos(guiComponents.at(id)->GetPosition());
	}

	guiComponents.at(id)->UpdatePoint();
	//qDebug() << guiComponents.at(index)->GetPosition();
	DrawNode(guiComponents.at(id));
	ClearSelected();
}
Пример #11
0
void KSceneEditorDialogAutoGrass::SetDetialTexData(BYTE byIndex,BYTE* byGrassTexIndex,BYTE* byPatternIndex)
{
	ClearSelected();
	m_byDetialTexIndex = byIndex;
	m_pbyGrassTexIndex = byGrassTexIndex;
	m_pbyPatternIndex = byPatternIndex;
	
	for (int i = 0; i < 6; i++)
	{
		if(m_pbyPatternIndex[i] != 255)
		{
			m_ListBoxPattern.SetSel(m_pbyPatternIndex[i],TRUE);
		}
	}

	m_Selector.SetSelected(m_pbyGrassTexIndex,8);
	INT* pTextureIndex = NULL;
	INT nNumTextureIndex = 0;
	m_Selector.GetSelectSection(&pTextureIndex,nNumTextureIndex);
	m_lpSceneSceneEditor->SetTBModifierTextureIndexInfo(pTextureIndex,&nNumTextureIndex);
	OnLbnSelchangeListPattern();
	SAFE_DELETE_ARRAY(pTextureIndex);

}
Пример #12
0
void CPhylogenView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    // TODO: Add your message handler code here and/or call default

    CGenedocDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    POSITION Pos;
    CPhyloGenBase *pPGB;

    CClientDC dc(this);
    OnPrepareDC(&dc);

    int Selection;

    switch ( nChar ) {
    case VK_DOWN:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection += 1;
        if ( Selection >= pDoc->m_pPGBase->m_PhyloList.GetCount() ) Selection = 0;
        SetSelected(Selection, 1);
        break;
    case VK_UP:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection -= 1;
        if ( Selection < 0 ) Selection = pDoc->m_pPGBase->m_PhyloList.GetCount() - 1;
        SetSelected(Selection, 1);
        break;
    case VK_NEXT:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection += 5;
        if ( Selection >= pDoc->m_pPGBase->m_PhyloList.GetCount() ) Selection = 0;
        SetSelected(Selection, 1);
        break;
    case VK_PRIOR:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection -= 5;
        if ( Selection < 0 ) Selection = pDoc->m_pPGBase->m_PhyloList.GetCount() - 1;
        SetSelected(Selection, 1);
        break;
    case VK_HOME:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection = 0;
        SetSelected(Selection, 1);
        break;
    case VK_END:
        if ( !ClearSelected(&Selection) ) Selection = m_LastKeySelect;
        Selection = pDoc->m_pPGBase->m_PhyloList.GetCount() - 1;
        SetSelected(Selection, 1);
        break;
    case VK_RETURN:
        Selection = 0;
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            CPhyloGenBase * pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_Selected == 1 ) break;
            Selection++;
        }
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_Selected ) {
                pPGB->m_FirstSelection = 1;
                break;
            }
        }
        CreateFunction();
        SetSelected(Selection, 0 );
        break;
    case VK_SHIFT:
    case VK_SPACE:
        SelectFunction();
        break;
    case VK_DELETE:
        Selection = 0;
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            CPhyloGenBase * pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_Selected == 1 ) break;
            Selection++;
        }
        DeleteFunction();
        SetSelected(Selection, 0 );
        break;
    case VK_ESCAPE:
        Pos = pDoc->m_pPGBase->m_PhyloList.GetHeadPosition();
        while ( Pos != NULL ) {
            pPGB = (CPhyloGenBase *)pDoc->m_pPGBase->m_PhyloList.GetNext(Pos);
            if ( pPGB->m_FirstSelection == 1 ) {
                pPGB->m_FirstSelection = 0;
                CRect tRect = pPGB->m_ClientRect;
                dc.LPtoDP( &tRect );
                InvalidateRect( tRect );
            }
        }
        break;
    }

    CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}