2.2. Creating Tracedisplay Tools

Creating Seismon Tracedisplay tools and adding them to the tracedisplay window is a simple task involving only a few steps. Basically you have to create one interface function (the init function) which lets Seismon know what kind of tool you provide and a set of callback interface functions which depend on the type of your tool and which control the user interaction.

The basic steps to do to get a working tool in the tracedisplay window are:

  1. Create a new directory in the pkg_trace_display/tools folder holding your tool functions. The folder has to start with the prefix +tool_ followed by your tool name (e.g. +tool_exampleCommandTool).

  2. Inside this directory create an m-file named init.m which is the initialization file for your tool. This file has to contain the init function. The init function is executed every time the tracedisplay module is started and lets Seismon know what kind of tool you provide.

  3. Implement the init function in the init.m file according to your needs. The init function has to return an instance of a tdToolRoot class. Take a look at the tool examples below to find out more about the coding guidelines.

  4. Create and implement the functions that are going to be called by the tool (e.g. a command tool will require one function, the callback function to be created). This point will get clearer when going through the example tools below.

One important thing that you will need when placing your tool root in the existing tracedisplay menu is the menu tag of the parent menu (the menu where you like your tool to appear). The tags of the menus in the tracedisplay window are named as m_MENUNAME. For example, the tag of the Analyze menu is m_analyze, the tag for the Localize menu is m_localize, and so on.... .

I didn't include an automatic creation of these parent menus, because I don't think that it's needed that often and if needed, it's very easy to add by editing the tdTraceDisplay.buildmenu function.

This chapter will guide you through the creation of tools using some example tools. You can find the example tools in the seismon examples (SEISMONROOT/examples) folder. Just copy the corresponding +tool_TOOLNAME folder into your pkg_trace_display/tools folder, start the tracedisplay module and the example tools will appear in the tracedisplay menu after selecting the example category in the tool preferences as described in Section 2.1.

Note

If you have downloaded the Seismon source using the SVN client, than there is a hidden directory called .svn in each of the example tool directories. To avoid possible troubles with the SVN updates, please delete the .svn folder from the example tool directory after you have copied it to the pkg_trace_display/tools directory.

The following sections will guide you through some of the tool examples.