X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui_ed.cc;h=9f6b181b4d97083e488c04082f22dfce35776534;hb=4bb517279c38102f57a22a9294b4d89b11f412d5;hp=712eb0aa3e551b5893dc9aebb19df74e4513f9a3;hpb=88688c8f5f58e5bed678e64005952edd9755e8b9;p=ardour.git diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 712eb0aa3e..9f6b181b4d 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -35,6 +35,7 @@ #include "gtkmm2ext/utils.h" #include "gtkmm2ext/window_title.h" #include "gtkmm2ext/tearoff.h" +#include "gtkmm2ext/cairo_packer.h" #include "pbd/file_utils.h" #include "pbd/fpu.h" @@ -53,6 +54,7 @@ #include "utils.h" #include "window_proxy.h" #include "global_port_matrix.h" +#include "location_ui.h" #include @@ -147,6 +149,10 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); + act = ActionManager::register_action (main_actions, X_("Rename"), _("Rename..."), sigc::mem_fun(*this, &ARDOUR_UI::rename_session)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::write_sensitive_actions.push_back (act); + act = ActionManager::register_action (main_actions, X_("SaveTemplate"), _("Save Template..."), sigc::mem_fun(*this, &ARDOUR_UI::save_template)); ActionManager::session_sensitive_actions.push_back (act); @@ -221,7 +227,7 @@ ARDOUR_UI::install_actions () act = ActionManager::register_toggle_action (common_actions, X_("KeepTearoffs"), _("Toolbars when Maximised"), mem_fun (*this, &ARDOUR_UI::toggle_keep_tearoffs)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), _("Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window)); + ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window)); ActionManager::register_toggle_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top)); ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window)); ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Properties"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_options_window)); @@ -242,7 +248,8 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::register_action (common_actions, X_("About"), _("About"), sigc::mem_fun(*this, &ARDOUR_UI::show_about)); ActionManager::register_action (common_actions, X_("Chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat)); - ActionManager::register_action (common_actions, X_("Manual"), _("Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual)); + /** TRANSLATORS: This is `Manual' in the sense of an instruction book that tells a user how to use Ardour */ + ActionManager::register_action (common_actions, X_("Manual"), S_("Help|Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual)); ActionManager::register_action (common_actions, X_("Reference"), _("Reference"), mem_fun(*this, &ARDOUR_UI::launch_reference)); ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_theme_manager)); ActionManager::register_toggle_action (common_actions, X_("ToggleKeyEditor"), _("Key Bindings"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_key_editor)); @@ -350,7 +357,7 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = ActionManager::register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(primary_clock, &AudioClock::focus)); + act = ActionManager::register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(*this, &ARDOUR_UI::focus_on_clock)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); @@ -440,12 +447,18 @@ ARDOUR_UI::install_actions () } } + /* MIDI */ + + Glib::RefPtr midi_actions = ActionGroup::create (X_("MIDI")); + ActionManager::register_action (midi_actions, X_("panic"), _("Panic"), sigc::mem_fun(*this, &ARDOUR_UI::midi_panic)); + ActionManager::add_action_group (shuttle_actions); ActionManager::add_action_group (option_actions); ActionManager::add_action_group (jack_actions); ActionManager::add_action_group (transport_actions); ActionManager::add_action_group (main_actions); ActionManager::add_action_group (common_actions); + ActionManager::add_action_group (midi_actions); } void @@ -518,29 +531,30 @@ ARDOUR_UI::build_menu_bar () // so use this instead ... gtk_settings_set_long_property (gtk_settings_get_default(), "gtk-can-change-accels", 1, "Ardour:designers"); - wall_clock_box.add (wall_clock_label); - wall_clock_box.set_name ("WallClock"); - wall_clock_label.set_name ("WallClock"); + EventBox* ev = manage (new EventBox); + ev->show (); + CairoHPacker* hbox = manage (new CairoHPacker); + hbox->show (); + hbox->set_border_width (3); - disk_space_box.add (disk_space_label); - disk_space_box.set_name ("WallClock"); - disk_space_label.set_name ("WallClock"); + VBox* vbox = manage (new VBox); + vbox->pack_start (*hbox, true, false); + vbox->show(); - cpu_load_box.add (cpu_load_label); - cpu_load_box.set_name ("CPULoad"); - cpu_load_label.set_name ("CPULoad"); + ev->add (*vbox); - buffer_load_box.add (buffer_load_label); - buffer_load_box.set_name ("BufferLoad"); + wall_clock_label.set_name ("WallClock"); + wall_clock_label.set_use_markup (); + disk_space_label.set_name ("WallClock"); + disk_space_label.set_use_markup (); + cpu_load_label.set_name ("CPULoad"); + cpu_load_label.set_use_markup (); buffer_load_label.set_name ("BufferLoad"); - - sample_rate_box.add (sample_rate_label); - sample_rate_box.set_name ("SampleRate"); + buffer_load_label.set_use_markup (); sample_rate_label.set_name ("SampleRate"); - - format_box.add (format_label); - format_box.set_name ("Format"); + sample_rate_label.set_use_markup (); format_label.set_name ("Format"); + format_label.set_use_markup (); #ifndef TOP_MENUBAR menu_hbox.pack_start (*menu_bar, false, false); @@ -548,21 +562,37 @@ ARDOUR_UI::build_menu_bar () use_menubar_as_top_menubar (); #endif + bool wall_clock = false; + bool disk_space = false; + if (!Profile->get_small_screen()) { #ifndef GTKOSX // OSX provides its own wallclock, thank you very much - menu_hbox.pack_end (wall_clock_box, false, false, 2); + wall_clock = true; #endif - menu_hbox.pack_end (disk_space_box, false, false, 4); + disk_space = true; } + + hbox->pack_end (wall_clock_label, false, false, 2); + hbox->pack_end (disk_space_label, false, false, 4); + hbox->pack_end (cpu_load_label, false, false, 4); + hbox->pack_end (buffer_load_label, false, false, 4); + hbox->pack_end (sample_rate_label, false, false, 4); + hbox->pack_end (format_label, false, false, 4); - menu_hbox.pack_end (cpu_load_box, false, false, 4); - menu_hbox.pack_end (buffer_load_box, false, false, 4); - menu_hbox.pack_end (sample_rate_box, false, false, 4); - menu_hbox.pack_end (format_box, false, false, 4); + menu_hbox.pack_end (*ev, false, false, 6); menu_bar_base.set_name ("MainMenuBar"); menu_bar_base.add (menu_hbox); + + _status_bar_visibility.add (&wall_clock_label, X_("WallClock"), _("Wall Clock"), wall_clock); + _status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), disk_space); + _status_bar_visibility.add (&cpu_load_label, X_("DSP"), _("DSP"), true); + _status_bar_visibility.add (&buffer_load_label, X_("Buffers"), _("Buffers"), true); + _status_bar_visibility.add (&sample_rate_label, X_("JACK"), _("JACK Sampling Rate and Latency"), true); + _status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true); + + ev->signal_button_press_event().connect (sigc::mem_fun (_status_bar_visibility, &VisibilityGroup::button_press_event)); } void @@ -579,21 +609,31 @@ ARDOUR_UI::use_menubar_as_top_menubar () GtkApplicationMenuGroup* group = app->add_app_menu_group (); - if ((widget = ActionManager::get_widget ("/ui/Main/Help/About"))) { + if ((widget = ActionManager::get_widget ("/ui/Main/Session/About"))) { app->add_app_menu_item (group, dynamic_cast(widget)); } - if ((widget = ActionManager::get_widget ("/ui/Main/WindowMenu/ToggleOptionsEditor"))) { + if ((widget = ActionManager::get_widget ("/ui/Main/Session/ToggleRCOptionsEditor"))) { app->add_app_menu_item (group, dynamic_cast(widget)); } app->set_menu_bar (*menu_bar); } +void +ARDOUR_UI::big_clock_catch_focus () +{ + PublicEditor::instance().reset_focus (); +} + void ARDOUR_UI::setup_clock () { - ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (big_clock, &AudioClock::set), false)); + ARDOUR_UI::Clock.connect (sigc::mem_fun (big_clock, &AudioClock::set)); + + big_clock->set_corner_radius (0.0); + big_clock->set_fixed_width (false); + big_clock->mode_changed.connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_reset_aspect_ratio)); big_clock_window->set (new Window (WINDOW_TOPLEVEL), false); @@ -603,13 +643,29 @@ ARDOUR_UI::setup_clock () big_clock_window->get()->set_title (_("Big Clock")); big_clock_window->get()->signal_realize().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_realized)); - big_clock_window->get()->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("/Common/ToggleBigClock"))); big_clock_window->get()->signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), big_clock_window->get()), false); big_clock_window->get()->signal_size_allocate().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_size_allocate)); + big_clock_window->get()->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("/Common/ToggleBigClock"))); + big_clock_window->get()->signal_unmap().connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_catch_focus)); + manage_window (*big_clock_window->get()); } +void +ARDOUR_UI::big_clock_reset_aspect_ratio () +{ + Gtk::Requisition req; + big_clock->size_request (req); + float aspect = req.width/(float)req.height; + Gdk::Geometry geom; + + geom.min_aspect = aspect; + geom.max_aspect = aspect; + + big_clock_window->get()->set_geometry_hints (*big_clock, geom, Gdk::HINT_ASPECT); +} + void ARDOUR_UI::big_clock_realized () { @@ -618,6 +674,8 @@ ARDOUR_UI::big_clock_realized () set_decoration (big_clock_window->get(), (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)); big_clock_window->get()->get_window()->get_geometry (x, y, w, big_clock_height, d); + big_clock_reset_aspect_ratio (); + original_big_clock_height = big_clock_height; original_big_clock_width = w; @@ -644,7 +702,7 @@ ARDOUR_UI::float_big_clock (Gtk::Window* parent) } void -ARDOUR_UI::big_clock_size_allocate (Gtk::Allocation&) +ARDOUR_UI::big_clock_size_allocate (Gtk::Allocation& alloc) { if (!big_clock_resize_in_progress) { Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::idle_big_clock_text_resizer), 0, 0)); @@ -710,6 +768,7 @@ ARDOUR_UI::save_ardour_state () Config->add_extra_xml (get_transport_controllable_state()); XMLNode* window_node = new XMLNode (X_("UI")); + window_node->add_property (_status_bar_visibility.get_state_name().c_str(), _status_bar_visibility.get_state_value ()); for (list::iterator i = _window_proxies.begin(); i != _window_proxies.end(); ++i) { if ((*i)->rc_configured()) { @@ -747,7 +806,9 @@ ARDOUR_UI::save_ardour_state () Config->add_extra_xml (_startup->engine_control()->get_state()); } Config->save_state(); - ui_config->save_state (); + if (ui_config->dirty()) { + ui_config->save_state (); + } XMLNode& enode (static_cast(editor)->get_state()); XMLNode& mnode (mixer->get_state()); @@ -755,9 +816,15 @@ ARDOUR_UI::save_ardour_state () if (_session) { _session->add_instant_xml (enode); _session->add_instant_xml (mnode); + if (location_ui->get ()) { + _session->add_instant_xml (location_ui->get()->ui().get_state ()); + } } else { Config->add_instant_xml (enode); Config->add_instant_xml (mnode); + if (location_ui->get ()) { + Config->add_instant_xml (location_ui->get()->ui().get_state ()); + } } Keyboard::save_keybindings (); @@ -784,3 +851,19 @@ ARDOUR_UI::toggle_global_port_matrix (ARDOUR::DataType t) } } } + +void +ARDOUR_UI::resize_text_widgets () +{ + set_size_request_to_display_given_text (cpu_load_label, "DSP: 100.0%", 2, 2); + set_size_request_to_display_given_text (buffer_load_label, "Buffers: p:100% c:100%", 2, 2); +} + +void +ARDOUR_UI::focus_on_clock () +{ + if (editor && primary_clock) { + editor->present (); + primary_clock->focus (); + } +}