combobox width fixes from mtaht, backported from 2.X
git-svn-id: svn://localhost/ardour2/branches/3.0@4742 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a9d6d16214
commit
0697aed059
@ -189,6 +189,11 @@ 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");
|
||||
|
||||
@ -375,11 +380,12 @@ ARDOUR_UI::setup_transport ()
|
||||
shuttle_units_button.set_name (X_("ShuttleButton"));
|
||||
shuttle_units_button.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::shuttle_unit_clicked));
|
||||
|
||||
shuttle_style_button.set_name (X_("ShuttleButton"));
|
||||
shuttle_style_button.set_name (X_("ShuttleStyleButton"));
|
||||
|
||||
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);
|
||||
shuttle_style_button.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::shuttle_style_changed));
|
||||
|
||||
@ -390,8 +396,7 @@ ARDOUR_UI::setup_transport ()
|
||||
|
||||
mtc_port_changed ();
|
||||
sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
|
||||
const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
|
||||
set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 2+FUDGE, 10);
|
||||
set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+FUDGE, 10);
|
||||
|
||||
shbox->pack_start (*sdframe, false, false);
|
||||
shbox->pack_start (shuttle_units_button, true, true);
|
||||
@ -880,8 +885,7 @@ ARDOUR_UI::editor_realized ()
|
||||
|
||||
set_size_request_to_display_given_text (speed_display_box, _("-0.55"), 2, 2);
|
||||
const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
|
||||
set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10);
|
||||
cerr << "I commented out line line 881 in ardour_ui2.cc, because it made ardour crash somewhere in Gnome::Canvas::Text" << endl;
|
||||
cerr << "I commented out line line 889 in ardour_ui2.cc, because it made ardour crash somewhere in Gnome::Canvas::Text" << endl;
|
||||
//reset_dpi();
|
||||
}
|
||||
|
||||
|
@ -3079,7 +3079,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, longest (edit_mode_strings).c_str(), 2+FUDGE, 10);
|
||||
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);
|
||||
edit_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_mode_selection_done));
|
||||
|
||||
@ -3163,7 +3163,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, _("Playhead"), FUDGE, 0);
|
||||
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);
|
||||
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"));
|
||||
@ -3177,19 +3177,19 @@ 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, _("SMPTE Seconds"), 2+FUDGE, 10);
|
||||
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);
|
||||
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, _("Magnetic Snap"), 2+FUDGE, 10);
|
||||
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);
|
||||
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 ("SnapModeSelector");
|
||||
Gtkmm2ext::set_size_request_to_display_given_text (edit_point_selector, _("Playhead"), 2+FUDGE, 10);
|
||||
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);
|
||||
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"));
|
||||
|
@ -36,15 +36,22 @@ namespace Gtk {
|
||||
namespace Gtkmm2ext {
|
||||
void init ();
|
||||
|
||||
void get_ink_pixel_size (Glib::RefPtr<Pango::Layout>, int& width, int& height);
|
||||
void get_ink_pixel_size (Glib::RefPtr<Pango::Layout>,
|
||||
int& width, int& height);
|
||||
|
||||
void set_size_request_to_display_given_text (Gtk::Widget &w,
|
||||
const gchar *text,
|
||||
gint hpadding,
|
||||
gint vpadding);
|
||||
|
||||
void set_popdown_strings (Gtk::ComboBoxText&, const std::vector<std::string>&);
|
||||
|
||||
void set_size_request_to_display_given_text (Gtk::Widget &w,
|
||||
const std::vector<std::string>&,
|
||||
gint hpadding,
|
||||
gint vpadding);
|
||||
|
||||
void set_popdown_strings (Gtk::ComboBoxText&,
|
||||
const std::vector<std::string>&);
|
||||
|
||||
template<class T> void deferred_delete (void *ptr) {
|
||||
delete static_cast<T *> (ptr);
|
||||
}
|
||||
|
@ -57,6 +57,26 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *
|
||||
w.set_size_request(width + hpadding, height + vpadding);
|
||||
}
|
||||
|
||||
void
|
||||
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w,
|
||||
const std::vector<std::string>& strings,
|
||||
gint hpadding, gint vpadding)
|
||||
|
||||
{
|
||||
int width, height;
|
||||
int width_max = 0;
|
||||
int height_max = 0;
|
||||
w.ensure_style ();
|
||||
|
||||
for (vector<string>::const_iterator i = strings.begin();
|
||||
i != strings.end(); ++i) {
|
||||
get_ink_pixel_size (w.create_pango_layout (*i), width, height);
|
||||
width_max = max(width_max,width);
|
||||
height_max = max(height_max, height);
|
||||
}
|
||||
w.set_size_request(width_max + hpadding, height_max + vpadding);
|
||||
}
|
||||
|
||||
void
|
||||
Gtkmm2ext::init ()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user