remove cruft from ArdourUI; improve keyboard icon(s); shrink other plugin GUI buttons...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 30 Oct 2008 23:45:20 +0000 (23:45 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 30 Oct 2008 23:45:20 +0000 (23:45 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4036 d708f5d6-7413-0410-9779-e7cbd77b26cf

14 files changed:
gtk2_ardour/ardour_dialog.cc
gtk2_ardour/ardour_dialog.h
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/au_pluginui.mm
gtk2_ardour/crossfade_edit.cc
gtk2_ardour/generic_pluginui.cc
gtk2_ardour/icons/computer_keyboard.png
gtk2_ardour/icons/computer_keyboard_active.png
gtk2_ardour/keyboard.cc
gtk2_ardour/plugin_ui.cc
gtk2_ardour/plugin_ui.h
gtk2_ardour/tempo_lines.cc

index bc24389948cfb993118a1fa082ed1cbfb9636f1a..decae49bd1ef2e1ad539f4c53f9f05e6d2d2d80c 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <iostream>
+#include <sigc++/bind.h>
 
 #include <gtkmm2ext/doi.h>
 
 #include "keyboard.h"
 #include "ardour_ui.h"
 #include "splash.h"
+#include "public_editor.h"
+#include "utils.h"
+
+using namespace sigc;
+using namespace Gtk;
+
+sigc::signal<void> ArdourDialog::CloseAllDialogs;
 
 ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
        : Dialog (title, modal, use_seperator)
 {
        session = 0;
 
+       CloseAllDialogs.connect (bind (mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
+
        set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
 }
 
@@ -39,6 +49,8 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool
 {
        session = 0;
 
+       CloseAllDialogs.connect (bind (mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
+
        set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
        set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
 }
@@ -80,3 +92,10 @@ ArdourDialog::on_show ()
 
        Dialog::on_show ();
 }
+
+bool
+ArdourDialog::on_key_press_event (GdkEventKey* key)
+{
+       return Gtk::Dialog::on_key_press_event (key);
+}
+
index f2859717e0ce7c88c02e1fee68ba282799c67e99..4dc35550fd1dcdb9a50ff2862c844ef5eb180cdd 100644 (file)
@@ -40,6 +40,9 @@ class ArdourDialog : public Gtk::Dialog
        ArdourDialog (Gtk::Window& parent, std::string title, bool modal = false, bool use_separator = false);
        ~ArdourDialog();
 
+       static int close_all_current_dialogs (int response);
+
+       bool on_key_press_event (GdkEventKey *);
        bool on_enter_notify_event (GdkEventCrossing*);
        bool on_leave_notify_event (GdkEventCrossing*);
        void on_unmap ();
@@ -54,6 +57,11 @@ class ArdourDialog : public Gtk::Dialog
        virtual void session_gone () {
                set_session (0);
        }
+
+       static void close_all_dialogs () { CloseAllDialogs(); }
+
+  private:
+       static sigc::signal<void> CloseAllDialogs;
 };
 
 #endif // __ardour_dialog_h__
index e97e563cede7119bf6768a4d7c9b3bea10c4be42..09ec2e7e88f5847e4a44d34547f9a5576a11ae24 100644 (file)
@@ -747,6 +747,7 @@ If you still wish to quit, please use the\n\n\
                session->set_deletion_in_progress ();
        }
 
+       ArdourDialog::close_all_dialogs ();
        engine->stop (true);
        save_ardour_state ();
        quit ();
@@ -1918,14 +1919,6 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
        }
 }
 
-gint
-ARDOUR_UI::hide_and_quit (GdkEventAny *ev, ArdourDialog *window)
-{
-       window->hide();
-       Gtk::Main::quit ();
-       return TRUE;
-}
-
 void
 ARDOUR_UI::save_template ()
 
@@ -2162,28 +2155,6 @@ ARDOUR_UI::loading_message (const std::string& msg)
        splash->message (msg);
        flush_pending ();
 }
