| 163 | } |
| 164 | |
| 165 | void RedoMenuItem::updateRedoListCache_( const HistoryStore& store, HistoryStore::ChangeType type, std::shared_ptr<HistoryAction> ) |
| 166 | { |
| 167 | if ( type == HistoryStore::ChangeType::PreRedo || |
| 168 | type == HistoryStore::ChangeType::PreUndo || |
| 169 | type == HistoryStore::ChangeType::PreAppendAction ) |
| 170 | return; // no need to update cache in this case |
| 171 | |
| 172 | if ( type == HistoryStore::ChangeType::PostAppendAction && bool( store.getScopeBlockPtr() ) ) |
| 173 | return; // no need to update cache for actions in scope |
| 174 | |
| 175 | auto lastRedos = store.getNActions( cMaxNumActionsInList, HistoryAction::Type::Redo ); |
| 176 | if ( lastRedos.empty() ) |
| 177 | { |
| 178 | dropList_.clear(); |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | dropList_.resize( lastRedos.size() ); |
| 183 | for ( int i = 0; i < lastRedos.size(); ++i ) |
| 184 | { |
| 185 | const auto itemName = fmt::format( "{}##{}", Locale::translate( trimHashHashSuffix( lastRedos[i] ), Locale::genericDomain ), i ); |
| 186 | dropList_[i] = std::make_shared<LambdaRibbonItem>( itemName, [i] |
| 187 | { |
| 188 | if ( auto* history = HistoryStore::getViewerInstance() ) |
| 189 | for ( int j = 0; j <= i; ++j ) |
| 190 | history->redo(); |
| 191 | } ); |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | MR_REGISTER_RIBBON_ITEM( UndoMenuItem ) |
| 196 |
nothing calls this directly
no test coverage detected