bathy_window

Description

bathy_window.c is a Motif GUI source file, typically generated by an interface builder tool like X-Designer. Its purpose is to create and manage the primary window for displaying bathymetry data within the “Submetrix 2000 unraveller” application. This module sets up a DrawingArea widget where the bathymetry is visually rendered and integrates event handlers for user interaction (e.g., expose_bathy for redrawing, bathy_events for mouse/keyboard input). It also defines a popup menu that allows users to dynamically change the data compression method applied to the displayed bathymetry (linear, logarithmic, square root, or TVG).

How It Works

This file uses Motif (Xm) and Xt Intrinsics libraries to define and instantiate GUI widgets.

  1. create_BathyShell(Widget parent) function:
    • Creates a DialogShell widget (BathyShell) as the top-level window for the bathymetry display.
    • Creates an XmForm widget (BathyForm) to manage the layout of elements within the shell.
    • Creates an XmDrawingArea widget (DA10.widget), which serves as the canvas for drawing the bathymetry.
    • Attaches two primary event handlers to the DrawingArea:
      • expose_bathy: A callback function (executed on XmNexposeCallback) responsible for redrawing the bathymetry whenever the window needs to be refreshed.
      • bathy_events: An event handler (executed on various mouse/keyboard events) that manages user interaction within the drawing area (e.g., rubber-banding, parameter changes via keys).
    • Popup Menu (bathy_popup):
      • Creates an XmPopupMenu widget, which appears when Button3 (right-click) is pressed in the drawing area.
      • Adds four XmPushButton widgets (“linear”, “log”, “sqrt”, “tvg”) to this popup menu.
      • Each button is associated with an activateCallback (change_data_compression), passing a unique identifier (0-3) to specify the desired compression method.
    • Manages the children widgets to lay them out within the form. This file primarily sets up the visual interface and connects it to event handling and data compression logic.