-       
-void
-ARDOUR_UI::idle_load (const Glib::ustring& path)
-{
-       if (session) {
-               if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
-                       /* /path/to/foo => /path/to/foo, foo */
-                       load_session (path, basename_nosuffix (path));
-               } else {
-                       /* /path/to/foo/foo.ardour => /path/to/foo, foo */
-                       load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
-               }
-       } else {
-               ARDOUR_COMMAND_LINE::session_name = path;
-               if (new_session_dialog) {
-                       /* make it break out of Dialog::run() and
-                          start again.
-                        */
-                       new_session_dialog->response (1);
-               }
-       }
-}
 
 bool
 ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be_new)
index 79ab093e9db62a8cdd5ab7f060d86ae147444adf..dce32541927de01d0d150e33776e67d38bf90b46 100644 (file)
@@ -116,7 +116,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void show_about ();
        void hide_about ();
        
-       void idle_load (const Glib::ustring& path);
+       void finish();
+
        int load_session (const Glib::ustring& path, const Glib::ustring& snapshot, Glib::ustring mix_template = Glib::ustring());
        bool session_loaded;
        int build_session (const Glib::ustring& path, const Glib::ustring& snapshot, 
@@ -178,8 +179,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        void name_io_setup (ARDOUR::AudioEngine&, string&, ARDOUR::IO& io, bool in);
 
-       static gint hide_and_quit (GdkEventAny *ev, ArdourDialog *);
-
        XMLNode* editor_settings() const;
        XMLNode* mixer_settings () const;
        XMLNode* keyboard_settings () const;
@@ -300,7 +299,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void startup ();
        void shutdown ();
 
-       void finish();
        int  ask_about_saving_session (const string & why);
 
        /* periodic safety backup, to be precise */
index 967baa173700ae9c987cd09d2f418b4f979a4933..7c00d89ec12667981c95c44554664441fd179ecd 100644 (file)
@@ -195,7 +195,7 @@ ARDOUR_UI::install_actions ()
        
        common_actions = ActionGroup::create (X_("Common"));
        ActionManager::register_action (main_actions, X_("WindowMenu"), _("Window"));
-       ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (mem_fun(*this, &ARDOUR_UI::finish)));
+       ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (mem_fun(*this, &ARDOUR_UI::finish))));
 
         /* windows visibility actions */
 
index 0fc1d55dcc202164fcdc66f25fe614e38a6c8d45..a46021f66fd04cd952133b0f65ea18c61ef16a89 100644 (file)
@@ -65,16 +65,27 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
 
        /* stuff some stuff into the top of the window */
 
+       HBox* smaller_hbox = manage (new HBox);
+
+       smaller_hbox->pack_start (preset_label, false, false, 10);
+       smaller_hbox->pack_start (preset_combo, false, false);
+       smaller_hbox->pack_start (save_button, false, false);
+       smaller_hbox->pack_start (automation_mode_label, false, false);
+       smaller_hbox->pack_start (automation_mode_selector, false, false);
+       smaller_hbox->pack_start (bypass_button, false, true);
+
+       VBox* v1_box = manage (new VBox);
+       VBox* v2_box = manage (new VBox);
+
+       v1_box->pack_start (*smaller_hbox, false, true);
+       v2_box->pack_start (focus_button, false, true);
+
+       top_box.set_homogeneous (false);
        top_box.set_spacing (6);
        top_box.set_border_width (6);
 
-       top_box.pack_end (focus_button, false, true);
-       top_box.pack_end (bypass_button, false, true);
-       top_box.pack_end (automation_mode_selector, false, false);
-       top_box.pack_end (automation_mode_label, false, false);
-       top_box.pack_end (save_button, false, false);
-       top_box.pack_end (preset_combo, false, false);
-       top_box.pack_end (preset_label, false, false);
+       top_box.pack_end (*v2_box, false, false);
+       top_box.pack_end (*v1_box, false, false);
 
        set_spacing (6);
        pack_start (top_box, false, false);
