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