Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / programs / ttsnoop / messageProps_stubs.C.src
1 /*** DTB_USER_CODE_START vvv Add file header below vvv ***/
2 //%%  (c) Copyright 1993, 1994 Hewlett-Packard Company
3 //%%  (c) Copyright 1993, 1994 International Business Machines Corp.
4 //%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
5 //%%  (c) Copyright 1993, 1994 Novell, Inc.
6 //%%  $XConsortium: messageProps_stubs.C.src /main/4 1996/03/18 15:04:37 barstow $
7 /*** DTB_USER_CODE_END   ^^^ Add file header above ^^^ ***/
8
9 /*
10  * File: messageProps_stubs.c
11  * Contains: Module callbacks and connection functions
12  *
13  * This file was generated by dtcodegen, from module messageProps
14  *
15  * Any text may be added between the DTB_USER_CODE_START and
16  * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
17  * are provided only as an aid.
18  *
19  *  ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS.  **
20  *  ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR  **
21  *  ** DELETE THE GENERATED COMMENTS!                                 **
22  */
23
24 #include <stdint.h>
25 #include <stdio.h>
26 #include <Xm/Xm.h>
27 #include "dtb_utils.h"
28 #include "messageProps_ui.h"
29
30 /*
31  * Header files for cross-module connections
32  */
33 #include "ttsnoop_ui.h"
34
35
36 /**************************************************************************
37  *** DTB_USER_CODE_START
38  ***
39  *** All necessary header files have been included.
40  ***
41  *** Add include files, types, macros, externs, and user functions here.
42  ***/
43
44 #include <sstream>
45
46 #include <Xm/TextF.h>
47 #include <Dt/SpinBox.h>
48 #include "DtTt.h"
49
50 int             DtTtMsgWidgetKey        = (int) (long) DtTtMessageWidget;
51 int             DtTtMsgUpdateCBKey      = DtTtMsgWidgetKey + 1;
52 int             DtTtMsgInfoKey          = DtTtMsgWidgetKey + 2;
53
54 Tt_callback_action
55 _DtMsgUpdateMarshall(
56         Tt_message msg,
57         Tt_pattern
58 )
59 {
60         DtTtMessageUpdateCallback cb = (DtTtMessageUpdateCallback)
61                 tt_message_user( msg, DtTtMsgUpdateCBKey );
62         Tt_status status = tt_ptr_error( cb );
63         if (tt_is_err( status ) || (cb == 0)) {
64                 return TT_CALLBACK_CONTINUE;
65         }
66         Widget widget = DtTtMessageWidget( msg );
67         status = tt_ptr_error( widget );
68         if (tt_is_err( status ) || (widget == 0)) {
69                 return TT_CALLBACK_CONTINUE;
70         }
71         // XXX Just guessing.  Store oldState with tt_message_user_set()
72         Tt_state oldState = TT_SENT;
73         if (tt_message_state( msg ) == TT_SENT) {
74                 oldState = TT_CREATED;
75         }
76         (*cb)( widget, msg, oldState, TT_OK, True );
77         return TT_CALLBACK_CONTINUE;
78 }
79
80 Widget
81 DtTtMessageWidget(
82         Tt_message              msg
83 )
84 {
85         // Function address is cast to int and used as clientdata key
86         return (Widget)tt_message_user( msg, DtTtMsgWidgetKey );
87 }
88
89 static Tt_message
90 messageProps2Msg(
91         DtbMessagePropsMessagePropsInfo instance
92 )
93 {
94         Tt_message msg;
95         XtVaGetValues( instance->messageProps_shellform,
96                        XmNuserData, &msg, NULL );
97         return msg;
98 }
99
100 static Boolean
101 _DtTtMessageUpdating(
102         Tt_message msg
103 )
104 {
105         void *updating = tt_message_user( msg, (int) (long) _DtTtMessageUpdating );
106         if (tt_is_err( tt_ptr_error( updating ))) {
107                 return False;
108         }
109         return updating == (void *)True;
110 }
111
112 static void
113 _DtTtMessageSetUpdating(
114         Tt_message                      msg,
115         Boolean                         updating
116 )
117 {
118         tt_message_user_set( msg, (int) (long) _DtTtMessageUpdating,
119                              (void *) (intptr_t)updating );
120 }
121
122 typedef enum {
123         _DtTtMessageRePrint,
124         _DtTtMessageArgAdded,
125         _DtTtMessageFullUpdate
126 } _DtTtMessageUpdateLevel;
127
128 static void
129 _DtTtMessageWidgetUpdate(
130         DtbMessagePropsMessagePropsInfo instance,
131         Tt_message                      msg,
132         _DtTtMessageUpdateLevel         level
133 )
134 {
135         char *printout = tt_message_print( msg ); // XXX when to free?
136         Tt_status status = tt_ptr_error( printout );
137         if (tt_is_err( status )) {
138                 printout = tt_status_message( status );
139         }
140         XtVaSetValues( instance->messageText, XmNvalue, printout, NULL );
141         if (level == _DtTtMessageRePrint) {
142                 return;
143         }
144
145         int numArgs = tt_message_args_count( msg );
146 #define SetArgMenuItemSensitive(n) \
147         XtSetSensitive( instance->setArgButton_setArgButton_menu_items. \
148                         Arg_##n##_item, numArgs > n );
149         SetArgMenuItemSensitive(0);
150         SetArgMenuItemSensitive(1);
151         SetArgMenuItemSensitive(2);
152         SetArgMenuItemSensitive(3);
153         SetArgMenuItemSensitive(4);
154         SetArgMenuItemSensitive(5);
155         SetArgMenuItemSensitive(6);
156         SetArgMenuItemSensitive(7);
157         SetArgMenuItemSensitive(8);
158         SetArgMenuItemSensitive(9);
159         SetArgMenuItemSensitive(10);
160         SetArgMenuItemSensitive(11);
161         SetArgMenuItemSensitive(12);
162         SetArgMenuItemSensitive(13);
163         SetArgMenuItemSensitive(14);
164         SetArgMenuItemSensitive(15);
165 #undef SetArgMenuItemSensitive
166         XtSetSensitive( instance->setArgButton_setArgButton_menu_items.
167                         Arg_15_item2, numArgs > 16 );
168
169         if (level == _DtTtMessageArgAdded) {
170                 return;
171         }
172
173         _DtTtMessageSetUpdating( msg, True );
174
175         char *op = tt_message_op( msg );
176         status = tt_ptr_error( op );
177         if (! tt_is_err( status )) {
178                 XmTextFieldSetString( instance->opText, op );
179                 tt_free( op );
180         }
181
182         char *handler = tt_message_handler( msg );
183         status = tt_ptr_error( handler );
184         if (! tt_is_err( status )) {
185                 XmTextFieldSetString( instance->handlerText, handler );
186                 tt_free( handler );
187         }
188
189         char *file = tt_message_file( msg );
190         status = tt_ptr_error( file );
191         if (! tt_is_err( status )) {
192                 XmTextFieldSetString( instance->fileText, file );
193                 tt_free( file );
194         }
195
196         char *session = tt_message_session( msg );
197         status = tt_ptr_error( session );
198         if (! tt_is_err( status )) {
199                 XmTextFieldSetString( instance->sessionText, session );
200                 tt_free( session );
201         }
202
203         int val = tt_message_status( msg );
204         XtVaSetValues( instance->statusBox, DtNposition, val, NULL );
205         char *status_string = tt_status_string( (Tt_status)val );
206         DtTtSetLabel( instance->statusLabel, status_string );
207         tt_free( status_string );
208
209         Widget choice;
210         switch (tt_message_class( msg )) {
211             case TT_CLASS_UNDEFINED:
212             default:
213                 choice = instance->classChoice_items.UNDEFINED_item;
214                 break;
215             case TT_NOTICE:
216                 choice = instance->classChoice_items.NOTICE_item;
217                 break;
218             case TT_REQUEST:
219                 choice = instance->classChoice_items.REQUEST_item;
220                 break;
221             case TT_OFFER:
222                 choice = instance->classChoice_items.OFFER_item;
223                 break;
224         }
225         XtVaSetValues( instance->classChoice, XmNmenuHistory, choice, NULL );
226
227         switch (tt_message_address( msg )) {
228             case TT_PROCEDURE:
229                 choice = instance->addressChoice_items.PROCEDURE_item;
230                 break;
231             case TT_OBJECT:
232                 choice = instance->addressChoice_items.OBJECT_item;
233                 break;
234             case TT_HANDLER:
235                 choice = instance->addressChoice_items.HANDLER_item;
236                 break;
237             case TT_OTYPE:
238                 choice = instance->addressChoice_items.OTYPE_item;
239                 break;
240             case TT_ADDRESS_LAST:
241             default:
242                 choice = instance->addressChoice_items.ADDRESS_LAST_item;
243                 break;
244         }
245         XtVaSetValues( instance->addressChoice, XmNmenuHistory, choice, NULL );
246
247         switch (tt_message_scope( msg )) {
248             case TT_SCOPE_NONE:
249             default:
250                 choice = instance->scopeChoice_items.SCOPE_NONE_item;
251                 break;
252             case TT_SESSION:
253                 choice = instance->scopeChoice_items.SESSION_item;
254                 break;
255             case TT_FILE:
256                 choice = instance->scopeChoice_items.FILE_item;
257                 break;
258             case TT_BOTH:
259                 choice = instance->scopeChoice_items.BOTH_item;
260                 break;
261             case TT_FILE_IN_SESSION:
262                 choice = instance->scopeChoice_items.FILE_IN_SESSION_item;
263                 break;
264         }
265         XtVaSetValues( instance->scopeChoice, XmNmenuHistory, choice, NULL );
266
267         switch (tt_message_disposition( msg )) {
268             case TT_DISCARD:
269             default:
270                 choice = instance->dispositionChoice_items.DISCARD_item;
271                 break;
272             case TT_QUEUE:
273                 choice = instance->dispositionChoice_items.QUEUE_item;
274                 break;
275             case TT_START:
276                 choice = instance->dispositionChoice_items.START_item;
277                 break;
278             case TT_QUEUE+TT_START:
279                 choice = instance->dispositionChoice_items.QUEUE_START_item;
280                 break;
281         }
282         XtVaSetValues( instance->dispositionChoice, XmNmenuHistory, choice, NULL);
283
284         _DtTtMessageSetUpdating( msg, False );
285 }
286
287 void
288 DtTtMessageWidgetUpdate(
289         Widget          propsWin,
290         Tt_message      msg,
291         Tt_state        oldState,
292         Tt_status       lastOperation,
293         Boolean         stillExists
294 )
295 {
296         void *v = tt_message_user( msg, DtTtMsgInfoKey );
297         Tt_status status = tt_ptr_error( v );
298         if (tt_is_err( status ) || (v == 0)) {
299                 return;
300         }
301         DtbMessagePropsMessagePropsInfo instance =
302                 (DtbMessagePropsMessagePropsInfo)v;
303         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
304 }
305
306 void
307 _DtTtMessageUpdate(
308         Tt_message                      msg,
309         _DtStringChooserAction          choice,
310         char *                          val
311 )
312 {
313         DtbMessagePropsMessagePropsInfo instance;
314         instance = (DtbMessagePropsMessagePropsInfo)
315                 tt_message_user( msg, DtTtMsgInfoKey );
316         Tt_status status = tt_ptr_error( instance );
317         if (tt_is_err( status ) || (instance == 0)) {
318                 return;
319         }
320         char *func;
321         switch (choice) {
322             case _DtStringChooseMessageOtype:
323                 status = tt_message_otype_set( msg, val );
324                 func = "tt_message_otype_set()";
325                 break;
326             case _DtStringChooseMessageObject:
327                 status = tt_message_object_set( msg, val );
328                 func = "tt_message_object_set()";
329                 break;
330             case _DtStringChooseMessageHandlerPtype:
331                 status = tt_message_handler_ptype_set( msg, val );
332                 func = "tt_message_handler_ptype_set()";
333                 break;
334             case _DtStringChooseMessageSenderPtype:
335                 status = tt_message_sender_ptype_set( msg, val );
336                 func = "tt_message_sender_ptype_set()";
337                 break;
338             case _DtStringChooseMessageStatusString:
339                 status = tt_message_status_string_set( msg, val );
340                 func = "tt_message_status_string_set()";
341                 break;
342             case _DtStringChooseMessageArgValSet: {
343                 if (val == 0) {
344                         break;
345                 }
346                 int arg = atoi( val );
347                 if ((arg <= 15) || (arg+1 > tt_message_args_count( msg ))) {
348                         break;
349                 }
350                 Tt_mode mode = tt_message_arg_mode( msg, arg );
351                 char *vtype = tt_message_arg_type( msg, arg );
352                 if (tt_is_err( tt_ptr_error( vtype ))) {
353                         vtype = 0;
354                 }
355                 char *val = 0;
356                 int ival = 0;
357                 Boolean noValue = False;
358                 Tt_status status = tt_message_arg_ival( msg, arg, &ival );
359                 if (status == TT_ERR_NUM) {
360                         val = tt_message_arg_val( msg, arg );
361                         if (tt_is_err( tt_ptr_error( val ))) {
362                                 val = 0;
363                         }
364                         if (val == 0) {
365                                 noValue = True;
366                         }
367                 }
368                 _DtArgChooserSet( _DtArgChooseMessageArgSet, msg, arg,
369                                   mode, noValue, vtype, val, ival );
370                 } return;
371             default:
372                 return;
373         }
374         DtTtSetLabel( instance->messageFooterLabel, func, status );
375         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
376         return;
377 }
378
379 void
380 _DtTtMessageUpdate(
381         Tt_message                      msg,
382         _DtSessionChooserAction         choice,
383         char *                          session
384 )
385 {
386         DtbMessagePropsMessagePropsInfo instance;
387         instance = (DtbMessagePropsMessagePropsInfo)
388                 tt_message_user( msg, DtTtMsgInfoKey );
389         Tt_status status = tt_ptr_error( instance );
390         if (tt_is_err( status ) || (instance == 0)) {
391                 return;
392         }
393         char *func;
394         switch (choice) {
395             case _DtSessionChooseMessage:
396                 status = tt_message_session_set( msg, session );
397                 func = "tt_message_session_set()";
398                 session = tt_message_session( msg );
399                 if (! tt_is_err( tt_ptr_error( session ))) {
400                         _DtTtMessageSetUpdating( msg, True );
401                         XmTextFieldSetString( instance->sessionText, session );
402                         _DtTtMessageSetUpdating( msg, False );
403                         tt_free( session );
404                 }
405                 break;
406             default:
407                 return;
408         }
409         DtTtSetLabel( instance->messageFooterLabel, func, status );
410         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
411         return;
412 }
413
414 void
415 _DtTtMessageUpdate(
416         Tt_message                      msg,
417         _DtFileChooserAction            choice,
418         char *                          file
419 )
420 {
421         DtbMessagePropsMessagePropsInfo instance;
422         instance = (DtbMessagePropsMessagePropsInfo)
423                 tt_message_user( msg, DtTtMsgInfoKey );
424         Tt_status status = tt_ptr_error( instance );
425         if (tt_is_err( status ) || (instance == 0)) {
426                 return;
427         }
428         char *func;
429         switch (choice) {
430             case _DtFileChooseMessageSet:
431                 status = tt_message_file_set( msg, file );
432                 func = "tt_message_file_set()";
433                 file = tt_message_file( msg );
434                 if (! tt_is_err( tt_ptr_error( file ))) {
435                         _DtTtMessageSetUpdating( msg, True );
436                         XmTextFieldSetString( instance->fileText, file );
437                         _DtTtMessageSetUpdating( msg, False );
438                         tt_free( file );
439                 }
440                 break;
441             default:
442                 return;
443         }
444         DtTtSetLabel( instance->messageFooterLabel, func, status );
445         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
446         return;
447 }
448
449 void
450 _DtTtMessageUpdate(
451         Tt_message                      msg,
452         _DtTtChooserAction              choice,
453         char *                          string
454 )
455 {
456         DtbMessagePropsMessagePropsInfo instance;
457         instance = (DtbMessagePropsMessagePropsInfo)
458                 tt_message_user( msg, DtTtMsgInfoKey );
459         Tt_status status = tt_ptr_error( instance );
460         if (tt_is_err( status ) || (instance == 0)) {
461                 return;
462         }
463         char *func;
464         switch (choice) {
465             case _DtTtChooserMessageOpSet:
466                 status = tt_message_op_set( msg, string );
467                 func = "tt_message_op_set()";
468                 string = tt_message_op( msg );
469                 if (! tt_is_err( tt_ptr_error( string ))) {
470                         _DtTtMessageSetUpdating( msg, True );
471                         XmTextFieldSetString( instance->opText, string );
472                         _DtTtMessageSetUpdating( msg, False );
473                         tt_free( string );
474                 }
475                 break;
476             case _DtTtChooserMessageHandlerSet:
477                 status = tt_message_handler_set( msg, string );
478                 func = "tt_message_handler_set()";
479                 string = tt_message_handler( msg );
480                 if (! tt_is_err( tt_ptr_error( string ))) {
481                         _DtTtMessageSetUpdating( msg, True );
482                         XmTextFieldSetString( instance->handlerText, string );
483                         _DtTtMessageSetUpdating( msg, False );
484                         tt_free( string );
485                 }
486                 break;
487             default:
488                 return;
489         }
490         DtTtSetLabel( instance->messageFooterLabel, func, status );
491         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
492         return;
493 }
494
495 void
496 _DtTtMessageUpdate(
497         Tt_message              msg,
498         _DtArgChooserAction     choice,
499         int                     nth,
500         Tt_mode                 mode,
501         char *                  vtype,
502         char *                  val,
503         int                     ival
504 )
505 {
506         DtbMessagePropsMessagePropsInfo instance;
507         instance = (DtbMessagePropsMessagePropsInfo)
508                 tt_message_user( msg, DtTtMsgInfoKey );
509         Tt_status status = tt_ptr_error( instance );
510         if (tt_is_err( status ) || (instance == 0)) {
511                 return;
512         }
513         char *func;
514         switch (choice) {
515             case _DtArgChooseMessageArgAdd:
516                 status = tt_message_arg_add( msg, mode, vtype, val );
517                 func = "tt_message_arg_add()";
518                 break;
519             case _DtArgChooseMessageIArgAdd:
520                 status = tt_message_iarg_add( msg, mode, vtype, ival );
521                 func = "tt_message_iarg_add()";
522                 break;
523             case _DtArgChooseMessageArgSet:
524                 status = tt_message_arg_val_set( msg, nth, val );
525                 func = "tt_message_arg_val_set()";
526                 break;
527             case _DtArgChooseMessageIArgSet:
528                 status = tt_message_arg_ival_set( msg, nth, ival );
529                 func = "tt_message_arg_ival_set()";
530                 break;
531             case _DtArgChooseMessageContextSet:
532                 status = tt_message_context_set( msg, vtype, val );
533                 func = "tt_message_context_set()";
534                 break;
535             case _DtArgChooseMessageIContextSet:
536                 status = tt_message_icontext_set( msg, vtype, ival );
537                 func = "tt_message_icontext_set()";
538                 break;
539             default:
540                 return;
541         }
542         DtTtSetLabel( instance->messageFooterLabel, func, status );
543         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageArgAdded );
544         return;
545 }
546
547 void
548 _DtTtMessageUpdate(
549         Tt_message                      msg,
550         Tt_message_callback             cb
551 )
552 {
553         DtbMessagePropsMessagePropsInfo instance;
554         instance = (DtbMessagePropsMessagePropsInfo)
555                 tt_message_user( msg, DtTtMsgInfoKey );
556         Tt_status status = tt_ptr_error( instance );
557         if (tt_is_err( status ) || (instance == 0)) {
558                 return;
559         }
560         status = tt_message_callback_add( msg, cb );
561         DtTtSetLabel( instance->messageFooterLabel,
562                       "tt_message_callback_add()", status );
563         return;
564 }
565
566 Widget
567 DtTtMessageWidgetCreate(
568         Widget                          parent,
569         Tt_message                      msg,
570         DtTtMessageUpdateCallback       notifyProc
571 )
572 {
573         DtbMessagePropsMessagePropsInfoRec *instance;
574         Widget widget = DtTtMessageWidget( msg );
575         Tt_status status = tt_ptr_error( widget );
576         if (tt_is_err( status ) || (widget != 0)) {
577                 instance = (DtbMessagePropsMessagePropsInfoRec *)
578                         tt_message_user( msg, DtTtMsgInfoKey );
579                 status = tt_ptr_error( instance );
580                 if (tt_is_err( status ) || (instance != 0)) {
581                         XtManageChild( instance->messageProps_shellform );
582                 }
583                 return widget;
584         }
585         instance = new DtbMessagePropsMessagePropsInfoRec;
586         if (instance == 0) {
587                 return (Widget)tt_error_pointer( TT_ERR_NOMEM );
588         }
589         // XXX delete instance in widget destroy proc
590         status = tt_message_user_set( msg, DtTtMsgInfoKey, instance );
591         if (tt_is_err( status )) {
592                 delete instance;
593                 return (Widget)tt_error_pointer( status );
594         }
595         dtbMessagePropsMessagePropsInfo_clear( instance );
596         dtb_message_props_message_props_initialize( instance, parent );
597         widget = instance->messageProps;
598
599         XtVaSetValues( instance->messageProps_shellform, XmNuserData, msg, NULL );
600         status = tt_message_user_set( msg, DtTtMsgWidgetKey, widget );
601         if (tt_is_err( status )) {
602                 XtDestroyWidget( widget );
603                 delete instance;
604                 return (Widget)tt_error_pointer( status );
605         }
606         if (notifyProc != 0) {
607                 status = tt_message_user_set( msg, DtTtMsgUpdateCBKey,
608                                               (void *) notifyProc );
609                 if (tt_is_err( status )) {
610                         XtDestroyWidget( widget );
611                         return (Widget)tt_error_pointer( status );
612                 }
613                 status = tt_message_callback_add( msg, _DtMsgUpdateMarshall );
614                 if (tt_is_err( status )) {
615                         XtDestroyWidget( widget );
616                         return (Widget)tt_error_pointer( status );
617                 }
618         }
619
620         std::ostringstream labelStream;
621         labelStream << "Tt_message " << (void *)msg;
622         XtVaSetValues( instance->messageProps,
623                        XmNtitle, labelStream.str().c_str(),
624                        NULL );
625
626         _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
627
628         XtManageChild( instance->messageProps_shellform );
629         return widget;
630 }
631
632 static void
633 _DtTtMessageDispositionSet(
634         DtbMessagePropsMessagePropsInfo instance,
635         Tt_disposition disposition
636 )
637 {
638     Tt_message msg = messageProps2Msg( instance );
639     if (msg == 0) {
640             return;
641     }
642     Tt_status status = tt_message_disposition_set( msg, disposition );
643     DtTtSetLabel( instance->messageFooterLabel,
644                   "tt_message_disposition_set()", status );
645     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
646 }
647
648 /*** DTB_USER_CODE_END
649  ***
650  *** End of user code section
651  ***
652  **************************************************************************/
653
654
655
656 void 
657 messageProps_msgCloseButton_CB1(
658     Widget widget,
659     XtPointer clientData,
660     XtPointer callData
661 )
662 {
663     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
664     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
665     
666     DtbMessagePropsMessagePropsInfo     instance = (DtbMessagePropsMessagePropsInfo)clientData;
667     
668     if (!(instance->initialized))
669     {
670         dtb_message_props_message_props_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
671     }
672     XtUnmanageChild(instance->messageProps_shellform);
673     
674     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
675     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
676 }
677
678
679 void 
680 setClassUndefined(
681     Widget widget,
682     XtPointer clientData,
683     XtPointer callData
684 )
685 {
686     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
687     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
688     
689     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
690     DtbMessagePropsMessagePropsInfo instance =
691             (DtbMessagePropsMessagePropsInfo)clientData;
692     Tt_message msg = messageProps2Msg( instance );
693     if (msg == 0) {
694             return;
695     }
696     Tt_status status = tt_message_class_set( msg, TT_CLASS_UNDEFINED );
697     DtTtSetLabel( instance->messageFooterLabel,
698                   "tt_message_class_set()", status );
699     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
700     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
701 }
702
703
704 void 
705 setClassNotice(
706     Widget widget,
707     XtPointer clientData,
708     XtPointer callData
709 )
710 {
711     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
712     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
713     
714     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
715     DtbMessagePropsMessagePropsInfo instance =
716             (DtbMessagePropsMessagePropsInfo)clientData;
717     Tt_message msg = messageProps2Msg( instance );
718     if (msg == 0) {
719             return;
720     }
721     Tt_status status = tt_message_class_set( msg, TT_NOTICE );
722     DtTtSetLabel( instance->messageFooterLabel,
723                   "tt_message_class_set()", status );
724     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
725     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
726 }
727
728
729 void 
730 setClassRequest(
731     Widget widget,
732     XtPointer clientData,
733     XtPointer callData
734 )
735 {
736     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
737     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
738     
739     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
740     DtbMessagePropsMessagePropsInfo instance =
741             (DtbMessagePropsMessagePropsInfo)clientData;
742     Tt_message msg = messageProps2Msg( instance );
743     if (msg == 0) {
744             return;
745     }
746     Tt_status status = tt_message_class_set( msg, TT_REQUEST );
747     DtTtSetLabel( instance->messageFooterLabel,
748                   "tt_message_class_set()", status );
749     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
750     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
751 }
752
753
754 void 
755 setClassOffer(
756     Widget widget,
757     XtPointer clientData,
758     XtPointer callData
759 )
760 {
761     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
762     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
763     
764     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
765     DtbMessagePropsMessagePropsInfo instance =
766             (DtbMessagePropsMessagePropsInfo)clientData;
767     Tt_message msg = messageProps2Msg( instance );
768     if (msg == 0) {
769             return;
770     }
771     Tt_status status = tt_message_class_set( msg, TT_OFFER );
772     DtTtSetLabel( instance->messageFooterLabel,
773                   "tt_message_class_set()", status );
774     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
775     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
776 }
777
778
779 void 
780 setAddressLast(
781     Widget widget,
782     XtPointer clientData,
783     XtPointer callData
784 )
785 {
786     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
787     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
788     
789     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
790     DtbMessagePropsMessagePropsInfo instance =
791             (DtbMessagePropsMessagePropsInfo)clientData;
792     Tt_message msg = messageProps2Msg( instance );
793     if (msg == 0) {
794             return;
795     }
796     Tt_status status = tt_message_address_set( msg, TT_ADDRESS_LAST );
797     DtTtSetLabel( instance->messageFooterLabel,
798                   "tt_message_address_set()", status );
799     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
800     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
801 }
802
803
804 void 
805 setAddressProcedure(
806     Widget widget,
807     XtPointer clientData,
808     XtPointer callData
809 )
810 {
811     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
812     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
813     
814     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
815     DtbMessagePropsMessagePropsInfo instance =
816             (DtbMessagePropsMessagePropsInfo)clientData;
817     Tt_message msg = messageProps2Msg( instance );
818     if (msg == 0) {
819             return;
820     }
821     Tt_status status = tt_message_address_set( msg, TT_PROCEDURE );
822     DtTtSetLabel( instance->messageFooterLabel,
823                   "tt_message_address_set()", status );
824     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
825     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
826 }
827
828
829 void 
830 setAddressObject(
831     Widget widget,
832     XtPointer clientData,
833     XtPointer callData
834 )
835 {
836     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
837     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
838     
839     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
840     DtbMessagePropsMessagePropsInfo instance =
841             (DtbMessagePropsMessagePropsInfo)clientData;
842     Tt_message msg = messageProps2Msg( instance );
843     if (msg == 0) {
844             return;
845     }
846     Tt_status status = tt_message_address_set( msg, TT_OBJECT );
847     DtTtSetLabel( instance->messageFooterLabel,
848                   "tt_message_address_set()", status );
849     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
850     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
851 }
852
853
854 void 
855 setAddressHandler(
856     Widget widget,
857     XtPointer clientData,
858     XtPointer callData
859 )
860 {
861     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
862     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
863     
864     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
865     DtbMessagePropsMessagePropsInfo instance =
866             (DtbMessagePropsMessagePropsInfo)clientData;
867     Tt_message msg = messageProps2Msg( instance );
868     if (msg == 0) {
869             return;
870     }
871     Tt_status status = tt_message_address_set( msg, TT_HANDLER );
872     DtTtSetLabel( instance->messageFooterLabel,
873                   "tt_message_address_set()", status );
874     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
875     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
876 }
877
878
879 void 
880 setAddressOtype(
881     Widget widget,
882     XtPointer clientData,
883     XtPointer callData
884 )
885 {
886     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
887     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
888     
889     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
890     DtbMessagePropsMessagePropsInfo instance =
891             (DtbMessagePropsMessagePropsInfo)clientData;
892     Tt_message msg = messageProps2Msg( instance );
893     if (msg == 0) {
894             return;
895     }
896     Tt_status status = tt_message_address_set( msg, TT_OTYPE );
897     DtTtSetLabel( instance->messageFooterLabel,
898                   "tt_message_address_set()", status );
899     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
900     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
901 }
902
903
904 void 
905 setScopeNone(
906     Widget widget,
907     XtPointer clientData,
908     XtPointer callData
909 )
910 {
911     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
912     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
913     
914     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
915     DtbMessagePropsMessagePropsInfo instance =
916             (DtbMessagePropsMessagePropsInfo)clientData;
917     Tt_message msg = messageProps2Msg( instance );
918     if (msg == 0) {
919             return;
920     }
921     Tt_status status = tt_message_scope_set( msg, TT_SCOPE_NONE );
922     DtTtSetLabel( instance->messageFooterLabel,
923                   "tt_message_scope_set()", status );
924     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
925     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
926 }
927
928
929 void 
930 setScopeSession(
931     Widget widget,
932     XtPointer clientData,
933     XtPointer callData
934 )
935 {
936     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
937     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
938     
939     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
940     DtbMessagePropsMessagePropsInfo instance =
941             (DtbMessagePropsMessagePropsInfo)clientData;
942     Tt_message msg = messageProps2Msg( instance );
943     if (msg == 0) {
944             return;
945     }
946     Tt_status status = tt_message_scope_set( msg, TT_SESSION );
947     DtTtSetLabel( instance->messageFooterLabel,
948                   "tt_message_scope_set()", status );
949     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
950     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
951 }
952
953
954 void 
955 setScopeFile(
956     Widget widget,
957     XtPointer clientData,
958     XtPointer callData
959 )
960 {
961     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
962     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
963     
964     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
965     DtbMessagePropsMessagePropsInfo instance =
966             (DtbMessagePropsMessagePropsInfo)clientData;
967     Tt_message msg = messageProps2Msg( instance );
968     if (msg == 0) {
969             return;
970     }
971     Tt_status status = tt_message_scope_set( msg, TT_FILE );
972     DtTtSetLabel( instance->messageFooterLabel,
973                   "tt_message_scope_set()", status );
974     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
975     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
976 }
977
978
979 void 
980 setScopeBoth(
981     Widget widget,
982     XtPointer clientData,
983     XtPointer callData
984 )
985 {
986     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
987     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
988     
989     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
990     DtbMessagePropsMessagePropsInfo instance =
991             (DtbMessagePropsMessagePropsInfo)clientData;
992     Tt_message msg = messageProps2Msg( instance );
993     if (msg == 0) {
994             return;
995     }
996     Tt_status status = tt_message_scope_set( msg, TT_BOTH );
997     DtTtSetLabel( instance->messageFooterLabel,
998                   "tt_message_scope_set()", status );
999     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1000     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1001 }
1002
1003
1004 void 
1005 setScopeFileInSession(
1006     Widget widget,
1007     XtPointer clientData,
1008     XtPointer callData
1009 )
1010 {
1011     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1012     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1013     
1014     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1015     DtbMessagePropsMessagePropsInfo instance =
1016             (DtbMessagePropsMessagePropsInfo)clientData;
1017     Tt_message msg = messageProps2Msg( instance );
1018     if (msg == 0) {
1019             return;
1020     }
1021     Tt_status status = tt_message_scope_set( msg, TT_FILE_IN_SESSION );
1022     DtTtSetLabel( instance->messageFooterLabel,
1023                   "tt_message_scope_set()", status );
1024     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1025     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1026 }
1027
1028
1029 void 
1030 setOp(
1031     Widget widget,
1032     XtPointer clientData,
1033     XtPointer callData
1034 )
1035 {
1036     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1037     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1038     
1039     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1040     DtbMessagePropsMessagePropsInfo instance =
1041             (DtbMessagePropsMessagePropsInfo)clientData;
1042     Tt_message msg = messageProps2Msg( instance );
1043     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1044             return;
1045     }
1046     char *op = XmTextFieldGetString( instance->opText );
1047     if ((op != 0) && (op[0] == '\0')) {
1048             XtFree( op );
1049             op = 0;
1050     }
1051     Tt_status status = tt_message_op_set( msg, op );
1052     if (op != 0) {
1053             XtFree( op );
1054     }
1055     DtTtSetLabel( instance->messageFooterLabel,
1056                   "tt_message_op_set()", status );
1057     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1058     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1059 }
1060
1061
1062 void 
1063 msgSend(
1064     Widget widget,
1065     XtPointer clientData,
1066     XtPointer callData
1067 )
1068 {
1069     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1070     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1071     
1072     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1073     DtbMessagePropsMessagePropsInfo instance =
1074             (DtbMessagePropsMessagePropsInfo)clientData;
1075     Tt_message msg = messageProps2Msg( instance );
1076     if (msg == 0) {
1077             return;
1078     }
1079     Tt_status status = tt_message_send( msg );
1080     DtTtSetLabel( instance->messageFooterLabel,
1081                   "tt_message_send()", status );
1082     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1083     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1084 }
1085
1086
1087 void 
1088 msgSendOnExit(
1089     Widget widget,
1090     XtPointer clientData,
1091     XtPointer callData
1092 )
1093 {
1094     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1095     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1096     
1097     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1098     DtbMessagePropsMessagePropsInfo instance =
1099             (DtbMessagePropsMessagePropsInfo)clientData;
1100     Tt_message msg = messageProps2Msg( instance );
1101     if (msg == 0) {
1102             return;
1103     }
1104     Tt_status status = tt_message_send_on_exit( msg );
1105     DtTtSetLabel( instance->messageFooterLabel,
1106                   "tt_message_send_on_exit()", status );
1107     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1108     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1109 }
1110
1111
1112 void 
1113 msgAccept(
1114     Widget widget,
1115     XtPointer clientData,
1116     XtPointer callData
1117 )
1118 {
1119     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1120     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1121     
1122     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1123     DtbMessagePropsMessagePropsInfo instance =
1124             (DtbMessagePropsMessagePropsInfo)clientData;
1125     Tt_message msg = messageProps2Msg( instance );
1126     if (msg == 0) {
1127             return;
1128     }
1129     Tt_status status = tt_message_accept( msg );
1130     DtTtSetLabel( instance->messageFooterLabel,
1131                   "tt_message_accept()", status );
1132     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1133     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1134 }
1135
1136
1137 void 
1138 msgReject(
1139     Widget widget,
1140     XtPointer clientData,
1141     XtPointer callData
1142 )
1143 {
1144     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1145     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1146     
1147     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1148     DtbMessagePropsMessagePropsInfo instance =
1149             (DtbMessagePropsMessagePropsInfo)clientData;
1150     Tt_message msg = messageProps2Msg( instance );
1151     if (msg == 0) {
1152             return;
1153     }
1154     Tt_status status = tt_message_send_on_exit( msg );
1155     DtTtSetLabel( instance->messageFooterLabel,
1156                   "tt_message_send_on_exit()", status );
1157     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1158     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1159 }
1160
1161
1162 void 
1163 msgReply(
1164     Widget widget,
1165     XtPointer clientData,
1166     XtPointer callData
1167 )
1168 {
1169     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1170     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1171     
1172     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1173     DtbMessagePropsMessagePropsInfo instance =
1174             (DtbMessagePropsMessagePropsInfo)clientData;
1175     Tt_message msg = messageProps2Msg( instance );
1176     if (msg == 0) {
1177             return;
1178     }
1179     Tt_status status = tt_message_reply( msg );
1180     DtTtSetLabel( instance->messageFooterLabel,
1181                   "tt_message_reply()", status );
1182     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1183     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1184 }
1185
1186
1187 void 
1188 msgFail(
1189     Widget widget,
1190     XtPointer clientData,
1191     XtPointer callData
1192 )
1193 {
1194     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1195     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1196     
1197     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1198     DtbMessagePropsMessagePropsInfo instance =
1199             (DtbMessagePropsMessagePropsInfo)clientData;
1200     Tt_message msg = messageProps2Msg( instance );
1201     if (msg == 0) {
1202             return;
1203     }
1204     Tt_status status = tt_message_fail( msg );
1205     DtTtSetLabel( instance->messageFooterLabel,
1206                   "tt_message_fail()", status );
1207     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1208     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1209 }
1210
1211
1212 void 
1213 msgDestroy(
1214     Widget widget,
1215     XtPointer clientData,
1216     XtPointer callData
1217 )
1218 {
1219     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1220     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1221     
1222     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1223     DtbMessagePropsMessagePropsInfo instance =
1224             (DtbMessagePropsMessagePropsInfo)clientData;
1225     Tt_message msg = messageProps2Msg( instance );
1226     if (msg == 0) {
1227             return;
1228     }
1229     Tt_status status = tttk_message_destroy( msg );
1230     DtTtSetLabel( instance->messageFooterLabel,
1231                   "tttk_message_destroy()", status );
1232     switch (status) {
1233         case TT_OK:
1234             DtTtDestroyed( DTTT_MESSAGE, msg );
1235             XtDestroyWidget( instance->messageProps );
1236             delete instance;
1237             break;
1238         default:
1239             _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1240             break;
1241     }
1242     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1243 }
1244
1245
1246 void 
1247 msgDtAccept(
1248     Widget widget,
1249     XtPointer clientData,
1250     XtPointer callData
1251 )
1252 {
1253     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1254     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1255     
1256     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1257     DtbMessagePropsMessagePropsInfo instance =
1258             (DtbMessagePropsMessagePropsInfo)clientData;
1259     Tt_message msg = messageProps2Msg( instance );
1260     if (msg == 0) {
1261             return;
1262     }
1263     Tt_pattern *pats = ttdt_message_accept( msg, 0, 0, instance->messageProps,
1264                                             1, 1 );
1265     Tt_status status = tt_ptr_error( pats );
1266     DtTtSetLabel( instance->messageFooterLabel,
1267                   "ttdt_message_accept()", status );
1268     if ((status == TT_OK) && (pats != 0)) {
1269             while (*pats != 0) {
1270                     DtTtCreated( DTTT_PATTERN, *pats );
1271                     pats++;
1272             }
1273     }
1274     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1275     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1276 }
1277
1278
1279 void 
1280 msgSubcontractManage(
1281     Widget widget,
1282     XtPointer clientData,
1283     XtPointer callData
1284 )
1285 {
1286     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1287     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1288     
1289     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1290     DtbMessagePropsMessagePropsInfo instance =
1291             (DtbMessagePropsMessagePropsInfo)clientData;
1292     Tt_message msg = messageProps2Msg( instance );
1293     if (msg == 0) {
1294             return;
1295     }
1296     Tt_pattern *pats = ttdt_subcontract_manage( msg, 0,
1297                                                 instance->messageProps, 0 );
1298     Tt_status status = tt_ptr_error( pats );
1299     DtTtSetLabel( instance->messageFooterLabel,
1300                   "ttdt_subcontract_manage()", status );
1301     if (status == TT_OK) {
1302             while (*pats != 0) {
1303                     DtTtCreated( DTTT_PATTERN, *pats );
1304                     pats++;
1305             }
1306     }
1307     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageFullUpdate );
1308     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1309 }
1310
1311
1312 void 
1313 msgClone(
1314     Widget widget,
1315     XtPointer clientData,
1316     XtPointer callData
1317 )
1318 {
1319     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1320     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1321     
1322     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1323     DtbMessagePropsMessagePropsInfo instance =
1324             (DtbMessagePropsMessagePropsInfo)clientData;
1325     Tt_message msg = messageProps2Msg( instance );
1326     if (msg == 0) {
1327             return;
1328     }
1329     msg = tt_message_copy( msg );
1330     Tt_status status = DtTtSetLabel( instance->messageProps_footer,
1331                                      "tt_message_copy()", msg );
1332     if (tt_is_err( status )) {
1333             return;
1334     }
1335     DtTtCreated( DTTT_MESSAGE, msg );
1336     Widget newWidget = DtTtMessageWidgetCreate(
1337                                 dtb_ttsnoop_ttsnoop_win.ttsnoopWin, msg,
1338                                 DtTtMessageWidgetUpdate );
1339     status = tt_ptr_error( newWidget );
1340     if (tt_is_err( status )) {
1341             return;
1342     }
1343     XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
1344     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1345 }
1346
1347
1348 void 
1349 msgStatusNotice(
1350     Widget widget,
1351     XtPointer clientData,
1352     XtPointer callData
1353 )
1354 {
1355     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1356     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1357     
1358     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1359     DtbMessagePropsMessagePropsInfo instance =
1360             (DtbMessagePropsMessagePropsInfo)clientData;
1361     Tt_message msg = messageProps2Msg( instance );
1362     if (msg == 0) {
1363             return;
1364     }
1365     char *sender = tt_message_sender( msg );
1366     Tt_message msg2 = tttk_message_create( msg, TT_NOTICE,
1367                                 tt_message_scope( msg ), sender, "Status", 0 );
1368     tt_free( sender );
1369     Tt_status status = DtTtSetLabel( instance->messageProps_footer,
1370                                      "tttk_message_create()", msg2 );
1371     if (tt_is_err( status )) {
1372             return;
1373     }
1374
1375     tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
1376     tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
1377     tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
1378     tt_message_arg_add( msg2, TT_IN, Tttk_string, 0 );
1379     char *commission = tt_message_id( msg );
1380     tt_message_arg_add( msg2, TT_IN, Tttk_message_id, commission );
1381     tt_free( commission );
1382
1383     DtTtCreated( DTTT_MESSAGE, msg2 );
1384     Widget newWidget = DtTtMessageWidgetCreate(
1385                                 dtb_ttsnoop_ttsnoop_win.ttsnoopWin, msg2,
1386                                 DtTtMessageWidgetUpdate );
1387     status = tt_ptr_error( newWidget );
1388     if (tt_is_err( status )) {
1389             return;
1390     }
1391     XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
1392     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1393 }
1394
1395
1396 void 
1397 msgGenAction(
1398     Widget widget,
1399     XtPointer clientData,
1400     XtPointer callData
1401 )
1402 {
1403     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1404     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1405     
1406     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1407     std::ostringstream action;
1408     DtbMessagePropsMessagePropsInfo instance =
1409             (DtbMessagePropsMessagePropsInfo)clientData;
1410     Tt_message msg = messageProps2Msg( instance );
1411     if (msg == 0) {
1412             return;
1413     }
1414     char *op = tt_message_op( msg );
1415     action << "ACTION Send_" << op << "\n{\n\tLABEL\tSend_" << op << "\n";
1416     action << "\tTYPE\tTT_MSG\n";
1417     action << "\tTT_CLASS\t" << tt_message_class( msg ) << "\n";
1418     action << "\tTT_SCOPE\t" << tt_message_scope( msg ) << "\n";
1419     action << "\tTT_OPERATION\t" << op << "\n";
1420     tt_free( op );
1421     char *file = tt_message_file( msg );
1422     Tt_status status = tt_ptr_error( file );
1423     if ((! tt_is_err( status )) && (file != 0)) {
1424             action << "\tTT_FILE\t" << file << "\n";
1425             tt_free( file );
1426     }
1427     int args = tt_message_args_count( msg );
1428     for (int arg = 0; arg < args; arg++) {
1429             action << "\tTT_ARG" << arg << "_MODE\t";
1430             action << tt_message_arg_mode( msg, arg ) << "\n";
1431             char *vtype = tt_message_arg_type( msg, arg );
1432             action << "\tTT_ARG" << arg << "_VTYPE\t" << vtype << "\n";
1433             int ival;
1434             status = tt_message_arg_ival( msg, arg, &ival );
1435             switch (status) {
1436                     char *val;
1437                 case TT_OK:
1438                     action << "\tTT_ARG" << arg << "_REP_TYPE\t"
1439                               "TT_REP_INTEGER\n";
1440                     action << "\tTT_ARG" << arg << "_VALUE\t" << ival << "\n";
1441                     break;
1442                 case TT_ERR_NUM:
1443                     val = tt_message_arg_val( msg, arg );
1444                     status = tt_ptr_error( val );
1445                     if (tt_is_err( status ) || (val == 0)) {
1446                             continue;
1447                     }
1448                     action << "\tTT_ARG" << arg << "_VALUE\t" << val << "\n";
1449                     tt_free( val );
1450                     break;
1451             }
1452     }
1453     // XXX emit commented warnings for e.g. TT_OFFER, TT_HANDLER
1454     action << "}\n";
1455     // XtVaSetValues( instance->messageText, XmNvalue, action.str().c_str(), 0 );
1456     _DtOpen( instance->messageFooterLabel, (void *)action.str().c_str(),
1457              action.str().size(), "actio" );
1458     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1459 }
1460
1461
1462 void 
1463 msgGenC(
1464     Widget widget,
1465     XtPointer clientData,
1466     XtPointer callData
1467 )
1468 {
1469     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1470     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1471     
1472     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1473         std::ostringstream code;
1474         DtbMessagePropsMessagePropsInfo instance =
1475                 (DtbMessagePropsMessagePropsInfo)clientData;
1476         Tt_message msg = messageProps2Msg( instance );
1477         if (msg == 0) {
1478                 return;
1479         }
1480         code << "#include <Tt/tt_c.h>\n";
1481         code << "#include <Tt/tttk.h>\n";
1482         char *op = tt_message_op( msg );
1483         if (tt_message_class( msg ) != TT_NOTICE) {
1484                 code << "\nTt_callback_action\nprocess_" << op << "_reply(";
1485                 code << " Tt_message msg, Tt_message pat );\n";
1486         }
1487         code << "\nTt_message\n";
1488         code << "create_" << op << "(\n";
1489         code << "\tTt_message context\n)\n{\n";
1490         code << "\tTt_message msg;\n";
1491         code << "\tmsg = tttk_message_create( context";
1492         code << ", " << tt_message_class( msg );
1493         code << ", " << tt_message_scope( msg ) << ",\n\t\t\t";
1494         Tt_address address = tt_message_address( msg );
1495         switch (address) {
1496                 char *handler;
1497             case TT_PROCEDURE:
1498             default:
1499                 code << "0, ";
1500                 break;
1501             case TT_HANDLER:
1502                 handler = tt_message_handler( msg );
1503                 code << "\"" << handler << "\",\n";
1504                 tt_free( handler );
1505                 break;
1506         }
1507         if (op == 0) {
1508                 code << "(char *)0";
1509         } else {
1510                 code << "\"" << op << "\"";
1511         }
1512         code << ", ";
1513         if (tt_message_class( msg ) == TT_NOTICE) {
1514                 code << "0 ";
1515         } else {
1516                 code << "\n\t\t\tprocess_" << op << "_reply ";
1517         }
1518         code << ");\n";
1519         switch (address) {
1520             default:
1521                 code << "\ttt_message_address_set( msg, " << address << " );\n";
1522                 break;
1523             case TT_PROCEDURE:
1524             case TT_HANDLER:
1525                 // set properly by tttk_message_create();
1526                 break;
1527         }
1528         int args = tt_message_args_count( msg );
1529         if (tt_is_err( tt_int_error( args ))) {
1530                 args = 0;
1531         }
1532         for (int arg = 0; arg < args; arg++) {
1533                 Tt_mode mode = tt_message_arg_mode( msg, arg );
1534                 char *vtype = tt_message_arg_type( msg, arg );
1535                 int ival;
1536                 Tt_status status = tt_message_arg_ival( msg, arg, &ival );
1537                 switch (status) {
1538                         char *val;
1539                     case TT_OK:
1540                         code << "\ttt_message_iarg_add( msg, " << mode << ", ";
1541                         code << '"' << vtype << "\", " << ival << " );\n";
1542                         break;
1543                     case TT_ERR_NUM:
1544                         val = tt_message_arg_val( msg, arg );
1545                         code << "\ttt_message_arg_add( msg, " << mode << ", ";
1546                         code << '"' << vtype << "\", ";
1547                         if (val == 0) {
1548                                 code << "(char *)0";
1549                         } else {
1550                                 code << "\"" << val << "\"";
1551                         }
1552                         code << ");\n";
1553                         tt_free( val );
1554                         break;
1555                 }
1556                 tt_free( vtype );
1557         }
1558         int stat = tt_message_status( msg );
1559         if (stat != 0) {
1560                 code << "\ttt_message_status_set( msg, " << stat << " );\n";
1561         }
1562         code << "\treturn msg;\n";
1563         code << "}\n";
1564         if (tt_message_class( msg ) != TT_NOTICE) {
1565                 code << "\nstatic Tt_callback_action\n";
1566                 code << "process_" << op << "_reply(\n";
1567                 code << "\tTt_message msg,\n";
1568                 code << "\tTt_message pat\n";
1569                 code << ")\n{\n";
1570                 code << "\tswitch (tt_message_state(msg)) {\n";
1571                 code << "\t\tcase TT_SENT:\t/* handler is in this process */\n";
1572                 code << "\t\tcase TT_STARTED:/* intermediate state */\n";
1573                 code << "\t\tcase TT_QUEUED:\t/* intermediate state */\n";
1574                 code << "\t\tdefault:\t/* unknown state */\n";
1575                 code << "\t\t\treturn TT_CALLBACK_CONTINUE;\n";
1576                 if (tt_message_class(msg) == TT_REQUEST) {
1577                         code << "\t\tcase TT_HANDLED:\n";
1578                         code << "\t\t\t/* ... */\n";
1579                         code << "\t\t\tbreak;\n";
1580                         code << "\t\tcase TT_FAILED: {\n";
1581                         code << "\t\t\tint status;\n";
1582                         code << "\t\t\tchar *string;\n";
1583                         code << "\t\t\tstatus = tt_message_status( msg );\n";
1584                         code << "\t\t\tstring = "
1585                                 "tt_message_status_string( msg );\n";
1586                         code << "\t\t\t/* ... */\n";
1587                         code << "\t\t\t} break;\n";
1588                 } else {
1589                         code << "\t\tcase TT_RETURNED:\n";
1590                         code << "\t\t\t/* ... */\n";
1591                         code << "\t\t\tbreak;\n";
1592                 }
1593                 code << "\t}\n";
1594                 code << "\ttt_message_destroy( msg );\n";
1595                 code << "\treturn TT_CALLBACK_PROCESSED;\n";
1596                 code << "}\n";
1597         }
1598         tt_free( op );
1599         // XtVaSetValues( instance->messageText, XmNvalue, code.str().c_str(), 0 );
1600         _DtOpen( instance->messageFooterLabel, (void *)code.str().c_str(),
1601                  code.str().size(), "msgC" );
1602     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1603 }
1604
1605
1606 void 
1607 setHandler(
1608     Widget widget,
1609     XtPointer clientData,
1610     XtPointer callData
1611 )
1612 {
1613     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1614     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1615     
1616     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1617     DtbMessagePropsMessagePropsInfo instance =
1618             (DtbMessagePropsMessagePropsInfo)clientData;
1619     Tt_message msg = messageProps2Msg( instance );
1620     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1621             return;
1622     }
1623     char *handler = XmTextFieldGetString( instance->handlerText );
1624     if ((handler != 0) && (handler[0] == '\0')) {
1625             XtFree( handler );
1626             handler = 0;
1627     }
1628     Tt_status status = tt_message_handler_set( msg, handler );
1629     if (handler != 0) {
1630             XtFree( handler );
1631     }
1632     DtTtSetLabel( instance->messageFooterLabel,
1633                   "tt_message_handler_set()", status );
1634     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1635     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1636 }
1637
1638
1639 void 
1640 setSession(
1641     Widget widget,
1642     XtPointer clientData,
1643     XtPointer callData
1644 )
1645 {
1646     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1647     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1648     
1649     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1650     DtbMessagePropsMessagePropsInfo instance =
1651             (DtbMessagePropsMessagePropsInfo)clientData;
1652     Tt_message msg = messageProps2Msg( instance );
1653     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1654             return;
1655     }
1656     char *session = XmTextFieldGetString( instance->sessionText );
1657     if ((session != 0) && (session[0] == '\0')) {
1658             XtFree( session );
1659             session = 0;
1660     }
1661     Tt_status status = tt_message_session_set( msg, session );
1662     if (session != 0) {
1663             XtFree( session );
1664     }
1665     DtTtSetLabel( instance->messageFooterLabel,
1666                   "tt_message_session_set()", status );
1667     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1668     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1669 }
1670
1671
1672 void 
1673 setFile(
1674     Widget widget,
1675     XtPointer clientData,
1676     XtPointer callData
1677 )
1678 {
1679     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1680     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1681     
1682     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1683     DtbMessagePropsMessagePropsInfo instance =
1684             (DtbMessagePropsMessagePropsInfo)clientData;
1685     Tt_message msg = messageProps2Msg( instance );
1686     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1687             return;
1688     }
1689     char *file = XmTextFieldGetString( instance->fileText );
1690     if ((file != 0) && (file[0] == '\0')) {
1691             XtFree( file );
1692             file = 0;
1693     }
1694     Tt_status status = tt_message_file_set( msg, file );
1695     if (file != 0) {
1696             XtFree( file );
1697     }
1698     DtTtSetLabel( instance->messageFooterLabel,
1699                   "tt_message_file_set()", status );
1700     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1701     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1702 }
1703
1704
1705 void 
1706 setStatus(
1707     Widget widget,
1708     XtPointer clientData,
1709     XtPointer callData
1710 )
1711 {
1712     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1713     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1714     
1715     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1716     DtbMessagePropsMessagePropsInfo instance =
1717             (DtbMessagePropsMessagePropsInfo)clientData;
1718     Tt_message msg = messageProps2Msg( instance );
1719     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1720             return;
1721     }
1722     int val;
1723     XtVaGetValues( instance->statusBox, DtNposition, &val, NULL );
1724     XmString statusName = DtTtStatusString( (Tt_status)val );
1725     XtVaSetValues( instance->statusLabel, XmNlabelString, statusName, NULL );
1726     XmStringFree( statusName );
1727     Tt_status status = tt_message_status_set( msg, val );
1728     DtTtSetLabel( instance->messageFooterLabel,
1729                   "tt_message_status_set()", status );
1730     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1731     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1732 }
1733
1734
1735 void 
1736 msgHelp(
1737     Widget widget,
1738     XtPointer clientData,
1739     XtPointer callData
1740 )
1741 {
1742     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1743     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1744     
1745     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1746     dtb_do_onitem_help();
1747     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1748 }
1749
1750
1751 void 
1752 msgPattern(
1753     Widget widget,
1754     XtPointer clientData,
1755     XtPointer callData
1756 )
1757 {
1758     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1759     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1760     
1761     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1762     DtbMessagePropsMessagePropsInfo instance =
1763             (DtbMessagePropsMessagePropsInfo)clientData;
1764     Tt_message msg = messageProps2Msg( instance );
1765     if (msg == 0) {
1766             return;
1767     }
1768     Tt_pattern pat = tt_message_pattern( msg );
1769     Tt_status status = DtTtSetLabel( instance->messageFooterLabel,
1770                                      "tt_message_pattern()", pat );
1771     if (tt_is_err( status ) || (pat == 0)) {
1772             return;
1773     }
1774     Widget newWidget = DtTtPatternWidgetCreate(
1775                         dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
1776                         pat, 0 );
1777     status = tt_ptr_error( newWidget );
1778     if (tt_is_err( status )) {
1779             return;
1780     }
1781     XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
1782     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1783 }
1784
1785
1786 void 
1787 msgPrint(
1788     Widget widget,
1789     XtPointer clientData,
1790     XtPointer callData
1791 )
1792 {
1793     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1794     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1795     
1796     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1797     DtbMessagePropsMessagePropsInfo instance =
1798             (DtbMessagePropsMessagePropsInfo)clientData;
1799     Tt_message msg = messageProps2Msg( instance );
1800     if (msg == 0) {
1801             return;
1802     }
1803     _DtTtMessageWidgetUpdate( instance, msg, _DtTtMessageRePrint );
1804     DtTtSetLabel( instance->messageFooterLabel,
1805                   "tt_message_print()", TT_OK );
1806     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1807 }
1808
1809
1810 void 
1811 genPattern(
1812     Widget widget,
1813     XtPointer clientData,
1814     XtPointer callData
1815 )
1816 {
1817     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1818     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1819     
1820     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1821     DtbMessagePropsMessagePropsInfo instance =
1822             (DtbMessagePropsMessagePropsInfo)clientData;
1823     Tt_message msg = messageProps2Msg( instance );
1824     if (msg == 0) {
1825             return;
1826     }
1827     Tt_pattern pat = tt_pattern_create();
1828     tt_pattern_category_set( pat, TT_OBSERVE );
1829     tt_pattern_class_add( pat, tt_message_class( msg ));
1830     tt_pattern_scope_add( pat, tt_message_scope( msg ));
1831     tt_pattern_address_add( pat, tt_message_address( msg ));
1832     char *op = tt_message_op( msg );
1833     if ((! tt_is_err( tt_ptr_error( op ))) && (op != 0)) {
1834             tt_pattern_op_add( pat, op );
1835             tt_free( op );
1836     }
1837     // skip file, sender, sender_ptype, otype, object, opnum, contexts
1838     char *session = tt_message_session( msg );
1839     if ((! tt_is_err( tt_ptr_error( session ))) && (session != 0)) {
1840             tt_pattern_session_add( pat, session );
1841             tt_free( session );
1842     }
1843     int args = tt_message_args_count( msg );
1844     if (tt_int_error( args ) == TT_OK) {
1845             for (int arg = 0; arg < args; arg++) {
1846                     Tt_mode mode = tt_message_arg_mode( msg, arg );
1847                     char *vtype = tt_message_arg_type( msg, arg );
1848                     // skip arg value
1849                     tt_pattern_arg_add( pat, mode, vtype, 0 );
1850                     tt_free( vtype );
1851             }
1852     }
1853     DtTtCreated( DTTT_PATTERN, pat );
1854     Widget newWidget = DtTtPatternWidgetCreate(
1855                                 dtb_ttsnoop_ttsnoop_win.ttsnoopWin, pat, 0 );
1856     if (tt_is_err( tt_ptr_error( newWidget ))) {
1857             return;
1858     }
1859     XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
1860     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1861 }
1862
1863
1864 void 
1865 genObserver(
1866     Widget widget,
1867     XtPointer clientData,
1868     XtPointer callData
1869 )
1870 {
1871     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1872     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1873     
1874     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1875     std::ostringstream ptype;
1876     DtbMessagePropsMessagePropsInfo instance =
1877             (DtbMessagePropsMessagePropsInfo)clientData;
1878     Tt_message msg = messageProps2Msg( instance );
1879     if (msg == 0) {
1880             return;
1881     }
1882     ptype << "ptype Acme_Calc {\n\tstart \"acalc\";\n";
1883     ptype << "\t/*\n";
1884     ptype << "\thandle_push:\n";
1885     ptype << "\thandle_rotate:\n";
1886     switch (tt_message_class(msg)) {
1887         case TT_REQUEST:
1888             ptype << "\tobserve:\n";
1889             ptype << "\t*/\n";
1890             ptype << "\thandle:\n";
1891             break;
1892         case TT_OFFER:
1893         case TT_NOTICE:
1894         default:
1895             ptype << "\thandle:\n";
1896             ptype << "\t*/\n";
1897             ptype << "\tobserve:\n";
1898             break;
1899     }
1900     ptype << "\t\t";
1901     switch (tt_message_scope(msg)) {
1902         case TT_FILE:
1903             ptype << "file ";
1904             break;
1905         case TT_FILE_IN_SESSION:
1906         case TT_BOTH:
1907         case TT_SESSION:
1908         default:
1909             ptype << "session ";
1910             break;
1911     }
1912     char *op = tt_message_op( msg );
1913     ptype << op << "(\n";
1914     tt_free( op );
1915     int args = tt_message_args_count( msg );
1916     if (tt_is_err( tt_int_error( args ))) {
1917             args = 0;
1918     }
1919     for (int arg = 0; arg < args; arg++) {
1920             ptype << "\t\t\t\t";
1921             switch (tt_message_arg_mode( msg, arg )) {
1922                 case TT_IN:     ptype << "in   "; break;
1923                 case TT_OUT:    ptype << "out  "; break;
1924                 default:
1925                 case TT_INOUT:  ptype << "inout"; break;
1926             }
1927             char *vtype = tt_message_arg_type( msg, arg );
1928             ptype << " " << vtype << "\targ" << arg;
1929             if (arg < args - 1) {
1930                     ptype << ",";
1931             }
1932             ptype << "\n";
1933     }
1934     ptype << "\t\t\t) => start opnum=1;\n";
1935     ptype << "};\n";
1936     // XXX contexts
1937     // XtVaSetValues( instance->messageText, XmNvalue, ptype.str().c_str(), 0 );
1938     _DtOpen( instance->messageFooterLabel, (void *)ptype.str().c_str(),
1939              ptype.str().size(), "ptype" );
1940     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1941 }
1942
1943
1944 void 
1945 sessionSet(
1946     Widget widget,
1947     XtPointer clientData,
1948     XtPointer callData
1949 )
1950 {
1951     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1952     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1953     
1954     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1955     DtbMessagePropsMessagePropsInfo instance =
1956             (DtbMessagePropsMessagePropsInfo)clientData;
1957     Tt_message msg = messageProps2Msg( instance );
1958     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1959             return;
1960     }
1961     _DtSessionChooserSet( _DtSessionChooseMessage, msg );
1962     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1963 }
1964
1965
1966 void 
1967 msgFileSet(
1968     Widget widget,
1969     XtPointer clientData,
1970     XtPointer callData
1971 )
1972 {
1973     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1974     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1975     
1976     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1977     DtbMessagePropsMessagePropsInfo instance =
1978             (DtbMessagePropsMessagePropsInfo)clientData;
1979     Tt_message msg = messageProps2Msg( instance );
1980     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
1981             return;
1982     }
1983     _DtFileChooserSet( _DtFileChooseMessageSet, msg );
1984     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
1985 }
1986
1987
1988 void 
1989 msgArgAdd(
1990     Widget widget,
1991     XtPointer clientData,
1992     XtPointer callData
1993 )
1994 {
1995     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
1996     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
1997     
1998     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
1999     DtbMessagePropsMessagePropsInfo instance =
2000             (DtbMessagePropsMessagePropsInfo)clientData;
2001     Tt_message msg = messageProps2Msg( instance );
2002     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2003             return;
2004     }
2005     _DtArgChooserSet( _DtArgChooseMessageArgAdd, msg );
2006     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2007 }
2008
2009
2010 void 
2011 msgContextSet(
2012     Widget widget,
2013     XtPointer clientData,
2014     XtPointer callData
2015 )
2016 {
2017     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2018     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2019     
2020     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2021     DtbMessagePropsMessagePropsInfo instance =
2022             (DtbMessagePropsMessagePropsInfo)clientData;
2023     Tt_message msg = messageProps2Msg( instance );
2024     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2025             return;
2026     }
2027     _DtArgChooserSet( _DtArgChooseMessageContextSet, msg );
2028     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2029 }
2030
2031
2032 void 
2033 setArg(
2034     Widget widget,
2035     XtPointer clientData,
2036     XtPointer callData
2037 )
2038 {
2039     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2040     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2041     
2042     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2043     DtbMessagePropsMessagePropsInfo instance =
2044             (DtbMessagePropsMessagePropsInfo)clientData;
2045     Tt_message msg = messageProps2Msg( instance );
2046     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2047             return;
2048     }
2049     int arg;
2050     MessagePropsSetArgButtonMenuItems items =
2051             &instance->setArgButton_setArgButton_menu_items;
2052     if (widget == items->Arg_0_item) {
2053             arg = 0;
2054     } else if (widget == items->Arg_1_item) {
2055             arg = 1;
2056     } else if (widget == items->Arg_2_item) {
2057             arg = 2;
2058     } else if (widget == items->Arg_3_item) {
2059             arg = 3;
2060     } else if (widget == items->Arg_4_item) {
2061             arg = 4;
2062     } else if (widget == items->Arg_5_item) {
2063             arg = 5;
2064     } else if (widget == items->Arg_6_item) {
2065             arg = 6;
2066     } else if (widget == items->Arg_7_item) {
2067             arg = 7;
2068     } else if (widget == items->Arg_8_item) {
2069             arg = 8;
2070     } else if (widget == items->Arg_9_item) {
2071             arg = 9;
2072     } else if (widget == items->Arg_10_item) {
2073             arg = 10;
2074     } else if (widget == items->Arg_11_item) {
2075             arg = 11;
2076     } else if (widget == items->Arg_12_item) {
2077             arg = 12;
2078     } else if (widget == items->Arg_13_item) {
2079             arg = 13;
2080     } else if (widget == items->Arg_14_item) {
2081             arg = 14;
2082     } else if (widget == items->Arg_15_item) {
2083             arg = 15;
2084     } else if (widget == items->Arg_15_item2) {
2085             _DtStringChooserSet( _DtStringChooseMessageArgValSet, msg,
2086                                  "16" );
2087             return;
2088     } else {
2089             return;
2090     }
2091     Tt_mode mode = tt_message_arg_mode( msg, arg );
2092     char *vtype = tt_message_arg_type( msg, arg );
2093     if (tt_is_err( tt_ptr_error( vtype ))) {
2094             vtype = 0;
2095     }
2096     char *val = 0;
2097     int ival = 0;
2098     Boolean noValue = False;
2099     Tt_status status = tt_message_arg_ival( msg, arg, &ival );
2100     if (status == TT_ERR_NUM) {
2101             val = tt_message_arg_val( msg, arg );
2102             if (tt_is_err( tt_ptr_error( val ))) {
2103                     val = 0;
2104             }
2105             if (val == 0) {
2106                     noValue = True;
2107             }
2108     }
2109     _DtArgChooserSet( _DtArgChooseMessageArgSet, msg, arg, mode, noValue,
2110                       vtype, val, ival );
2111     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2112 }
2113
2114
2115 void 
2116 setDISCARD(
2117     Widget widget,
2118     XtPointer clientData,
2119     XtPointer callData
2120 )
2121 {
2122     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2123     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2124     
2125     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2126     DtbMessagePropsMessagePropsInfo instance =
2127             (DtbMessagePropsMessagePropsInfo)clientData;
2128     _DtTtMessageDispositionSet( instance, TT_DISCARD );
2129     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2130 }
2131
2132
2133 void 
2134 setQUEUE(
2135     Widget widget,
2136     XtPointer clientData,
2137     XtPointer callData
2138 )
2139 {
2140     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2141     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2142     
2143     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2144     DtbMessagePropsMessagePropsInfo instance =
2145             (DtbMessagePropsMessagePropsInfo)clientData;
2146     _DtTtMessageDispositionSet( instance, TT_QUEUE );
2147     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2148 }
2149
2150
2151 void 
2152 setSTART(
2153     Widget widget,
2154     XtPointer clientData,
2155     XtPointer callData
2156 )
2157 {
2158     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2159     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2160     
2161     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2162     DtbMessagePropsMessagePropsInfo instance =
2163             (DtbMessagePropsMessagePropsInfo)clientData;
2164     _DtTtMessageDispositionSet( instance, TT_START );
2165     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2166 }
2167
2168
2169 void 
2170 setQUEUESTART(
2171     Widget widget,
2172     XtPointer clientData,
2173     XtPointer callData
2174 )
2175 {
2176     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2177     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2178     
2179     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2180     DtbMessagePropsMessagePropsInfo instance =
2181             (DtbMessagePropsMessagePropsInfo)clientData;
2182     _DtTtMessageDispositionSet( instance, (Tt_disposition)(TT_QUEUE+TT_START));
2183     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2184 }
2185
2186
2187 void 
2188 msgSetObject(
2189     Widget widget,
2190     XtPointer clientData,
2191     XtPointer callData
2192 )
2193 {
2194     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2195     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2196     
2197     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2198     DtbMessagePropsMessagePropsInfo instance =
2199             (DtbMessagePropsMessagePropsInfo)clientData;
2200     Tt_message msg = messageProps2Msg( instance );
2201     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2202             return;
2203     }
2204     _DtStringChooserSet( _DtStringChooseMessageObject, msg,
2205                          tt_message_object( msg ));
2206     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2207 }
2208
2209
2210 void 
2211 msgSetOtype(
2212     Widget widget,
2213     XtPointer clientData,
2214     XtPointer callData
2215 )
2216 {
2217     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2218     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2219     
2220     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2221     DtbMessagePropsMessagePropsInfo instance =
2222             (DtbMessagePropsMessagePropsInfo)clientData;
2223     Tt_message msg = messageProps2Msg( instance );
2224     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2225             return;
2226     }
2227     _DtStringChooserSet( _DtStringChooseMessageOtype, msg,
2228                          tt_message_otype( msg ));
2229     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2230 }
2231
2232
2233 void 
2234 msgSetHandlerPtype(
2235     Widget widget,
2236     XtPointer clientData,
2237     XtPointer callData
2238 )
2239 {
2240     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2241     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2242     
2243     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2244     DtbMessagePropsMessagePropsInfo instance =
2245             (DtbMessagePropsMessagePropsInfo)clientData;
2246     Tt_message msg = messageProps2Msg( instance );
2247     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2248             return;
2249     }
2250     _DtStringChooserSet( _DtStringChooseMessageHandlerPtype, msg,
2251                          tt_message_handler_ptype( msg ));
2252     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2253 }
2254
2255
2256 void 
2257 msgSetSenderPtype(
2258     Widget widget,
2259     XtPointer clientData,
2260     XtPointer callData
2261 )
2262 {
2263     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2264     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2265     
2266     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2267     DtbMessagePropsMessagePropsInfo instance =
2268             (DtbMessagePropsMessagePropsInfo)clientData;
2269     Tt_message msg = messageProps2Msg( instance );
2270     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2271             return;
2272     }
2273     _DtStringChooserSet( _DtStringChooseMessageSenderPtype, msg,
2274                          tt_message_sender_ptype( msg ));
2275     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2276 }
2277
2278
2279 void 
2280 chooseOp(
2281     Widget widget,
2282     XtPointer clientData,
2283     XtPointer callData
2284 )
2285 {
2286     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2287     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2288     
2289     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2290     DtbMessagePropsMessagePropsInfo instance =
2291             (DtbMessagePropsMessagePropsInfo)clientData;
2292     Tt_message msg = messageProps2Msg( instance );
2293     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2294             return;
2295     }
2296     _DtTtChooserSet( _DtTtChooserMessageOpSet, msg );
2297     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2298 }
2299
2300
2301 void 
2302 addCallback(
2303     Widget widget,
2304     XtPointer clientData,
2305     XtPointer callData
2306 )
2307 {
2308     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2309     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2310     
2311     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2312     DtbMessagePropsMessagePropsInfo instance =
2313             (DtbMessagePropsMessagePropsInfo)clientData;
2314     Tt_message msg = messageProps2Msg( instance );
2315     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2316             return;
2317     }
2318     _DtTtMsgCbChooserSet( msg );
2319     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2320 }
2321
2322
2323 void 
2324 chooseHandler(
2325     Widget widget,
2326     XtPointer clientData,
2327     XtPointer callData
2328 )
2329 {
2330     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2331     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2332     
2333     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2334     DtbMessagePropsMessagePropsInfo instance =
2335             (DtbMessagePropsMessagePropsInfo)clientData;
2336     Tt_message msg = messageProps2Msg( instance );
2337     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2338             return;
2339     }
2340     _DtStringChooserSet( _DtStringChooseMessageStatusString, msg,
2341                          tt_message_status_string( msg ));
2342     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2343 }
2344
2345
2346 void 
2347 msgSetStatusString(
2348     Widget widget,
2349     XtPointer clientData,
2350     XtPointer callData
2351 )
2352 {
2353     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
2354     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
2355     
2356     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
2357     DtbMessagePropsMessagePropsInfo instance =
2358             (DtbMessagePropsMessagePropsInfo)clientData;
2359     Tt_message msg = messageProps2Msg( instance );
2360     if ((msg == 0) || _DtTtMessageUpdating( msg )) {
2361             return;
2362     }
2363     _DtStringChooserSet( _DtStringChooseMessageStatusString, msg,
2364                          tt_message_object( msg ));
2365     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
2366 }
2367
2368
2369
2370 /**************************************************************************
2371  *** DTB_USER_CODE_START
2372  ***
2373  *** All automatically-generated data and functions have been defined.
2374  ***
2375  *** Add new functions here, or at the top of the file.
2376  ***/
2377
2378 /*** DTB_USER_CODE_END
2379  ***
2380  *** End of user code section
2381  ***
2382  **************************************************************************/
2383
2384