X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Futils.cc;h=a8b46f1f57853496f91d028ce831208b2e5961ae;hb=cf61fb07b80fafd76275eacdddddf78522caf42e;hp=0e9ca9f19060a54a75f4ceeec0ef02f246f19ef5;hpb=045ef69ac37550cf376d40443555a57a931fe7b0;p=ardour.git diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 0e9ca9f190..a8b46f1f57 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -63,6 +64,10 @@ using Gtkmm2ext::Keyboard; sigc::signal DPIReset; +#ifdef PLATFORM_WINDOWS +#define random() rand() +#endif + /** Add an element to a menu, settings its sensitivity. * @param m Menu to add to. @@ -345,12 +350,11 @@ relay_key_press (GdkEventKey* ev, Gtk::Window* win) { PublicEditor& ed (PublicEditor::instance()); - if (&ed == 0) { - /* early key press in pre-main-window-dialogs, no editor yet */ - return false; - } - if (!key_press_focus_accelerator_handler (*win, ev)) { + if (&ed == 0) { + /* early key press in pre-main-window-dialogs, no editor yet */ + return false; + } return ed.on_key_press_event(ev); } else { return true; @@ -568,7 +572,7 @@ get_xpm (std::string name) { if (!xpm_map[name]) { - SearchPath spath(ARDOUR::ardour_data_search_path()); + Searchpath spath(ARDOUR::ardour_data_search_path()); spath.add_subdirectory_to_paths("pixmaps"); @@ -594,7 +598,7 @@ get_icon_path (const char* cname) string name = cname; name += X_(".png"); - SearchPath spath(ARDOUR::ardour_data_search_path()); + Searchpath spath(ARDOUR::ardour_data_search_path()); spath.add_subdirectory_to_paths("icons"); @@ -741,7 +745,9 @@ set_pango_fontsize () /* FT2 rendering - used by GnomeCanvas, sigh */ +#ifndef PLATFORM_WINDOWS pango_ft2_font_map_set_resolution ((PangoFT2FontMap*) pango_ft2_font_map_new(), val/1024, val/1024); +#endif /* Cairo rendering, in case there is any */ @@ -842,3 +848,15 @@ unique_random_color (list& used_colors) /* XXX need throttle here to make sure we don't spin for ever */ } } + +string +rate_as_string (float r) +{ + char buf[32]; + if (fmod (r, 1000.0f)) { + snprintf (buf, sizeof (buf), "%.1f kHz", r/1000.0); + } else { + snprintf (buf, sizeof (buf), "%.0f kHz", r/1000.0); + } + return buf; +}