remove cruft from ArdourUI; improve keyboard icon(s); shrink other plugin GUI buttons; close all dialogs when quitting so that we actually quit

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4036 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-10-30 23:45:20 +00:00
parent 2fab8c2737
commit 040d7fec2c
14 changed files with 82 additions and 71 deletions

View File

@ -18,6 +18,7 @@
*/
#include <iostream>
#include <sigc++/bind.h>
#include <gtkmm2ext/doi.h>
@ -25,12 +26,21 @@
#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);
}

View 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__

View 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)

View 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 */

View 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 */

View 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);

View 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();

View 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);
settings_box.pack_end (*constraint_hbox, false, false);
v1_box->pack_start (*smaller_hbox, false, true);
v2_box->pack_start (focus_button, false, true);
pack_start (settings_box, false, false);
constraint_hbox->pack_end (*v2_box, false, false);
constraint_hbox->pack_end (*v1_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)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View 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;
}
}

View 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

View 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);

View 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;