[Gimp-developer] gimp menu - procedure positions

2007-12-20 Thread Lionel Tarazon Alcocer
Hi again,

At http://prhlt.iti.es/ we are developing a GIMP plug-in which installs various
procedures under Image/giDoc/. By default the registered procedures appear in
alphabetical order under this menu.

Is there a way of controlling the position they occupie instead of having them
in alphabetical order?

Thanks
-- 
Lionel Tarazón Alcocer 
PRHLT - UPV - Spain

-
This mail sent through IMP: http://horde.org/imp/
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] gimp menu - procedure positions

2007-12-20 Thread Sven Neumann
Hi,

On Thu, 2007-12-20 at 20:19 +0100, Lionel Tarazon Alcocer wrote:

 At http://prhlt.iti.es/ we are developing a GIMP plug-in which installs 
 various
 procedures under Image/giDoc/. By default the registered procedures appear 
 in
 alphabetical order under this menu.
 
 Is there a way of controlling the position they occupie instead of having them
 in alphabetical order?

No, there is currently no way to control the order in which menu items
added by plug-ins appear inside a submenu. Perhaps this could be added
but I can't currently imagine how an API for this would look like.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] gimp menu - procedure positions

2007-12-20 Thread gg
On Thu, 20 Dec 2007 20:55:15 +0100, Sven Neumann [EMAIL PROTECTED] wrote:

 Hi,

 On Thu, 2007-12-20 at 20:19 +0100, Lionel Tarazon Alcocer wrote:

 At http://prhlt.iti.es/ we are developing a GIMP plug-in which installs  
 various
 procedures under Image/giDoc/. By default the registered procedures  
 appear in
 alphabetical order under this menu.

 Is there a way of controlling the position they occupie instead of  
 having them
 in alphabetical order?

 No, there is currently no way to control the order in which menu items
 added by plug-ins appear inside a submenu. Perhaps this could be added
 but I can't currently imagine how an API for this would look like.


 Sven


What does the current API look like?

It would seem easy enough to add an extra arguement to indicate the  
required position in the menu list. A value of minus one could indicate a  
default placement, be that alphabetical or add-to-the-end.

An additional interface to query the current menu length would seem useful  
in this context:

int gimp_get_menu_length(menuID)


regards.




   .*.
   /V\
  (/ \)
  (   )
  ^^_^^
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] gimp menu - procedure positions

2007-12-20 Thread Sven Neumann
Hi,

On Thu, 2007-12-20 at 22:26 +0100, [EMAIL PROTECTED] wrote:

 It would seem easy enough to add an extra arguement to indicate the  
 required position in the menu list. A value of minus one could indicate a  
 default placement, be that alphabetical or add-to-the-end.

I don't see how that could possibly work. At the time the plug-in
registers the menu entry the length of the menu isn't known. It might be
the first plug-in to register or others might have registered there
before. The order in which the procedures are registered can not be
relied on. Also the plug-in doesn't know anything about the other
plug-ins the user might have installed.

The current behavior (sorting alphabetically) is perhaps not ideal but
at least it creates a stable and predictable menu order.

What would perhaps help is if we allowed plug-ins to create menu groups.
These work like submenus as that anything registered into such a group
would be sorted alphabetically within that group. But that group would
appear as a group in the menu, perhaps even separated using menu
separators.

We already use such a mechanism, called placeholders in GTKUIManager
terminology. Look for example at the Print plug-in. It registers into
Image/File/Send. Send is not a submenu of the File menu, but a
menu group. This way Print appears grouped with Mail Image. What is
missing is an API for plug-ins to create such a group. Perhaps
gimp_plugin_menu_group_register() would do the trick. It would work like
gimp_plugin_menu_branch_register() but install a placeholder instead of
a submenu.

This would not solve all the needs raised by Lionel, but it would
probably help a lot already.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer