示例#1
0
void MoveTo(gchar note){
  gint mode = Denemo.project->mode;
  Denemo.project->mode = INPUTCLASSIC|INPUTNORMAL;
  go_to_key(note, NULL);
  Denemo.project->mode = mode;
  displayhelper(Denemo.project);
}
示例#2
0
void
insert_rest_xkey(gint duration, DenemoScriptParam* param)
{
  dnm_insertnote (Denemo.project, duration, INPUTREST, TRUE);
  displayhelper (Denemo.project);
  score_status(Denemo.project, TRUE);
}
示例#3
0
void
insert_blankchord_xkey (gint duration, DenemoScriptParam *param)
{
  dnm_insertnote (Denemo.project, duration, INPUTBLANK, FALSE);
  displayhelper (Denemo.project);
  score_status(Denemo.project, TRUE);
}
示例#4
0
/**
 * Toggle blank mode FIXME bitfields!!!
 *
 */
void
toggle_blank (GtkAction* action, DenemoScriptParam *param)
{
  GtkAction *mode = gtk_ui_manager_get_action (Denemo.ui_manager, "/MainMenu/ModeMenu/Blank");
  gtk_action_activate (mode);
  displayhelper (Denemo.project);
  score_status(Denemo.project, TRUE);
}
示例#5
0
void Insert(gchar note){
  gint mode = Denemo.project->mode;
  Denemo.project->mode = INPUTINSERT|INPUTNORMAL;
  go_to_key(note, NULL);
  Denemo.project->mode = mode;
  score_status(Denemo.project, TRUE);
  displayhelper(Denemo.project);
}
示例#6
0
void
pending_flatten (GtkAction* action, DenemoScriptParam *param)
{
  Denemo.project->movement->pending_enshift--;
  if (Denemo.project->movement->pending_enshift < -2)
    Denemo.project->movement->pending_enshift = -2;
  displayhelper (Denemo.project);
  score_status(Denemo.project, TRUE);
}
示例#7
0
void
pending_sharpen (GtkAction* action, DenemoScriptParam *param)
{
  Denemo.project->movement->pending_enshift++;
  if (Denemo.project->movement->pending_enshift > 2)
    Denemo.project->movement->pending_enshift = 2;
  displayhelper (Denemo.project);
  score_status(Denemo.project, TRUE);
}
示例#8
0
/**
 * change to read only mode
 * only score traversal available FIXME wrong name
 */
void
default_mode (DenemoScriptParam *param)
{
  Denemo.project->mode ^= TRAVERSE;
  if (Denemo.project->mode & TRAVERSE)
    gtk_label_set_text (GTK_LABEL (Denemo.statuslabel), "Read Only");
  g_debug ("Mode %d\n", Denemo.project->mode);
  displayhelper (Denemo.project);
}
示例#9
0
void Add(gchar note){
  gint mode = Denemo.project->mode;
  Denemo.project->mode = INPUTCLASSIC|INPUTNORMAL;
  go_to_key(note, NULL);
  add_tone_key(NULL, NULL);
  Denemo.project->mode = mode;
  score_status(Denemo.project, TRUE);
  displayhelper(Denemo.project);
}
示例#10
0
void InsertDur(gint duration){
  highlight_duration(Denemo.project, duration);
  gint mode = Denemo.project->mode;
  Denemo.project->mode = INPUTINSERT|INPUTNORMAL;
  insert_chord_xkey(duration, NULL);
  Denemo.project->mode = mode;
  score_status(Denemo.project, TRUE);
  displayhelper(Denemo.project);
}
示例#11
0
void AddNote(gchar note){
  movecursorright(NULL, NULL);
  gint mode = Denemo.project->mode;
  Denemo.project->mode = INPUTINSERT|INPUTNORMAL;
  go_to_key(note, NULL);
  Denemo.project->mode = mode;
  movecursorleft(NULL, NULL);
  score_status(Denemo.project, TRUE);
  displayhelper(Denemo.project);
}
示例#12
0
文件: midi.c 项目: denemo/denemo
/**
 * action_note_into_score
  enters ( or (if mode==INPUTEDIT and appending) edits the note at the cursor)
 * the parameters specify which note
 * @mid_c_offset
 * @enshift enharmonic adjustment -1 is one flat etc..
 * @octave
 */
