/*** DTB_USER_CODE_START vvv Add file header below vvv ***/
//%%  (c) Copyright 1993, 1994 Hewlett-Packard Company
//%%  (c) Copyright 1993, 1994 International Business Machines Corp.
//%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
//%%  (c) Copyright 1993, 1994 Novell, Inc.
//%%  $XConsortium: messageProps_stubs.C.src /main/4 1996/03/18 15:04:37 barstow $
/*** DTB_USER_CODE_END   ^^^ Add file header above ^^^ ***/

/*
 * File: messageProps_stubs.c
 * Contains: Module callbacks and connection functions
 *
 * This file was generated by dtcodegen, from module messageProps
 *
 * Any text may be added between the DTB_USER_CODE_START and
 * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
 * are provided only as an aid.
 *
 *  ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS.  **
 *  ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR  **
 *  ** DELETE THE GENERATED COMMENTS!                                 **
 */

#include <stdio.h>
#include <Xm/Xm.h>
#include "dtb_utils.h"
#include "messageProps_ui.h"

/*
 * Header files for cross-module connections
 */
#include "ttsnoop_ui.h"


/**************************************************************************
 *** DTB_USER_CODE_START
 ***
 *** All necessary header files have been included.
 ***
 *** Add include files, types, macros, externs, and user functions here.
 ***/

#if defined(linux)
#include <strstream>
#else
#include <strstream.h>
#endif

#include <Xm/TextF.h>
#include <Dt/SpinBox.h>
#include "DtTt.h"

int		DtTtMsgWidgetKey	= (int) (long) DtTtMessageWidget;
int		DtTtMsgUpdateCBKey	= DtTtMsgWidgetKey + 1;
int		DtTtMsgInfoKey		= DtTtMsgWidgetKey + 2;

Tt_callback_action
_DtMsgUpdateMarshall(
	Tt_message msg,
	Tt_pattern
)
{
	DtTtMessageUpdateCallback cb = (DtTtMessageUpdateCallback)
		tt_message_user( msg, DtTtMsgUpdateCBKey );
	Tt_status status = tt_ptr_error( cb );
	if (tt_is_err( status ) || (cb == 0)) {
		return TT_CALLBACK_CONTINUE;
	}
	Widget widget = DtTtMessageWidget( msg );
	status = tt_ptr_error( widget );
	if (tt_is_err( status ) || (widget == 0)) {
		return TT_CALLBACK_CONTINUE;
	}
	// XXX Just guessing.  Store oldState with tt_message_user_set()
	Tt_state oldState = TT_SENT;
	if (tt_message_state( msg ) == TT_SENT) {
		oldState = TT_CREATED;
	}
	(*cb)( widget, msg, oldState, TT_OK, True );
	return TT_CALLBACK_CONTINUE;
}

Widget
DtTtMessageWidget(
	Tt_message		msg
)
{
	// Function address is cast to int and used as clientdata key
	return (Widget)tt_message_user( msg, DtTtMsgWidgetKey );
}

static Tt_message
messageProps2Msg(
	DtbMessagePropsMessagePropsInfo instance
)
{
	Tt_message msg;
	XtVaGetValues( instance->messageProps_shellform,
		       XmNuserData, &msg, 0 );
	return msg;
}

static Boolean
_DtTtMessageUpdating(
	Tt_message msg
)
{
	void *updating = tt_message_user( msg, (int) (long) _DtTtMessageUpdating );
	if (tt_is_err( tt_ptr_error( updating ))) {
		return False;
	}
	return updating == (void *)True;
}

static void
_DtTtMessageSetUpdating(
	Tt_message			msg,
	Boolean				updating
)
{
	tt_message_user_set( msg, (int) (long) _DtTtMessageUpdating,
			     (void *)updating );
}

typedef enum {
	_DtTtMessageRePrint,
	_DtTtMessageArgAdded,
	_DtTtMessageFullUpdate
} _DtTtMessageUpdateLevel;

