Hacking GIMP - Gimp top level menu

View: New views
9 Messages — Rating Filter:   Alert me  

Hacking GIMP - Gimp top level menu

by j2stinso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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





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

Re: Hacking GIMP - Gimp top level menu

by Martin Nordholts-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <menu>-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
_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Parent Message unknown Re: Hacking GIMP - Gimp top level menu

by j2stinso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <enselic@...> wrote:
Jordan Stinson wrote:
Thanks for the tips. Just one quick question though. What do you mean by installing the <menu>.xml.in <http://xml.in> file? What's the difference between that file and the <menu>.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


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

Re: Hacking GIMP - Gimp top level menu

by Simon Budig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jordan Stinson (jordan.stinson83@...) 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@...              http://simon.budig.de/
_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: Hacking GIMP - Gimp top level menu

by j2stinso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <simon@...> wrote:
Jordan Stinson (jordan.stinson83@...) 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@...              http://simon.budig.de/
_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


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

Re: Hacking GIMP - Gimp top level menu

by David Gowers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

toolrc

On Wed, Jun 17, 2009 at 11:00 AM, Jordan
Stinson<jordan.stinson83@...> 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?
_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: Hacking GIMP - Gimp top level menu

by j2stinso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <00ai99@...> wrote:
toolrc

On Wed, Jun 17, 2009 at 11:00 AM, Jordan
Stinson<jordan.stinson83@...> 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?


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

Re: Hacking GIMP - Gimp top level menu

by Martin Nordholts-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

Re: Hacking GIMP - Gimp top level menu

by j2stinso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

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

Thanks,
Jordan

On Mon, Jul 13, 2009 at 3:35 PM, Martin Nordholts <enselic@...> 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



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