static void
action_note_into_score (gint mid_c_offset, gint enshift, gint octave)
{//g_print ("action note into score\n");
  DenemoProject *gui = Denemo.project;
  gui->last_source = INPUTMIDI;
  gui->movement->cursor_y = gui->movement->staffletter_y = mid_c_offset;
  gui->movement->cursor_y += 7 * octave;
  Denemo.project->movement->pending_enshift = enshift;
  edit_or_append_pitch (mid_c_offset, TRUE);
  Denemo.project->movement->pending_enshift = 0;
  displayhelper (gui);
}
示例#13
0
文件: midi.c 项目: denemo/denemo
static void
add_or_delete_note_to_chord (gint mid_c_offset, gint enshift, gint octave)
{//g_print ("add or delete note to chord\n");
  DenemoProject *gui = Denemo.project;
  DenemoObject *curObj;
  gui->last_source = INPUTMIDI;
  gui->movement->cursor_y = gui->movement->staffletter_y = mid_c_offset;
  gui->movement->cursor_y += 7 * octave;
  if(insert_or_delete_chordnote (enshift))
    setenshift (gui->movement, enshift);
  displayhelper (gui);
}
示例#14
0
void ChangeTo(gchar note){
  gboolean appending = Denemo.project->movement->cursor_appending;
  if(appending)
    movecursorleft(NULL, NULL);
  gint mode = Denemo.project->mode;
  Denemo.project->mode = INPUTEDIT|INPUTNORMAL;
  go_to_key(note, NULL);
  Denemo.project->mode = mode;
  if(appending)
    movecursorright(NULL, NULL);
  score_status(Denemo.project, TRUE);
  displayhelper(Denemo.project);
}
示例#15
0
void ChangeDur(gint duration){
  gint mode = Denemo.project->mode;
  gboolean appending = Denemo.project->movement->cursor_appending;
  if(appending)
    movecursorleft(NULL, NULL);
  Denemo.project->mode = INPUTEDIT|INPUTNORMAL;
  insert_chord_xkey(duration, NULL);
  Denemo.project->mode = mode;
  if(appending)
    movecursorright(NULL, NULL);
  score_status(Denemo.project, TRUE);
  displayhelper(Denemo.project);
}
示例#16
0
void Dur (gint duration) {
  DenemoProject *gui = Denemo.project;
 if(Denemo.project->mode&INPUTINSERT)
   highlight_duration(Denemo.project, duration);
 else
 if( !(Denemo.project->mode&INPUTRHYTHM) && (Denemo.project->mode&INPUTEDIT) && (!Denemo.project->movement->cursor_appending))
   ChangeDur (duration);
else {
 insert_chord_xkey(duration, NULL);
   highlight_duration(Denemo.project, duration);
  score_status(Denemo.project, TRUE);
 displayhelper(Denemo.project);
 }
}
示例#17
0
/* perform the command of the given name and store the event that triggered it */
static gchar *
perform_command (const gchar * command_name, GdkEventKey * event)
{
  Denemo.last_keyval = event->keyval;
  Denemo.last_keystate = dnm_sanitize_key_state (event);
  call_out_to_guile ("(define DenemoKeypressActivatedCommand #t)");
  execute_callback_from_name (command_name);
  call_out_to_guile ("(define DenemoKeypressActivatedCommand #f)");
  // note Denemo.project = Denemo.project; may have changed as a result of executing the command
#ifdef TESTING_REPEATED_XPOSITION_UPDATE
  if (Denemo.project->movement)
    displayhelper (Denemo.project);
#endif
  return NULL;
}
示例#18
0
/* perform an action for mouse-click stored with shortcuts */
static void
perform_command (gint modnum, mouse_gesture press, gboolean left)
{
  GString *modname = mouse_shortcut_name (modnum, press, left);
  gint command_idx = lookup_command_for_keybinding_name (Denemo.map, modname->str);
  if (press != GESTURE_MOVE)
    {
      if (!Denemo.prefs.strictshortcuts)
        {
          if (command_idx < 0)
            {
              g_string_free (modname, TRUE);
              modname = mouse_shortcut_name (modnum & (~GDK_LOCK_MASK /*CapsLock */ ), press, left);
              command_idx = lookup_command_for_keybinding_name (Denemo.map, modname->str);
            }
          if (command_idx < 0)
            {
              g_string_free (modname, TRUE);
              modname = mouse_shortcut_name (modnum & (~GDK_MOD2_MASK /*NumLock */ ), press, left);
              command_idx = lookup_command_for_keybinding_name (Denemo.map, modname->str);
            }
          if (command_idx < 0)
            {
              g_string_free (modname, TRUE);
              modname = mouse_shortcut_name (modnum & (~(GDK_LOCK_MASK | GDK_MOD2_MASK)), press, left);
              command_idx = lookup_command_for_keybinding_name (Denemo.map, modname->str);
            }
        }
    }


  if (command_idx >= 0)
    {

      if (Denemo.prefs.learning)
        KeyPlusMouseGestureShow(modname->str, command_idx);

      execute_callback_from_idx (Denemo.map, command_idx);
      displayhelper (Denemo.project);
    }
  g_string_free (modname, TRUE);
}
示例#19
0
文件: grace.c 项目: denemo/denemo
void
toggle_acciaccatura (DenemoAction * action, DenemoScriptParam * param)
{
  DenemoProject *gui = Denemo.project;
  DenemoMovement *si = gui->movement;
  GET_1PARAM (action, param, grace);
  DenemoObject *curmudelaobj = (DenemoObject *) (gui->movement->currentobject ? gui->movement->currentobject->data : NULL);
  if (curmudelaobj && (curmudelaobj->type == CHORD))
    {
      if (query)
        param->status = ((chord *) curmudelaobj->object)->is_grace, g_string_assign (param->string, "acciaccatura");
      else
        {
          store_for_undo_change (si, curmudelaobj);
          ((chord *) curmudelaobj->object)->is_grace ^= ACCIACCATURA;
          displayhelper (Denemo.project);
        }
      //g_debug("now %x\n",  ((chord *)curmudelaobj->object)->is_grace);
    }
}
示例#20
0
/**
 * Notehead selection dialog
 * Displays the notehead type in a Combobox
 * Callback - insert_notehead
 */
