mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 23:17:46 +01:00
save and restore pianoroll note mode on a per-region basis
This commit is contained in:
parent
54958f1e94
commit
38368f4dd9
6 changed files with 61 additions and 24 deletions
|
|
@ -467,6 +467,10 @@ EditingContext::register_common_actions (Bindings* common_bindings, std::string
|
||||||
reg_sens (_common_actions, "editor-copy", _("Copy"), sigc::mem_fun (*this, &EditingContext::copy));
|
reg_sens (_common_actions, "editor-copy", _("Copy"), sigc::mem_fun (*this, &EditingContext::copy));
|
||||||
reg_sens (_common_actions, "editor-paste", _("Paste"), sigc::mem_fun (*this, &EditingContext::keyboard_paste));
|
reg_sens (_common_actions, "editor-paste", _("Paste"), sigc::mem_fun (*this, &EditingContext::keyboard_paste));
|
||||||
|
|
||||||
|
RadioAction::Group note_mode_group;
|
||||||
|
note_mode_actions[ARDOUR::Sustained] = ActionManager::register_radio_action (_common_actions, note_mode_group, "set-note-mode-sustained", _("Sustained"), sigc::bind (sigc::mem_fun (*this, &EditingContext::note_mode_chosen), ARDOUR::Sustained));
|
||||||
|
note_mode_actions[ARDOUR::Percussive] = ActionManager::register_radio_action (_common_actions, note_mode_group, "set-note-mode-percussivee", _("Percussive"), sigc::bind (sigc::mem_fun (*this, &EditingContext::note_mode_chosen), ARDOUR::Percussive));
|
||||||
|
|
||||||
RadioAction::Group mouse_mode_group;
|
RadioAction::Group mouse_mode_group;
|
||||||
|
|
||||||
mouse_mode_actions[Editing::MouseObject] = ActionManager::register_radio_action (_common_actions, mouse_mode_group, "set-mouse-mode-object", _("Grab (Object Tool)"), sigc::bind (sigc::mem_fun (*this, &EditingContext::mouse_mode_chosen), Editing::MouseObject));
|
mouse_mode_actions[Editing::MouseObject] = ActionManager::register_radio_action (_common_actions, mouse_mode_group, "set-mouse-mode-object", _("Grab (Object Tool)"), sigc::bind (sigc::mem_fun (*this, &EditingContext::mouse_mode_chosen), Editing::MouseObject));
|
||||||
|
|
|
||||||
|
|
@ -297,10 +297,12 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
||||||
void set_draw_length (Editing::GridType);
|
void set_draw_length (Editing::GridType);
|
||||||
void set_draw_velocity (int);
|
void set_draw_velocity (int);
|
||||||
void set_draw_channel (int);
|
void set_draw_channel (int);
|
||||||
|
virtual void set_note_mode (ARDOUR::NoteMode) {}
|
||||||
|
|
||||||
Editing::GridType draw_length () const;
|
Editing::GridType draw_length () const;
|
||||||
int draw_velocity () const;
|
int draw_velocity () const;
|
||||||
int draw_channel () const;
|
int draw_channel () const;
|
||||||
|
virtual ARDOUR::NoteMode note_mode() const { return ARDOUR::Sustained; }
|
||||||
|
|
||||||
Editing::SnapMode snap_mode () const;
|
Editing::SnapMode snap_mode () const;
|
||||||
|
|
||||||
|
|
@ -548,6 +550,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
||||||
std::map<Editing::SnapMode, Glib::RefPtr<Gtk::RadioAction> > snap_mode_actions;
|
std::map<Editing::SnapMode, Glib::RefPtr<Gtk::RadioAction> > snap_mode_actions;
|
||||||
std::map<Editing::GridType, Glib::RefPtr<Gtk::RadioAction> > draw_length_actions;
|
std::map<Editing::GridType, Glib::RefPtr<Gtk::RadioAction> > draw_length_actions;
|
||||||
std::map<Editing::MouseMode, Glib::RefPtr<Gtk::RadioAction> > mouse_mode_actions;
|
std::map<Editing::MouseMode, Glib::RefPtr<Gtk::RadioAction> > mouse_mode_actions;
|
||||||
|
std::map<ARDOUR::NoteMode, Glib::RefPtr<Gtk::RadioAction> > note_mode_actions;
|
||||||
std::map<Editing::ZoomFocus, Glib::RefPtr<Gtk::RadioAction> > zoom_focus_actions;
|
std::map<Editing::ZoomFocus, Glib::RefPtr<Gtk::RadioAction> > zoom_focus_actions;
|
||||||
std::map<int, Glib::RefPtr<Gtk::RadioAction> > draw_velocity_actions;
|
std::map<int, Glib::RefPtr<Gtk::RadioAction> > draw_velocity_actions;
|
||||||
std::map<int, Glib::RefPtr<Gtk::RadioAction> > draw_channel_actions;
|
std::map<int, Glib::RefPtr<Gtk::RadioAction> > draw_channel_actions;
|
||||||
|
|
@ -555,6 +558,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
||||||
void draw_channel_chosen (int);
|
void draw_channel_chosen (int);
|
||||||
void draw_velocity_chosen (int);
|
void draw_velocity_chosen (int);
|
||||||
void draw_length_chosen (Editing::GridType);
|
void draw_length_chosen (Editing::GridType);
|
||||||
|
virtual void note_mode_chosen (ARDOUR::NoteMode) {}
|
||||||
|
|
||||||
sigc::signal<void> DrawLengthChanged;
|
sigc::signal<void> DrawLengthChanged;
|
||||||
sigc::signal<void> DrawVelocityChanged;
|
sigc::signal<void> DrawVelocityChanged;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ Pianoroll::Pianoroll (std::string const & name, bool with_transport)
|
||||||
, bg (nullptr)
|
, bg (nullptr)
|
||||||
, view (nullptr)
|
, view (nullptr)
|
||||||
, bbt_metric (*this)
|
, bbt_metric (*this)
|
||||||
, _note_mode (Sustained)
|
|
||||||
, ignore_channel_changes (false)
|
, ignore_channel_changes (false)
|
||||||
{
|
{
|
||||||
autoscroll_vertical_allowed = false;
|
autoscroll_vertical_allowed = false;
|
||||||
|
|
@ -1587,6 +1586,40 @@ Pianoroll::automation_state_changed ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ARDOUR::NoteMode
|
||||||
|
Pianoroll::note_mode () const
|
||||||
|
{
|
||||||
|
return bg->note_mode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Pianoroll::note_mode_chosen (ARDOUR::NoteMode mode)
|
||||||
|
{
|
||||||
|
EC_LOCAL_TEMPO_SCOPE;
|
||||||
|
|
||||||
|
/* this is driven by a toggle on a radio group, and so is invoked twice,
|
||||||
|
once for the item that became inactive and once for the one that became
|
||||||
|
active.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Glib::RefPtr<Gtk::RadioAction> ract = note_mode_actions[mode];
|
||||||
|
|
||||||
|
if (!ract->get_active()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode != bg->note_mode()) {
|
||||||
|
bg->set_note_mode (mode);
|
||||||
|
if (bg->note_mode() == Percussive) {
|
||||||
|
note_mode_button.set_active_state (Gtkmm2ext::ExplicitActive);
|
||||||
|
} else {
|
||||||
|
note_mode_button.set_active_state (Gtkmm2ext::Off);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
instant_save ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Pianoroll::note_mode_clicked ()
|
Pianoroll::note_mode_clicked ()
|
||||||
{
|
{
|
||||||
|
|
@ -1594,27 +1627,11 @@ Pianoroll::note_mode_clicked ()
|
||||||
|
|
||||||
assert (bg);
|
assert (bg);
|
||||||
|
|
||||||
|
|
||||||
if (bg->note_mode() == Sustained) {
|
if (bg->note_mode() == Sustained) {
|
||||||
set_note_mode (Percussive);
|
note_mode_actions[Percussive]->set_active (true);
|
||||||
} else {
|
} else {
|
||||||
set_note_mode (Sustained);
|
note_mode_actions[Sustained]->set_active (true);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Pianoroll::set_note_mode (NoteMode nm)
|
|
||||||
{
|
|
||||||
EC_LOCAL_TEMPO_SCOPE;
|
|
||||||
|
|
||||||
assert (bg);
|
|
||||||
|
|
||||||
if (nm != bg->note_mode()) {
|
|
||||||
bg->set_note_mode (nm);
|
|
||||||
if (bg->note_mode() == Percussive) {
|
|
||||||
note_mode_button.set_active_state (Gtkmm2ext::ExplicitActive);
|
|
||||||
} else {
|
|
||||||
note_mode_button.set_active_state (Gtkmm2ext::Off);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2037,6 +2054,13 @@ Pianoroll::hide_count_in ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Pianoroll::set_from_rsu (RegionUISettings& region_ui_settings)
|
||||||
|
{
|
||||||
|
note_mode_actions[region_ui_settings.note_mode]->set_active (true);
|
||||||
|
CueEditor::set_from_rsu (region_ui_settings);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Pianoroll::instant_save ()
|
Pianoroll::instant_save ()
|
||||||
{
|
{
|
||||||
|
|
@ -2047,6 +2071,7 @@ Pianoroll::instant_save ()
|
||||||
region_ui_settings.channel = draw_channel();
|
region_ui_settings.channel = draw_channel();
|
||||||
region_ui_settings.note_min = bg->lowest_note ();
|
region_ui_settings.note_min = bg->lowest_note ();
|
||||||
region_ui_settings.note_max = bg->highest_note();
|
region_ui_settings.note_max = bg->highest_note();
|
||||||
|
region_ui_settings.note_mode = note_mode ();
|
||||||
|
|
||||||
CueEditor::instant_save ();
|
CueEditor::instant_save ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ class Pianoroll : public CueEditor
|
||||||
int visible_channel () const { return _visible_channel; }
|
int visible_channel () const { return _visible_channel; }
|
||||||
|
|
||||||
void note_mode_clicked();
|
void note_mode_clicked();
|
||||||
ARDOUR::NoteMode note_mode() const { return _note_mode; }
|
ARDOUR::NoteMode note_mode() const;
|
||||||
void set_note_mode (ARDOUR::NoteMode);
|
void note_mode_chosen (ARDOUR::NoteMode);
|
||||||
|
|
||||||
void set_trigger_start (Temporal::timepos_t const &);
|
void set_trigger_start (Temporal::timepos_t const &);
|
||||||
void set_trigger_end (Temporal::timepos_t const &);
|
void set_trigger_end (Temporal::timepos_t const &);
|
||||||
|
|
@ -213,7 +213,6 @@ class Pianoroll : public CueEditor
|
||||||
|
|
||||||
int _visible_channel;
|
int _visible_channel;
|
||||||
|
|
||||||
ARDOUR::NoteMode _note_mode;
|
|
||||||
sigc::signal<void> NoteModeChanged;
|
sigc::signal<void> NoteModeChanged;
|
||||||
|
|
||||||
void automation_state_changed ();
|
void automation_state_changed ();
|
||||||
|
|
@ -253,4 +252,5 @@ class Pianoroll : public CueEditor
|
||||||
|
|
||||||
void instant_save ();
|
void instant_save ();
|
||||||
void parameter_changed (std::string param);
|
void parameter_changed (std::string param);
|
||||||
|
void set_from_rsu (RegionUISettings&);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ RegionUISettings::RegionUISettings ()
|
||||||
, snap_mode (Editing::SnapMagnetic)
|
, snap_mode (Editing::SnapMagnetic)
|
||||||
, zoom_focus (ZoomFocusLeft)
|
, zoom_focus (ZoomFocusLeft)
|
||||||
, mouse_mode (MouseContent)
|
, mouse_mode (MouseContent)
|
||||||
|
, note_mode (ARDOUR::Sustained)
|
||||||
, x_origin (0)
|
, x_origin (0)
|
||||||
, recording_length (1, 0, 0)
|
, recording_length (1, 0, 0)
|
||||||
, width (-1)
|
, width (-1)
|
||||||
|
|
@ -65,6 +66,7 @@ RegionUISettings::get_state () const
|
||||||
node->set_property (X_("snap-mode"), snap_mode);
|
node->set_property (X_("snap-mode"), snap_mode);
|
||||||
node->set_property (X_("zoom-focus"), zoom_focus);
|
node->set_property (X_("zoom-focus"), zoom_focus);
|
||||||
node->set_property (X_("mouse-mode"), mouse_mode);
|
node->set_property (X_("mouse-mode"), mouse_mode);
|
||||||
|
node->set_property (X_("note-mode"), note_mode);
|
||||||
node->set_property (X_("x-origin"), x_origin);
|
node->set_property (X_("x-origin"), x_origin);
|
||||||
node->set_property (X_("recording_length"), recording_length);
|
node->set_property (X_("recording_length"), recording_length);
|
||||||
|
|
||||||
|
|
@ -95,6 +97,7 @@ RegionUISettings::set_state (XMLNode const & state, int)
|
||||||
state.get_property (X_("snap-mode"), snap_mode);
|
state.get_property (X_("snap-mode"), snap_mode);
|
||||||
state.get_property (X_("zoom-focus"), zoom_focus);
|
state.get_property (X_("zoom-focus"), zoom_focus);
|
||||||
state.get_property (X_("mouse-mode"), mouse_mode);
|
state.get_property (X_("mouse-mode"), mouse_mode);
|
||||||
|
state.get_property (X_("note-mode"), note_mode);
|
||||||
state.get_property (X_("x-origin"), x_origin);
|
state.get_property (X_("x-origin"), x_origin);
|
||||||
state.get_property (X_("recording_length"), recording_length);
|
state.get_property (X_("recording_length"), recording_length);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,14 @@ struct RegionUISettings
|
||||||
Editing::SnapMode snap_mode;
|
Editing::SnapMode snap_mode;
|
||||||
Editing::ZoomFocus zoom_focus;
|
Editing::ZoomFocus zoom_focus;
|
||||||
Editing::MouseMode mouse_mode;
|
Editing::MouseMode mouse_mode;
|
||||||
|
ARDOUR::NoteMode note_mode;
|
||||||
Temporal::timepos_t x_origin;
|
Temporal::timepos_t x_origin;
|
||||||
Temporal::BBT_Offset recording_length;
|
Temporal::BBT_Offset recording_length;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
/* MIDI specific */
|
/* MIDI specific */
|
||||||
|
|
||||||
Editing::GridType draw_length;
|
Editing::GridType draw_length;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue