Skip to content

Commit

Permalink
use icon for cue editor sound selected MIDI notes button and make it …
Browse files Browse the repository at this point in the history
…sensitive to the UIConfig parameter, and active
  • Loading branch information
pauldavisthefirst committed Jan 3, 2025
1 parent ed54b8e commit 9139b07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gtk2_ardour/editing_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ EditingContext::EditingContext (std::string const & name)
, _grid_type (GridTypeBeat)
, _snap_mode (SnapOff)
, _timeline_origin (0.)
, play_note_selection_button (_("Ear"), ArdourButton::Text, true)
, play_note_selection_button (ArdourButton::default_elements)
, follow_playhead_button (_("F"), ArdourButton::Text, true)
, full_zoom_button (_("<->"), ArdourButton::Text)
, visible_channel_label (_("MIDI|Channel"))
Expand Down Expand Up @@ -233,6 +233,9 @@ EditingContext::EditingContext (std::string const & name)

Config->ParameterChanged.connect (parameter_connections, MISSING_INVALIDATOR, std::bind (&EditingContext::parameter_changed, this, _1), gui_context());
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &EditingContext::ui_parameter_changed));

std::function<void (string)> pc (std::bind (&EditingContext::ui_parameter_changed, this, _1));
UIConfiguration::instance().map_parameters (pc);
}

EditingContext::~EditingContext()
Expand All @@ -242,7 +245,12 @@ EditingContext::~EditingContext()
void
EditingContext::ui_parameter_changed (string parameter)
{
if (parameter == "sound-midi-note") {
if (parameter == "sound-midi-notes") {
if (UIConfiguration::instance().get_sound_midi_notes()) {
play_note_selection_button.set_active_state (Gtkmm2ext::ExplicitActive);
} else {
play_note_selection_button.set_active_state (Gtkmm2ext::Off);
}
}
}

Expand Down Expand Up @@ -2777,6 +2785,7 @@ EditingContext::choose_canvas_cursor_on_entry (ItemType type)
void
EditingContext::play_note_selection_clicked ()
{
UIConfiguration::instance().set_sound_midi_notes (!UIConfiguration::instance().get_sound_midi_notes());
}

void
Expand Down
2 changes: 2 additions & 0 deletions gtk2_ardour/midi_cue_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ MidiCueEditor::build_upper_toolbar ()
set_tooltip (note_mode_button, _("Toggle between drum and regular note drawing"));
note_mode_button.set_icon (ArdourIcon::Drum);

play_note_selection_button.set_icon (ArdourIcon::ToolAudition);

#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
note_mode_button.set_size_request (PX_SCALE(50), -1);
note_mode_button.set_active_color (UIConfiguration::instance().color ("alert:yellow"));
Expand Down

0 comments on commit 9139b07

Please sign in to comment.