void
set_notehead (GtkAction * action, DenemoScriptParam * param)
{
  DenemoProject *gui = Denemo.project;
  GtkWidget *dialog;
  GtkWidget *label;
  GtkWidget *combo;
  GtkWidget *content_area;
  static GList *list = NULL;    //NOTE required for gtk<2.24

  guint i;
  if (!action)
    {
      if (((DenemoScriptParam *) param)->string && ((DenemoScriptParam *) param)->string->len)
        {
          insertnotehead (gui->movement, ((DenemoScriptParam *) param)->string->str);
          ((DenemoScriptParam *) param)->status = TRUE;
          return;
        }
      else
        {
          if (param)
            ((DenemoScriptParam *) param)->status = FALSE;
          return;
        }
    }

  if (!list)
    {
      for (i = 0; i < 4; i++)
        {
          list = g_list_append (list, _(notehead[i]));
        }
    }

  dialog = gtk_dialog_new_with_buttons (_("Change Notehead"), GTK_WINDOW (Denemo.window), (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), _("_OK"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_REJECT, NULL);


  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
  label = gtk_label_new (_("Select Notehead Type"));
  gtk_container_add (GTK_CONTAINER (content_area), label);
#if GTK_MAJOR_VERSION==3
  combo = gtk_combo_box_text_new ();
  for (i = 0; i < G_N_ELEMENTS (notehead); i++)
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), notehead[i]);
  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
#else
  combo = gtk_combo_new ();
  gtk_combo_set_popdown_strings (GTK_COMBO (combo), list);
  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), _(notehead[0]));
  gtk_combo_box_set_active (GTK_COMBO (combo), 0);
#endif
  gtk_container_add (GTK_CONTAINER (content_area), combo);
  gtk_widget_grab_focus (combo);
  gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);

  gtk_widget_show_all (dialog);

  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
    {
#if GTK_MAJOR_VERSION==3
      gint num = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
      insertnotehead (gui->movement, notehead[num]);
#else
      gchar *noteheadstring = (gchar *) gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (combo)->entry));
      insertnotehead (gui->movement, noteheadstring);
