home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume13 / xdtm / part06 < prev    next >
Internet Message Format  |  1991-05-18  |  51KB

  1. Path: uunet!olivea!apple!sun-barr!newstop!exodus!cogs.sussex.ac.uk
  2. From: eddyg@cogs.sussex.ac.uk (EdwardJ. Groenendaal)
  3. Newsgroups: comp.sources.x
  4. Subject: v13i011: xdtm - X Desktop Manager for the X Window System, Part06/11
  5. Message-ID: <13575@exodus.Eng.Sun.COM>
  6. Date: 19 May 91 00:03:18 GMT
  7. References: <csx-13i006:xdtm@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 1376
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: Edward "J." Groenendaal <eddyg@cogs.sussex.ac.uk>
  13. Posting-number: Volume 13, Issue 11
  14. Archive-name: xdtm/part06
  15.  
  16. Submitted-by: eddyg@cste
  17. Archive-name: xdtm/part06
  18.  
  19. ---- Cut Here and feed the following to sh ----
  20. #!/bin/sh
  21. # This is part 06 of xdtm
  22. # ============= xdtm/display.c ==============
  23. if test ! -d 'xdtm'; then
  24.     echo 'x - creating directory xdtm'
  25.     mkdir 'xdtm'
  26. fi
  27. if test -f 'xdtm/display.c' -a X"$1" != X"-c"; then
  28.     echo 'x - skipping xdtm/display.c (File already exists)'
  29. else
  30. echo 'x - extracting xdtm/display.c (Text)'
  31. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/display.c' &&
  32. X/*****************************************************************************
  33. X ** File          : display.c                                               **
  34. X ** Purpose       : Initialise and Realise display and query dialogs        **
  35. X ** Author        : Edward Groenendaal                                      **
  36. X ** Date          : April 1991                                              **
  37. X ** Documentation : Xdtm Design Folder                                      **
  38. X ** Related Files :                                                         **
  39. X *****************************************************************************/
  40. X
  41. X#include "xdtm.h"
  42. X
  43. X#ifndef TRUE_SYSV
  44. X#include <sys/file.h>    /* For access(2) */
  45. X#endif
  46. X
  47. X#include <sys/signal.h>  /* For longjmp */
  48. X#include <setjmp.h>      /* For longjmp */
  49. X
  50. X#include <X11/Shell.h>
  51. X#include <X11/Xaw/Label.h>
  52. X#include <X11/Xaw/Command.h>
  53. X#include <X11/Xaw/AsciiText.h>
  54. X#include "Xedw/XedwForm.h"
  55. X
  56. Xextern void realize_dialog(Widget);
  57. X
  58. X
  59. Xtypedef enum {ViewReturn, CancelReturn} queryReturn;
  60. X
  61. Xpublic String viewfile;
  62. Xprivate jmp_buf env;
  63. X
  64. X/* Widgets */
  65. Xprivate Widget querypopup;      /* For asking whether to display a file */
  66. Xprivate Widget displaypopup;    /* For displaying a file */
  67. Xprivate Widget queryform;
  68. Xprivate Widget displayform;
  69. Xprivate Widget querylabel;
  70. Xprivate Widget displaylabel;
  71. Xprivate Widget queryyes;
  72. Xprivate Widget queryno;
  73. Xprivate Widget displayquit;
  74. Xprivate Widget displaytext;
  75. X
  76. X/*****************************************************************************
  77. X *                               init_query                                  *
  78. X *****************************************************************************/
  79. Xpublic void init_query(Widget top)
  80. X{
  81. X  /* Initialise the query dialog widgets. */
  82. X
  83. X  Arg arglist[5];
  84. X  Cardinal i;
  85. X
  86. X  querypopup = XtCreatePopupShell("querypopup",
  87. X                  transientShellWidgetClass,
  88. X                  top,
  89. X                  NULL, 0);
  90. X
  91. X  queryform  = XtCreateManagedWidget("queryform",
  92. X                     xedwFormWidgetClass,
  93. X                     querypopup,
  94. X                     NULL, 0);
  95. X
  96. X  i = 0;
  97. X  XtSetArg(arglist[i], XtNborderWidth,           0); i++;
  98. X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
  99. X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
  100. X  querylabel = XtCreateManagedWidget("querylabel",
  101. X                     labelWidgetClass,
  102. X                     queryform,
  103. X                     arglist, i);
  104. X  i = 0;
  105. X  XtSetArg(arglist[i], XtNfromVert,     querylabel); i++;
  106. X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
  107. X  queryno    = XtCreateManagedWidget("queryno",
  108. X                     commandWidgetClass,
  109. X                     queryform,
  110. X                     arglist, i);  
  111. X
  112. X  i = 0;
  113. X  XtSetArg(arglist[i], XtNfromVert,     querylabel); i++;
  114. X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
  115. X  XtSetArg(arglist[i], XtNfromHoriz,      queryno); i++;
  116. X  XtSetArg(arglist[i], XtNwidthLinked,    queryno); i++;
  117. X  queryyes   = XtCreateManagedWidget("queryyes",
  118. X                     commandWidgetClass,
  119. X                     queryform,
  120. X                     arglist, i);
  121. X                     
  122. X}
  123. X
  124. X/*****************************************************************************
  125. X *                              init_display                                 *
  126. X *****************************************************************************/
  127. Xpublic void init_display(Widget top)
  128. X{
  129. X  /* Initialise the widgets used for viewing a file */
  130. X
  131. X  private void destroy_display_dialog(Boolean);
  132. X
  133. X  XFontStruct *font;
  134. X  Arg arglist[8];
  135. X  Cardinal i, width, height;
  136. X
  137. X  private String DisplayQuit = "Quit";
  138. X
  139. X  /* Create popup */
  140. X  displaypopup  = XtCreatePopupShell("displaypopup",
  141. X                     transientShellWidgetClass,
  142. X                     top,
  143. X                     NULL, 0);
  144. X  
  145. X  displayform   = XtCreateManagedWidget("displayform",
  146. X                    xedwFormWidgetClass,
  147. X                    displaypopup,
  148. X                    NULL, 0);
  149. X  i = 0;
  150. X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
  151. X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
  152. X  displaylabel  = XtCreateManagedWidget("displaylabel",
  153. X                    labelWidgetClass,
  154. X                    displayform,
  155. X                    arglist, i);
  156. X
  157. X  i = 0;
  158. X  XtSetArg(arglist[i], XtNfont,            app_data.view_font); i++;
  159. X  XtSetArg(arglist[i], XtNfullWidth,                     True); i++;
  160. X  XtSetArg(arglist[i], XtNfromVert,              displaylabel); i++;
  161. X  XtSetArg(arglist[i], XtNscrollVertical, XawtextScrollAlways); i++; 
  162. X  XtSetArg(arglist[i], XtNtype,                  XawAsciiFile); i++;
  163. X  XtSetArg(arglist[i], XtNstring,                 "/dev/null"); i++;
  164. X  XtSetArg(arglist[i], XtNdataCompression,              False); i++;
  165. X  displaytext   = XtCreateManagedWidget("displaytext",
  166. X                    asciiTextWidgetClass,
  167. X                    displayform,
  168. X                    arglist, i);
  169. X
  170. X  /* Get font from text widget, set the width of the widget to the
  171. X   * maximum width of any character in that font multiplied by the
  172. X   * value in the application defaults (default 85),
  173. X   * set the height of the widget to (ascent + descent) * value in the
  174. X   * application defaults (default 25).
  175. X   * 
  176. X   * This gives a default viewing area of 85x25 characters if using a fixed 
  177. X   * width font, wider if using a variable width font.
  178. X   *
  179. X   * Note: The user may override these sizes via the application resources.
  180. X   */
  181. X
  182. X  XtSetArg(arglist[0], XtNfont, &font);
  183. X  XtGetValues(displaytext, arglist, 1);
  184. X
  185. X  width =  (font->max_bounds.width * app_data.view_width);
  186. X  height = ((font->max_bounds.ascent +
  187. X           font->max_bounds.descent) * app_data.view_height);
  188. X
  189. X  i = 0;
  190. X  XtSetArg(arglist[i], XtNwidth,   width); i++;
  191. X  XtSetArg(arglist[i], XtNheight, height); i++;
  192. X  XtSetValues(displaytext, arglist, i);
  193. X
  194. X  i = 0;
  195. X  XtSetArg(arglist[i], XtNlabel,       DisplayQuit); i++;
  196. X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
  197. X  XtSetArg(arglist[i], XtNfromVert,    displaytext); i++;
  198. X  displayquit   = XtCreateManagedWidget("displayquit",
  199. X                    commandWidgetClass,
  200. X                    displayform,
  201. X                    arglist, i);
  202. X                       
  203. X  XtAddCallback(displayquit, XtNcallback, destroy_display_dialog, True);
  204. X
  205. X}
  206. X
  207. X/*****************************************************************************
  208. X *                              query_dialog                                 *
  209. X *****************************************************************************/
  210. Xpublic void query_dialog(String fullname, Boolean Query)
  211. X{    
  212. X  /* Pop the query dialog up onto screen. If Query is true then
  213. X   * the default string is displayed, "View selected File?" and
  214. X   * the callback is linked with the display popup, otherwise
  215. X   * the user supplied string 'fullname' is used, the callback just
  216. X   * unpopup's the popup.
  217. X   * This dialog can be used as a multi-purpose query dialog by using 
  218. X   * this feature.
  219. X   *
  220. X   * - Takes an optional string to display, and a boolean saying whether
  221. X   *   to use the default function or not.
  222. X   */
  223. X
  224. X  private void queryQueryResult(Widget, queryReturn, caddr_t);
  225. X
  226. X  Arg arglist[2];
  227. X  Cardinal i;
  228. X
  229. X  if (Query == True) {
  230. X    /* display query dialog */
  231. X
  232. X    private String QueryLabel = "View selected file?";
  233. X    private String QueryNo    = " Cancel ";
  234. X    private String QueryYes   = "View";
  235. X
  236. X    i = 0;
  237. X    XtSetArg(arglist[i], XtNlabel, QueryLabel); i++;
  238. X    XtSetValues(querylabel, arglist, i);
  239. X
  240. X    i = 0;
  241. X    XtSetArg(arglist[i], XtNsensitive, True); i++;
  242. X    XtSetArg(arglist[i], XtNlabel,  QueryNo); i++;
  243. X    XtSetValues(queryno, arglist, i);
  244. X
  245. X    i = 0;
  246. X    XtSetArg(arglist[i], XtNlabel, QueryYes); i++;
  247. X    XtSetValues(queryyes, arglist, i);
  248. X
  249. X    XtAddCallback(queryyes, XtNcallback, queryQueryResult, ViewReturn);
  250. X    XtAddCallback(queryno,  XtNcallback, queryQueryResult, CancelReturn);
  251. X
  252. X    viewfile = XtNewString(fullname);
  253. X
  254. X  } else {
  255. X    /* display view error dialog */
  256. X
  257. X    private String QueryNo    = " Cancel ";
  258. X    private String QueryYes   = "OK";
  259. X
  260. X    i = 0;
  261. X    XtSetArg(arglist[i], XtNlabel, fullname); i++;
  262. X    XtSetValues(querylabel, arglist, i);
  263. X
  264. X    i = 0;
  265. X    XtSetArg(arglist[i], XtNsensitive, False); i++;
  266. X    XtSetArg(arglist[i], XtNlabel,   QueryNo); i++;
  267. X    XtSetValues(queryno, arglist, i);
  268. X
  269. X    i = 0;
  270. X    XtSetArg(arglist[i], XtNlabel, QueryYes); i++;
  271. X    XtSetValues(queryyes, arglist, i);
  272. X
  273. X    XtAddCallback(queryyes, XtNcallback, queryQueryResult, CancelReturn);
  274. X    XtAddCallback(queryno,  XtNcallback, queryQueryResult, CancelReturn);
  275. X
  276. X    XBell(XtDisplay(displaypopup), 100);
  277. X  }
  278. X  
  279. X  realize_dialog(querypopup);
  280. X
  281. X}
  282. X
  283. X/*****************************************************************************
  284. X *                          destroy_query_dialog                             *
  285. X *****************************************************************************/
  286. Xprivate void destroy_query_dialog(void)
  287. X{
  288. X  /* Popdown the query dialog, remove the callback lists */
  289. X
  290. X  XtPopdown(querypopup);
  291. X  
  292. X  XtRemoveAllCallbacks(queryyes, XtNcallback);
  293. X  XtRemoveAllCallbacks(queryno,  XtNcallback);
  294. X
  295. X}
  296. X
  297. X/* display */
  298. X
  299. X/*****************************************************************************
  300. X *                              displayfile                                  *
  301. X *****************************************************************************/
  302. Xpublic void displayfile(String fullname)
  303. X{
  304. X  /* This procedure popup's a window with the file 'fullname' contained 
  305. X   * within a text widget. When quit is selected the window is popped down.
  306. X   * On my A/UX machine the text widget breaks with a segmentation fault 
  307. X   * if the specified file is not a text file (most of the time), 
  308. X   * therefore rather than check the type of the file
  309. X   * everytime before viewing a file I check for the SIGSEGV signal, 
  310. X   * if this occurs it is assumed that the file is not a text 
  311. X   * file and an error message is displayed, the program continues.
  312. X   *
  313. X   * - Takes the name of the file to be viewed
  314. X   */
  315. X
  316. X  extern void setCursor(Cursor);
  317. X  extern Cursor busy;
  318. X  private void seggie(int);
  319. X  Arg arglist[5];
  320. X  Cardinal i;
  321. X
  322. X  setCursor(busy);
  323. X  signal(SIGSEGV, seggie);
  324. X  if (setjmp(env) == 0) {
  325. X    i = 0;
  326. X    XtSetArg(arglist[i], XtNstring, fullname); i++;
  327. X    XtSetValues(displaytext, arglist, i);
  328. X    i = 0;
  329. X    XtSetArg(arglist[i], XtNlabel,  fullname); i++;
  330. X    XtSetValues(displaylabel, arglist, i);
  331. X
  332. X    setCursor(NULL);
  333. X    realize_dialog(displaypopup);
  334. X  } else {
  335. X    setCursor(NULL);
  336. X    query_dialog("Not a text file!", False);
  337. X  }
  338. X  signal(SIGSEGV, SIG_DFL);
  339. X}
  340. X
  341. X/*****************************************************************************
  342. X *                                 seggie                                    *
  343. X *****************************************************************************/
  344. Xprivate void seggie(int value)
  345. X{
  346. X  /* This procedure is called if a segmentation fault occurs when trying
  347. X   * to view a file. It jumps back to the point immediately before
  348. X   * the text widget tried to load the file and display's an error message.
  349. X   */
  350. X
  351. X  longjmp(env, value);
  352. X}
  353. X
  354. X/*****************************************************************************
  355. X *                        destroy_display_dialog                             *
  356. X *****************************************************************************/
  357. Xprivate void destroy_display_dialog(Boolean destroy)
  358. X{
  359. X  /* Popdown the display popup */
  360. X
  361. X  XtPopdown(displaypopup);
  362. X}
  363. X
  364. X/*****************************************************************************
  365. X *                            queryQueryResult                               *
  366. X *****************************************************************************/
  367. Xprivate void queryQueryResult(Widget w, queryReturn result, caddr_t dummy)
  368. X{
  369. X  /* Pop the query dialog down, if the user asked to view a file then
  370. X   * call display file to view it (if readable).
  371. X   *
  372. X   * -  Takes a result of the button presses, if this is ViewReturn display
  373. X   *    the file, otherwise it is CancelReturn.
  374. X   */
  375. X
  376. X  destroy_query_dialog();
  377. X
  378. X  if (result == ViewReturn) {
  379. X    /* Call display */
  380. X    if (access(viewfile, R_OK) == 0)
  381. X      displayfile(viewfile);
  382. X    else
  383. X      query_dialog("File not readable!", False);
  384. X  } 
  385. X}
  386. X
  387. SHAR_EOF
  388. chmod 0644 xdtm/display.c ||
  389. echo 'restore of xdtm/display.c failed'
  390. Wc_c="`wc -c < 'xdtm/display.c'`"
  391. test 11820 -eq "$Wc_c" ||
  392.     echo 'xdtm/display.c: original size 11820, current size' "$Wc_c"
  393. fi
  394. # ============= xdtm/docs/README ==============
  395. if test ! -d 'xdtm/docs'; then
  396.     echo 'x - creating directory xdtm/docs'
  397.     mkdir 'xdtm/docs'
  398. fi
  399. if test -f 'xdtm/docs/README' -a X"$1" != X"-c"; then
  400.     echo 'x - skipping xdtm/docs/README (File already exists)'
  401. else
  402. echo 'x - extracting xdtm/docs/README (Text)'
  403. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/docs/README' &&
  404. XThe printable documentation for the X Desktop Manager is available
  405. Xonly in Macintosh Word 4 format.
  406. X
  407. XOnly the User's Guide is currently available, to obtain this file
  408. Xyou should mail a request to an automatic mail server running on my
  409. Xaccount. The service is triggered by the string "-SUIS-" in the 
  410. XSubject line of your message.
  411. X
  412. XTo obtain the index of xdtm files available:
  413. X
  414. X% mail eddyg@cogs.sussex.ac.uk
  415. XTo: eddyg@cogs.sussex.ac.uk
  416. XSubject: -SUIS-
  417. X
  418. XRequest: xdtm
  419. XTopic: index
  420. XRequest: end
  421. X
  422. X^D
  423. X
  424. XTo obtain the xdtm User's Guide:
  425. X
  426. XRequest: xdtm
  427. XTopic: xdtm.hqx.01
  428. XTopic: xdtm.hqx.02
  429. XTopic: xdtm.hqx.03
  430. XTopic: xdtm.hqx.04
  431. XRequest: end
  432. X
  433. X
  434. SHAR_EOF
  435. chmod 0644 xdtm/docs/README ||
  436. echo 'restore of xdtm/docs/README failed'
  437. Wc_c="`wc -c < 'xdtm/docs/README'`"
  438. test 637 -eq "$Wc_c" ||
  439.     echo 'xdtm/docs/README: original size 637, current size' "$Wc_c"
  440. fi
  441. # ============= xdtm/fileman.c ==============
  442. if test -f 'xdtm/fileman.c' -a X"$1" != X"-c"; then
  443.     echo 'x - skipping xdtm/fileman.c (File already exists)'
  444. else
  445. echo 'x - extracting xdtm/fileman.c (Text)'
  446. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/fileman.c' &&
  447. X/*****************************************************************************
  448. X ** File          : fileman.c                                               **
  449. X ** Purpose       : Receive and distribute directory changes                **
  450. X ** Author        : Edward Groenendaal                                      **
  451. X ** Date          : 18th Feb 1991                                           **
  452. X ** Documentation : Xdtm Design Folder                                      **
  453. X ** Related Files : treeman.c, dirman.c, pathman.c, main.c                  **
  454. X *****************************************************************************/
  455. X
  456. X#include "xdtm.h"
  457. X
  458. X#include <X11/Xaw/AsciiText.h>
  459. X#include <X11/Xaw/Command.h>
  460. X#include <X11/Xaw/Paned.h>
  461. X#include <X11/Xaw/Viewport.h>
  462. X#include <X11/cursorfont.h>
  463. X
  464. X#include "Xedw/XedwForm.h"
  465. X
  466. Xpublic Widget vert_bar;
  467. Xpublic Widget dirSelector;
  468. Xpublic Cursor busy, left_ptr;
  469. Xpublic Widget directoryManagerView;
  470. X
  471. Xpublic void setCursor(Cursor);
  472. X
  473. X/*****************************************************************************
  474. X *                        createFileManagerWidgets                           *
  475. X *****************************************************************************/
  476. Xpublic void createFileManagerWidgets(Widget w)
  477. X{
  478. X  /* Create file manager widgets, this includes directory manager, 
  479. X   * directory selector and may in the future include the tree manager
  480. X   * which displays a tree structure representing the file system
  481. X   */
  482. X
  483. X  private void GotoDir(Widget, XButtonEvent*);
  484. X  private void goto_dir(Widget, caddr_t, caddr_t);
  485. X
  486. X  Widget fileManagerPane, treeManagerView;
  487. X  Widget dirSelectorForm, dirButton, dirLabel;
  488. X  extern Widget menuBar;
  489. X  Arg arglist[6], *newlist;
  490. X  Cardinal i;
  491. X  XtTranslations dirSelTranslations;
  492. X
  493. X  static XtActionsRec actions[] = {
  494. X    {"GotoDir",  GotoDir},
  495. X    {NULL, NULL}
  496. X  };
  497. X
  498. X
  499. X  static char defaultTranslations[] = 
  500. X    "Ctrl<Key>A:        beginning-of-line() \n\
  501. X     Ctrl<Key>E:        end-of-line() \n\
  502. X     <Key>Return:       GotoDir() \n\
  503. X     <Key>Escape:       beginning-of-line() kill-to-end-of-line() \n\
  504. X     <Key>Right:     forward-character() \n\
  505. X     <Key>Left:         backward-character() \n\
  506. X     <Key>Delete:       delete-previous-character() \n\
  507. X     <Key>BackSpace:    delete-previous-character() \n\
  508. X     <Key>:             insert-char() \n\
  509. X     <FocusIn>:         focus-in() \n\
  510. X     <FocusOut>:        focus-out() \n\
  511. X     <BtnDown>:         select-start()";
  512. X
  513. X  i = 0;
  514. X  XtSetArg(arglist[i], XtNfromVert,                               menuBar); i++;
  515. X  XtSetArg(arglist[i], XtNfullHeight,                                True); i++;
  516. X  XtSetArg(arglist[i], XtNfullWidth,                                 True); i++;
  517. X  XtSetArg(arglist[i], XtNfromHoriz, XtNameToWidget(w, "appManagerButton"));i++;
  518. X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
  519. X  fileManagerPane         =   XtCreateManagedWidget("fileManagerPane",
  520. X                            panedWidgetClass,
  521. X                            w,
  522. X                            newlist, i + chain_size);
  523. X  
  524. X  XtFree(newlist);
  525. X
  526. X/* Here is the hook onto which the tree manager will fit.
  527. X *  
  528. X *  i = 0;
  529. X *  XtSetArg(arglist[i], XtNforceBars, True); i++;
  530. X *  XtSetArg(arglist[i], XtNallowVert, True); i++;
  531. X *  XtSetArg(arglist[i], XtNallowHoriz, True); i++;
  532. X *  treeManagerView         =   XtCreateManagedWidget("treeManagerView",
  533. X *                             viewportWidgetClass,
  534. X *                             fileManagerPane,
  535. X *                             arglist, i);
  536. X */
  537. X
  538. X  i = 0;
  539. X  XtSetArg(arglist[i], XtNforceBars, True); i++;
  540. X  XtSetArg(arglist[i], XtNallowVert, True); i++;
  541. X  directoryManagerView    =   XtCreateManagedWidget("directoryManagerView",
  542. X                            viewportWidgetClass,
  543. X                            fileManagerPane,
  544. X                            arglist, i);
  545. X  
  546. X  createDirectoryManagerWidgets(directoryManagerView);
  547. X  /* createTreeManagerWidgets(treeManagerView); */
  548. X
  549. X  /* Create text widget */
  550. X
  551. X  i = 0;
  552. X  XtSetArg(arglist[i], XtNrubberHeight,   False); i++;
  553. X  XtSetArg(arglist[i], XtNrubberWidth,    False); i++;
  554. X  XtSetArg(arglist[i], XtNfromHoriz,    menuBar); i++; 
  555. X  XtSetArg(arglist[i], XtNborderWidth,        0); i++;
  556. X  XtSetArg(arglist[i], XtNlabel,        "Goto:"); i++;
  557. X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
  558. X  dirButton               =   XtCreateManagedWidget("dirButton",
  559. X                                                    commandWidgetClass,
  560. X                            w,
  561. X                            newlist, i + chain_size);
  562. X                                              
  563. X  XtFree(newlist);
  564. X
  565. X  i = 0;
  566. X  XtSetArg(arglist[i], XtNrubberHeight,    False); i++;
  567. X  XtSetArg(arglist[i], XtNfullWidth,        True); i++;
  568. X  XtSetArg(arglist[i], XtNfromHoriz,   dirButton); i++;
  569. X  XtSetArg(arglist[i], XtNeditType,  XawtextEdit); i++;
  570. X  XtSetArg(arglist[i], XtNborderWidth,         0); i++;
  571. X  XtSetArg(arglist[i], XtNvertDistance,        6); i++;
  572. X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
  573. X  dirSelector            =   XtCreateManagedWidget("dirSelector",
  574. X                            asciiTextWidgetClass,
  575. X                            w,
  576. X                            newlist, i + chain_size);
  577. X  XtFree(newlist);
  578. X  XtAddCallback(dirButton, XtNcallback, goto_dir, 0);
  579. X  XtAddActions(actions, XtNumber(actions));
  580. X  XtUninstallTranslations(dirSelector);
  581. X  dirSelTranslations = XtParseTranslationTable(defaultTranslations);
  582. X  XtOverrideTranslations(dirSelector, dirSelTranslations); 
  583. X  
  584. X }
  585. X
  586. X/*****************************************************************************
  587. X *                           initFileManager                                 *
  588. X *****************************************************************************/
  589. Xpublic void initFileManager(Widget w)
  590. X{
  591. X  /* initialise file management bits */
  592. X
  593. X  extern void initDirectoryManager(void);         /* dirman.c */
  594. X  /* extern void initTreeManager(void); */
  595. X  busy     = XCreateFontCursor(XtDisplay(w), XC_watch);
  596. X  left_ptr = XCreateFontCursor(XtDisplay(w), XC_left_ptr);
  597. X
  598. X  /* Check what should be mapped, unmapping those that shouldn't */
  599. X
  600. X  initDirectoryManager();
  601. X  /* initTreeManager(); */
  602. X}
  603. X
  604. X/*****************************************************************************
  605. X *                                                                           *
  606. X *****************************************************************************/
  607. Xprivate void GotoDir(Widget w, XButtonEvent *event)
  608. X{
  609. X  /* Goto directory, this is an action called in reponse to the key return
  610. X   * within the directory selector. 
  611. X   */
  612. X
  613. X  private goto_dir(Widget, caddr_t, caddr_t);
  614. X
  615. X  goto_dir(w, 0, 0);
  616. X}
  617. X
  618. X/*****************************************************************************
  619. X *                             goto_dir                                      *
  620. X *****************************************************************************/
  621. Xprivate void goto_dir(Widget w, caddr_t client_data, caddr_t call_data)
  622. X{
  623. X  /* Called when the goto directory button is pressed, Or when return is
  624. X   * pressed in the directory selector.
  625. X   */
  626. X  extern Boolean directoryManagerNewDirectory(String);
  627. X
  628. X  extern String home;
  629. X  extern String cwd;
  630. X  Arg args[1];
  631. X  String value, tmp;
  632. X
  633. X  /* Get the contents of the dirselector */
  634. X  XtSetArg(args[0], XtNstring, &value);
  635. X  XtGetValues(dirSelector, args, 1);
  636. X
  637. X  /* expand ~ to HOME, this should be expanded to include ~username */
  638. X  if (*value == '~') {
  639. X    tmp = (String) XtMalloc ((strlen(home) + strlen(value) + 2) * sizeof(char));
  640. X    strcpy(tmp, home);
  641. X    if (*(value+1) != '\0')
  642. X      strcat(tmp, value+1);
  643. X    value = tmp;
  644. X  }
  645. X
  646. X  /* change to the directory specified */
  647. X  if (directoryManagerNewDirectory(value) == False) {
  648. X    XBell(XtDisplay(w), 100);
  649. X  } else {
  650. X    XtFree(cwd);
  651. X    cwd = XtNewString(value);
  652. X  }
  653. X
  654. X}
  655. X
  656. X/*****************************************************************************
  657. X *                                setCursor                                  *
  658. X *****************************************************************************/
  659. Xpublic void setCursor(Cursor newcursor)
  660. X{
  661. X
  662. X  /* This should be called with a cursor to change to, or NULL to
  663. X   * go back to saved values. 
  664. X   * If the cursor is NULL then reset cursors to their defaults in
  665. X   * widgets.
  666. X   * Otherwise..
  667. X   * Set the cursor to newcursor in the following widgets:
  668. X   *   directoryManager
  669. X   *   dirSelector
  670. X   *   
  671. X   */
  672. X
  673. X  extern Widget directoryManager, appManager;
  674. X  
  675. X  static Cursor dirManCursor, appManCursor;
  676. X  Arg arglist[1];
  677. X  Cardinal i;
  678. X
  679. X  if (newcursor == NULL) {
  680. X    /* Go back to saved values */
  681. X    XtSetArg(arglist[0], XtNcursor, dirManCursor);
  682. X    XtSetValues(directoryManager, arglist, 1);
  683. X    /* XtSetArg(arglist[0], XtNcursor, treeManCursor);
  684. X     * XtSetValues(treeManager, arglist, 1); */
  685. X    XtSetArg(arglist[0], XtNcursor, appManCursor);
  686. X    XtSetValues(appManager, arglist, 1);
  687. X  } else {
  688. X    /* Get old values */
  689. X    XtSetArg(arglist[0], XtNcursor, &dirManCursor);
  690. X    XtGetValues(directoryManager, arglist, 1);
  691. X    /* XtSetArg(arglist[0], XtNcursor, &treeManCursor);
  692. X     * XtGetValues(treeManager, arglist, 1); */
  693. X    XtSetArg(arglist[0], XtNcursor, &appManCursor);
  694. X    XtGetValues(appManager, arglist, 1);
  695. X
  696. X    XtSetArg(arglist[0], XtNcursor, newcursor);
  697. X    XtSetValues(directoryManager, arglist, 1);
  698. X    /* XtSetValues(treeManager,      arglist, 1); */
  699. X    XtSetValues(appManager,       arglist, 1);
  700. X  }
  701. X
  702. X  XFlush(XtDisplay(directoryManager)); /* Change cursors immediately */
  703. X}
  704. X
  705. SHAR_EOF
  706. chmod 0644 xdtm/fileman.c ||
  707. echo 'restore of xdtm/fileman.c failed'
  708. Wc_c="`wc -c < 'xdtm/fileman.c'`"
  709. test 9280 -eq "$Wc_c" ||
  710.     echo 'xdtm/fileman.c: original size 9280, current size' "$Wc_c"
  711. fi
  712. # ============= xdtm/help ==============
  713. if test -f 'xdtm/help' -a X"$1" != X"-c"; then
  714.     echo 'x - skipping xdtm/help (File already exists)'
  715. else
  716. echo 'x - extracting xdtm/help (Text)'
  717. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/help' &&
  718. X           This is the X Desktop Manager Help file.
  719. X                 Version 1.0
  720. X               for Version 1.4 of xdtm.
  721. X
  722. X           Edward Groenendaal, April 1991.
  723. X
  724. X
  725. X +--------------------------------------------------------------+
  726. X | File  Options View  Goto: directory selector                 |
  727. X |--------------------------------------------------------------|
  728. X | selection menu |                                             |
  729. X |----------------|                                             |
  730. X |                |                                             |
  731. X |                |                                             |
  732. X |  application   |                                             |
  733. X |    manager     |            directory manager                |
  734. X |                |                                             |
  735. X |                |                                             |
  736. X |                |                                             |
  737. X |                |                                             |
  738. X |                |                                             |
  739. X |                |                                             |
  740. X |                |                                             |
  741. X |--------------  |                                             |
  742. X |Trash move copy |                                             |
  743. X +--------------------------------------------------------------+
  744. X                  Figure 1: X Desktop Manager
  745. X
  746. X
  747. X1. Selecting files
  748. X==================
  749. X
  750. XWhen a file is selected the icon and/or filename representing it in
  751. Xthe filemanager is highlighted by inverting it. When a file is
  752. Xselected it is available as an argument to another program or to be
  753. Xmoved, copied or deleted.
  754. X
  755. XFiles may be selected either via the mouse, regular expression, or all
  756. Xthe files via a key-press.
  757. X
  758. X1.1 Selecting files via the mouse
  759. X---------------------------------
  760. X
  761. XTo select a file using the mouse, press the first mouse button down
  762. Xwhile the pointer is over the file you wish to select. To select more
  763. Xthan one file at a time the modifier key SHIFT may be applied at the
  764. Xsame time as the mouse button in which case any files already selected
  765. Xwill remain so, and the file selected will also be selected.
  766. X
  767. X1.2 Selecting files via a regular expression
  768. X--------------------------------------------
  769. X
  770. XUsing the 'Select files by template' option in the 'Options' menu the
  771. Xuser may enter a standard UNIX regular expression describing the set
  772. Xof filenames to be selected. (See section 12 on regular expressions at
  773. Xthe end of this help file)
  774. X
  775. XExample.
  776. X
  777. X    The regular expression "\.c$" will select all C source files
  778. X    The regular expression "^#.*#$" will select all emacs auto-save
  779. X     files, (#filename#).
  780. X
  781. X1.3 Selecting files via the keyboard
  782. X------------------------------------
  783. X
  784. XIf you want to select all the files in the current directory, except
  785. X'.' and '..' you may use may press the key 'a' when in the directory
  786. Xmanager window.
  787. X
  788. X1.4 Executing, and Viewing files
  789. X--------------------------------
  790. X
  791. XIf you double click on a file then depending on the type of file
  792. Xone of three things will happen, if the file is a directory you will 
  793. Xchange to that directory, if the file is executable it will be executed, 
  794. Xotherwise you will be prompted whether you want to view the file.
  795. X
  796. X1.4.1 Viewing files
  797. X-------------------
  798. X
  799. XTo view a file double-click on a plain file then answer View to the
  800. Xquery box. A large text-window with a scroll bar will appear in the
  801. Xcenter of the application. Use the scroll bar to move through the
  802. Xfile. Text maybe highlighted using the mouse, then pasted into other X
  803. Xapplications. The text widget also understands some emacs commands:
  804. X
  805. XControl V  - Next Page
  806. XMeta V     - Previous Page
  807. XControl S  - Forward Search
  808. XControl R  - Reverse Search
  809. X
  810. XLook at the documentation for the Athena Text Widget for a full list
  811. Xof the translations.
  812. X
  813. X2. Deleting files
  814. X=================
  815. X
  816. XTo delete files, select the files (or directories) to delete, then
  817. Xeither select the TRASH button under the application manager, or
  818. Xselect the 'Delete files' option in the 'File' menu.
  819. X
  820. XBefore the files are deleted the user will be prompted, only if delete
  821. Xis then chosen will the files actually be deleted.
  822. X
  823. XAfter the files have been deleted, the directory listing will be
  824. Xupdated. It is possible using the application resource (or command
  825. Xline option -delay) to set a delay period between the delete and the
  826. Xupdate of the directory, this is for machines working over an NFS
  827. Xnetwork where the update of directories can be slow.
  828. X
  829. X3. Moving files
  830. X===============
  831. X
  832. XTo move files from one directory to another, select the files (or
  833. Xdirectories) to move, then either select the MOVE button under the
  834. Xapplication manager or select the 'Move files" option in the 'File'
  835. Xmenu. The cursor will change to a move cursor (a smaller version of
  836. Xthe picture on the MOVE button), change directory to the file in which
  837. Xyou wish to place the files.
  838. X
  839. XBefore the files are copied the user will be prompted, only if move
  840. Xis chosen will the files actually be moved.
  841. X
  842. XAfter the files have been moved the directory listing will be updated.
  843. XIt is possible using the application resource (or command line option
  844. X-delay) to set a delay period between the delete and the update of the
  845. Xdirectory, this is for machines working over an NFS network where the
  846. Xupdate of directories can be slow.
  847. X
  848. X4. Copying files
  849. X================
  850. X
  851. XThe copying of files is exactly the same as the moving of files 
  852. Xdescribed above.
  853. X
  854. X5. Changing Directories
  855. X=======================
  856. X
  857. XTo change directories you may either type a new directory in the
  858. Xdirectory selector, double click on the directory you wish to enter,
  859. Xor press the key 'u' on the keyboard to ascend to the above directory
  860. X(previous directory in the path).
  861. X
  862. X5.1 Directory Selector
  863. X----------------------
  864. X
  865. XTo edit the directory in the directory selector move the pointer over
  866. Xthe directory selector text until the pointer changes into a text
  867. Xinsert cursor.
  868. X
  869. XAt this point you can do the following:
  870. X
  871. XPress a mouse button - The caret will move to the position of the pointer
  872. XPress Control A      - The caret goes to the start of the text
  873. XPress Control E      - The caret goes to the end of the text
  874. XPress Return         - The directory manager will change directory to
  875. X                       the one in the directory selector. It will ring
  876. X                       the Bell on failure.
  877. XPress Escape         - Clear the text in the directory selector
  878. XPress Right Arrow    - Move caret right
  879. XPress Left Arrow     - Move caret left
  880. XPress Delete         - Delete character to left of caret
  881. XPress Backspace      - Delete character to left of caret
  882. XPress any other key  - Insert that letter
  883. X
  884. XDirectories must start with either '/' or your home directory '~/' you
  885. Xcannot specify someone else's home directory, '~alix/'. 
  886. X
  887. X6. The Directory View
  888. X=====================
  889. X
  890. XThe directory list may show either:
  891. X
  892. X o Icons        - icons and filenames
  893. X o No Icons     - filenames
  894. X o Long Listing - filenames plus zero or more of permissions, 
  895. X   number of links, owner, group, size, modification time, and access time.
  896. X
  897. XThe different modes may be selected via the 'View' menu. To set
  898. Xthe long listing options select 'Options' in the 'View' menu.
  899. X
  900. XNote: If you are using xdtm on a network using NIS (yellow pages) then
  901. Xthe lookup time for user name and group may be unbearably slow. If you
  902. Xwish to fix this yourself look at the Enhancements file in the xdtm
  903. Xsource directory.
  904. X
  905. X7. Mapping a program over selected files
  906. X========================================
  907. X
  908. XThis option found in the 'Options' menu will prompt you for a command
  909. Xto execute with the selected files as parameters. The format of this
  910. Xcommand should be the same as that used to specify commands for the
  911. Xselection list (See section 9.2.1).
  912. X
  913. XThe program will be run in the background, therefore use of xdtm may 
  914. Xcontinue. A bell will sound when the program terminates and if the
  915. XdirOnExit application resource is True the directory manager will 
  916. Xrefresh the directory listing.
  917. X
  918. X8. Application Manager Selection Lists
  919. X======================================
  920. X
  921. XThe application manager controls a number of selection lists, each
  922. Xselection list contains a number of icons which when pressed will
  923. Xexecute a specific command.
  924. X
  925. Xexample,
  926. X
  927. XThe programming selection list would contain all the programs normally
  928. Xused by yourself when developing a piece of software. In my case that
  929. Xlist contains, emacs - To edit files, Make All - To recompile files,
  930. XMake etags - To re-make the emacs TAGS database, Make clean - to remove
  931. Xall unnecessary files from the current directory, and gdb - to debug
  932. Xprograms.
  933. X
  934. XThe Application manager can only display one selection list at a time
  935. Xand so to switch between selection lists the selection menu is used. 
  936. XThe selection menu lists all the available selection lists.
  937. X
  938. XWhen a command is executed from the application manager it is run
  939. Xin the background, therefore xdtm may be used in parallel. When 
  940. Xa program terminates a bell is rung.
  941. X
  942. XSome programs that may be in the selection list expect filenames as
  943. Xarguments. To execute these commands the user must select one or more
  944. Xfiles in the current directory BEFORE double-clicking on the selection
  945. Xin the selection list. Conversely some commands do not expect
  946. Xarguments, for these no files should be selected.
  947. X
  948. X9. Configuration file
  949. X=====================
  950. X
  951. XWhen xdtm is executed it expects to read a configuration file. There
  952. Xare four places it will try:
  953. X
  954. X o Use the application resource 'Xdtm.configFile' to obtain a file name
  955. X o Use the command line argument '-cf <filename>'
  956. X o Look in the users home directory for the file '.xdtmrc'
  957. X o Look for the system xdtmrc, in a public lib directory.
  958. X
  959. XIf all these methods fail the program will terminate.
  960. X
  961. XThe configuration file contains two important sections, the icon rules
  962. Xfor specifying which icons are mapped to which filenames and types,
  963. Xand the selection lists.
  964. X
  965. XThe configuration language is a mix between C and csh, but is very
  966. Xeasy to learn even for someone without any previous computer
  967. Xexperience.
  968. X
  969. XBefore you can define either the icon rules or the selection lists
  970. Xxdtm must know where to find the icon bitmaps. At the top of the file
  971. Xshould be a command setting the 'path' through which xdtm will search
  972. Xfor an icon with the specified name. The path should be a colon
  973. Xdelimited list of directories. E.g.
  974. X
  975. X    set path = "/usr/local/lib/xdtm/icons:~/lib/eddy:~/lib/alix";
  976. X
  977. Xwould tell xdtm to search the directories, /usr/local/lib/xdtm/icons,
  978. X~/lib/eddy and ~/lib/alix (where ~ refers to my home directory). The
  979. Xpath my be reset at any point in the configuration file, but because
  980. Xthe icons are all loaded while parsing the config file on startup no
  981. Xruntime speed increase will be noticed.  
  982. X
  983. XComments may be included anywhere in the file. They are started by a 
  984. Xhash '#' preceeded by either one or more spaces or tabs. The comments 
  985. Xare terminated by the next newline.
  986. X
  987. X9.1 Icon Rules
  988. X--------------
  989. X
  990. XThe mapping between files and their representative icons is performed
  991. Xby a sequence of possibly nested if-then statements. Each 'if' statement
  992. Xtries to limit the set of possible icons for that filename until there
  993. Xare no more rules left to apply, in which case that icon will be used.
  994. X
  995. XAn if statement may test for the following characteristics of a file:
  996. X
  997. X 1) Is it a directory?
  998. X 2) Is it a plain file?
  999. X 3) Is it block special?
  1000. X 4) Is it character special?
  1001. X 5) Is it a symbolic link?
  1002. X 6) Is it a fifo?
  1003. X 7) Is it a socket?
  1004. X 8) Is it executable?
  1005. X 9) Is it readable?
  1006. X10) Is it writable?
  1007. X11) Does it's filename match this regular expression?
  1008. X
  1009. XExamples :
  1010. X
  1011. Xif (type==dir) {        if (type==file) {       if (type==block) {
  1012. X  ...                     ...                     ...
  1013. X}                       }                       }
  1014. X
  1015. Xif (type==character) {  if (type==slink) {      if (type==fifo) {
  1016. X  ...                     ...                     ...
  1017. X}                       }                       }
  1018. X
  1019. Xif (type==socket) {     if (type==exe) {        if (type==read) {
  1020. X  ...                     ...                     ...
  1021. X}                       }                       }
  1022. X
  1023. Xif (type==write) {      if (name=="\.tar$") {
  1024. X  ...                     ...
  1025. X}                       }
  1026. X
  1027. XThese rules may be nested to any depth. Note. that when checking a
  1028. Xfilename the rules in a block are NOT executed top-down they are
  1029. Xexecuted in the same order as the numbered list above. 
  1030. X
  1031. X9.1.1 Symbolic Links
  1032. X--------------------
  1033. X
  1034. XAfter a successful match on a symbolic link any rules within that
  1035. Xblock refer to the file that the link points to. Note: You *cannot*
  1036. Xnest checks for symbolic links.
  1037. X
  1038. XExample:
  1039. X
  1040. X    if (type==slink) {
  1041. X      set deficon="slink.icon";
  1042. X      if (type==dir) {
  1043. X        set icon="folder.icon";
  1044. X      }
  1045. X    }
  1046. X
  1047. X    If the symbolic link points to a directory then show the
  1048. X    icon for a directory, otherwise use the symbolic link icon.
  1049. X
  1050. X9.1.2 Checking the path or just filename
  1051. X----------------------------------------
  1052. X
  1053. XWhen checking the name of a file against a regular expression the
  1054. Xmatch can be applied over the full path of the file or just the file.
  1055. XThis may be set at any point in the file by setting the variable
  1056. X'checkpath' to either 'True' to check the whole path or 'False' to
  1057. Xcheck only the filename.
  1058. X
  1059. XExample:
  1060. X
  1061. X    set checkpath = False;
  1062. X    if (name == "\.man$") {
  1063. X      set icon = "manpage.icon";
  1064. X    }
  1065. X    set checkpath = True;
  1066. X    if (name == "/man[1-8l]/") {
  1067. X      set icon = "manpage.icon";
  1068. X    }
  1069. X
  1070. X    The first rule will match any filename ending in .man. The second
  1071. X    will set the icon to manpage.icon of any file within a manual page
  1072. X    directory.
  1073. X
  1074. X9.1.3 Setting the default icon
  1075. X------------------------------
  1076. X
  1077. XWithin any block you may set the default icon which will be used if
  1078. Xno other icon has been set within that block. It is often used at
  1079. Xthe top of the file in case no rules are matched.
  1080. X
  1081. XExample:
  1082. X
  1083. X    if (type == dir) {
  1084. X      set deficon = "folder.icon";
  1085. X      if (name == "^\.\.$") {
  1086. X        set icon = "dotdot.icon";
  1087. X      }
  1088. X    }
  1089. X
  1090. X    All directories will have the icon folder.icon unless they have the
  1091. X    name ".." in which case they will have the icon dotdot.icon.
  1092. X
  1093. X9.1.4 Ignoring files
  1094. X--------------------
  1095. XTo ignore files you may use the ignore variable, if set within a block 
  1096. Xit takes the place of an icon. When viewing directories in Icon mode
  1097. Xany files that would be matched by that rule are not displayed. This
  1098. Xis useful for ignoring temporary and configuration files.
  1099. X
  1100. XExample:
  1101. X
  1102. X    if (name=="^#\.*#$") {
  1103. X      set ignore;
  1104. X    }
  1105. X
  1106. X    Ignore all files which have a filename starting and ending in a 
  1107. X    hash. (Emacs auto-save files)
  1108. X
  1109. X9.2 Selection Lists
  1110. X-------------------
  1111. X
  1112. XYou may define as many selection lists as you like, each list may contain 
  1113. Xan unlimited amount of commands. The selection lists are defined 
  1114. Xusing the following syntax:
  1115. X
  1116. Xdefine "selection name" = {
  1117. X  {
  1118. X    name = "Name in Selection List";
  1119. X    icon = "filename of icon";
  1120. X    prog = "program to execute";
  1121. X    options = NSEL;
  1122. X  }
  1123. X  {
  1124. X    ...
  1125. X  }
  1126. X  .
  1127. X  .
  1128. X  .
  1129. X}
  1130. X
  1131. XThe name entry of a command is the title given to the icon in the 
  1132. Xselection list. 
  1133. XThe icon is the filename of the icon displayed.
  1134. XThe prog is the program and arguments to be executed when the icon
  1135. Xis double-clicked. 
  1136. XThe options specify whether the program can accept filenames as 
  1137. Xarguments, if it can then just one file or multiple files.
  1138. X
  1139. X9.2.1 Program specification
  1140. X---------------------------
  1141. X
  1142. XThe program line must start with an executable program, though it
  1143. Xdoesn't have to be a binary (unless the exec on your machine 
  1144. Xdoesn't understand the #! notation at the top of scripts). The 
  1145. Xrest of the program line may contain arguments to this program
  1146. Xarguments may be grouped together by inclosing them in single 
  1147. Xquotes. The filenames if allowed will by default be appended to
  1148. Xthis program line. If you wish to have the filenames inserted 
  1149. Xat some other point then insert the characters "!@" where you
  1150. Xwish the filenames to be inserted.
  1151. X
  1152. XXdtm does NOT understand escaped characters.
  1153. X
  1154. XWhen the program is executed it's standard input and output are
  1155. Xredirected to /dev/NULL. This prevents interactive programs from
  1156. Xgrabbing the terminal from which you executed xdtm, they will receive
  1157. Xa EOF character as soon as they try to read. You also don't want to
  1158. Xsee any output messages from these programs unless they are error 
  1159. Xmessages in which case they will be displayed. The program is run 
  1160. Xin the background, this means that you can carry on using xdtm. When
  1161. Xthis program terminates a bell will be sounded and if the application
  1162. Xresource dirOnExit is set to True the directory list will be updated.
  1163. X
  1164. XIf you wish to use an interactive program which does NOT have an X
  1165. Xfront end you should execute an xterm then execute your program 
  1166. Xwithin that xterm. 
  1167. X
  1168. XExample,
  1169. X
  1170. Xprog = "xterm -T 'Test of Xdtm' -e sh -c 'make | tee Make.out | less'"
  1171. X
  1172. XThis command line will execute an xterm with the title Test of Xdtm 
  1173. Xwithin that xterm a bourne shell will be executed which will in turn
  1174. Xexecute make piping the output to tee which will save a copy in the
  1175. Xfile Make.out and pipe the rest to less (which stops the xterm dyeing 
  1176. Xas soon as make terminates).    
  1177. X
  1178. X
  1179. X10. Command Line arguments
  1180. X==========================
  1181. X
  1182. XXdtm understands all the normal X Toolkit command line arguments, plus
  1183. X
  1184. X-delay     <number> The delay between files being modified and the directory 
  1185. X         being updated. Number should be between 0 and 5 seconds
  1186. X-cf <filename>   Use filename as the configuration file.
  1187. X-dmfont <font>   Use font for in the directory list.
  1188. X
  1189. X11. Application Resources
  1190. X=========================
  1191. X
  1192. XResource Name   Default         Description
  1193. X-------------   -------         -----------
  1194. X
  1195. XviewWidth    85        Width in characters of the view window
  1196. XviewHeight    25        Height in characters of the view window
  1197. Xmode        icons        Initial mode for directory list 
  1198. X                one of "icons", "short", "long"
  1199. Xdelay        0        Delay between files being modified
  1200. X                and the directory being updated.
  1201. X                In seconds, range 0 to 5.    
  1202. XdirOnExit    False        Refresh dir when a program terminates
  1203. XconfigFile    NULL        Config filename
  1204. XviewFont    6x10        Font when viewing a file
  1205. XdmFont        *-courier-bold-r-*-120-*       Font in directory Manager
  1206. X
  1207. X
  1208. X12. Regular Expressions
  1209. X=======================
  1210. X
  1211. Xdot '.' 
  1212. X    matches any single character
  1213. X
  1214. Xasterisk '*' 
  1215. X    matches any number (including zero) of any single character
  1216. X    (including a regular expression meta character) preceding
  1217. X    it.
  1218. X
  1219. Xsquare brackets '[ ]'
  1220. X    match any one of the characters inclosed within the brackets.
  1221. X    A range of characters may be specified by separating the first
  1222. X    and last character of the range with a hyphen. A circumflex (^)
  1223. X    as the first character in the list negates the match; i.e. match
  1224. X    any character NOT in the list.
  1225. X
  1226. Xescaped braces '\{n, m\}'
  1227. X    matches a range of occurrences of a single character (including
  1228. X    any regular expression meta character) preceding it. n and m
  1229. X    are cardinals between 0 and 256 that specify the minimum and 
  1230. X    maximum number of occurrences to match. e.g. [0-9]\{4,6\} will
  1231. X    match any number of 4 to 6 digits in length.
  1232. X
  1233. Xcaret '^'
  1234. X    A caret requires that the rest of the expression be matched at
  1235. X    the beginning of the string.
  1236. X
  1237. Xdollar sign '$'
  1238. X    A dollar sign requires that the preceding expression be matched 
  1239. X    at the end of the string.
  1240. X
  1241. Xbackslash '\'
  1242. X    A backslash escapes the meaning of any regular expression meta 
  1243. X    character so that it has the meaning of a normal character.
  1244. X
  1245. X13. Thanks
  1246. X==========
  1247. X
  1248. XThanks to the following people who sent me bug reports, suggestions, 
  1249. Xpatches etc.. (not in any particular order)
  1250. X
  1251. XDidier Fort, David Byers, Andreas (the Imake man), Christos Zoulas,
  1252. XBrett McCoy, Bill McLean, Johan Vromans, Johan Widen, Gustaf Neumann,
  1253. XJames Beal, Harald Vogt, Hugues Leroy, and Henry Thomas.
  1254. X
  1255. XAnd a special thanks to Alix Courtney for designing all the pretty 
  1256. Xicons in the directory alix.
  1257. X
  1258. XAnd Song-Tu Yang who did a port of version 1.0 to the MIPS but I haven't
  1259. Xbeen able to contact him through the supplied addresses to get the patches! 
  1260. X
  1261. XAnd Jean-Christophe Collet (jcc) for porting xdtm to straight SYSV machines.
  1262. X
  1263. X14. Files
  1264. X=========
  1265. X
  1266. X$LIBDIR/xdtm/help   - This help file
  1267. X$LIBDIR/xdtm/xdtmrc - The system configuration file
  1268. X$LIBDIR/xdtm/icons  - The system icon bitmaps
  1269. X~/.xdtmrc           - User configuration file
  1270. X$BINDIR/xdtm        - executable.
  1271. X
  1272. Xwhere $LIBDIR and $BINDIR are defined in the imake config files to
  1273. Xbe the local library and binary directories.
  1274. SHAR_EOF
  1275. chmod 0644 xdtm/help ||
  1276. echo 'restore of xdtm/help failed'
  1277. Wc_c="`wc -c < 'xdtm/help'`"
  1278. test 20446 -eq "$Wc_c" ||
  1279.     echo 'xdtm/help: original size 20446, current size' "$Wc_c"
  1280. fi
  1281. # ============= xdtm/icons/alix/airballoon.icon ==============
  1282. if test ! -d 'xdtm/icons'; then
  1283.     echo 'x - creating directory xdtm/icons'
  1284.     mkdir 'xdtm/icons'
  1285. fi
  1286. if test ! -d 'xdtm/icons/alix'; then
  1287.     echo 'x - creating directory xdtm/icons/alix'
  1288.     mkdir 'xdtm/icons/alix'
  1289. fi
  1290. if test -f 'xdtm/icons/alix/airballoon.icon' -a X"$1" != X"-c"; then
  1291.     echo 'x - skipping xdtm/icons/alix/airballoon.icon (File already exists)'
  1292. else
  1293. echo 'x - extracting xdtm/icons/alix/airballoon.icon (Text)'
  1294. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/icons/alix/airballoon.icon' &&
  1295. X/* This X bitmap is designed for use with the X Desktop Manager.
  1296. X * it was designed by Alix Courtney, April 1991.
  1297. X */
  1298. X#define drawing3_width 32
  1299. X#define drawing3_height 32
  1300. Xstatic char drawing3_bits[] = {
  1301. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x05,
  1302. X   0x00, 0x18, 0x8c, 0x0a, 0x00, 0x04, 0x10, 0x00, 0x00, 0x02, 0x20, 0x00,
  1303. X   0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x07, 0x70, 0x14,
  1304. X   0x00, 0xf9, 0x4f, 0x2a, 0x00, 0x81, 0x40, 0x00, 0x00, 0x81, 0x40, 0x00,
  1305. X   0x00, 0x82, 0x20, 0x00, 0x00, 0x82, 0x20, 0x00, 0x00, 0x84, 0x10, 0x00,
  1306. X   0x00, 0x9c, 0x1c, 0x00, 0x00, 0xe4, 0x13, 0x00, 0x00, 0x88, 0x08, 0x00,
  1307. X   0x00, 0x88, 0x28, 0x00, 0x00, 0x90, 0x34, 0x00, 0x00, 0x90, 0x0c, 0x00,
  1308. X   0x00, 0x90, 0x3e, 0x00, 0x14, 0xf0, 0x47, 0x00, 0x2a, 0x90, 0x04, 0x00,
  1309. X   0x00, 0x90, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x04, 0x01,
  1310. X   0x00, 0xf0, 0x87, 0x02, 0x00, 0x00, 0x40, 0x04, 0x40, 0x00, 0x20, 0x08,
  1311. X   0xa0, 0x00, 0x70, 0x1f, 0xf0, 0x01, 0xf8, 0x3f};
  1312. SHAR_EOF
  1313. chmod 0644 xdtm/icons/alix/airballoon.icon ||
  1314. echo 'restore of xdtm/icons/alix/airballoon.icon failed'
  1315. Wc_c="`wc -c < 'xdtm/icons/alix/airballoon.icon'`"
  1316. test 1005 -eq "$Wc_c" ||
  1317.     echo 'xdtm/icons/alix/airballoon.icon: original size 1005, current size' "$Wc_c"
  1318. fi
  1319. # ============= xdtm/icons/alix/alien.icon ==============
  1320. if test -f 'xdtm/icons/alix/alien.icon' -a X"$1" != X"-c"; then
  1321.     echo 'x - skipping xdtm/icons/alix/alien.icon (File already exists)'
  1322. else
  1323. echo 'x - extracting xdtm/icons/alix/alien.icon (Text)'
  1324. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/icons/alix/alien.icon' &&
  1325. X/* This X bitmap is designed for use with the X Desktop Manager.
  1326. X * it was designed by Alix Courtney, April 1991.
  1327. X */
  1328. X#define pic_width 32
  1329. X#define pic_height 32
  1330. Xstatic char pic_bits[] = {
  1331. X   0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x1c, 0x60, 0x00, 0x1c,
  1332. X   0x0e, 0xd0, 0x0c, 0x38, 0x1c, 0x90, 0x1a, 0x1c, 0x04, 0x70, 0x12, 0x10,
  1333. X   0x00, 0x60, 0x0c, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x68, 0x1c, 0x00,
  1334. X   0x40, 0x44, 0x28, 0x00, 0x70, 0x04, 0x40, 0x30, 0xe0, 0x04, 0x44, 0x4b,
  1335. X   0x70, 0x44, 0x42, 0x45, 0x40, 0x8c, 0x21, 0x41, 0x00, 0x30, 0x3c, 0x42,
  1336. X   0x00, 0xc8, 0x23, 0x22, 0x00, 0x04, 0x60, 0x11, 0x00, 0x04, 0xc0, 0x11,
  1337. X   0x00, 0x02, 0x00, 0x08, 0x00, 0x09, 0x00, 0x08, 0x00, 0x05, 0x60, 0x04,
  1338. X   0x80, 0x04, 0x80, 0x03, 0x80, 0x04, 0x80, 0x00, 0x80, 0x04, 0x80, 0x00,
  1339. X   0x60, 0x04, 0x80, 0x00, 0x10, 0x08, 0x40, 0x00, 0xd0, 0x09, 0xc0, 0x01,
  1340. X   0x20, 0x06, 0x20, 0x06, 0x10, 0x00, 0x10, 0x08, 0x10, 0x00, 0x10, 0x08,
  1341. X   0x10, 0x30, 0x10, 0x08, 0xe0, 0xef, 0xef, 0x07};
  1342. SHAR_EOF
  1343. chmod 0644 xdtm/icons/alix/alien.icon ||
  1344. echo 'restore of xdtm/icons/alix/alien.icon failed'
  1345. Wc_c="`wc -c < 'xdtm/icons/alix/alien.icon'`"
  1346. test 990 -eq "$Wc_c" ||
  1347.     echo 'xdtm/icons/alix/alien.icon: original size 990, current size' "$Wc_c"
  1348. fi
  1349. # ============= xdtm/icons/alix/bat.icon ==============
  1350. if test -f 'xdtm/icons/alix/bat.icon' -a X"$1" != X"-c"; then
  1351.     echo 'x - skipping xdtm/icons/alix/bat.icon (File already exists)'
  1352. else
  1353. echo 'x - extracting xdtm/icons/alix/bat.icon (Text)'
  1354. sed 's/^X//' << 'SHAR_EOF' > 'xdtm/icons/alix/bat.icon' &&
  1355. X/* This X bitmap is designed for use with the X Desktop Manager.
  1356. X * it was designed by Alix Courtney, April 1991.
  1357. X */
  1358. X#define bat_width 32
  1359. X#define bat_height 32
  1360. Xstatic char bat_bits[] = {
  1361. X   0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x0a, 0x39, 0x00,
  1362. X   0x00, 0x94, 0x4a, 0x00, 0x00, 0x64, 0x92, 0x00, 0x00, 0x54, 0x22, 0x01,
  1363. X   0x60, 0x54, 0x22, 0x02, 0x50, 0x04, 0x41, 0x04, 0x48, 0x68, 0x41, 0x08,
  1364. X   0x48, 0x08, 0x21, 0x10, 0x44, 0x08, 0x11, 0x20, 0x82, 0x04, 0x0e, 0x20,
  1365. X   0x02, 0x07, 0x04, 0x40, 0x01, 0x04, 0x0c, 0x40, 0x01, 0x02, 0x10, 0x40,
  1366. X   0x01, 0x02, 0x10, 0x80, 0x01, 0x02, 0x00, 0x80, 0x01, 0x02, 0x00, 0xb0,
  1367. X   0x01, 0x02, 0x00, 0x48, 0x01, 0x02, 0x00, 0x44, 0x01, 0x04, 0xc0, 0x45,
  1368. X   0x01, 0x08, 0x20, 0x06, 0x01, 0x10, 0x20, 0x04, 0x01, 0x20, 0x20, 0x00,
  1369. X   0x01, 0x40, 0x2e, 0x00, 0x01, 0x78, 0xb1, 0x03, 0xc2, 0x84, 0xc1, 0x00,
  1370. X   0x26, 0x03, 0x41, 0x03, 0x2c, 0xc2, 0x47, 0x00, 0x28, 0x40, 0xc1, 0x00,
  1371. X   0x30, 0x00, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00};
  1372. SHAR_EOF
  1373. chmod 0644 xdtm/icons/alix/bat.icon ||
  1374. echo 'restore of xdtm/icons/alix/bat.icon failed'
  1375. Wc_c="`wc -c < 'xdtm/icons/alix/bat.icon'`"
  1376. test 990 -eq "$Wc_c" ||
  1377.     echo 'xdtm/icons/alix/bat.icon: original size 990, current size' "$Wc_c"
  1378. fi
  1379. true || echo 'restore of xdtm/icons/alix/bear.icon failed'
  1380. echo End of part 6, continue with part 7
  1381. exit 0
  1382.  
  1383. --
  1384. Dan Heller
  1385. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  1386. Senior Writer                President          comp-sources-x@uunet.uu.net
  1387. argv@ora.com                 argv@zipcode.com
  1388.