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