Sunday, August 28, 2011 8:26 PM DanielJ

Hardcore Customization - Part 2 - Customizing Menus

In this post, I’ll show you how to customize Painter’s menu structure. To begin, you need to locate the folder that holds the resources specific to your particular language. Chances are, if you're reading this post, you'll be interested in the English language resources. To find the English resources, you'll need to look in a folder parallel to the Framework folder. (Please refer back to Part 1 for help on finding the Framework folder.) If you've found the Framework folder, navigate one level higher in the tree. At this level, you should find be able to select the EN folder on Windows or English.lproj on the Mac. (If you’re running a localized version of Painter, you’ll want the folder that corresponds to your language. Example, JP = Japanese).

 

Changing the text in a menu item:

Now, let’s say you’re familiar with another program that has a feature called New from Clipboard that creates a new document based on the current contents of the clipboard. In Painter, this feature is called Paste in New Image.   Maybe you’re frequently overlooking this feature in Painter because the name is different than you’re expecting. In this case, it might be worth renaming the menu item. 

 

WARNING: Changes of this nature are not supported by Corel. You can render Painter unusable if you make a mistake. Make sure that you have backups of any files that you modify. MODIFICATIONS OF PAINTER XML FILES IS DONE AT YOUR OWN RISK.


Here’s how you’d do that:  

  1. Open EN/MenuStrings.xml in a text editor. (Notepad on Windows or TextEdit on Mac should be fine). 
  2. Search for the text you’d like to replace. (“Paste In New Image”)
  3. You should find a line that looks like <string key="Paste_In_New_Image" value="Paste In New Image"/>
  4. Replace the text in between the quotes after value. Ex.:<string key=”Paste_In_New_Image” value=”New from Clipboard”/>
  5. Save the file. (Note: If you don’t have write permissions for this file, you may have to save it first on your desktop and then manually copy the updated file back to its original location.)
  6. Re-launch Painter

That’s it!

 

Moving a menu Item:

Extending the previous example, let’s say that you’d like to put that menu item in a different menu dropdown. Logically, you might want to put New from Clipboard in the File menu below the normal New... command.

To do this: 

  1. Open EN/CommandBars.xml in a text editor.
  2. Search in CommandBars.xml for the menu item you’d like to move. Now, this can be difficult as this is a big file and is difficult to navigate. Matters are complicated by the fact that Painter uses special keys to identify menu items, not normal English text. Remember the key field from MenuStrings.xml? That’s the same key you’ll need in this file. For “Paste In New Image”, the key is Paste_In_New_Image.
  3. You should find the line: <item guidRef="MenuEdit|Paste_In_New_Image"/>
  4. Cut that line from the Edit menu
  5. Find the File menu block. To find the File menu, look in MenuStrings.xml for a menu command that's already in the File menu. (New... for example.) Make note of the key associated with that menu item and search for that key in CommandBars.xml. Paste the line from step 3 somewhere in to the File menu block. Finding menu items in CommandBars.xml will get easier the more you work with the file. You'll start to recognize the patterns and should begin to be able to read the keys with some practice.
  6. You should now have something that looks like this:
    <commandBarData guid="C3EB32DD-9761-41CB-941F-917BC1F553D8" type="menu" nonLocalizableName="File" flyout="true">
    	<container>
    		<item guidRef="MenuFile|New"/>
    		<item guidRef="MenuEdit|Paste_In_New_Image"/>
    	...
    
  7. Save and re-launch Painter:

Creating your own menu

If this level of customization is not enough for you, you can push Painter even further by creating your own top-level menu dropdown.

You can copy as many menu items in here as you’d like. You can have duplicates of menu items. You can keep a copy of a menu item in its original location. It’s up to you to decide how you’d like to structure things. In this example, I will create a "My Stuff" menu holding a few of my favorite menu options.

