13
0

pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is

This commit is contained in:
Paul Davis 2023-08-06 13:10:35 -06:00
parent 47a7a16c43
commit afe5331a0b
28 changed files with 64 additions and 55 deletions

View File

@ -2295,7 +2295,7 @@ private:
void apply_filter (ARDOUR::Filter&, std::string cmd, ProgressReporter* progress = 0);
Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
PBD::Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
/* plugin setup */
int plugin_setup (std::shared_ptr<ARDOUR::Route>, std::shared_ptr<ARDOUR::PluginInsert>, ARDOUR::Route::PluginSetupOptions);

View File

@ -5982,7 +5982,7 @@ Editor::strip_region_silence ()
}
}
Command*
PBD::Command*
Editor::apply_midi_note_edit_op_to_region (MidiOperator& op, MidiRegionView& mrv)
{
Evoral::Sequence<Temporal::Beats>::Notes selected;

View File

@ -116,7 +116,7 @@ public:
XMLNode& get_state () const;
int set_state (const XMLNode &, int version);
Command* memento_command (XMLNode* before, XMLNode* after);
PBD::Command* memento_command (XMLNode* before, XMLNode* after);
bool operator!= (const AutomationList &) const;

View File

@ -41,7 +41,7 @@ public:
typedef Evoral::Sequence<Temporal::Beats>::Notes Notes;
Command* operator()(std::shared_ptr<ARDOUR::MidiModel> model,
PBD::Command* operator()(std::shared_ptr<ARDOUR::MidiModel> model,
Temporal::Beats position,
std::vector<Notes>& seqs);

View File

@ -63,7 +63,7 @@ public:
MidiModel (MidiSource&);
class LIBARDOUR_API DiffCommand : public Command {
class LIBARDOUR_API DiffCommand : public PBD::Command {
public:
DiffCommand (std::shared_ptr<MidiModel> m, const std::string& name);
@ -275,22 +275,22 @@ public:
* This STARTS and COMMITS an undo command.
* The command will constitute one item on the undo stack.
*/
void apply_diff_command_as_commit (Session& session, Command* cmd);
void apply_diff_command_as_commit (Session& session, PBD::Command* cmd);
void apply_diff_command_as_commit (Session* session, Command* cmd) { if (session) { apply_diff_command_as_commit (*session, cmd); } }
void apply_diff_command_as_commit (Session* session, PBD::Command* cmd) { if (session) { apply_diff_command_as_commit (*session, cmd); } }
/** Add a command as part of a larger reversible transaction
*
* Ownership of cmd is taken, it must not be deleted by the caller.
* The command will be incorporated into the current command.
*/
void apply_diff_command_as_subcommand (Session& session, Command* cmd);
void apply_diff_command_as_subcommand (Session& session, PBD::Command* cmd);
/** Apply the midi diff, but without any effect on undo
*
* Ownership of cmd is not changed.
*/
void apply_diff_command_only (Session& session, Command* cmd);
void apply_diff_command_only (Session& session, PBD::Command* cmd);
bool sync_to_source (const Source::WriterLock& source_lock);

View File

@ -26,7 +26,9 @@
#include "temporal/beats.h"
#include "evoral/Sequence.h"
namespace PBD {
class Command;
}
namespace ARDOUR {
@ -37,7 +39,7 @@ class LIBARDOUR_API MidiOperator {
MidiOperator () {}
virtual ~MidiOperator() {}
virtual Command* operator() (std::shared_ptr<ARDOUR::MidiModel>,
virtual PBD::Command* operator() (std::shared_ptr<ARDOUR::MidiModel>,
Temporal::Beats,
std::vector<Evoral::Sequence<Temporal::Beats>::Notes>&) = 0;
virtual std::string name() const = 0;

View File

@ -102,7 +102,7 @@ public:
void update (const RegionListProperty::ChangeRecord&);
void clear_owned_changes ();
void rdiff (std::vector<Command*>&) const;
void rdiff (std::vector<PBD::Command*>&) const;
void rdiff_and_add_command (Session*);

View File

@ -33,7 +33,7 @@ public:
float strength, float swing, Temporal::Beats const & threshold);
~Quantize ();
Command* operator() (std::shared_ptr<ARDOUR::MidiModel>,
PBD::Command* operator() (std::shared_ptr<ARDOUR::MidiModel>,
Temporal::Beats position,
std::vector<Evoral::Sequence<Temporal::Beats>::Notes>&);
std::string name() const { return std::string ("quantize"); }

View File

@ -110,6 +110,7 @@ class Parser;
namespace PBD {
class Controllable;
class Progress;
class Command;
}
namespace luabridge {
@ -1084,9 +1085,9 @@ public:
* This must only be called after begin_reversible_command ()
* @param cmd (additional) command to add
*/
void commit_reversible_command (Command* cmd = 0);
void commit_reversible_command (PBD::Command* cmd = 0);
void add_command (Command *const cmd);
void add_command (PBD::Command *const cmd);
/** create an StatefulDiffCommand from the given object and add it to the stack.
*
@ -1127,13 +1128,13 @@ public:
*/
bool abort_empty_reversible_command ();
void add_commands (std::vector<Command*> const & cmds);
void add_commands (std::vector<PBD::Command*> const & cmds);
std::map<PBD::ID,PBD::StatefulDestructible*> registry;
// these commands are implemented in libs/ardour/session_command.cc
Command* memento_command_factory(XMLNode* n);
Command* stateful_diff_command_factory (XMLNode *);
PBD::Command* memento_command_factory(XMLNode* n);
PBD::Command* stateful_diff_command_factory (XMLNode *);
void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible*);
/* clicking */
@ -1386,7 +1387,7 @@ public:
bool bang_trigger_at(int32_t route_index, int32_t row_index);
bool unbang_trigger_at(int32_t route_index, int32_t row_index);
void globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to);
PBD::Command* globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to);
protected:
friend class AudioEngine;

View File

@ -131,7 +131,7 @@ public:
Transform(const Program& prog);
Command* operator()(std::shared_ptr<ARDOUR::MidiModel> model,
PBD::Command* operator()(std::shared_ptr<ARDOUR::MidiModel> model,
Temporal::Beats position,
std::vector<Notes>& seqs);

View File

@ -32,7 +32,7 @@ public:
Transpose (int semitones);
Command* operator() (std::shared_ptr<ARDOUR::MidiModel> model,
PBD::Command* operator() (std::shared_ptr<ARDOUR::MidiModel> model,
Temporal::Beats position,
std::vector<Notes>& seqs);

View File

@ -315,7 +315,7 @@ AutomationList::thaw ()
}
}
Command*
PBD::Command*
AutomationList::memento_command (XMLNode* before, XMLNode* after)
{
return new MementoCommand<AutomationList> (*this, before, after);

View File

@ -29,7 +29,7 @@ Legatize::Legatize(bool shrink_only)
Legatize::~Legatize ()
{}
Command*
PBD::Command*
Legatize::operator()(std::shared_ptr<ARDOUR::MidiModel> model,
Temporal::Beats position,
std::vector<Legatize::Notes>& seqs)

View File

@ -507,9 +507,9 @@ LuaBindings::common (lua_State* L)
.deriveWSPtrClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructiblePtr")
.endClass ()
.deriveClass <Command, PBD::StatefulDestructible> ("Command")
.addFunction ("set_name", &Command::set_name)
.addFunction ("name", &Command::name)
.deriveClass <PBD::Command, PBD::StatefulDestructible> ("Command")
.addFunction ("set_name", &PBD::Command::set_name)
.addFunction ("name", &PBD::Command::name)
.endClass ()
/* UndoTransaction::add_command() subscribes to DropReferences()
@ -521,7 +521,7 @@ LuaBindings::common (lua_State* L)
* use Session::add_stateful_diff_command()
* and Session::abort_reversible_command()
*/
.deriveClass <PBD::StatefulDiffCommand, Command> ("StatefulDiffCommand")
.deriveClass <PBD::StatefulDiffCommand, PBD::Command> ("StatefulDiffCommand")
.addFunction ("undo", &PBD::StatefulDiffCommand::undo)
.addFunction ("empty", &PBD::StatefulDiffCommand::empty)
.endClass ()
@ -1765,13 +1765,13 @@ LuaBindings::common (lua_State* L)
.endClass ()
.deriveWSPtrClass <MidiModel, AutomatableSequence<Temporal::Beats> > ("MidiModel")
.addFunction ("apply_command", (void (MidiModel::*)(Session*, Command*))&MidiModel::apply_diff_command_as_commit) /* deprecated: left here in case any extant scripts use apply_command */
.addFunction ("apply_diff_command_as_commit", (void (MidiModel::*)(Session*, Command*))&MidiModel::apply_diff_command_as_commit)
.addFunction ("apply_command", (void (MidiModel::*)(Session*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) /* deprecated: left here in case any extant scripts use apply_command */
.addFunction ("apply_diff_command_as_commit", (void (MidiModel::*)(Session*, PBD::Command*))&MidiModel::apply_diff_command_as_commit)
.addFunction ("new_note_diff_command", &MidiModel::new_note_diff_command)
.endClass ()
.beginNamespace ("MidiModel")
.deriveClass<ARDOUR::MidiModel::DiffCommand, Command> ("DiffCommand")
.deriveClass<ARDOUR::MidiModel::DiffCommand, PBD::Command> ("DiffCommand")
.endClass ()
.deriveClass<ARDOUR::MidiModel::NoteDiffCommand, ARDOUR::MidiModel::DiffCommand> ("NoteDiffCommand")

View File

@ -118,7 +118,7 @@ swing_position (Temporal::Beats pos, Temporal::Beats grid, double swing_strength
return pos;
}
Command*
PBD::Command*
Quantize::operator () (std::shared_ptr<MidiModel> model,
Temporal::Beats position,
std::vector<Evoral::Sequence<Temporal::Beats>::Notes>& seqs)

View File

@ -41,7 +41,9 @@
#include "pbd/statefuldestructible.h"
#include "pbd/types_convert.h"
namespace PBD {
class Command;
}
using namespace PBD;
using namespace ARDOUR;
@ -54,7 +56,7 @@ void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulDes
registry[id] = ptr;
}
Command *
PBD::Command *
Session::memento_command_factory(XMLNode *n)
{
PBD::ID id;
@ -151,7 +153,7 @@ Session::memento_command_factory(XMLNode *n)
return 0 ;
}
Command *
PBD::Command *
Session::stateful_diff_command_factory (XMLNode* n)
{
PBD::ID id;

View File

@ -119,7 +119,7 @@ Transform::Operation::eval(Context& ctx) const
ctx.stack.push(Variant(lhs.type(), value));
}
Command*
PBD::Command*
Transform::operator()(std::shared_ptr<MidiModel> model,
Temporal::Beats position,
std::vector<Notes>& seqs)

View File

@ -24,7 +24,7 @@ Transpose::Transpose(int semitones)
: _semitones(semitones)
{}
Command*
PBD::Command*
Transpose::operator()(std::shared_ptr<MidiModel> model,
Temporal::Beats position,
std::vector<Notes>& seqs)

View File

@ -21,7 +21,7 @@
#include "pbd/command.h"
#include "pbd/xml++.h"
XMLNode &Command::get_state() const
XMLNode &PBD::Command::get_state() const
{
XMLNode *node = new XMLNode ("Command");
node->add_content("WARNING: Somebody forgot to subclass Command.");

View File

@ -29,6 +29,8 @@
#include "pbd/signals.h"
#include "pbd/statefuldestructible.h"
namespace PBD {
/** Base class for Undo/Redo commands and changesets */
class LIBPBD_API Command : public PBD::StatefulDestructible, public PBD::ScopedConnectionList
{
@ -57,4 +59,6 @@ protected:
std::string _name;
};
} /* namespace */
#endif // __lib_pbd_command_h_

View File

@ -36,7 +36,7 @@
namespace PBD {
template <class obj_type, class arg_type>
class /*LIBPBD_API*/ FunctorCommand : public Command
class /*LIBPBD_API*/ FunctorCommand : public PBD::Command
{
private:
typedef void (obj_type::*functor_type)(arg_type);

View File

@ -101,7 +101,7 @@ private:
* memento, and redo is restoring the after memento.
*/
template <class obj_T>
class LIBPBD_TEMPLATE_API MementoCommand : public Command
class LIBPBD_TEMPLATE_API MementoCommand : public PBD::Command
{
public:
MementoCommand (obj_T& a_object, XMLNode* a_before, XMLNode* a_after)

View File

@ -29,10 +29,8 @@
#include "pbd/libpbd_visibility.h"
#include "pbd/xml++.h"
class Command;
namespace PBD {
class LIBPBD_API Command;
class LIBPBD_API PropertyList;
class LIBPBD_API StatefulDiffCommand;
@ -140,7 +138,7 @@ public:
virtual void get_changes_as_properties (PropertyList& changes, Command *) const = 0;
/** Collect StatefulDiffCommands for changes to anything that we own */
virtual void rdiff (std::vector<Command*> &) const {}
virtual void rdiff (std::vector<PBD::Command*> &) const {}
/** Look in an XML node written by get_changes_as_xml and, if XML from this property
* is found, create a property with the changes from the XML.

View File

@ -37,6 +37,7 @@
#include "pbd/error.h"
namespace PBD {
class Command;
/** A base class for properties whose state is a container of other
* things. Its behaviour is `specialised' for this purpose in that
@ -224,7 +225,7 @@ class /*LIBPBD_API*/ SequenceProperty : public PropertyBase
}
}
void rdiff (std::vector<Command*>& cmds) const {
void rdiff (std::vector<PBD::Command*>& cmds) const {
for (typename Container::const_iterator i = begin(); i != end(); ++i) {
if ((*i)->changed ()) {
StatefulDiffCommand* sdc = new StatefulDiffCommand (*i);

View File

@ -89,8 +89,8 @@ class LIBPBD_API Stateful {
void clear_changes ();
virtual void clear_owned_changes ();
PropertyList* get_changes_as_properties (Command *) const;
virtual void rdiff (std::vector<Command*> &) const;
PropertyList* get_changes_as_properties (PBD::Command *) const;
virtual void rdiff (std::vector<PBD::Command*> &) const;
bool changed() const;
/* create a property list from an XMLNode */

View File

@ -33,7 +33,7 @@ class PropertyList;
/** A Command which stores its action as the differences between the before and after
* state of a Stateful object.
*/
class LIBPBD_API StatefulDiffCommand : public Command
class LIBPBD_API StatefulDiffCommand : public PBD::Command
{
public:
StatefulDiffCommand (std::shared_ptr<StatefulDestructible>);

View File

@ -41,7 +41,7 @@
typedef sigc::slot<void> UndoAction;
class LIBPBD_API UndoTransaction : public Command
class LIBPBD_API UndoTransaction : public PBD::Command
{
public:
UndoTransaction ();
@ -55,8 +55,8 @@ public:
return _clearing;
}
void add_command (Command* const);
void remove_command (Command* const);
void add_command (PBD::Command* const);
void remove_command (PBD::Command* const);
void operator() ();
void undo ();
@ -75,7 +75,7 @@ public:
}
private:
std::list<Command*> actions;
std::list<PBD::Command*> actions;
struct timeval _timestamp;
bool _clearing;

View File

@ -30,6 +30,7 @@
using namespace std;
using namespace sigc;
using namespace PBD;
UndoTransaction::UndoTransaction ()
: _clearing (false)