static void
_DtTtMessageWidgetUpdate(
	DtbMessagePropsMessagePropsInfo	instance,
	Tt_message			msg,
	_DtTtMessageUpdateLevel		level
)
{
	char *printout = tt_message_print( msg ); // XXX when to free?
	Tt_status status = tt_ptr_error( printout );
	if (tt_is_err( status )) {
		printout = tt_status_message( status );
	}
	XtVaSetValues( instance->messageText, XmNvalue, printout, 0 );
	if (level == _DtTtMessageRePrint) {
		return;
	}

	int numArgs = tt_message_args_count( msg );
#define SetArgMenuItemSensitive(n) \
	XtSetSensitive( instance->setArgButton_setArgButton_menu_items. \
		        Arg_##n##_item, numArgs > n );
	SetArgMenuItemSensitive(0);
	SetArgMenuItemSensitive(1);
	SetArgMenuItemSensitive(2);
	SetArgMenuItemSensitive(3);
	SetArgMenuItemSensitive(4);
	SetArgMenuItemSensitive(5);
	SetArgMenuItemSensitive(6);
	SetArgMenuItemSensitive(7);
	SetArgMenuItemSensitive(8);
	SetArgMenuItemSensitive(9);
	SetArgMenuItemSensitive(10);
	SetArgMenuItemSensitive(11);
	SetArgMenuItemSensitive(12);
	SetArgMenuItemSensitive(13);
	SetArgMenuItemSensitive(14);
	SetArgMenuItemSensitive(15);
#undef SetArgMenuItemSensitive
	XtSetSensitive( instance->setArgButton_setArgButton_menu_items.
		        Arg_15_item2, numArgs > 16 );

	if (level == _DtTtMessageArgAdded) {
		return;
	}

	_DtTtMessageSetUpdating( msg, True );

	char *op = tt_message_op( msg );
	status = tt_ptr_error( op );
	if (! tt_is_err( status )) {
		XmTextFieldSetString( instance->opText, op );
		tt_free( op );
	}

	char *handler = tt_message_handler( msg );
	status = tt_ptr_error( handler );
	if (! tt_is_err( status )) {
		XmTextFieldSetString( instance->handlerText, handler );
		tt_free( handler );
	}

	char *file = tt_message_file( msg );
	status = tt_ptr_error( file );
	if (! tt_is_err( status )) {
		XmTextFieldSetString( instance->fileText, file );
		tt_free( file );
	}

	char *session = tt_message_session( msg );
	status = tt_ptr_error( session );
	if (! tt_is_err( status )) {
		XmTextFieldSetString( instance->sessionText, session );
		tt_free( session );
	}

	int val = tt_message_status( msg );
	XtVaSetValues( instance->statusBox, DtNposition, val, 0 );
	char *status_string = tt_status_string( (Tt_status)val );
	DtTtSetLabel( instance->statusLabel, status_string );
	tt_free( status_string );

	Widget choice;
	switch (tt_message_class( msg )) {
	    case TT_CLASS_UNDEFINED:
	    default:
		choice = instance->classChoice_items.UNDEFINED_item;
		break;
	    case TT_NOTICE:
		choice = instance->classChoice_items.NOTICE_item;
		break;
	    case TT_REQUEST:
		choice = instance->classChoice_items.REQUEST_item;
		break;
	    case TT_OFFER:
		choice = instance->classChoice_items.OFFER_item;
		break;
	}
	XtVaSetValues( instance->classChoice, XmNmenuHistory, choice, 0 );

	switch (tt_message_address( msg )) {
	    case TT_PROCEDURE:
		choice = instance->addressChoice_items.PROCEDURE_item;
		break;
	    case TT_OBJECT:
		choice = instance->addressChoice_items.OBJECT_item;
		break;
	    case TT_HANDLER:
		choice = instance->addressChoice_items.HANDLER_item;
		break;
	    case TT_OTYPE:
		choice = instance->addressChoice_items.OTYPE_item;
		break;
	    case TT_ADDRESS_LAST:
	    default:
		choice = instance->addressChoice_items.ADDRESS_LAST_item;
		break;
	}
	XtVaSetValues( instance->addressChoice, XmNmenuHistory, choice, 0 );

	switch (tt_message_scope( msg )) {
	    case TT_SCOPE_NONE:
	    default:
		choice = instance->scopeChoice_items.SCOPE_NONE_item;
		break;
	    case TT_SESSION:
		choice = instance->scopeChoice_items.SESSION_item;
		break;
	    case TT_FILE:
		choice = instance->scopeChoice_items.FILE_item;
		break;
	    case TT_BOTH:
		choice = instance->scopeChoice_items.BOTH_item;
		break;
	    case TT_FILE_IN_SESSION:
		choice = instance->scopeChoice_items.FILE_IN_SESSION_item;
		break;
	}
	XtVaSetValues( instance->scopeChoice, XmNmenuHistory, choice, 0 );

	switch (tt_message_disposition( msg )) {
	    case TT_DISCARD:
	    default:
		choice = instance->dispositionChoice_items.DISCARD_item;
		break;
	    case TT_QUEUE:
		choice = instance->dispositionChoice_items.QUEUE_item;
		break;
	    case TT_START:
		choice = instance->dispositionChoice_items.START_item;
		break;
	    case TT_QUEUE+TT_START:
		choice = instance->dispositionChoice_items.QUEUE_START_item;
		break;
	}
	XtVaSetValues( instance->dispositionChoice, XmNmenuHistory, choice, 0);

	_DtTtMessageSetUpdating( msg, False );
}

void
DtTtMessageWidgetUpdate(
	Widget		propsWin,
	Tt_message	msg,
	Tt_state	oldState,
	Tt_status	lastOperation,
	Boolean		stillExists
)
{
	void *v = tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( v );
	if (tt_is_err( status ) || (v == 0)) {
		return;
	}
	DtbMessagePropsMessagePropsInfo instance =
		(DtbMessagePropsMessagePropsInfo)v;
	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
}

void
_DtTtMessageUpdate(
	Tt_message			msg,
	_DtStringChooserAction		choice,
	char *				val
)
{
	DtbMessagePropsMessagePropsInfo	instance;
	instance = (DtbMessagePropsMessagePropsInfo)
		tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( instance );
	if (tt_is_err( status ) || (instance == 0)) {
		return;
	}
	char *func;
	switch (choice) {
	    case _DtStringChooseMessageOtype:
		status = tt_message_otype_set( msg, val );
		func = "tt_message_otype_set()";
		break;
	    case _DtStringChooseMessageObject:
		status = tt_message_object_set( msg, val );
		func = "tt_message_object_set()";
		break;
	    case _DtStringChooseMessageHandlerPtype:
		status = tt_message_handler_ptype_set( msg, val );
		func = "tt_message_handler_ptype_set()";
		break;
	    case _DtStringChooseMessageSenderPtype:
		status = tt_message_sender_ptype_set( msg, val );
		func = "tt_message_sender_ptype_set()";
		break;
	    case _DtStringChooseMessageStatusString:
		status = tt_message_status_string_set( msg, val );
		func = "tt_message_status_string_set()";
		break;
	    case _DtStringChooseMessageArgValSet: {
		if (val == 0) {
			break;
		}
		int arg = atoi( val );
		if ((arg <= 15) || (arg+1 > tt_message_args_count( msg ))) {
			break;
		}
		Tt_mode mode = tt_message_arg_mode( msg, arg );
		char *vtype = tt_message_arg_type( msg, arg );
		if (tt_is_err( tt_ptr_error( vtype ))) {
			vtype = 0;
		}
		char *val = 0;
		int ival = 0;
		Boolean noValue = False;
		Tt_status status = tt_message_arg_ival( msg, arg, &ival );
		if (status == TT_ERR_NUM) {
			val = tt_message_arg_val( msg, arg );
			if (tt_is_err( tt_ptr_error( val ))) {
				val = 0;
			}
			if (val == 0) {
				noValue = True;
			}
		}
		_DtArgChooserSet( _DtArgChooseMessageArgSet, msg, arg,
				  mode, noValue, vtype, val, ival );
		} return;
	    default:
		return;
	}
	DtTtSetLabel( instance->messageFooterLabel, func, status );
	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
	return;
}

void
_DtTtMessageUpdate(
	Tt_message			msg,
	_DtSessionChooserAction		choice,
	char *				session
)
{
	DtbMessagePropsMessagePropsInfo	instance;
	instance = (DtbMessagePropsMessagePropsInfo)
		tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( instance );
	if (tt_is_err( status ) || (instance == 0)) {
		return;
	}
	char *func;
	switch (choice) {
	    case _DtSessionChooseMessage:
		status = tt_message_session_set( msg, session );
		func = "tt_message_session_set()";
		session = tt_message_session( msg );
		if (! tt_is_err( tt_ptr_error( session ))) {
			_DtTtMessageSetUpdating( msg, True );
			XmTextFieldSetString( instance->sessionText, session );
			_DtTtMessageSetUpdating( msg, False );
			tt_free( session );
		}
		break;
	    default:
		return;
	}
	DtTtSetLabel( instance->messageFooterLabel, func, status );
	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
	return;
}

void
_DtTtMessageUpdate(
	Tt_message			msg,
	_DtFileChooserAction		choice,
	char *				file
)
{
	DtbMessagePropsMessagePropsInfo	instance;
	instance = (DtbMessagePropsMessagePropsInfo)
		tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( instance );
	if (tt_is_err( status ) || (instance == 0)) {
		return;
	}
	char *func;
	switch (choice) {
	    case _DtFileChooseMessageSet:
		status = tt_message_file_set( msg, file );
		func = "tt_message_file_set()";
		file = tt_message_file( msg );
		if (! tt_is_err( tt_ptr_error( file ))) {
			_DtTtMessageSetUpdating( msg, True );
			XmTextFieldSetString( instance->fileText, file );
			_DtTtMessageSetUpdating( msg, False );
			tt_free( file );
		}
		break;
	    default:
		return;
	}
	DtTtSetLabel( instance->messageFooterLabel, func, status );
	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
	return;
}

void
_DtTtMessageUpdate(
	Tt_message			msg,
	_DtTtChooserAction		choice,
	char *				string
)
{
	DtbMessagePropsMessagePropsInfo	instance;
	instance = (DtbMessagePropsMessagePropsInfo)
		tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( instance );
	if (tt_is_err( status ) || (instance == 0)) {
		return;
	}
	char *func;
	switch (choice) {
	    case _DtTtChooserMessageOpSet:
		status = tt_message_op_set( msg, string );
		func = "tt_message_op_set()";
		string = tt_message_op( msg );
		if (! tt_is_err( tt_ptr_error( string ))) {
			_DtTtMessageSetUpdating( msg, True );
			XmTextFieldSetString( instance->opText, string );
			_DtTtMessageSetUpdating( msg, False );
			tt_free( string );
		}
		break;
	    case _DtTtChooserMessageHandlerSet:
		status = tt_message_handler_set( msg, string );
		func = "tt_message_handler_set()";
		string = tt_message_handler( msg );
		if (! tt_is_err( tt_ptr_error( string ))) {
			_DtTtMessageSetUpdating( msg, True );
			XmTextFieldSetString( instance->handlerText, string );
			_DtTtMessageSetUpdating( msg, False );
			tt_free( string );
		}
		break;
	    default:
		return;
	}
	DtTtSetLabel( instance->messageFooterLabel, func, status );
	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
	return;
}

void
_DtTtMessageUpdate(
	Tt_message		msg,
	_DtArgChooserAction	choice,
	int			nth,
	Tt_mode			mode,
	char *			vtype,
	char *			val,
	int			ival
)
{
	DtbMessagePropsMessagePropsInfo	instance;
	instance = (DtbMessagePropsMessagePropsInfo)
		tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( instance );
	if (tt_is_err( status ) || (instance == 0)) {
		return;
	}
	char *func;
	switch (choice) {
	    case _DtArgChooseMessageArgAdd:
		status = tt_message_arg_add( msg, mode, vtype, val );
		func = "tt_message_arg_add()";
		break;
	    case _DtArgChooseMessageIArgAdd:
		status = tt_message_iarg_add( msg, mode, vtype, ival );
		func = "tt_message_iarg_add()";
		break;
	    case _DtArgChooseMessageArgSet:
		status = tt_message_arg_val_set( msg, nth, val );
		func = "tt_message_arg_val_set()";
		break;
	    case _DtArgChooseMessageIArgSet:
		status = tt_message_arg_ival_set( msg, nth, ival );
		func = "tt_message_arg_ival_set()";
		break;
	    case _DtArgChooseMessageContextSet:
		status = tt_message_context_set( msg, vtype, val );
		func = "tt_message_context_set()";
		break;
	    case _DtArgChooseMessageIContextSet:
		status = tt_message_icontext_set( msg, vtype, ival );
		func = "tt_message_icontext_set()";
		break;
	    default:
		return;
	}
	DtTtSetLabel( instance->messageFooterLabel, func, status );
	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageArgAdded );
	return;
}

