argChooser_stubs.C.src 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  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: argChooser_stubs.C.src /main/3 1995/11/06 17:12:12 rswiston $
  7. /*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
  8. /*
  9. * File: argChooser_stubs.c
  10. * Contains: Module callbacks and connection functions
  11. *
  12. * This file was generated by dtcodegen, from module argChooser
  13. *
  14. * Any text may be added between the DTB_USER_CODE_START and
  15. * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
  16. * are provided only as an aid.
  17. *
  18. * ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
  19. * ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
  20. * ** DELETE THE GENERATED COMMENTS! **
  21. */
  22. #include <stdio.h>
  23. #include <Xm/Xm.h>
  24. #include "dtb_utils.h"
  25. #include "argChooser_ui.h"
  26. /*
  27. * Header files for cross-module connections
  28. */
  29. #include "ttsnoop_ui.h"
  30. /**************************************************************************
  31. *** DTB_USER_CODE_START
  32. ***
  33. *** All necessary header files have been included.
  34. ***
  35. *** Add include files, types, macros, externs, and user functions here.
  36. ***/
  37. #include <Xm/Text.h>
  38. #include <Xm/TextF.h>
  39. #include <Dt/SpinBox.h>
  40. #include "DtTt.h"
  41. void
  42. _DtArgChooserSet(
  43. _DtArgChooserAction choice,
  44. void * entity,
  45. int nth,
  46. Tt_mode mode,
  47. Boolean noValue,
  48. char * vtype,
  49. char * val,
  50. int ival
  51. )
  52. {
  53. DtbArgChooserArgChooserInfo instance =
  54. &dtb_arg_chooser_arg_chooser;
  55. if (! instance->initialized) {
  56. dtb_arg_chooser_arg_chooser_initialize(
  57. instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
  58. }
  59. Widget modeChoice;
  60. switch (mode) {
  61. default:
  62. case TT_IN:
  63. modeChoice = instance->modeChoice_items.IN_item;
  64. break;
  65. case TT_OUT:
  66. modeChoice = instance->modeChoice_items.OUT_item;
  67. break;
  68. case TT_INOUT:
  69. modeChoice = instance->modeChoice_items.INOUT_item;
  70. break;
  71. }
  72. XtVaSetValues( instance->modeChoice, XmNmenuHistory, modeChoice, NULL );
  73. Widget valType = instance->argValTypeChoice_items.None_item;
  74. if (! noValue) {
  75. if (val != 0) {
  76. valType = instance->
  77. argValTypeChoice_items.char_item;
  78. } else {
  79. valType = instance->
  80. argValTypeChoice_items.int_item;
  81. }
  82. }
  83. XtVaSetValues( instance->argValTypeChoice, XmNmenuHistory, valType, NULL);
  84. XmTextFieldSetString( instance->vtypeText, vtype );
  85. XtVaSetValues( instance->argIvalBox, DtNposition, ival, NULL );
  86. XtVaSetValues( instance->argValText, XmNvalue, val, NULL );
  87. _DtArgChooserSet( choice, entity, nth );
  88. }
  89. void
  90. _DtArgChooserSet(
  91. _DtArgChooserAction choice,
  92. void * entity,
  93. int nth
  94. )
  95. {
  96. Boolean vtypeActive = True;
  97. Boolean modeActive = True;
  98. char *vtypeLabel = "vtype:";
  99. char *okString;
  100. char *title;
  101. switch (choice) {
  102. case _DtArgChoosePatternArgAdd:
  103. case _DtArgChoosePatternIArgAdd:
  104. okString = "Add";
  105. title = "tt_pattern_arg_add";
  106. break;
  107. case _DtArgChoosePatternContextAdd:
  108. case _DtArgChoosePatternIContextAdd:
  109. okString = "Add";
  110. title = "tt_pattern_context_add";
  111. modeActive = False;
  112. vtypeLabel = "slot:";
  113. break;
  114. case _DtArgChooseMessageArgAdd:
  115. case _DtArgChooseMessageIArgAdd:
  116. okString = "Add";
  117. title = "tt_message_arg_add";
  118. break;
  119. case _DtArgChooseMessageArgSet:
  120. case _DtArgChooseMessageIArgSet:
  121. okString = "Set";
  122. title = "tt_message_arg_val_set";
  123. vtypeActive = False;
  124. modeActive = False;
  125. break;
  126. case _DtArgChooseMessageContextSet:
  127. case _DtArgChooseMessageIContextSet:
  128. okString = "Set";
  129. title = "tt_message_context_set";
  130. modeActive = False;
  131. vtypeLabel = "slot:";
  132. break;
  133. default:
  134. return;
  135. }
  136. DtbArgChooserArgChooserInfo instance =
  137. &dtb_arg_chooser_arg_chooser;
  138. if (! instance->initialized) {
  139. dtb_arg_chooser_arg_chooser_initialize(
  140. instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
  141. }
  142. DtTtSetLabel( instance->argChooserOkButton, okString );
  143. XtVaSetValues( instance->argChooser, XmNtitle, title, NULL );
  144. DtTtSetLabel( instance->vtypeText_label, vtypeLabel );
  145. XtSetSensitive( instance->vtypeText, vtypeActive );
  146. XtSetSensitive( instance->modeChoice, modeActive );
  147. // Remember dialog mode, entity, nth
  148. XtVaSetValues( instance->argChooserOkButton, XmNuserData, choice, NULL );
  149. XtVaSetValues( instance->argChooserCancelButton,
  150. XmNuserData, entity, NULL );
  151. XtVaSetValues( instance->argChooserHelpButton, XmNuserData, nth, NULL );
  152. if (vtypeActive) {
  153. // Pre-select vtype text
  154. XmTextPosition last =
  155. XmTextFieldGetLastPosition( instance->vtypeText );
  156. Time when = XtLastTimestampProcessed(
  157. XtDisplay( instance->vtypeText ));
  158. XmTextFieldSetSelection( instance->vtypeText, 0, last, when );
  159. }
  160. XtManageChild( instance->argChooser_shellform );
  161. }
  162. /*** DTB_USER_CODE_END
  163. ***
  164. *** End of user code section
  165. ***
  166. **************************************************************************/
  167. void
  168. argChooser_argValTypeChoice_None_item_CB1(
  169. Widget widget,
  170. XtPointer clientData,
  171. XtPointer callData
  172. )
  173. {
  174. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  175. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  176. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  177. if (!(instance->initialized))
  178. {
  179. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  180. }
  181. XtSetSensitive(instance->argIvalBox, False);
  182. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  183. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  184. }
  185. void
  186. argChooser_argValTypeChoice_char_item_CB1(
  187. Widget widget,
  188. XtPointer clientData,
  189. XtPointer callData
  190. )
  191. {
  192. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  193. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  194. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  195. if (!(instance->initialized))
  196. {
  197. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  198. }
  199. XtSetSensitive(instance->argIvalBox, False);
  200. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  201. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  202. }
  203. void
  204. argChooser_argValTypeChoice_int_item_CB1(
  205. Widget widget,
  206. XtPointer clientData,
  207. XtPointer callData
  208. )
  209. {
  210. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  211. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  212. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  213. if (!(instance->initialized))
  214. {
  215. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  216. }
  217. XtSetSensitive(instance->argIvalBox, True);
  218. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  219. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  220. }
  221. void
  222. argChooser_argChooserOkButton_CB1(
  223. Widget widget,
  224. XtPointer clientData,
  225. XtPointer callData
  226. )
  227. {
  228. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  229. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  230. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  231. if (!(instance->initialized))
  232. {
  233. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  234. }
  235. XtUnmanageChild(instance->argChooser_shellform);
  236. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  237. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  238. }
  239. void
  240. argChooser_argChooserCancelButton_CB1(
  241. Widget widget,
  242. XtPointer clientData,
  243. XtPointer callData
  244. )
  245. {
  246. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  247. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  248. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  249. if (!(instance->initialized))
  250. {
  251. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  252. }
  253. XtUnmanageChild(instance->argChooser_shellform);
  254. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  255. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  256. }
  257. void
  258. argChooser_argValTypeChoice_None_item_CB2(
  259. Widget widget,
  260. XtPointer clientData,
  261. XtPointer callData
  262. )
  263. {
  264. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  265. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  266. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  267. if (!(instance->initialized))
  268. {
  269. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  270. }
  271. XtSetSensitive(instance->argValText, False);
  272. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  273. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  274. }
  275. void
  276. argChooser_argValTypeChoice_int_item_CB2(
  277. Widget widget,
  278. XtPointer clientData,
  279. XtPointer callData
  280. )
  281. {
  282. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  283. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  284. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  285. if (!(instance->initialized))
  286. {
  287. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  288. }
  289. XtSetSensitive(instance->argValText, False);
  290. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  291. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  292. }
  293. void
  294. argChooser_argValTypeChoice_char_item_CB2(
  295. Widget widget,
  296. XtPointer clientData,
  297. XtPointer callData
  298. )
  299. {
  300. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  301. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  302. DtbArgChooserArgChooserInfo instance = (DtbArgChooserArgChooserInfo)clientData;
  303. if (!(instance->initialized))
  304. {
  305. dtb_arg_chooser_arg_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  306. }
  307. XtSetSensitive(instance->argValText, True);
  308. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  309. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  310. }
  311. void
  312. argOkayed(
  313. Widget widget,
  314. XtPointer clientData,
  315. XtPointer callData
  316. )
  317. {
  318. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  319. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  320. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  321. DtbArgChooserArgChooserInfo instance =
  322. (DtbArgChooserArgChooserInfo)clientData;
  323. int nth = 0;
  324. Tt_message msg = 0;
  325. Tt_pattern pat = 0;
  326. _DtArgChooserAction choice = _DtArgChooseNone;
  327. XtPointer pval;
  328. XtVaGetValues( instance->argChooserOkButton, XmNuserData, &pval, NULL );
  329. choice = (_DtArgChooserAction) (long) pval;
  330. XtVaGetValues( instance->argChooserCancelButton, XmNuserData, &pval, NULL );
  331. msg = (Tt_message)pval;
  332. pat = (Tt_pattern)pval;
  333. XtVaGetValues( instance->argChooserHelpButton, XmNuserData, &pval, NULL );
  334. nth = (int) (long) pval;
  335. char *vtype = XmTextFieldGetString( instance->vtypeText );
  336. if ((vtype != 0) && (vtype[0] == '\0')) {
  337. XtFree( vtype );
  338. vtype = 0;
  339. }
  340. Widget modeWidget;
  341. XtVaGetValues( instance->modeChoice, XmNmenuHistory, &modeWidget, NULL );
  342. Tt_mode mode = TT_IN;
  343. if (modeWidget == instance->modeChoice_items.OUT_item) {
  344. mode = TT_OUT;
  345. } else if (modeWidget == instance->modeChoice_items.INOUT_item) {
  346. mode = TT_INOUT;
  347. }
  348. char *val = 0;
  349. int ival = 0;
  350. Widget valTypeWidget;
  351. XtVaGetValues( instance->argValTypeChoice,
  352. XmNmenuHistory, &valTypeWidget, NULL );
  353. if (valTypeWidget == instance->argValTypeChoice_items.char_item) {
  354. val = XmTextGetString( instance->argValText );
  355. } else if (valTypeWidget == instance->argValTypeChoice_items.int_item) {
  356. // see _DtArgChooserAction invariant in DtTt.h
  357. choice = (_DtArgChooserAction)(choice + 1);
  358. XtVaGetValues( instance->argIvalBox, DtNposition, &ival, NULL );
  359. }
  360. switch (choice) {
  361. Tt_status status;
  362. case _DtArgChooseMessageArgAdd:
  363. case _DtArgChooseMessageIArgAdd:
  364. case _DtArgChooseMessageArgSet:
  365. case _DtArgChooseMessageIArgSet:
  366. case _DtArgChooseMessageContextSet:
  367. case _DtArgChooseMessageIContextSet:
  368. _DtTtMessageUpdate( msg, choice, nth, mode, vtype, val, ival );
  369. case _DtArgChoosePatternArgAdd:
  370. case _DtArgChoosePatternIArgAdd:
  371. case _DtArgChoosePatternContextAdd:
  372. case _DtArgChoosePatternIContextAdd:
  373. _DtTtPatternUpdate( pat, choice, mode, vtype, val, ival );
  374. break;
  375. default:
  376. break;
  377. }
  378. if (vtype != 0) XtFree( vtype );
  379. if (val != 0) XtFree( val );
  380. XtUnmanageChild(instance->argChooser_shellform);
  381. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  382. }
  383. void
  384. argHelp(
  385. Widget widget,
  386. XtPointer clientData,
  387. XtPointer callData
  388. )
  389. {
  390. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  391. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  392. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  393. DtbArgChooserArgChooserInfo instance =
  394. (DtbArgChooserArgChooserInfo)clientData;
  395. XtPointer val;
  396. XtVaGetValues( instance->argChooserOkButton, XmNuserData, &val, NULL );
  397. _DtArgChooserAction choice = (_DtArgChooserAction) (long) val;
  398. Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
  399. switch (choice) {
  400. case _DtArgChoosePatternArgAdd:
  401. case _DtArgChoosePatternIArgAdd:
  402. _DtMan( label, "tt_pattern_arg_add" );
  403. break;
  404. case _DtArgChoosePatternContextAdd:
  405. case _DtArgChoosePatternIContextAdd:
  406. _DtMan( label, "tt_pattern_context_add" );
  407. break;
  408. case _DtArgChooseMessageArgAdd:
  409. case _DtArgChooseMessageIArgAdd:
  410. _DtMan( label, "tt_message_arg_add" );
  411. break;
  412. case _DtArgChooseMessageArgSet:
  413. case _DtArgChooseMessageIArgSet:
  414. _DtMan( label, "tt_message_arg_val_set" );
  415. break;
  416. case _DtArgChooseMessageContextSet:
  417. case _DtArgChooseMessageIContextSet:
  418. _DtMan( label, "tt_message_context_set" );
  419. break;
  420. default:
  421. break;
  422. }
  423. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  424. }
  425. /**************************************************************************
  426. *** DTB_USER_CODE_START
  427. ***
  428. *** All automatically-generated data and functions have been defined.
  429. ***
  430. *** Add new functions here, or at the top of the file.
  431. ***/
  432. /*** DTB_USER_CODE_END
  433. ***
  434. *** End of user code section
  435. ***
  436. **************************************************************************/