size-based scrolling and right-click pages for editor notebook
[ardour.git] / gtk2_ardour / ardour_ui_dialogs.cc
index 93efa57110c9c71faba7771265fca5f2847ed39e..1a0ba6618f6f8361a241fd132082f138c61e9dd4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <ardour/session.h>
 
+#include "actions.h"
 #include "ardour_ui.h"
 #include "connection_editor.h"
 #include "location_ui.h"
@@ -37,6 +38,7 @@
 #include "i18n.h"
 
 using namespace ARDOUR;
+using namespace Glib;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 
@@ -49,37 +51,11 @@ ARDOUR_UI::connect_to_session (Session *s)
 
        /* sensitize menu bar options that are now valid */
 
-//     save_as_item->set_sensitive (true);
-       save_template_item->set_sensitive (true);
-       snapshot_item->set_sensitive (true);
-       save_item->set_sensitive (true);
-       add_track_item->set_sensitive (true);
-       export_item->set_sensitive (true);
-       close_item->set_sensitive (true);
-       locations_dialog_check->set_sensitive (true);
-       route_params_check->set_sensitive (true);
-       connection_editor_check->set_sensitive (true);
-
-       cleanup_item->set_sensitive (true);
-
-       /* sensitize transport bar */
-
-       goto_start_button.set_sensitive (true);
-       goto_end_button.set_sensitive (true);
-       roll_button.set_sensitive (true);
-       stop_button.set_sensitive (true);
-       play_selection_button.set_sensitive (true);
+       ActionManager::set_sensitive (ActionManager::session_sensitive_actions, true);
+
        rec_button.set_sensitive (true);
-       auto_loop_button.set_sensitive (true);
        shuttle_box.set_sensitive (true);
        
-       /* <CMT Additions> */
-       if (image_compositor_item) {
-               image_compositor_item->set_sensitive(true) ;
-       }
-       /* </CMT Additions> */
-       
-
        if (session->n_diskstreams() == 0) {
                session->DiskStreamAdded.connect (mem_fun(*this, &ARDOUR_UI::diskstream_added));
        }
@@ -166,30 +142,9 @@ ARDOUR_UI::unload_session ()
        point_one_second_connection.disconnect ();
        point_zero_one_second_connection.disconnect();
 
-       /* desensitize menu bar options that are now invalid */
-
-//     save_as_item->set_sensitive (false);
-       save_template_item->set_sensitive (false);
-       snapshot_item->set_sensitive (false);
-       save_item->set_sensitive (false);
-       add_track_item->set_sensitive (false);
-       export_item->set_sensitive (false);
-       close_item->set_sensitive (false);
-       connection_editor_check->set_sensitive (false);
-       locations_dialog_check->set_sensitive (false);
-       connection_editor_check->set_active(false);
-       locations_dialog_check->set_active(false);
-       route_params_check->set_sensitive (false);
-
-       /* desensitize transport bar */
-
-       goto_start_button.set_sensitive (false);
-       goto_end_button.set_sensitive (false);
-       roll_button.set_sensitive (false);
-       stop_button.set_sensitive (false);
-       play_selection_button.set_sensitive (false);
+       ActionManager::set_sensitive (ActionManager::session_sensitive_actions, false);
+       
        rec_button.set_sensitive (false);
-       auto_loop_button.set_sensitive (false);
        shuttle_box.set_sensitive (false);
 
        stop_blinking ();
@@ -226,13 +181,12 @@ int
 ARDOUR_UI::create_connection_editor ()
 {
        if (connection_editor == 0) {
-               // GTK2FIX
-               // connection_editor = new ConnectionEditor ();
-               // connection_editor->signal_unmap().connect (mem_fun(*this, &ARDOUR_UI::connection_editor_hiding));
+//             connection_editor = new ConnectionEditor ();
+//             connection_editor->signal_unmap().connect (sigc::bind (ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleConnections")));
        }
 
        if (session) {
-               // connection_editor->set_session (session);
+//             connection_editor->set_session (session);
        }
 
        return 0;
@@ -256,25 +210,13 @@ ARDOUR_UI::toggle_connection_editor ()
 #endif
 }
 
