RTsubx
Description
RTsubx.c is the main application file for the “Submetrix 2000 unraveller,” a Motif-based graphical user interface (GUI) application designed for processing and visualizing Submetrix 2000 sonar data. This file is responsible for initializing the X Window System environment (using Xt Intrinsics), creating the primary application window, setting up its menu bar and various drawing areas, and instantiating all necessary dialog boxes (e.g., About, File Selection, Spacings, Thresholds, Bathy). It acts as the central orchestrator, connecting the GUI elements to the underlying Submetrix 2000 data processing logic.
How It Works
- Xt Initialization:
XtSetLanguageProc(): Sets up the language procedure.XtToolkitInitialize(): Initializes the Xt Intrinsics toolkit.XtAppCreateApplicationContext(): Creates an application context.XtOpenDisplay(): Opens a connection to the X display server.
- Screen Depth Determination: Determines the screen’s color depth (
ddepth) and setsbitmap_padaccordingly (for 8, 16, or 24-bit displays). - Main Widget Creation (
create_main_widget()): This function, defined withinRTsubx.c, constructs the main application window:- Creates an
ApplicationShell(main_widget) as the top-level window. - Creates a main
XmFormwidget (widget8) to manage the layout. - Creates an
XmMenuBar(widget9) at the top. - File Menu: Sets up a “File” cascade button (
FileButton) with a pulldown menu (widget14) containing “New”, “Open”, “Save”, “Save As”, and “Exit” options. Callbacks (open_callback,save,save_as,quit) are attached. - Settings Menu: Sets up a “Settings” cascade button (
SettingButton) with a pulldown menu (widget20) containing “Spacings”, “Bathy”, and “Thresholds” options. Callbacks (display_spacings,display_bathy,display_thresholds) are attached. - Go/Stop Buttons: Creates “Go” (
GoButton) and “Stop” (StopButton) cascade buttons, with callbacks (go_parse,stop_parse) to control the background data parsing. - Help Menu: Sets up a “Help” cascade button (
HelpMenu) with an “About” option (widget23), which calls theabout()function. - Drawing Areas (
DA1toDA4): Creates fourXmFramewidgets (widgetf1-f4) and within each, anXmDrawingAreawidget (DA1.widgettoDA4.widget). These drawing areas are arranged vertically within the main form. - Drawing Area Popup Menu: Creates a popup menu (
da_all_popup) for the drawing areas, allowing users to select different display types (e.g., “AB phase”, “Log Ampl”, “Sidescan”, “Angle”, “AngleDif”, “Orientation”). Callbacks (change_display_state) are attached. - Event Handlers: Attaches
da_all_eventsas an event handler to each of the four drawing areas to manage interactive events.
- Creates an
- Widget Realization:
XtRealizeWidget(main_widget)makes the entire widget hierarchy visible on the screen. - Initial Display Setup:
- Sets initial
display_statefor each drawing area. - Calls
init_windows()to initialize drawing contexts. - Initializes
current_sidetoSUBX_UNASSIGNED. - Calls
expose_view()for each DA to perform initial drawing.
- Sets initial
- Dialog Box Creation: Creates instances of all necessary dialog shells and message boxes (e.g.,
create_BathyShell,create_SpacingShell,create_ThresholdShell,create_AboutShell,create_FileSelectionBox,create_CantSaveShell,create_ErrorShell,create_warning). - Data Processing Initialization: Calls
init_jSUBX_vals(),prime_Alignments(),set_values(),calc_row_spacings(),prime_IQ(),prime_LUTs()to initialize the internal data structures and processing parameters for handling Submetrix 2000 data. - Event Loop:
XtAppMainLoop(app_context)enters the main X event loop, where the application waits for and processes user events. - Exit: Exits gracefully when the application is terminated. This file brings together all the GUI and processing components to form a functional interactive application for Submetrix 2000 data.