예제 #1
0
static void
bind_keys_qwertz(PianoKeyboard *pk)
{
	bind_keys_qwerty(pk);

	/* The only difference between QWERTY and QWERTZ is that the "y" and "z" are swapped together. */
	bind_key(pk, "y", 12);
	bind_key(pk, "z", 33);
}
예제 #2
0
GtkWidget *
piano_keyboard_new(void)
{
	GtkWidget *widget = (GtkWidget*)gtk_type_new(piano_keyboard_get_type());

	PianoKeyboard *pk = PIANO_KEYBOARD(widget);

	pk->maybe_stop_sustained_notes = 0;
	pk->sustain_new_notes = 0;
	pk->enable_keyboard_cue = 0;
	pk->octave = 4;
	pk->note_being_pressed_using_mouse = -1;
	memset((void *)pk->notes, 0, sizeof(struct PKNote) * NNOTES);
	pk->key_bindings = g_hash_table_new(g_str_hash, g_str_equal);
	bind_keys_qwerty(pk);

	return widget;
}
예제 #3
0
gboolean
piano_keyboard_set_keyboard_layout(PianoKeyboard *pk, const char *layout)
{
	assert(layout);

	if (!g_ascii_strcasecmp(layout, "QWERTY")) {
		bind_keys_qwerty(pk);

	} else if (!g_ascii_strcasecmp(layout, "QWERTZ")) {
		bind_keys_qwertz(pk);

	} else if (!g_ascii_strcasecmp(layout, "AZERTY")) {
		bind_keys_azerty(pk);

	} else {
		/* Unknown layout name. */
		return TRUE;
	}

	return FALSE;
}