#include <tcl.h>
#include <tk.h>
#include <sadie.h>
#include "tclsadie.h"
Go to the source code of this file.
Enumerations | |
enum | err_template_index { ERR_TKDIALOG, ERR_WINDOW, ERR_TITLE, ERR_TEXT, ERR_BITMAP, ERR_DEFAULT, ERR_STRING, max_err_index } |
Define slots in the command template for an error-reporting Tk popup. More... | |
Functions | |
int | tclsadie_plotter (PIXEL *line, uint32_t nbnd, uint32_t npix, const char *minxlbl, const char *maxxlbl, int option, PIXEL gmin, PIXEL gmax, void *data) |
Declare the plotting callback (defined elsewhere) so we can register it. | |
int | dispose_private_data (void *rawdata) |
Clean up the private data used by the SADIE library callbacks. | |
void | tclsadie_demolish_private_data (ClientData clientData) |
Register the SADIE application data cleanup with the Tcl interpreter. | |
int | tclsadie_private_data_init (Tcl_Interp *interp) |
Set up the tclSadie-specific private data structure for the SADIE library. | |
void | tclsadie_warning_messenger (char option, char *msg, void *data) |
The callback allowing the SADIE library to generate log messages. | |
void | tclsadie_error_messenger (char option, char *msg, void *data) |
The callback allowing the SADIE library to generate error messages. | |
int | tclsadie_app_init (void) |
Register all the necessary callbacks with the SADIE library. |
The SADIE library allows an application to provide its own callbacks for certain utility operations, such as displaying error messages and updating the session log. If we expect it to manipulate parts of a user interface defined in Tcl/Tk (as in the case of tclSadie), we need to provide callbacks that not only conform to the requirements for SADIE's callbacks, but also are properly Tcl/Tk aware. For convenience, we also maintain an application-wide data structure for details required by the callbacks, such as the Tk canvas that represents the session log and pre-parsed Tcl/Tk command templates for generating popup error messages.
Definition in file tclSadie_app.c.
|
Define slots in the command template for an error-reporting Tk popup.
Definition at line 53 of file tclSadie_app.c. |
|
Clean up the private data used by the SADIE library callbacks. This conforms to the app_data_destructor_t prototype defined within the SADIE library for something that disposes of application-specific data.
Definition at line 102 of file tclSadie_app.c. References Tclsadie_app_data::err_popup, Tclsadie_app_data::log_refresh, Tclsadie_app_data::sadievar, and Tclsadie_app_data::sessionlog_canvas. Referenced by tclsadie_private_data_init(). |
|
Register all the necessary callbacks with the SADIE library.
Note that this registers all the SADIE callbacks (including the plotter and progress meter callbacks), not just the ones defined in
Definition at line 454 of file tclSadie_app.c. References ProgMeter_Create(), ProgMeter_Destroy(), ProgMeter_Update(), tclsadie_error_messenger(), tclsadie_plotter(), and tclsadie_warning_messenger(). Referenced by Tcl_AppInit(). |
|
Register the SADIE application data cleanup with the Tcl interpreter. In addition to registering Tcl-aware callbacks with the SADIE library, we also register SADIE's generic application data cleanup operation with the Tcl interpreter. This wrapper conforms to the Tcl_ExitProc prototype for a Tcl/Tk exit handler (registered by Tcl_CreateExitHandler).
Definition at line 128 of file tclSadie_app.c. Referenced by tclsadie_private_data_init(). |
|
The callback allowing the SADIE library to generate error messages. In this context an error is an alert that pops up a modal Tk dialog widget, in addition to resetting the message text element of the array holding Tcl settings. The message type code is the character supplied as the option parameter of the SADIE library function MESSAGE, with the following significance:
Definition at line 411 of file tclSadie_app.c. References Tclsadie_cmd_skel::cmd, Tclsadie_app_data::err_popup, ERR_TEXT, Tclsadie_cmd_skel::len, Tclsadie_app_data::main_interp, and Tclsadie_app_data::sadievar. Referenced by tclsadie_app_init(). |
|
Declare the plotting callback (defined elsewhere) so we can register it.
Because SADIE knows nothing of the Tcl/Tk specifics of tclSadie's session log (notably the Tk canvas it uses and the current vertical position within this), we first recover the relevant details from the private application-specific data. Then for each band in the image we plot a bar graph, arranging them horizontally within the session log (for large hyperspectral images this may be unwieldy). The first three bands of a multi-band image get plotted in red, green and blue respectively: everything else in black. The bar lengths are scaled according to the option code, one of the values defined in
Definition at line 702 of file tclSadie_plot.c. References BAR_COLOR, DEFAULT_SESSION_LOG_POS_INDEX, GetSadieUintFromObj2(), Tclsadie_app_data::log_refresh, Tclsadie_app_data::main_interp, Line_value_range::max, max_axl_index, max_bar_index, max_label_index, max_text_index, max_x_preset_index, max_y_preset_index, Line_value_range::min, RIGHT_MARGIN, Tclsadie_app_data::sadievar, Tclsadie_app_data::sessionlog_canvas, and TOP_MARGIN. Referenced by tclsadie_app_init(). |
|
Set up the tclSadie-specific private data structure for the SADIE library. The tclSadie callbacks need access to information such as the particular Tk canvas used for the SADIE session log, the name of the top-level window to use for pop-up dialog boxes, and the pre-parsed Tcl/Tk command templates, but cannot obtain it from SADIE, so here we initialize the relevant global data structure for their benefit.
Definition at line 258 of file tclSadie_app.c. References DEFAULT_SESSION_LOG_CANVAS, dispose_private_data(), Tclsadie_app_data::err_popup, Tclsadie_app_data::log_refresh, Tclsadie_app_data::main_interp, Tclsadie_app_data::sadievar, SADIEVAR_ARRAYNAME, Tclsadie_app_data::sessionlog_canvas, and tclsadie_demolish_private_data(). Referenced by Tcl_AppInit(). |
|
The callback allowing the SADIE library to generate log messages. We write an informational or low-key warning message (as opposed to an alert) to the session log without popping up a modal dialog box. The message type code is the character supplied as the option parameter of the SADIE library function MESSAGE, with the following significance:
Definition at line 379 of file tclSadie_app.c. References Tclsadie_app_data::main_interp, and Tclsadie_app_data::sadievar. Referenced by tclsadie_app_init(). |