| 358 | } |
| 359 | |
| 360 | static inline int |
| 361 | MacroIndexToModelIndex(int realIdx, |
| 362 | const std::deque<std::shared_ptr<Macro>> ¯os) |
| 363 | { |
| 364 | if (realIdx == -1) { |
| 365 | return -1; |
| 366 | } |
| 367 | |
| 368 | int modelIdx = 0; |
| 369 | bool inCollapsedGroup = false; |
| 370 | uint32_t groupSize = 0; |
| 371 | for (int i = 0; i < realIdx; i++) { |
| 372 | if (inCollapsedGroup) { |
| 373 | i += groupSize - 1; |
| 374 | groupSize = 0; |
| 375 | inCollapsedGroup = false; |
| 376 | continue; |
| 377 | } |
| 378 | const auto &m = macros.at(i); |
| 379 | inCollapsedGroup = m->IsGroup() && m->IsCollapsed(); |
| 380 | groupSize = m->GroupSize(); |
| 381 | modelIdx++; |
| 382 | } |
| 383 | return modelIdx; |
| 384 | } |
| 385 | |
| 386 | void MacroTreeModel::MoveItemBefore(const std::shared_ptr<Macro> &item, |
| 387 | const std::shared_ptr<Macro> &before) |
no test coverage detected