*/
#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);
}
{
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);
}
Dialog::on_show ();
}
+
+bool
+ArdourDialog::on_key_press_event (GdkEventKey* key)
+{
+ return Gtk::Dialog::on_key_press_event (key);
+}
+
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 ();
virtual void session_gone () {
set_session (0);
}
+
+ static void close_all_dialogs () { CloseAllDialogs(); }
+
+ private:
+ static sigc::signal<void> CloseAllDialogs;
};
#endif // __ardour_dialog_h__
session->set_deletion_in_progress ();
}
+ ArdourDialog::close_all_dialogs ();
engine->stop (true);
save_ardour_state ();
quit ();
}
}
-gint
-ARDOUR_UI::hide_and_quit (GdkEventAny *ev, ArdourDialog *window)
-{
- window->hide();
- Gtk::Main::quit ();
- return TRUE;
-}
-
void
ARDOUR_UI::save_template ()
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)
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,
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;
void startup ();
void shutdown ();
- void finish();
int ask_about_saving_session (const string & why);
/* periodic safety backup, to be precise */
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 */
/* 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);
#include "canvas_impl.h"
#include "simplerect.h"
#include "waveview.h"
+#include "actions.h"
using namespace std;
using namespace ARDOUR;
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();
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>")));
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);
pack_start (hpacker, false, false);
}
- insert->active_changed.connect (mem_fun(*this, &GenericPluginUI::redirect_active_changed));
- bypass_button.set_active (!insert->active());
-
build ();
}
}
-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)
{
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
}
}
- 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;
}
}
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);
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
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);
};
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);
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;