-void
-ARDOUR_UI::connection_editor_hiding()
-{
-       //GTK2FIX
-       // connection_editor_check->set_active(false);
-}
-
-void
-ARDOUR_UI::big_clock_hiding()
-{
-       big_clock_check->set_active(false);
-}
-
 void
 ARDOUR_UI::toggle_big_clock_window ()
 {
        if (big_clock_window->is_visible()) {
                big_clock_window->hide ();
        } else {
+               big_clock_window->show_all ();
                big_clock_window->present ();
        }
 }
@@ -284,7 +226,7 @@ ARDOUR_UI::toggle_options_window ()
 {
        if (option_editor == 0) {
                option_editor = new OptionEditor (*this, *editor, *mixer);
-               option_editor->signal_unmap().connect(mem_fun(*this, &ARDOUR_UI::option_hiding));
+               option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleOptionsEditor")));
                option_editor->set_session (session);
        } 
 
@@ -295,12 +237,6 @@ ARDOUR_UI::toggle_options_window ()
        }
 }
 
-void
-ARDOUR_UI::option_hiding ()
-{
-       options_window_check->set_active(false);
-}
-
 void
 ARDOUR_UI::toggle_auto_input ()
 
@@ -316,8 +252,8 @@ ARDOUR_UI::create_location_ui ()
        if (location_ui == 0) {
                location_ui = new LocationUI ();
                location_ui->set_session (session);
-               location_ui->signal_unmap().connect (mem_fun(*this, &ARDOUR_UI::location_ui_hiding));
-       } 
+               location_ui->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleLocations")));
+       }
        return 0;
 }
 
@@ -335,19 +271,13 @@ ARDOUR_UI::toggle_location_window ()
        }
 }
 
-void
-ARDOUR_UI::location_ui_hiding()
-{
-       locations_dialog_check->set_active(false);
-}
-
 int
 ARDOUR_UI::create_route_params ()
 {
        if (route_params == 0) {
                route_params = new RouteParams_UI (*engine);
                route_params->set_session (session);
-               route_params->signal_unmap().connect (mem_fun(*this, &ARDOUR_UI::route_params_hiding));
+               route_params->signal_unmap().connect (sigc::bind(sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleInspector")));
        }
        return 0;
 }
@@ -365,22 +295,33 @@ ARDOUR_UI::toggle_route_params_window ()
                route_params->present ();
        }
 }
-       
-void
-ARDOUR_UI::route_params_hiding ()
+
+int
+ARDOUR_UI::create_sound_file_browser ()
 {
-       route_params_check->set_active (false);
+       if (sfdb == 0) {
+               sfdb = new SoundFileBrowser (_("Sound File Browser"));
+               sfdb->set_session (session);
+               sfdb->signal_unmap().connect (sigc::bind(sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleSoundFileBrowser")));
+       }
+       return 0;
 }
-
+       
 void
 ARDOUR_UI::toggle_sound_file_browser ()
 {
-       if (sfdb_check->get_active()) {
-               SoundFileBrowser sfdb(_("Sound File Browser"));
+       if (create_sound_file_browser()) {
+               return;
+       }
 
-               sfdb_check->signal_toggled().connect (bind (mem_fun (sfdb, &Gtk::Dialog::response), Gtk::RESPONSE_CANCEL));
-               sfdb.run();
-               sfdb_check->set_active(false);
+       RefPtr<Action> act = ActionManager::ui_manager->get_action (X_("<Actions>/Common/ToggleSoundFileBrowser"));
+       if (act) {
+               RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+       
+               if (tact->get_active()) {
+                       sfdb->present();
+               } else {
+                       sfdb->hide ();
+               }
        }
 }
-