| 691 | } |
| 692 | |
| 693 | void InputEditorModel::endPaint() |
| 694 | { |
| 695 | if (!paintOngoing) return; |
| 696 | |
| 697 | /* Rewind to past frame if needed, otherwise paint whatever is possible */ |
| 698 | if (paintMinRow < context->framecount) { |
| 699 | bool ret = rewind(paintMinRow); |
| 700 | if (!ret) { |
| 701 | /* Try rewinding to the earliest frame possible and paint what is possible */ |
| 702 | uint64_t root_frame = SaveStateList::rootStateFramecount(); |
| 703 | if (root_frame > paintMaxRow) { |
| 704 | startHighlight(paintMinRow, paintMaxRow, paintCol, paintCol, false); |
| 705 | paintOngoing = false; |
| 706 | return; |
| 707 | } |
| 708 | if (root_frame > paintMinRow) |
| 709 | paintMinRow = root_frame; |
| 710 | ret = rewind(root_frame); |
| 711 | if (!ret) { |
| 712 | startHighlight(paintMinRow, paintMaxRow, paintCol, paintCol, false); |
| 713 | paintOngoing = false; |
| 714 | return; |
| 715 | } |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | /* Update the seek frame if we changed an earlier frame */ |
| 720 | if ((context->seek_frame) && !context->config.editor_rewind_seek |
| 721 | && (paintMinRow < context->seek_frame)) { |
| 722 | context->seek_frame = paintMinRow; |
| 723 | } |
| 724 | |
| 725 | /* Add rows if necessary */ |
| 726 | if (paintMaxRow >= frameCount()) { |
| 727 | insertRows(movie->inputs->nbFrames(), paintMaxRow - frameCount() + 1, QModelIndex()); |
| 728 | } |
| 729 | |
| 730 | if (paintAutofire == 0) { |
| 731 | movie->inputs->paintInput(paintInput, paintValue, paintMinRow, paintMaxRow); |
| 732 | } |
| 733 | else { |
| 734 | for (unsigned int r = paintMinRow; r <= paintMaxRow; r++) { |
| 735 | movie->inputs->paintInput(paintInput, ((r%2)==(paintAutofire%2))?!paintValue:paintValue, r, r); |
| 736 | } |
| 737 | } |
| 738 | paintOngoing = false; |
| 739 | } |
| 740 | |
| 741 | std::string InputEditorModel::inputLabel(int column) |
| 742 | { |
no test coverage detected