Geosoft GX Developer 8.5

Oasis montaj Menus and Toolbars

GX's can be organized for your users to run using either Oasis montaj menus (.omn) with sub-menus (.cmn), or placed on a Toolbar (.geobar).  This section documents how to use menus and toolbars.


 

 

Oasis montaj Menus

An Oasis montaj menu file (.omn) and sub-menu file (.smn) define menus that can be added the Oasis montaj menu bar. Menus organise suites of GXs and internal commands into logical processing groups and workflows to be presented to your user. You will normally create a menu specifically for your own application suite, and your user will load your menu by clicking the Load menu option on the GX menu. The contents of your menu will be inserted into the displayed Oasis montaj menus.

Note that only menus with extension .omn will be displayed in the menu browse tool.  Menu files with extension .smn are for menus that will only be included in other menus.  A menu may load submenus using the LOADMENU directive followed by the sub-menu name.

For example, following is the menu file for the gravity reduction system (gravity.omn): 

/
/ Gravity reduction system
/------------------------------------------------------------------------------
 
MENU "&Gravity"
ITEM "Pro&ject information..."       ,grproj.gx
ITEM "&Processing parameters..."     ,grparm.gx
SEPARATOR
SUBMENU "&Base stations"
SUBMENU "&Calibration"
SUBMENU "&Locations"
SEPARATOR
SUBMENU "&Import"
ITEM "&Drift correction..."          ,grdrift.gx
ITEM "&Merge with master database...",grappend.gx
SEPARATOR
ITEM "Process &repeats..."           ,grrepeat.gx
SUBMENU "&Terrain corrections"
ITEM "&Free air, Bouguer anomaly..." ,grboug.gx
SEPARATOR
ITEM "Edit file..."                  ,edit.gx
ITEM "Sort all by &1 channel..."     ,sortall.gx
ITEM "Sort all by &2 channels..."    ,sortall2.gx
ITEM "E&xpression..."                ,math.gx
ITEM "Expressi&on file..."           ,mathfile.gx
 
 
MENU "&GravRed/&Import"
ITEM "&Import gravity survey..."     ,grload.gx
SEPARATOR
ITEM "&Edit data file..."            ,edit.gx
ITEM "&Download from CG3..."         ,grdnlcg3.gx

Menu Keywords

Each line of a menu file is either a comment, a blank line, or a keyword followed by parameters. The following table describes each of the supported keywords:

Keyword

Parameters

Description

CLEARALL

None

The CLEARALL keyword will clear all menus; excluding the coremenus.omn   This enables your menu to completely control the Oasis montaj environment for your specific application.  The CLEARALL keyword, if used, should be the first keyword in your menu file.

If you use this keyword, you should provide your user with access the *ID_CLEARMENU internal command somewhere in your menu system.  This command will allow your user to reset the menus to the Geosoft coremenus.omn.

MENU

Name

This identifies a new menu, which can appear on the Oasis montaj menu bar, or may be a submenu that will become part of a previously defined menu.  Each MENU line is followed by one or more ITEM lines, SUBMENU lines or SEPARATOR lines.

You can also specify the name of a pop-up menu that is activated when the right-mouse button is pressed.  Pop-up menus are context sensitive, which means that the menu that appears depends on the current mode and the object that is under the mouse cursor at the time the right-mouse button is pressed.

SUBMENU

Name

This identifies a menu entry that will be a sub-menu in the menu list.  There must be a MENU associated with the submenu later in the OMN file, and the name in the MENU must be “menu_name/sub_menu_name”.  See the above example.  Submenus may also be nested.

SEPARATOR

None

Places a separator to space items in the menu list when displayed.

LOADMENU

File

Load another menu file.  If you need to share certain menu components among applications, it is easier to store the menus in a separate menu file that can be included in other menu files.  If a menu file is never intended to be used by itself, you should give it extension “.smn” to prevent the file from appearing in the load menu browse tool.

All menu files are located in the <geosoft>\omn directory by default.  Menus that are not located in this directory must be specified explicitly (see File Names below).

LOCATE

TOP

BOTTOM

AFTER "Name"

BEFORE "Name"

 

Controls the location of the menu items that follow.  The AFTER and BEFORE require the name of a menu item that already exists in the menu.

ITEM

Name, Action

<image.bmp[i]>

{?context}

An ITEM in a menu identifies an action that will happen when your user selects the item.

Name is the text that appears in the menu.

Action can be the name of a GX, a GS script, a Sushi PDF file, a Win-32 help file, or the name of an internal command. GX, GS, PDF and help files must be in the project directory or in the Geosoft directory, or the locations must be specified explicitly (see File Names below).

