X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui2.cc;h=0394d8be8cd012dc4d8be0c4813198a34182a8a6;hb=3845af6ce92ef15637ffb09410f442e7b4a104c3;hp=f3e8b6e344ed3f124ab939d1c7a41ed4fe83ae6c;hpb=3f49a43dc450bd1b35b9418fbc7c66c0a35114c9;p=ardour.git diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index f3e8b6e344..0394d8be8c 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -25,17 +25,17 @@ #include #include -#include -#include -#include +#include "pbd/error.h" +#include "pbd/basename.h" +#include "pbd/fastlog.h" #include #include #include -#include -#include -#include -#include +#include "ardour/audioengine.h" +#include "ardour/ardour.h" +#include "ardour/profile.h" +#include "ardour/route.h" #include "ardour_ui.h" #include "keyboard.h" @@ -43,7 +43,7 @@ #include "audio_clock.h" #include "actions.h" #include "utils.h" -#include "color_manager.h" +#include "theme_manager.h" #include "i18n.h" @@ -76,16 +76,56 @@ ARDOUR_UI::setup_windows () setup_transport(); build_menu_bar (); - color_manager->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("/Common/ToggleColorManager"))); + theme_manager->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("/Common/ToggleThemeManager"))); - top_packer.pack_start (menu_bar_base, false, false); - top_packer.pack_start (transport_frame, false, false); +#ifdef TOP_MENUBAR + HBox* status_bar_packer = manage (new HBox); + + status_bar_label.set_size_request (300, -1); + status_bar_packer->pack_start (status_bar_label, true, true, 6); + status_bar_packer->pack_start (error_log_button, false, false); + + error_log_button.signal_clicked().connect (mem_fun (*this, &UI::toggle_errors)); + + editor->get_status_bar_packer().pack_start (*status_bar_packer, true, true); + editor->get_status_bar_packer().pack_start (menu_bar_base, false, false, 6); +#else + top_packer.pack_start (menu_bar_base, false, false); +#endif + + top_packer.pack_start (transport_frame, false, false); editor->add_toplevel_controls (top_packer); return 0; } + void +ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr ptag, RefPtr mtag, const char *msg) +{ + ustring text; + + UI::display_message (prefix, prefix_len, ptag, mtag, msg); +#ifdef TOP_MENUBAR + + if (strcmp (prefix, _("[ERROR]: ")) == 0) { + text = ""; + } else if (strcmp (prefix, _("[WARNING]: ")) == 0) { + text = ""; + } else if (strcmp (prefix, _("[INFO]: ")) == 0) { + text = ""; + } else { + text = "???"; + } + + text += prefix; + text += ""; + text += msg; + + status_bar_label.set_markup (text); +#endif +} + void ARDOUR_UI::transport_stopped () { @@ -151,6 +191,11 @@ ARDOUR_UI::setup_transport () { transport_tearoff = manage (new TearOff (transport_tearoff_hbox)); transport_tearoff->set_name ("TransportBase"); + transport_tearoff->tearoff_window().signal_key_press_event().connect (bind (sigc::ptr_fun (relay_key_press), &transport_tearoff->tearoff_window()), false); + + if (Profile->get_sae()) { + transport_tearoff->set_can_be_torn_off (false); + } transport_hbox.pack_start (*transport_tearoff, true, false); @@ -271,11 +316,12 @@ ARDOUR_UI::setup_transport () /* clocks, etc. */ - ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), false)); - ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), false)); + ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), 'p')); + ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), 's')); primary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed)); secondary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed)); + big_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::big_clock_value_changed)); ARDOUR_UI::instance()->tooltips().set_tip (primary_clock, _("Primary clock")); ARDOUR_UI::instance()->tooltips().set_tip (secondary_clock, _("secondary clock")); @@ -326,16 +372,17 @@ ARDOUR_UI::setup_transport () speed_display_box.add (speed_display_label); speed_display_box.set_name (X_("ShuttleDisplay")); + set_size_request_to_display_given_text (speed_display_label, X_("> 24.0"), 2, 2); 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 shuttle_strings; shuttle_strings.push_back (_("sprung")); shuttle_strings.push_back (_("wheel")); - 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); @@ -345,8 +392,9 @@ 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); + // 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); @@ -358,7 +406,9 @@ ARDOUR_UI::setup_transport () transport_tearoff_hbox.pack_start (*svbox, false, false, 3); transport_tearoff_hbox.pack_start (auto_loop_button, false, false); - transport_tearoff_hbox.pack_start (play_selection_button, false, false); + if (!Profile->get_sae()) { + transport_tearoff_hbox.pack_start (play_selection_button, false, false); + } transport_tearoff_hbox.pack_start (roll_button, false, false); transport_tearoff_hbox.pack_start (stop_button, false, false); transport_tearoff_hbox.pack_start (rec_button, false, false, 6); @@ -368,12 +418,16 @@ ARDOUR_UI::setup_transport () if (!ARDOUR::Profile->get_small_screen()) { clock_box->pack_start (secondary_clock, false, false); } - VBox* time_controls_box = manage (new VBox); - time_controls_box->pack_start (sync_option_combo, false, false); - time_controls_box->pack_start (time_master_button, false, false); - clock_box->pack_start (*time_controls_box, false, false, 1); + + if (!Profile->get_sae()) { + VBox* time_controls_box = manage (new VBox); + time_controls_box->pack_start (sync_option_combo, false, false); + time_controls_box->pack_start (time_master_button, false, false); + clock_box->pack_start (*time_controls_box, false, false, 1); + } + transport_tearoff_hbox.pack_start (*clock_box, false, false, 0); - + HBox* toggle_box = manage(new HBox); VBox* punch_box = manage (new VBox); @@ -403,6 +457,11 @@ ARDOUR_UI::setup_transport () transport_tearoff_hbox.pack_start (*toggle_box, false, false, 4); transport_tearoff_hbox.pack_start (alert_box, false, false); + + if (Profile->get_sae()) { + Image* img = manage (new Image ((::get_icon (X_("sae"))))); + transport_tearoff_hbox.pack_end (*img, false, false, 6); + } } void @@ -606,7 +665,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev) shuttle_grabbed = false; shuttle_box.remove_modal_grab (); if (Config->get_shuttle_behaviour() == Sprung) { - if (Config->get_auto_play() || roll_button.get_visual_state()) { + if (session->config.get_auto_play() || roll_button.get_visual_state()) { shuttle_fract = SHUTTLE_FRACT_SPEED1; session->request_transport_speed (1.0); stop_button.set_visual_state (0); @@ -704,31 +763,45 @@ ARDOUR_UI::set_shuttle_fract (double f) void ARDOUR_UI::use_shuttle_fract (bool force) { - struct timeval now; - struct timeval diff; + microseconds_t now = get_microseconds(); /* do not attempt to submit a motion-driven transport speed request more than once per process cycle. */ - gettimeofday (&now, 0); - timersub (&now, &last_shuttle_request, &diff); - - if (!force && (diff.tv_usec + (diff.tv_sec * 1000000)) < engine->usecs_per_cycle()) { + if (!force && (last_shuttle_request - now) < (microseconds_t) engine->usecs_per_cycle()) { return; } last_shuttle_request = now; - bool neg = (shuttle_fract < 0.0); + if (Config->get_shuttle_units() == Semitones) { + + const double step = 1.0 / 24.0; // range is 24 semitones up & down + double semitones; + double speed; - double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1 + semitones = round (shuttle_fract / step); + speed = pow (2.0, (semitones / 12.0)); - if (neg) { - fract = -fract; + session->request_transport_speed (speed); + + } else { + + bool neg; + double fract; + + neg = (shuttle_fract < 0.0); + + fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1 + + if (neg) { + fract = -fract; + } + + session->request_transport_speed (shuttle_max_speed * fract); } - session->request_transport_speed (shuttle_max_speed * fract); // Formula A2 shuttle_box.queue_draw (); } @@ -799,10 +872,11 @@ ARDOUR_UI::update_speed_display () if (Config->get_shuttle_units() == Percentage) { snprintf (buf, sizeof (buf), "%.2f", x); } else { + if (x < 0) { - snprintf (buf, sizeof (buf), "< %.1f", 12.0 * fast_log2 (-x)); + snprintf (buf, sizeof (buf), "< %d", (int) round (12.0 * fast_log2 (-x))); } else { - snprintf (buf, sizeof (buf), "> %.1f", 12.0 * fast_log2 (x)); + snprintf (buf, sizeof (buf), "> %d", (int) round (12.0 * fast_log2 (x))); } } speed_display_label.set_text (buf); @@ -827,15 +901,17 @@ ARDOUR_UI::editor_realized () Config->map_parameters (mem_fun (*this, &ARDOUR_UI::parameter_changed)); 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); + reset_dpi (); } void ARDOUR_UI::sync_option_changed () { if (session) { - session->request_slave_source (string_to_slave_source (sync_option_combo.get_active_text())); + ustring txt = sync_option_combo.get_active_text (); + if (txt.length()) { + session->request_slave_source (string_to_slave_source (txt)); + } } }