From 625df0912abe44912d842f1485d7d6c9a3321aef Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 26 Sep 2005 14:33:53 +0000 Subject: got ardour_dialog compiling git-svn-id: svn://localhost/trunk/ardour2@41 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/add_route_dialog.cc | 9 ++---- gtk2_ardour/add_route_dialog.h | 3 +- gtk2_ardour/ardour_dialog.cc | 66 ++++++++++++++------------------------- gtk2_ardour/ardour_dialog.h | 4 +-- gtk2_ardour/crossfade_edit.cc | 2 +- gtk2_ardour/editor.cc | 12 +++---- gtk2_ardour/editor.h | 9 +++--- gtk2_ardour/export_dialog.cc | 16 +++++----- gtk2_ardour/export_dialog.h | 27 ++++++++++------ gtk2_ardour/library_ui.cc | 2 +- gtk2_ardour/new_session_dialog.cc | 18 +++++------ gtk2_ardour/new_session_dialog.h | 7 +++-- gtk2_ardour/option_editor.cc | 58 ++++++++-------------------------- gtk2_ardour/option_editor.h | 34 +++++++++++++------- gtk2_ardour/plugin_ui.cc | 12 +++---- gtk2_ardour/plugin_ui.h | 17 ++++++++-- gtk2_ardour/tempo_dialog.cc | 2 +- gtk2_ardour/tempo_dialog.h | 12 +++++-- gtk2_ardour/utils.h | 4 +-- libs/gtkmm2ext/gtkmm2ext/utils.h | 7 ++++- libs/gtkmm2ext/utils.cc | 12 +++++++ 21 files changed, 165 insertions(+), 168 deletions(-) diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index faa527491d..0062455005 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -57,7 +57,7 @@ AddRouteDialog::AddRouteDialog () cancel_button.set_name ("AddRouteDialogButton"); routes_spinner.set_name ("AddRouteDialogSpinner"); - bus_button.set_group (track_button.group()); + bus_button.set_group (track_button.get_group()); track_button.set_active (true); HBox *hbrb = manage (new HBox); @@ -68,11 +68,8 @@ AddRouteDialog::AddRouteDialog () hbrb->pack_start (track_button, false, false); hbrb->pack_start (bus_button, false, false); - channel_combo.set_popdown_strings (channel_combo_strings); - channel_combo.set_value_in_list (true, false); + set_popdown_strings (channel_combo, channel_combo_strings); channel_combo.set_name (X_("ChannelCountSelector")); - channel_combo.get_entry()->set_name (X_("ChannelCountSelector")); - channel_combo.get_popwin()->set_name (X_("ChannelCountSelector")); VBox *vbcc = manage (new VBox); @@ -114,7 +111,7 @@ AddRouteDialog::AddRouteDialog () add (*vb2); - delete_event.connect (mem_fun(*this, &ArdourDialog::wm_close_event)); + // delete_event.connect (mem_fun(*this, &ArdourDialog::wm_close_event)); ok_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 0)); cancel_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1)); } diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index 3db8772859..6a2aea7871 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -33,7 +34,7 @@ class AddRouteDialog : public ArdourDialog Gtk::RadioButton bus_button; Gtk::Adjustment routes_adjustment; Gtk::SpinButton routes_spinner; - Gtk::Combo channel_combo; + Gtk::ComboBoxText channel_combo; }; #endif /* __gtk_ardour_add_route_dialog_h__ */ diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index 1755214bd8..a5604fbbdb 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -27,7 +27,7 @@ ArdourDialog::ArdourDialog (string name) - : Gtk::Window (GTK_WINDOW_TOPLEVEL), + : Dialog (name), KeyboardTarget (*this, name) { session = 0; @@ -42,7 +42,7 @@ ArdourDialog::~ArdourDialog () { } -gint +bool ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev) { if (ev->detail != GDK_NOTIFY_INFERIOR) { @@ -51,7 +51,7 @@ ArdourDialog::on_enter_notify_event (GdkEventCrossing *ev) return FALSE; } -gint +bool ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev) { if (ev->detail != GDK_NOTIFY_INFERIOR) { @@ -60,13 +60,13 @@ ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev) return FALSE; } -gint -ArdourDialog:on_unmap (GdkEventAny *ev) +void +ArdourDialog::on_unmap () { _within_hiding = true; - Hiding (); /* EMIT_SIGNAL */ + Hiding (); /* EMIT_SIGNAL */ _within_hiding = false; - return Gtk::Window::on_unmap (ev); + Dialog::on_unmap (); } void @@ -76,37 +76,6 @@ ArdourDialog::wm_close() ARDOUR_UI::instance()->allow_focus(false); } -void -ArdourDialog::wm_doi () -{ - if (!hide_on_stop) { - Hiding (); /* EMIT_SIGNAL */ - } - stop (-1); - delete_when_idle (this); -} - -gint -ArdourDialog::wm_close_event (GdkEventAny* ev) -{ - wm_close (); - return TRUE; -} - -gint -ArdourDialog::wm_doi_event (GdkEventAny* ev) -{ - wm_doi (); - return TRUE; -} - -gint -ArdourDialog::wm_doi_event_stop (GdkEventAny* ev) -{ - stop (-1); - return TRUE; -} - void ArdourDialog::set_hide_on_stop (bool yn) { @@ -126,8 +95,6 @@ ArdourDialog::close () void ArdourDialog::stop (int rr) { - _run_status = rr; - if (hide_on_stop) { Hiding (); /* EMIT_SIGNAL */ hide_all (); @@ -138,7 +105,11 @@ ArdourDialog::stop (int rr) } if (running) { - Gtk::Main::quit (); + if (rr == 0) { + response (GTK_RESPONSE_ACCEPT); + } else { + response (GTK_RESPONSE_CANCEL); + } running = false; } } @@ -153,7 +124,18 @@ ArdourDialog::run () } running = true; - Gtk::Main::run (); + switch (Dialog::run ()) { + case GTK_RESPONSE_ACCEPT: + _run_status = 0; + break; + + case GTK_RESPONSE_DELETE_EVENT: + _run_status = -1; + break; + + default: + _run_status = -1; + } } void diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index becacdccbf..eb2b57b1d2 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -34,7 +34,7 @@ namespace ARDOUR { * same mechanism to declare its closing, and to have a common * method of connecting and disconnecting from a Session. */ -class ArdourDialog : public Gtk::Window, public KeyboardTarget +class ArdourDialog : public Gtk::Dialog, public KeyboardTarget { public: ArdourDialog (string name); @@ -51,7 +51,7 @@ class ArdourDialog : public Gtk::Window, public KeyboardTarget bool on_enter_notify_event (GdkEventCrossing*); bool on_leave_notify_event (GdkEventCrossing*); - bool on_unmap (GdkEventAny *); + void on_unmap (); ARDOUR::Session *session; diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 5c9485fef2..a3fcec148c 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -101,7 +101,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, Crossfade& xf, double my, double m add (vpacker); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::POINTER_MOTION_MASK); - select_out_button.set_group (select_in_button.group()); + select_out_button.set_group (select_in_button.get_group()); select_out_button.set_mode (false); select_in_button.set_mode (false); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 97d6a8f90d..e7a4df47fb 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3130,8 +3130,7 @@ Editor::setup_toolbar () /* XXX another disgusting hack because of the way combo boxes size themselves */ Gtkmm2ext::set_size_request_to_display_given_text (*edit_mode_selector.get_entry(), "EdgtMode", 2, 10); - edit_mode_selector.set_popdown_strings (internationalize (edit_mode_strings)); - edit_mode_selector.set_value_in_list (true, false); + set_popdown_string (edit_mode_selector, internationalize (edit_mode_strings)); edit_mode_box.pack_start (edit_mode_label, false, false); edit_mode_box.pack_start (edit_mode_selector, false, false); @@ -3153,8 +3152,7 @@ Editor::setup_toolbar () const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button Gtkmm2ext::set_size_request_to_display_given_text (*snap_type_selector.get_entry(), "Region bounds", 2+FUDGE, 10); - snap_type_selector.set_popdown_strings (internationalize (snap_type_strings)); - snap_type_selector.set_value_in_list (true, false); + set_popdown_strings (snap_type_selector, internationalize (snap_type_strings)); snap_type_box.pack_start (snap_type_label, false, false); snap_type_box.pack_start (snap_type_selector, false, false); @@ -3173,8 +3171,7 @@ Editor::setup_toolbar () snap_mode_box.set_border_width (3); Gtkmm2ext::set_size_request_to_display_given_text (*snap_mode_selector.get_entry(), "SngpMode", 2, 10); - snap_mode_selector.set_popdown_strings (internationalize (snap_mode_strings)); - snap_mode_selector.set_value_in_list (true, false); + set_popdown_strings (snap_mode_selector, internationalize (snap_mode_strings)); snap_mode_box.pack_start (snap_mode_label, false, false); snap_mode_box.pack_start (snap_mode_selector, false, false); @@ -3195,8 +3192,7 @@ Editor::setup_toolbar () /* XXX another disgusting hack because of the way combo boxes size themselves */ Gtkmm2ext::set_size_request_to_display_given_text (*zoom_focus_selector.get_entry(), "Edgt Cursor", 2, 10); - zoom_focus_selector.set_popdown_strings (internationalize (zoom_focus_strings)); - zoom_focus_selector.set_value_in_list (true, false); + set_popdown_strings (zoom_focus_selector, internationalize (zoom_focus_strings)); zoom_focus_box.pack_start (zoom_focus_label, false, false); zoom_focus_box.pack_start (zoom_focus_selector, false, false); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 6e7f47b920..722dda8a6b 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -1360,25 +1361,25 @@ class Editor : public PublicEditor Gtk::Button automation_mode_button; Gtk::ToggleButton global_automation_button; - Gtk::Combo edit_mode_selector; + Gtk::ComboBoxText edit_mode_selector; Gtk::Label edit_mode_label; Gtk::VBox edit_mode_box; gint edit_mode_selection_done (GdkEventAny*); - Gtk::Combo snap_type_selector; + Gtk::ComboBoxText snap_type_selector; Gtk::Label snap_type_label; Gtk::VBox snap_type_box; gint snap_type_selection_done (GdkEventAny*); - Gtk::Combo snap_mode_selector; + Gtk::ComboBoxText snap_mode_selector; Gtk::Label snap_mode_label; Gtk::VBox snap_mode_box; gint snap_mode_selection_done (GdkEventAny*); - Gtk::Combo zoom_focus_selector; + Gtk::ComboBoxText zoom_focus_selector; Gtk::Label zoom_focus_label; Gtk::VBox zoom_focus_box; diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 5f2365cdce..1dbe582246 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -230,14 +230,14 @@ ExportDialog::ExportDialog(PublicEditor& e, AudioRegion* r) file_frame.set_border_width (5); file_frame.set_name (FRAME_NAME); - sample_rate_combo.set_popdown_strings (internationalize(sample_rates)); - src_quality_combo.set_popdown_strings (internationalize (src_qualities)); - dither_type_combo.set_popdown_strings (internationalize (dither_types)); - channel_count_combo.set_popdown_strings (internationalize (channel_strings)); - header_format_combo.set_popdown_strings (internationalize ((const char **) sndfile_header_formats_strings)); - bitdepth_format_combo.set_popdown_strings (internationalize ((const char **) sndfile_bitdepth_formats_strings)); - endian_format_combo.set_popdown_strings (internationalize ((const char **) sndfile_endian_formats_strings)); - cue_file_combo.set_popdown_strings (internationalize (cue_file_types)); + set_popdown_strings (sample_rate_combo, internationalize(sample_rates)); + set_popdown_strings (src_quality_combo, internationalize (src_qualities)); + set_popdown_strings (dither_type_combo, internationalize (dither_types)); + set_popdown_strings (channel_count_combo, internationalize (channel_strings)); + set_popdown_strings (header_format_combo, internationalize ((const char **) sndfile_header_formats_strings)); + set_popdown_strings (bitdepth_format_combo, internationalize ((const char **) sndfile_bitdepth_formats_strings)); + set_popdown_strings (endian_format_combo, internationalize ((const char **) sndfile_endian_formats_strings)); + set_popdown_strings (cue_file_combo, internationalize (cue_file_types)); /* this will re-sensitized as soon as a non RIFF/WAV header format is chosen. diff --git a/gtk2_ardour/export_dialog.h b/gtk2_ardour/export_dialog.h index f7be550ebf..256fe867ac 100644 --- a/gtk2_ardour/export_dialog.h +++ b/gtk2_ardour/export_dialog.h @@ -20,7 +20,16 @@ #ifndef __ardour_export_dialog_h__ #define __ardour_export_dialog_h__ -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include "ardour_dialog.h" @@ -57,21 +66,21 @@ class ExportDialog : public ArdourDialog Gtk::Frame format_frame; Gtk::Label sample_rate_label; - Gtk::Combo sample_rate_combo; + Gtk::ComboBoxText sample_rate_combo; Gtk::Label src_quality_label; - Gtk::Combo src_quality_combo; + Gtk::ComboBoxText src_quality_combo; Gtk::Label dither_type_label; - Gtk::Combo dither_type_combo; + Gtk::ComboBoxText dither_type_combo; Gtk::Label cue_file_label; - Gtk::Combo cue_file_combo; + Gtk::ComboBoxText cue_file_combo; Gtk::Label channel_count_label; - Gtk::Combo channel_count_combo; + Gtk::ComboBoxText channel_count_combo; Gtk::Label header_format_label; - Gtk::Combo header_format_combo; + Gtk::ComboBoxText header_format_combo; Gtk::Label bitdepth_format_label; - Gtk::Combo bitdepth_format_combo; + Gtk::ComboBoxText bitdepth_format_combo; Gtk::Label endian_format_label; - Gtk::Combo endian_format_combo; + Gtk::ComboBoxText endian_format_combo; Gtk::CheckButton cuefile_only_checkbox; Gtk::Frame file_frame; diff --git a/gtk2_ardour/library_ui.cc b/gtk2_ardour/library_ui.cc index e3afc50547..a020cbb277 100644 --- a/gtk2_ardour/library_ui.cc +++ b/gtk2_ardour/library_ui.cc @@ -1302,7 +1302,7 @@ SearchSounds::SearchSounds () add(main_box); - or_rbtn.set_group(and_rbtn.group()); + or_rbtn.set_group(and_rbtn.get_group()); or_rbtn.set_active(true); rbtn_box.set_homogeneous(true); rbtn_box.pack_start(and_rbtn); diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index 71bde7fb86..d17d5d3015 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -103,8 +103,8 @@ NewSessionDialog::NewSessionDialog (ARDOUR::AudioEngine& engine, bool startup, s use_master_button.set_active (true); use_master_button.set_name ("NewSessionDialogButton"); - connect_to_physical_outputs_button.set_group (connect_to_master_button.group()); - manual_connect_outputs_button.set_group (connect_to_master_button.group()); + connect_to_physical_outputs_button.set_group (connect_to_master_button.get_group()); + manual_connect_outputs_button.set_group (connect_to_master_button.get_group()); connect_to_master_button.set_active (true); connect_to_physical_outputs_button.set_name ("NewSessionDialogButton"); @@ -115,19 +115,15 @@ NewSessionDialog::NewSessionDialog (ARDOUR::AudioEngine& engine, bool startup, s out_count_adjustment.set_value (engine.n_physical_outputs()); in_count_adjustment.set_value (engine.n_physical_inputs()); - control_out_channel_combo.set_popdown_strings (channel_combo_strings); + set_popdown_strings (control_out_channel_combo, channel_combo_strings); control_out_channel_combo.set_name (X_("NewSessionChannelCombo")); - control_out_channel_combo.get_entry()->set_name (X_("NewSessionChannelCombo")); - control_out_channel_combo.get_popwin()->set_name (X_("NewSessionChannelCombo")); // use stereo as default - control_out_channel_combo.get_list()->select_item (1); + control_out_channel_combo.set_active_text (channel_combo_strings.front()); - master_out_channel_combo.set_popdown_strings (channel_combo_strings); + set_popdown_strings (master_out_channel_combo, channel_combo_strings); master_out_channel_combo.set_name (X_("NewSessionChannelCombo")); - master_out_channel_combo.get_entry()->set_name (X_("NewSessionChannelCombo")); - master_out_channel_combo.get_popwin()->set_name (X_("NewSessionChannelCombo")); // use stereo as default - master_out_channel_combo.get_list()->select_item (1); + master_out_channel_combo.set_active_text (channel_combo_strings.front()); out_table.set_col_spacings (7); @@ -327,7 +323,7 @@ NewSessionDialog::reset_templates () templates.clear (); templates.push_back (_("No template - create tracks/busses manually")); Session::get_template_list (templates); - template_combo.set_popdown_strings (templates); + set_popdown_strings (template_combo, templates); } string diff --git a/gtk2_ardour/new_session_dialog.h b/gtk2_ardour/new_session_dialog.h index c83f585add..9d0762bc73 100644 --- a/gtk2_ardour/new_session_dialog.h +++ b/gtk2_ardour/new_session_dialog.h @@ -6,6 +6,7 @@ #include #include #include +#include namespace Gtk { class CList; @@ -26,8 +27,8 @@ class NewSessionDialog : public ArdourDialog NewSessionDialog (ARDOUR::AudioEngine&, bool startup, std::string path); Gtkmm2ext::NewSaveDialog file_selector; - Gtk::Combo control_out_channel_combo; - Gtk::Combo master_out_channel_combo; + Gtk::ComboBoxText control_out_channel_combo; + Gtk::ComboBoxText master_out_channel_combo; Gtk::CheckButton use_control_button; Gtk::CheckButton use_master_button; Gtk::CheckButton connect_to_physical_inputs_button; @@ -72,7 +73,7 @@ class NewSessionDialog : public ArdourDialog Gtk::Button expansion_button; Gtk::Table out_table; Gtk::CheckButton show_again; - Gtk::Combo template_combo; + Gtk::ComboBoxText template_combo; list templates; Gtk::SpinButton in_count_spinner; Gtk::SpinButton out_count_spinner; diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index f2a4453719..86b1a0e232 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -349,7 +349,7 @@ OptionEditor::set_session (Session *s) if (session->mtc_port()) { dumb.push_back (positional_sync_strings[Session::MTC]); } - slave_type_combo.set_popdown_strings (dumb); + set_popdown_strings (slave_type_combo, dumb); // meter stuff if (session->meter_falloff() == 0.0f) { @@ -426,10 +426,7 @@ OptionEditor::setup_path_options() vector nfstrings = internationalize (native_format_strings); - native_format_combo.set_popdown_strings (nfstrings), - native_format_combo.get_entry()->set_editable (false); - native_format_combo.get_entry()->set_name ("OptionsEntry"); - native_format_combo.set_use_arrows_always (true); + set_popdown_strings (native_format_combo, nfstrings); native_format_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::native_format_chosen)); fixup_combo_size (native_format_combo, nfstrings); @@ -489,12 +486,8 @@ OptionEditor::setup_fade_options () dumb.push_back (lmode_strings[Session::LaterHigher]); dumb.push_back (lmode_strings[Session::MoveAddHigher]); dumb.push_back (lmode_strings[Session::AddHigher]); - layer_mode_combo.set_popdown_strings (dumb); + set_popdown_strings (layer_mode_combo, dumb); - layer_mode_combo.set_use_arrows_always (true); - layer_mode_combo.set_value_in_list (true, false); - layer_mode_combo.get_entry()->set_editable (false); - layer_mode_combo.get_entry()->set_name ("OptionsEntry"); layer_mode_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::layer_mode_chosen)); fixup_combo_size (layer_mode_combo, layer_mode_strings); @@ -511,12 +504,8 @@ OptionEditor::setup_fade_options () dumb.clear (); dumb.push_back (xfade_model_strings[FullCrossfade]); dumb.push_back (xfade_model_strings[ShortCrossfade]); - xfade_model_combo.set_popdown_strings (dumb); + set_popdown_strings (xfade_model_combo, dumb); - xfade_model_combo.set_use_arrows_always (true); - xfade_model_combo.set_value_in_list (true, false); - xfade_model_combo.get_entry()->set_editable (false); - xfade_model_combo.get_entry()->set_name ("OptionsEntry"); xfade_model_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::xfade_model_chosen)); fixup_combo_size (xfade_model_combo, xfade_model_strings); @@ -714,11 +703,7 @@ OptionEditor::setup_display_options () dumb.push_back (_("Short")); dumb.push_back (_("Medium")); dumb.push_back (_("Long")); - meter_hold_combo.set_popdown_strings (dumb); - meter_hold_combo.set_use_arrows_always (true); - meter_hold_combo.set_value_in_list (true, false); - meter_hold_combo.get_entry()->set_editable (false); - meter_hold_combo.get_entry()->set_name ("OptionsEntry"); + set_popdown_strings (meter_hold_combo, dumb); meter_hold_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::meter_hold_chosen)); hbox = manage (new HBox); hbox->set_border_width (8); @@ -737,11 +722,7 @@ OptionEditor::setup_display_options () dumb.push_back (_("Fast")); dumb.push_back (_("Faster")); dumb.push_back (_("Fastest")); - meter_falloff_combo.set_popdown_strings (dumb); - meter_falloff_combo.set_use_arrows_always (true); - meter_falloff_combo.set_value_in_list (true, false); - meter_falloff_combo.get_entry()->set_editable (false); - meter_falloff_combo.get_entry()->set_name ("OptionsEntry"); + set_popdown_strings (meter_falloff_combo, dumb); meter_falloff_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::meter_falloff_chosen)); hbox = manage (new HBox); hbox->set_border_width (8); @@ -863,11 +844,7 @@ OptionEditor::setup_sync_options () dumb.push_back (X_("30 FPS drop")); dumb.push_back (X_("30 FPS non-drop")); - smpte_fps_combo.set_popdown_strings (dumb); - smpte_fps_combo.set_use_arrows_always (true); - smpte_fps_combo.set_value_in_list (true, false); - smpte_fps_combo.get_entry()->set_editable (false); - smpte_fps_combo.get_entry()->set_name ("OptionsEntry"); + set_popdown_strings (smpte_fps_combo, dumb); smpte_fps_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen)); smpte_offset_clock.set_mode (AudioClock::SMPTE); @@ -1147,7 +1124,7 @@ OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioB if (session->mtc_port()) { dumb.push_back (positional_sync_strings[Session::MTC]); } - slave_type_combo.set_popdown_strings (dumb); + set_popdown_strings (slave_type_combo, dumb); rb->set_active (true); } @@ -1689,8 +1666,8 @@ OptionEditor::setup_misc_options() connect_box->set_spacing (3); connect_box->set_border_width (8); - auto_connect_output_manual_button.set_group (auto_connect_output_master_button.group()); - auto_connect_output_physical_button.set_group (auto_connect_output_master_button.group()); + auto_connect_output_manual_button.set_group (auto_connect_output_master_button.get_group()); + auto_connect_output_physical_button.set_group (auto_connect_output_master_button.get_group()); Gtk::HBox* useless_box = manage (new HBox); useless_box->pack_start (auto_connect_inputs_button, false, false); @@ -1871,10 +1848,7 @@ OptionEditor::setup_keyboard_options () dumb.push_back (_(modifiers[i].name)); } - edit_modifier_combo.set_popdown_strings (dumb); - edit_modifier_combo.get_entry()->set_editable (false); - edit_modifier_combo.get_entry()->set_name ("OptionsEntry"); - edit_modifier_combo.set_use_arrows_always (true); + set_popdown_strings (edit_modifier_combo, dumb); edit_modifier_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen)); for (int x = 0; modifiers[x].name; ++x) { @@ -1901,10 +1875,7 @@ OptionEditor::setup_keyboard_options () edit_button_adjustment.set_value (Keyboard::edit_button()); edit_button_adjustment.value_changed.connect (mem_fun(*this, &OptionEditor::edit_button_changed)); - delete_modifier_combo.set_popdown_strings (dumb); - delete_modifier_combo.get_entry()->set_editable (false); - delete_modifier_combo.get_entry()->set_name ("OptionsEntry"); - delete_modifier_combo.set_use_arrows_always (true); + set_popdown_strings (delete_modifier_combo, dumb); delete_modifier_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen)); for (int x = 0; modifiers[x].name; ++x) { @@ -1931,10 +1902,7 @@ OptionEditor::setup_keyboard_options () delete_button_adjustment.set_value (Keyboard::delete_button()); delete_button_adjustment.value_changed.connect (mem_fun(*this, &OptionEditor::delete_button_changed)); - snap_modifier_combo.set_popdown_strings (dumb); - snap_modifier_combo.get_entry()->set_editable (false); - snap_modifier_combo.get_entry()->set_name ("OptionsEntry"); - snap_modifier_combo.set_use_arrows_always (true); + set_popdown_strings (snap_modifier_combo, dumb); snap_modifier_combo.get_popwin()->unmap_event.connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen)); for (int x = 0; modifiers[x].name; ++x) { diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index c4a51b9ad5..0a6595f8f2 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -21,7 +21,17 @@ #ifndef __gtk_ardour_option_editor_h__ #define __gtk_ardour_option_editor_h__ -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -68,7 +78,7 @@ class OptionEditor : public ArdourDialog Gtk::Entry session_raid_entry; - Gtk::Combo native_format_combo; + Gtk::ComboBoxText native_format_combo; void setup_path_options(); void add_session_paths (); @@ -84,9 +94,9 @@ class OptionEditor : public ArdourDialog Gtk::CheckButton auto_xfade_button; Gtk::CheckButton xfade_active_button; Gtk::Label layer_mode_label; - Gtk::Combo layer_mode_combo; + Gtk::ComboBoxText layer_mode_combo; Gtk::Label xfade_model_label; - Gtk::Combo xfade_model_combo; + Gtk::ComboBoxText xfade_model_combo; Gtk::Adjustment short_xfade_adjustment; Gtk::HScale short_xfade_slider; @@ -116,8 +126,8 @@ class OptionEditor : public ArdourDialog Gtk::CheckButton mixer_strip_width_button; Gtk::CheckButton show_measures_button; Gtk::CheckButton follow_playhead_button; - Gtk::Combo meter_hold_combo; - Gtk::Combo meter_falloff_combo; + Gtk::ComboBoxText meter_hold_combo; + Gtk::ComboBoxText meter_falloff_combo; void setup_display_options(); void show_waveforms_clicked (); @@ -137,8 +147,8 @@ class OptionEditor : public ArdourDialog Gtk::CheckButton send_mtc_button; Gtk::CheckButton send_mmc_button; Gtk::CheckButton jack_time_master_button; - Gtk::Combo slave_type_combo; - Gtk::Combo smpte_fps_combo; + Gtk::ComboBoxText slave_type_combo; + Gtk::ComboBoxText smpte_fps_combo; AudioClock smpte_offset_clock; Gtk::CheckButton smpte_offset_negative_button; @@ -224,9 +234,9 @@ class OptionEditor : public ArdourDialog /* keyboard/mouse */ Gtk::Table keyboard_mouse_table; - Gtk::Combo edit_modifier_combo; - Gtk::Combo delete_modifier_combo; - Gtk::Combo snap_modifier_combo; + Gtk::ComboBoxText edit_modifier_combo; + Gtk::ComboBoxText delete_modifier_combo; + Gtk::ComboBoxText snap_modifier_combo; Gtk::Adjustment delete_button_adjustment; Gtk::SpinButton delete_button_spin; Gtk::Adjustment edit_button_adjustment; @@ -274,7 +284,7 @@ class OptionEditor : public ArdourDialog void debug_keyboard_clicked (); void speed_quieten_clicked (); - void fixup_combo_size (Gtk::Combo&, vector& strings); + void fixup_combo_size (Gtk::ComboBox&, vector& strings); }; #endif /* __gtk_ardour_option_editor_h__ */ diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index aa966ae453..b0137fc3be 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -475,8 +475,8 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, MIDI::Contr control_ui->combo = new Gtk::Combo; control_ui->combo->set_value_in_list(true, false); - control_ui->combo->set_popdown_strings(setup_scale_values(port_index, control_ui)); - control_ui->combo->get_popwin()->unmap_event.connect(bind (mem_fun(*this, &PluginUI::control_combo_changed), control_ui)); + set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); + control_ui->combo->get_popwin()->unmap_event, un(*this, &PluginUI::control_combo_changed), control_ui)); plugin.ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); @@ -872,8 +872,8 @@ PlugUIBase::PlugUIBase (PluginInsert& pi) combo.set_value_in_list(true,true); combo.set_use_arrows(true); combo.set_use_arrows_always(true); - combo.set_popdown_strings(plugin.get_presets()); - combo.get_entry()->set_text(""); + set_popdown_strings (combo, plugin.get_presets()); + combo.set_active_text (""); combo.get_popwin()->unmap_event.connect(mem_fun(*this, &PlugUIBase::setting_selected)); save_button.set_name ("PluginSaveButton"); @@ -914,8 +914,8 @@ PlugUIBase::save_plugin_setting () if (name.length()) { if(plugin.save_preset(name)){ - combo.set_popdown_strings(plugin.get_presets()); - combo.get_entry()->set_text(name); + set_popdown_strings (combo, plugin.get_presets()); + combo.set_active_text (name); } } } diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index afa419d93c..c10dc26232 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -27,7 +27,18 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -66,7 +77,7 @@ class PlugUIBase : public sigc::trackable protected: ARDOUR::PluginInsert& insert; ARDOUR::Plugin& plugin; - Gtk::Combo combo; + Gtk::ComboBoxText combo; Gtk::Button save_button; Gtk::ToggleButton bypass_button; @@ -139,7 +150,7 @@ class PluginUI : public PlugUIBase, public Gtk::VBox /* input */ Gtk::Adjustment* adjustment; - Gtk::Combo* combo; + Gtk::ComboBoxText* combo; std::map* combo_map; Gtk::ToggleButton* button; Gtkmm2ext::BarController* control; diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index f0ad928aa5..9e2a9aafe8 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -183,7 +183,7 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova strings.push_back (_("sixteenth (16)")); strings.push_back (_("thirty-second (32)")); - note_types.set_popdown_strings (strings); + set_popdown_strings (note_types, strings); if (note_type==1.0f) note_types.get_entry()->set_text(_("whole (1)")); diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index f287147aa2..df30e9b799 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -1,7 +1,15 @@ #ifndef __ardour_gtk_tempo_dialog_h__ #define __ardour_gtk_tempo_dialog_h__ -#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -38,7 +46,7 @@ struct TempoDialog : public ArdourDialog struct MeterDialog : public ArdourDialog { Gtk::Entry bpb_entry; - Gtk::Combo note_types; + Gtk::ComboBoxText note_types; vector strings; Gtk::Frame note_frame; Gtk::Frame bpb_frame; diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 3dd777f524..b844e0eb30 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -30,7 +30,7 @@ namespace Gtk { class Window; - class Combo; + class ComboBoxText; class Paned; } @@ -65,7 +65,7 @@ unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h); GnomeCanvasPoints* get_canvas_points (std::string who, uint32_t npoints); -int channel_combo_get_channel_count (Gtk::Combo& combo); +int channel_combo_get_channel_count (Gtk::ComboBoxText& combo); std::string get_font_for_style (std::string widgetname); gint pane_handler (GdkEventButton*, Gtk::Paned*); diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index 7dd6b2ad9d..57cbe7dda5 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -21,7 +21,10 @@ #ifndef __gtkmm2ext_utils_h__ #define __gtkmm2ext_utils_h__ -#include +#include +#include +#include +#include namespace Gtkmm2ext { void init (); @@ -30,6 +33,8 @@ namespace Gtkmm2ext { const gchar *text, gint hpadding, gint vpadding); + + void set_popdown_strings (Gtk::ComboBoxText&, std::vector&); template void deferred_delete (void *ptr) { delete static_cast (ptr); diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 54b6c7d987..df4e510df8 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -20,9 +20,12 @@ #include #include +#include #include "i18n.h" +using namespace std; + void Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *text, gint hpadding, gint vpadding) @@ -45,3 +48,12 @@ Gtkmm2ext::init () (void) bindtextdomain(PACKAGE, LOCALEDIR); } +void +Gtkmm2ext::set_popdown_strings (Gtk::ComboBoxText& cr, vector& strings) +{ + cr.clear (); + + for (vector::iterator i = strings.begin(); i != strings.end(); ++i) { + cr.append_text (*i); + } +} -- cgit v1.2.3