Internal commands must be one of the commands listed in the Internal Command table below.

Action can also be a SHELL command that will execute an operating system command. See the “SHELL item action below for more information.

<image.bmp[i]> indicates this item will show an image in the menu to the left of the item.  The [i] indicates the position of the specified icon or picture within the larger bmp file.

{?context} is a context test that if not true will shade the item Name in the menu.  The following contexts are supported:

{?map}                          a current map is open

{?gdb}                          a current database is open

{?map_or_gdb}       a current map or database is open

{?map_and_gdb}    a current map and database are open

LOADTOOLBAR

“Name.geobar”

Loads a toolbar into the project. See “Working with Toolbars” below.

Pop-Up Menus

A pop-up menu is a context sensitive menu that appears when the right mouse button is pressed. The menu that is displayed (popped-up) depends on what has been selected, where the mouse is located and/or the current mode of Oasis montaj. The default oasis pop-up menus are defined in the file montaj_popups.smn in the Geosoft directory. The following table lists some of the available pop-up menus:

 

Popup Name

Context

@PopupSelLine

Line/group

@PopupSelChanNone

Empty channel

@PopupSelChan

Loaded channel

@PopupSelData

One or more date items selected in a channel/line

@PopupSelBDat

Data from all lines on this channel

@PopupSelProf

Cursor in a profile window

@PopupSelFid

Fid is selected

@PopupMap

Map with nothing selected

@PopupSelGroup

Group selected and in context

@PopupSelView

View selected and in context

@PopupSelItem

Group edited and item selected

@PopupSelGrid

AGG group selected

@PopupGroupEdit

Group opened for edit, nothing selected

@PopupMapGroup

Map in group select mode, no group selected

@PopupMapView

Map in view select mode, no view selected

@PopupSelCSymb

Colour symbol group selected

@PopupBoxMark

Group edited, multiple items selected

@PopupSelPAGG

Poly-aggregate (animation) selected

Oasis montaj Toolbars

An Oasis montaj toolbar file (.geobar file) defines a single toolbar that can be added to any Oasis montaj project. Toolbars organise suites of GXs and internal commands into logical processing groups to be presented to your user. You will normally create a toolbar specifically for your own application suite, and the first thing your user will do is load your toolbar by right-clicking the Toolbars section of the project explorer and selecting Add toolbar(s)…. The user can then browse to the bar directory and load your toolbar.  The bar will be loaded and displayed in default fashion and added to the list in the project explorer.

Note that each toolbar needs to have its own .geobar file.

For example, following is the toolbar file for a small toolbar installed with Oasis montajViewer:

TOOLBAR "Standard Bar"
ITEM  "Open database...", *ID_FILE_OPEN_DATA <standard.bmp[2]>
ITEM  "&Open map...",     *ID_FILE_OPEN_MAP  <standard.bmp[5]>
SEPARATOR
ITEM  "Run &GX...",       gxrun.gx           <standard.bmp[13]>
ITEM  "&Load menu...",    *ID_VIEW_LOADMENU  <standard.bmp[14]>

Toolbar Keywords

Each line of a toolbar file is either a comment, a blank line, or a keyword followed by parameters. The following table describes each of the supported keywords for toolbar files:

 

Keyword

Parameters

Description

TOOLBAR

Name

This identifies a new toolbar, which can appear on the Oasis montaj project explorer.  Each TOOLBAR line is followed by one or more ITEM lines or SEPARATOR lines.

Only one toolbar should be specified per .geobar file.

ITEM

Name, Action

<image.bmp[i]>

{?context}

An ITEM in a toolbar identifies an action that will happen when your user selects this button on the bar.

Name is the text that appears in the tooltip when the user hovers over the button for a couple of seconds.

Action can be the name of a GX, a GS script, a Sushi PDF file, a Win-32 help file, or the name of an internal command. GX, GS, PDF and help files must be in the project directory or in the Geosoft directory, or the locations must be specified explicitly (see File Names below).

Internal commands must be one of the commands listed in the Internal Command table below.

Action can also be a SHELL command that will execute an operating system command.  See the SHELL command description for more information.

<image.bmp[i]> indicates this button will show an image.  The [i] indicates the position of the specified icon or picture within the larger bmp file.

{?context} is a context test that if not true will shade the item Name in the menu.  The following contexts are supported:

{?map}                          a current map is open

{?gdb}                          a current database is open

{?map_or_gdb}       a current map or database is open

{?map_and_gdb}           a current map and database are open

SEPARATORNone

Places a separator to space items in the toolbar when displayed. 