index 51d5306a1e1e0cfbcbeb2fee698b99c80af4a939..c2d97d089766325f758e143fc70569c99aa86932 100644 (file)
@@ -48,6 +48,7 @@
 #include "canvas_impl.h"
 #include "simplerect.h"
 #include "waveview.h"
+#include "actions.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -98,6 +99,8 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d
        set_name ("CrossfadeEditWindow");
        set_position (Gtk::WIN_POS_MOUSE);
 
+       add_accel_group (ActionManager::ui_manager->get_accel_group());
+
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
 
        RadioButtonGroup sel_but_group = select_in_button.get_group();
index 7944fd0d28ba35f12cd86ed811484c7ebee87492..4a4ea9cf1cfcb1f9d2ade84c8a00d25858fd3292 100644 (file)
@@ -73,8 +73,6 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        set_border_width (10);
        set_homogeneous (false);
 
-       settings_box.set_homogeneous (false);
-
        HBox* constraint_hbox = manage (new HBox);
        HBox* smaller_hbox = manage (new HBox);
        Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>")));
@@ -83,15 +81,21 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        smaller_hbox->pack_start (*combo_label, false, false, 10);
        smaller_hbox->pack_start (preset_combo, false, false);
        smaller_hbox->pack_start (save_button, false, false);
+       smaller_hbox->pack_start (bypass_button, false, true);
 
        constraint_hbox->set_spacing (5);
-       constraint_hbox->pack_start (*smaller_hbox, true, false);
-       constraint_hbox->pack_end (focus_button, false, false);
-       constraint_hbox->pack_end (bypass_button, false, false);
+       constraint_hbox->set_homogeneous (false);
+       
+       VBox* v1_box = manage (new VBox);
+       VBox* v2_box = manage (new VBox);
+
+       v1_box->pack_start (*smaller_hbox, false, true);
+       v2_box->pack_start (focus_button, false, true);
 
-       settings_box.pack_end (*constraint_hbox, false, false);
+       constraint_hbox->pack_end (*v2_box, false, false);
+       constraint_hbox->pack_end (*v1_box, false, false);
 
-       pack_start (settings_box, false, false);
+       pack_start (*constraint_hbox, false, false);
 
        if ( is_scrollable ) {
                scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
@@ -107,9 +111,6 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
                pack_start (hpacker, false, false);
        }
 
-       insert->active_changed.connect (mem_fun(*this, &GenericPluginUI::redirect_active_changed));
-       bypass_button.set_active (!insert->active());
-       
        build ();
 }
 
@@ -705,14 +706,6 @@ GenericPluginUI::control_combo_changed (ControlUI* cui)
 
 }
 
-void
-GenericPluginUI::redirect_active_changed (Redirect* r, void* src)
-{
-       ENSURE_GUI_THREAD(bind (mem_fun(*this, &GenericPluginUI::redirect_active_changed), r, src));
-       
-       bypass_button.set_active (!r->active());
-}
-
 bool
 GenericPluginUI::start_updating (GdkEventAny* ignored)
 {
index 9da0109378c7c1d1d920f1ad1fc79c07fba5e3d5..8d425d0385c98b8fe963d7effe4b624ff44646c5 100644 (file)
Binary files a/gtk2_ardour/icons/computer_keyboard.png and b/gtk2_ardour/icons/computer_keyboard.png differ
index 64b704d2ea9c4bd08d3388e51ec91081a912c218..70e6b37aa02c690825da49a283e01b7608ff36be 100644 (file)
Binary files a/gtk2_ardour/icons/computer_keyboard_active.png and b/gtk2_ardour/icons/computer_keyboard_active.png differ
index a1adc5e9bae0de80d5492e4180f949404a66b799..e5fb8d8b1014fa1202852202f1bc06da3d7f5d42 100644 (file)
@@ -89,14 +89,12 @@ void
 Keyboard::magic_widget_grab_focus () 
 {
        _some_magic_widget_has_focus = true;
-       cerr << "Grabbed magic widget docus\n";
 }
 
 void
 Keyboard::magic_widget_drop_focus ()
 {
        _some_magic_widget_has_focus = false;
-       cerr << "Dropped magic widget docus\n";
 }
 
 bool
@@ -264,10 +262,20 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
                }
        }
 
