gtkmm: use set_can_focus() instead of deprecated Gtk::Widget::set_flags(CAN_FOCUS)

This commit is contained in:
Mads Kiilerich 2022-01-26 22:29:36 +01:00 committed by Robin Gareus
parent 4c3c433700
commit 7f649efd42
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
32 changed files with 49 additions and 49 deletions

View File

@ -3122,7 +3122,7 @@ ARDOUR_UI::setup_toplevel_window (Gtk::Window& window, const string& name, void*
window.set_title (title.get_string());
window.set_wmclass (string_compose (X_("%1_%1"), downcase (std::string(PROGRAM_NAME)), downcase (name)), PROGRAM_NAME);
window.set_flags (CAN_FOCUS);
window.set_can_focus ();
window.add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
/* This is a hack to ensure that GTK-accelerators continue to

View File

@ -273,7 +273,7 @@ ARDOUR_UI::set_session (Session *s)
ArdourMeter::ResetGroupPeakDisplays.connect (sigc::mem_fun(*this, &ARDOUR_UI::reset_group_peak_display));
editor_meter_peak_display.set_name ("meterbridge peakindicator");
editor_meter_peak_display.unset_flags (Gtk::CAN_FOCUS);
editor_meter_peak_display.set_can_focus (false);
editor_meter_peak_display.set_size_request (-1, std::max (5.f, std::min (12.f, rintf (8.f * UIConfiguration::instance().get_ui_scale()))) );
editor_meter_peak_display.set_corner_radius (1.0);

View File

@ -110,7 +110,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
, yscale (1.0)
{
if (editable) {
set_flags (CAN_FOCUS);
set_can_focus ();
}
_layout = Pango::Layout::create (get_pango_context());

View File

@ -195,8 +195,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (
auto_dropdown.set_name ("route button");
hide_button.set_name ("route button");
auto_dropdown.unset_flags (Gtk::CAN_FOCUS);
hide_button.unset_flags (Gtk::CAN_FOCUS);
auto_dropdown.set_can_focus (false);
hide_button.set_can_focus (false);
controls_table.set_no_show_all();

View File

@ -130,7 +130,7 @@ CANVAS_UI::CANVAS_UI (int *argcp, char **argvp[], const char* localedir)
Gtkmm2ext::WindowTitle title ("Canvas Test");
_main_window.set_title (title.get_string());
_main_window.set_flags (CAN_FOCUS);
_main_window.set_can_focus ();
_main_window.signal_delete_event().connect (sigc::mem_fun (*this, &CANVAS_UI::main_window_delete_event));

View File

@ -261,7 +261,7 @@ Editor::initialize_canvas ()
_track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK | Gdk::SCROLL_MASK | Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
_track_canvas->signal_leave_notify_event().connect (sigc::mem_fun(*this, &Editor::left_track_canvas), false);
_track_canvas->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::entered_track_canvas), false);
_track_canvas->set_flags (CAN_FOCUS);
_track_canvas->set_can_focus ();
_track_canvas->PreRender.connect (sigc::mem_fun(*this, &Editor::pre_render));

View File

@ -71,7 +71,7 @@ EditorSummary::EditorSummary (Editor* e)
{
CairoWidget::use_nsglview ();
add_events (Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
set_flags (get_flags() | Gtk::CAN_FOCUS);
set_can_focus ();
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &EditorSummary::parameter_changed));
}

View File

@ -625,7 +625,7 @@ EngineControl::build_full_control_notebook ()
row++;
input_channels.set_name ("InputChannels");
input_channels.set_flags (Gtk::CAN_FOCUS);
input_channels.set_can_focus ();
input_channels.set_digits (0);
input_channels.set_wrap (false);
output_channels.set_editable (true);
@ -638,7 +638,7 @@ EngineControl::build_full_control_notebook ()
}
output_channels.set_name ("OutputChannels");
output_channels.set_flags (Gtk::CAN_FOCUS);
output_channels.set_can_focus ();
output_channels.set_digits (0);
output_channels.set_wrap (false);
output_channels.set_editable (true);
@ -658,7 +658,7 @@ EngineControl::build_full_control_notebook ()
}
input_latency.set_name ("InputLatency");
input_latency.set_flags (Gtk::CAN_FOCUS);
input_latency.set_can_focus ();
input_latency.set_digits (0);
input_latency.set_wrap (false);
input_latency.set_editable (true);
@ -671,7 +671,7 @@ EngineControl::build_full_control_notebook ()
++row;
output_latency.set_name ("OutputLatency");
output_latency.set_flags (Gtk::CAN_FOCUS);
output_latency.set_can_focus ();
output_latency.set_digits (0);
output_latency.set_wrap (false);
output_latency.set_editable (true);

View File

@ -102,7 +102,7 @@ main (int argc, char* argv[])
eventbox.signal_event().connect (sigc::ptr_fun (print_event));
eventbox.add_events (Gdk::SCROLL_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
eventbox.set_flags (Gtk::CAN_FOCUS);
eventbox.set_can_focus ();
eventbox.show ();
window.show ();

View File

@ -405,7 +405,7 @@ FoldbackStrip::init ()
_name_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
_name_button.set_layout_ellipsize_width (PX_SCALE (_width) * PANGO_SCALE);
_send_display.set_flags (CAN_FOCUS);
_send_display.set_can_focus ();
_send_display.set_spacing (4);
_send_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
@ -523,7 +523,7 @@ FoldbackStrip::init ()
Gdk::KEY_PRESS_MASK |
Gdk::KEY_RELEASE_MASK);
set_flags (get_flags () | Gtk::CAN_FOCUS);
set_can_focus ();
signal_enter_notify_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::fb_strip_enter_event));

View File

@ -157,7 +157,7 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int
peak_display.set_events (peak_display.get_events() & ~(Gdk::EventMask (Gdk::LEAVE_NOTIFY_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::POINTER_MOTION_MASK)));
peak_display.signal_map().connect (sigc::bind (sigc::ptr_fun (reset_cursor_to_default), &peak_display));
peak_display.signal_state_changed().connect (sigc::bind (sigc::ptr_fun (reset_cursor_to_default_state), &peak_display));
peak_display.unset_flags (Gtk::CAN_FOCUS);
peak_display.set_can_focus (false);
peak_display.set_editable (false);
gain_automation_state_button.set_name ("mixer strip button");
@ -165,7 +165,7 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int
set_tooltip (gain_automation_state_button, _("Fader automation mode"));
set_tooltip (peak_display, _("dBFS - Digital Peak Hold. Click to reset."));
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.set_can_focus (false);
gain_automation_state_button.set_size_request(15, 15);
@ -176,7 +176,7 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int
set_tooltip (&meter_point_button, _("Metering point"));
meter_point_button.unset_flags (Gtk::CAN_FOCUS);
meter_point_button.set_can_focus (false);
meter_point_button.set_size_request(15, 15);
@ -924,7 +924,7 @@ GainMeter::GainMeter (Session* s, int fader_length)
set_tooltip (gain_automation_state_button, _("Fader automation mode"));
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.set_can_focus (false);
gain_automation_state_button.set_size_request (PX_SCALE(12, 15), PX_SCALE(12, 15));

View File

@ -130,7 +130,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
if (!for_auditioner) { /*auditioner is not run when it isn't auditioning; so the piano keyboard, cpu usage, and other features are not applicable */
if (pi->is_instrument ()) {
_piano = new APianoKeyboard ();
_piano->set_flags(Gtk::CAN_FOCUS);
_piano->set_can_focus ();
_piano->NoteOn.connect (sigc::mem_fun (*this, &GenericPluginUI::note_on_event_handler));
_piano->NoteOff.connect (sigc::mem_fun (*this, &GenericPluginUI::note_off_event_handler));

View File

@ -169,7 +169,7 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
peak_display.set_name ("meterbridge peakindicator");
peak_display.set_elements((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body));
set_tooltip (peak_display, _("Reset Peak"));
peak_display.unset_flags (Gtk::CAN_FOCUS);
peak_display.set_can_focus (false);
peak_display.set_size_request(PX_SCALE(12, 12), PX_SCALE(8, 8));
peak_display.set_corner_radius(2); // ardour-button scales this

View File

@ -391,7 +391,7 @@ MixerStrip::init ()
Gdk::KEY_PRESS_MASK|
Gdk::KEY_RELEASE_MASK);
set_flags (get_flags() | Gtk::CAN_FOCUS);
set_can_focus ();
/* Add the widgets under visibility control to the VisibilityGroup; the names used here
must be the same as those used in RCOptionEditor so that the configuration changes
@ -593,7 +593,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
monitor_changed ();
monitor_section_button->set_related_action (act);
set_tooltip (monitor_section_button, _("Show/Hide Monitoring Section"));
monitor_section_button->unset_flags (Gtk::CAN_FOCUS);
monitor_section_button->set_can_focus (false);
monitor_section_added_or_removed ();
}
} else {

View File

@ -147,7 +147,7 @@ Mixer_UI::Mixer_UI ()
scroller.set_can_default (true);
// set_default (scroller);
scroller_base.set_flags (Gtk::CAN_FOCUS);
scroller_base.set_can_focus ();
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
scroller_base.set_name ("MixerWindow");
scroller_base.signal_button_press_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_event));

View File

@ -486,7 +486,7 @@ MonitorSection::MonitorSection ()
signal_enter_notify_event().connect (sigc::mem_fun (*this, &MonitorSection::enter_handler));
signal_leave_notify_event().connect (sigc::mem_fun (*this, &MonitorSection::leave_handler));
set_flags (CAN_FOCUS);
set_can_focus ();
_tearoff = new TearOff (*this);
@ -694,10 +694,10 @@ MonitorSection::ChannelButtonSet::ChannelButtonSet ()
solo.set_name (X_("solo button"));
invert.set_name (X_("invert button"));
cut.unset_flags (Gtk::CAN_FOCUS);
dim.unset_flags (Gtk::CAN_FOCUS);
solo.unset_flags (Gtk::CAN_FOCUS);
invert.unset_flags (Gtk::CAN_FOCUS);
cut.set_can_focus (false);
dim.set_can_focus (false);
solo.set_can_focus (false);
invert.set_can_focus (false);
}
void

View File

@ -27,7 +27,7 @@ NoteSelectDialog::NoteSelectDialog ()
: ArdourDialog (_("Select Note"))
, _note_number(60)
{
_piano.set_flags(Gtk::CAN_FOCUS);
_piano.set_can_focus ();
_piano.show();
_piano.NoteOn.connect (sigc::mem_fun (*this, &NoteSelectDialog::note_on_event_handler));

View File

@ -39,7 +39,7 @@ PannerInterface::PannerInterface (boost::shared_ptr<Panner> p)
, _send_mode (false)
, _editor (0)
{
set_flags (Gtk::CAN_FOCUS);
set_can_focus ();
add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|
Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|

View File

@ -79,7 +79,7 @@ PannerUI::PannerUI (Session* s)
//set_size_request_to_display_given_text (pan_automation_state_button, X_("O"), 2, 2);
pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
pan_automation_state_button.set_can_focus (false);
pan_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_automation_state_button_event), false);

View File

@ -453,7 +453,7 @@ PatchChangeWidget::PatchChangeWidget (boost::shared_ptr<ARDOUR::Route> r)
_piano.NoteOn.connect (sigc::mem_fun (*this, &PatchChangeWidget::_note_on_event_handler));
_piano.NoteOff.connect (sigc::mem_fun (*this, &PatchChangeWidget::note_off_event_handler));
_piano.set_flags (Gtk::CAN_FOCUS);
_piano.set_can_focus ();
pack_start (_piano, false, false);
_audition_start_spin.set_sensitive (false);

View File

@ -1850,7 +1850,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
processor_scroller.add (processor_display);
pack_start (processor_scroller, true, true);
processor_display.set_flags (CAN_FOCUS);
processor_display.set_can_focus ();
processor_display.set_name ("ProcessorList");
processor_display.set_data ("processorbox", this);
processor_display.set_size_request (48, -1);

View File

@ -160,7 +160,7 @@ RecorderUI::RecorderUI ()
_meter_scroller.add (_meter_area);
_meter_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
_scroller_base.set_flags (CAN_FOCUS);
_scroller_base.set_can_focus ();
_scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
_scroller_base.signal_button_press_event().connect (sigc::mem_fun(*this, &RecorderUI::scroller_button_event));
_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &RecorderUI::scroller_button_event));

View File

@ -87,7 +87,7 @@ RegionEditor::RegionEditor (Session* s, boost::shared_ptr<Region> r)
ArdourWidgets::set_tooltip (audition_button, _("audition this region"));
audition_button.unset_flags (Gtk::CAN_FOCUS);
audition_button.set_can_focus (false);
audition_button.set_events (audition_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));

View File

@ -420,8 +420,8 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
_route->triggerbox ()->EmptyStatusChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_monitoring_display, this), gui_context());
}
mute_button->unset_flags (Gtk::CAN_FOCUS);
solo_button->unset_flags (Gtk::CAN_FOCUS);
mute_button->set_can_focus (false);
solo_button->set_can_focus (false);
mute_button->show();

View File

@ -473,7 +473,7 @@ SessionDialog::setup_initial_choice_box ()
/* --disable plugins UI */
_disable_plugins.set_label (_("Safe Mode: Disable all Plugins"));
_disable_plugins.set_flags (Gtk::CAN_FOCUS);
_disable_plugins.set_can_focus ();
_disable_plugins.set_relief (Gtk::RELIEF_NORMAL);
_disable_plugins.set_mode (true);
_disable_plugins.set_active (ARDOUR::Session::get_disable_all_loaded_plugins());

View File

@ -161,7 +161,7 @@ ShuttleControl::ShuttleControl ()
_hovering = false;
_ignore_change = false;
set_flags (CAN_FOCUS);
set_can_focus ();
add_events (Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK);
set_name (X_("ShuttleControl"));

View File

@ -422,7 +422,7 @@ StepEntry::StepEntry ()
length_divisor_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &StepEntry::length_value_change));
dot_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &StepEntry::dot_value_change));
_piano.set_flags (Gtk::CAN_FOCUS);
_piano.set_can_focus ();
_piano.NoteOff.connect (sigc::mem_fun (*this, &StepEntry::note_off_event_handler));
_piano.Rest.connect (sigc::mem_fun (*this, &StepEntry::rest_event_handler));

