Ejemplo n.º 1
0
void MidiRuleCtrlTrigger::row_changed(const Gtk::TreeModel::Path& path,
                                      const Gtk::TreeModel::iterator& iter) {
    if (update_model) return;

    Gtk::TreeModel::Row row = *iter;
    int i = path[0];

    if (m->pTriggers[i].Velocity == 255 && row[columns.switch_logic]) {
        update_model++;
        row[columns.velocity] = 100;
        update_model--;
    }

    int key = note_value(row[columns.key]);

    if (m->pTriggers[i].TriggerPoint != row[columns.trigger_point] ||
        m->pTriggers[i].Descending != row[columns.descending] ||
        m->pTriggers[i].VelSensitivity != row[columns.vel_sensitivity] ||
        m->pTriggers[i].Key != key ||
        m->pTriggers[i].NoteOff != row[columns.note_off] ||
        (m->pTriggers[i].Velocity != 255) != row[columns.switch_logic] ||
        m->pTriggers[i].Velocity != row[columns.velocity] ||
        m->pTriggers[i].OverridePedal != row[columns.override_pedal])
    {
        m->pTriggers[i].TriggerPoint = row[columns.trigger_point];
        m->pTriggers[i].Descending = row[columns.descending];
        m->pTriggers[i].VelSensitivity = row[columns.vel_sensitivity];
        m->pTriggers[i].Key = key;
        m->pTriggers[i].NoteOff = row[columns.note_off];
        m->pTriggers[i].Velocity =
            row[columns.switch_logic] ? row[columns.velocity] : 255;
        m->pTriggers[i].OverridePedal = row[columns.override_pedal];
        sig_changed();
    }
}
Ejemplo n.º 2
0
void MidiRuleCtrlTrigger::note_edited(
    const Glib::ustring& path,
    const Glib::ustring& new_text,
    const Gtk::TreeModelColumn<Glib::ustring>& column) {
    Gtk::TreeModel::Row row = *list_store->get_iter(path);

    row[column] = note_str(note_value(new_text));
}
Ejemplo n.º 3
0
void MidiRuleCtrlTrigger::note_editing_started(
    Gtk::CellEditable* editable,
    const Glib::ustring& path,
    Gtk::CellRendererSpin* renderer) {
    int value = note_value(renderer->property_text());
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
    renderer->property_adjustment() = new Gtk::Adjustment(0, 0, 127);
#else
    renderer->property_adjustment() = Gtk::Adjustment::create(0, 0, 127);
#endif
    Gtk::SpinButton* spin_button = dynamic_cast<Gtk::SpinButton*>(editable);
    if (spin_button) {
        spin_button->get_adjustment()->set_value(value);
        spin_button_show_notes(*spin_button);
    }
}
Ejemplo n.º 4
0
/* Called when a new gdb.Value object needs to be allocated.  Returns NULL on
   error, with a python exception set.  */
static PyObject *
valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords)
{
  struct value *value = NULL;   /* Initialize to appease gcc warning.  */
  value_object *value_obj;

  if (PyTuple_Size (args) != 1)
    {
      PyErr_SetString (PyExc_TypeError, _("Value object creation takes only "
					  "1 argument"));
      return NULL;
    }

  value_obj = (value_object *) subtype->tp_alloc (subtype, 1);
  if (value_obj == NULL)
    {
      PyErr_SetString (PyExc_MemoryError, _("Could not allocate memory to "
					    "create Value object."));
      return NULL;
    }

  value = convert_value_from_python (PyTuple_GetItem (args, 0));
  if (value == NULL)
    {
      subtype->tp_free (value_obj);
      return NULL;
    }

  value_obj->value = value;
  release_value_or_incref (value);
  value_obj->address = NULL;
  value_obj->type = NULL;
  value_obj->dynamic_type = NULL;
  note_value (value_obj);

  return (PyObject *) value_obj;
}