Пример #1
0
static gboolean
get_previous (enharmonic * enote)
{
  DenemoObject *curObj = NULL;
  if (Denemo.project->movement->currentobject)
    {
      if (Denemo.project->movement->currentobject->prev)
        curObj = Denemo.project->movement->currentobject->prev->data;
      else
        {
          if (Denemo.project->movement->currentmeasure->prev && Denemo.project->movement->currentmeasure->prev->data)
            {
             DenemoMeasure *m = (DenemoMeasure*)Denemo.project->movement->currentmeasure->prev->data;
             curObj = m->objects?g_list_last (m->objects)->data:NULL;
            }
        }
    }
  if (curObj && curObj->type == CHORD)
    {
      chord *thechord = (chord *) curObj->object;
      if (thechord->notes)
        {
          note *thenote = (note *) thechord->notes->data;
          enote->mid_c_offset = offsettonumber (thenote->mid_c_offset);
          enote->enshift = thenote->enshift;
          return TRUE;
        }
    }
  return FALSE;
}
Пример #2
0
static gboolean
get_current (enharmonic * enote)
{
  DenemoObject *curObj = NULL;
  if (Denemo.project->movement->currentobject)
    {
      curObj = Denemo.project->movement->currentobject->data;
      if (curObj && curObj->type == CHORD)
        {
          chord *thechord = (chord *) curObj->object;
          if (thechord->notes)
            {
              note *thenote = (note *) thechord->notes->data;
              enote->mid_c_offset = offsettonumber (thenote->mid_c_offset);
              enote->enshift = thenote->enshift;
              return TRUE;
            }
        }
    }
  return FALSE;
}
Пример #3
0
/**
 * Set the cursor's y position from a mouse click
 *
 */
void
set_cursor_y_from_click (DenemoProject * gui, gdouble y)
{
  DenemoStaff *staff = (DenemoStaff*)gui->movement->currentstaff->data;
  gint cursorclef;
  if (gui->movement->currentobject)
    cursorclef = ((DenemoObject *)gui->movement->currentobject->data)->clef->type;
  else
    cursorclef = ((DenemoMeasure *)gui->movement->currentmeasure->data)->clef->type;
  /* Click height relative to the top of the staff.  */
  gdouble click_height = get_click_height (gui, y);
  gint offset = offset_from_height (click_height, (enum clefs) cursorclef);
  //g_print ("Does %d come within range %d %d?\n", offset, staff->range_hi, staff->range_lo);
  if (staff->range)
  {
    if(offset < staff->range_lo)
        offset = staff->range_lo;
    else
      if(offset > staff->range_hi)
        offset = staff->range_hi;
  }
  gui->movement->cursor_y = offset;
  gui->movement->staffletter_y = offsettonumber (gui->movement->cursor_y);
}