Menu and Toolbar File Names

Files to be located by name, either in OMN files, GEOBAR files, or in scripts, will be located either in their default location (<geosoft>\omn for menu files, <geosoft>\gx for GX files), or in the location explicitly identified by a full path name.  For explicitly located files, you may use a prefix <label> to identify a directory in which to locate a file.  Allowable <label> values are:

LabelLocation
<geosoft>the main Geosoft installation directory.
<geosoft2>the secondary Geosoft installation directory (typically user).
<geotemp>the Geosoft temporary file directory.
<windows>the operating system Windows directory.
<system>the operating system SYSTEM directory.
<other>other environment variables.  The “Geosoft/Oasis montaj/Environment” registry is searched first.  If the name indicated by “other” is not found, the user’s environment is searched.

For example, if you install your custom system, including GXs, in the user\my_system directory, you can identify the GX in your OMN file as follows:

ITEM,”Run one of my GX’s”,<geosoft>\user\my_system\my_gx.gx

The SHELL command

An ITEM can use the SHELL action to identify an operating system command to be executed.   The SHELL action syntax is as follows:

 ITEM "Text" ,SHELL(verb;file[;parameters;directory;ShowCmd] )

 ITEM "Text" ,SHELL(WinHelp;data[;nCmd])

The Windows "ShellExecute" command is called with the specified parameters.  For the WinHelp verb, the Windows WinHelp command is used.  Please refer to your Windows API documentation for the use of these parameters.  Note that the items in square brackets are optional and are for special use when full control of the Windows functions are required..  ShowCmd and nCmd are both integer values that can be set to the Windows manifest constant values as required.  By default, ShowCmd will be  1 (SW_SHOWNORMAL), and nCmd will be 258 (HELP_COMMAND).

The following are common examples show how to use the SHELL command:

ITEM "&Geosoft Website",SHELL(open;http://www.geosoft.com)
ITEM "&Geosoft Website",SHELL(open;http://www.geosoft.com)
ITEM "&Send a message",SHELL(open;"mailto:geonet@lists.geosoft.com")
ITEM "&Subscribe",SHELL(open; "mailto:majordomo@lists.geosoft.com?subject=Subscribe%20to%20GEONET%20user%20help%20list.?body=SUBSCRIBE%20gxnet")
ITEM "Ho&w to get help...",SHELL(WinHelp; "JumpID(\"oe32.hlp\",\"ID_HELP_TECH_SUPPORT_TOPIC\")") 

Internal commands

Menu and toolbar items can also activate an internal command, which can be named in an ITEM.  Note that internal commands are not stored in a script or in the processing log file. Only GX commands and GX parameters appear in a script of a log file. If scripting is required, most commands can be emulated by writing a GX that performs the required action. 

Displaying images for items in menus

Menu items can display images (icons really) to stress what an item does or represents.  Icons must be 18 x 18 in size (pixels) and can be stored individually or contained in a larger bitmap file and indexed by the image number in square brackets [].  For example, if my bitmap file contains six 18 x 18 images and the item requires the 4th image in the file you would use <image.bmp[3]> to reference that position (index count begins at 0).  Image files are .bmp files and are usually stored in the img subdirectory of Oasis montaj.

Examples:

ITEM "Run &GX...", gxrun.gx <standard.bmp[13]>
ITEM "&Load menu...", *ID_VIEW_LOADMENU <standard.bmp[14]> 

Controlling item activation

Some items should only be active if the project has a database or a map open.  You can specify the item dependency by placing one of the following qualifiers at the end of an ITEM line.  The menu item will be greyed out if the dependancy is not true:

{map}

{gdb}

{map_or_gdb}

{map_and_gdb}

{packed_map}

Examples:

ITEM "New database line", newline.gx {gdb}
ITEM "Display on the map", display.gx {map}
ITEM "Draw database line on map", drawline.gx {map_and_gdb}

Note that dependencies can be in any order at the end of a line. 

How menus are loaded

The default Oasis montaj menu will contain the minimum menu you see when you do not have a project open. This includes a File menu, a Window menu and a Help menu. When you create a new project, Oasis montaj first loads the coremenus.omn file, then loads the menu(s) specified by the Default Menu entry in the settings.gx.  When an existing project is opened, the same actions are executed and then any menus that were open when the project was last closed are also displayed.

If the user clears menus, all menus are removed except the coremenus.omn file.

If you want your application to completely control your users menu, you can change the Default Menus entry. You should look at the contents of montaj.smn and montaj_popups to see if there are any components of these menus that you want to include in your application. 

Geosoft GX Developer 8.5