Here’s how to create your own menu: 

  1. From the Framework folder, open the file called ItemData.xml. This file lists all the menu bars and menu items available to Painter.
  2. At the bottom of this file, we're going to define our own custom menu bar. To do this, add a new itemData entry. For your new entry, you need to create your own guid entry. Start with "MenuOther|" then append your any name you'd like, just keep it sorter than 20 characters.
    For example:
    <itemData guid="MenuOther|Stuff"/>
  3. Next, add a flyoutBarRef property to the itemData entry from step 2. You can name this anything you'd like.
    For example:
    <itemData guid="MenuOther|Stuff" flyoutBarRef="MainMenuStuffMenu"/>
  4. From the EN folder, open the file called CommandBars.xml. This file defines the arrangement and content of alll the menus in Painter.
  5. Near the top of the file, you should see a section titled "MainPainterMenuBar". Add a reference to your new menu bar. Like this:
    <commandbardata guid="MainPainterMenuBar" type="menu" nonlocalizablename="Menu Bar" novertdocking="true">
    	<container>
    		<item guidRef="MenuFile|Painter_Menu" os="mac"/>
    		<item guidRef="MenuFile|File"/>
    		<item guidRef="MenuEdit|Edit"/>
    		<item guidRef="MenuOther|Stuff"/>
    		<item guidRef="MenuCanvas|Canvas"/>
    
  6. From the EN folder, open the file called MenuStrings.xml. In here, we'll add the text to display for our new menu.
  7. Search MenuStrings.xml for "MenuOther". At the bottom of the category, just before the </category> tag, add a new entry for the menu bar:
    <string key="Stuff" value="My Stuff"/>
  8. Save all your modified files & relaunch Painter
At this point, you've defined a container to hold other menu items. It won't get interesting until we add our own menu items.

 

To add menu items to your new menu flyout:
  1. From the EN folder, open the file called CommandBars.xml.
  2. You need to define the menu that will drop down. This is done by adding a commandBarData entry to the end of CommandBars.xml (right before the </commandBars> tag). Like this:
    <commandBarData guid="MainMenuStuffMenu" type="menu" nonLocalizableName="Stuff Menu" flyout="true">
    </commandBarData>
  3. Next copy and paste any itemData entries that you want in to your new menu.
    Like this:
    <commandBarData guid="MainMenuStuffMenu" type="menu" nonLocalizableName="Stuff Menu" flyout="true">
    	<item guidRef="MenuFile|New"/>
    	<item guidRef="MenuGrid|Show_Grid"/>
    	<item guidRef="MenuLayers|Duplicate_Layer"/>
    </commandBarData>
    This adds the command New..., Show Grid, and Duplicate Layer to our new menu.

 That's it! Now you can make any kind of menus you'd like. Let me know if you have any trouble.

Comments

# re: Hardcore Customization - Part 2 - Customizing Menus

Thursday, September 08, 2011 6:50 PM by nightshadow

Fascinating and interesting too. Thanks for giving us some insight into the Painter interface.

# re: Hardcore Customization - Part 2 - Customizing Menus

Saturday, September 10, 2011 6:35 PM by Robert

Thanks so much for this Dan!  This is extremely useful information!  Please keep it up...

# re: Hardcore Customization - Part 2 - Customizing Menus

Friday, October 14, 2011 2:51 PM by zag

Hello Dan!

thanks a lot for these post! would be very usefull!

May be time to me ask you something which make me sad since V7.

i use painter since long time, using it in live performance with dancers or musicians. My hardware set is two screens one for all tools and a other monitor spitting with a video-projector reaching the stage with  only the master window on which the draw is performed. I do never update to the other version since 7 because all the dialog boxes(fill,effect....) open on the master windows and so are visible on the stage which is not possible for my painting performance which need to hide all except art. Do you help me to find the way to make these dialog windows appear only on the first screen dedicated to the tools. This was changed since V8 i think so i still work on V7 and it is a pity i can't update and use the newest version. I hope now 12 could permiss ( as i read your post) to modify  with your help by myself this so restrained problems i have since years. Thanks a lot Dan.i wish hear from you soon...best regards Christian (zag)