#endif
    }
  gtk_widget_destroy (dialog);
  displayhelper (gui);
}
示例#21
0
gint
scorearea_scroll_event (GtkWidget * widget, GdkEventScroll * event)
{
  DenemoProject *gui = Denemo.project;
  if (gui == NULL || gui->movement == NULL)
    return FALSE;
  switch (event->direction)
    {
      DenemoScriptParam param;
    case GDK_SCROLL_UP:
      if (event->state & GDK_CONTROL_MASK)
        {
          if (Denemo.prefs.learning) {
            gint command_idx = lookup_command_from_name(Denemo.map, "ZoomIn");
            KeyStrokeShow (_("Ctrl + Mouse Wheel Up"), command_idx, TRUE);
          }
          Denemo.project->movement->zoom *= 1.1;
          scorearea_configure_event (Denemo.scorearea, NULL);
        }
      else if (event->state & GDK_SHIFT_MASK)
        {
          gint command_idx = lookup_command_from_name(Denemo.map, "MoveToMeasureLeft");
          if (Denemo.prefs.learning) {
            KeyStrokeShow (_("Shift + Mouse Wheel Up"), command_idx, TRUE);
          }
          execute_callback_from_idx(Denemo.map, command_idx);//scroll_left ();

        }
      else
        {
          if (Denemo.prefs.learning) {
            gint command_idx = lookup_command_from_name(Denemo.map, "MoveToStaffUp");
            KeyStrokeShow (_("Unshifted + Mouse Wheel Up"), command_idx, TRUE);
          }
          movetostaffup (NULL, &param);
          if (!param.status) {
            DenemoStaff *thestaff = (DenemoStaff*)(Denemo.project->movement->currentstaff->data);
            if(thestaff->space_above < MAXEXTRASPACE)
              {
                thestaff->space_above++;
                g_debug ("Increasing the height of the top staff");
              }
          }
        }
      break;
    case GDK_SCROLL_DOWN:
      if (event->state & GDK_CONTROL_MASK)
        {
          if (Denemo.prefs.learning) {
            gint command_idx = lookup_command_from_name(Denemo.map, "ZoomOut");
            KeyStrokeShow (_("Ctrl + Mouse Wheel Down"), command_idx, TRUE);
          }
          Denemo.project->movement->zoom /= 1.1;
          if (Denemo.project->movement->zoom < 0.01)
            Denemo.project->movement->zoom = 0.01;
          scorearea_configure_event (Denemo.scorearea, NULL);
          //displayhelper(gui);
        }
      else if (event->state & GDK_SHIFT_MASK)
        {
          gint command_idx = lookup_command_from_name(Denemo.map, "MoveToMeasureRight");
          if (Denemo.prefs.learning) {
            KeyStrokeShow (_("Shift + Mouse Wheel Down"), command_idx, TRUE);
          }
          execute_callback_from_idx(Denemo.map, command_idx);//scroll_right ();
        }
      else
        {
          if (Denemo.prefs.learning) {
            gint command_idx = lookup_command_from_name(Denemo.map, "MoveToStaffDown");
            KeyStrokeShow (_("Unshifted + Mouse Wheel Down"), command_idx, TRUE);
          }
          movetostaffdown (NULL, &param);
          if (!param.status) {
            warningmessage ("This is the bottom staff");
           // DenemoStaff *thestaff = (DenemoStaff*)(Denemo.project->movement->currentstaff->data);
           // thestaff->space_below++; //This doesn't help, because the viewport does not change.
           // warningmessage ("Increasing the space below the bottom staff");
           //move_viewport_down(Denemo.project);
          }
        }
      break;
    case GDK_SCROLL_LEFT:
      movetomeasureleft (NULL, &param);
      if (!param.status)
        warningmessage ("This is the first measure");
      break;
    case GDK_SCROLL_RIGHT:
      movetomeasureright (NULL, &param);
      if (!param.status)
        warningmessage ("This is the last measure");
      break;

    default:
      break;
    }
  displayhelper (Denemo.project);
  return FALSE;
}
示例#22
0
文件: midi.c 项目: denemo/denemo
void
process_midi_event (gchar * buf)
{
  if (command == MIDI_CONTROL_CHANGE && (notenumber == 0x40))
    {
      if (velocity == 0x7F)
        {//PEDAL DOWN
        if (Denemo.project->movement->cursor_appending || at_nonprinting ())
            Denemo.keyboard_state |= ADDING_MASK;
        else
            Denemo.keyboard_state |= CHORD_MASK | ADDING_MASK;
        }
      else
        {
          Denemo.keyboard_state &= ~(CHORD_MASK | ADDING_MASK);
          next_insert_or_editable_note();//next_insert_or_editable_note ();
        }
      set_midi_in_status ();
      displayhelper (Denemo.project);
    }
  if ((0xFFFFFF & *(gint *) buf) == 0)
    {
      set_midi_capture (FALSE);
      g_queue_clear (&midi_queue);
      if (divert_midi_event)
        {
          *divert_midi_event = 0;
          divert_midi_event = NULL;
          gtk_main_quit ();
        }
      //g_debug("queue emptied %d\n", g_queue_get_length(&midi_queue));
    }
  else
    {
      if (command == MIDI_NOTE_ON)
        midiaction (notenumber);
      else if (command == MIDI_CONTROL_CHANGE)
        {
          gchar *command_name = get_midi_control_command (notenumber, velocity);
          if (command_name)
            {
              execute_callback_from_name (command_name);
              g_free (command_name);
            }
          else
            {
              if (notenumber == 0x40)
                {               //Foot Pedal
                  if (velocity == 0x7F)
                    {
                    if ((Denemo.project->movement->cursor_appending) || at_nonprinting ())
                        Denemo.keyboard_state |= ADDING_MASK;
                    else
                        Denemo.keyboard_state |= CHORD_MASK | ADDING_MASK;
                    }
                  else
                    {
                      Denemo.keyboard_state &= ~(CHORD_MASK | ADDING_MASK);
                      //next_editable_note (); this causes a double advance...
                    }
                  set_midi_in_status ();
                  displayhelper (Denemo.project);
                }
            }
        }
      else if (command == MIDI_PITCH_BEND)
        {
          gchar *command_name = get_midi_pitch_bend_command ((notenumber << 8) + velocity);
          if (command_name)
            {
              execute_callback_from_name (command_name);
              g_free (command_name);
            }
        }
    }
}