add theme files to default target, and install using target names
[ardour.git] / gtk2_ardour / ardour_ui_ed.cc
index fa047d65d0829cc319e9f53f864a62dc3211dac0..41665cffbbd71799e3ec3c438c5263d90895a26e 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 /* This file contains any ARDOUR_UI methods that require knowledge of
 */
 
 #include <pbd/pathscanner.h>
+#include <pbd/fpu.h>
+
+#include <glibmm/miscutils.h>
 
 #include <gtkmm2ext/utils.h>
+#include <gtkmm2ext/window_title.h>
 
 #include "ardour_ui.h"
 #include "public_editor.h"
@@ -35,6 +38,7 @@
 #include "actions.h"
 
 #include <ardour/session.h>
+#include <ardour/profile.h>
 #include <ardour/audioengine.h>
 #include <ardour/control_protocol_manager.h>
 
@@ -55,7 +59,7 @@ ARDOUR_UI::create_editor ()
 
 {
        try {
-               editor = new Editor (*engine);
+               editor = new Editor ();
        }
 
        catch (failed_constructor& err) {
@@ -76,7 +80,6 @@ ARDOUR_UI::install_actions ()
        /* menus + submenus that need action items */
 
        ActionManager::register_action (main_actions, X_("Session"), _("Session"));
-       ActionManager::register_action (main_actions, X_("Export"), _("Export"));
        ActionManager::register_action (main_actions, X_("Cleanup"), _("Cleanup"));
        ActionManager::register_action (main_actions, X_("Sync"), _("Sync"));
        ActionManager::register_action (main_actions, X_("Options"), _("Options"));
@@ -87,24 +90,27 @@ ARDOUR_UI::install_actions ()
        ActionManager::register_action (main_actions, X_("AudioFileFormatHeader"), _("Header"));
        ActionManager::register_action (main_actions, X_("AudioFileFormatData"), _("Data"));
        ActionManager::register_action (main_actions, X_("ControlSurfaces"), _("Control Surfaces"));
+       ActionManager::register_action (main_actions, X_("Plugins"), _("Plugins"));
        ActionManager::register_action (main_actions, X_("Metering"), _("Metering"));
        ActionManager::register_action (main_actions, X_("MeteringFallOffRate"), _("Fall off rate"));
        ActionManager::register_action (main_actions, X_("MeteringHoldTime"), _("Hold Time"));
+       ActionManager::register_action (main_actions, X_("Denormals"), _("Denormal Handling"));
 
        /* the real actions */
 
-       act = ActionManager::register_action (main_actions, X_("New"), _("New"),  bind (mem_fun(*this, &ARDOUR_UI::new_session), string ()));
+       act = ActionManager::register_action (main_actions, X_("New"), _("New"),  hide_return (bind (mem_fun(*this, &ARDOUR_UI::new_session), string ())));
 
        ActionManager::register_action (main_actions, X_("Open"), _("Open"),  mem_fun(*this, &ARDOUR_UI::open_session));
        ActionManager::register_action (main_actions, X_("Recent"), _("Recent"),  mem_fun(*this, &ARDOUR_UI::open_recent_session));
        act = ActionManager::register_action (main_actions, X_("Close"), _("Close"),  mem_fun(*this, &ARDOUR_UI::close_session));
        ActionManager::session_sensitive_actions.push_back (act);
 
-       act = ActionManager::register_action (main_actions, X_("AddTrackBus"), _("Add Track/Bus"),  mem_fun(*this, &ARDOUR_UI::add_route));
+       act = ActionManager::register_action (main_actions, X_("AddTrackBus"), _("Add Track/Bus"),  
+                                             bind (mem_fun(*this, &ARDOUR_UI::add_route), (Gtk::Window*) 0));
        ActionManager::session_sensitive_actions.push_back (act);
 
        
-       /* <CMT Additions> */
+#ifdef WITH_CMT
 
        PathScanner scanner;
        vector<string*>* results = scanner (getenv ("PATH"), "AniComp", false, false);
@@ -117,7 +123,7 @@ ARDOUR_UI::install_actions ()
                delete results;
        }
 
-       /* </CMT Additions> */
+#endif
 
        act = ActionManager::register_action (main_actions, X_("Snapshot"), _("Snapshot"),  mem_fun(*this, &ARDOUR_UI::snapshot_session));
        ActionManager::session_sensitive_actions.push_back (act);
@@ -198,13 +204,17 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_toggle_action (common_actions, X_("ToggleBigClock"), _("Big Clock"), mem_fun(*this, &ARDOUR_UI::toggle_big_clock_window));
        ActionManager::session_sensitive_actions.push_back (act);
-       ActionManager::register_action (common_actions, X_("About"), _("About"),  mem_fun(*this, &ARDOUR_UI::show_splash));
-       act = ActionManager::register_toggle_action (common_actions, X_("ToggleColorManager"), _("Colors"), mem_fun(*this, &ARDOUR_UI::toggle_color_manager));
-       
+       act = ActionManager::register_action (common_actions, X_("About"), _("About"),  mem_fun(*this, &ARDOUR_UI::show_splash));
+       act = ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), mem_fun(*this, &ARDOUR_UI::toggle_theme_manager));
+       ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (common_actions, X_("AddAudioTrack"), _("Add Audio Track"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_track), 1, 1, ARDOUR::Normal, 1));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (common_actions, X_("AddAudioBus"), _("Add Audio Bus"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_bus), 1, 1, 1));
        ActionManager::session_sensitive_actions.push_back (act);