void
_DtTtMessageUpdate(
	Tt_message			msg,
	Tt_message_callback		cb
)
{
	DtbMessagePropsMessagePropsInfo	instance;
	instance = (DtbMessagePropsMessagePropsInfo)
		tt_message_user( msg, DtTtMsgInfoKey );
	Tt_status status = tt_ptr_error( instance );
	if (tt_is_err( status ) || (instance == 0)) {
		return;
	}
	status = tt_message_callback_add( msg, cb );
	DtTtSetLabel( instance->messageFooterLabel,
		      "tt_message_callback_add()", status );
	return;
}

Widget
DtTtMessageWidgetCreate(
	Widget				parent,
	Tt_message			msg,
	DtTtMessageUpdateCallback	notifyProc
)
{
	DtbMessagePropsMessagePropsInfoRec *instance;
	Widget widget = DtTtMessageWidget( msg );
	Tt_status status = tt_ptr_error( widget );
	if (tt_is_err( status ) || (widget != 0)) {
		instance = (DtbMessagePropsMessagePropsInfoRec *)
			tt_message_user( msg, DtTtMsgInfoKey );
		status = tt_ptr_error( instance );
		if (tt_is_err( status ) || (instance != 0)) {
			XtManageChild( instance->messageProps_shellform );
		}
		return widget;
	}
	instance = new DtbMessagePropsMessagePropsInfoRec;
	if (instance == 0) {
		return (Widget)tt_error_pointer( TT_ERR_NOMEM );
	}
	// XXX delete instance in widget destroy proc
	status = tt_message_user_set( msg, DtTtMsgInfoKey, instance );
	if (tt_is_err( status )) {
		delete instance;
		return (Widget)tt_error_pointer( status );
	}
	dtbMessagePropsMessagePropsInfo_clear( instance );
	dtb_message_props_message_props_initialize( instance, parent );
	widget = instance->messageProps;

	XtVaSetValues( instance->messageProps_shellform, XmNuserData, msg, 0 );
	status = tt_message_user_set( msg, DtTtMsgWidgetKey, widget );
	if (tt_is_err( status )) {
		XtDestroyWidget( widget );
		delete instance;
		return (Widget)tt_error_pointer( status );
	}
	if (notifyProc != 0) {
		status = tt_message_user_set( msg, DtTtMsgUpdateCBKey,
					      (void *) notifyProc );
		if (tt_is_err( status )) {
			XtDestroyWidget( widget );
			return (Widget)tt_error_pointer( status );
		}
		status = tt_message_callback_add( msg, _DtMsgUpdateMarshall );
		if (tt_is_err( status )) {
			XtDestroyWidget( widget );
			return (Widget)tt_error_pointer( status );
		}
	}

	ostrstream labelStream;
	labelStream << "Tt_message " << (void *)msg;
	XtVaSetValues( instance->messageProps,
		       XmNtitle, labelStream.str(),
		       0 );
	delete labelStream.str();

	_DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );

	XtManageChild( instance->messageProps_shellform );
	return widget;
}

