RSS/Atom feed Twitter
Site is read-only, email is disabled

Hacking GIMP - Gimp top level menu

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

9 of 10 messages available
Toggle history

Please log in to manage your subscriptions.

Hacking GIMP - Gimp top level menu Jordan Stinson 02 Jun 18:35
  Hacking GIMP - Gimp top level menu Martin Nordholts 02 Jun 19:16
4A257397.1020405@gmail.com 07 Oct 20:27
  Hacking GIMP - Gimp top level menu Jordan Stinson 17 Jun 02:27
   Hacking GIMP - Gimp top level menu Simon Budig 17 Jun 02:33
    Hacking GIMP - Gimp top level menu Jordan Stinson 17 Jun 03:30
     Hacking GIMP - Gimp top level menu David Gowers 17 Jun 03:36
      Hacking GIMP - Gimp top level menu Jordan Stinson 13 Jul 21:27
       Hacking GIMP - Gimp top level menu Martin Nordholts 13 Jul 21:33
        Hacking GIMP - Gimp top level menu Jordan Stinson 13 Jul 21:44
Jordan Stinson
2009-06-02 18:35:21 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Hi,
I was wondering how the top level menu for GIMP is created (The one with these items: "File", "Edit", "Select", "View", "Image", etc. ). I want to add a menu item to this menu and I'm kind of lost as to where to start. If someone could tell me where to hunt around in the code for this and give me an explanation of how it's done, that would be great! Even better, is there some documentation online about this kind of thing?

Thanks in advance,

Jordan

Martin Nordholts
2009-06-02 19:16:12 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Jordan Stinson wrote:

Hi,
I was wondering how the top level menu for GIMP is created (The one with these items: "File", "Edit", "Select", "View", "Image", etc. ). I want to add a menu item to this menu and I'm kind of lost as to where to start. If someone could tell me where to hunt around in the code for this and give me an explanation of how it's done, that would be great! Even better, is there some documentation online about this kind of thing?

The GIMP menus are created using the GTK+ menu APIs, often with some thin wrapper on top. The actual instantiation of the menu is in the gimp_display_shell_new() function:

shell->menubar = gtk_ui_manager_get_widget (GTK_UI_MANAGER (shell->menubar_manager), "/image-menubar");

Some keywords to look up: GtkUIManager, GtkAction. The menu structure is in menus/image-menu.xml.in. Note that you will need to install the modified file before GIMP can find it.

To add a new menu item these are the rough steps:

1. Edit image-menu.xml.in 2. Add a GimpAction in -actions.c, e.g. image-actions.c if you are going to add something under the Image menu. Then just follow the pattern from there.

As a general tip, you will learn a lot from studying the commit history. There have been several occasions where menu items have been added and modified for example, so just looking up a commit for this and studying the diff will tell you how to do it.

/ Martin

Jordan Stinson
2009-06-17 02:27:58 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Hi,I'm trying (for starters) to make the hue saturation tool visible in the toolbox. I noticed that all tools are registered in the gimp_tools_register function. In the function a tool info structure is created for each tool and the tool info visible property is set to true if tool is an image map tool type. I tried hacking this to set the hue saturation tool info object to be visible. All well and good, I thought. But when the toolbox is populated in the tool_box_create tools function, the visible property is set back to false. I set a memory breakpoint using gdb and it looks like there's a plug in that's setting the visible property back to false. So far, I haven't been able to figure out what plug in is doing this. Does anyone have any idea what plug in may be doing this or where I can find it?

Thanks, Jordan

On Tue, Jun 2, 2009 at 2:46 PM, Martin Nordholts wrote:

Jordan Stinson wrote:

Thanks for the tips. Just one quick question though. What do you mean by installing the .xml.in file? What's the difference between that file and the .xml file?

Look in menus/Makefile.am, *.xml.in is processed with xsltproc into *.xml. With "installing the menu.xml.in file" I really meant "installing the generated menu.xml" file. Sorry for being a bit unprecise ;)

/ Martin

Simon Budig
2009-06-17 02:33:49 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Jordan Stinson (jordan.stinson83@gmail.com) wrote:

Hi,I'm trying (for starters) to make the hue saturation tool visible in the toolbox.

Uhm, actually there is no need to start hacking for this:

1) Go to Windows -> Dockable Dialogs -> Tools 2) toggle the "eye" icon next to the hue-saturation tool 3) watch it appear in the toolbox.

Hope this helps, Simon

Jordan Stinson
2009-06-17 03:30:09 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Thanks for the quick response. It looks like this will get me closer to what i'm actually after. When I use this method to add the hue saturation tool to the toolbox, it persists after I close gimp and reopen it. Could anyone tell me what file it's saved to?

Thanks again, Jordan

On Tue, Jun 16, 2009 at 8:33 PM, Simon Budig wrote:

Jordan Stinson (jordan.stinson83@gmail.com) wrote:

Hi,I'm trying (for starters) to make the hue saturation tool visible in

the

toolbox.

Uhm, actually there is no need to start hacking for this:

1) Go to Windows -> Dockable Dialogs -> Tools 2) toggle the "eye" icon next to the hue-saturation tool 3) watch it appear in the toolbox.

Hope this helps, Simon

--
simon@budig.de http://simon.budig.de/

David Gowers
2009-06-17 03:36:51 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

toolrc

On Wed, Jun 17, 2009 at 11:00 AM, Jordan Stinson wrote:

Thanks for the quick response. It looks like this will get me closer to what i'm actually after. When I use this method to add the hue saturation tool to the toolbox, it persists after I close gimp and reopen it. Could anyone tell me what file it's saved to?

Jordan Stinson
2009-07-13 21:27:18 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Hi,
Could someone tell me the location of this file? I found it way back when I originally asked the question, but I can't find it anymore.

Thanks, Jordan

On Tue, Jun 16, 2009 at 9:36 PM, David Gowers wrote:

toolrc

On Wed, Jun 17, 2009 at 11:00 AM, Jordan Stinson wrote:

Thanks for the quick response. It looks like this will get me closer to

what

i'm actually after. When I use this method to add the hue saturation tool

to

the toolbox, it persists after I close gimp and reopen it. Could anyone

tell

me what file it's saved to?

Martin Nordholts
2009-07-13 21:33:11 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

On 07/13/2009 09:27 PM, Jordan Stinson wrote:

Hi,

Could someone tell me the location of this file?

Hi,

Do you mean menus/image-menu.xml.in ?

/ Martin

Jordan Stinson
2009-07-13 21:44:00 UTC (over 15 years ago)

Hacking GIMP - Gimp top level menu

Hi,
I meant toolrc. Sorry if that wasn't clear.

Thanks, Jordan

On Mon, Jul 13, 2009 at 3:35 PM, Martin Nordholts wrote:

On 07/13/2009 09:27 PM, Jordan Stinson wrote:

Hi,

Could someone tell me the location of this file?

Hi,

Do you mean menus/image-menu.xml.in ?

/ Martin