diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-03-13 13:01:23 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-03-13 13:01:23 +0000 |
commit | e8185a39f29cd9ec89b5827babe7ad3b3561d96a (patch) | |
tree | ce767a3439c4aed44388be69a3d7ca120795d239 /gtk2_ardour | |
parent | 9917f30a180a33ffa9fd70d0b23174d304f4c308 (diff) |
remove icky FUDGE-ness code when sizing ComboBoxText's (from an idea by david taht)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4829 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 21 | ||||
-rw-r--r-- | gtk2_ardour/option_editor.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/option_editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/tempo_dialog.cc | 17 |
6 files changed, 18 insertions, 75 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index d37ec11593..4bd7f10dab 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -157,17 +157,19 @@ AddRouteDialog::AddRouteDialog () hbox5->pack_start (track_button, PACK_EXPAND_PADDING); hbox5->pack_start (bus_button, PACK_EXPAND_PADDING); - set_popdown_strings (channel_combo, channel_combo_strings); - set_popdown_strings (track_mode_combo, track_mode_strings); - channel_combo.set_active_text (channel_combo_strings.front()); channel_combo.set_name (X_("ChannelCountSelector")); + track_mode_combo.set_name (X_("ChannelCountSelector")); + + set_popdown_strings (channel_combo, channel_combo_strings, true); + set_popdown_strings (track_mode_combo, track_mode_strings, true); + + channel_combo.set_active_text (channel_combo_strings.front()); + track_mode_combo.set_active_text (track_mode_strings.front()); track_button.signal_clicked().connect (mem_fun (*this, &AddRouteDialog::track_type_chosen)); bus_button.signal_clicked().connect (mem_fun (*this, &AddRouteDialog::track_type_chosen)); template_button.signal_clicked().connect (mem_fun (*this, &AddRouteDialog::track_type_chosen)); - track_mode_combo.set_active_text (track_mode_strings.front()); - track_mode_combo.set_name (X_("ChannelCountSelector")); VBox* vbox1 = manage (new VBox); vbox1->set_spacing (6); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 8ace5b8236..1dabb25c4b 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -188,11 +188,6 @@ ARDOUR_UI::transport_forwarding () void ARDOUR_UI::setup_transport () { -#ifdef GTKOSX - const guint32 FUDGE = 38; // Combo's are stupid - they steal space from the entry for the button -#else - const guint32 FUDGE = 24; // Combo's are stupid - they steal space from the entry for the button -#endif transport_tearoff = manage (new TearOff (transport_tearoff_hbox)); transport_tearoff->set_name ("TransportBase"); @@ -384,8 +379,7 @@ ARDOUR_UI::setup_transport () vector<string> shuttle_strings; shuttle_strings.push_back (_("sprung")); shuttle_strings.push_back (_("wheel")); - set_size_request_to_display_given_text (shuttle_style_button, shuttle_strings, 6+FUDGE, 10); - set_popdown_strings (shuttle_style_button, shuttle_strings); + set_popdown_strings (shuttle_style_button, shuttle_strings, true); shuttle_style_button.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::shuttle_style_changed)); Frame* sdframe = manage (new Frame); @@ -395,7 +389,9 @@ ARDOUR_UI::setup_transport () mtc_port_changed (); sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed)); - set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+FUDGE, 10); + // XXX HOW TO USE set_popdown_strings() and combo_fudge with this when we don't know + // the real strings till later? + set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+COMBO_FUDGE, 10); shbox->pack_start (*sdframe, false, false); shbox->pack_start (shuttle_units_button, true, true); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index e365382331..1ab9e402c8 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2853,12 +2853,6 @@ Editor::setup_toolbar () { string pixmap_path; -#ifdef GTKOSX - const guint32 FUDGE = 38; // Combo's are stupid - they steal space from the entry for the button -#else - const guint32 FUDGE = 24; // Combo's are stupid - they steal space from the entry for the button -#endif - /* Mode Buttons (tool selection) */ vector<ToggleButton *> mouse_mode_buttons; @@ -2913,8 +2907,7 @@ Editor::setup_toolbar () edit_mode_strings.push_back (edit_mode_to_string (Lock)); edit_mode_selector.set_name ("EditModeSelector"); - Gtkmm2ext::set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, 7+FUDGE, 10); - set_popdown_strings (edit_mode_selector, edit_mode_strings); + set_popdown_strings (edit_mode_selector, edit_mode_strings, true); edit_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_mode_selection_done)); mode_box->pack_start(edit_mode_selector); @@ -2993,8 +2986,7 @@ Editor::setup_toolbar () ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to Session")); zoom_focus_selector.set_name ("ZoomFocusSelector"); - Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, 2+FUDGE, 10); - set_popdown_strings (zoom_focus_selector, zoom_focus_strings); + set_popdown_strings (zoom_focus_selector, zoom_focus_strings, true); zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done)); ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus")); @@ -3007,20 +2999,17 @@ Editor::setup_toolbar () snap_box.set_border_width (2); snap_type_selector.set_name ("SnapTypeSelector"); - Gtkmm2ext::set_size_request_to_display_given_text (snap_type_selector, snap_type_strings, 7+FUDGE, 10); - set_popdown_strings (snap_type_selector, snap_type_strings); + set_popdown_strings (snap_type_selector, snap_type_strings, true); snap_type_selector.signal_changed().connect (mem_fun(*this, &Editor::snap_type_selection_done)); ARDOUR_UI::instance()->tooltips().set_tip (snap_type_selector, _("Snap/Grid Units")); snap_mode_selector.set_name ("SnapModeSelector"); - Gtkmm2ext::set_size_request_to_display_given_text (snap_mode_selector, snap_mode_strings, 7+FUDGE, 10); - set_popdown_strings (snap_mode_selector, snap_mode_strings); + set_popdown_strings (snap_mode_selector, snap_mode_strings, true); snap_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::snap_mode_selection_done)); ARDOUR_UI::instance()->tooltips().set_tip (snap_mode_selector, _("Snap/Grid Mode")); edit_point_selector.set_name ("EditPointSelector"); - Gtkmm2ext::set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, 7+FUDGE, 10); - set_popdown_strings (edit_point_selector, edit_point_strings); + set_popdown_strings (edit_point_selector, edit_point_strings, true); edit_point_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_point_selection_done)); ARDOUR_UI::instance()->tooltips().set_tip (edit_point_selector, _("Edit point")); diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 76f209e98b..826d937f23 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -1353,35 +1353,6 @@ OptionEditor::edit_button_changed () } void -OptionEditor::fixup_combo_size (Gtk::ComboBoxText& combo, vector<string>& strings) -{ - /* find the widest string */ - - string::size_type maxlen = 0; - string maxstring; - - for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) { - string::size_type l; - - if ((l = (*i).length()) > maxlen) { - maxlen = l; - maxstring = *i; - } - } - - /* try to include ascenders and descenders */ - - if (maxstring.length() > 2) { - maxstring[0] = 'g'; - maxstring[1] = 'l'; - } - - const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button - - set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10); -} - -void OptionEditor::parameter_changed (const char* parameter_name) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &OptionEditor::parameter_changed), parameter_name)); diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 359b314cdb..ed6d752e6e 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -229,8 +229,6 @@ class OptionEditor : public ArdourDialog void edit_button_changed (); void delete_button_changed (); void bindings_changed (); - - void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings); }; #endif /* __gtk_ardour_option_editor_h__ */ diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 622045579c..7a59fe9ab0 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -82,13 +82,7 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova strings.push_back (_("sixteenth (16)")); strings.push_back (_("thirty-second (32)")); - /* the string here needs to be the longest one to display */ - const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button - // TRANSLATORS: this is not a mis-spelling of "thirty", we're including a vertical - // descender to make sure the height gets computed properly. - Gtkmm2ext::set_size_request_to_display_given_text (note_types, "thirtq-second (32)", 7+FUDGE, 15); - - set_popdown_strings (note_types, strings); + set_popdown_strings (note_types, strings, true); if (note_type==1.0f) note_types.set_active_text (_("whole (1)")); @@ -309,14 +303,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)")); - /* the string here needs to be the longest one to display */ - const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button - - // TRANSLATORS: this is not a mis-spelling of "thirty", we're including a vertical - // descender to make sure the height gets computed properly. - Gtkmm2ext::set_size_request_to_display_given_text (note_types, _("thirtq-second (32)"), 7+FUDGE, 15); - - set_popdown_strings (note_types, strings); + set_popdown_strings (note_types, strings, true); if (note_type==1.0f) note_types.set_active_text (_("whole (1)")); |