add static methods to Keyboard for keyboard modifier names
git-svn-id: svn://localhost/ardour2/branches/3.0@8364 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a06c33b6d9
commit
4624153d26
@ -57,6 +57,13 @@ class Keyboard : public sigc::trackable, PBD::Stateful
|
||||
static uint32_t CopyModifier;
|
||||
static uint32_t RangeSelectModifier;
|
||||
|
||||
static const char* primary_modifier_name ();
|
||||
static const char* secondary_modifier_name ();
|
||||
static const char* tertiary_modifier_name ();
|
||||
static const char* level4_modifier_name ();
|
||||
static const char* copy_modifier_name ();
|
||||
static const char* rangeselect_modifier_name ();
|
||||
|
||||
static void set_primary_modifier (uint32_t newval) {
|
||||
set_modifier (newval, PrimaryModifier);
|
||||
}
|
||||
@ -110,8 +117,14 @@ class Keyboard : public sigc::trackable, PBD::Stateful
|
||||
static guint delete_modifier() { return delete_mod; }
|
||||
static void set_delete_modifier(guint);
|
||||
|
||||
static guint insert_note_button() { return insert_note_but; }
|
||||
static void set_insert_note_button (guint);
|
||||
static guint insert_note_modifier() { return insert_note_mod; }
|
||||
static void set_insert_note_modifier(guint);
|
||||
|
||||
static bool is_edit_event (GdkEventButton*);
|
||||
static bool is_delete_event (GdkEventButton*);
|
||||
static bool is_insert_note_event (GdkEventButton*);
|
||||
static bool is_context_menu_event (GdkEventButton*);
|
||||
static bool is_button2_event (GdkEventButton*);
|
||||
|
||||
@ -148,6 +161,8 @@ class Keyboard : public sigc::trackable, PBD::Stateful
|
||||
static guint edit_mod;
|
||||
static guint delete_but;
|
||||
static guint delete_mod;
|
||||
static guint insert_note_but;
|
||||
static guint insert_note_mod;
|
||||
static guint snap_mod;
|
||||
static guint button2_modifiers;
|
||||
static Gtk::Window* current_window;
|
||||
|
@ -52,9 +52,12 @@ guint Keyboard::edit_but = 3;
|
||||
guint Keyboard::edit_mod = GDK_CONTROL_MASK;
|
||||
guint Keyboard::delete_but = 3;
|
||||
guint Keyboard::delete_mod = GDK_SHIFT_MASK;
|
||||
guint Keyboard::insert_note_but = 3;
|
||||
guint Keyboard::insert_note_mod = GDK_CONTROL_MASK;
|
||||
guint Keyboard::snap_mod = GDK_MOD3_MASK;
|
||||
|
||||
#ifdef GTKOSX
|
||||
|
||||
guint Keyboard::PrimaryModifier = GDK_META_MASK; // Command
|
||||
guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option
|
||||
guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift
|
||||
@ -62,7 +65,16 @@ guint Keyboard::Level4Modifier = GDK_CONTROL_MASK; // Control
|
||||
guint Keyboard::CopyModifier = GDK_MOD1_MASK; // Alt/Option
|
||||
guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
|
||||
guint Keyboard::button2_modifiers = Keyboard::SecondaryModifier|Keyboard::Level4Modifier;
|
||||
|
||||
const char* Keyboard::primary_modifier_name() { return _("Command"); }
|
||||
const char* Keyboard::secondary_modifier_name() { return _("Option"); }
|
||||
const char* Keyboard::tertiary_modifier_name() { return _("Shift"); }
|
||||
const char* Keyboard::level4_modifier_name() { return _("Control"); }
|
||||
const char* Keyboard::copy_modifier_name() { return _("Mod1"; ); }
|
||||
const char* Keyboard::rangeselect_modifier_name() { return _("Shift"); }
|
||||
|
||||
#else
|
||||
|
||||
guint Keyboard::PrimaryModifier = GDK_CONTROL_MASK; // Control
|
||||
guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option
|
||||
guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift
|
||||
@ -70,8 +82,15 @@ guint Keyboard::Level4Modifier = GDK_MOD4_MASK; // Mod4/Windows
|
||||
guint Keyboard::CopyModifier = GDK_CONTROL_MASK;
|
||||
guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
|
||||
guint Keyboard::button2_modifiers = 0; /* not used */
|
||||
#endif
|
||||
|
||||
const char* Keyboard::primary_modifier_name() { return _("Control"); }
|
||||
const char* Keyboard::secondary_modifier_name() { return _("Alt"); }
|
||||
const char* Keyboard::tertiary_modifier_name() { return _("Shift"); }
|
||||
const char* Keyboard::level4_modifier_name() { return _("Meta"); }
|
||||
const char* Keyboard::copy_modifier_name() { return _("Control"); }
|
||||
const char* Keyboard::rangeselect_modifier_name() { return _("Shift"); }
|
||||
|
||||
#endif
|
||||
|
||||
Keyboard* Keyboard::_the_keyboard = 0;
|
||||
Gtk::Window* Keyboard::current_window = 0;
|
||||
@ -148,6 +167,10 @@ Keyboard::get_state (void)
|
||||
node->add_property ("delete-modifier", buf);
|
||||
snprintf (buf, sizeof (buf), "%d", snap_mod);
|
||||
node->add_property ("snap-modifier", buf);
|
||||
snprintf (buf, sizeof (buf), "%d", insert_note_but);
|
||||
node->add_property ("insert-note-button", buf);
|
||||
snprintf (buf, sizeof (buf), "%d", insert_note_mod);
|
||||
node->add_property ("insert-note-modifier", buf);
|
||||
|
||||
return *node;
|
||||
}
|
||||
@ -177,6 +200,14 @@ Keyboard::set_state (const XMLNode& node, int /*version*/)
|
||||
sscanf (prop->value().c_str(), "%d", &snap_mod);
|
||||
}
|
||||
|
||||
if ((prop = node.property ("insert-note-button")) != 0) {
|
||||
sscanf (prop->value().c_str(), "%d", &insert_note_but);
|
||||
}
|
||||
|
||||
if ((prop = node.property ("insert-note-modifier")) != 0) {
|
||||
sscanf (prop->value().c_str(), "%d", &insert_note_mod);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -359,6 +390,21 @@ Keyboard::set_delete_modifier (guint mod)
|
||||
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | delete_mod);
|
||||
}
|
||||
|
||||
void
|
||||
Keyboard::set_insert_note_button (guint but)
|
||||
{
|
||||
insert_note_but = but;
|
||||
}
|
||||
|
||||
void
|
||||
Keyboard::set_insert_note_modifier (guint mod)
|
||||
{
|
||||
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~insert_note_mod);
|
||||
insert_note_mod = mod;
|
||||
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | insert_note_mod);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Keyboard::set_modifier (uint32_t newval, uint32_t& var)
|
||||
{
|
||||
@ -383,6 +429,14 @@ Keyboard::is_edit_event (GdkEventButton *ev)
|
||||
((ev->state & RelevantModifierKeyMask) == Keyboard::edit_modifier());
|
||||
}
|
||||
|
||||
bool
|
||||
Keyboard::is_insert_note_event (GdkEventButton *ev)
|
||||
{
|
||||
return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) &&
|
||||
(ev->button == Keyboard::insert_note_button()) &&
|
||||
((ev->state & RelevantModifierKeyMask) == Keyboard::insert_note_modifier());
|
||||
}
|
||||
|
||||
bool
|
||||
Keyboard::is_button2_event (GdkEventButton* ev)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user