+       act = ActionManager::register_action (common_actions, X_("AddMIDITrack"), _("Add MIDI Track"), bind (mem_fun(*this, &ARDOUR_UI::session_add_midi_track), 1));
+       ActionManager::session_sensitive_actions.push_back (act);
+       //act = ActionManager::register_action (common_actions, X_("AddMidiBus"), _("Add Midi Bus"), mem_fun(*this, &ARDOUR_UI::session_add_midi_bus));
+       //ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (common_actions, X_("Save"), _("Save"),  bind (mem_fun(*this, &ARDOUR_UI::save_state), string("")));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (common_actions, X_("RemoveLastCapture"), _("Remove Last Capture"), mem_fun(*this, &ARDOUR_UI::remove_last_capture));
@@ -390,16 +400,43 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_toggle_action (option_actions, X_("SendMIDIfeedback"), _("Send MIDI feedback"), mem_fun (*this, &ARDOUR_UI::toggle_send_midi_feedback));
        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (option_actions, X_("UseMIDIcontrol"), _("Use MIDI control"), mem_fun (*this, &ARDOUR_UI::toggle_use_midi_control));
-       ActionManager::session_sensitive_actions.push_back (act);
+
+       act = ActionManager::register_toggle_action (option_actions, X_("UseOSC"), _("Use OSC"), mem_fun (*this, &ARDOUR_UI::toggle_use_osc));
+#ifndef HAVE_LIBLO
+       act->set_sensitive (false);
+#endif
 
        ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport));
        ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture));
+       ActionManager::register_toggle_action (option_actions, X_("PeriodicSafetyBackups"), _("Make periodic safety backups"), mem_fun (*this, &ARDOUR_UI::toggle_PeriodicSafetyBackups));
        ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun));
        ActionManager::register_toggle_action (option_actions, X_("StopTransportAtEndOfSession"), _("Stop transport at session end"), mem_fun (*this, &ARDOUR_UI::toggle_StopTransportAtEndOfSession));
        ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport));
        ActionManager::register_toggle_action (option_actions, X_("LatchedRecordEnable"), _("Rec-enable stays engaged at stop"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedRecordEnable));
        ActionManager::register_toggle_action (option_actions, X_("RegionEquivalentsOverlap"), _("Region equivalents overlap"), mem_fun (*this, &ARDOUR_UI::toggle_RegionEquivalentsOverlap));
+       ActionManager::register_toggle_action (option_actions, X_("PrimaryClockDeltaEditCursor"), _("Primary Clock delta to edit cursor"), mem_fun (*this, &ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor));
+       ActionManager::register_toggle_action (option_actions, X_("SecondaryClockDeltaEditCursor"), _("Secondary Clock delta to edit cursor"), mem_fun (*this, &ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor));      
+
+       RadioAction::Group denormal_group;
+
+       ActionManager::register_toggle_action (option_actions, X_("DenormalProtection"), _("Use DC bias"), mem_fun (*this, &ARDOUR_UI::toggle_denormal_protection));
+       
+       FPU fpu;
+
+       ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalNone"), _("No processor handling"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalNone));
+
+       act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZ"), _("Use FlushToZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZ));
+       if (!fpu.has_flush_to_zero()) {
+               act->set_sensitive (false);
+       }
+       act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalDAZ"), _("Use DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalDAZ));
+       if (!fpu.has_denormals_are_zero()) {
+               act->set_sensitive (false);
+       }
+       act = ActionManager::register_radio_action (option_actions, denormal_group, X_("DenormalFTZDAZ"), _("Use FlushToZero & DenormalsAreZero"), bind (mem_fun (*this, &ARDOUR_UI::set_denormal_model), DenormalFTZDAZ));
+       if (!fpu.has_flush_to_zero() || !fpu.has_denormals_are_zero()) {
+               act->set_sensitive (false);
+       }
 
        act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording));
        ActionManager::session_sensitive_actions.push_back (act);
@@ -409,6 +446,11 @@ ARDOUR_UI::install_actions ()
        act = ActionManager::register_toggle_action (option_actions, X_("ShowSoloMutes"), _("Show solo muting"), mem_fun (*this, &ARDOUR_UI::toggle_ShowSoloMutes));
        ActionManager::session_sensitive_actions.push_back (act);
 
+       act = ActionManager::register_action (option_actions, X_("DisableAllPlugins"), _("Disable All Plugins"), mem_fun (*this, &ARDOUR_UI::disable_all_plugins));
+       ActionManager::session_sensitive_actions.push_back (act);
+       act = ActionManager::register_action (option_actions, X_("ABAllPlugins"), _("A/B All Plugins"), mem_fun (*this, &ARDOUR_UI::ab_all_plugins));
+       ActionManager::session_sensitive_actions.push_back (act);
+
        /* !!! REMEMBER THAT RADIO ACTIONS HAVE TO BE HANDLED WITH MORE FINESSE THAN SIMPLE TOGGLES !!! */
 
        RadioAction::Group meter_falloff_group;
@@ -440,6 +482,7 @@ ARDOUR_UI::install_actions ()
 
        act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormatFloat"), X_("32-bit floating point"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatFloat));
        act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat24bit"), X_("24-bit signed integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt24));
+       act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat16bit"), X_("16-bit signed integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt16));
 
        RadioAction::Group monitoring_group;
 
@@ -470,6 +513,15 @@ ARDOUR_UI::install_actions ()
        act = ActionManager::register_radio_action (option_actions, output_auto_connect_group, X_("OutputAutoConnectManual"), _("Manually connect outputs"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_output_auto_connect), (AutoConnectOption) 0)));
        ActionManager::session_sensitive_actions.push_back (act);
 
+       RadioAction::Group remote_group;
+
+       act = ActionManager::register_radio_action (option_actions, remote_group, X_("RemoteUserDefined"), _("Remote ID assigned by User"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_remote_model), UserOrdered)));
+       ActionManager::session_sensitive_actions.push_back (act);
+       act = ActionManager::register_radio_action (option_actions, remote_group, X_("RemoteMixerDefined"), _("Remote ID follows order of Mixer"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_remote_model), MixerOrdered)));
+       ActionManager::session_sensitive_actions.push_back (act);
+       act = ActionManager::register_radio_action (option_actions, remote_group, X_("RemoteEditorDefined"), _("Remote ID follows order of Editor"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_remote_model), EditorOrdered)));
+       ActionManager::session_sensitive_actions.push_back (act);
+
        ActionManager::add_action_group (shuttle_actions);
        ActionManager::add_action_group (option_actions);
        ActionManager::add_action_group (jack_actions);
@@ -658,8 +710,11 @@ ARDOUR_UI::build_menu_bar ()
         * until the Menu GObject class is registered, which happens
         * when the first menu instance is created.
         */
-       Gtk::Settings::get_default()->property_gtk_can_change_accels() = true;  
-       
+       // XXX bug in gtkmm causes this to popup an error message
+       // Gtk::Settings::get_default()->property_gtk_can_change_accels() = true;       
+       // 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");
@@ -681,11 +736,13 @@ ARDOUR_UI::build_menu_bar ()
        sample_rate_label.set_name ("SampleRate");
 
        menu_hbox.pack_start (*menu_bar, true, true);
-       menu_hbox.pack_end (wall_clock_box, false, false, 10);
-       menu_hbox.pack_end (disk_space_box, false, false, 10);
-       menu_hbox.pack_end (cpu_load_box, false, false, 10);
-       menu_hbox.pack_end (buffer_load_box, false, false, 10);
-       menu_hbox.pack_end (sample_rate_box, false, false, 10);
+       if (!Profile->get_small_screen()) {
+               menu_hbox.pack_end (wall_clock_box, false, false, 2);
+               menu_hbox.pack_end (disk_space_box, 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_bar_base.set_name ("MainMenuBar");
        menu_bar_base.add (menu_hbox);
@@ -700,7 +757,10 @@ ARDOUR_UI::setup_clock ()
        
        big_clock_window->set_border_width (0);
        big_clock_window->add  (big_clock);
-       big_clock_window->set_title (_("ardour: clock"));
+
+       WindowTitle title(Glib::get_application_name());
+       title += _("Clock");
+       big_clock_window->set_title (title.get_string());
        big_clock_window->set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU);
        big_clock_window->signal_realize().connect (bind (sigc::ptr_fun (set_decoration), big_clock_window,  (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
        big_clock_window->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBigClock")));