Ejemplo n.º 1
0
static void
apoint_free (struct apoint *apt)
{
  mem_free (apt->mesg);
  erase_note (&apt->note, ERASE_FORCE_KEEP_NOTE);
  mem_free (apt);
}
Ejemplo n.º 2
0
void
apoint_free_bkp (enum eraseflg flag)
{
  if (bkp_cut_apoint.mesg)
    {
      mem_free (bkp_cut_apoint.mesg);
      bkp_cut_apoint.mesg = 0;
    }
  erase_note (&bkp_cut_apoint.note, flag);
}
Ejemplo n.º 3
0
void
apoint_delete_bynum (long start, unsigned num, enum eraseflg flag)
{
  llist_item_t *i;
  int need_check_notify = 0;

  LLIST_TS_LOCK (&alist_p);
  i = LLIST_TS_FIND_NTH (&alist_p, num, start, apoint_inday);

  if (!i)
    EXIT (_("no such appointment"));
  struct apoint *apt = LLIST_TS_GET_DATA (i);

  switch (flag)
    {
    case ERASE_FORCE_ONLY_NOTE:
      erase_note (&apt->note, flag);
      break;
    case ERASE_CUT:
      apoint_free_bkp (ERASE_FORCE);
      apoint_dup (apt, &bkp_cut_apoint);
      erase_note (&apt->note, ERASE_FORCE_KEEP_NOTE);
      /* FALLTHROUGH */
    default:
      if (notify_bar ())
        need_check_notify = notify_same_item (apt->start);
      LLIST_TS_REMOVE (&alist_p, i);
      mem_free (apt->mesg);
      if (flag != ERASE_FORCE_KEEP_NOTE && flag != ERASE_CUT)
        erase_note (&apt->note, flag);
      mem_free (apt);
      if (need_check_notify)
        notify_check_next_app (0);
      break;
    }

  LLIST_TS_UNLOCK (&alist_p);
}
Ejemplo n.º 4
0
static void *
off_clb(note_t *note, void *_arg)
{
    noteoff_t *arg = _arg;
    if (note->midipitch != arg->midipitch)
        return NULL;

    if (arg->time < note->off_time || note->note_offed < arg->offed) {
        note_t n = *note;
        n.off_time = arg->time;
        n.off_vel = arg->vel;

        erase_note(note);
        if (n.on_time != n.off_time)
            insert_note(&n)->note_offed = arg->offed;
    }
    return arg;
}
Ejemplo n.º 5
0
/* Edit a note with an external editor. */
void
edit_note (char **note, char *editor)
{
  char fullname[BUFSIZ];
  char *filename;

  if (*note == NULL)
    {
      if ((filename = new_tempfile (path_notes, NOTESIZ)) != NULL)
        *note = filename;
      else
        return;
    }
  (void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, *note);
  wins_launch_external (fullname, editor);

  if (io_file_is_empty (fullname) > 0)
    erase_note (note, ERASE_FORCE);
}