mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
basic adoption of new mouse binding facility
git-svn-id: svn://localhost/ardour2/branches/3.0@9063 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3d1fc33abb
commit
d08e3b94c5
5 changed files with 80 additions and 13 deletions
|
|
@ -49,6 +49,7 @@
|
||||||
#include "pbd/file_utils.h"
|
#include "pbd/file_utils.h"
|
||||||
|
|
||||||
#include "gtkmm2ext/application.h"
|
#include "gtkmm2ext/application.h"
|
||||||
|
#include "gtkmm2ext/bindings.h"
|
||||||
#include "gtkmm2ext/gtk_ui.h"
|
#include "gtkmm2ext/gtk_ui.h"
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
#include "gtkmm2ext/click_box.h"
|
#include "gtkmm2ext/click_box.h"
|
||||||
|
|
@ -305,11 +306,15 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
|
||||||
|
|
||||||
keyboard = new ArdourKeyboard(*this);
|
keyboard = new ArdourKeyboard(*this);
|
||||||
|
|
||||||
|
|
||||||
XMLNode* node = ARDOUR_UI::instance()->keyboard_settings();
|
XMLNode* node = ARDOUR_UI::instance()->keyboard_settings();
|
||||||
if (node) {
|
if (node) {
|
||||||
keyboard->set_state (*node, Stateful::loading_state_version);
|
keyboard->set_state (*node, Stateful::loading_state_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we don't like certain modifiers */
|
||||||
|
Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK);
|
||||||
|
|
||||||
reset_dpi();
|
reset_dpi();
|
||||||
|
|
||||||
TimeAxisViewItem::set_constant_heights ();
|
TimeAxisViewItem::set_constant_heights ();
|
||||||
|
|
@ -3300,6 +3305,7 @@ ARDOUR_UI::keyboard_settings () const
|
||||||
if (!node) {
|
if (!node) {
|
||||||
node = new XMLNode (X_("Keyboard"));
|
node = new XMLNode (X_("Keyboard"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,14 @@
|
||||||
#include <gdkmm/color.h>
|
#include <gdkmm/color.h>
|
||||||
#include <gdkmm/bitmap.h>
|
#include <gdkmm/bitmap.h>
|
||||||
|
|
||||||
#include <gtkmm2ext/grouped_buttons.h>
|
#include "gtkmm2ext/bindings.h"
|
||||||
#include <gtkmm2ext/gtk_ui.h>
|
#include "gtkmm2ext/grouped_buttons.h"
|
||||||
#include <gtkmm2ext/tearoff.h>
|
#include "gtkmm2ext/gtk_ui.h"
|
||||||
#include <gtkmm2ext/utils.h>
|
#include "gtkmm2ext/tearoff.h"
|
||||||
#include <gtkmm2ext/window_title.h>
|
#include "gtkmm2ext/utils.h"
|
||||||
#include <gtkmm2ext/choice.h>
|
#include "gtkmm2ext/window_title.h"
|
||||||
#include <gtkmm2ext/cell_renderer_pixbuf_toggle.h>
|
#include "gtkmm2ext/choice.h"
|
||||||
|
#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
|
||||||
|
|
||||||
#include "ardour/audio_diskstream.h"
|
#include "ardour/audio_diskstream.h"
|
||||||
#include "ardour/audio_track.h"
|
#include "ardour/audio_track.h"
|
||||||
|
|
@ -719,6 +720,17 @@ Editor::Editor ()
|
||||||
_show_marker_lines = false;
|
_show_marker_lines = false;
|
||||||
_over_region_trim_target = false;
|
_over_region_trim_target = false;
|
||||||
|
|
||||||
|
/* Button bindings */
|
||||||
|
|
||||||
|
button_bindings = new Bindings;
|
||||||
|
|
||||||
|
XMLNode* node = button_settings();
|
||||||
|
if (node) {
|
||||||
|
for (XMLNodeList::const_iterator i = node->children().begin(); i != node->children().end(); ++i) {
|
||||||
|
button_bindings->load (**i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
constructed = true;
|
constructed = true;
|
||||||
instant_save ();
|
instant_save ();
|
||||||
|
|
||||||
|
|
@ -739,12 +751,27 @@ Editor::~Editor()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
delete button_bindings;
|
||||||
delete _routes;
|
delete _routes;
|
||||||
delete _route_groups;
|
delete _route_groups;
|
||||||
delete track_canvas;
|
delete track_canvas;
|
||||||
delete _drags;
|
delete _drags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XMLNode*
|
||||||
|
Editor::button_settings () const
|
||||||
|
{
|
||||||
|
XMLNode* settings = ARDOUR_UI::instance()->editor_settings();
|
||||||
|
XMLNode* node = find_named_node (*settings, X_("Buttons"));
|
||||||
|
|
||||||
|
if (!node) {
|
||||||
|
cerr << "new empty Button node\n";
|
||||||
|
node = new XMLNode (X_("Buttons"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::add_toplevel_controls (Container& cont)
|
Editor::add_toplevel_controls (Container& cont)
|
||||||
{
|
{
|
||||||
|
|
@ -2389,6 +2416,12 @@ Editor::get_state ()
|
||||||
snprintf (buf, sizeof (buf), "%d", _the_notebook.get_current_page ());
|
snprintf (buf, sizeof (buf), "%d", _the_notebook.get_current_page ());
|
||||||
node->add_property (X_("editor-list-page"), buf);
|
node->add_property (X_("editor-list-page"), buf);
|
||||||
|
|
||||||
|
if (button_bindings) {
|
||||||
|
XMLNode* bb = new XMLNode (X_("Buttons"));
|
||||||
|
button_bindings->save (*bb);
|
||||||
|
node->add_child_nocopy (*bb);
|
||||||
|
}
|
||||||
|
|
||||||
node->add_property (X_("show-marker-lines"), _show_marker_lines ? "yes" : "no");
|
node->add_property (X_("show-marker-lines"), _show_marker_lines ? "yes" : "no");
|
||||||
|
|
||||||
node->add_child_nocopy (selection->get_state ());
|
node->add_child_nocopy (selection->get_state ());
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ namespace Gnome { namespace Canvas {
|
||||||
|
|
||||||
namespace Gtkmm2ext {
|
namespace Gtkmm2ext {
|
||||||
class TearOff;
|
class TearOff;
|
||||||
|
class Bindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
@ -1042,10 +1043,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
|
bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
|
||||||
bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
|
bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
|
||||||
bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
|
bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
|
||||||
|
bool button_press_dispatch (GdkEventButton*);
|
||||||
|
bool button_release_dispatch (GdkEventButton*);
|
||||||
bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
|
bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
|
||||||
bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
|
bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
|
||||||
bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
|
bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
|
||||||
|
|
||||||
|
Gtkmm2ext::Bindings* button_bindings;
|
||||||
|
XMLNode* button_settings () const;
|
||||||
|
|
||||||
/* KEYMAP HANDLING */
|
/* KEYMAP HANDLING */
|
||||||
|
|
||||||
void register_actions ();
|
void register_actions ();
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,14 @@
|
||||||
|
|
||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "pbd/enumwriter.h"
|
#include "pbd/enumwriter.h"
|
||||||
#include <gtkmm2ext/utils.h>
|
|
||||||
#include <gtkmm2ext/tearoff.h>
|
|
||||||
#include "pbd/memento_command.h"
|
#include "pbd/memento_command.h"
|
||||||
#include "pbd/basename.h"
|
#include "pbd/basename.h"
|
||||||
#include "pbd/stateful_diff_command.h"
|
#include "pbd/stateful_diff_command.h"
|
||||||
|
|
||||||
|
#include "gtkmm2ext/bindings.h"
|
||||||
|
#include "gtkmm2ext/utils.h"
|
||||||
|
#include "gtkmm2ext/tearoff.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "canvas-note.h"
|
#include "canvas-note.h"
|
||||||
|
|
@ -1168,6 +1170,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
return button_press_dispatch (&event->button);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1175,6 +1178,26 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Editor::button_press_dispatch (GdkEventButton* ev)
|
||||||
|
{
|
||||||
|
/* this function is intended only for buttons 4 and above.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Gtkmm2ext::MouseButton b (ev->state, ev->button);
|
||||||
|
return button_bindings->activate (b, Gtkmm2ext::Bindings::Press);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Editor::button_release_dispatch (GdkEventButton* ev)
|
||||||
|
{
|
||||||
|
/* this function is intended only for buttons 4 and above.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Gtkmm2ext::MouseButton b (ev->state, ev->button);
|
||||||
|
return button_bindings->activate (b, Gtkmm2ext::Bindings::Release);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
|
Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -487,7 +487,7 @@ StepEntry::on_key_press_event (GdkEventKey* ev)
|
||||||
if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
||||||
KeyboardKey k (ev->state, ev->keyval);
|
KeyboardKey k (ev->state, ev->keyval);
|
||||||
|
|
||||||
if (bindings.activate (k, KeyboardKey::Press)) {
|
if (bindings.activate (k, Bindings::Press)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -501,7 +501,7 @@ StepEntry::on_key_release_event (GdkEventKey* ev)
|
||||||
if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) {
|
||||||
KeyboardKey k (ev->state, ev->keyval);
|
KeyboardKey k (ev->state, ev->keyval);
|
||||||
|
|
||||||
if (bindings.activate (k, KeyboardKey::Release)) {
|
if (bindings.activate (k, Bindings::Release)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -693,7 +693,6 @@ void
|
||||||
StepEntry::load_bindings ()
|
StepEntry::load_bindings ()
|
||||||
{
|
{
|
||||||
/* XXX move this to a better place */
|
/* XXX move this to a better place */
|
||||||
KeyboardKey::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK);
|
|
||||||
|
|
||||||
bindings.set_action_map (myactions);
|
bindings.set_action_map (myactions);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue