home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / pexdraw / part11 < prev    next >
Encoding:
Text File  |  1993-06-07  |  60.2 KB  |  1,954 lines

  1. Newsgroups: comp.sources.x
  2. From: jch@okimicro.oki.com (Jan Hardenbergh)
  3. Subject: v20i021:  pexdraw - A PEX drawing program, Part11/14
  4. Message-ID: <1993Jun8.150229.19322@sparky.imd.sterling.com>
  5. X-Md4-Signature: 17d0d25a089e4d41ec4db8bffdc2b7b0
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 8 Jun 1993 15:02:29 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: jch@okimicro.oki.com (Jan Hardenbergh)
  12. Posting-number: Volume 20, Issue 21
  13. Archive-name: pexdraw/part11
  14. Environment: X11R5, PEX
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  pexdrawu.2 rdr.c util/pexutext.h
  21. # Wrapped by chris@sparky on Tue Jun  8 09:46:34 1993
  22. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  23. echo If this archive is complete, you will see the following message:
  24. echo '          "shar: End of archive 11 (of 14)."'
  25. if test -f 'pexdrawu.2' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'pexdrawu.2'\"
  27. else
  28.   echo shar: Extracting \"'pexdrawu.2'\" \(28751 characters\)
  29.   sed "s/^X//" >'pexdrawu.2' <<'END_OF_FILE'
  30. X            XmNlabelString = "View Reference Point";
  31. X            };
  32. X        };
  33. X
  34. Xobject
  35. X    view_ref_pt_x : XmTextField {
  36. X        arguments {
  37. X        XmNtopAttachment = XmATTACH_FORM;
  38. X        XmNleftAttachment = XmATTACH_WIDGET;
  39. X        XmNleftWidget = XmLabel view_ref_pt_label;
  40. X            XmNwidth = 30;
  41. X            XmNmaxLength = 3;
  42. X            XmNvalue = "0";
  43. X            };
  44. X        callbacks {
  45. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_ref_pt_x);
  46. X            };
  47. X        };
  48. X
  49. Xobject
  50. X    view_ref_pt_y : XmTextField {
  51. X        arguments {
  52. X        XmNtopAttachment = XmATTACH_FORM;
  53. X        XmNleftAttachment = XmATTACH_WIDGET;
  54. X        XmNleftWidget = XmTextField view_ref_pt_x;
  55. X            XmNwidth = 30;
  56. X            XmNmaxLength = 3;
  57. X            XmNvalue = "0";
  58. X            };
  59. X        callbacks {
  60. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_ref_pt_y);
  61. X            };
  62. X        };
  63. X
  64. Xobject
  65. X    view_ref_pt_z : XmTextField {
  66. X        arguments {
  67. X        XmNtopAttachment = XmATTACH_FORM;
  68. X        XmNleftAttachment = XmATTACH_WIDGET;
  69. X        XmNleftWidget = XmTextField view_ref_pt_y;
  70. X            XmNwidth = 30;
  71. X            XmNmaxLength = 3;
  72. X            XmNvalue = "0";
  73. X            };
  74. X        callbacks {
  75. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_ref_pt_z);
  76. X            };
  77. X        };
  78. X
  79. X!****************************** View Plane Normal  ********************
  80. X
  81. Xobject
  82. X    view_pl_norm_sep : XmSeparator {
  83. X    arguments {
  84. X        XmNleftAttachment =  XmATTACH_FORM;
  85. X        XmNrightAttachment =  XmATTACH_FORM;
  86. X        XmNtopAttachment = XmATTACH_WIDGET;
  87. X        XmNtopWidget = XmTextField view_ref_pt_y;
  88. X    };
  89. X    };
  90. X
  91. X
  92. Xobject
  93. X    view_pl_norm_label : XmLabel {
  94. X        arguments {
  95. X        XmNtopAttachment = XmATTACH_WIDGET ;
  96. X        XmNtopWidget = XmSeparator view_pl_norm_sep;
  97. X        XmNleftAttachment = XmATTACH_FORM ;
  98. X            XmNlabelString = "View Plane Normal";
  99. X            };
  100. X        };
  101. X
  102. Xobject
  103. X    view_pl_norm_x : XmTextField {
  104. X        arguments {
  105. X        XmNtopAttachment = XmATTACH_WIDGET ;
  106. X        XmNtopWidget = XmSeparator view_pl_norm_sep;
  107. X        XmNleftAttachment = XmATTACH_WIDGET;
  108. X        XmNleftWidget = XmLabel view_pl_norm_label;
  109. X            XmNwidth = 80;
  110. X            XmNmaxLength = 8;
  111. X            XmNvalue = "0";
  112. X            };
  113. X        callbacks {
  114. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_pl_norm_x);
  115. X            };
  116. X        };
  117. X
  118. Xobject
  119. X    view_pl_norm_y : XmTextField {
  120. X        arguments {
  121. X        XmNtopAttachment = XmATTACH_WIDGET ;
  122. X        XmNtopWidget = XmSeparator view_pl_norm_sep;
  123. X        XmNleftAttachment = XmATTACH_WIDGET;
  124. X        XmNleftWidget = XmTextField view_pl_norm_x;
  125. X            XmNwidth = 80;
  126. X            XmNmaxLength = 8;
  127. X            XmNvalue = "0";
  128. X            };
  129. X        callbacks {
  130. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_pl_norm_y);
  131. X            };
  132. X        };
  133. X
  134. Xobject
  135. X    view_pl_norm_z : XmTextField {
  136. X        arguments {
  137. X        XmNtopAttachment = XmATTACH_WIDGET ;
  138. X        XmNtopWidget = XmSeparator view_pl_norm_sep;
  139. X        XmNleftAttachment = XmATTACH_WIDGET;
  140. X        XmNleftWidget = XmTextField view_pl_norm_y;
  141. X            XmNwidth = 80;
  142. X            XmNmaxLength = 8;
  143. X            XmNvalue = "1";
  144. X            };
  145. X        callbacks {
  146. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_pl_norm_z);
  147. X            };
  148. X        };
  149. X
  150. X!****************************** View Up Vector  ********************
  151. X
  152. Xobject
  153. X    view_up_vect_sep : XmSeparator {
  154. X    arguments {
  155. X        XmNleftAttachment =  XmATTACH_FORM;
  156. X        XmNrightAttachment =  XmATTACH_FORM;
  157. X        XmNtopAttachment = XmATTACH_WIDGET;
  158. X        XmNtopWidget = XmTextField view_pl_norm_y;
  159. X    };
  160. X    };
  161. X
  162. X
  163. Xobject
  164. X    view_up_vect_label : XmLabel {
  165. X        arguments {
  166. X        XmNtopAttachment = XmATTACH_WIDGET ;
  167. X        XmNtopWidget = XmSeparator view_up_vect_sep;
  168. X        XmNleftAttachment = XmATTACH_FORM ;
  169. X            XmNlabelString = "View Up Vector";
  170. X            };
  171. X        };
  172. X
  173. Xobject
  174. X    view_up_vect_x : XmTextField {
  175. X        arguments {
  176. X        XmNtopAttachment = XmATTACH_WIDGET ;
  177. X        XmNtopWidget = XmSeparator view_up_vect_sep;
  178. X        XmNleftAttachment = XmATTACH_WIDGET;
  179. X        XmNleftWidget = XmLabel view_up_vect_label;
  180. X            XmNwidth = 80;
  181. X            XmNmaxLength = 8;
  182. X            XmNvalue = "0";
  183. X            };
  184. X        callbacks {
  185. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_up_vect_x);
  186. X            };
  187. X        };
  188. X
  189. Xobject
  190. X    view_up_vect_y : XmTextField {
  191. X        arguments {
  192. X        XmNtopAttachment = XmATTACH_WIDGET ;
  193. X        XmNtopWidget = XmSeparator view_up_vect_sep;
  194. X        XmNleftAttachment = XmATTACH_WIDGET;
  195. X        XmNleftWidget = XmTextField view_up_vect_x;
  196. X            XmNwidth = 80;
  197. X            XmNmaxLength = 8;
  198. X            XmNvalue = "1";
  199. X            };
  200. X        callbacks {
  201. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_up_vect_y);
  202. X            };
  203. X        };
  204. X
  205. Xobject
  206. X    view_up_vect_z : XmTextField {
  207. X        arguments {
  208. X        XmNtopAttachment = XmATTACH_WIDGET ;
  209. X        XmNtopWidget = XmSeparator view_up_vect_sep;
  210. X        XmNleftAttachment = XmATTACH_WIDGET;
  211. X        XmNleftWidget = XmTextField view_up_vect_y;
  212. X            XmNwidth = 80;
  213. X            XmNmaxLength = 8;
  214. X            XmNvalue = "0";
  215. X            };
  216. X        callbacks {
  217. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_up_vect_z);
  218. X            };
  219. X        };
  220. X
  221. X!****************************** Projection Reference Point *******************
  222. X
  223. Xobject
  224. X    proj_ref_pt_sep : XmSeparator {
  225. X    arguments {
  226. X        XmNleftAttachment =  XmATTACH_FORM;
  227. X        XmNrightAttachment =  XmATTACH_FORM;
  228. X        XmNtopAttachment = XmATTACH_WIDGET;
  229. X        XmNtopWidget = XmTextField view_up_vect_y;
  230. X    };
  231. X    };
  232. X
  233. X
  234. Xobject
  235. X    proj_ref_pt_label : XmLabel {
  236. X        arguments {
  237. X        XmNtopAttachment = XmATTACH_WIDGET ;
  238. X        XmNtopWidget = XmSeparator proj_ref_pt_sep;
  239. X        XmNleftAttachment = XmATTACH_FORM ;
  240. X            XmNlabelString = "Projection Reference Point";
  241. X            };
  242. X        };
  243. X
  244. Xobject
  245. X    proj_ref_pt_x : XmTextField {
  246. X        arguments {
  247. X        XmNtopAttachment = XmATTACH_WIDGET ;
  248. X        XmNtopWidget = XmSeparator proj_ref_pt_sep;
  249. X        XmNleftAttachment = XmATTACH_WIDGET;
  250. X        XmNleftWidget = XmLabel proj_ref_pt_label;
  251. X            XmNwidth = 30;
  252. X            XmNmaxLength = 3;
  253. X            XmNvalue = "0";
  254. X            };
  255. X        callbacks {
  256. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_ref_pt_x);
  257. X            };
  258. X        };
  259. X
  260. Xobject
  261. X    proj_ref_pt_y : XmTextField {
  262. X        arguments {
  263. X        XmNtopAttachment = XmATTACH_WIDGET ;
  264. X        XmNtopWidget = XmSeparator proj_ref_pt_sep;
  265. X        XmNleftAttachment = XmATTACH_WIDGET;
  266. X        XmNleftWidget = XmTextField proj_ref_pt_x;
  267. X            XmNwidth = 30;
  268. X            XmNmaxLength = 3;
  269. X            XmNvalue = "0";
  270. X            };
  271. X        callbacks {
  272. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_ref_pt_y);
  273. X            };
  274. X        };
  275. X
  276. Xobject
  277. X    proj_ref_pt_z : XmTextField {
  278. X        arguments {
  279. X        XmNtopAttachment = XmATTACH_WIDGET ;
  280. X        XmNtopWidget = XmSeparator proj_ref_pt_sep;
  281. X        XmNleftAttachment = XmATTACH_WIDGET;
  282. X        XmNleftWidget = XmTextField proj_ref_pt_y;
  283. X            XmNwidth = 30;
  284. X            XmNmaxLength = 3;
  285. X            XmNvalue = "10";
  286. X            };
  287. X        callbacks {
  288. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_ref_pt_z);
  289. X            };
  290. X        };
  291. X
  292. X!****************************** View Window *******************
  293. X
  294. Xobject
  295. X    view_window_sep : XmSeparator {
  296. X    arguments {
  297. X        XmNleftAttachment =  XmATTACH_FORM;
  298. X        XmNrightAttachment =  XmATTACH_FORM;
  299. X        XmNtopAttachment = XmATTACH_WIDGET;
  300. X        XmNtopWidget = XmTextField proj_ref_pt_y;
  301. X    };
  302. X    };
  303. X
  304. X
  305. Xobject
  306. X    view_window_label : XmLabel {
  307. X        arguments {
  308. X        XmNtopAttachment = XmATTACH_WIDGET ;
  309. X        XmNtopWidget = XmSeparator view_window_sep;
  310. X        XmNleftAttachment = XmATTACH_FORM ;
  311. X            XmNlabelString = "View Window - minx, maxx, miny, maxy";
  312. X            };
  313. X        };
  314. X
  315. Xobject
  316. X    view_window_minx : XmTextField {
  317. X        arguments {
  318. X        XmNtopAttachment = XmATTACH_WIDGET ;
  319. X        XmNtopWidget = XmSeparator view_window_sep;
  320. X        XmNleftAttachment = XmATTACH_WIDGET;
  321. X        XmNleftWidget = XmLabel view_window_label;
  322. X            XmNwidth = 30;
  323. X            XmNmaxLength = 3;
  324. X            XmNvalue = "-3";
  325. X            };
  326. X        callbacks {
  327. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_window_minx);
  328. X            };
  329. X        };
  330. X
  331. Xobject
  332. X    view_window_maxx : XmTextField {
  333. X        arguments {
  334. X        XmNtopAttachment = XmATTACH_WIDGET ;
  335. X        XmNtopWidget = XmSeparator view_window_sep;
  336. X        XmNleftAttachment = XmATTACH_WIDGET;
  337. X        XmNleftWidget = XmTextField view_window_minx;
  338. X            XmNwidth = 30;
  339. X            XmNmaxLength = 3;
  340. X            XmNvalue = "3";
  341. X            };
  342. X        callbacks {
  343. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_window_maxx);
  344. X            };
  345. X        };
  346. X
  347. Xobject
  348. X    view_window_miny : XmTextField {
  349. X        arguments {
  350. X        XmNtopAttachment = XmATTACH_WIDGET ;
  351. X        XmNtopWidget = XmSeparator view_window_sep;
  352. X        XmNleftAttachment = XmATTACH_WIDGET;
  353. X        XmNleftWidget = XmTextField view_window_maxx;
  354. X            XmNwidth = 30;
  355. X            XmNmaxLength = 3;
  356. X            XmNvalue = "-3";
  357. X            };
  358. X        callbacks {
  359. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_window_miny);
  360. X            };
  361. X        };
  362. X
  363. Xobject
  364. X    view_window_maxy : XmTextField {
  365. X        arguments {
  366. X        XmNtopAttachment = XmATTACH_WIDGET ;
  367. X        XmNtopWidget = XmSeparator view_window_sep;
  368. X        XmNleftAttachment = XmATTACH_WIDGET;
  369. X        XmNleftWidget = XmTextField view_window_miny;
  370. X            XmNwidth = 30;
  371. X            XmNmaxLength = 3;
  372. X            XmNvalue = "3";
  373. X            };
  374. X        callbacks {
  375. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_window_maxy);
  376. X            };
  377. X        };
  378. X
  379. X!****************************** View Plane Distance, Back & Front *************
  380. X
  381. Xobject
  382. X    view_plane_sep : XmSeparator {
  383. X    arguments {
  384. X        XmNleftAttachment =  XmATTACH_FORM;
  385. X        XmNrightAttachment =  XmATTACH_FORM;
  386. X        XmNtopAttachment = XmATTACH_WIDGET;
  387. X        XmNtopWidget = XmTextField view_window_maxy;
  388. X    };
  389. X    };
  390. X
  391. X
  392. Xobject
  393. X    view_plane_label : XmLabel {
  394. X        arguments {
  395. X        XmNtopAttachment = XmATTACH_WIDGET ;
  396. X        XmNtopWidget = XmSeparator view_plane_sep;
  397. X        XmNleftAttachment = XmATTACH_FORM ;
  398. X            XmNlabelString = "View Plane, Back & Front";
  399. X            };
  400. X        };
  401. X
  402. Xobject
  403. X    view_plane_dist : XmTextField {
  404. X        arguments {
  405. X        XmNtopAttachment = XmATTACH_WIDGET ;
  406. X        XmNtopWidget = XmSeparator view_plane_sep;
  407. X        XmNleftAttachment = XmATTACH_WIDGET;
  408. X        XmNleftWidget = XmLabel view_plane_label;
  409. X            XmNwidth = 30;
  410. X            XmNmaxLength = 3;
  411. X            XmNvalue = "0";
  412. X            };
  413. X        callbacks {
  414. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_plane_dist);
  415. X            };
  416. X        };
  417. X
  418. Xobject
  419. X    view_plane_back : XmTextField {
  420. X        arguments {
  421. X        XmNtopAttachment = XmATTACH_WIDGET ;
  422. X        XmNtopWidget = XmSeparator view_plane_sep;
  423. X        XmNleftAttachment = XmATTACH_WIDGET;
  424. X        XmNleftWidget = XmTextField view_plane_dist;
  425. X            XmNwidth = 30;
  426. X            XmNmaxLength = 3;
  427. X            XmNvalue = "-5";
  428. X            };
  429. X        callbacks {
  430. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_plane_back);
  431. X            };
  432. X        };
  433. X
  434. Xobject
  435. X    view_plane_front : XmTextField {
  436. X        arguments {
  437. X        XmNtopAttachment = XmATTACH_WIDGET ;
  438. X        XmNtopWidget = XmSeparator view_plane_sep;
  439. X        XmNleftAttachment = XmATTACH_WIDGET;
  440. X        XmNleftWidget = XmTextField view_plane_back;
  441. X            XmNwidth = 30;
  442. X            XmNmaxLength = 3;
  443. X            XmNvalue = "5";
  444. X            };
  445. X        callbacks {
  446. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_view_plane_front);
  447. X            };
  448. X        };
  449. X
  450. X!****************************** Projection Viewport  *******************
  451. X
  452. Xobject
  453. X    proj_vp_sep : XmSeparator {
  454. X    arguments {
  455. X        XmNleftAttachment =  XmATTACH_FORM;
  456. X        XmNrightAttachment =  XmATTACH_FORM;
  457. X        XmNtopAttachment = XmATTACH_WIDGET;
  458. X        XmNtopWidget = XmTextField view_plane_front;
  459. X    };
  460. X    };
  461. X
  462. X
  463. Xobject
  464. X    proj_vp_label : XmLabel {
  465. X        arguments {
  466. X        XmNtopAttachment = XmATTACH_WIDGET ;
  467. X        XmNtopWidget = XmSeparator proj_vp_sep;
  468. X        XmNleftAttachment = XmATTACH_FORM ;
  469. X            XmNlabelString = "Projection Viewport";
  470. X            };
  471. X        };
  472. X
  473. Xobject
  474. X    proj_vp_minx : XmTextField {
  475. X        arguments {
  476. X        XmNtopAttachment = XmATTACH_WIDGET ;
  477. X        XmNtopWidget = XmSeparator proj_vp_sep;
  478. X        XmNleftAttachment = XmATTACH_WIDGET;
  479. X        XmNleftWidget = XmLabel proj_vp_label;
  480. X            XmNwidth = 30;
  481. X            XmNmaxLength = 3;
  482. X            XmNvalue = "0";
  483. X            };
  484. X        callbacks {
  485. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_vp_minx);
  486. X            };
  487. X        };
  488. X
  489. Xobject
  490. X    proj_vp_maxx : XmTextField {
  491. X        arguments {
  492. X        XmNtopAttachment = XmATTACH_WIDGET ;
  493. X        XmNtopWidget = XmSeparator proj_vp_sep;
  494. X        XmNleftAttachment = XmATTACH_WIDGET;
  495. X        XmNleftWidget = XmTextField proj_vp_minx;
  496. X            XmNwidth = 30;
  497. X            XmNmaxLength = 3;
  498. X            XmNvalue = "1";
  499. X            };
  500. X        callbacks {
  501. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_vp_maxx);
  502. X            };
  503. X        };
  504. X
  505. Xobject
  506. X    proj_vp_miny : XmTextField {
  507. X        arguments {
  508. X        XmNtopAttachment = XmATTACH_WIDGET ;
  509. X        XmNtopWidget = XmSeparator proj_vp_sep;
  510. X        XmNleftAttachment = XmATTACH_WIDGET;
  511. X        XmNleftWidget = XmTextField proj_vp_maxx;
  512. X            XmNwidth = 30;
  513. X            XmNmaxLength = 3;
  514. X            XmNvalue = "0";
  515. X            };
  516. X        callbacks {
  517. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_vp_miny);
  518. X            };
  519. X        };
  520. X
  521. Xobject
  522. X    proj_vp_maxy : XmTextField {
  523. X        arguments {
  524. X        XmNtopAttachment = XmATTACH_WIDGET ;
  525. X        XmNtopWidget = XmSeparator proj_vp_sep;
  526. X        XmNleftAttachment = XmATTACH_WIDGET;
  527. X        XmNleftWidget = XmTextField proj_vp_miny;
  528. X            XmNwidth = 30;
  529. X            XmNmaxLength = 3;
  530. X            XmNvalue = "1";
  531. X            };
  532. X        callbacks {
  533. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_vp_maxy);
  534. X            };
  535. X        };
  536. X
  537. Xobject
  538. X    proj_vp_minz : XmTextField {
  539. X        arguments {
  540. X        XmNtopAttachment = XmATTACH_WIDGET ;
  541. X        XmNtopWidget = XmSeparator proj_vp_sep;
  542. X        XmNleftAttachment = XmATTACH_WIDGET;
  543. X        XmNleftWidget = XmTextField proj_vp_maxy;
  544. X            XmNwidth = 30;
  545. X            XmNmaxLength = 3;
  546. X            XmNvalue = "0";
  547. X            };
  548. X        callbacks {
  549. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_vp_minz);
  550. X            };
  551. X        };
  552. X
  553. Xobject
  554. X    proj_vp_maxz : XmTextField {
  555. X        arguments {
  556. X        XmNtopAttachment = XmATTACH_WIDGET ;
  557. X        XmNtopWidget = XmSeparator proj_vp_sep;
  558. X        XmNleftAttachment = XmATTACH_WIDGET;
  559. X        XmNleftWidget = XmTextField proj_vp_minz;
  560. X            XmNwidth = 30;
  561. X            XmNmaxLength = 3;
  562. X            XmNvalue = "1";
  563. X            };
  564. X        callbacks {
  565. X        MrmNcreateCallback = procedure proc_pexdraw_create(k_proj_vp_maxz);
  566. X            };
  567. X        };
  568. X
  569. X!********************************* Projection type
  570. X
  571. X
  572. Xobject
  573. X    proj_type_sep : XmSeparator {
  574. X    arguments {
  575. X        XmNleftAttachment =  XmATTACH_FORM;
  576. X        XmNrightAttachment =  XmATTACH_FORM;
  577. X        XmNtopAttachment = XmATTACH_WIDGET;
  578. X        XmNtopWidget = XmTextField proj_vp_maxz;
  579. X    };
  580. X    };
  581. X
  582. Xobject
  583. X    proj_type_label : XmLabel {
  584. X        arguments {
  585. X        XmNleftAttachment =  XmATTACH_FORM;
  586. X        XmNtopAttachment = XmATTACH_WIDGET;
  587. X        XmNtopWidget =  XmSeparator proj_type_sep;
  588. X            XmNlabelString = "Projection Type";
  589. X            };
  590. X    };
  591. X
  592. Xobject
  593. X    proj_type_box : XmRadioBox {
  594. X        arguments {
  595. X            XmNorientation = XmHORIZONTAL;
  596. X        XmNleftAttachment =  XmATTACH_WIDGET;
  597. X        XmNleftWidget = XmLabel proj_type_label;
  598. X        XmNtopAttachment = XmATTACH_WIDGET;
  599. X        XmNtopWidget =  XmSeparator proj_type_sep;
  600. X            XmNborderWidth = 0;
  601. X        XmNisHomogeneous = false;
  602. X            };
  603. X        controls {
  604. X            XmToggleButton   proj_type_para;
  605. X            XmToggleButton   proj_type_persp;
  606. X            };
  607. X        };
  608. X                                                                                                              
  609. Xobject
  610. X    proj_type_para : XmToggleButton {
  611. X        arguments {
  612. X            XmNlabelString = "Parallel";
  613. X            XmNset = on;   ! A radio box requires one toggle to be set.
  614. X            };                                                             
  615. X        callbacks {
  616. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_proj_type_para);
  617. X            };
  618. X        };
  619. X
  620. Xobject
  621. X    proj_type_persp : XmToggleButton {
  622. X        arguments {
  623. X            XmNlabelString = "Perspective";
  624. X            XmNindicatorOn = on;   ! A radio box requires one toggle to be set.
  625. X            };
  626. X        callbacks {
  627. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_proj_type_persp);
  628. X            };
  629. X        };
  630. X
  631. X!*****************************  Bottom Buttons ******************************
  632. X
  633. Xobject
  634. X    button_box : XmRowColumn {
  635. X        arguments {
  636. X            XmNorientation = XmHORIZONTAL;
  637. X        XmNleftAttachment =  XmATTACH_FORM;
  638. X        XmNrightAttachment =  XmATTACH_FORM;
  639. X        XmNbottomAttachment =  XmATTACH_FORM;
  640. X            XmNborderWidth = 2;
  641. X            XmNentryBorder = 3;
  642. X            };
  643. X        controls {                                                  
  644. X            XmPushButton     apply_button;
  645. X            XmPushButton     dismiss_button;
  646. X            XmPushButton     can_button;
  647. X            };
  648. X        };
  649. X
  650. Xobject
  651. X    apply_button : XmPushButton widget { ! The menu positions the buttons
  652. X        arguments {                     !  automatically.
  653. X            XmNlabelString = "apply";
  654. X            XmNforeground = yellow;
  655. X            XmNbackground = red;
  656. X            XmNhighlightColor = magenta;
  657. X            XmNborderColor = green;
  658. X        XmNaccelerator = "Ctrl <key>a";
  659. X        XmNacceleratorText = "^a";
  660. X            };
  661. X        callbacks {
  662. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_apply_vs);
  663. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_apply_vs);
  664. X        };
  665. X    };
  666. X
  667. Xobject
  668. X    can_button : XmPushButton widget {                       
  669. X        arguments {
  670. X            XmNlabelString = "reset";
  671. X            XmNforeground = yellow;
  672. X            XmNbackground = red;
  673. X            XmNhighlightColor = magenta;
  674. X            XmNborderColor = green;
  675. X            };
  676. X        callbacks {
  677. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_reset_vs);
  678. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_reset_vs);
  679. X        };
  680. X    };
  681. X
  682. Xobject
  683. X    dismiss_button : XmPushButton widget {
  684. X        arguments {
  685. X            XmNlabelString = "dismiss";
  686. X            XmNforeground = yellow;
  687. X            XmNbackground = red;
  688. X            XmNhighlightColor = magenta;
  689. X            XmNborderColor = green;
  690. X        };
  691. X        callbacks {
  692. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_dismiss_vs);
  693. X            XmNactivateCallback = procedure proc_pexdraw_activate (k_dismiss_vs);
  694. X        };
  695. X    };
  696. X
  697. X!************************************************************************
  698. X! end of Set View Form
  699. X!************************************************************************
  700. X
  701. X!************************************************************************
  702. X! The Light Form
  703. X!************************************************************************
  704. X
  705. Xobject
  706. X    light_dialog : XmFormDialog {
  707. X        arguments {
  708. X            XmNdialogTitle = "PEX Light Options";
  709. X            XmNdialogStyle = XmDIALOG_MODELESS;
  710. X        XmNheight = 400;
  711. X        XmNwidth = 360;
  712. X!        XmNmwmDecorations = 30;
  713. X            XmNbackground = lightblue;
  714. X        };
  715. X        controls {
  716. X            XmLabel     light_toggles_label;
  717. X            XmRowColumn light_toggles_box;
  718. X        XmSeparator    light_radio_sep;
  719. X            XmLabel     light_radio_label;
  720. X            XmRadioBox     light_radio_box;
  721. X        XmSeparator    light_type_sep;
  722. X        XmLabel    light_type_label;
  723. X        XmRadioBox    light_type_box;
  724. X        XmSeparator    light_pos_sep;
  725. X        XmLabel    light_pos_label;
  726. X        XmTextField    light_pos_x;
  727. X        XmTextField    light_pos_y;
  728. X        XmTextField    light_pos_z;
  729. X        XmSeparator    light_color_sep;
  730. X        XmLabel    light_color_label;
  731. X        XmTextField    light_color_red;
  732. X        XmTextField    light_color_green;
  733. X        XmTextField    light_color_blue;
  734. X        XmSeparator    light_direction_sep;
  735. X        XmLabel    light_direction_label;
  736. X        XmTextField    light_direction_x;
  737. X        XmTextField    light_direction_y;
  738. X        XmTextField    light_direction_z;
  739. X        XmSeparator    light_coeff_sep;
  740. X        XmLabel    light_coeff_label;
  741. X        XmTextField    light_coeff_const;
  742. X        XmTextField    light_coeff_dist;
  743. X        XmSeparator    light_conc_exp_sep;
  744. X        XmLabel    light_conc_exp_label;
  745. X        XmTextField    light_conc_exp;
  746. X        XmSeparator    light_spread_angle_sep;
  747. X        XmLabel    light_spread_angle_label;
  748. X        XmTextField    light_spread_angle;
  749. X            XmRowColumn light_button_box;
  750. X            };
  751. X
  752. X        callbacks {
  753. X            MrmNcreateCallback = procedure proc_pexdraw_create (k_light);
  754. X            };
  755. X    };
  756. X
  757. X!****************************** Light On/Off Toggles ********************
  758. X
  759. Xobject
  760. X    light_toggles_label : XmLabel {
  761. X        arguments {
  762. X        XmNtopAttachment = XmATTACH_FORM ;
  763. X        XmNleftAttachment = XmATTACH_FORM ;
  764. X            XmNlabelString = "THIS FORM DOES NOTHING ! ! !";
  765. X            };
  766. X        };
  767. X
  768. Xobject
  769. X    light_toggles_box : XmRowColumn {
  770. X        arguments {
  771. X        XmNleftAttachment = XmATTACH_FORM ;
  772. X        XmNrightAttachment = XmATTACH_FORM ;
  773. X        XmNtopAttachment = XmATTACH_WIDGET;
  774. X        XmNtopWidget = XmLabel light_toggles_label;
  775. X            XmNorientation = XmHORIZONTAL;
  776. X            XmNbackground = lightblue;
  777. X            XmNborderWidth = 0;
  778. X            };
  779. X        controls {
  780. X            XmToggleButton   light_on1;
  781. X            XmToggleButton   light_on2;
  782. X            XmToggleButton   light_on3;
  783. X            XmToggleButton   light_on4;
  784. X            XmToggleButton   light_on5;
  785. X            XmToggleButton   light_on6;
  786. X            XmToggleButton   light_on7;
  787. X            XmToggleButton   light_on8;
  788. X            };
  789. X        };
  790. X
  791. X
  792. Xobject
  793. X    light_on1 : XmToggleButton {
  794. X        arguments {
  795. X            XmNlabelString = "1";
  796. X            };
  797. X        callbacks {
  798. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on1);
  799. X            };
  800. X        };
  801. Xobject
  802. X    light_on2 : XmToggleButton {
  803. X        arguments {
  804. X            XmNlabelString = "2";
  805. X            };
  806. X        callbacks {
  807. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on2);
  808. X            };
  809. X        };
  810. Xobject
  811. X    light_on3 : XmToggleButton {
  812. X        arguments {
  813. X            XmNlabelString = "3";
  814. X            };
  815. X        callbacks {
  816. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on3);
  817. X            };
  818. X        };
  819. Xobject
  820. X    light_on4 : XmToggleButton {
  821. X        arguments {
  822. X            XmNlabelString = "4";
  823. X            };
  824. X        callbacks {
  825. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on4);
  826. X            };
  827. X        };
  828. Xobject
  829. X    light_on5 : XmToggleButton {
  830. X        arguments {
  831. X            XmNlabelString = "5";
  832. X            };
  833. X        callbacks {
  834. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on5);
  835. X            };
  836. X        };
  837. Xobject
  838. X    light_on6 : XmToggleButton {
  839. X        arguments {
  840. X            XmNlabelString = "6";
  841. X            };
  842. X        callbacks {
  843. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on6);
  844. X            };
  845. X        };
  846. Xobject
  847. X    light_on7 : XmToggleButton {
  848. X        arguments {
  849. X            XmNlabelString = "7";
  850. X            };
  851. X        callbacks {
  852. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on7);
  853. X            };
  854. X        };
  855. Xobject
  856. X    light_on8 : XmToggleButton {
  857. X        arguments {
  858. X            XmNlabelString = "8";
  859. X            };
  860. X        callbacks {
  861. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_on8);
  862. X            };
  863. X        };
  864. X
  865. X!****************************** Light Radio Toggles ********************
  866. Xobject
  867. X    light_radio_sep : XmSeparator {
  868. X    arguments {
  869. X        XmNleftAttachment =  XmATTACH_FORM;
  870. X        XmNrightAttachment =  XmATTACH_FORM;
  871. X        XmNtopAttachment = XmATTACH_WIDGET;
  872. X        XmNtopWidget = XmRowColumn light_toggles_box;
  873. X    };
  874. X    };
  875. X
  876. Xobject
  877. X    light_radio_label : XmLabel {
  878. X        arguments {
  879. X        XmNtopAttachment = XmATTACH_WIDGET ;
  880. X        XmNtopWidget = XmSeparator light_radio_sep;
  881. X        XmNleftAttachment = XmATTACH_FORM ;
  882. X        XmNrightAttachment = XmATTACH_FORM ;
  883. X            XmNlabelString = "Light Edit Selector";
  884. X            };
  885. X        };
  886. X
  887. Xobject
  888. X    light_radio_box : XmRadioBox {
  889. X        arguments {
  890. X        XmNtopAttachment = XmATTACH_WIDGET ;
  891. X        XmNtopWidget = XmLabel light_radio_label;
  892. X        XmNleftAttachment = XmATTACH_FORM ;
  893. X        XmNrightAttachment = XmATTACH_FORM ;
  894. X            XmNorientation = XmHORIZONTAL;
  895. X            XmNborderWidth = 1;
  896. X            };
  897. X        controls {
  898. X            XmToggleButton   light_edit1;
  899. X            XmToggleButton   light_edit2;
  900. X            XmToggleButton   light_edit3;
  901. X            XmToggleButton   light_edit4;
  902. X            XmToggleButton   light_edit5;
  903. X            XmToggleButton   light_edit6;
  904. X            XmToggleButton   light_edit7;
  905. X            XmToggleButton   light_edit8;
  906. X            };
  907. X        };
  908. X
  909. X
  910. Xobject
  911. X    light_edit1 : XmToggleButton {
  912. X        arguments {
  913. X            XmNlabelString = "1";
  914. X            };
  915. X        callbacks {
  916. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit1);
  917. X            };
  918. X        };
  919. Xobject
  920. X    light_edit2 : XmToggleButton {
  921. X        arguments {
  922. X            XmNlabelString = "2";
  923. X            };
  924. X        callbacks {
  925. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit2);
  926. X            };
  927. X        };
  928. Xobject
  929. X    light_edit3 : XmToggleButton {
  930. X        arguments {
  931. X            XmNlabelString = "3";
  932. X            };
  933. X        callbacks {
  934. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit3);
  935. X            };
  936. X        };
  937. Xobject
  938. X    light_edit4 : XmToggleButton {
  939. X        arguments {
  940. X            XmNlabelString = "4";
  941. X            };
  942. X        callbacks {
  943. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit4);
  944. X            };
  945. X        };
  946. Xobject
  947. X    light_edit5 : XmToggleButton {
  948. X        arguments {
  949. X            XmNlabelString = "5";
  950. X            };
  951. X        callbacks {
  952. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit5);
  953. X            };
  954. X        };
  955. Xobject
  956. X    light_edit6 : XmToggleButton {
  957. X        arguments {
  958. X            XmNlabelString = "6";
  959. X            };
  960. X        callbacks {
  961. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit6);
  962. X            };
  963. X        };
  964. Xobject
  965. X    light_edit7 : XmToggleButton {
  966. X        arguments {
  967. X            XmNlabelString = "7";
  968. X            };
  969. X        callbacks {
  970. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit7);
  971. X            };
  972. X        };
  973. Xobject
  974. X    light_edit8 : XmToggleButton {
  975. X        arguments {
  976. X            XmNlabelString = "8";
  977. X            };
  978. X        callbacks {
  979. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_edit8);
  980. X            };
  981. X        };
  982. X
  983. X!****************************** Light Type Radio ********************
  984. Xobject
  985. X    light_type_sep : XmSeparator {
  986. X    arguments {
  987. X        XmNleftAttachment =  XmATTACH_FORM;
  988. X        XmNrightAttachment =  XmATTACH_FORM;
  989. X        XmNtopAttachment = XmATTACH_WIDGET;
  990. X        XmNtopWidget = XmRadioBox light_radio_box;
  991. X    };
  992. X    };
  993. X
  994. Xobject
  995. X    light_type_label : XmLabel {
  996. X        arguments {
  997. X        XmNtopAttachment = XmATTACH_WIDGET ;
  998. X        XmNtopWidget = XmSeparator light_type_sep;
  999. X        XmNleftAttachment = XmATTACH_FORM ;
  1000. X        XmNrightAttachment = XmATTACH_FORM;
  1001. X            XmNlabelString = "Light Type";
  1002. X            };
  1003. X        };
  1004. X
  1005. Xobject
  1006. X    light_type_box : XmRadioBox {
  1007. X        arguments {
  1008. X        XmNtopAttachment = XmATTACH_WIDGET ;
  1009. X        XmNtopWidget = XmLabel light_type_label;
  1010. X        XmNleftAttachment = XmATTACH_FORM;
  1011. X        XmNrightAttachment = XmATTACH_FORM;
  1012. X            XmNorientation = XmHORIZONTAL;
  1013. X            XmNborderWidth = 1;
  1014. X            };
  1015. X        controls {
  1016. X            XmToggleButton   light_type_ambient;
  1017. X            XmToggleButton   light_type_directional;
  1018. X            XmToggleButton   light_type_positional;
  1019. X            XmToggleButton   light_type_spot;
  1020. X            };
  1021. X        };
  1022. X
  1023. Xobject
  1024. X    light_type_ambient : XmToggleButton {
  1025. X        arguments {
  1026. X            XmNlabelString = "Ambient";
  1027. X            };
  1028. X        callbacks {
  1029. X            XmNvalueChangedCallback = procedure proc_pexdraw_activate (k_light_type_ambient);
  1030. END_OF_FILE
  1031.   if test 28751 -ne `wc -c <'pexdrawu.2'`; then
  1032.     echo shar: \"'pexdrawu.2'\" unpacked with wrong size!
  1033.   fi
  1034.   # end of 'pexdrawu.2'
  1035. fi
  1036. if test -f 'rdr.c' -a "${1}" != "-c" ; then 
  1037.   echo shar: Will not clobber existing file \"'rdr.c'\"
  1038. else
  1039.   echo shar: Extracting \"'rdr.c'\" \(20761 characters\)
  1040.   sed "s/^X//" >'rdr.c' <<'END_OF_FILE'
  1041. X#ifdef SCCS
  1042. Xstatic char sccsid[]="@(#)rdr.c    1.15 Oki 93/05/24";
  1043. X#endif
  1044. X/*
  1045. X *            Copyright (c) 1992 by
  1046. X *            Oki Electric Industry Co., Ltd.
  1047. X *            All Rights Reserved
  1048. X *
  1049. X * Permission to use, copy, modify, and distribute this software and its
  1050. X * documentation for any purpose and without fee is hereby granted,
  1051. X * provided that the above copyright notice appear in all copies and that
  1052. X * both that copyright notice and this permission notice appear in
  1053. X * supporting documentation, and that the name of Oki Electric not be
  1054. X * used in advertising or publicity pertaining to distribution of the
  1055. X * software without specific, written prior permission. Oki Electric
  1056. X * makes no representations about the suitability of this software for any
  1057. X * purpose.  It is provided "as is" without express or implied warranty.
  1058. X *
  1059. X *************************************************************************
  1060. X * rdr.c - the methods for using a PHIGS Workstation resource as the
  1061. X * render object.
  1062. X *
  1063. X *  rdrInit
  1064. X *  rdrReDraw
  1065. X *  rdrMapXtoMC
  1066. X *  rdrMapMCtoX
  1067. X *  rdrSetView
  1068. X *  rdrSetNPCtoDC
  1069. X *  rdrPost
  1070. X *  rdrDeleteAll
  1071. X *  rdrPickOne
  1072. X */
  1073. X
  1074. X#include <stdio.h>
  1075. X
  1076. X#include <math.h>
  1077. X
  1078. X#include <X11/Xlib.h>
  1079. X#include <X11/Xutil.h>
  1080. X#include <X11/Xatom.h>
  1081. X
  1082. X#include <X11/PEX5/PEXlib.h>
  1083. X#include "pexdraw.h"
  1084. X#include "util/pexutdb.h"  /* this ain't Right, but life is too short */
  1085. X
  1086. X/*************************************************************************
  1087. X * State Variables
  1088. X */
  1089. Xstatic int myMCSeqNo = -1;
  1090. Xstatic int thePickInitFlag = 0;
  1091. X
  1092. Xstatic int theRdrViewLUT;
  1093. X
  1094. Xstatic int rPostCount = 0;
  1095. Xstatic long *rPostTable = (long *)0;
  1096. X
  1097. Xstatic Drawable the3DBuffer;
  1098. Xstatic int thePMWidth, thePMHeight;
  1099. Xstatic PEXPipelineContext thePC;
  1100. Xextern int theDBFlag;
  1101. X
  1102. XPEXNPCSubVolume theVolume;
  1103. XPEXViewport theViewport;
  1104. XPEXMatrix theXToMCMatrix;
  1105. Xint theMatrixValidFlag = 0;
  1106. X
  1107. Xextern int theHPFlag;
  1108. X/* L O C A L  P r o c s */
  1109. X
  1110. X/*************************************************************************
  1111. X *
  1112. X */
  1113. XXID  rdrInit( dpy,  w, colorLUT, lightLUT, textLUT, depthCueLUT,colorApproxLUT)
  1114. X     Display *dpy;
  1115. X     Window w;
  1116. X     PEXLookupTable colorLUT;
  1117. X     PEXLookupTable lightLUT;
  1118. X     PEXLookupTable textLUT;
  1119. X     PEXLookupTable depthCueLUT;
  1120. X     PEXLookupTable colorApproxLUT;
  1121. X{
  1122. X  XID                           renderObj;
  1123. X  PEXNameSet            incl, excl;
  1124. X  PEXName names[2];
  1125. X  PEXRendererAttributes        rAttrs;    /* renderer attributes */
  1126. X  long                          rMask;
  1127. X  XWindowAttributes             winAttrs;
  1128. X
  1129. X  PEXPCAttributes        pcAttrs;
  1130. X  unsigned long            pcMask[3];
  1131. X  
  1132. X  XColor                        background;
  1133. X  Drawable                      id;
  1134. X  int                           dbstat;
  1135. X/*************************************************************************/
  1136. X
  1137. X  theRdrViewLUT = PEXCreateLookupTable( theDisplay, theWindow, PEXLUTView);
  1138. X
  1139. X  incl = PEXCreateNameSet(theDisplay);
  1140. X  names[0] = 1; names[1] = 2; names[2] = 3; /* do an extra, for the heck */
  1141. X  PEXChangeNameSet(theDisplay, incl, PEXNSAdd, 3, names);
  1142. X  excl = PEXCreateNameSet(theDisplay);
  1143. X
  1144. X/*
  1145. X * init the NPC to DC transform so we have it when we need it.
  1146. X */
  1147. X  theVolume.min.x = theVolume.min.y = theVolume.min.z = 0.0;
  1148. X  theVolume.max.x = theVolume.max.y = theVolume.max.z = 1.0;
  1149. X
  1150. X  XGetWindowAttributes(theDisplay, theWindow, &winAttrs );
  1151. X
  1152. X  theViewport.min.x = theViewport.min.y = theViewport.min.z = 0.0;
  1153. X  theViewport.max.x = winAttrs.width;
  1154. X  theViewport.max.y = winAttrs.height;
  1155. X  theViewport.max.z = 1.0;
  1156. X  theViewport.use_drawable = 1;
  1157. X
  1158. X/*
  1159. X * Init the Pipeline Context for TextHeight and CurveApprox Criteria.
  1160. X */
  1161. X  pcAttrs.char_height = 0.08;
  1162. X  pcAttrs.curve_approx.method = PEXApproxConstantBetweenKnots;
  1163. X  pcAttrs.curve_approx.tolerance = 16.0;
  1164. X  pcAttrs.surface_approx.method = PEXApproxConstantBetweenKnots;
  1165. X  pcAttrs.surface_approx.u_tolerance = 4.0;
  1166. X  pcAttrs.surface_approx.v_tolerance = 4.0;
  1167. X
  1168. X  pcMask[0] = pcMask[1] = pcMask[2] = 0;
  1169. X  if (CheckEnumType(PEXETCurveApproxMethod, PEXApproxConstantBetweenKnots))
  1170. X    {PEXSetPCAttributeMask(pcMask, PEXPCCurveApprox);
  1171. X     PEXSetPCAttributeMask(pcMask, PEXPCSurfaceApprox);}
  1172. X  PEXSetPCAttributeMask(pcMask, PEXPCCharHeight );
  1173. X  if (theHPFlag == 0)
  1174. X  thePC = PEXCreatePipelineContext(theDisplay, pcMask, &pcAttrs);
  1175. X
  1176. X/*
  1177. X * now set all of the accumulated attributes into the struct and set the flags.
  1178. X */
  1179. X  rAttrs.pipeline_context = thePC;
  1180. X  rAttrs.npc_subvolume = theVolume;
  1181. X  rAttrs.viewport = theViewport;
  1182. X  rAttrs.view_table = theRdrViewLUT;
  1183. X  rAttrs.light_table = lightLUT;
  1184. X  rAttrs.hlhsr_mode = PEXHLHSRZBuffer;
  1185. X  rAttrs.depth_cue_table = depthCueLUT;
  1186. X  rAttrs.color_approx_table = colorApproxLUT;
  1187. X  rAttrs.color_table = colorLUT;
  1188. X  rAttrs.text_font_table = textLUT;
  1189. X  rAttrs.pick_incl = incl;
  1190. X  rAttrs.pick_excl = excl;
  1191. X  rAttrs.pick_excl = excl;
  1192. X  rAttrs.clear_image = True;
  1193. X  rAttrs.clear_z = True;
  1194. X
  1195. X  rMask = PEXRAPipelineContext|PEXRALightTable|PEXRAHLHSRMode|
  1196. X    PEXRAViewTable|PEXRADepthCueTable|PEXRAColorTable|
  1197. X      PEXRAColorApproxTable|PEXRAPickIncl|PEXRAPickExcl|
  1198. X    PEXRANPCSubVolume|PEXRAViewport|PEXRAClearImage|
  1199. X      PEXRAClearZ|PEXRATextFontTable;
  1200. X
  1201. X/*  if (theHPFlag == 0)   mask |= PEXRAPipelineContext; byte swapping bug? */
  1202. X
  1203. X  renderObj = PEXCreateRenderer(theDisplay, theWindow, rMask, &rAttrs);
  1204. X
  1205. X  background.pixel = BlackPixel(theDisplay,theScreen);
  1206. X  background.red = 0;
  1207. X  background.green = 0;
  1208. X  background.blue = 0;
  1209. X  background.flags = DoRed|DoGreen|DoBlue;
  1210. X
  1211. X  if (theDBFlag) {
  1212. X    dbstat = PEXUtDBConfig(theDisplay, theWindow, True,&background,False,&id);    
  1213. X    printf(" dbstat %x, id %x, win %x\n", dbstat, id, theWindow );
  1214. X    if (theWindow != id) {
  1215. X      printf(" Pixmap or MBX - reassinging theWindow! \n");
  1216. X      the3DBuffer = id;
  1217. X    } else {
  1218. X      the3DBuffer = theWindow;
  1219. X    }
  1220. X  } else {
  1221. X    the3DBuffer = theWindow;
  1222. X  }
  1223. X  return (renderObj);
  1224. X}
  1225. X
  1226. X/*************************************************************************
  1227. X * ReDraw - does a redraw for the renderer case.
  1228. X */
  1229. Xvoid  rdrReDraw()
  1230. X{
  1231. X  int i;
  1232. X  Drawable id;
  1233. X
  1234. X  PEXBeginRendering(theDisplay, the3DBuffer, theRenderObj);
  1235. X
  1236. X  for (i = 0; i < rPostCount; i++ )
  1237. X    PEXExecuteStructure(theDisplay, theRenderObj, PEXOCRender, rPostTable[i] );
  1238. X  
  1239. X  PEXEndRendering(theDisplay, theRenderObj, 1);
  1240. X  
  1241. X  if (theDBFlag) {
  1242. X    id = PEXUtDBSwap(theDisplay, theWindow, False );
  1243. X    the3DBuffer = id;
  1244. X  }
  1245. X  XFlush(theDisplay);
  1246. X}
  1247. X
  1248. X/*************************************************************************
  1249. X * MapPoints 
  1250. X */
  1251. Xint  rdrMapXToMC(mc, nCoords, xPoints, mcPoints )
  1252. X     MCMatrix *mc;
  1253. X     int nCoords;
  1254. X     XPoint *xPoints;
  1255. X     PEXCoord **mcPoints;
  1256. X{
  1257. X  int i;
  1258. X  int error;
  1259. X  unsigned long valueMask[2];
  1260. X  PEXRendererAttributes *rdrAttrs;
  1261. X  PEXMatrix WCtoXC, NPCtoXC, XtoMC;
  1262. X  XPoint *xp;
  1263. X  PEXCoord p, *m;
  1264. X
  1265. X  error = PEXNPCToXCTransform( &theVolume, (PEXDeviceCoord *)&theViewport, 
  1266. X                  theWinHeight, NPCtoXC );
  1267. X  if(error != 0) printf("imagine a Motif alarm, NPCtoXC err = %d\n",error);
  1268. X
  1269. X  PEXMatrixMult( theMatMap, theMatOri, WCtoXC );
  1270. X  PEXMatrixMult( NPCtoXC, WCtoXC, WCtoXC );
  1271. X  if (myMCSeqNo != mc->seqNo) myMCSeqNo = mc->seqNo; /* cache this someday */
  1272. X  PEXMatrixMult( WCtoXC, mc->matrix, WCtoXC );
  1273. X  
  1274. X  error = PEXInvertMatrix( WCtoXC, XtoMC );
  1275. X  if(error != 0) printf("imagine a Motif alarm, Invert err = %d\n",error);
  1276. X
  1277. X  m = (PEXCoord *)malloc(nCoords * sizeof(PEXCoord));
  1278. X
  1279. X  for (i = 0, xp = xPoints; i < nCoords; i++, xp++ ) {
  1280. X    p.x = (float)xp->x;
  1281. X    p.y = (float)xp->y;
  1282. X    p.z = theDepth;
  1283. X    PEXTransformPoints(XtoMC, 1, &p, &m[i]);
  1284. X  }
  1285. X
  1286. X  *mcPoints = m;
  1287. X  return (nCoords);
  1288. X}
  1289. X
  1290. X/*************************************************************************
  1291. X * MapMCToX
  1292. X *
  1293. X * MC xform struct.
  1294. X * count
  1295. X * points in
  1296. X * returns points out.
  1297. X * functions returns count
  1298. X */
  1299. Xint rdrMapMCToX( mc, inCount, mcPoints, xPoints )
  1300. X     MCMatrix *mc;
  1301. X     int inCount;
  1302. X     PEXCoord *mcPoints;
  1303. X     XPoint **xPoints;
  1304. X{
  1305. X  int i;
  1306. X  int error;
  1307. X  PEXMatrix WCtoXC, NPCtoXC, XtoMC;
  1308. X  XPoint *xp;
  1309. X  PEXCoord p, *m;
  1310. X
  1311. X  error = PEXNPCToXCTransform( &theVolume, (PEXDeviceCoord *)&theViewport, 
  1312. X                  theWinHeight, NPCtoXC );
  1313. X  if(error != 0) printf("imagine a Motif alarm, NPCtoXC err = %d\n",error);
  1314. X
  1315. X  PEXMatrixMult( theMatMap, theMatOri, WCtoXC );
  1316. X  PEXMatrixMult( NPCtoXC, WCtoXC, WCtoXC );
  1317. X  if (myMCSeqNo != mc->seqNo) myMCSeqNo = mc->seqNo; /* cache this someday */
  1318. X  PEXMatrixMult( WCtoXC, mc->matrix, WCtoXC );
  1319. X
  1320. X  *xPoints = (XPoint *)malloc(inCount * sizeof(XPoint));
  1321. X
  1322. X  for (i = 0, xp = *xPoints; i < inCount; i++, xp++ ) {
  1323. X    PEXTransformPoints(WCtoXC, 1, &mcPoints[i], &p);
  1324. X    xp->x = p.x;
  1325. X    xp->y = p.y;
  1326. X  }
  1327. X
  1328. X  return (inCount);
  1329. X}
  1330. X
  1331. X/*************************************************************************
  1332. X *
  1333. X */
  1334. Xvoid  rdrSetView( viewNumber, view)
  1335. X     int viewNumber;
  1336. X     PEXViewEntry *view;
  1337. X{
  1338. X  PEXSetTableEntries(theDisplay, theRdrViewLUT,1,1, PEXLUTView,(char *)view);
  1339. X}
  1340. X
  1341. X/*************************************************************************
  1342. X *
  1343. X */
  1344. Xvoid  rdrSetNPCToDC( volume, viewport )
  1345. X     PEXNPCSubVolume *volume;
  1346. X     PEXViewport *viewport;
  1347. X{
  1348. X  PEXRendererAttributes        rAttrs;    /* renderer attributes */
  1349. X
  1350. X  rAttrs.npc_subvolume = *volume;
  1351. X  rAttrs.viewport = *viewport;
  1352. X  PEXChangeRenderer( theDisplay, theRenderObj, 
  1353. X            PEXRANPCSubVolume|PEXRAViewport, &rAttrs );
  1354. X
  1355. X  theMatrixValidFlag = 0;
  1356. X  theVolume = *volume;
  1357. X  theViewport = *viewport;
  1358. X }
  1359. X
  1360. X/*************************************************************************
  1361. X * P O S T - rdrPost
  1362. X *
  1363. X * put the struxid in the "to be redrawn" list.
  1364. X */
  1365. Xvoid  rdrPost( struxid )
  1366. Xlong struxid;
  1367. X{
  1368. X  int i;
  1369. X/*
  1370. X * Check to see if this strux is already in use.
  1371. X * This quite inefficient if you have lots of structures. Perhaps
  1372. X * keep a pointer to an encoded ROC packet with all of the executes.
  1373. X */
  1374. X  for (i = 0; i < rPostCount; i++ )
  1375. X    if (rPostTable[i] == struxid) 
  1376. X      { printf("alarm, alread posted %d\n", struxid ); return; }
  1377. X
  1378. X  rPostCount++;
  1379. X  if (rPostCount == 1) {
  1380. X    rPostTable = (long *)malloc(rPostCount*sizeof(long *));
  1381. X  } else {
  1382. X    rPostTable = (long *)realloc(rPostTable, rPostCount*sizeof(long *));
  1383. X  }
  1384. X
  1385. X  if (!rPostTable) {printf("alarm, malloc failed in rdrPost\n"); }
  1386. X
  1387. X  rPostTable[rPostCount-1] = struxid;
  1388. X}
  1389. X
  1390. X/*************************************************************************
  1391. X *  DeleteAllStrux
  1392. X *
  1393. X *  PHIGS Workstation Version, get all of the posted structres and delete them
  1394. X *  Should probably do a PEXGetDescendants, to be really thorough.
  1395. X */
  1396. Xvoid  rdrDeleteAll()
  1397. X{
  1398. X  PEXDestroyStructures(theDisplay, rPostCount, (PEXStructure *)rPostTable);
  1399. X  rPostCount = 0;
  1400. X  free(rPostTable);
  1401. X  theNewStrux = 0;
  1402. X  theSelectedElement = -1;
  1403. X}
  1404. X
  1405. X
  1406. X/*************************************************************************
  1407. X * PickSomething - returns structure and element, else element == -1
  1408. X */
  1409. X#if NeedFunctionPrototypes
  1410. X/* need to do this to avoid warning about initialization, due to shorts */
  1411. Xvoid  rdrPickOne( short x, short y, long *strux, int *element )
  1412. X#else
  1413. Xvoid  rdrPickOne( x, y, strux, element )
  1414. X     short x;
  1415. X     short y;
  1416. X     long *strux;
  1417. X     int *element;
  1418. X#endif
  1419. X{
  1420. X  PEXPDDCHitBox hitInfo;
  1421. X  PEXPickPath *pickReturn;
  1422. X  int i;
  1423. X  int statusReturn, hidden;
  1424. X  XColor                        background;
  1425. X  Drawable                      id;
  1426. X  int                           dbstat;
  1427. X
  1428. X  hitInfo.position.x = x;
  1429. X  hitInfo.position.y = theWinHeight - y;
  1430. X  hitInfo.distance = 10;
  1431. X
  1432. X/*
  1433. X * this is just to test both cases.
  1434. X * Since there is the default structure in the beginning. When we add one we
  1435. X * have two, to get the PEXPickOne, delete all then add something.
  1436. X */
  1437. X  if (rPostCount == 1) {
  1438. X    pickReturn =  PEXPickOne(theDisplay, theWindow, theRenderObj,
  1439. X                 rPostTable[0],  PEXPickLast,  
  1440. X                 PEXPickDeviceDCHitBox, (PEXPickRecord *)&hitInfo, 
  1441. X                 &statusReturn, &hidden);
  1442. X  } else {
  1443. X    PEXBeginPickOne(theDisplay, theWindow, theRenderObj, (XID)1, PEXPickLast,  
  1444. X            PEXPickDeviceDCHitBox, (PEXPickRecord *)&hitInfo );
  1445. X    
  1446. X    for (i = 0; i < rPostCount; i++ )
  1447. X      PEXExecuteStructure(theDisplay, theRenderObj, PEXOCRender, rPostTable[i]);
  1448. X    
  1449. X    pickReturn = PEXEndPickOne(theDisplay, theRenderObj,
  1450. X                   &statusReturn, &hidden);
  1451. X  }
  1452. X
  1453. X  if (statusReturn == PEXPick) {
  1454. X    /*
  1455. X     * Get the last struxure/element in the pick path
  1456. X     */
  1457. X    *strux   = pickReturn->elements[pickReturn->count-1].sid;
  1458. X    *element = pickReturn->elements[pickReturn->count-1].offset;
  1459. X  } else {
  1460. X    *element = -1;
  1461. X  }
  1462. X
  1463. X  if (statusReturn == PEXPick) {
  1464. X    PEXColor echoColor;
  1465. X    PEXElementRef eRefs[4];
  1466. X    int i;
  1467. X    PEXRendererAttributes    rAttrs;    /* renderer attributes */
  1468. X    int count, offset;
  1469. X/*
  1470. X * just testing for now. Really should try to do something useful.
  1471. X * count -1 here is because we are skipping over the dummy structure
  1472. X * in the return path.
  1473. X * we are copying from a pick return path to an element ref path
  1474. X */
  1475. X    if (rPostCount == 1) {
  1476. X      count = pickReturn->count;
  1477. X      offset = 0;
  1478. X    } else {
  1479. X      count = pickReturn->count - 1;
  1480. X      offset = 1;
  1481. X    }
  1482. X    if (count > 4) return;
  1483. X    for (i = 0; i < count; i++ ) {
  1484. X      eRefs[i].structure =  pickReturn->elements[i+offset].sid;
  1485. X      eRefs[i].offset    =  pickReturn->elements[i+offset].offset;
  1486. X    }
  1487. X
  1488. X    rAttrs.clear_image = False;
  1489. X    PEXChangeRenderer( theDisplay, theRenderObj, PEXRAClearImage, &rAttrs );
  1490. X
  1491. X    background.pixel = BlackPixel(theDisplay,theScreen);
  1492. X    background.red = 0;
  1493. X    background.green = 0;
  1494. X    background.blue = 0;
  1495. X    background.flags = DoRed|DoGreen|DoBlue;
  1496. X    if (theDBFlag)
  1497. X      dbstat = PEXUtDBConfig(theDisplay, theWindow, False,&background,False, &id);
  1498. X
  1499. X    PEXBeginRendering(theDisplay, theWindow, theRenderObj);
  1500. X    PEXAccumulateState(theDisplay, theRenderObj, count, eRefs );
  1501. X    echoColor.rgb.red   = 1.0;
  1502. X    echoColor.rgb.green = 1.0;
  1503. X    echoColor.rgb.blue  = 0.0;
  1504. X    PEXSetLineColor( theDisplay, theRenderObj, PEXOCRender,
  1505. X            PEXColorTypeRGB, &echoColor );
  1506. X    PEXSetTextColor( theDisplay, theRenderObj, PEXOCRender,
  1507. X            PEXColorTypeRGB, &echoColor );
  1508. X    PEXSetSurfaceColor( theDisplay, theRenderObj, PEXOCRender,
  1509. X            PEXColorTypeRGB, &echoColor );
  1510. X    PEXRenderElements(theDisplay, theRenderObj, *strux, PEXBeginning, *element,
  1511. X                 PEXBeginning, *element );
  1512. X    PEXEndRendering(theDisplay, theRenderObj, 1);
  1513. X
  1514. X    XSync(theDisplay, 0);
  1515. X    if (theDBFlag) {
  1516. X      dbstat = PEXUtDBConfig(theDisplay, theWindow, True,&background,False,&id);    
  1517. X      printf(" dbstat %x, id %x, win %x\n", dbstat, id, theWindow );
  1518. X      if (theWindow != id) {
  1519. X        printf(" Pixmap or MBX - reassinging theWindow! \n");
  1520. X        the3DBuffer = id;
  1521. X      } else {
  1522. X        the3DBuffer = theWindow;
  1523. X      }
  1524. X    }
  1525. X    rAttrs.clear_image = True;
  1526. X    PEXChangeRenderer( theDisplay, theRenderObj, PEXRAClearImage, &rAttrs );
  1527. X  }
  1528. X
  1529. X}
  1530. X
  1531. X/*************************************************************************
  1532. X * rdrPickAll - 
  1533. X */
  1534. X#if NeedFunctionPrototypes
  1535. X/* need to do this to avoid warning about initialization, due to shorts */
  1536. Xvoid rdrPickAll( short x, short y, short x2, short y2,
  1537. X        int *nFound, long **struxArray, int **elemArray )
  1538. X#else
  1539. Xvoid rdrPickAll( x, y, x2, y2, nFound, struxArray, elemArray )
  1540. X     short x;
  1541. X     short y;
  1542. X     short x2;
  1543. X     short y2;
  1544. X     int *nFound;
  1545. X     long **struxArray;
  1546. X     int **elemArray;
  1547. X#endif
  1548. X{
  1549. X  PEXPDNPCHitVolume  hitBox;
  1550. X  PEXPickPath *pickReturn, *pps;
  1551. X  int i;
  1552. X  int statusReturn, hidden;
  1553. X  PEXMatrix XCtoNPC;
  1554. X  PEXCoord p[2];
  1555. X  int more;
  1556. X  unsigned long hitCount;
  1557. X  float t;
  1558. X  int notDone = 1;
  1559. X
  1560. X  *nFound = 0;
  1561. X
  1562. X  i = PEXXCToNPCTransform( &theVolume, (PEXDeviceCoord *)&theViewport,
  1563. X              theWinHeight, XCtoNPC );
  1564. X  if (i!=0) {printf("rdrPickAll bad XCtoNPC %d\n", i); return; }
  1565. X
  1566. X  p[0].x = x;
  1567. X  p[0].y = y;
  1568. X  p[0].z = 1.0;
  1569. X  p[1].x = x2;
  1570. X  p[1].y = y2;
  1571. X  p[1].z = 0.0;
  1572. X
  1573. X  PEXTransformPoints(XCtoNPC, 2, p, (PEXCoord *)&hitBox);
  1574. X
  1575. X#define SWAP(a,b) {t=a;a=b;b=t;}
  1576. X
  1577. X  if (hitBox.min.x > hitBox.max.x) SWAP(hitBox.min.x, hitBox.max.x);
  1578. X  if (hitBox.min.y > hitBox.max.y) SWAP(hitBox.min.y, hitBox.max.y);
  1579. X  if (hitBox.min.z > hitBox.max.z) SWAP(hitBox.min.z, hitBox.max.z);
  1580. X
  1581. X  if (rPostCount == 1) {
  1582. X    PEXRendererAttributes    rAttrs;    /* renderer attributes */
  1583. X    PEXElementRef       ep[1];
  1584. X
  1585. X    rAttrs.pick_start_path.count = 1;
  1586. X    rAttrs.pick_start_path.elements = ep;
  1587. X    rAttrs.pick_start_path.elements[0].structure = rPostTable[0];
  1588. X    rAttrs.pick_start_path.elements[0].offset = 0; /* begins after */
  1589. X
  1590. X    PEXChangeRenderer(theDisplay, theRenderObj, PEXRAPickStartPath, &rAttrs );
  1591. X    *nFound = 0;
  1592. X
  1593. X    while (notDone) {
  1594. X      pickReturn = PEXPickAll(theDisplay, theWindow, theRenderObj,
  1595. X                PEXPickLast, /* max hits */3, 
  1596. X                PEXPickDeviceNPCHitVolume,
  1597. X                (PEXPickRecord *)&hitBox,
  1598. X                &statusReturn, &more, &hitCount );
  1599. X
  1600. X      if (statusReturn == PEXPick) {
  1601. X    if (*nFound == 0) {
  1602. X      *struxArray = (long *)malloc(hitCount*sizeof(long));
  1603. X      *elemArray = (int *)malloc(hitCount*sizeof(int));
  1604. X    } else {
  1605. X      *struxArray = (long *)realloc((char *)*struxArray,
  1606. X                    (*nFound+hitCount)*sizeof(long));
  1607. X      *elemArray = (int *)realloc((char *)*elemArray,
  1608. X                      (*nFound+hitCount)*sizeof(int));
  1609. X    }
  1610. X
  1611. X    for (i = *nFound, pps = pickReturn; i < *nFound+(int)hitCount; i++ ){
  1612. X      /*
  1613. X       * Get the last struxure/element in the pick path
  1614. X       printf("depth %d, leaf - sid %x, element %x\n", pps->count, 
  1615. X       */ 
  1616. X      (*struxArray)[i] = pps->elements[pps->count-1].sid;
  1617. X      (*elemArray)[i] = pps->elements[pps->count-1].offset;
  1618. X      pps++;
  1619. X    }
  1620. X    *nFound += hitCount;
  1621. X    PEXFreePickPaths(hitCount,pickReturn);
  1622. X      } else {
  1623. X    notDone = 0;
  1624. X      }
  1625. X      if (more == PEXNoMoreHits) notDone = 0;
  1626. X    } /* end while notDone */
  1627. X  } else {
  1628. X    PEXBeginPickAll(theDisplay, theWindow, theRenderObj, 1,
  1629. X            PEXPickLast,  False, /* max hits */42, 
  1630. X            PEXPickDeviceNPCHitVolume, (PEXPickRecord *)&hitBox );
  1631. X    
  1632. X    for (i = 0; i < rPostCount; i++ )
  1633. X      PEXExecuteStructure(theDisplay, theRenderObj, PEXOCRender, rPostTable[i]);
  1634. X    
  1635. X    pickReturn = PEXEndPickAll(theDisplay, theRenderObj,
  1636. X                 &statusReturn, &more, &hitCount );
  1637. X
  1638. X
  1639. X    if (statusReturn == PEXPick) {
  1640. X      *struxArray = (long *)malloc(hitCount*sizeof(long));
  1641. X      *elemArray = (int *)malloc(hitCount*sizeof(int));
  1642. X      for (i = 0, pps = pickReturn; i < (int)hitCount; i++ ){
  1643. X    /*
  1644. X     * Get the last struxure/element in the pick path
  1645. X     *  printf("depth %d, leaf - sid %x, element %x\n", pps->count, 
  1646. X     */ 
  1647. X    (*struxArray)[i] = pps->elements[pps->count-1].sid;
  1648. X    (*elemArray)[i] = pps->elements[pps->count-1].offset;
  1649. X    pps++;
  1650. X      }
  1651. X      *nFound = hitCount;
  1652. X      PEXFreePickPaths(hitCount,pickReturn);
  1653. X    } else {
  1654. X      printf("no luck in pick all\n");
  1655. X    }
  1656. X  }
  1657. X}
  1658. X
  1659. Xint rdrMapXToNPC( count, points)
  1660. X     int count;
  1661. X     PEXCoord *points;
  1662. X{
  1663. X  int i;
  1664. X  PEXMatrix XCtoNPC;
  1665. X
  1666. X  i = PEXXCToNPCTransform( &theVolume, (PEXDeviceCoord *)&theViewport,
  1667. X              theWinHeight, XCtoNPC );
  1668. X  if (i!=0) {printf("rdrPickAll bad XCtoNPC %d\n", i); return (0); }
  1669. X
  1670. X  PEXTransformPoints(XCtoNPC, count, points, points);
  1671. X  return (1);
  1672. X}
  1673. X
  1674. Xint rdrReconfigureWindow( wkid, width, height)
  1675. X     long wkid;
  1676. X     int width;
  1677. X     int height;
  1678. X{
  1679. X   if (theWimpyWindow)
  1680. X     XResizeWindow(theDisplay, theWindow, width, height );
  1681. X
  1682. X   the3DBuffer = PEXUtDBResize(theDisplay, theWindow);
  1683. X}
  1684. X
  1685. Xint rdrGetColorFromIndex(cIndex, rgb)
  1686. X     int cIndex;
  1687. X     PEXColorRGB *rgb;
  1688. X{
  1689. X  PEXRendererAttributes *rAttr;
  1690. X  int table_type;
  1691. X  int defined;
  1692. X  PEXColorSpecifier *entry;
  1693. X
  1694. X  rAttr = PEXGetRendererAttributes( theDisplay, theRenderObj, PEXRAColorTable);
  1695. X  if (!rAttr) return (0);
  1696. X  entry = (PEXColorSpecifier *)PEXGetTableEntry(theDisplay, rAttr->color_table,
  1697. X                        cIndex, PEXSetValue, &defined,
  1698. X                        &table_type);
  1699. X  if (table_type != PEXLUTColor) {
  1700. X    printf("rdrGetColorFromIndex fix it!!!\n");
  1701. X    return (0);
  1702. X  }
  1703. X  if (entry->type != PEXColorTypeRGB) printf("RGB NOT %d\n");
  1704. X  *rgb = entry->value.rgb;
  1705. X
  1706. X  PEXFreeTableEntries(table_type, 1,(PEXPointer)entry);
  1707. X  PEXFreeRendererAttributes(rAttr);
  1708. X  return (1);
  1709. X}
  1710. X
  1711. X/*************************************************************************
  1712. X * U N P O S T - rdrUnpost
  1713. X *
  1714. X * remove the struxid from the "to be redrawn" list.
  1715. X */
  1716. Xvoid  rdrUnpost( strux )
  1717. Xlong strux;
  1718. X{
  1719. X  int i;
  1720. X/*
  1721. X * Check to see if this strux is already in use.
  1722. X * This quite inefficient if you have lots of structures. Perhaps
  1723. X * keep a pointer to an encoded ROC packet with all of the executes.
  1724. X */
  1725. X  for (i = 0; i < rPostCount; i++ )
  1726. X    if (rPostTable[i] == strux) {
  1727. X      if (i < rPostCount-1) {
  1728. X    bcopy(&rPostTable[i+1], &rPostTable[i], sizeof(long)*(rPostCount-i-1));
  1729. X      }
  1730. X      rPostCount--;
  1731. X      return;
  1732. X    }
  1733. X  /* no can do */
  1734. X  printf("tried to unpost non existent strux = %x\n", strux);
  1735. X}
  1736. X
  1737. X
  1738. X/*
  1739. X * init the procedure pointer structure
  1740. X */
  1741. XrenderProcs rdrProcs = { rdrInit, rdrReDraw, rdrMapXToMC, rdrMapMCToX, 
  1742. X               rdrSetView, rdrSetNPCToDC, rdrPost, rdrDeleteAll,
  1743. X               rdrPickOne, rdrPickAll, rdrMapXToNPC,
  1744. X               rdrReconfigureWindow, rdrGetColorFromIndex, 
  1745. X               rdrUnpost };
  1746. X
  1747. END_OF_FILE
  1748.   if test 20761 -ne `wc -c <'rdr.c'`; then
  1749.     echo shar: \"'rdr.c'\" unpacked with wrong size!
  1750.   fi
  1751.   # end of 'rdr.c'
  1752. fi
  1753. if test -f 'util/pexutext.h' -a "${1}" != "-c" ; then 
  1754.   echo shar: Will not clobber existing file \"'util/pexutext.h'\"
  1755. else
  1756.   echo shar: Extracting \"'util/pexutext.h'\" \(7178 characters\)
  1757.   sed "s/^X//" >'util/pexutext.h' <<'END_OF_FILE'
  1758. X
  1759. X#ifndef _PEXUTEXT_H_ /* [ */
  1760. X#define _PEXUTEXT_H_
  1761. X
  1762. X/******************************************************************************/
  1763. X/*                                                                            */
  1764. X/*  (c) Copyright Hewlett-Packard Company, 1992, Fort Collins, Colorado       */
  1765. X/*                                                                            */
  1766. X/*                            All Rights Reserved                             */
  1767. X/*                                                                            */
  1768. X/*  Permission to use, copy, modify, and distribute this software and its     */
  1769. X/*  documentation for any purpose and without fee is hereby granted,          */
  1770. X/*  provided that the above copyright notices appear in all copies and that   */
  1771. X/*  both the copyright notices and this permission notice appear in           */
  1772. X/*  supporting documentation, and that the name of Hewlett-Packard not be     */
  1773. X/*  used in advertising or publicity pertaining to distribution of the        */
  1774. X/*  software without specific, written prior permission.                      */
  1775. X/*                                                                            */
  1776. X/*  HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS         */
  1777. X/*  SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF        */
  1778. X/*  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  Hewlett-Packard    */
  1779. X/*  shall not be liable for errors contained herein or direct, indirect,      */
  1780. X/*  special, incidental or consequential damages in connection with the       */
  1781. X/*  furnishing, performance or use of this software.                          */
  1782. X/*                                                                            */
  1783. X/******************************************************************************/
  1784. X
  1785. X/******************************************************************************/
  1786. X/*                                                                            */
  1787. X/* $Source: /users/waitz/work/tmp/RCS/pexutext.h,v $                                */
  1788. X/* $Date: 93/03/02 16:39:31 $                                                 */
  1789. X/* $Revision: 1.1 $                                                           */
  1790. X/*                                                                            */
  1791. X/* Description:                                                               */
  1792. X/*   Internal header file for PEXUt ,                                  */
  1793. X/*   not to be included by application programs.                              */
  1794. X/*                                                                            */
  1795. X/* Notes:                                                                     */
  1796. X/*                                                                            */
  1797. X/******************************************************************************/
  1798. X
  1799. X/*
  1800. X** Data structures and constants for escapes used in the utilities.
  1801. X** This header file is intended to make the code more portable by eliminating
  1802. X** the need to include vendor-specific extension header files.
  1803. X*/
  1804. X
  1805. X/*
  1806. X** The following is to prevent multiple inclusion of escape information from 
  1807. X** any vendor specific header files.  It relies on standard constant names
  1808. X** for the escape opcode.
  1809. X*/
  1810. X
  1811. X#if !defined (ES_ESCAPE_DBLBUFFER) /* [ */
  1812. X
  1813. X/*
  1814. X** Constants for E&S double-buffering escapes
  1815. X*/
  1816. X#define ES_ESCAPE_DBLBUFFER             0x80040001      /* escape for db      */
  1817. X#define ES_RENDERER_SINGLEBUFFER                 0      /* turn db off        */
  1818. X#define ES_RENDERER_DBLBUFFER                    1      /* turn db on         */
  1819. X
  1820. X#define ES_ESCAPE_SWAPBUFFER            0x80040002      /* escape to swap buf */
  1821. X
  1822. X#define ES_ESCAPE_SWAPBUFFERCONTENT     0x80040003      /* escape to inquire  */
  1823. X#define ES_DB_SWAP_CONTENT_UNDEFINED             0      /* what the content   */
  1824. X#define ES_DB_SWAP_CONTENT_CLEAR_TO_BACKGROUND   1      /* of the back buffer */
  1825. X#define ES_DB_SWAP_CONTENT_UNCHANGED             2      /* will be after a    */
  1826. X#define ES_DB_SWAP_CONTENT_FRONTBUFFER           3      /* swap is done       */
  1827. X
  1828. X
  1829. X/*
  1830. X** Constants for enumerated type descriptors returned from PEXGetEnumTypeInfo
  1831. X*/
  1832. X#define ES_ESCAPE_ET_DBLBUFFER          0x8401
  1833. X#define ES_ESCAPE_ET_SWAPBUFFER         0x8402
  1834. X#define ES_ESCAPE_ET_SWAPBUFFERCONTENT  0x8403
  1835. X
  1836. X#define ES_ESCAPE_ETM_DBLBUFFER         "ES_ESCAPE_DBLBUFFER"
  1837. X#define ES_ESCAPE_ETM_SWAPBUFFER        "ES_ESCAPE_SWAPBUFFER"
  1838. X#define ES_ESCAPE_ETM_SWAPBUFFERCONTENT "ES_ESCAPE_SWAPBUFFERCONTENT"
  1839. X
  1840. X/*
  1841. X** Data structures for E&S double-buffering.
  1842. X** The PEXEscape function is defined in PEXlib.h.
  1843. X** These define the data argument for PEXEscape.
  1844. X*/
  1845. Xtypedef struct {        /* Data for ES_ESCAPE_DBLBUFFER in PEXEscape function */
  1846. X   Drawable             drawable;
  1847. X   unsigned long        bufferMode;
  1848. X} esEscapeDblBuffer;
  1849. X
  1850. Xtypedef struct {        /* Data for ES_ESCAPE_SWAPBUFFER in PEXEscape function*/
  1851. X   Drawable             drawable;
  1852. X} esEscapeSwapBuffer;
  1853. X
  1854. Xtypedef struct {/* Data for ES_ESCAPE_SWAPBUFFERCONTENT in PEXEscapeWithReply */
  1855. X   Drawable             drawable;
  1856. X} esEscapeSwapBufferContent;
  1857. X
  1858. Xtypedef struct {/* Return from PEXEscapeWithReply, ES_ESCAPE_SWAPBUFFERCONTENT*/
  1859. X   unsigned char        type;
  1860. X   unsigned char        unused;
  1861. X   unsigned short       sequence_num;
  1862. X   unsigned long        length;
  1863. X   unsigned long        escapeId;
  1864. X   unsigned long        content;
  1865. X} esEscapeSwapBufferContentReply;
  1866. X
  1867. X#endif /* ] */
  1868. X
  1869. X
  1870. X#if !defined (HP_ESCAPE_DFRONT) /* [ */
  1871. X/*
  1872. X** Constants for HP double-buffering escapes
  1873. X*/
  1874. X
  1875. X#define HP_ESCAPE_DFRONT                0x80070001      /* escape render cntl */
  1876. X#define HP_RENDER_TO_BACK_BUFFER                 0      /* render to back     */
  1877. X#define HP_RENDER_TO_FRONT_BUFFER                1      /* render to front    */
  1878. X
  1879. X#define HP_ESCAPE_ET_DFRONT             0x8701
  1880. X#define HP_ESCAPE_ETM_DFRONT            "HP_ESCAPE_DFRONT"
  1881. X
  1882. Xtypedef struct {        /* Data for HP_ESCAPE_DFRONT in PEXEscape function    */
  1883. X   Drawable             drawable;
  1884. X   int                  render_to_front_buffer;
  1885. X} hpEscapeSetRenderingBuffer;
  1886. X
  1887. X#endif /* ] */
  1888. X
  1889. X
  1890. X#if !defined (PEXEscapeQueryColorApprox) /* [ */
  1891. X
  1892. X/* QueryColorApprox                                                           */
  1893. X#define PEXEscapeQueryColorApprox    0x80010001
  1894. X#define PEXETEscapeQueryColorApprox  0x8101
  1895. X
  1896. X/* QueryColorApprox mnemonic                                                  */
  1897. X#define PEXETMEscapeQueryColorApprox "QueryColorApprox"
  1898. X
  1899. Xtypedef struct 
  1900. X{
  1901. X   Drawable            drawable;     /* Drawable to compare capx against     */
  1902. X   PEXColorApproxEntry capx;         /* Color approx to check                */
  1903. X} PEXEscapeQueryColorApproxData;
  1904. X
  1905. Xtypedef struct 
  1906. X{
  1907. X   char          capx_is_supported;  /* True if given input approx supported */
  1908. X   char          dithering_supported;/* True if dithering is supported       */
  1909. X   char          all_capxs;          /* True if all alt capx's are returned  */
  1910. X   char          reserved1;
  1911. X   unsigned long count;              /* Number of alternative color approx's */
  1912. X   unsigned int     reserved2[3];
  1913. X} PEXEscapeQueryColorApproxReplyData;
  1914. X
  1915. X#endif /* ] */
  1916. X
  1917. X#endif /* _PEXUTEXT_H_ ] */
  1918. END_OF_FILE
  1919.   if test 7178 -ne `wc -c <'util/pexutext.h'`; then
  1920.     echo shar: \"'util/pexutext.h'\" unpacked with wrong size!
  1921.   fi
  1922.   # end of 'util/pexutext.h'
  1923. fi
  1924. echo shar: End of archive 11 \(of 14\).
  1925. cp /dev/null ark11isdone
  1926. MISSING=""
  1927. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  1928.     if test ! -f ark${I}isdone ; then
  1929.     MISSING="${MISSING} ${I}"
  1930.     fi
  1931. done
  1932. if test "${MISSING}" = "" ; then
  1933.     echo You have unpacked all 14 archives.
  1934.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1935.     echo "concatentating pexdraw.c ..."
  1936.     cat pexdrawc.? > pexdraw.c
  1937.     rm pexdrawc.?
  1938.     echo "concatentating pexdraw.uil ..."
  1939.     cat pexdrawu.? > pexdraw.uil
  1940.     rm pexdrawu.?
  1941.     echo "concatentating teapot.c ..."
  1942.     rm teapotc.?
  1943. else
  1944.     echo You still must unpack the following archives:
  1945.     echo "        " ${MISSING}
  1946. fi
  1947. exit 0
  1948. exit 0 # Just in case...
  1949. -- 
  1950.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  1951. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  1952.  "It's intuitively obvious to the |
  1953.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1954.