mouse_mode_button_box->pack_start (mouse_audition_button);
mouse_mode_button_box->pack_start (internal_edit_button);
- vector<string> edit_mode_strings;
edit_mode_strings.push_back (edit_mode_to_string (Slide));
if (!Profile->get_sae()) {
edit_mode_strings.push_back (edit_mode_to_string (Splice));
toolbar_frame.set_shadow_type (SHADOW_OUT);
toolbar_frame.set_name ("BaseFrame");
toolbar_frame.add (toolbar_base);
+
+ DPIReset.connect (sigc::mem_fun (*this, &Editor::resize_text_widgets));
}
void
void
Editor::edit_mode_selection_done ()
{
- Config->set_edit_mode (string_to_edit_mode (edit_mode_selector.get_active_text ()));
+ string s = edit_mode_selector.get_active_text ();
+
+ if (!s.empty()) {
+ Config->set_edit_mode (string_to_edit_mode (s));
+ }
}
void
return *manage (a->create_menu_item ());
}
+void
+Editor::resize_text_widgets ()
+{
+ set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, COMBO_FUDGE+10, 15);
+ set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, COMBO_FUDGE+10, 15);
+ set_size_request_to_display_given_text (snap_type_selector, snap_type_strings, COMBO_FUDGE+10, 15);
+ set_size_request_to_display_given_text (snap_mode_selector, snap_mode_strings, COMBO_FUDGE+10, 15);
+ set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, COMBO_FUDGE+10, 15);
+}
+
Gtk::ComboBoxText edit_mode_selector;
Gtk::VBox edit_mode_box;
+ std::vector<std::string> edit_mode_strings;
void set_edit_mode (ARDOUR::EditMode);
void cycle_edit_mode ();
void set_canvas_cursor_for_region_view (double, RegionView *);
MouseCursors* _cursors;
+
+ void resize_text_widgets ();
friend class Drag;
friend class RegionDrag;
class Adjustment;
}
+extern sigc::signal<void> DPIReset;
+
std::string fit_to_pixels (const std::string&, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses = false);
std::pair<std::string, double> fit_to_pixels (cairo_t *, std::string, double);
int width_max = 0;
int height_max = 0;
w.ensure_style ();
+ vector<string> copy;
+ const vector<string>* to_use;
+ vector<string>::const_iterator i;
+
+ for (i = strings.begin(); i != strings.end(); ++i) {
+ if ((*i).find_first_of ("gy") != string::npos) {
+ /* contains a descender */
+ break;
+ }
+ }
+
+ if (i == strings.end()) {
+ /* make a copy of the strings then add one that has a descener */
+ copy = strings;
+ copy.push_back ("g");
+ to_use = ©
+ } else {
+ to_use = &strings;
+ }
- for (vector<string>::const_iterator i = strings.begin(); i != strings.end(); ++i) {
+ for (vector<string>::const_iterator i = to_use->begin(); i != to_use->end(); ++i) {
get_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);
}
cr.clear ();
if (set_size) {
- vector<string> copy;
-
- for (i = strings.begin(); i != strings.end(); ++i) {
- if ((*i).find_first_of ("gy") != string::npos) {
- /* contains a descender */
- break;
- }
- }
-
- if (i == strings.end()) {
-
- /* make a copy of the strings then add one that has a descener */
-
- copy = strings;
- copy.push_back ("g");
- set_size_request_to_display_given_text (cr, copy, COMBO_FUDGE+10+hpadding, 15+vpadding);
-
- } else {
- set_size_request_to_display_given_text (cr, strings, COMBO_FUDGE+10+hpadding, 15+vpadding);
- }
+ set_size_request_to_display_given_text (cr, strings, COMBO_FUDGE+10+hpadding, 15+vpadding);
}
for (i = strings.begin(); i != strings.end(); ++i) {