static void
_DtTtMessageDispositionSet(
	DtbMessagePropsMessagePropsInfo instance,
	Tt_disposition disposition
)
{
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_disposition_set( msg, disposition );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_disposition_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
}

/*** DTB_USER_CODE_END
 ***
 *** End of user code section
 ***
 **************************************************************************/



void 
messageProps_msgCloseButton_CB1(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    DtbMessagePropsMessagePropsInfo	instance = (DtbMessagePropsMessagePropsInfo)clientData;
    
    if (!(instance->initialized))
    {
        dtb_message_props_message_props_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
    }
    XtUnmanageChild(instance->messageProps_shellform);
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setClassUndefined(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_class_set( msg, TT_CLASS_UNDEFINED );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_class_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setClassNotice(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_class_set( msg, TT_NOTICE );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_class_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setClassRequest(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_class_set( msg, TT_REQUEST );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_class_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setClassOffer(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_class_set( msg, TT_OFFER );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_class_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setAddressLast(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_address_set( msg, TT_ADDRESS_LAST );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_address_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setAddressProcedure(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_address_set( msg, TT_PROCEDURE );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_address_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setAddressObject(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_address_set( msg, TT_OBJECT );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_address_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setAddressHandler(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_address_set( msg, TT_HANDLER );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_address_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setAddressOtype(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_address_set( msg, TT_OTYPE );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_address_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setScopeNone(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_scope_set( msg, TT_SCOPE_NONE );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_scope_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setScopeSession(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_scope_set( msg, TT_SESSION );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_scope_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setScopeFile(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_scope_set( msg, TT_FILE );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_scope_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setScopeBoth(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_scope_set( msg, TT_BOTH );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_scope_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setScopeFileInSession(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_scope_set( msg, TT_FILE_IN_SESSION );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_scope_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setOp(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    char *op = XmTextFieldGetString( instance->opText );
    if ((op != 0) && (op[0] == '\0')) {
	    XtFree( op );
	    op = 0;
    }
    Tt_status status = tt_message_op_set( msg, op );
    if (op != 0) {
	    XtFree( op );
    }
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_op_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSend(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_send( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_send()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSendOnExit(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_send_on_exit( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_send_on_exit()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgAccept(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_accept( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_accept()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgReject(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_send_on_exit( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_send_on_exit()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgReply(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_reply( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_reply()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgFail(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tt_message_fail( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_fail()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgDestroy(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_status status = tttk_message_destroy( msg );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tttk_message_destroy()", status );
    switch (status) {
	case TT_OK:
	    DtTtDestroyed( DTTT_MESSAGE, msg );
	    XtDestroyWidget( instance->messageProps );
	    delete instance;
	    break;
	default:
	    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
	    break;
    }
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgDtAccept(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_pattern *pats = ttdt_message_accept( msg, 0, 0, instance->messageProps,
					    1, 1 );
    Tt_status status = tt_ptr_error( pats );
    DtTtSetLabel( instance->messageFooterLabel,
		  "ttdt_message_accept()", status );
    if ((status == TT_OK) && (pats != 0)) {
	    while (*pats != 0) {
		    DtTtCreated( DTTT_PATTERN, *pats );
		    pats++;
	    }
    }
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSubcontractManage(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_pattern *pats = ttdt_subcontract_manage( msg, 0,
					        instance->messageProps, 0 );
    Tt_status status = tt_ptr_error( pats );
    DtTtSetLabel( instance->messageFooterLabel,
		  "ttdt_subcontract_manage()", status );
    if (status == TT_OK) {
	    while (*pats != 0) {
		    DtTtCreated( DTTT_PATTERN, *pats );
		    pats++;
	    }
    }
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgClone(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    msg = tt_message_copy( msg );
    Tt_status status = DtTtSetLabel( instance->messageProps_footer,
				     "tt_message_copy()", msg );
    if (tt_is_err( status )) {
	    return;
    }
    DtTtCreated( DTTT_MESSAGE, msg );
    Widget newWidget = DtTtMessageWidgetCreate(
				dtb_ttsnoop_ttsnoop_win.ttsnoopWin, msg,
				DtTtMessageWidgetUpdate );
    status = tt_ptr_error( newWidget );
    if (tt_is_err( status )) {
	    return;
    }
    XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgStatusNotice(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    char *sender = tt_message_sender( msg );
    Tt_message msg2 = tttk_message_create( msg, TT_NOTICE,
				tt_message_scope( msg ), sender, "Status", 0 );
    tt_free( sender );
    Tt_status status = DtTtSetLabel( instance->messageProps_footer,
				     "tttk_message_create()", msg2 );
    if (tt_is_err( status )) {
	    return;
    }

    tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
    tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
    tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
    tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
    char *commission = tt_message_id( msg );
    tt_message_arg_add( msg2, TT_IN, Tttk_message_id, commission );
    tt_free( commission );

    DtTtCreated( DTTT_MESSAGE, msg2 );
    Widget newWidget = DtTtMessageWidgetCreate(
				dtb_ttsnoop_ttsnoop_win.ttsnoopWin, msg2,
				DtTtMessageWidgetUpdate );
    status = tt_ptr_error( newWidget );
    if (tt_is_err( status )) {
	    return;
    }
    XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgGenAction(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    ostrstream action; // XXX when to delete .str()?
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    char *op = tt_message_op( msg );
    action << "ACTION Send_" << op << "\n{\n\tLABEL\tSend_" << op << "\n";
    action << "\tTYPE\tTT_MSG\n";
    action << "\tTT_CLASS\t" << tt_message_class( msg ) << "\n";
    action << "\tTT_SCOPE\t" << tt_message_scope( msg ) << "\n";
    action << "\tTT_OPERATION\t" << op << "\n";
    tt_free( op );
    char *file = tt_message_file( msg );
    Tt_status status = tt_ptr_error( file );
    if ((! tt_is_err( status )) && (file != 0)) {
	    action << "\tTT_FILE\t" << file << "\n";
	    tt_free( file );
    }
    int args = tt_message_args_count( msg );
    for (int arg = 0; arg < args; arg++) {
	    action << "\tTT_ARG" << arg << "_MODE\t";
	    action << tt_message_arg_mode( msg, arg ) << "\n";
	    char *vtype = tt_message_arg_type( msg, arg );
	    action << "\tTT_ARG" << arg << "_VTYPE\t" << vtype << "\n";
	    int ival;
	    status = tt_message_arg_ival( msg, arg, &ival );
	    switch (status) {
		    char *val;
		case TT_OK:
		    action << "\tTT_ARG" << arg << "_REP_TYPE\t"
			      "TT_REP_INTEGER\n";
		    action << "\tTT_ARG" << arg << "_VALUE\t" << ival << "\n";
		    break;
		case TT_ERR_NUM:
		    val = tt_message_arg_val( msg, arg );
		    status = tt_ptr_error( val );
		    if (tt_is_err( status ) || (val == 0)) {
			    continue;
		    }
		    action << "\tTT_ARG" << arg << "_VALUE\t" << val << "\n";
		    tt_free( val );
		    break;
	    }
    }
    // XXX emit commented warnings for e.g. TT_OFFER, TT_HANDLER
    action << "}\n";
    // XtVaSetValues( instance->messageText, XmNvalue, action.str(), 0 );
    _DtOpen( instance->messageFooterLabel, (void *)action.str(),
	     action.pcount(), "actio" );
    delete action.str();
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgGenC(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
	ostrstream code; // XXX when to delete .str()?
	DtbMessagePropsMessagePropsInfo instance =
		(DtbMessagePropsMessagePropsInfo)clientData;
	Tt_message msg = messageProps2Msg( instance );
	if (msg == 0) {
		return;
	}
	code << "#include <Tt/tt_c.h>\n";
	code << "#include <Tt/tttk.h>\n";
	char *op = tt_message_op( msg );
	if (tt_message_class( msg ) != TT_NOTICE) {
		code << "\nTt_callback_action\nprocess_" << op << "_reply(";
		code << " Tt_message msg, Tt_message pat );\n";
	}
	code << "\nTt_message\n";
	code << "create_" << op << "(\n";
	code << "\tTt_message context\n)\n{\n";
	code << "\tTt_message msg;\n";
	code << "\tmsg = tttk_message_create( context";
	code << ", " << tt_message_class( msg );
	code << ", " << tt_message_scope( msg ) << ",\n\t\t\t";
	Tt_address address = tt_message_address( msg );
	switch (address) {
		char *handler;
	    case TT_PROCEDURE:
	    default:
		code << "0, ";
		break;
	    case TT_HANDLER:
		handler = tt_message_handler( msg );
		code << "\"" << handler << "\",\n";
		tt_free( handler );
		break;
	}
	if (op == 0) {
		code << "(char *)0";
	} else {
		code << "\"" << op << "\"";
	}
	code << ", ";
	if (tt_message_class( msg ) == TT_NOTICE) {
		code << "0 ";
	} else {
		code << "\n\t\t\tprocess_" << op << "_reply ";
	}
	code << ");\n";
	switch (address) {
	    default:
		code << "\ttt_message_address_set( msg, " << address << " );\n";
		break;
	    case TT_PROCEDURE:
	    case TT_HANDLER:
		// set properly by tttk_message_create();
		break;
	}
	int args = tt_message_args_count( msg );
	if (tt_is_err( tt_int_error( args ))) {
		args = 0;
	}
	for (int arg = 0; arg < args; arg++) {
		Tt_mode mode = tt_message_arg_mode( msg, arg );
		char *vtype = tt_message_arg_type( msg, arg );
		int ival;
		Tt_status status = tt_message_arg_ival( msg, arg, &ival );
		switch (status) {
			char *val;
		    case TT_OK:
			code << "\ttt_message_iarg_add( msg, " << mode << ", ";
			code << '"' << vtype << "\", " << ival << " );\n";
			break;
		    case TT_ERR_NUM:
			val = tt_message_arg_val( msg, arg );
			code << "\ttt_message_arg_add( msg, " << mode << ", ";
			code << '"' << vtype << "\", ";
			if (val == 0) {
				code << "(char *)0";
			} else {
				code << "\"" << val << "\"";
			}
			code << ");\n";
			tt_free( val );
			break;
		}
		tt_free( vtype );
	}
	int stat = tt_message_status( msg );
	if (stat != 0) {
		code << "\ttt_message_status_set( msg, " << stat << " );\n";
	}
	code << "\treturn msg;\n";
	code << "}\n";
	if (tt_message_class( msg ) != TT_NOTICE) {
		code << "\nstatic Tt_callback_action\n";
		code << "process_" << op << "_reply(\n";
		code << "\tTt_message msg,\n";
		code << "\tTt_message pat\n";
		code << ")\n{\n";
		code << "\tswitch (tt_message_state(msg)) {\n";
		code << "\t\tcase TT_SENT:\t/* handler is in this process */\n";
		code << "\t\tcase TT_STARTED:/* intermediate state */\n";
		code << "\t\tcase TT_QUEUED:\t/* intermediate state */\n";
		code << "\t\tdefault:\t/* unknown state */\n";
		code << "\t\t\treturn TT_CALLBACK_CONTINUE;\n";
		if (tt_message_class(msg) == TT_REQUEST) {
			code << "\t\tcase TT_HANDLED:\n";
			code << "\t\t\t/* ... */\n";
			code << "\t\t\tbreak;\n";
			code << "\t\tcase TT_FAILED: {\n";
			code << "\t\t\tint status;\n";
			code << "\t\t\tchar *string;\n";
			code << "\t\t\tstatus = tt_message_status( msg );\n";
			code << "\t\t\tstring = "
				"tt_message_status_string( msg );\n";
			code << "\t\t\t/* ... */\n";
			code << "\t\t\t} break;\n";
		} else {
			code << "\t\tcase TT_RETURNED:\n";
			code << "\t\t\t/* ... */\n";
			code << "\t\t\tbreak;\n";
		}
		code << "\t}\n";
		code << "\ttt_message_destroy( msg );\n";
		code << "\treturn TT_CALLBACK_PROCESSED;\n";
		code << "}\n";
	}
	tt_free( op );
	// XtVaSetValues( instance->messageText, XmNvalue, code.str(), 0 );
	_DtOpen( instance->messageFooterLabel, (void *)code.str(),
		 code.pcount(), "msgC" );
	delete code.str();
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setHandler(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    char *handler = XmTextFieldGetString( instance->handlerText );
    if ((handler != 0) && (handler[0] == '\0')) {
	    XtFree( handler );
	    handler = 0;
    }
    Tt_status status = tt_message_handler_set( msg, handler );
    if (handler != 0) {
	    XtFree( handler );
    }
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_handler_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setSession(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    char *session = XmTextFieldGetString( instance->sessionText );
    if ((session != 0) && (session[0] == '\0')) {
	    XtFree( session );
	    session = 0;
    }
    Tt_status status = tt_message_session_set( msg, session );
    if (session != 0) {
	    XtFree( session );
    }
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_session_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setFile(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    char *file = XmTextFieldGetString( instance->fileText );
    if ((file != 0) && (file[0] == '\0')) {
	    XtFree( file );
	    file = 0;
    }
    Tt_status status = tt_message_file_set( msg, file );
    if (file != 0) {
	    XtFree( file );
    }
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_file_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setStatus(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    int val;
    XtVaGetValues( instance->statusBox, DtNposition, &val, 0 );
    XmString statusName = DtTtStatusString( (Tt_status)val );
    XtVaSetValues( instance->statusLabel, XmNlabelString, statusName, 0 );
    XmStringFree( statusName );
    Tt_status status = tt_message_status_set( msg, val );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_status_set()", status );
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgHelp(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    dtb_do_onitem_help();
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgPattern(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_pattern pat = tt_message_pattern( msg );
    Tt_status status = DtTtSetLabel( instance->messageFooterLabel,
				     "tt_message_pattern()", pat );
    if (tt_is_err( status ) || (pat == 0)) {
	    return;
    }
    Widget newWidget = DtTtPatternWidgetCreate(
			dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
			pat, 0 );
    status = tt_ptr_error( newWidget );
    if (tt_is_err( status )) {
	    return;
    }
    XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgPrint(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
    DtTtSetLabel( instance->messageFooterLabel,
		  "tt_message_print()", TT_OK );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
genPattern(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    Tt_pattern pat = tt_pattern_create();
    tt_pattern_category_set( pat, TT_OBSERVE );
    tt_pattern_class_add( pat, tt_message_class( msg ));
    tt_pattern_scope_add( pat, tt_message_scope( msg ));
    tt_pattern_address_add( pat, tt_message_address( msg ));
    char *op = tt_message_op( msg );
    if ((! tt_is_err( tt_ptr_error( op ))) && (op != 0)) {
	    tt_pattern_op_add( pat, op );
	    tt_free( op );
    }
    // skip file, sender, sender_ptype, otype, object, opnum, contexts
    char *session = tt_message_session( msg );
    if ((! tt_is_err( tt_ptr_error( session ))) && (session != 0)) {
	    tt_pattern_session_add( pat, session );
	    tt_free( session );
    }
    int args = tt_message_args_count( msg );
    if (tt_int_error( args ) == TT_OK) {
	    for (int arg = 0; arg < args; arg++) {
		    Tt_mode mode = tt_message_arg_mode( msg, arg );
		    char *vtype = tt_message_arg_type( msg, arg );
		    // skip arg value
		    tt_pattern_arg_add( pat, mode, vtype, 0 );
		    tt_free( vtype );
	    }
    }
    DtTtCreated( DTTT_PATTERN, pat );
    Widget newWidget = DtTtPatternWidgetCreate(
				dtb_ttsnoop_ttsnoop_win.ttsnoopWin, pat, 0 );
    if (tt_is_err( tt_ptr_error( newWidget ))) {
	    return;
    }
    XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
genObserver(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    ostrstream ptype; // XXX when to delete .str()?
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if (msg == 0) {
	    return;
    }
    ptype << "ptype Acme_Calc {\n\tstart \"acalc\";\n";
    ptype << "\t/*\n";
    ptype << "\thandle_push:\n";
    ptype << "\thandle_rotate:\n";
    switch (tt_message_class(msg)) {
	case TT_REQUEST:
	    ptype << "\tobserve:\n";
	    ptype << "\t*/\n";
	    ptype << "\thandle:\n";
	    break;
	case TT_OFFER:
	case TT_NOTICE:
	default:
	    ptype << "\thandle:\n";
	    ptype << "\t*/\n";
	    ptype << "\tobserve:\n";
	    break;
    }
    ptype << "\t\t";
    switch (tt_message_scope(msg)) {
	case TT_FILE:
	    ptype << "file ";
	    break;
	case TT_FILE_IN_SESSION:
	case TT_BOTH:
	case TT_SESSION:
	default:
	    ptype << "session ";
	    break;
    }
    char *op = tt_message_op( msg );
    ptype << op << "(\n";
    tt_free( op );
    int args = tt_message_args_count( msg );
    if (tt_is_err( tt_int_error( args ))) {
	    args = 0;
    }
    for (int arg = 0; arg < args; arg++) {
	    ptype << "\t\t\t\t";
	    switch (tt_message_arg_mode( msg, arg )) {
		case TT_IN:	ptype << "in   "; break;
		case TT_OUT:	ptype << "out  "; break;
		default:
		case TT_INOUT:	ptype << "inout"; break;
	    }
	    char *vtype = tt_message_arg_type( msg, arg );
	    ptype << " " << vtype << "\targ" << arg;
	    if (arg < args - 1) {
		    ptype << ",";
	    }
	    ptype << "\n";
    }
    ptype << "\t\t\t) => start opnum=1;\n";
    ptype << "};\n";
    // XXX contexts
    // XtVaSetValues( instance->messageText, XmNvalue, ptype.str(), 0 );
    _DtOpen( instance->messageFooterLabel, (void *)ptype.str(),
	     ptype.pcount(), "ptype" );
    delete ptype.str();
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
sessionSet(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtSessionChooserSet( _DtSessionChooseMessage, msg );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgFileSet(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtFileChooserSet( _DtFileChooseMessageSet, msg );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgArgAdd(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtArgChooserSet( _DtArgChooseMessageArgAdd, msg );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgContextSet(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtArgChooserSet( _DtArgChooseMessageContextSet, msg );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setArg(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    int arg;
    MessagePropsSetArgButtonMenuItems items =
	    &instance->setArgButton_setArgButton_menu_items;
    if (widget == items->Arg_0_item) {
	    arg = 0;
    } else if (widget == items->Arg_1_item) {
	    arg = 1;
    } else if (widget == items->Arg_2_item) {
	    arg = 2;
    } else if (widget == items->Arg_3_item) {
	    arg = 3;
    } else if (widget == items->Arg_4_item) {
	    arg = 4;
    } else if (widget == items->Arg_5_item) {
	    arg = 5;
    } else if (widget == items->Arg_6_item) {
	    arg = 6;
    } else if (widget == items->Arg_7_item) {
	    arg = 7;
    } else if (widget == items->Arg_8_item) {
	    arg = 8;
    } else if (widget == items->Arg_9_item) {
	    arg = 9;
    } else if (widget == items->Arg_10_item) {
	    arg = 10;
    } else if (widget == items->Arg_11_item) {
	    arg = 11;
    } else if (widget == items->Arg_12_item) {
	    arg = 12;
    } else if (widget == items->Arg_13_item) {
	    arg = 13;
    } else if (widget == items->Arg_14_item) {
	    arg = 14;
    } else if (widget == items->Arg_15_item) {
	    arg = 15;
    } else if (widget == items->Arg_15_item2) {
	    _DtStringChooserSet( _DtStringChooseMessageArgValSet, msg,
				 "16" );
	    return;
    } else {
	    return;
    }
    Tt_mode mode = tt_message_arg_mode( msg, arg );
    char *vtype = tt_message_arg_type( msg, arg );
    if (tt_is_err( tt_ptr_error( vtype ))) {
	    vtype = 0;
    }
    char *val = 0;
    int ival = 0;
    Boolean noValue = False;
    Tt_status status = tt_message_arg_ival( msg, arg, &ival );
    if (status == TT_ERR_NUM) {
	    val = tt_message_arg_val( msg, arg );
	    if (tt_is_err( tt_ptr_error( val ))) {
		    val = 0;
	    }
	    if (val == 0) {
		    noValue = True;
	    }
    }
    _DtArgChooserSet( _DtArgChooseMessageArgSet, msg, arg, mode, noValue,
		      vtype, val, ival );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setDISCARD(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    _DtTtMessageDispositionSet( instance, TT_DISCARD );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setQUEUE(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    _DtTtMessageDispositionSet( instance, TT_QUEUE );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setSTART(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    _DtTtMessageDispositionSet( instance, TT_START );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
setQUEUESTART(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    _DtTtMessageDispositionSet( instance, (Tt_disposition)(TT_QUEUE+TT_START));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSetObject(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtStringChooserSet( _DtStringChooseMessageObject, msg,
			 tt_message_object( msg ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSetOtype(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtStringChooserSet( _DtStringChooseMessageOtype, msg,
			 tt_message_otype( msg ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSetHandlerPtype(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtStringChooserSet( _DtStringChooseMessageHandlerPtype, msg,
			 tt_message_handler_ptype( msg ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSetSenderPtype(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtStringChooserSet( _DtStringChooseMessageSenderPtype, msg,
			 tt_message_sender_ptype( msg ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
chooseOp(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtTtChooserSet( _DtTtChooserMessageOpSet, msg );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
addCallback(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtTtMsgCbChooserSet( msg );
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
chooseHandler(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtStringChooserSet( _DtStringChooseMessageStatusString, msg,
			 tt_message_status_string( msg ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}


void 
msgSetStatusString(
    Widget widget,
    XtPointer clientData,
    XtPointer callData
)
{
    /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
    /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
    
    /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
    DtbMessagePropsMessagePropsInfo instance =
	    (DtbMessagePropsMessagePropsInfo)clientData;
    Tt_message msg = messageProps2Msg( instance );
    if ((msg == 0) || _DtTtMessageUpdating( msg )) {
	    return;
    }
    _DtStringChooserSet( _DtStringChooseMessageStatusString, msg,
			 tt_message_object( msg ));
    /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
}



/**************************************************************************
 *** DTB_USER_CODE_START
 ***
 *** All automatically-generated data and functions have been defined.
 ***
 *** Add new functions here, or at the top of the file.
 ***/

/*** DTB_USER_CODE_END
 ***
 *** End of user code section
 ***
 **************************************************************************/


