home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume18 / xdtree / part02 < prev    next >
Encoding:
Text File  |  1992-07-20  |  50.1 KB  |  1,597 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!darwin.sura.net!mips!msi!dcmartin
  3. From: Konstantinos Konstantinides <kk@hpkronos.hpl.hp.com>
  4. Subject: v18i032: xdtree (Motif), Part02/03
  5. Message-ID: <1992Jul20.154252.2148@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-18i031-xdtree@uunet.UU.NET>
  10. Date: Mon, 20 Jul 1992 15:42:52 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1583
  13.  
  14. Submitted-by: Konstantinos Konstantinides <kk@hpkronos.hpl.hp.com>
  15. Posting-number: Volume 18, Issue 32
  16. Archive-name: xdtree/part02
  17.  
  18. #!/bin/sh
  19. # this is part.02 (part 2 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file xdtree.c continued
  22. #
  23. if test ! -r _shar_seq_.tmp; then
  24.     echo 'Please unpack part 1 first!'
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 2; then
  29.     echo Please unpack part "$Scheck" next!
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < _shar_seq_.tmp || exit 1
  35. if test ! -f _shar_wnt_.tmp; then
  36.     echo 'x - still skipping xdtree.c'
  37. else
  38. echo 'x - continuing file xdtree.c'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'xdtree.c' &&
  40. X    char *button_name = NULL;
  41. X    char *lpdest=NULL, *editor = NULL;
  42. X    char  *EDITOR="EDITOR\0";
  43. X    int pid, pathl,namel;
  44. X    Arg  wargs[3];
  45. X
  46. X    
  47. X    
  48. X    /* find which button called us */
  49. X
  50. X    branch = file_pointer;
  51. X    XtSetArg(wargs[0], XmNlabelString, &name_string);
  52. X    XtGetValues(w,wargs,1);
  53. X    XmStringGetLtoR(name_string,XmSTRING_DEFAULT_CHARSET,&button_name);
  54. X
  55. X
  56. X    /* find first the correct path - append the file name 
  57. X        except for the "root" directory */
  58. X
  59. X    strncpy(filename,branch->path_name,MAXPATHLEN);
  60. X    if(branch->next != 1) {
  61. X        strcat(filename,"/");
  62. X        strcat(filename,branch->e_name);
  63. X    }
  64. X    /* fork a new process */
  65. X    pid = fork();
  66. X
  67. X    if(pid > 0) {
  68. X        /* wait((int *)0); */
  69. X        return;
  70. X    }
  71. X
  72. X    if(pid == 0) {
  73. X    /*     for(fd = 0; fd < _NFILE; fd++) close(fd); */
  74. X        if(strcmp(button_name,"print") == 0) {
  75. X            
  76. X            lpdest = XGetDefault(XtDisplay(w),"xdtree","lpdest");
  77. X            if (lpdest != NULL){
  78. X             execl("/usr/bin/lp","lp","-d",lpdest,filename,(char *)0);
  79. X            }
  80. X            else
  81. X            execl("/usr/bin/lp","lp",filename,(char *)0);
  82. X        }
  83. X        else if(strcmp(button_name,"edit") == 0) {
  84. X
  85. X            editor = XGetDefault(XtDisplay(w),"xdtree","editor");
  86. X
  87. X            if (editor == NULL) { 
  88. X                 editor = getenv(EDITOR);
  89. X                 if(editor == NULL) 
  90. X                     editor="/usr/bin/vi";
  91. X                       execl("/usr/bin/X11/hpterm",
  92. X                            "hpterm","-e",editor,
  93. X                                  filename,(char *)0);
  94. X                 } else 
  95. X            execlp(editor,editor, filename,(char *)0);
  96. X        }
  97. X        else if(strcmp(button_name,"list files") == 0) {
  98. X              execlp("xdtree", "xdtree", 
  99. X                   "-a", "-l","1",filename, (char *)0);
  100. X        }
  101. X        else if(strcmp(button_name,"list ../") == 0) {
  102. X
  103. X            /* find the parent directory */
  104. X            pathl = strlen(filename);
  105. X            namel = strlen(branch->e_name);
  106. X            strncpy(topdir,branch->path_name,pathl-namel);
  107. X
  108. X             execlp("xdtree", "xdtree", "-l","1",topdir, (char *)0);
  109. X        }
  110. X            
  111. X        else
  112. X         execlp("xdtree", "xdtree", 
  113. X                  "-a",filename, (char *)0);
  114. X
  115. X    fprintf(stderr,"%s command failed\n",button_name);
  116. X    }
  117. X    fprintf(stderr,"fork for %s command failed\n",button_name);
  118. }
  119. X
  120. /* Function that updates the pop-up menu labels and permissions
  121. X   when someone clicks on a node.
  122. */
  123. void clickB( w,branch,call_data)
  124. X    Widget w;
  125. X    struct entry *branch;
  126. X    caddr_t call_data;
  127. {
  128. X    Arg wargs[3];
  129. X    XrmValue bgcolor;
  130. X    if(branch->dir == 1) {
  131. X        XtSetSensitive(submenu_file ,FALSE);
  132. X        XtSetSensitive(submenu_dir ,True);
  133. X    }
  134. X    else {
  135. X        XtSetSensitive(submenu_dir ,False);
  136. #ifdef STATS
  137. X        /* Don't do anything with symb. links */
  138. X        if(strncmp(" l",getmode(branch->e_mode),2) == 0)
  139. X             XtSetSensitive(submenu_file ,False);
  140. X        else
  141. #endif /* STATS */
  142. X        XtSetSensitive(submenu_file ,True);
  143. X    }
  144. X    w_print(options, branch->e_name);
  145. X
  146. X     /* Get the background color of the activated button 
  147. X        Need to get the foreground color too
  148. X         */
  149. X     _XmSelectColorDefault (w, NULL, &bgcolor);
  150. X    XtSetArg(wargs[0], XmNbackground, *((Pixel *) bgcolor.addr));
  151. X    XtSetValues(options, wargs, 1);
  152. X    file_pointer = branch;
  153. X    button_print(branch);
  154. }
  155. X
  156. /* Print a string on a widget */
  157. X
  158. void w_print(w, string)
  159. X    Widget w;
  160. X    char *string;
  161. {
  162. X    XmString xmstr;
  163. X    Arg wargs[2];
  164. X
  165. X    xmstr = XmStringLtoRCreate(string, XmSTRING_DEFAULT_CHARSET);
  166. X    XtSetArg(wargs[0], XmNlabelString, xmstr);
  167. X    XtSetValues(w,wargs, 1);
  168. }
  169. X
  170. /* print the labels on the menu */
  171. void button_print(branch)
  172. X    struct entry *branch;
  173. {
  174. X    char tmp[40];
  175. X    char tmp2[40];
  176. X    /* w_print(boxes[0], branch->e_name); */
  177. #ifdef STATS
  178. X    strncpy(tmp,"Mode :",40);
  179. X    strcat(tmp,getmode(branch->e_mode));
  180. X    w_print(boxes[1],tmp);
  181. X    strncpy(tmp,"User :",40);
  182. X    strcat(tmp,guid(branch->e_uid));
  183. X    w_print(boxes[2], tmp);
  184. X    strncpy(tmp,"Group:",40);
  185. X    strcat(tmp, ggid(branch->e_gid));
  186. X    w_print(boxes[3], tmp);
  187. X    sprintf(tmp2,"%7ld",(branch->e_size+511L/512L));
  188. X    strncpy(tmp,"Size :",40);
  189. X    strcat(tmp, tmp2);
  190. X    w_print(boxes[11], tmp);
  191. #endif /* STATS */
  192. }
  193. X
  194. /* 
  195. X * Copied from D. Young's book  with some changes
  196. X * Define three callbacks. Make them static - no need 
  197. X * to make them known outside this file.
  198. X */
  199. static void arm_callback(w, flag, call_data)
  200. X     Widget     w;
  201. X     int       *flag;
  202. X     XmAnyCallbackStruct *call_data; 
  203. {
  204. X *flag = FALSE;
  205. }
  206. static void activate_callback(w, flag, call_data)
  207. X     Widget     w;
  208. X     int       *flag;
  209. X     XmAnyCallbackStruct *call_data; 
  210. {
  211. X  *flag = TRUE;
  212. }
  213. static void disarm_callback(w, flag, call_data)
  214. X     Widget     w;
  215. X     int       *flag;
  216. X     XmAnyCallbackStruct *call_data; 
  217. {
  218. X  if(*flag){
  219. X    XtCloseDisplay(XtDisplay(w));
  220. X    exit(0);
  221. X  }
  222. }
  223. X
  224. /* print options toggle callback routine */
  225. X
  226. void stoggle(widget, client_data, call_data)
  227. Widget widget;
  228. caddr_t client_data;
  229. XXmToggleButtonCallbackStruct *call_data;
  230. X
  231. {
  232. X
  233. X    S_flag = !S_flag;
  234. }
  235. X
  236. void gtoggle(widget, client_data, call_data)
  237. Widget widget;
  238. caddr_t client_data;
  239. XXmToggleButtonCallbackStruct *call_data;
  240. X
  241. {
  242. X
  243. X    g_flag = !g_flag;
  244. }
  245. X
  246. void htoggle(widget, client_data, call_data)
  247. Widget widget;
  248. caddr_t client_data;
  249. XXmToggleButtonCallbackStruct *call_data;
  250. X
  251. {
  252. X
  253. X    H_flag = !H_flag;
  254. }
  255. void print_tree(w, call_mydata, call_data)
  256. X          Widget w;
  257. X      caddr_t call_data, call_mydata;
  258. X
  259. {
  260. X    struct entry *branch;
  261. X    char *filename[MAXPATHLEN+1];
  262. X    int pid;
  263. X    char opt_flags[MAXPATHLEN+40];
  264. X    extern int newlevel;
  265. X    char temp[20];
  266. X    char *lpdest=NULL;
  267. X
  268. X    branch = &List[0];
  269. X    strncpy(filename,branch->path_name,MAXPATHLEN);
  270. X
  271. X
  272. X    strncpy(opt_flags,"xdtree -l ",MAXPATHLEN+40);
  273. X    sprintf(temp,"%d",newlevel);
  274. X    strcat(opt_flags,temp);
  275. X    strcat(opt_flags," -t");
  276. X    if (All == 1) strcat(opt_flags,"a");
  277. X    if (File_dir == 2) strcat(opt_flags,"f");
  278. X    if (Xdev == 0) strcat(opt_flags,"x");
  279. X    if (Point == 0) strcat(opt_flags,"p");
  280. X    if (Sort == 0) strcat(opt_flags,"N");
  281. X    if (S_flag) strcat(opt_flags,"S");
  282. X    if (g_flag) strcat(opt_flags,"g");
  283. X    if (H_flag) strcat(opt_flags,"H");
  284. X    strcat(opt_flags," ");
  285. X    strcat(opt_flags,filename);
  286. X
  287. X    strcat(opt_flags," | lp");
  288. X
  289. X        lpdest = XGetDefault(XtDisplay(w),"xdtree","lpdest");
  290. X        if (lpdest != NULL) {
  291. X        strcat(opt_flags," -d");
  292. X        strcat(opt_flags,lpdest);
  293. X        }
  294. X    if(system(opt_flags) !=0) 
  295. X    fprintf(stderr,"Print-tree Command %s failed\n",opt_flags);
  296. X
  297. }
  298. SHAR_EOF
  299. echo 'File xdtree.c is complete' &&
  300. chmod 0644 xdtree.c ||
  301. echo 'restore of xdtree.c failed'
  302. Wc_c="`wc -c < 'xdtree.c'`"
  303. test 47318 -eq "$Wc_c" ||
  304.     echo 'xdtree.c: original size 47318, current size' "$Wc_c"
  305. rm -f _shar_wnt_.tmp
  306. fi
  307. # ============= Makefile ==============
  308. if test -f 'Makefile' -a X"$1" != X"-c"; then
  309.     echo 'x - skipping Makefile (File already exists)'
  310.     rm -f _shar_wnt_.tmp
  311. else
  312. > _shar_wnt_.tmp
  313. echo 'x - extracting Makefile (Text)'
  314. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  315. # Makefile generated by imake - do not edit!
  316. # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  317. #
  318. # The cpp used on this machine replaces all newlines and multiple tabs and
  319. # spaces in a macro expansion with a single space.  Imake tries to compensate
  320. # for this, but is not always successful.
  321. #
  322. X
  323. # -------------------------------------------------------------------------
  324. # Makefile generated from "Imake.tmpl" and </tmp/IIf.a17100>
  325. # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  326. #
  327. # Platform-specific parameters may be set in the appropriate <vendor>.cf
  328. # configuration files.  Site-specific parameters should be set in the file
  329. # site.def.  Full rebuilds are recommended if any parameters are changed.
  330. #
  331. # If your C preprocessor does not define any unique symbols, you will need
  332. # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  333. # "make World" the first time).
  334. #
  335. X
  336. # -------------------------------------------------------------------------
  337. # site-specific configuration parameters that need to come before
  338. # the platform-specific parameters - edit site.def to change
  339. X
  340. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  341. X
  342. # -------------------------------------------------------------------------
  343. # platform-specific configuration parameters - edit sun.cf to change
  344. X
  345. # platform:  $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
  346. X
  347. # operating system:  SunOS 4.1.1
  348. X
  349. # $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
  350. X
  351. # -------------------------------------------------------------------------
  352. # site-specific configuration parameters that go after
  353. # the platform-specific parameters - edit site.def to change
  354. X
  355. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  356. X
  357. X            SHELL = /bin/sh
  358. X
  359. X              TOP = .
  360. X      CURRENT_DIR = .
  361. X
  362. X               AR = ar clq
  363. X  BOOTSTRAPCFLAGS =
  364. X               CC = cc
  365. X               AS = as
  366. X
  367. X         COMPRESS = compress
  368. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  369. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  370. X          INSTALL = install
  371. X               LD = ld
  372. X             LINT = lint
  373. X      LINTLIBFLAG = -C
  374. X         LINTOPTS = -axz
  375. X               LN = ln -s
  376. X             MAKE = make
  377. X               MV = mv
  378. X               CP = cp
  379. X
  380. X           RANLIB = ranlib
  381. X  RANLIBINSTFLAGS =
  382. X
  383. X               RM = rm -f
  384. X            TROFF = psroff
  385. X         MSMACROS = -ms
  386. X              TBL = tbl
  387. X              EQN = eqn
  388. X     STD_INCLUDES =
  389. X  STD_CPP_DEFINES =
  390. X      STD_DEFINES =
  391. X EXTRA_LOAD_FLAGS =
  392. X  EXTRA_LIBRARIES =
  393. X             TAGS = ctags
  394. X
  395. X    SHAREDCODEDEF = -DSHAREDCODE
  396. X         SHLIBDEF = -DSUNSHLIB
  397. X
  398. X    PROTO_DEFINES =
  399. X
  400. X     INSTPGMFLAGS =
  401. X
  402. X     INSTBINFLAGS = -m 0755
  403. X     INSTUIDFLAGS = -m 4755
  404. X     INSTLIBFLAGS = -m 0644
  405. X     INSTINCFLAGS = -m 0444
  406. X     INSTMANFLAGS = -m 0444
  407. X     INSTDATFLAGS = -m 0444
  408. X    INSTKMEMFLAGS = -m 4755
  409. X
  410. X      PROJECTROOT = /usr/X11/R5
  411. X
  412. X     TOP_INCLUDES = -I$(INCROOT)
  413. X
  414. X      CDEBUGFLAGS = -O
  415. X        CCOPTIONS = -pipe
  416. X
  417. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  418. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  419. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  420. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  421. X
  422. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  423. X
  424. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  425. X
  426. X   LDCOMBINEFLAGS = -X -r
  427. X      DEPENDFLAGS =
  428. X
  429. X        MACROFILE = sun.cf
  430. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  431. X
  432. X    IMAKE_DEFINES =
  433. X
  434. X         IRULESRC = $(CONFIGDIR)
  435. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  436. X
  437. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  438. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  439. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  440. X
  441. # -------------------------------------------------------------------------
  442. # X Window System Build Parameters
  443. # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  444. X
  445. # -------------------------------------------------------------------------
  446. # X Window System make variables; this need to be coordinated with rules
  447. X
  448. X          PATHSEP = /
  449. X        USRLIBDIR = /usr/X11/R5/lib
  450. X           BINDIR = /usr/X11/R5/bin
  451. X          INCROOT = /usr/X11/R5/include
  452. X     BUILDINCROOT = $(TOP)
  453. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  454. X      BUILDINCTOP = ..
  455. X           INCDIR = $(INCROOT)/X11
  456. X           ADMDIR = /usr/adm
  457. X           LIBDIR = $(USRLIBDIR)/X11
  458. X        CONFIGDIR = $(LIBDIR)/config
  459. X       LINTLIBDIR = $(USRLIBDIR)/lint
  460. X
  461. X          FONTDIR = $(LIBDIR)/fonts
  462. X         XINITDIR = $(LIBDIR)/xinit
  463. X           XDMDIR = $(LIBDIR)/xdm
  464. X           TWMDIR = $(LIBDIR)/twm
  465. X          MANPATH = /usr/X11/R5/man
  466. X    MANSOURCEPATH = $(MANPATH)/man
  467. X        MANSUFFIX = n
  468. X     LIBMANSUFFIX = 3
  469. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  470. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  471. X           NLSDIR = $(LIBDIR)/nls
  472. X        PEXAPIDIR = $(LIBDIR)/PEX
  473. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  474. X       FONTCFLAGS = -t
  475. X
  476. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  477. X
  478. X            IMAKE = imake
  479. X           DEPEND = makedepend
  480. X              RGB = rgb
  481. X
  482. X            FONTC = bdftopcf
  483. X
  484. X        MKFONTDIR = mkfontdir
  485. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  486. X
  487. X        CONFIGSRC = $(TOP)/config
  488. X       DOCUTILSRC = $(TOP)/doc/util
  489. X        CLIENTSRC = $(TOP)/clients
  490. X          DEMOSRC = $(TOP)/demos
  491. X           LIBSRC = $(TOP)/lib
  492. X          FONTSRC = $(TOP)/fonts
  493. X       INCLUDESRC = $(TOP)/X11
  494. X        SERVERSRC = $(TOP)/server
  495. X          UTILSRC = $(TOP)/util
  496. X        SCRIPTSRC = $(UTILSRC)/scripts
  497. X       EXAMPLESRC = $(TOP)/examples
  498. X       CONTRIBSRC = $(TOP)/../contrib
  499. X           DOCSRC = $(TOP)/doc
  500. X           RGBSRC = $(TOP)/rgb
  501. X        DEPENDSRC = $(UTILSRC)/makedepend
  502. X         IMAKESRC = $(CONFIGSRC)
  503. X         XAUTHSRC = $(LIBSRC)/Xau
  504. X          XLIBSRC = $(LIBSRC)/X
  505. X           XMUSRC = $(LIBSRC)/Xmu
  506. X       TOOLKITSRC = $(LIBSRC)/Xt
  507. X       AWIDGETSRC = $(LIBSRC)/Xaw
  508. X       OLDXLIBSRC = $(LIBSRC)/oldX
  509. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  510. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  511. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  512. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  513. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  514. X         FSLIBSRC = $(FONTSRC)/lib/fs
  515. X    FONTSERVERSRC = $(FONTSRC)/server
  516. X     EXTENSIONSRC = $(TOP)/extensions
  517. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  518. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  519. X
  520. # $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
  521. X
  522. SHLIBLDFLAGS = -assert pure-text
  523. PICFLAGS = -pic
  524. X
  525. X  DEPEXTENSIONLIB =
  526. X     EXTENSIONLIB = -lXext
  527. X
  528. X          DEPXLIB = $(DEPEXTENSIONLIB)
  529. X             XLIB = $(EXTENSIONLIB) -lX11
  530. X
  531. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  532. X           XMULIB = -lXmu
  533. X
  534. X       DEPOLDXLIB =
  535. X          OLDXLIB = -loldX
  536. X
  537. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  538. X         XTOOLLIB = -lXt
  539. X
  540. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  541. X           XAWLIB = -lXaw
  542. X
  543. X        DEPXILIB =
  544. X           XILIB = -lXi
  545. X
  546. X        SOXLIBREV = 4.10
  547. X          SOXTREV = 4.10
  548. X         SOXAWREV = 5.0
  549. X        SOOLDXREV = 4.10
  550. X         SOXMUREV = 4.10
  551. X        SOXEXTREV = 4.10
  552. X      SOXINPUTREV = 4.10
  553. X
  554. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  555. X         XAUTHLIB =  -lXau
  556. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  557. X         XDMCPLIB =  -lXdmcp
  558. X
  559. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  560. X           PHIGSLIB =  -lphigs
  561. X
  562. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  563. X          XBSDLIB =  -lXbsd
  564. X
  565. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  566. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  567. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  568. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  569. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  570. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  571. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  572. X
  573. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  574. X
  575. X         DEPLIBS1 = $(DEPLIBS)
  576. X         DEPLIBS2 = $(DEPLIBS)
  577. X         DEPLIBS3 = $(DEPLIBS)
  578. X
  579. # -------------------------------------------------------------------------
  580. # Imake rules for building libraries, programs, scripts, and data files
  581. # rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  582. X
  583. # -------------------------------------------------------------------------
  584. # start of Imakefile
  585. X
  586. #Imakefile to create dtree using the "tree" widget.
  587. X
  588. X        DEFINES = -DSTATS -DNEWDIR -DSYSV
  589. LOCAL_LIBRARIES =
  590. X  SYS_LIBRARIES = -lmalloc -lXm -lXt -lX11 -lm
  591. X           SRCS = xdtree.c Tree.c
  592. X           OBJS = xdtree.o Tree.o
  593. X
  594. X PROGRAM = xdtree
  595. X
  596. all:: xdtree
  597. X
  598. xdtree: $(OBJS) $(DEPLIBS)
  599. X    $(RM) $@
  600. X    $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  601. X
  602. saber_xdtree:: $(SRCS)
  603. X    # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  604. X
  605. osaber_xdtree:: $(OBJS)
  606. X    # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  607. X
  608. install:: xdtree
  609. X    @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
  610. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
  611. X    $(INSTALL) -c $(INSTPGMFLAGS)  xdtree $(DESTDIR)$(BINDIR)
  612. X
  613. install.man:: xdtree.man
  614. X    @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  615. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  616. X    $(INSTALL) -c $(INSTMANFLAGS) xdtree.man $(DESTDIR)$(MANDIR)/xdtree.$(MANSUFFIX)
  617. X
  618. depend::
  619. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  620. X
  621. lint:
  622. X    $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  623. lint1:
  624. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  625. X
  626. clean::
  627. X    $(RM) $(PROGRAM)
  628. X
  629. # -------------------------------------------------------------------------
  630. # common rules for all Makefiles - do not edit
  631. X
  632. emptyrule::
  633. X
  634. clean::
  635. X    $(RM_CMD) "#"*
  636. X
  637. Makefile::
  638. X    -@if [ -f Makefile ]; then set -x; \
  639. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  640. X    else exit 0; fi
  641. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  642. X
  643. tags::
  644. X    $(TAGS) -w *.[ch]
  645. X    $(TAGS) -xw *.[ch] > TAGS
  646. X
  647. saber:
  648. X    # load $(ALLDEFINES) $(SRCS)
  649. X
  650. osaber:
  651. X    # load $(ALLDEFINES) $(OBJS)
  652. X
  653. # -------------------------------------------------------------------------
  654. # empty rules for directories that do not have SUBDIRS - do not edit
  655. X
  656. install::
  657. X    @echo "install in $(CURRENT_DIR) done"
  658. X
  659. install.man::
  660. X    @echo "install.man in $(CURRENT_DIR) done"
  661. X
  662. Makefiles::
  663. X
  664. includes::
  665. X
  666. # -------------------------------------------------------------------------
  667. # dependencies generated by makedepend
  668. X
  669. SHAR_EOF
  670. chmod 0644 Makefile ||
  671. echo 'restore of Makefile failed'
  672. Wc_c="`wc -c < 'Makefile'`"
  673. test 10452 -eq "$Wc_c" ||
  674.     echo 'Makefile: original size 10452, current size' "$Wc_c"
  675. rm -f _shar_wnt_.tmp
  676. fi
  677. # ============= XDtree ==============
  678. if test -f 'XDtree' -a X"$1" != X"-c"; then
  679.     echo 'x - skipping XDtree (File already exists)'
  680.     rm -f _shar_wnt_.tmp
  681. else
  682. > _shar_wnt_.tmp
  683. echo 'x - extracting XDtree (Text)'
  684. sed 's/^X//' << 'SHAR_EOF' > 'XDtree' &&
  685. #
  686. # app-defaults file for xdtree
  687. #
  688. xdtree*geometry:                     585x600
  689. xdtree*dir.background:               Red
  690. xdtree*file.background:              Gray
  691. xdtree*sym_link.background:          Brown
  692. xdtree*quit.background:              DarkSlateBlue
  693. xdtree*options.background:           Red
  694. xdtree*XmGraph*childSpacing:         50              #distance between levels
  695. !Mwm*XDtree*iconImage:                /usr/local/include/X11/bitmaps/xdtree-i.h
  696. Vuewm*XDtree*iconImage:                /usr/local/include/X11/bitmaps/xdtree-i.h
  697. !Hpwm*XDtree*iconImage:               /usr/local/include/X11/bitmaps/xdtree-i.h
  698. !xdtree*lpdest:              rljet           #Printer destination
  699. !xdtree*editor:                      emacsclient     #window-clever editor
  700. !xdtree*sym_link.foreground:    
  701. SHAR_EOF
  702. chmod 0644 XDtree ||
  703. echo 'restore of XDtree failed'
  704. Wc_c="`wc -c < 'XDtree'`"
  705. test 785 -eq "$Wc_c" ||
  706.     echo 'XDtree: original size 785, current size' "$Wc_c"
  707. rm -f _shar_wnt_.tmp
  708. fi
  709. # ============= xdtree-i.h ==============
  710. if test -f 'xdtree-i.h' -a X"$1" != X"-c"; then
  711.     echo 'x - skipping xdtree-i.h (File already exists)'
  712.     rm -f _shar_wnt_.tmp
  713. else
  714. > _shar_wnt_.tmp
  715. echo 'x - extracting xdtree-i.h (Text)'
  716. sed 's/^X//' << 'SHAR_EOF' > 'xdtree-i.h' &&
  717. #define load_i_width 50
  718. #define load_i_height 50
  719. static char load_i_bits[] = {
  720. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  721. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  722. X   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x20,
  723. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10,
  724. X   0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
  725. X   0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
  726. X   0x00, 0xf8, 0x0f, 0x10, 0x00, 0x20, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
  727. X   0x20, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, 0x20, 0x00, 0x00, 0x0f, 0x08,
  728. X   0x00, 0x00, 0x20, 0x00, 0x00, 0x09, 0x08, 0x10, 0x00, 0x20, 0x00, 0x80,
  729. X   0x08, 0x08, 0x00, 0x00, 0x20, 0x00, 0x80, 0xf8, 0x0f, 0x10, 0x00, 0x20,
  730. X   0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x10,
  731. X   0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00,
  732. X   0x00, 0x10, 0x00, 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfe,
  733. X   0x13, 0xfe, 0xe3, 0x17, 0x00, 0x20, 0x02, 0x0a, 0x02, 0x22, 0x04, 0x00,
  734. X   0x20, 0xaa, 0x0a, 0x56, 0x23, 0x14, 0x00, 0x20, 0x02, 0xfe, 0x03, 0x3e,
  735. X   0x04, 0x00, 0x20, 0xaa, 0x0a, 0xaa, 0x22, 0x14, 0x00, 0x20, 0x02, 0x0a,
  736. X   0x02, 0x22, 0x04, 0x00, 0x20, 0xfe, 0x13, 0xfe, 0xe3, 0x17, 0x00, 0x20,
  737. X   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x10,
  738. X   0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40, 0xf8,
  739. X   0x0f, 0x10, 0x00, 0x20, 0x00, 0x40, 0x08, 0x08, 0x00, 0x00, 0x20, 0x00,
  740. X   0x80, 0x08, 0x08, 0x10, 0x00, 0x20, 0x00, 0x80, 0x08, 0x08, 0x00, 0x00,
  741. X   0x20, 0x00, 0x00, 0x0f, 0x08, 0x10, 0x00, 0x20, 0x00, 0x00, 0x08, 0x08,
  742. X   0x00, 0x00, 0x20, 0x00, 0x00, 0xf8, 0x0f, 0x10, 0x00, 0x20, 0x00, 0x00,
  743. X   0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20,
  744. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10,
  745. X   0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x55, 0x55, 0x55,
  746. X   0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  747. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  748. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  749. X   0x00, 0x00};
  750. SHAR_EOF
  751. chmod 0644 xdtree-i.h ||
  752. echo 'restore of xdtree-i.h failed'
  753. Wc_c="`wc -c < 'xdtree-i.h'`"
  754. test 2270 -eq "$Wc_c" ||
  755.     echo 'xdtree-i.h: original size 2270, current size' "$Wc_c"
  756. rm -f _shar_wnt_.tmp
  757. fi
  758. # ============= Imakefile ==============
  759. if test -f 'Imakefile' -a X"$1" != X"-c"; then
  760.     echo 'x - skipping Imakefile (File already exists)'
  761.     rm -f _shar_wnt_.tmp
  762. else
  763. > _shar_wnt_.tmp
  764. echo 'x - extracting Imakefile (Text)'
  765. sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
  766. #Imakefile to create dtree using the "tree" widget.
  767. X
  768. X        DEFINES = -DSTATS -DNEWDIR -DSYSV
  769. LOCAL_LIBRARIES = 
  770. X  SYS_LIBRARIES = -lmalloc -lXm -lXt -lX11 -lm
  771. X           SRCS = xdtree.c Tree.c
  772. X           OBJS = xdtree.o Tree.o
  773. X
  774. ComplexProgramTarget(xdtree)
  775. X
  776. X
  777. SHAR_EOF
  778. chmod 0644 Imakefile ||
  779. echo 'restore of Imakefile failed'
  780. Wc_c="`wc -c < 'Imakefile'`"
  781. test 261 -eq "$Wc_c" ||
  782.     echo 'Imakefile: original size 261, current size' "$Wc_c"
  783. rm -f _shar_wnt_.tmp
  784. fi
  785. # ============= README ==============
  786. if test -f 'README' -a X"$1" != X"-c"; then
  787.     echo 'x - skipping README (File already exists)'
  788.     rm -f _shar_wnt_.tmp
  789. else
  790. > _shar_wnt_.tmp
  791. echo 'x - extracting README (Text)'
  792. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  793. xdtree is an extension of dtree,  the program originally
  794. written by Dave Borman. It is very similar to my old "dtree" I posted
  795. in comp.sources.x in 1990, but it has a new user interface, and I
  796. changed the name to xdtree to avoid any confusion with the original program.
  797. It displays on a terminal or under X11
  798. (using Motif widgets) the tree structure of a Unix directory tree.
  799. On a color terminal, different colors can be used for files, directories,
  800. and symbolic links. On a monochrome terminal, one may try to use
  801. different button bitmaps for files and directories using the PushButton
  802. resources.
  803. One can select nodes of the tree, and edit them,
  804. view them, or print them. One can also traverse nodes not fully
  805. shown on the original tree.
  806. X
  807. The program uses the "tree" widget described in D. Young's book on
  808. XX window programming (code included here).
  809. X
  810. Potential problem: because xdtree creates a PushButton widget for every file
  811. or directory shown, you may run out of memory. It is recommended that you
  812. start with a moderate size tree, and create new ones as needed.
  813. Experience will show how much you can push it!!
  814. If you have a monochrome monitor, you may want to substitute those
  815. widgets with gadgets.
  816. X
  817. For example: xdtree -l 2
  818. will show the tree of your current directory up to depth 2.
  819. X         xdtree -al 2
  820. will show both files and directories up to depth 2.
  821. X
  822. 4/29/92
  823. K. Konstantinides
  824. HP Labs
  825. kk@hpkronos.hpl.hp.com
  826. SHAR_EOF
  827. chmod 0644 README ||
  828. echo 'restore of README failed'
  829. Wc_c="`wc -c < 'README'`"
  830. test 1418 -eq "$Wc_c" ||
  831.     echo 'README: original size 1418, current size' "$Wc_c"
  832. rm -f _shar_wnt_.tmp
  833. fi
  834. # ============= Tree.c ==============
  835. if test -f 'Tree.c' -a X"$1" != X"-c"; then
  836.     echo 'x - skipping Tree.c (File already exists)'
  837.     rm -f _shar_wnt_.tmp
  838. else
  839. > _shar_wnt_.tmp
  840. echo 'x - extracting Tree.c (Text)'
  841. sed 's/^X//' << 'SHAR_EOF' > 'Tree.c' &&
  842. /**********************************************************************************
  843. X  * Tree.c: The Tree Widget Source File
  844. X  *         From:
  845. X  *                   The X Window System, 
  846. X  *            Programming and Applications with Xt
  847. X  *                   OSF/Motif Edition
  848. X  *         by
  849. X  *                Douglas Young
  850. X  *              Prentice Hall, 1990
  851. X  *
  852. X  *                 Example described on pages: 397-419
  853. X  *
  854. X  *
  855. X  *  Copyright 1989 by Prentice Hall
  856. X  *  All Rights Reserved
  857. X  *
  858. X  * This code is based on the OSF/Motif widget set and the X Window System
  859. X  *
  860. X  * Permission to use, copy, modify, and distribute this software for 
  861. X  * any purpose and without fee is hereby granted, provided that the above
  862. X  * copyright notice appear in all copies and that both the copyright notice
  863. X  * and this permission notice appear in supporting documentation.
  864. X  *
  865. X  * Prentice Hall and the author disclaim all warranties with regard to 
  866. X  * this software, including all implied warranties of merchantability and fitness.
  867. X  * In no event shall Prentice Hall or the author be liable for any special,
  868. X  * indirect or cosequential damages or any damages whatsoever resulting from 
  869. X  * loss of use, data or profits, whether in an action of contract, negligence 
  870. X  * or other tortious action, arising out of or in connection with the use 
  871. X  * or performance of this software.
  872. X  *
  873. X  * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
  874. X  * OSF is a trademark of Open Software Foundation, Inc.
  875. X  * OSF/Motif is a trademark of Open Software Foundation, Inc.
  876. X  * Motif is a trademark of Open Software Foundation, Inc.
  877. X  * DEC is a registered trademark of Digital Equipment Corporation
  878. X  * HP is a registered trademark of the Hewlett Packard Company
  879. X  * DIGITAL is a registered trademark of Digital Equipment Corporation
  880. X  * X Window System is a trademark of the Massachusetts Institute of Technology
  881. X  **********************************************************************************/
  882. X
  883. X
  884. #include      <X11/Intrinsic.h>
  885. #include      <X11/IntrinsicP.h>
  886. #include      <X11/StringDefs.h>
  887. #include      <X11/CoreP.h>
  888. #include      <X11/CompositeP.h>
  889. #include      <X11/ConstrainP.h>
  890. #include      "Tree.h"
  891. #include      "TreeP.h"
  892. #define   MAX(a,b) ((a) > (b) ? (a) : (b))
  893. X
  894. static void             Initialize();
  895. static void             ConstraintInitialize();
  896. static void             ConstraintDestroy();
  897. static Boolean          ConstraintSetValues();
  898. static Boolean          SetValues();
  899. static XtGeometryResult GeometryManager();
  900. static void             ChangeManaged();
  901. static void             insert_new_node();
  902. static void             delete_node();
  903. static void             new_layout();
  904. static void             Redisplay();
  905. static TreeOffsetPtr    create_offset();
  906. static int              compute_positions();
  907. static void             shift_subtree();
  908. static void             set_positions();
  909. static void             reset();
  910. static Position         current_position();
  911. static void             set_current_position();
  912. static Position         sum_of_positions();
  913. X
  914. static XtResource resources[] = {
  915. X {XtNhorizontalSpace,XtCSpace,XtRDimension,sizeof(Dimension),
  916. X   XtOffset(XsTreeWidget, tree.h_min_space), XtRString,"15" },
  917. X {XtNverticalSpace,XtCSpace, XtRDimension,sizeof (Dimension),
  918. X   XtOffset(XsTreeWidget, tree.v_min_space), XtRString,"5"  },
  919. X {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel),
  920. X  XtOffset(XsTreeWidget, tree.foreground), XtRString,"Black"},
  921. };
  922. X
  923. static XtResource treeConstraintResources[] = {
  924. X {XtNsuperNode, XtCSuperNode, XtRPointer, sizeof(Widget),
  925. X   XtOffset(TreeConstraints, tree.super_node),
  926. X   XtRPointer, NULL},
  927. };
  928. X
  929. XXsTreeClassRec XstreeClassRec = {
  930. X  {
  931. X    /* core_class fields  */
  932. X    (WidgetClass) &constraintClassRec,/* superclass         */
  933. X    "Tree",                           /* class_name         */
  934. X    sizeof(XsTreeRec),                /* widget_size        */
  935. X    NULL,                             /* class_init         */
  936. X    NULL,                             /* class_part_init    */
  937. X    FALSE,                            /* class_inited       */    
  938. X    Initialize,                       /* initialize         */
  939. X    NULL,                             /* initialize_hook    */    
  940. X    XtInheritRealize,                 /* realize            */
  941. X    NULL,                             /* actions            */
  942. X    0,                                /* num_actions        */    
  943. X    resources,                        /* resources          */
  944. X    XtNumber(resources),              /* num_resources      */
  945. X    NULLQUARK,                        /* xrm_class          */
  946. X    TRUE,                             /* compress_motion    */    
  947. X    TRUE,                             /* compress_exposure  */    
  948. X    TRUE,                             /* compress_enterleave*/    
  949. X    TRUE,                             /* visible_interest   */
  950. X    NULL,                             /* destroy            */
  951. X    NULL,                             /* resize             */
  952. X    Redisplay,                        /* expose             */
  953. X    SetValues,                        /* set_values         */
  954. X    NULL,                             /* set_values_hook    */    
  955. X    XtInheritSetValuesAlmost,         /* set_values_almost  */
  956. X    NULL,                             /* get_values_hook    */    
  957. X    NULL,                             /* accept_focus       */
  958. X    XtVersion,                        /* version            */    
  959. X    NULL,                             /* callback_private   */
  960. X    NULL,                             /* tm_table           */
  961. X    NULL,                             /* query_geometry     */    
  962. X    NULL,                             /* display_accelerator*/
  963. X    NULL,                             /* extension          */
  964. X  },
  965. X  {
  966. X    /* composite_class fields */
  967. X    GeometryManager,                 /* geometry_manager    */
  968. X    ChangeManaged,                   /* change_managed      */
  969. X    XtInheritInsertChild,            /* insert_child        */    
  970. X    XtInheritDeleteChild,            /* delete_child        */    
  971. X    NULL,                            /* extension           */
  972. X  },
  973. X  { 
  974. X    /* constraint_class fields */
  975. X   treeConstraintResources,          /* subresources        */
  976. X   XtNumber(treeConstraintResources),/* subresource_count   */
  977. X   sizeof(TreeConstraintsRec),       /* constraint_size     */
  978. X   ConstraintInitialize,             /* initialize          */
  979. X   ConstraintDestroy,                /* destroy             */
  980. X   ConstraintSetValues,              /* set_values          */
  981. X   NULL,                             /* extension           */
  982. X   },
  983. X  {
  984. X    /* Tree class fields */
  985. X    0,                               /* ignore              */    
  986. X  }
  987. };
  988. X
  989. WidgetClass XstreeWidgetClass = (WidgetClass) &XstreeClassRec;
  990. X
  991. static void Initialize(request, new)
  992. X    XsTreeWidget request, new;
  993. {
  994. X  Arg       wargs[2];
  995. X  XGCValues values;
  996. X  XtGCMask  valueMask;
  997. X  /*
  998. X   * Make sure the widget's width and height are 
  999. X   * greater than zero.
  1000. X   */
  1001. X  if (request->core.width <= 0)
  1002. X    new->core.width = 5;
  1003. X  if (request->core.height <= 0)
  1004. X    new->core.height = 5;
  1005. X  /*
  1006. X   * Create a graphics context for the connecting lines.
  1007. X   */
  1008. X  valueMask = GCForeground | GCBackground;
  1009. X  values.foreground = new->tree.foreground;
  1010. X  values.background = new->core.background_pixel;
  1011. X  new->tree.gc = XtGetGC (new, valueMask, &values);  
  1012. X  /*
  1013. X   * Create the hidden root widget.
  1014. X   */
  1015. X  new->tree.tree_root = (Widget) NULL;
  1016. X  XtSetArg(wargs[0], XtNwidth, 1);
  1017. X  XtSetArg(wargs[1], XtNheight, 1);
  1018. X  new->tree.tree_root = 
  1019. X          XtCreateWidget("root", widgetClass, new, wargs, 2);
  1020. X  /*
  1021. X   * Allocate the tables used by the layout
  1022. X   * algorithm.
  1023. X   */
  1024. X  new->tree.horizontal = create_offset(10);
  1025. X  new->tree.vertical   = create_offset(10);
  1026. X
  1027. static void ConstraintInitialize(request, new)
  1028. X     Widget request, new;
  1029. {
  1030. X  TreeConstraints tree_const = TREE_CONSTRAINT(new);
  1031. X  XsTreeWidget tw = (XsTreeWidget) new->core.parent;
  1032. X  /*
  1033. X   * Initialize the widget to have no sub-nodes.
  1034. X   */
  1035. X  tree_const->tree.n_sub_nodes = 0;
  1036. X  tree_const->tree.max_sub_nodes = 0;
  1037. X  tree_const->tree.sub_nodes = (WidgetList) NULL;
  1038. X  tree_const->tree.x = tree_const->tree.y = 0; 
  1039. X  /*
  1040. X   * If this widget has a super-node, add it to that 
  1041. X   * widget' sub-nodes list. Otherwise make it a sub-node of 
  1042. X   * the tree_root widget.
  1043. X   */
  1044. X  if(tree_const->tree.super_node)
  1045. X    insert_new_node(tree_const->tree.super_node, new);
  1046. X  else
  1047. X    if(tw->tree.tree_root)
  1048. X      insert_new_node(tw->tree.tree_root, new);
  1049. X
  1050. static Boolean SetValues(current, request, new)
  1051. X    XsTreeWidget current, request, new;
  1052. {
  1053. X int       redraw = FALSE;
  1054. X XGCValues values;
  1055. X XtGCMask  valueMask;
  1056. X /*
  1057. X  * If the foreground color has changed, redo the GC's
  1058. X  * and indicate a redraw.
  1059. X  */
  1060. X if (new->tree.foreground != current->tree.foreground ||
  1061. X     new->core.background_pixel !=
  1062. X                           current->core.background_pixel){
  1063. X   valueMask         = GCForeground | GCBackground;
  1064. X   values.foreground = new->tree.foreground;
  1065. X   values.background = new->core.background_pixel;
  1066. X   XtReleaseGC(new, new->tree.gc);
  1067. X   new->tree.gc    = XtGetGC (new, valueMask, &values);   
  1068. X   redraw = TRUE;     
  1069. X }
  1070. X /*
  1071. X  * If the minimum spacing has changed, recalculate the
  1072. X  * tree layout. new_layout() does a redraw, so we don't
  1073. X  * need SetValues to do another one.
  1074. X  */
  1075. X if (new->tree.v_min_space != current->tree.v_min_space ||
  1076. X     new->tree.h_min_space != current->tree.h_min_space){ 
  1077. X   new_layout(new);
  1078. X   redraw = FALSE;
  1079. X }
  1080. X return (redraw);
  1081. }
  1082. X
  1083. static Boolean ConstraintSetValues(current, request, new)
  1084. X    Widget current, request, new;
  1085. {
  1086. X TreeConstraints newconst = TREE_CONSTRAINT(new);
  1087. X TreeConstraints current_const = TREE_CONSTRAINT(current);
  1088. X XsTreeWidget tw = (XsTreeWidget) new->core.parent;
  1089. X /*
  1090. X  * If the super_node field has changed, remove the widget
  1091. X  * from the old widget's sub_nodes list and add it to the
  1092. X  * new one.
  1093. X  */
  1094. X if(current_const->tree.super_node !=
  1095. X                                  newconst->tree.super_node){
  1096. X   if(current_const->tree.super_node)
  1097. X     delete_node(current_const->tree.super_node, new);
  1098. X   if(newconst->tree.super_node)
  1099. X     insert_new_node(newconst->tree.super_node, new);
  1100. X   /*
  1101. X    * If the Tree widget has been realized, 
  1102. X    * compute new layout.
  1103. X    */
  1104. X   if(XtIsRealized(tw))
  1105. X     new_layout(tw);
  1106. X  }               
  1107. X  return (False);
  1108. }
  1109. X
  1110. static void insert_new_node(super_node, node)
  1111. X     Widget super_node, node;
  1112. {
  1113. X  TreeConstraints super_const = TREE_CONSTRAINT(super_node);
  1114. X  TreeConstraints node_const = TREE_CONSTRAINT(node);
  1115. X  int index = super_const->tree.n_sub_nodes;
  1116. X  
  1117. X  node_const->tree.super_node = super_node;
  1118. X  /*
  1119. X   * If there is no more room in the sub_nodes array, 
  1120. X   * allocate additional space.
  1121. X   */  
  1122. X  if(super_const->tree.n_sub_nodes ==
  1123. X                             super_const->tree.max_sub_nodes){
  1124. X    super_const->tree.max_sub_nodes += 
  1125. X                    (super_const->tree.max_sub_nodes / 2) + 2;
  1126. X    super_const->tree.sub_nodes = 
  1127. X     (WidgetList) XtRealloc(super_const->tree.sub_nodes, 
  1128. X                           (super_const->tree.max_sub_nodes) *
  1129. X                            sizeof(Widget));
  1130. X  } 
  1131. X  /*
  1132. X   * Add the sub_node in the next available slot and 
  1133. X   * increment the counter.
  1134. X   */
  1135. X  super_const->tree.sub_nodes[index] = node;
  1136. X  super_const->tree.n_sub_nodes++;
  1137. }
  1138. X
  1139. static void delete_node(super_node, node)
  1140. X    Widget  super_node, node;
  1141. {
  1142. X  TreeConstraints node_const = TREE_CONSTRAINT(node);
  1143. X  TreeConstraints super_const;
  1144. X  int             pos, i;
  1145. X  /*
  1146. X   * Make sure the super_node exists.
  1147. X   */
  1148. X  if(!super_node) return;  
  1149. X  
  1150. X  super_const = TREE_CONSTRAINT(super_node);
  1151. X  /*
  1152. X   * Find the sub_node on its super_node's list.
  1153. X   */
  1154. X  for (pos = 0; pos < super_const->tree.n_sub_nodes; pos++)
  1155. X    if (super_const->tree.sub_nodes[pos] == node)
  1156. X      break;
  1157. X  if (pos == super_const->tree.n_sub_nodes) return;
  1158. X  /*
  1159. X   * Decrement the number of sub_nodes
  1160. X   */  
  1161. X  super_const->tree.n_sub_nodes--;
  1162. X  /*
  1163. X   * Fill in the gap left by the sub_node.
  1164. X   * Zero the last slot for good luck.
  1165. X   */
  1166. X  for (i = pos; i < super_const->tree.n_sub_nodes; i++) 
  1167. X    super_const->tree.sub_nodes[i] = 
  1168. X                            super_const->tree.sub_nodes[i+1];
  1169. X super_const->tree.sub_nodes[super_const->tree.n_sub_nodes]=0;
  1170. }
  1171. X
  1172. static void ConstraintDestroy(w) 
  1173. #ifdef JUST_LIKE_BOOK  /* Unimportant but perhaps confusing */
  1174. X     XsTreeWidget w;
  1175. #else
  1176. X     Widget w;
  1177. #endif
  1178. X  TreeConstraints tree_const = TREE_CONSTRAINT(w);
  1179. X  int i;
  1180. X /* 
  1181. X  * Remove the widget from its parent's sub-nodes list and
  1182. X  * make all this widget's sub-nodes sub-nodes of the parent.
  1183. X  */
  1184. X  if(tree_const->tree.super_node) { 
  1185. X    delete_node(tree_const->tree.super_node, w);
  1186. X    for(i=0;i< tree_const->tree.n_sub_nodes; i++)
  1187. X      insert_new_node(tree_const->tree.super_node, 
  1188. X                      tree_const->tree.sub_nodes[i]);
  1189. X  }
  1190. X  new_layout(w->core.parent);
  1191. }
  1192. X
  1193. static XtGeometryResult GeometryManager(w, request, reply)
  1194. X    Widget               w;
  1195. X    XtWidgetGeometry    *request;
  1196. X    XtWidgetGeometry    *reply;
  1197. {
  1198. X
  1199. X XsTreeWidget tw = (XsTreeWidget) w->core.parent;
  1200. X /*
  1201. X  * No position changes allowed!.
  1202. X  */
  1203. X if ((request->request_mode & CWX && request->x!=w->core.x)
  1204. X     ||(request->request_mode & CWY && request->y!=w->core.y))
  1205. X  return (XtGeometryNo);
  1206. X /*
  1207. X  * Allow all resize requests.
  1208. X  */
  1209. X if (request->request_mode & CWWidth)
  1210. X   w->core.width = request->width;
  1211. X if (request->request_mode & CWHeight)
  1212. X   w->core.height = request->height;
  1213. X if (request->request_mode & CWBorderWidth)
  1214. X   w->core.border_width = request->border_width;
  1215. X /*
  1216. X  *  Compute the new layout based on the new widget sizes;
  1217. X  */
  1218. X new_layout(tw);
  1219. X return (XtGeometryYes);
  1220. }
  1221. X
  1222. static void ChangeManaged(tw)
  1223. X    XsTreeWidget tw;
  1224. {
  1225. X  new_layout(tw);
  1226. }
  1227. X
  1228. X
  1229. static void Redisplay (w, event, region)
  1230. X     XsTreeWidget   w;
  1231. X     XEvent        *event;
  1232. X     Region         region;
  1233. {
  1234. X  int              i, j;
  1235. X  TreeConstraints tree_const;
  1236. X  Widget          child;
  1237. X  /*
  1238. X   * If the Tree widget is visible, visit each managed child.
  1239. X   */
  1240. X  if(w->core.visible)
  1241. X   for (i = 0; i < w -> composite.num_children; i++){
  1242. X     child = w -> composite.children[i];
  1243. X     tree_const = TREE_CONSTRAINT(child);
  1244. X     /*
  1245. X      * Draw a line between the right edge of each widget
  1246. X      * and the left edge of each of its sub_nodes. Don't
  1247. X      * draw lines from the fake tree_root.
  1248. X      */
  1249. X     if(child != w->tree.tree_root && 
  1250. X        tree_const->tree.n_sub_nodes)
  1251. X       for (j = 0; j < tree_const->tree.n_sub_nodes; j++)
  1252. X         XDrawLine(XtDisplay(w), XtWindow(w), 
  1253. X                   w->tree.gc,
  1254. X                   child->core.x + child->core.width, 
  1255. X                   child->core.y + child->core.height / 2,
  1256. X                   tree_const->tree.sub_nodes[j]->core.x,
  1257. X                   tree_const->tree.sub_nodes[j]->core.y + 
  1258. X                tree_const->tree.sub_nodes[j]->core.height/2);
  1259. X    }
  1260. }
  1261. X
  1262. static void new_layout(tw)
  1263. X     XsTreeWidget   tw;
  1264. {
  1265. X  /*
  1266. X   *  Reset the auxiliary tables.
  1267. X   */
  1268. X  reset(tw->tree.vertical);
  1269. X  reset(tw->tree.horizontal);
  1270. X  /*
  1271. X   * Compute each widget's x,y position
  1272. X   */
  1273. X  compute_positions(tw, tw->tree.tree_root, 0);
  1274. X  /*
  1275. X   * Move each widget into place.
  1276. X   */
  1277. X  set_positions(tw, tw->tree.tree_root, 0, 0);
  1278. X  /*
  1279. X   * Trigger a redisplay of the lines connecting nodes.
  1280. X   */
  1281. X  if(XtIsRealized(tw))
  1282. X    XClearArea(XtDisplay(tw), XtWindow(tw), 0, 0, 0, 0, TRUE);
  1283. }
  1284. X
  1285. X static int compute_positions(tw, w, level)
  1286. X     XsTreeWidget tw;
  1287. X     Widget       w;
  1288. X     long         level;
  1289. {
  1290. X Position       current_hpos, current_vpos;
  1291. X int             i, depth = 0;
  1292. X TreeConstraints tree_const = TREE_CONSTRAINT(w);
  1293. X /*
  1294. X  * Get the current positions for this level.
  1295. X  */
  1296. X current_hpos = current_position(tw->tree.horizontal, level);
  1297. X current_vpos = current_position(tw->tree.vertical, level);
  1298. X /*
  1299. X  * Set the current horizontal width to the max widths of all
  1300. X  * widgets at this level.
  1301. X  */
  1302. X set_current_position(tw->tree.horizontal, level, 
  1303. X                      MAX(current_hpos, w->core.width));
  1304. X /*
  1305. X  * If the node has no sub_nodes, just set the vertical 
  1306. X  * position to the next available space.
  1307. X  */
  1308. X if(tree_const->tree.n_sub_nodes == 0){
  1309. X   tree_const->tree.y = current_vpos;
  1310. X }
  1311. X else {
  1312. X   Widget          first_kid, last_kid;
  1313. X   TreeConstraints const1, const2;
  1314. X   Position        top, bottom;
  1315. X  /*
  1316. X   * If the node has sub_nodes, recursively figure the 
  1317. X   * positions of each sub_node.
  1318. X   */
  1319. X   for(i = 0; i < tree_const->tree.n_sub_nodes; i++)
  1320. X    depth = compute_positions(tw, 
  1321. X                              tree_const->tree.sub_nodes[i],
  1322. X                              level + 1);
  1323. X  /*
  1324. X   * Now that the vertical positions of all children are 
  1325. X   * known, find the vertical extent of all sub_nodes.
  1326. X   */
  1327. X  first_kid= tree_const->tree.sub_nodes[0];
  1328. X  last_kid = 
  1329. X   tree_const->tree.sub_nodes[tree_const->tree.n_sub_nodes-1];
  1330. X  const1   = TREE_CONSTRAINT(first_kid);
  1331. X  const2   = TREE_CONSTRAINT(last_kid);
  1332. X  top      = const1->tree.y + first_kid->core.height / 2; 
  1333. X  bottom   = const2->tree.y + last_kid->core.height / 2;
  1334. X  /*
  1335. X   * Set the node's position to the center of its sub_nodes.
  1336. X   */
  1337. X  tree_const->tree.y = (top + bottom)/2 - (w->core.height/ 2);
  1338. X  /*
  1339. X   * If this position is less than the next available 
  1340. X   * position, correct it to be the next available
  1341. X   * position, calculate the amount by which all sub_nodes
  1342. X   * must be shifted, and shift the entire sub-tree.
  1343. X   */
  1344. X   if(tree_const->tree.y < current_vpos){
  1345. X     Dimension offset = current_vpos - tree_const->tree.y;
  1346. X     for(i = 0; i < tree_const->tree.n_sub_nodes; i++)
  1347. X       shift_subtree(tree_const->tree.sub_nodes[i], offset);
  1348. X    /*
  1349. X     * Adjust the next available space at all levels below
  1350. X     * the current level.
  1351. X     */
  1352. X     for(i = level + 1; i <= depth; i++){
  1353. X       Position pos = current_position(tw->tree.vertical, i);
  1354. X       set_current_position(tw->tree.vertical, i, pos+offset);
  1355. X     }
  1356. X     tree_const->tree.y = current_vpos;
  1357. X     }
  1358. X   }
  1359. X /*
  1360. X  * Record the current vertical position at this level.
  1361. X  */
  1362. X  set_current_position(tw->tree.vertical, level,
  1363. X                       tw->tree.v_min_space + 
  1364. X                       tree_const->tree.y + w->core.height);
  1365. X  return (MAX(depth, level));
  1366. }
  1367. X
  1368. static void shift_subtree(w, offset)
  1369. X     Widget     w;
  1370. X     Dimension  offset;
  1371. {
  1372. X  int             i;
  1373. X  TreeConstraints tree_const = TREE_CONSTRAINT(w);
  1374. X  /*
  1375. X   * Shift the node by the offset.
  1376. X   */
  1377. X  tree_const->tree.y += offset; 
  1378. X  /*
  1379. X   * Shift each sub-node into place.
  1380. X   */
  1381. X  for(i=0; i< tree_const->tree.n_sub_nodes; i++)
  1382. X    shift_subtree(tree_const->tree.sub_nodes[i], offset);
  1383. }
  1384. X
  1385. static void set_positions(tw, w, level)
  1386. X     XsTreeWidget tw;
  1387. X     Widget       w;
  1388. X     int          level;
  1389. {
  1390. X int               i;
  1391. X Dimension         replyWidth = 0, replyHeight = 0;
  1392. X XtGeometryResult  result;
  1393. X  
  1394. X if(w){
  1395. X  TreeConstraints tree_const = TREE_CONSTRAINT(w);
  1396. X /*
  1397. X  * Add up the sum of the width's of all nodes to this 
  1398. X  * depth, and use it as the x position.
  1399. X  */
  1400. X  tree_const->tree.x = (level * tw->tree.h_min_space) + 
  1401. X                sum_of_positions(tw->tree.horizontal, level);
  1402. X /*
  1403. X  * Move the widget into position.
  1404. X  */
  1405. X  XtMoveWidget (w, tree_const->tree.x, tree_const->tree.y);
  1406. X /*
  1407. X  * If the widget position plus its width or height doesn't
  1408. X  * fit in the tree, ask if the tree can be resized.
  1409. X  */
  1410. X  if(tw->core.width < tree_const->tree.x + w->core.width ||
  1411. X     tw->core.height < tree_const->tree.y + w->core.height){
  1412. X    result = 
  1413. X      XtMakeResizeRequest(tw, MAX(tw->core.width, 
  1414. X                                  tree_const->tree.x + 
  1415. X                                  w->core.width),
  1416. X                              MAX(tw->core.height, 
  1417. X                                  tree_const->tree.y + 
  1418. X                                  w->core.height),
  1419. X                          &replyWidth, &replyHeight);
  1420. X    /*
  1421. X     * Accept any compromise.
  1422. X     */
  1423. X     if (result == XtGeometryAlmost)
  1424. X       XtMakeResizeRequest (tw, replyWidth, replyHeight, 
  1425. X                             NULL, NULL);
  1426. X  }
  1427. X /*
  1428. X  * Set the positions of all sub_nodes.
  1429. X  */
  1430. X  for(i=0; i< tree_const->tree.n_sub_nodes;i++)
  1431. X    set_positions(tw, tree_const->tree.sub_nodes[i], level+1);
  1432. X  }
  1433. }
  1434. X
  1435. static TreeOffsetPtr create_offset(size)
  1436. X   long size;
  1437. {
  1438. X TreeOffsetPtr  offset = 
  1439. X                 (TreeOffsetPtr) XtMalloc(sizeof(TreeOffset));
  1440. X offset->size = size;
  1441. X offset->array = 
  1442. X             (Dimension *) XtMalloc(size * sizeof(Dimension));
  1443. X return (offset);
  1444. }
  1445. X
  1446. static void reset(offset)
  1447. X   TreeOffsetPtr offset;
  1448. {
  1449. X  long i;
  1450. X  for(i=0; i< offset->size; i++)
  1451. X    offset->array[i] = 0;
  1452. }
  1453. X
  1454. static Position current_position(offset, position)
  1455. X   TreeOffsetPtr  offset;
  1456. X   long          position;
  1457. {
  1458. X  if(position >= offset->size)
  1459. X    return (0);
  1460. X  return (offset->array[position]);
  1461. X }
  1462. X
  1463. static void set_current_position(offset, index, value)
  1464. X   TreeOffsetPtr offset;
  1465. X   int           index;
  1466. X   Dimension     value;
  1467. {
  1468. X if(index >= offset->size){
  1469. X   offset->size = index + index / 2;
  1470. X   offset->array =
  1471. X    (Dimension *) XtRealloc(offset->array, 
  1472. X                            offset->size * sizeof(Dimension));
  1473. X }
  1474. X offset->array[index] = value;
  1475. }
  1476. X
  1477. static Position sum_of_positions(offset, index)
  1478. X   TreeOffsetPtr  offset;
  1479. X   long           index;
  1480. {
  1481. X  int    i;
  1482. X  Position  sum  = 0;
  1483. X  long      stop = index;
  1484. X  if(index > offset->size) 
  1485. X    stop = offset->size;
  1486. X  for (i=0;i < stop; i++)
  1487. X    sum += offset->array[i];
  1488. X  return (sum);
  1489. }
  1490. X
  1491. SHAR_EOF
  1492. chmod 0644 Tree.c ||
  1493. echo 'restore of Tree.c failed'
  1494. Wc_c="`wc -c < 'Tree.c'`"
  1495. test 21424 -eq "$Wc_c" ||
  1496.     echo 'Tree.c: original size 21424, current size' "$Wc_c"
  1497. rm -f _shar_wnt_.tmp
  1498. fi
  1499. # ============= Tree.h ==============
  1500. if test -f 'Tree.h' -a X"$1" != X"-c"; then
  1501.     echo 'x - skipping Tree.h (File already exists)'
  1502.     rm -f _shar_wnt_.tmp
  1503. else
  1504. > _shar_wnt_.tmp
  1505. echo 'x - extracting Tree.h (Text)'
  1506. sed 's/^X//' << 'SHAR_EOF' > 'Tree.h' &&
  1507. /**********************************************************************************
  1508. X * Tree.h: Public header file for the Tree widget
  1509. X  *         From:
  1510. X  *                   The X Window System, 
  1511. X  *            Programming and Applications with Xt
  1512. X  *                   OSF/Motif Edition
  1513. X  *         by
  1514. X  *                Douglas Young
  1515. X  *              Prentice Hall, 1990
  1516. X  *
  1517. X  *                 Example described on pages: 397-419
  1518. X  *
  1519. X  *
  1520. X  *  Copyright 1989 by Prentice Hall
  1521. X  *  All Rights Reserved
  1522. X  *
  1523. X  * This code is based on the OSF/Motif widget set and the X Window System
  1524. X  *
  1525. X  * Permission to use, copy, modify, and distribute this software for 
  1526. X  * any purpose and without fee is hereby granted, provided that the above
  1527. X  * copyright notice appear in all copies and that both the copyright notice
  1528. X  * and this permission notice appear in supporting documentation.
  1529. X  *
  1530. X  * Prentice Hall and the author disclaim all warranties with regard to 
  1531. X  * this software, including all implied warranties of merchantability and fitness.
  1532. X  * In no event shall Prentice Hall or the author be liable for any special,
  1533. X  * indirect or cosequential damages or any damages whatsoever resulting from 
  1534. X  * loss of use, data or profits, whether in an action of contract, negligence 
  1535. X  * or other tortious action, arising out of or in connection with the use 
  1536. X  * or performance of this software.
  1537. X  *
  1538. X  * Open Software Foundation is a trademark of The Open Software Foundation, Inc.
  1539. X  * OSF is a trademark of Open Software Foundation, Inc.
  1540. X  * OSF/Motif is a trademark of Open Software Foundation, Inc.
  1541. X  * Motif is a trademark of Open Software Foundation, Inc.
  1542. X  * DEC is a registered trademark of Digital Equipment Corporation
  1543. X  * HP is a registered trademark of the Hewlett Packard Company
  1544. X  * DIGITAL is a registered trademark of Digital Equipment Corporation
  1545. X  * X Window System is a trademark of the Massachusetts Institute of Technology
  1546. X  **********************************************************************************/
  1547. X
  1548. X
  1549. X
  1550. #ifndef TREE_H
  1551. #define TREE_H
  1552. X
  1553. extern WidgetClass  XstreeWidgetClass;
  1554. X
  1555. typedef struct _XsTreeClassRec *XsTreeWidgetClass;
  1556. typedef struct _XsTreeRec      *XsTreeWidget;
  1557. X
  1558. #define XtNhorizontalSpace    "horizontalSpace"
  1559. #define XtNverticalSpace      "verticalSpace"
  1560. #define XtCPad                "Pad"
  1561. #define XtNsuperNode          "superNode"
  1562. #define XtCSuperNode          "SuperNode"
  1563. X
  1564. #endif TREE_H
  1565. SHAR_EOF
  1566. chmod 0644 Tree.h ||
  1567. echo 'restore of Tree.h failed'
  1568. Wc_c="`wc -c < 'Tree.h'`"
  1569. test 2420 -eq "$Wc_c" ||
  1570.     echo 'Tree.h: original size 2420, current size' "$Wc_c"
  1571. rm -f _shar_wnt_.tmp
  1572. fi
  1573. # ============= TreeP.h ==============
  1574. if test -f 'TreeP.h' -a X"$1" != X"-c"; then
  1575.     echo 'x - skipping TreeP.h (File already exists)'
  1576.     rm -f _shar_wnt_.tmp
  1577. else
  1578. > _shar_wnt_.tmp
  1579. echo 'x - extracting TreeP.h (Text)'
  1580. sed 's/^X//' << 'SHAR_EOF' > 'TreeP.h' &&
  1581. /**********************************************************************************
  1582. SHAR_EOF
  1583. true || echo 'restore of TreeP.h failed'
  1584. fi
  1585. echo 'End of  part 2'
  1586. echo 'File TreeP.h is continued in part 3'
  1587. echo 3 > _shar_seq_.tmp
  1588. exit 0
  1589. -- 
  1590. ---
  1591. Senior Systems Scientist        mail: dcmartin@msi.com
  1592. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1593. 796 North Pastoria Avenue        at&t: 408/522-9236
  1594.