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