-       if (event->type == GDK_KEY_RELEASE && event->keyval == GDK_w && modifier_state_equals (event->state, PrimaryModifier)) {
-               if (current_window) {
-                       current_window->hide ();
-                       current_window = 0;
+       /* Special keys that we want to handle in
+          any dialog, no matter whether it uses
+          the regular set of accelerators or not
+       */
+
+       if (event->type == GDK_KEY_RELEASE && modifier_state_equals (event->state, PrimaryModifier)) {
+               switch (event->keyval) {
+               case GDK_w:
+                       if (current_window) {
+                               current_window->hide ();
+                               current_window = 0;
+                               ret = true;
+                       }
+                       break;
                }
        }
 
index 4ac6ab8c791794d82f05c447a709fcedda64cc9f..63a2bff864900c2396fd78137a1c7ed1bfa16136 100644 (file)
@@ -342,6 +342,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
 
        bypass_button.set_name ("PluginBypassButton");
        bypass_button.signal_toggled().connect (mem_fun(*this, &PlugUIBase::bypass_toggled));
+       focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
 
        focus_button.signal_button_release_event().connect (mem_fun(*this, &PlugUIBase::focus_toggled));
        focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
@@ -352,14 +353,15 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
        focus_in_image = new Image (get_icon (X_("computer_keyboard_active")));
        
        focus_button.add (*focus_out_image);
+
        ARDOUR_UI::instance()->set_tip (&focus_button, _("Click to focus all keyboard events on this plugin window"), "");
+       ARDOUR_UI::instance()->set_tip (&bypass_button, _("Click to enable/disable this plugin"), "");
 }
 
 void
 PlugUIBase::redirect_active_changed (Redirect* r, void* src)
 {
        ENSURE_GUI_THREAD(bind (mem_fun(*this, &PlugUIBase::redirect_active_changed), r, src));
-       bypass_button.set_active (!r->active());
 }
 
 void
index 2bf55b2e0d8ccffc4b50c2fe4800407353b6f25d..c308a54095567b356cb7dd8a96e8e6815b648eda 100644 (file)
@@ -93,8 +93,8 @@ class PlugUIBase : public virtual sigc::trackable
 
        void setting_selected();
        void save_plugin_setting (void);
-       void bypass_toggled();
        bool focus_toggled(GdkEventButton*);
+       void bypass_toggled();
        void redirect_active_changed (ARDOUR::Redirect* r, void* src);
 };
 
@@ -194,8 +194,6 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
        void control_port_toggled (ControlUI* cui);
        void control_combo_changed (ControlUI* cui);
 
-       void redirect_active_changed (ARDOUR::Redirect*, void*);
-
        void astate_clicked (ControlUI*, uint32_t parameter);
        void automation_state_changed (ControlUI*);
        void set_automation_state (ARDOUR::AutoState state, ControlUI* cui);
index 716dcdb13944e2eb9106bf147eb5c9706374efb0..e8bd034a9b8831242b94e46d628fdf2b7ab97a24 100644 (file)
@@ -77,7 +77,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
        ArdourCanvas::SimpleLine *line = NULL;
        gdouble xpos;
        double who_cares;
-       double x1, x2, y1, y2, beat_density;
+       double x1, x2, y1, beat_density;
 
        uint32_t beats = 0;
        uint32_t bars = 0;