denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Using call_out_to_guile() for built-in denemo command


From: Richard Shann
Subject: Re: [Denemo-devel] Using call_out_to_guile() for built-in denemo commands
Date: Fri, 12 Mar 2010 12:12:25 +0000

It seems that the gtk_widget_draw() at the start of the
insertion_point() function - which tries to get the side effect of the
draw to happen is not actually forcing a draw. So I have put a more
direct call in. There is a merit that we can optimise this "dry run"
draw just to do the side effects.
Much could be broken now, so please test.

Richard


On Thu, 2010-03-11 at 11:11 -0600, Jeremiah Benham wrote:
> On Thu, Mar 11, 2010 at 11:08:08AM +0000, Richard Shann wrote:
> > 
> > >(Of course, we should be calling directly in C, not via guile, but that
> > is another story)
> > So, I tracked this through, and (call_out_to_guile "d-Insert2") is
> > calling InsertDur2().
> > So you should be able to make a call InsertDur2(NULL, NULL) to insert a
> > quarter note at the cursor position, with creation of a new measure if
> > the cursor position is at the end of the measure.
> > 
> > Slightly better might be code like this
> > 
> > DenemoScriptParam param;
> > InsertDur2(NULL, &param);
> 
> Doing this did not help. I am not sure how to operate DenemoScriptParam.
> I am attatching my current importmidi.c/h so you can put this into context. 
> > 
> > and then you can examine param.status to find out what happened.
> > (This is off the top of my head, so E&OE)
> 
> So here is the code that is giving me trouble:
> 
> static void
> insert_note_into_score(gint pitch, notetype length)
> { 
>   DenemoGUI *gui = Denemo.gui;
>   DenemoStaff *curstaffstruct = (DenemoStaff *) gui->si->currentstaff->data;
>   gint i;
> 
>   /* 0-8 accepted bellow */
> #if 0
>   gchar *proc = g_strdup_printf("(d-Insert%d)", length.notetype);
>   call_out_to_guile(proc);
>   g_free(proc);
> #endif
> #if 1
>   DenemoScriptParam param; 
>   InsertDur2(NULL, &param);
>   g_debug("DenemoScriptParam = %s",((DenemoScriptParam) param).string->str);
> #endif
>   /* get correct note name */
>   gint key = curstaffstruct->keysig.number;
>   harmonic enote = enharmonic (pitch, (gint) key);
>   gchar *name =  mid_c_offsettolily (enote.pitch, enote.enshift);
> 
>   /* Rename note to the correct note */
>   gchar *accidental = g_strdup_printf("(d-ChangeChordNotes \"%s\")", name);
>   call_out_to_guile(accidental);
>   g_free(accidental);
> 
>   /* Add dots */
>   for (i=0;i<length.numofdots;i++)
>     add_dot_key (gui);
> }
> 
> Thanks,
> Jeremiah
> 
> 
> > 
> > Richard
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Denemo-devel mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/denemo-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]