Thursday, February 13, 2014

GEDCOM Plugin for Notepad++: Now with Automatic Install

Earlier this week, the GEDCOM plugin made it to the official list of Notepad++ plugins. Registering a plugin and getting it accepted is fairly easy. But there is a big benefit to the user: your desired plugin is just a click away. No more downloads, unpacking zips, and copying files to multiple directory locations.

You can thank the Plugin Manager (also a plugin!) developed by Dave Brotherstone for this effective system of plugin management. When you register a plugin, you supply the information the Plugin Manager needs to find your zip (a download URL), identify its version, and tell it what needs to be extracted and where it should go. With just that information the Plugin Manager can perform installs and updates of registered plugins. It does this magic and also stops and restarts Notepad++ to make the changes take effect. And if the plugin doesn't do what you want, it's just as easy to remove it.

Plugin Manager also updates its list of available plugins from the plugin registry. There are actually two lists, a list of registered but not yet vetted new or updated plugins, and then the current official list which is downloaded by Plugin Manager. When you issue the command Plugins->Plugin Manager->"Show Plugin Manager", it displays the current official plugin list. Here is a screenshot of that from version 6.5.2 of Notepad++ taken today (13 Feb 2014):

You will notice that GEDCOM Lexer is still at version 0.1. Generally, Plugin Manager will lag behind the latest and greatest, for that you may still need to do a manual update.

Wednesday, February 12, 2014

New in GEDCOM Plugin v0.2: Navigating by NAMEs

GEDCOM Plugin v0.2 can now use the Function List to navigate to individual names. This allows you to double-click a name in a list to go directly to that INDI record in the GEDCOM file.

Notepad++ has a Function List plugin that comes already installed (more...). At one time this was an independent plugin developed by Jens Lorenz, but has been integrated into the main program since version 6.4.

The Function List panel (shown above) can be displayed by clicking the "Function List" command under View on the main menu. Any file type can define a rule for filling the Function List panel. Each node in the list serves as a hyperlink to a location in the file. Double-clicking on a node will take you straight to that file location. The larger image below better illustrates the relation between a viewed file and the Function List panel.

Setting up the Function List for the GEDCOM file type requires adding two entries to Notepad++'s functionList.xml configuration file. This file is user specific, so it is located in the directory: %APPDATA%\Notepad++.

The first entry associates the function list rule with a particular language and this takes the form of an <association> element under the <associationMap> section. For GEDCOM add this element line:
<association langID="XX" id="gedcom_name"/>
The "XX" following langID is a placeholder for whatever language ID number has been assigned to GEDCOM for your installation of the plugin. For Notepad++'s internal languages, there are fixed numbers assigned to each language (file type). But for external languages, this number can vary depending on what version of Notepad++ you are using and whether you have other external languages installed. Starting with v0.2 of the plugin, this langID is determined for you and displayed in the About dialog ("57" in this example):
The second entry defines the function list rule as a pair of regular expressions and takes the form of a <parser> element under the <parsers> section. To populate the Function List with NAMEs from GEDCOM INDI records, add this block:

<parser id="gedcom_name" displayName="GEDCOM Names">
    <nameExpr expr="(?&lt;=([\d][\x20]NAME[\x20])).*?([\r]|[\n]|[\r][\n])"/>

Note that if an INDI record contains more than one PERSONAL_NAME_STRUCTURE, only the first one encountered will be displayed. To learn more about the Function List see the Notepad++ Function List page. To download this example functionList.xml file, grab it from the SampleFiles area on SourceForge.

Tuesday, February 11, 2014

New in GEDCOM Plugin v0.2: Preserving Style

This release of the GEDCOM plugin for Notepad++ adds two new features. First, the plugin now preserves your style customizations when updating, and second, something called a "langID" is displayed in the About dialog. (It is needed for Notepad++'s Function List.) In this post, I'll discuss the first one.

When first installed, the plugin styles the text of a GEDCOM file using the default global style font (for my system it is Courier New, size 10, black on white) and adds the following style adjustments for each grammar element:

LEVELitalic, green on white
TAGbold, navy blue on white
IDbrown on white
POINTERunderlined, orange on white
INVALIDred on white
VALUEmedium grey on white
ESCAPEdeep sky blue on white
USER TAGbold, magenta on white

All of this styling information comes from the GedcomLexer.xml file that was initially installed. 

Notepad++ has a great Style Configurator dialog which is reached from the main "Settings" menu with the "Style Configurator..." command. Using this tool, you can tweak the appearance of the elements for each language type. If you select the GEDCOM language, the Style column lists all of the grammar elements: LEVEL, TAG, ID, POINTER, etc. The panel on the right allows you to set foreground and background color as well as font attributes for each selected grammar element.

Each time you save and close this dialog, Notepad++ writes your changes to GedcomLexer.xml.

When an update is done "manually" by downloading a zip and extracting the files, or by using Notepad++'s plugin manager, the old GedcomLexer.dll and GedcomLexer.xml files are overwritten with the new ones. In anticipation of this, v0.1 of the plugin, already created a backup of the configuration each time Notepad++ is closed. This backup file is called GedcomLexer.last and is kept in the same directory as GedcomLexer.xml.

So starting in v0.2, styles are preserved during an update by copying the style information from the backup file GedcomLexer.last to the new GedcomLexer.xml.  This copy is not performed every time the plugin is started, it is only done when the version of the new GedcomLexer.xml is different than the version of GedcomLexer.last. The version is an attribute in the header of these configuration files, that is incremented with each release.


Popular Posts


Total Pageviews

Google+ Profile

Follow by Email