wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
SetCellsCommand Class Reference

Generic undo command for any DolphinEdits mutation (Set 0/1, Invert, Clear, clock/combinational fill, and the value-filling half of a length increase). More...

#include <DolphinCommands.h>

Inheritance diagram for SetCellsCommand:
[legend]

Public Member Functions

void redo () override
 SetCellsCommand (SignalModel *model, const QList< QPair< int, int > > &cells, const QList< int > &oldValues, std::function< void()> onApplied, QUndoCommand *parent=nullptr)
void undo () override

Detailed Description

Generic undo command for any DolphinEdits mutation (Set 0/1, Invert, Clear, clock/combinational fill, and the value-filling half of a length increase).

Mirrors the main Scene's UpdateCommand: the caller applies the edit before constructing this command, so the constructor captures the post-edit ("new") values directly from the model, while the pre-edit ("old") values must be snapshotted by the caller beforehand and passed in. cells and both value lists must be the same size and in the same (row, col) order. onApplied is invoked after both redo() and undo() so the caller can re-run the simulation and refresh its edited-flag – this command only owns cell values, not BewavedDolphin's wider state.

Definition at line 31 of file DolphinCommands.h.

Constructor & Destructor Documentation

◆ SetCellsCommand()

SetCellsCommand::SetCellsCommand ( SignalModel * model,
const QList< QPair< int, int > > & cells,
const QList< int > & oldValues,
std::function< void()> onApplied,
QUndoCommand * parent = nullptr )

Definition at line 8 of file DolphinCommands.cpp.

Member Function Documentation

◆ redo()

void SetCellsCommand::redo ( )
override

Definition at line 27 of file DolphinCommands.cpp.

◆ undo()

void SetCellsCommand::undo ( )
override

Definition at line 32 of file DolphinCommands.cpp.


The documentation for this class was generated from the following files: