Remove unused declaration.
[ardour.git] / gtk2_ardour / ardour_ui_ed.cc
index 6295400e32f3c096c6417d78cc8cd6e66a26e5a4..9f6b181b4d97083e488c04082f22dfce35776534 100644 (file)
@@ -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 <gtkmm2ext/application.h>
 
@@ -225,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));
@@ -246,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));
@@ -354,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);
 
@@ -530,39 +533,26 @@ ARDOUR_UI::build_menu_bar ()
 
        EventBox* ev = manage (new EventBox);
        ev->show ();
-       HBox* hbox = manage (new HBox);
+       CairoHPacker* hbox = manage (new CairoHPacker);
        hbox->show ();
-       
-       ev->add (*hbox);
+       hbox->set_border_width (3);
 
-       wall_clock_box.add (wall_clock_label);
-       wall_clock_box.set_name ("WallClock");
-       wall_clock_label.set_name ("WallClock");
+       VBox* vbox = manage (new VBox);
+       vbox->pack_start (*hbox, true, false);
+       vbox->show();
 
-       disk_space_box.add (disk_space_label);
-       disk_space_box.set_name ("WallClock");
+       ev->add (*vbox);
+
+       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_box.add (cpu_load_label);
-       cpu_load_box.set_name ("CPULoad");
        cpu_load_label.set_name ("CPULoad");
        cpu_load_label.set_use_markup ();
-
-       buffer_load_box.add (buffer_load_label);
-       buffer_load_box.set_name ("BufferLoad");
        buffer_load_label.set_name ("BufferLoad");
        buffer_load_label.set_use_markup ();
-
-       resize_text_widgets ();
-
-       sample_rate_box.add (sample_rate_label);
-       sample_rate_box.set_name ("SampleRate");
        sample_rate_label.set_name ("SampleRate");
        sample_rate_label.set_use_markup ();
-
-       format_box.add (format_label);
-       format_box.set_name ("Format");
        format_label.set_name ("Format");
        format_label.set_use_markup ();
 
@@ -583,24 +573,24 @@ ARDOUR_UI::build_menu_bar ()
                disk_space = true;
        }
        
-       hbox->pack_end (wall_clock_box, false, false, 2);
-       hbox->pack_end (disk_space_box, false, false, 4);
-       hbox->pack_end (cpu_load_box, false, false, 4);
-       hbox->pack_end (buffer_load_box, false, false, 4);
-       hbox->pack_end (sample_rate_box, false, false, 4);
-       hbox->pack_end (format_box, false, false, 4);
+       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 (*ev, false, false);
+       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_box,  X_("WallClock"), _("Wall Clock"), wall_clock);
-       _status_bar_visibility.add (&disk_space_box,  X_("Disk"),      _("Disk Space"), disk_space);
-       _status_bar_visibility.add (&cpu_load_box,    X_("DSP"),       _("DSP"), true);
-       _status_bar_visibility.add (&buffer_load_box, X_("Buffers"),   _("Buffers"), true);
-       _status_bar_visibility.add (&sample_rate_box, X_("JACK"),      _("JACK Sampling Rate and Latency"), true);
-       _status_bar_visibility.add (&format_box,      X_("Format"),    _("File Format"), true);
+       _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));
 }
@@ -633,7 +623,6 @@ ARDOUR_UI::use_menubar_as_top_menubar ()
 void
 ARDOUR_UI::big_clock_catch_focus ()
 {
-       cerr << "catch BC focus\n";
        PublicEditor::instance().reset_focus ();
 }
 
@@ -642,6 +631,10 @@ ARDOUR_UI::setup_clock ()
 {
        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);
 
        big_clock_window->get()->set_keep_above (true);
@@ -650,15 +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_("<Actions>/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->DropFocus.connect (sigc::mem_fun (*this, &ARDOUR_UI::big_clock_catch_focus));
+       big_clock_window->get()->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/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 ()
 {
@@ -667,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;
 
@@ -807,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 ();
@@ -843,3 +858,12 @@ 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 ();
+       }
+}