...


Technical Support October 2004 Tutorial
Click here to return to the newsletter

A Tutorial on

Adding basic language support, custom highlighting and custom templates

For this tutorial we’ll create a Language and Filename Extension that does not currently exist in Multi-Edit: FAQ.

First thing to do is the creation of the basic items. Under Tools | Customize in the General section you’ll first click on the Languages button. In here you’ll then choose Insert and the Language Setup dialog will come up blank. At this time we’re just going to enter the Language name FAQ.


After that, OK your way out back to the General section of Customization. Here you’ll select Filename Extension this time and then choose to Insert a new extension. A Create New Record dialog will appear and it is here that you will type in FAQ for your new filename extension and hit OK. This will bring up the Edit Filename Extension Setup dialog where we will go ahead and click on the “…” for the associated Language and choose FAQ.


Now we’ve linked the extension with the language. Prior to this, FAQ files were handled as straight default files and you could not customize them specifically, but now we can. To do so, we now need to define certain items for the language by returning to the Language setup dialog for FAQ.

Now the main reason we’re doing all this is so we can customize our viewing/editing environment of FAQ (or any other) file type. This concerns all the different items that we are able to customize, found under the Filename Extension Setup item Colors. They include (in their respective categories):

Editing:
  • Normal Text
  • Highlight Text
  • Search Highlight Text
  • Page Break Text
  • Changed Text
  • End of File
  • Current Line Text
  • Current Line in Block Text
  • Line Changed Marker
  • Right Margin Marker
Syntax Highlighting:
  • Reserved Words 1
  • Reserved Words 2
  • Reserved Words 3
  • Reserved Words 4
  • Symbol Text
  • Brackets
  • EOL Comment 1
  • EOL Comment 2
  • EOL Comment 3
  • EOL Comment 4
  • Open\Close Comment 1
  • Open\Close Comment 2
  • Numeric Text
  • String Text
File Compare:
  • File Compare Difference
  • File Compare Inserted
Tag Highlighting:
  • Tag Reserved
  • Tag Symbol
  • Tag Comment
  • Tag Attribute
  • Tag Value
  • Tag Script

So, as you can see from this list, there is a great deal we can manipulate in how we view our editing environment. Some items (mostly under Editing) are static items that are predefined like Normal Text and the rest are items that we define or are defined under the specific language that we’ve assigned to be linked to our extension.

Note: Coloring is set in the Extension setup and not the Language setup, this means you can set up two different extensions that both utilize the same language (with all its reserved words, comment markers, etc.) and customize the highlighting completely differently for each if you so desire.

In this example I’ve only defined a few things for our FAQ language as seen below.

Reserved words 1 and 2, some Symbols and Block Comment 1.

All these items can be from existing languages if you wish to emulate a specific language or completely customize your own file types as you see fit. The Reserved words and Symbols are pretty self explanatory, but you may be wondering at the Block comment Open and Close choices. I’ve used yet another of Multi-Edit’s handy tools, the Line Draw tool, to further customize my FAQ files. Let’s open a FAQ file up and see what I’m talking about.

First, you’ll need to go into Tools | Customize | Editing and choose the OEM Terminal font for editing. When using the Line Draw tool, you must have a font that supports it and Terminal is one of the few that does. Once you’ve done that, open a FAQ file. Go ahead and position the cursor somewhere midway into the document. Then, go to Tools | Linedraw. I’ve selected double because I like the look of it better for making my Header boxes.

Now, click back on the editing window where you want to create your header box. Holding down the Shift key, use the arrow keys to create your box. Once completed, you’ll have something that looks like this:

Before drawing the box, I went ahead and typed my text first so I wouldn’t have to deal with adding and deleting spaces to get my box back into shape after inserting text.

Now, to get Multi-Edit to treat this whole thing as a comment, thus allowing you to highlight it a different set of colors, you’ll need to copy and paste the Open and Close characters from here into your Language Setup dialog. This has to occur one character at a time unless you are utilizing a separate utility/program to copy both the Open and Close character. So, copy the Open character, go into the Language Setup Dialog for FAQ and paste it there. Then, OK out to return to the editing window, copy the Close character and go back in and paste that as the close. You’ll see after putting the Opening comment character in the Language Setup dialog that it immediately italicized and colored the comment. This is due to the fact that even though we’ve not yet defined colors, there are default colors and highlighting that occurs, which we’ll see when we get to the point of selecting a color template and subsequently customizing it.

To see what the characters translate into and why they get recorded in the Language Setup Dialog as the É and ¼, just go back into Tools | Customize | Editing and switch the font over to an ANSI font and you’ll see something completely different.

Now that we’ve got everything defined under our FAQ language that we want to be able to manipulate, we need to go back into the Filename Extension Setup and change some colors!

First, there are a number of pre-made color templates to work from. In this instance, I decide to choose the Light Blue Background because it has the basic look of what I want to have for my highlighting and background coloring.

Then, to go through and change the few things I specifically want different from the original template. In the following image I am changing the Open\Close Comment 1 (the one we setup for the Line Draw tool). Initially it is a brown color and is italicized like most comments are done. I’ve changed it to a dark pink and made it bold so it sticks out more. To change the color of the text and its background all you have to do is select the item you want to change, then left click on the color you want as the text (foreground) and then right click on the color you want as the background. You’ll want to rename the color template as well while making your other changes. I’ve named this template FAQ Colors. The absolutely most important thing to remember after making all your changes is to hit the Save button up on the left side below the template name before you hit the OK button. Otherwise, if you just OK out of the dialog you’ll have to come back in and redo all your customizations again.

So, now that we’ve got all of our customizations done and in place, our FAQ files now have a completely different look from when we started. And, all this info can be translated to any of the 50+ languages that Multi-Edit supports!

While we’re at it, let’s create a real simple template for our FAQ files. In the Filename Extension setup click on the “…” for Templates. Then choose Insert. I named this template FAQ to keep the naming all the same. Now that we’ve done that, we’ll want to go to Tools | Customize and select Templates to add items to our new FAQ template.

I want to create a template for expanding asterisks to the right margin. Clicking on the Insert allows you to name it. Then you can select it out of the list (it being the only one at the moment) and fill in all the info to the right for it. We’ve made it so that typing **<Spacebar> will cause a string of 80 asterisks to jump into being on your doc.

For more examples of all the different things you can do with Templates, take a look at some of the predefined ones and those that you find useful you can move into your own customized Template set.

So, our final Filename Extension setup for FAQ looks like this:

Note that we have to put a check in next to Auto-template expansion, or the templates won’t expand.

And that brings us to the end of our exercise. Obviously, as you could see from all the other options that we didn’t utilize, customization of each file type can get pretty detailed, which makes Multi-Edit so great for people who like to work in an editing environment that is specifically designed to their own specifications.

Carl Hall

MESI Staff, Technical Support

..

If your e-mail application has trouble viewing this in HTML format, you can also view it online at http://www.multieditsoftware.com/TheDev/langsupport.htm


Copyright © 2004 Multi Edit Software, Inc. All rights reserved. Multi-Edit, the Multi-Edit "packaging"and logo, are trademarks of Multi Edit Software, Inc. All other marks and names mentioned herein may be trademarks of their respective companies.

Multi Edit Software, Inc. 3370 N. Hayden Rd. #123 pmb 712 Scottsdale, Arizona 85251