Ardour  9.0-pre0-582-g084a23a80d
history_owner.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <list>
6 
7 #include <glib.h>
8 
9 #include "pbd/undo.h"
10 #include "pbd/libpbd_visibility.h"
11 
12 namespace PBD {
13  class Command;
14 
15 
17 {
18  public:
19  HistoryOwner (std::string const & name);
20  virtual ~HistoryOwner();
21 
29  void begin_reversible_command (const std::string& cmd_name);
30  void begin_reversible_command (GQuark);
41 
42  void add_command (PBD::Command *const cmd);
43 
52  PBD::StatefulDiffCommand* add_stateful_diff_command (std::shared_ptr<PBD::StatefulDestructible> sfd);
53 
55  std::list<GQuark> const & current_operations () {
56  return _current_trans_quarks;
57  }
58 
59  bool operation_in_progress (GQuark) const;
60 
72  bool collected_undo_commands () const {
73  return _current_trans && !_current_trans->empty ();
74  }
75 
76  PBD::UndoTransaction* current_reversible_command() { return _current_trans; }
77 
84 
85  void add_commands (std::vector<PBD::Command*> const & cmds);
86 
87  PBD::UndoHistory& undo_redo() { return _history; }
88 
89  protected:
90  std::string _name;
98  std::list<GQuark> _current_trans_quarks;
99 };
100 
101 } /* namespace PBD */
102 
PBD::UndoHistory _history
Definition: history_owner.h:91
PBD::UndoTransaction * current_reversible_command()
Definition: history_owner.h:76
std::list< GQuark > const & current_operations()
Definition: history_owner.h:55
bool collected_undo_commands() const
Definition: history_owner.h:72
bool operation_in_progress(GQuark) const
void commit_reversible_command(PBD::Command *cmd=0)
virtual ~HistoryOwner()
PBD::UndoTransaction * _current_trans
Definition: history_owner.h:93
std::string _name
Definition: history_owner.h:90
PBD::StatefulDiffCommand * add_stateful_diff_command(std::shared_ptr< PBD::StatefulDestructible > sfd)
bool abort_empty_reversible_command()
PBD::UndoHistory & undo_redo()
Definition: history_owner.h:87
void add_commands(std::vector< PBD::Command * > const &cmds)
HistoryOwner(std::string const &name)
void begin_reversible_command(GQuark)
void begin_reversible_command(const std::string &cmd_name)
void add_command(PBD::Command *const cmd)
std::list< GQuark > _current_trans_quarks
Definition: history_owner.h:98
void abort_reversible_command()
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBPBD_API
Definition: axis_view.h:42