View File

@ -208,7 +208,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
Gdk::ENTER_NOTIFY_MASK|
Gdk::LEAVE_NOTIFY_MASK|
Gdk::SCROLL_MASK);
controls_ebox.set_flags (CAN_FOCUS);
controls_ebox.set_can_focus ();
/* note that this handler connects *before* the default handler */
controls_ebox.signal_scroll_event().connect (sigc::mem_fun (*this, &TimeAxisView::controls_ebox_scroll), true);

View File

@ -153,7 +153,7 @@ CANVAS_UI::CANVAS_UI (int *argcp, char **argvp[], const char* localedir)
Gtkmm2ext::WindowTitle title ("Canvas Toolbar Test");
_main_window.set_title (title.get_string());
_main_window.set_flags (CAN_FOCUS);
_main_window.set_can_focus ();
_main_window.signal_delete_event().connect (sigc::mem_fun (*this, &CANVAS_UI::main_window_delete_event));
canvas = new ArdourCanvas::GtkCanvas ();

View File

@ -98,7 +98,7 @@ TriggerPage::TriggerPage ()
/* Last item of strip packer, "+" background */
_strip_packer.pack_end (_no_strips, true, true);
_no_strips.set_flags (Gtk::CAN_FOCUS);
_no_strips.set_can_focus ();
_no_strips.add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
_no_strips.set_size_request (PX_SCALE (20), -1);
_no_strips.signal_expose_event ().connect (sigc::bind (sigc::ptr_fun (&ArdourWidgets::ArdourIcon::expose_with_text), &_no_strips, ArdourWidgets::ArdourIcon::ShadedPlusSign,

View File

@ -58,25 +58,25 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca
solo_button.set_name ("solo button");
set_tooltip (solo_button, _("Solo slaves"));
solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCATimeAxisView::solo_release), false);
solo_button.unset_flags (Gtk::CAN_FOCUS);
solo_button.set_can_focus (false);
mute_button.set_name ("mute button");
mute_button.set_text (S_("Mute|M"));
set_tooltip (mute_button, _("Mute slaves"));
mute_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCATimeAxisView::mute_release), false);
mute_button.unset_flags (Gtk::CAN_FOCUS);
mute_button.set_can_focus (false);
drop_button.set_name ("mute button");
drop_button.set_text (S_("VCA|D"));
set_tooltip (drop_button, _("Unassign all slaves"));
drop_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCATimeAxisView::drop_release), false);
drop_button.unset_flags (Gtk::CAN_FOCUS);
drop_button.set_can_focus (false);
automation_button.set_name ("route button");
automation_button.set_text (S_("RTAV|A"));
set_tooltip (automation_button, _("Automation"));
automation_button.signal_button_press_event().connect (sigc::mem_fun (*this, &VCATimeAxisView::automation_click), false);
automation_button.unset_flags (Gtk::CAN_FOCUS);
automation_button.set_can_focus (false);
mute_button.set_tweaks(ArdourButton::TrackHeader);
solo_button.set_tweaks(ArdourButton::TrackHeader);

View File

@ -49,7 +49,7 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
{
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::parameter_changed));
_piano.set_flags (Gtk::CAN_FOCUS);
_piano.set_can_focus ();
select_keyboard_layout (UIConfiguration::instance().get_vkeybd_layout ());
_piano.set_annotate_octave (true);