August 2011 - Posts

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.

One of the great things about Painter 12 is its new user interface. Not only does it look modern and offer more functionality, it's ultra-customizable ... if you know how. Luckily, today I'm going to start a series teaching you all the tricks to editing Painter's configuration files so you can build your own customized version of Painter.

Over the next few posts, I'll be showing you how to: 

  • Customize Icons
  • Customize Menus
  • Customize the property bar, toolbox and panels

In previous versions, the Painter user interface (UI) was built using an in-house, closed UI toolkit. It served us well for many years, but it was starting to look it age and was getting difficult to maintain on modern operating systems. So, for version 12, we've started transitioning our UI to a new, more flexible toolkit. The foundation of our new UI is built on a file format called Extensible Markup Language (XML). We've been using XML files for many years as the back-end for our brush libraries, so it seemed like a natural choice to extend to our UI. 

There are two main advantages to our choosing XML:
  1. It is a well known format encoded in human-readable plain text.
  2. The XML files are parsed and translated when Painter starts up. This means you can make changes to the UI even after the final build of the application has shipped.
So, given that so much of Painter is now defined in XML files, the possibilities for customization are huge!

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.

Now, on to the first lesson:

Customizing Icons


Let's say you've been using Painter 12 for a while, but you just can't get used to the way the new icons look.
Well, you're not stuck with them anymore! It's really easy to change them. To begin, you will need to find Painter's "Framework" folder. The Framework folder is where Painter reads all its configuration files from.

To find the Framework folder on Windows:
  • Open Windows Explorer and enter the following in to the navigation bar: %programfiles%\Corel\Painter12\Resources\12.0\Framework
To find the Framework folder on Mac:
  • Using the Finder, navigate to Applications > Corel Painter 12 and locate the Corel Painter 12.app application bundle.
  • Right-Click on Corel Painter 12.app and select Show Package Contents. This will open a new Finder window.
  • From this window, navigate to Contents > Resources > Framework
Now, to change those icons, all you need to do is:
  1. Navigate to the Framework/Images folder. In here, you'll find all the icons that we use in the application. 
  2. Find an icon you want to change. For example, let's say you want to change the default toolbox brush icon. In this case, open the "Toolbox Palette" folder and select "Brush.png":
  3. Modify the icon however you see fit. In my case, I decided to replace this brush icon with the Painter 11 version:
  4. You don't normally have write access to your installation folder (especially on Windows 7). So, you'll have to save your file somewhere you have write permissions (your desktop is a good choice) as a PNG file.
  5. Since you're not normally allowed to make changes to files directly in your install folder, you have to copy the file you saved in step #4 and paste it in the install folder, over top of the original. You should be prompted to provide the appropriate credentials.
  6. You can either relaunch Painter, or go to Window > Arrange Palettes > Default to see your updated icons.
That's it! You should be able to customize any of the icons in Painter this way. Just browse through the Images folder to find icons you want to change. You have access to the icons used by the toolbox, palettes and property bars.


As a bonus for this post, I've attached a custom icon set that looks like the Painter 11 icons here. Just unzip these files in to your "Toolbox Palette" folder.

 

We designed Painter 12 with multi-core computers in mind.  A modern multi-core computer should see significant improvements in performance over Painter 11.  In Painter 12, the work for the brushes can be split up and run in parallel on each of your CPU's cores. 

Splitting the code to run on multiple cores (Multithreading) is designed to target the scenario where a single CPU core does not have enough power to run the brush smoothly on its own. It is not free to split the work up on to multiple threads but by dividing the task in to smaller chunks the end result should give you faster performance. It is usually worth the extra cost to split things between multiple cores because what you were trying to do was basically too expensive to get done in real-time with single-threaded software.

Let's say that, for the sake of argument, a given brush requires 800 'units of CPU power' in order for it to render in real-time.  It costs 100 units to create a thread. So, if we want to split the work in to two, we would have to process 1000 units to render the brush. If your particular CPU has 2 cores each providing 500 units, then by threading the brush code to run on both cores, we're able to achieve real-time rendering. The result is that this brush is now faster than it was in Painter 11.

However, after the release of Painter 12, we began to hear feedback from some of our users that Painter 12 was not as fast as expected. After some investigation, we found two common reasons why things might get slower: 

  1. The amount of work needed to render a brush is so small that the added cost of multi-threading is not worth it. 
  2. Multiple threads can interfere with each other when sharing hardware resources. This is a problem when you have very few cores available or are running many processor-intensive applications at once. 

To address issue #1, the release build of Painter 12 included the Multicore checkbox in the General brush controls panel.

 

A challenge we've got is that there are so many combinations of brush settings available that it was impossible for us to consider all the different cases where it made sense to disable the multicore checkbox. We benchmarked every brush variant in the application and we believe that we've correctly identified the variants that should and should not have the multicore checkbox enabled. However, your individual hardware configuration and preferences come in to play so it's important to make your own determination on whether you prefer having the multicore feature enabled for each of your favorite variants.

A simple guide is that the bigger the radius, the more likely multicore will have a positive impact. If you use small brushes, or find that a few variants don't perform as well as expected, turning off this checkbox will prevent Painter from trying to split up the brush operations on multiple threads. You will save the cost of the threading overhead and your brush performance may improve. (Chris has some thoughts about the multicore checkbox in his blog here.)

Issue #2 is more interesting.  Extending the example from above, let's say that on your particular computer you're simultaneously running another CPU-intensive application. Perhaps you're recording your work in Painter using a screen capture utility or maybe you're playing back a script in Photoshop. Now Painter is in competition with that other software. Painter mistakenly believes that it has exclusive access to all the CPU resources available on your computer. But, if that other application subtracts 200 units of your available CPU power, Painter still requires 1000 units to complete and your CPU no longer has enough units available.  The more cores you have, the messier this can get as each additional core adds another possible point of contention with another program.

We have no way of knowing what kind of programs you're running on your computer and so balancing Painter's CPU usage with other programs is a big challenge. So, to address this problem, we have added a new feature to Service Pack 1: The Multicore Usage Slider.

The Multicore Usage Slider allows you to manually configure the maximum number of cores you want to allow Painter to use.

To change the multicore usage slider value on your copy of Painter go to Edit > Preferences > Performance... (on Windows) or Corel Painter 12 > Preferences > Performance... (on Mac). 

You must restart Painter to see the effect of your change.

By default, we now use 1 core less than the maximum on your system. Out of the box, this will ensure a good level of threading and leave one core free for operating system functions and other applications. If you're a heavy multi-tasker, you may want to try lowering your Usage slider slightly. If you have an 8-core machine, you may choose to play with setting the slider to any number from 1 through 8. On my machine, I have been finding that a value of 7 gives pretty good results.

Running Painter this way will reduce the amount of CPU cores that Painter tries to use. This should result in a smoother sharing of resources between Painter and other applications on your system. 

 

Hopefully, you'll find that Painter 12 performs better with this change.