Re: Hacking GIMP - Gimp top level menu

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

 



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@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux