void ScreenSelectStyle::MenuStart( PlayerNumber pn ) { /* Stop all tweens where they are, since we might have selected before * we finished tweening in. */ for( unsigned i=0; i<m_SubActors.size(); i++ ) m_SubActors[i]->StopTweening(); SCREENMAN->PlayStartSound(); SCREENMAN->SendMessageToTopScreen( SM_AllDoneChoosing ); const GameCommand& mc = m_aGameCommands[GetSelectionIndex(pn)]; SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(),mc.m_sName.c_str())) ); // // TweenOffScreen // for( unsigned i=0; i<m_aGameCommands.size(); i++ ) { OFF_COMMAND( m_sprIcon[i] ); OFF_COMMAND( m_textIcon[i] ); } OFF_COMMAND( m_sprExplanation ); OFF_COMMAND( m_sprWarning ); OFF_COMMAND( m_sprPicture[m_iSelection] ); OFF_COMMAND( m_sprInfo[m_iSelection] ); OFF_COMMAND( m_sprPremium ); }
void STileLayerList::OnSelectionChanged(FMirrorEntry ItemChangingState, ESelectInfo::Type SelectInfo) { if (UPaperTileMap* TileMap = TileMapPtr.Get()) { TileMap->SelectedLayerIndex = GetSelectionIndex(); PostEditNotfications(); } }
void CElementListDlog::SetSelectionIndex( int iItem ) { // deselect currently selected item m_oListCtl.SetItemState(GetSelectionIndex(),0,LVIS_SELECTED); // VC6+ need to set the selection mark #if (_MSC_VER >= 1200) m_oListCtl.SetSelectionMark(iItem); #endif // don't set item state for -1 (no item) if (iItem >= 0) m_oListCtl.SetItemState(iItem,0xffff,LVIS_SELECTED); }
void CElementListDlog::ListSelChange ( void ) { int iSel = GetSelectionIndex(); if (iSel != -1) m_pDoc->m_oWorld.SetSelItem(m_oListCtl.GetItemData(iSel)); else m_pDoc->m_oWorld.SetSelItem(-1); if (m_pInspector) m_pInspector->Update(); if (m_pView) m_pView->Invalidate(); }
BOOL CALLBACK FindBrushDlgProc ( HWND hwndDlg, // handle to dialog box UINT uMsg, // message WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { char entstr[256]; char brushstr[256]; HWND h; int ent, brush; switch (uMsg) { case WM_INITDIALOG: // set entity and brush number GetSelectionIndex (&ent, &brush); sprintf (entstr, "%i", ent); sprintf (brushstr, "%i", brush); SetWindowText(GetDlgItem(hwndDlg, IDC_FIND_ENTITY), entstr); SetWindowText(GetDlgItem(hwndDlg, IDC_FIND_BRUSH), brushstr); h = GetDlgItem(hwndDlg, IDC_FIND_ENTITY); SetFocus (h); return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: GetWindowText(GetDlgItem(hwndDlg, IDC_FIND_ENTITY), entstr, 255); GetWindowText(GetDlgItem(hwndDlg, IDC_FIND_BRUSH), brushstr, 255); SelectBrush (atoi(entstr), atoi(brushstr)); EndDialog(hwndDlg, 1); return TRUE; case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; } } return FALSE; }
void DoFind(const cmd::ArgumentList& args) { ui::IDialogPtr dialog = GlobalDialogManager().createDialog(_("Find Brush")); ui::IDialog::Handle entityEntry = dialog->addEntryBox(_("Entity Number:")); ui::IDialog::Handle brushEntry = dialog->addEntryBox(_("Brush Number:")); std::size_t ent(0), br(0); GetSelectionIndex(ent, br); dialog->setElementValue(entityEntry, sizetToStr(ent)); dialog->setElementValue(brushEntry, sizetToStr(br)); if (dialog->run() == ui::IDialog::RESULT_OK) { std::string entityValue = dialog->getElementValue(entityEntry); std::string brushValue = dialog->getElementValue(brushEntry); SelectBrush(strToInt(entityValue), strToInt(brushValue)); } }
void STileLayerList::MergeLayerDown() { if (UPaperTileMap* TileMap = TileMapPtr.Get()) { const int32 SourceIndex = GetSelectionIndex(); const int32 TargetIndex = SourceIndex + 1; if ((SourceIndex != INDEX_NONE) && (TargetIndex != INDEX_NONE)) { const FScopedTransaction Transaction(LOCTEXT("TileMapMergeLayerDown", "Merge Layer Down")); TileMap->SetFlags(RF_Transactional); TileMap->Modify(); UPaperTileLayer* SourceLayer = TileMap->TileLayers[SourceIndex]; UPaperTileLayer* TargetLayer = TileMap->TileLayers[TargetIndex]; TargetLayer->SetFlags(RF_Transactional); TargetLayer->Modify(); // Copy the non-empty tiles from the source to the target layer for (int32 Y = 0; Y < SourceLayer->LayerWidth; ++Y) { for (int32 X = 0; X < SourceLayer->LayerWidth; ++X) { FPaperTileInfo TileInfo = SourceLayer->GetCell(X, Y); if (TileInfo.IsValid()) { TargetLayer->SetCell(X, Y, TileInfo); } } } // Remove the source layer TileMap->TileLayers.RemoveAt(SourceIndex); // Update viewers PostEditNotfications(); } } }
void STileLayerList::DuplicateLayer() { if (UPaperTileMap* TileMap = TileMapPtr.Get()) { const int32 DuplicateIndex = GetSelectionIndex(); if (DuplicateIndex != INDEX_NONE) { const FScopedTransaction Transaction(LOCTEXT("TileMapDuplicateLayer", "Duplicate Layer")); TileMap->SetFlags(RF_Transactional); TileMap->Modify(); UPaperTileLayer* NewLayer = DuplicateObject<UPaperTileLayer>(TileMap->TileLayers[DuplicateIndex], TileMap); TileMap->TileLayers.Insert(NewLayer, DuplicateIndex); NewLayer->LayerName = GenerateDuplicatedLayerName(NewLayer->LayerName.ToString(), TileMap); PostEditNotfications(); // Select the duplicated layer SetSelectedLayer(NewLayer); } } }
BOOL CDib::DrawTransparent (CDC* pDC, int x, int y, COLORREF crColor) { ASSERT( IsIndexed() ); CRect rect(y,x,y+GetWidth(), x-GetHeight()); UtilWin::CIntArray selectionArray; GetSelectionIndex(crColor, selectionArray); HDC hDestDC = pDC->GetSafeHdc(); if( selectionArray.GetSize()==1 ) { return CImage::TransparentBlt(pDC->GetSafeHdc(), rect, crColor); } else if( selectionArray.GetSize()>=1 ) { CDib dib(GetWidth(), GetHeight(), 32); /*for(int i=0; i<GetWidth(); i++) { for(int j=0; j<GetHeight(); j++) { if( SetPixel(i,j, ); } } CImage::AlphaBlend(dib.GetDC(), rect, crColor); */ //return } return CDib::Draw(pDC, x, y); }
void STileLayerList::DeleteLayer() { if (UPaperTileMap* TileMap = TileMapPtr.Get()) { const int32 DeleteIndex = GetSelectionIndex(); if (DeleteIndex != INDEX_NONE) { const FScopedTransaction Transaction(LOCTEXT("TileMapDeleteLayer", "Delete Layer")); TileMap->SetFlags(RF_Transactional); TileMap->Modify(); TileMap->TileLayers.RemoveAt(DeleteIndex); PostEditNotfications(); // Select the item below the one that just got deleted const int32 NewSelectionIndex = FMath::Min<int32>(DeleteIndex, TileMap->TileLayers.Num() - 1); if (TileMap->TileLayers.IsValidIndex(NewSelectionIndex)) { SetSelectedLayer(TileMap->TileLayers[NewSelectionIndex]); } } } }
} Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler } void ScreenSelect::FinalizeChoices() { /* At this point, we're tweening out; we can't change the selection. * We don't want to allow players to join if the style will be set, * since that can change the available selection and is likely to * invalidate the choice we've already made. Hack: apply the style. * (Applying the style may have other side-effects, so it'll be re-applied * in SM_GoToNextScreen.) */ FOREACH_PlayerNumber( p ) if( GAMESTATE->IsHumanPlayer(p) ) { const int sel = GetSelectionIndex( p ); if( m_aModeChoices[sel].m_pStyle ) GAMESTATE->m_pCurStyle = m_aModeChoices[sel].m_pStyle; } SCREENMAN->RefreshCreditsMessages(); } void ScreenSelect::HandleScreenMessage( const ScreenMessage SM ) { switch( SM ) { /* Screen is starting to tween out. */ case SM_BeginFadingOut: FinalizeChoices(); break;
bool STileLayerList::CanExecuteActionNeedingSelectedLayer() const { return GetSelectionIndex() != INDEX_NONE; }
bool STileLayerList::CanExecuteActionNeedingLayerBelow() const { const int32 SelectedLayer = GetSelectionIndex(); return (SelectedLayer != INDEX_NONE) && (SelectedLayer + 1 < GetNumLayers()); }
bool STileLayerList::CanExecuteActionNeedingLayerAbove() const { return GetSelectionIndex() > 0; }
void STileLayerList::MoveLayerDown() { const int32 SelectedIndex = GetSelectionIndex(); const int32 NewIndex = SelectedIndex + 1; ChangeLayerOrdering(SelectedIndex, NewIndex); }
void CElementListDlog::OnSelchangeElementFilter() { if (!m_pDoc) return; int iCurSel = m_oListFilter.GetCurSel(); int iListSel = GetSelectionIndex(); m_oListCtl.DeleteAllItems(); CString ListType; CString ObjectType; int iListType; int iObjectType; if (iCurSel != 0) iListType = m_oListFilter.GetItemData(iCurSel); m_oNewITemButton.EnableWindow(iCurSel != 0); if (m_pDoc && (m_pDoc->m_oWorld.Size()>0) ) { int iCount = 0; bool bAd; trObjectList objs; m_pDoc->m_oWorld.GetObjectList(objs); for (trObjectList::iterator itr = objs.begin(); itr != objs.end(); itr++) { if (*itr) { iObjectType = (*itr)->GetTypeID(); bAd = false; if (iCurSel == 0) bAd = true; else if (iObjectType == iListType) bAd = true; if (bAd) { m_oListCtl.InsertItem(iCount,(*itr)->GetListName(),iObjectType); m_oListCtl.SetItemData(iCount,(*itr)->GetID()); iCount++; } } } } if (iListSel >=m_oListCtl.GetItemCount()) iListSel = m_oListCtl.GetItemCount()-1; SetSelectionIndex(iListSel); if (iListSel !=-1) m_pDoc->m_oWorld.SetSelItem(m_oListCtl.GetItemData(iListSel)); else m_pDoc->m_oWorld.SetSelItem(-1); if (m_pInspector) m_pInspector->Update(); }
void STileLayerList::AddNewLayerBelow() { AddLayer(/*bCollisionLayer=*/ false, GetSelectionIndex() + 1); }
void STileLayerList::AddNewLayerAbove() { AddLayer(/*bCollisionLayer=*/ false, GetSelectionIndex()); }