summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/step_editor.cc12
-rw-r--r--gtk2_ardour/step_editor.h17
-rw-r--r--gtk2_ardour/step_entry.cc4
3 files changed, 27 insertions, 6 deletions
diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc
index d173023714..1b017bbd53 100644
--- a/gtk2_ardour/step_editor.cc
+++ b/gtk2_ardour/step_editor.cc
@@ -73,8 +73,8 @@ StepEditor::start_step_editing ()
assert (step_edit_region_view);
StepEntry::instance().set_step_editor (this);
- StepEntry::instance().signal_delete_event().connect (sigc::mem_fun (*this, &StepEditor::step_entry_hidden));
- StepEntry::instance(). signal_hide().connect (sigc::mem_fun (*this, &StepEditor::step_entry_hide));
+ delete_connection = StepEntry::instance().signal_delete_event().connect (sigc::mem_fun (*this, &StepEditor::step_entry_hidden));
+ hide_connection = StepEntry::instance(). signal_hide().connect (sigc::mem_fun (*this, &StepEditor::step_entry_done));
step_edit_region_view->show_step_edit_cursor (step_edit_beat_pos);
step_edit_region_view->set_step_edit_cursor_width (StepEntry::instance().note_length());
@@ -148,13 +148,15 @@ StepEditor::reset_step_edit_beat_pos ()
bool
StepEditor::step_entry_hidden (GdkEventAny*)
{
- step_entry_hide ();
- return true; // XXX remember position ?!
+ step_entry_done ();
+ return true;
}
void
-StepEditor::step_entry_hide ()
+StepEditor::step_entry_done ()
{
+ hide_connection.disconnect ();
+ delete_connection.disconnect ();
/* everything else will follow the change in the model */
_track->set_step_editing (false);
}
diff --git a/gtk2_ardour/step_editor.h b/gtk2_ardour/step_editor.h
index 761ac0125b..dca0129c9f 100644
--- a/gtk2_ardour/step_editor.h
+++ b/gtk2_ardour/step_editor.h
@@ -38,12 +38,25 @@ class MidiTimeAxisView;
class PublicEditor;
class StepEntry;
+/** A StepEditor is an object which understands how to interact with the
+ * MidiTrack and MidiTimeAxisView APIs to make the changes required during step
+ * editing. However, it defers all GUI matters to the StepEntry class, which
+ * presents an interface to the user, and then calls StepEditor methods to make
+ * changes.
+ *
+ * The StepEntry is a singleton, used over and over each time the user wants to
+ * step edit; the StepEditor is owned by a MidiTimeAxisView and re-used for any
+ * step editing in the MidiTrack for which the MidiTimeAxisView is a view.
+ */
+
class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable
{
public:
StepEditor (PublicEditor&, boost::shared_ptr<ARDOUR::MidiTrack>, MidiTimeAxisView&);
virtual ~StepEditor ();
+ void step_entry_done ();
+
void check_step_edit ();
void step_edit_rest (Temporal::Beats beats);
void step_edit_beat_sync ();
@@ -82,10 +95,12 @@ private:
int8_t last_added_pitch;
Temporal::Beats last_added_end;
+ sigc::connection delete_connection;
+ sigc::connection hide_connection;
+
void region_removed (boost::weak_ptr<ARDOUR::Region>);
void playlist_changed ();
bool step_entry_hidden (GdkEventAny*);
- void step_entry_hide ();
void resync_step_edit_position ();
void prepare_step_edit_region ();
};
diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc
index 756adfde4c..d6bd4970cd 100644
--- a/gtk2_ardour/step_entry.cc
+++ b/gtk2_ardour/step_entry.cc
@@ -469,6 +469,10 @@ StepEntry::~StepEntry()
void
StepEntry::set_step_editor (StepEditor* seditor)
{
+ if (se) {
+ se->step_entry_done ();
+ }
+
se = seditor;
if (se) {