Centralize setting undo/redo action sensitivity
This fixes undo/redo action sensitivity for non-editor history stack changes. Notably recording was not undoable, because the butler thread creates the reversible "capture" command.
This commit is contained in:
parent
c56313cea0
commit
8794145c9d
|
@ -3796,8 +3796,6 @@ Editor::commit_reversible_command ()
|
|||
if (_session) {
|
||||
if (before.size() == 1) {
|
||||
_session->add_command (new MementoCommand<SelectionMemento>(*(_selection_memento), before.front(), &_selection_memento->get_state ()));
|
||||
redo_action->set_sensitive(false);
|
||||
undo_action->set_sensitive(true);
|
||||
begin_selection_op_history ();
|
||||
}
|
||||
|
||||
|
@ -3815,18 +3813,24 @@ Editor::commit_reversible_command ()
|
|||
void
|
||||
Editor::history_changed ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
string label;
|
||||
|
||||
if (undo_action && _session) {
|
||||
if (undo_action) {
|
||||
if (_session->undo_depth() == 0) {
|
||||
label = S_("Command|Undo");
|
||||
undo_action->set_sensitive(false);
|
||||
} else {
|
||||
label = string_compose(S_("Command|Undo (%1)"), _session->next_undo());
|
||||
undo_action->set_sensitive(true);
|
||||
}
|
||||
undo_action->property_label() = label;
|
||||
}
|
||||
|
||||
if (redo_action && _session) {
|
||||
if (redo_action) {
|
||||
if (_session->redo_depth() == 0) {
|
||||
label = _("Redo");
|
||||
redo_action->set_sensitive (false);
|
||||
|
|
|
@ -162,10 +162,6 @@ Editor::undo (uint32_t n)
|
|||
|
||||
if (_session) {
|
||||
_session->undo (n);
|
||||
if (_session->undo_depth() == 0) {
|
||||
undo_action->set_sensitive(false);
|
||||
}
|
||||
redo_action->set_sensitive(true);
|
||||
begin_selection_op_history ();
|
||||
}
|
||||
}
|
||||
|
@ -187,10 +183,6 @@ Editor::redo (uint32_t n)
|
|||
|
||||
if (_session) {
|
||||
_session->redo (n);
|
||||
if (_session->redo_depth() == 0) {
|
||||
redo_action->set_sensitive(false);
|
||||
}
|
||||
undo_action->set_sensitive(true);
|
||||
begin_selection_op_history ();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue