//------------------------------------------------------------------------------ void SBlueprintLibraryPalette::GenerateContextMenuEntries(FMenuBuilder& MenuBuilder) const { if (!bUseLegacyLayout) { FBlueprintLibraryPaletteCommands const& PaletteCommands = FBlueprintLibraryPaletteCommands::Get(); MenuBuilder.BeginSection("Favorites"); { TSharedPtr<FEdGraphSchemaAction> SelectedAction = GetSelectedAction(); // if we have a specific action selected if (SelectedAction.IsValid()) { MenuBuilder.AddMenuEntry(PaletteCommands.AddSingleFavorite); MenuBuilder.AddMenuEntry(PaletteCommands.RemoveSingleFavorite); } // if we have a category selected { FString CategoryName = GraphActionMenu->GetSelectedCategoryName(); // make sure it is an actual category and isn't the root (assume there's only one category with that name) if (!CategoryName.IsEmpty() && (CategoryName != SBlueprintLibraryPaletteUtils::LibraryCategoryName)) { MenuBuilder.AddMenuEntry(PaletteCommands.AddSubFavorites); MenuBuilder.AddMenuEntry(PaletteCommands.RemoveSubFavorites); } } } MenuBuilder.EndSection(); MenuBuilder.BeginSection("ListActions"); SBlueprintSubPalette::GenerateContextMenuEntries(MenuBuilder); MenuBuilder.EndSection(); } }
void ExecuteCommandDialog::handleCurrentChanged (int id) { if (!dynamic_cast<WaitPage*> (currentPage ())) return; const auto& ids = pageIds (); const int pos = ids.indexOf (id); if (pos <= 0) return; const auto prevPage = page (ids.at (pos - 1)); if (dynamic_cast<CommandsListPage*> (prevPage)) { const AdHocCommand& cmd = dynamic_cast<CommandsListPage*> (prevPage)->GetSelectedCommand (); if (cmd.GetName ().isEmpty ()) deleteLater (); else ExecuteCommand (cmd); } else if (dynamic_cast<CommandResultPage*> (prevPage)) { const auto crp = dynamic_cast<CommandResultPage*> (prevPage); const auto& action = crp->GetSelectedAction (); if (action.isEmpty ()) return; auto result = crp->GetResult (); result.SetDataForm (crp->GetForm ()); ProceedExecuting (result, action); } }
void GotoFileList::UpdateList(const bool reloadAll) { const FileEntry* selEntry = GetSelectedAction(); const int topLine = GetFirstVisibleLine(); int selection = -1; const unsigned int startItem = reloadAll ? 0 : m_items.size(); // Insert new items if (m_searchText.empty()) { // Copy all actions to items m_items.resize(m_actions.size()); for (unsigned int i = startItem; i < m_actions.size(); ++i) { m_items[i].file_entry = m_actions[i]; m_items[i].hlChars.clear(); } } else { // Copy matching actions to items for (unsigned int i = m_actionCount; i < m_actions.size(); ++i) { if (m_tempEntry->path.empty() || m_actions[i]->path != m_tempEntry->path) AddFileIfMatching(m_searchText, m_actions[i]); } } // Sort the items if (startItem) { sort(m_items.begin() + startItem, m_items.end()); inplace_merge(m_items.begin(), m_items.begin() + startItem, m_items.end()); } else sort(m_items.begin(), m_items.end()); // Keep same selection if (selEntry) { for (unsigned int i = 0; i < m_items.size(); ++i) { if (m_items[i].file_entry == selEntry) { selection = i; break; } } } // Refresh and redraw listCtrl Freeze(); SetItemCount(m_items.size()); SetSelection(selection); if (selection == -1) ScrollToLine(topLine); else if (!IsVisible(selection)) ScrollToLine(selection); RefreshAll(); Thaw(); m_actionCount = m_actions.size(); }
//------------------------------------------------------------------------------ void SBlueprintFavoritesPalette::GenerateContextMenuEntries(FMenuBuilder& MenuBuilder) const { FBlueprintFavoritesPaletteCommands const& PaletteCommands = FBlueprintFavoritesPaletteCommands::Get(); MenuBuilder.BeginSection("FavoritedItem"); { TSharedPtr<FEdGraphSchemaAction> SelectedAction = GetSelectedAction(); // if we have a specific action selected if (SelectedAction.IsValid()) { MenuBuilder.AddMenuEntry(PaletteCommands.RemoveSingleFavorite); } // if we have a category selected { FString CategoryName = GraphActionMenu->GetSelectedCategoryName(); // make sure it is an actual category and isn't the root (assume there's only one category with that name) if (!CategoryName.IsEmpty() && (CategoryName != SBlueprintFavoritesPaletteUtils::FavoritesCategoryName)) { MenuBuilder.AddMenuEntry(PaletteCommands.RemoveSubFavorites); } } } MenuBuilder.EndSection(); MenuBuilder.BeginSection("FavoritesList"); { SBlueprintSubPalette::GenerateContextMenuEntries(MenuBuilder); MenuBuilder.AddSubMenu( LOCTEXT("LoadProfile", "Load Profile"), LOCTEXT("LoadProfileTooltip", "Replace your current favorites with ones from a pre-defined profile."), FNewMenuDelegate::CreateStatic(&SBlueprintFavoritesPaletteUtils::BuildProfilesSubMenu) ); MenuBuilder.AddMenuEntry(PaletteCommands.ClearFavorites); } MenuBuilder.EndSection(); }
void EditCoursesMenu::OnRowValueChanged( Row row ) { LOG->Trace( "EditCoursesMenu::OnRowValueChanged(%i)", row ); const bool bCanGoLeft = CanGoLeft(), bCanGoRight = CanGoRight(); m_sprArrows[0].SetDiffuse( bCanGoLeft?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( bCanGoRight?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[0].EnableAnimation( bCanGoLeft ); m_sprArrows[1].EnableAnimation( bCanGoRight ); Course* pCourse = GetSelectedCourse(); CourseEntry* pEntry = GetSelectedEntry(); switch( row ) { case ROW_COURSE: CHECKPOINT; m_textValue[ROW_COURSE].SetText( pCourse->GetFullDisplayTitle() ); m_CourseBanner.LoadFromCourse( pCourse ); m_CourseBanner.ScaleToClipped( COURSE_BANNER_WIDTH, COURSE_BANNER_HEIGHT ); m_iSelection[ROW_ENTRY] = 0; pEntry = GetSelectedEntry(); if( pEntry == NULL ) { CourseEntry ce; const vector<Song*> &apSongs = SONGMAN->GetAllSongs(); ASSERT( !apSongs.empty() ); ce.pSong = apSongs[0]; pCourse->m_entries.push_back( ce ); pEntry = GetSelectedEntry(); } // fall through case ROW_COURSE_OPTIONS: CHECKPOINT; m_textValue[ROW_COURSE_OPTIONS].SetText( ssprintf( "(START) %s, %s, ", pCourse->m_bRepeat ? "repeat" : "no repeat", pCourse->m_bRandomize ? "randomize" : "no randomize" ) + ssprintf( (pCourse->m_iLives==-1) ? "use bar life" : "%d lives", pCourse->m_iLives ) ); // fall through case ROW_ACTION: CHECKPOINT; m_textValue[ROW_ACTION].SetText( "(START) " + ActionToString(GetSelectedAction()) ); // fall through case ROW_ENTRY: CHECKPOINT; m_textValue[ROW_ENTRY].SetText( ssprintf("%d of %d",m_iSelection[ROW_ENTRY]+1, (int)GetSelectedCourse()->m_entries.size()) ); m_iSelection[ROW_ENTRY_TYPE] = pEntry->type; // fall through case ROW_ENTRY_TYPE: CHECKPOINT; m_textValue[ROW_ENTRY_TYPE].SetText( pEntry ? CourseEntryTypeToString(pEntry->type) : CString("(none)") ); // fall through case ROW_ENTRY_OPTIONS: CHECKPOINT; { CStringArray as; const bool *bShow = g_bRowEnabledForType[GetSelectedEntry()->type]; if( bShow[song] ) as.push_back( pEntry->pSong ? pEntry->pSong->GetFullTranslitTitle() : CString("(missing song)") ); if( bShow[group] ) as.push_back( pEntry->group_name.empty() ? CString("(no group)") : pEntry->group_name ); if( bShow[difficulty] ) if( pEntry->difficulty != DIFFICULTY_INVALID ) as.push_back( DifficultyToString(pEntry->difficulty) ); if( bShow[low_meter] ) if( pEntry->low_meter > 0 ) as.push_back( ssprintf("low meter %d", pEntry->low_meter) ); if( bShow[high_meter] ) if( pEntry->high_meter > 0 ) as.push_back( ssprintf("high meter %d", pEntry->high_meter) ); if( bShow[best_worst_value] ) if( pEntry->players_index != -1 ) as.push_back( ssprintf("rank %d", pEntry->players_index+1) ); m_textValue[ROW_ENTRY_OPTIONS].SetText( "(START) " + join(", ",as) ); } // fall through case ROW_ENTRY_PLAYER_OPTIONS: CHECKPOINT; { CString s = "(START) "; PlayerOptions po; po.FromString( pEntry->modifiers ); if( po.GetString().empty() ) s += "(none)"; else s += po.GetString(); m_textValue[ROW_ENTRY_PLAYER_OPTIONS].SetText( s ); } // fall through case ROW_ENTRY_SONG_OPTIONS: CHECKPOINT; { CString s = "(START) "; SongOptions so; so.FromString( pEntry->modifiers ); if( so.GetString().empty() ) s += "(none)"; else s += so.GetString(); m_textValue[ROW_ENTRY_SONG_OPTIONS].SetText( s ); } break; default: ASSERT(0); // invalid row } }
void EditCoursesMenu::Start() { if( m_bInSongMenu ) { m_SongMenu.SaveToCourseEntry( GetSelectedEntry() ); m_bInSongMenu = false; OnRowValueChanged( ROW_ENTRY ); return; } Course* pCourse = GetSelectedCourse(); CourseEntry* pEntry = GetSelectedEntry(); switch( m_SelectedRow ) { case ROW_COURSE_OPTIONS: g_CourseOptionsMenu.rows[repeat].defaultChoice = pCourse->m_bRepeat ? 1 : 0; g_CourseOptionsMenu.rows[randomize].defaultChoice = pCourse->m_bRandomize ? 1 : 0; g_CourseOptionsMenu.rows[lives].defaultChoice = pCourse->m_iLives; if( g_CourseOptionsMenu.rows[lives].defaultChoice == -1 ) g_CourseOptionsMenu.rows[lives].defaultChoice = 0; SCREENMAN->MiniMenu( &g_CourseOptionsMenu, SM_BackFromCourseOptionsMenu ); break; case ROW_ACTION: switch( GetSelectedAction() ) { case save: m_soundSave.Play(); pCourse->Save(); SCREENMAN->SystemMessage( "Course saved." ); break; case add_entry: SCREENMAN->PlayStartSound(); pCourse->m_entries.insert( pCourse->m_entries.begin()+m_iSelection[ROW_ENTRY], pCourse->m_entries[m_iSelection[ROW_ENTRY]] ); OnRowValueChanged( ROW_ENTRY ); break; case delete_selected_entry: if( pCourse->m_entries.size() == 1 ) { SCREENMAN->PlayInvalidSound(); SCREENMAN->SystemMessage( "Cannot delete the last entry from a course" ); break; } SCREENMAN->PlayStartSound(); pCourse->m_entries.erase( pCourse->m_entries.begin()+m_iSelection[ROW_ENTRY] ); CLAMP( m_iSelection[ROW_ENTRY], 0, (int) pCourse->m_entries.size()-1 ); OnRowValueChanged( ROW_ENTRY ); break; default: ASSERT(0); } OnRowValueChanged( ROW_ENTRY ); break; case ROW_ENTRY_OPTIONS: m_SongMenu.LoadFromCourseEntry( GetSelectedEntry() ); m_bInSongMenu = true; break; case ROW_ENTRY_PLAYER_OPTIONS: SCREENMAN->PlayStartSound(); GAMESTATE->m_PlayerOptions[PLAYER_1] = PlayerOptions(); GAMESTATE->m_PlayerOptions[PLAYER_1].FromString( pEntry->modifiers ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions ); break; case ROW_ENTRY_SONG_OPTIONS: SCREENMAN->PlayStartSound(); GAMESTATE->m_SongOptions = SongOptions(); GAMESTATE->m_SongOptions.FromString( pEntry->modifiers ); SCREENMAN->AddNewScreenToTop( "ScreenSongOptions", SM_BackFromSongOptions ); break; default: SCREENMAN->PlayInvalidSound(); return; } }
void EditMenu::OnRowValueChanged( Row row ) { m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[0].EnableAnimation( CanGoLeft() ); m_sprArrows[1].EnableAnimation( CanGoRight() ); switch( row ) { case ROW_GROUP: m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); m_GroupBanner.LoadFromGroup( GetSelectedGroup() ); m_GroupBanner.ScaleToClipped( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT ); m_pSongs.clear(); SONGMAN->GetSongs( m_pSongs, GetSelectedGroup() ); m_iSelection[ROW_SONG] = 0; // fall through case ROW_SONG: m_textValue[ROW_SONG].SetText( "" ); m_SongBanner.LoadFromSong( GetSelectedSong() ); m_SongBanner.ScaleToClipped( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT ); m_SongTextBanner.LoadFromSong( GetSelectedSong() ); // fall through case ROW_STEPS_TYPE: m_textValue[ROW_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToString(GetSelectedStepsType()) ); // fall through case ROW_DIFFICULTY: m_textValue[ROW_DIFFICULTY].SetText( DifficultyToString(GetSelectedDifficulty()) ); m_Meter.SetFromSteps( GetSelectedNotes() ); // fall through case ROW_SOURCE_STEPS_TYPE: m_textLabel[ROW_SOURCE_STEPS_TYPE].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_STEPS_TYPE].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_STEPS_TYPE].SetText( GAMEMAN->StepsTypeToString(GetSelectedSourceStepsType()) ); // fall through case ROW_SOURCE_DIFFICULTY: m_textLabel[ROW_SOURCE_DIFFICULTY].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_DIFFICULTY].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) ); m_textValue[ROW_SOURCE_DIFFICULTY].SetText( DifficultyToString(GetSelectedSourceDifficulty()) ); m_SourceMeter.SetFromSteps( GetSelectedSourceNotes() ); m_SourceMeter.SetZoomY( GetSelectedNotes()?0.f:1.f ); m_Actions.clear(); if( GetSelectedNotes() ) { m_Actions.push_back( ACTION_EDIT ); m_Actions.push_back( ACTION_DELETE ); } else if( GetSelectedSourceNotes() ) { m_Actions.push_back( ACTION_COPY ); m_Actions.push_back( ACTION_AUTOGEN ); m_Actions.push_back( ACTION_BLANK ); } else { m_Actions.push_back( ACTION_BLANK ); } m_iSelection[ROW_ACTION] = 0; // fall through case ROW_ACTION: m_textValue[ROW_ACTION].SetText( ActionToString(GetSelectedAction()) ); break; default: ASSERT(0); // invalid row } }