denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Custom menus


From: Richard Shann
Subject: Re: [Denemo-devel] Custom menus
Date: Tue, 01 Jul 2008 09:16:08 +0100

Thanks for the potted guide - I probably wouldn't have got round to it
if it meant wading thru the docs.
It occurred to me that the next release after the upcoming one would be
0.7.10 if we are not doing anything that breaks old stuff. But in fact
the upcoming release does not support old keymaps, so probably should be
0.8.0
And the one after that, which I will start work on now, should be 0.8.1
If anyone thinks this is wrong, please say.
Richard

On Mon, 2008-06-30 at 20:09 -0500, Jeremiah Benham wrote:
> On Mon, 2008-06-30 at 18:13 +0100, Richard Shann wrote:
> > Below is a design for how to incorporate custom lilypond-insert menus
> > into Denemo, based on Jean-Rene`s code managing the keybindings.
> > What is described is the basic building block, an on-line gallery of
> > useful thumbnailed LilyPond directives contributed by users would be a
> > final goal.
> > This is for 0.8.0 and I would like to start soon!
> 
> Have you considered creating a .8 branch your own git. I don't know if
> you have used branches but I am quite impressed with it. 
> 
> You basically do this:
> 
> git branch 0.8 
> 
> This created a 0.8 branch. 
> 
> To switch to this branch do this:
> 
> git checkout 0.8
> 
> then whatever change you make sure to commit them when you want to
> switch back to the .7.9 branch. To switch back to working on the .7.9
> branch after committing changes to .8.0 type this:
> 
> git checkout master
> 
> You hides all your changes that you made in .8.0 and vice versa. When
> the code freeze is over you begin to merge the .8.0 branch into master:
> 
> git checkout master
> git merge 0.8
> 
> You can find this in your docs if you installed the git-doc packages:
> 
>  file://usr/share/doc/git-doc/tutorial.html
> 
> 
> Jeremiah
> 
> > 
> > Design for including custom LilyPond insertion actions into Denemo.
> > 
> > The simple case of inserting a fixed LilyPond string is described here.
> > The basic idea is that we can include custom commands in the keymap
> > file, which define an action name, label, location in the menu system,
> > tooltip, keybinding,
> > and which when the keymap is loaded causes the menu item to be inserted
> > and the command to appear in the command store (keymap->commands).
> > Activation is a callback to the function that inserts the LilyPond
> > directive.
> > To achieve this I propose to expand the 
> > typedef enum
> > {
> >     KeymapEntry,
> >     KeymapToggleEntry,
> >     KeymapRadioEntry,
> >     KeymapLilyPondAction,
> >     KeymapModeAction
> > }KeymapCommandType;
> > 
> > to include LilyPond and Mode command types (the COL_ENTRY column for
> > KeymapLilyPondEntry will be a  GtkAction*
> > while for KeymapModeEntry they will be GtkRadioAction* rather than a
> > GtkActionEntry*
> > I'll omit further details on how the KeymapModeAction type will work for
> > now.
> > 
> > In save_keymap we save extra fields in each <row> which is found to have
> > the type KeymapLilyPondEntry
> > the fields saved in this case are <type>, <tooltip>, <label>,
> > <lilypond>, <location>
> > 
> > In load keymap at parseBinding (rename this to parseAction) we parse the
> > <type> and for
> > type KeymapLilyPondEntry instead of lookup_index_from_name we create the
> > GtkAction (which will shortly have tooltip, label and lilypond fields
> > attached) and register it - essentially this is the add_favorite
> > function I have already prototyped (in view.c). We also parse the
> > location and insert the menuitem in the menu system.
> > The tooltip etc which we attach to the action are now parsed as well,
> > and attached to the action.
> > 
> > Then the code continues as a present.
> > When looking up the type, we have extra cases, e.g. in kbd-custom.c as
> > well as
> > 
> >           case KeymapEntry:
> >               names[i] = ((GtkActionEntry *) entry)->name;
> >               break;
> > etc we have
> > 
> >           case KeymapLilyPondAction:
> >               names[i] = g_object_get_data(entry, "name");
> > //note: we could use
> > gtk_action_get_name(GTK_ACTION(entry));     but this would create a copy of
> > the name, whereas the others are just references
> >               break;
> > 
> > another example is
> >       case KeymapEntry:
> >           f = (((GtkActionEntry *) row.entry)->callback);
> >           if (!f) {
> >             res = FALSE;
> >           }
> >           break;
> > which has the extra case
> >       case KeymapLilyPondAction:
> >           f = myactivate;
> >           break;
> > where myactivate is the name of the function attached to the action in
> > the add_favorite routine (this name will need to be something sensible,
> > to do with the fact that it is a custom lilypond activation).
> > 
> > at the end of the load, if we have registered new commands we re-sort
> > the list using the end_register function.
> > 
> > That is all there is to it, I think.
> > comments please - particularly are there internationalization issues
> > which I don't understand?
> > 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]