v13i016: xdtm - X Desktop Manager for the X Window System, Part11/11

EdwardJ. Groenendaal eddyg at cogs.sussex.ac.uk
Sun May 19 10:04:07 AEST 1991


Submitted-by: Edward "J." Groenendaal <eddyg at cogs.sussex.ac.uk>
Posting-number: Volume 13, Issue 16
Archive-name: xdtm/part11

Pheww.. last one!

Submitted-by: eddyg at cste
Archive-name: xdtm/part11

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 11 of xdtm
# ============= xdtm/patchlevel.h ==============
if test ! -d 'xdtm'; then
    echo 'x - creating directory xdtm'
    mkdir 'xdtm'
fi
if test -f 'xdtm/patchlevel.h' -a X"$1" != X"-c"; then
	echo 'x - skipping xdtm/patchlevel.h (File already exists)'
else
echo 'x - extracting xdtm/patchlevel.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/patchlevel.h' &&
X/* This file contains the current patch level. Not all patch levels are
X * released, I also use this number to keep track of my changes to xdtm,
X * so don't be suprised by jumps in this number.
X */
X#define PATCHLEVEL 5
SHAR_EOF
chmod 0644 xdtm/patchlevel.h ||
echo 'restore of xdtm/patchlevel.h failed'
Wc_c="`wc -c < 'xdtm/patchlevel.h'`"
test 219 -eq "$Wc_c" ||
	echo 'xdtm/patchlevel.h: original size 219, current size' "$Wc_c"
fi
# ============= xdtm/quit.c ==============
if test -f 'xdtm/quit.c' -a X"$1" != X"-c"; then
	echo 'x - skipping xdtm/quit.c (File already exists)'
else
echo 'x - extracting xdtm/quit.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/quit.c' &&
X/****************************************************************************
X ** File          : quit.c                                                 **
X ** Purpose       : Initialise and Realise quit dialogs                    **
X ** Author        : Edward Groenendaal                                     **
X ** Date          : April 1991                                             **
X ** Documentation : Xdtm Design Folder                                     **
X ** Related Files :                                                        **
X ****************************************************************************/
X
X#include "xdtm.h"
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include "Xedw/XedwForm.h"
X
Xextern void realize_dialog(Widget);
X
X/* Widgets */
Xprivate Widget quitpopup;	/* For Quit Message */
Xprivate Widget quitform;        /* The form */
Xprivate Widget quitlabel;  	/* Label at top of dialog */
Xprivate Widget quitquit;       	/* yes button */
Xprivate Widget quitcancel;    	/* no button */ 
X
X/*****************************************************************************
X *                              init_quit                                    *
X *****************************************************************************/
Xpublic void init_quit(Widget top)
X{
X  /* Initialise the quit dialog widgets */
X
X  extern void quitQueryResult(Widget, Boolean, caddr_t);
X
X  Arg arglist[5];
X  Cardinal i;
X
X  private String QuitLabel          = "Really quit?";
X  private String QuitButtonLabel    = "Quit";
X  private String CancelButtonLabel  = "Cancel";
X
X  quitpopup    =   XtCreatePopupShell("quitpopup",
X				      transientShellWidgetClass,
X				      top,
X				      NULL, 0);
X
X  quitform      =   XtCreateManagedWidget("quitform",
X				      xedwFormWidgetClass,
X				      quitpopup,
X				      NULL, 0);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNlabel,         QuitLabel);  i++;
X  XtSetArg(arglist[i], XtNborderWidth,           0);  i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter);  i++;
X  XtSetArg(arglist[i], XtNfullWidth,          True);  i++;
X  quitlabel    =   XtCreateManagedWidget("quitlabel",
X					  labelWidgetClass,
X					  quitform,
X					  arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNlabel, CancelButtonLabel);  i++;
X  XtSetArg(arglist[i], XtNfromVert,      quitlabel);  i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter);  i++;
X  quitcancel  =   XtCreateManagedWidget("quitcancel",
X					commandWidgetClass,
X					quitform,
X					arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNlabel,   QuitButtonLabel);  i++;
X  XtSetArg(arglist[i], XtNfromVert,     quitlabel);  i++;
X  XtSetArg(arglist[i], XtNwidthLinked, quitcancel);  i++;
X  XtSetArg(arglist[i], XtNfromHoriz,   quitcancel);  i++;
X  quitquit    =   XtCreateManagedWidget("quitquit",
X					commandWidgetClass,
X					quitform,
X					arglist, i);
X
X  XtAddCallback(quitcancel, XtNcallback, quitQueryResult, False);
X  XtAddCallback(quitquit,   XtNcallback, quitQueryResult, True);
X 
X}
X
X/*****************************************************************************
X *                                quit_dialog                                *
X *****************************************************************************/
Xpublic void quit_dialog(void)
X{
X  /* This procedure pops the quit dialog up on screen */
X
X  realize_dialog(quitpopup);
X}
X
X/*****************************************************************************
X *                                                                           *
X *****************************************************************************/
Xpublic void destroy_quit_dialog(void)
X{
X  /* This procedure pop's the quit dialog down */
X
X  XtPopdown(quitpopup);
X}
SHAR_EOF
chmod 0644 xdtm/quit.c ||
echo 'restore of xdtm/quit.c failed'
Wc_c="`wc -c < 'xdtm/quit.c'`"
test 3727 -eq "$Wc_c" ||
	echo 'xdtm/quit.c: original size 3727, current size' "$Wc_c"
fi
# ============= xdtm/scroll_hack.c ==============
if test -f 'xdtm/scroll_hack.c' -a X"$1" != X"-c"; then
	echo 'x - skipping xdtm/scroll_hack.c (File already exists)'
else
echo 'x - extracting xdtm/scroll_hack.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/scroll_hack.c' &&
X/*****************************************************************************
X ** File          : scroll_hack.c                                           **
X ** Purpose       : Reset the scrollbar in a viewport widget to the top     **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : April 1991                                              **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <X11/Xaw/XawInit.h>
X#include <X11/Xaw/Viewport.h>
X#include <X11/Xaw/ViewportP.h>
X#include <X11/Xaw/Scrollbar.h>
X#include <X11/Xaw/ScrollbarP.h>
X
X/*****************************************************************************
X *                               setscroll                                   *
X *****************************************************************************/
Xpublic void setscroll(Widget w, float pos)
X{
X  /* This procedure takes a viewpoet widget, find's it's vertical scrollbar
X   * sets the value of this to the position supplied, then calls the 
X   * callbacks on that scrollbar to inform the viewport of the change.
X   *
X   * This is a *bit* of a hack, but I couldn't think of another way around
X   * it without sub-classing the viewport widget.
X   */
X
X  ViewportWidget  vw = (ViewportWidget) w;
X  ScrollbarWidget sw = (ScrollbarWidget) vw->viewport.vert_bar;
X  Arg arglist[1];
X
X
X  XtSetArg(arglist[0], XtNtopOfThumb, pos);
X  XtSetValues(sw, arglist, 1);
X  XtCallCallbacks(sw, XtNthumbProc, sw->scrollbar.top);
X  XtCallCallbacks(sw, XtNjumpProc, &sw->scrollbar.top);
X
X}
SHAR_EOF
chmod 0644 xdtm/scroll_hack.c ||
echo 'restore of xdtm/scroll_hack.c failed'
Wc_c="`wc -c < 'xdtm/scroll_hack.c'`"
test 1816 -eq "$Wc_c" ||
	echo 'xdtm/scroll_hack.c: original size 1816, current size' "$Wc_c"
fi
# ============= xdtm/xdtm.h ==============
if test -f 'xdtm/xdtm.h' -a X"$1" != X"-c"; then
	echo 'x - skipping xdtm/xdtm.h (File already exists)'
else
echo 'x - extracting xdtm/xdtm.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/xdtm.h' &&
X/*****************************************************************************
X ** File          : xdtm.h                                                  **
X ** Purpose       :                                                         **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 18th Feb 1991                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files : menus.c                                                 **
X *****************************************************************************/
X
X#ifndef _xdtm_h
X#define _xdtm_h
X
X/* Current release of xdtm */
X#define RELEASE       1
X
X/* Change SYSTEM_HELP to the path of your help file */
X#define SYSTEM_HELP   "/usr/local/X11R4/lib/X11/xdtm/help"
X
X/* Change SYSTEM_XDTMRC to the path of your system config. file */
X#define SYSTEM_XDTMRC "/usr/local/X11R4/lib/X11/xdtm/xdtmrc"
X
X/* You shouldn't need to change anything below here */
X
X#define DUMMY ~0
X
X#ifdef TRUE_SYSV
X#ifndef USE_CWD
X#define USE_CWD  /* True SYSV machines use getcwd NOT getwd */
X#endif
X#endif
X
X#include "patchlevel.h"
X
X/* UNIX include files */
X#include <stdio.h>
X#include <errno.h>
X#include <string.h>
X
X/* Standard X11 include files */
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X
X#define private     	static
X#define public      	/* global */
X
Xextern Arg chain_position[];
Xextern Cardinal chain_size;
X
Xtypedef enum {NormalMode, CopyMode, MoveMode} Mode;
X
Xtypedef struct {
X  int view_width;
X  int view_height;
X  XFontStruct *view_font;
X  int delay;
X  Boolean dironexit;
X  String mode;
X  String cffile;
X  XFontStruct *dm_font;
X} AppData, *AppDataPtr;
X
Xextern AppData app_data;
X
X/* Application Resources */
X
X#define XtNviewWidth "viewWidth"
X#define XtNviewHeight "viewHeight"
X#define XtNviewFont "viewFont"
X#define XtNmode "mode"
X#define XtNdirOnExit "dirOnExit"
X#define XtNconfigFile "configFile"
X#define XtNdmFont "dmFont"
X#define XtNdelay "delay"
X
X#define XtCConfigFile "ConfigFile"
X#define XtCViewWidth "ViewWidth"
X#define XtCViewHeight "ViewHeight"
X#define XtCMode "Mode"
X#define XtCDirOnExit "DirOnExit"
X#define XtCDelay "Delay"
X
X#endif /* _xdtm_h */
SHAR_EOF
chmod 0644 xdtm/xdtm.h ||
echo 'restore of xdtm/xdtm.h failed'
Wc_c="`wc -c < 'xdtm/xdtm.h'`"
test 2222 -eq "$Wc_c" ||
	echo 'xdtm/xdtm.h: original size 2222, current size' "$Wc_c"
fi
# ============= xdtm/xdtm.man ==============
if test -f 'xdtm/xdtm.man' -a X"$1" != X"-c"; then
	echo 'x - skipping xdtm/xdtm.man (File already exists)'
else
echo 'x - extracting xdtm/xdtm.man (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/xdtm.man' &&
X.TH xdtm 1 "Version 1.4" "X Desktop Manager" 
X.SH NAME
Xxdtm \- graphical shell for X
X.SH SYNOPSIS
Xxdtm [ \f2\-cf\f1 configuration_file ] [ \f2\-delay\f1 time ] [ \f2\-dmfont\f1 font_name ] [ standard X options ]
X.SH DESCRIPTION
X.PP
XThe X Desktop Manager is a graphical shell for the X Window System.
XIt provides facilities to list directories graphically, view files,
Xcopy, move, and delete files, and to launch programs.
X.PP
XIt comes with comprehensive help available from within the program, 
Xthis should be consulted for instructions on how to use the program.
X.PP
XThe \f2\-cf\f1 option tells xdtm to use the following file as the 
Xconfiguration file. If this file is not found xdtm will try the users
Xhome directory for the file .xdtmrc, if that fails the system xdtmrc
Xwill be used.
X.PP
XThe \f2\-delay\f1 option is used on systems with NFS mounted directories.
XIt specifies the time in seconds to delay between updating a directories
Xcontents and updating the directory listing within xdtm. A value of 1 second
Xis usually enough unless the network is very heavily loaded. The valid range
Xis between 1 and 5 seconds.
X.PP
XThe \f2\-dmfont\f1 option is used to specify the font to be used to list
Xthe filenames in the directory list. Because this font is used in the 
Xlong listing mode within which spaces are used to align the columns of data a
Xfixed width font should be specified.
X.PP
XAny standard X Toolkit command line options may be used in addition to the
Xones already listed above.
X.SH DOCUMENTATION
X.PP
XFurther documentation may be found in the X Desktop Manual User's Guide, this
Xis provided along with the version 1.4 sources in a format suitable for use
Xwith an Apple Macintosh with Word 4.0.
X.PP
XExtensive online help is also available from within xdtm via the help menu
Xoption. This help file may also be viewed from outside xdtm with a standard
Xpager.
X.SH DIAGNOSTICS
XXdtm will display any standard error output from the commands it executes. 
XIt will also complain about any errors in accessing files.
X.SH FILES
X.nf
X~/.xdtmrc - User's configuration file
X/usr/lib/X11/xdtm/icons - Directory containing xdtm icon bitmaps
X/usr/lib/X11/xdtm/help - Help file
X/usr/lib/X11/xdtm/xdtmrc - System configuration file
X
XNote: The files in /usr/lib/X11/xdtm may be in another directory, see
Xyour system administrator to find out which.
X.fi
X.SH AUTHOR
X.nf
XEdward Groenendaal
X
XSchool of Cognitive and Computing Sciences,
XUniversity of Sussex,
XBrighton,
XEngland.
X
XEmail: eddyg at cogs.sussex.ac.uk
X.fi
X.PP
SHAR_EOF
chmod 0644 xdtm/xdtm.man ||
echo 'restore of xdtm/xdtm.man failed'
Wc_c="`wc -c < 'xdtm/xdtm.man'`"
test 2504 -eq "$Wc_c" ||
	echo 'xdtm/xdtm.man: original size 2504, current size' "$Wc_c"
fi
# ============= xdtm/xdtmrc ==============
if test -f 'xdtm/xdtmrc' -a X"$1" != X"-c"; then
	echo 'x - skipping xdtm/xdtmrc (File already exists)'
else
echo 'x - extracting xdtm/xdtmrc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/xdtmrc' &&
X# -*- Mode: C -*-
X# This is a sample .xdtmrc file.
X#
X# Edward Groenendaal.
X# (additions by Henry Thomas)
X#
X
X# Change this path to include the icon directories 
Xset path = "/usr/local/lib/xdtm/icons";
X
X# Check the whole path or just filenames when doing RE matches.
X# checking for just filename is a LOT quicker that on the whole path
Xset checkpath=False;
X
X# Default icon in case all rules fail
Xset deficon="file.icon";
X
Xif (type==dir) {
X  set deficon="folder.icon";
X  #if (name=="^\.$") {
X  #  set icon="dot.icon";
X  #}
X  if (name=="^\.\.$") {
X    set icon="dotdot.icon";
X  }
X  if (name=="^\.$") {
X    set icon="folder.icon";
X  }
X  if (name=="^\..*") {
X    set ignore;
X  }
X  if (name=="^X11$") {
X    set icon="x.icon";
X  }
X}
X
Xif (type==block) {
X  set icon = "block.icon";
X}
X
Xif (type==character) {
X  set deficon = "character.icon";
X  if (name=="^tty.*") {
X    set icon="tty.icon";
X  }
X}
X
Xif (type==slink) {
X  set deficon = "slink.icon";
X  # We are now checking the destination of the link 
X  if (type==dir) {
X    set icon="folder.icon";
X  }  
X}
X
Xif (type==socket) {
X  set icon = "socket.icon";
X}
X
X
Xif (type==file) {
X  set deficon="file.icon";
X  if (name=="^\..*") {
X    set ignore;
X  }
X  if (name=="^%.*") {
X    set ignore;
X  }
X  if (name=="^#.*#$") {
X    set ignore;
X  }
X  if (type==exe) { 
X    set deficon="prog.icon";
X    if (name=="^\..*") {
X      set ignore;
X    }
X    if (name=="^%.*") {
X      set ignore;
X    }
X    if (name=="^#.*#$") {
X      set ignore;
X    }
X    if (name=="^xdtm$") {
X      set icon="xdtm.icon";
X    }
X  }
X  
X# c source files
X  if (name==".*\.c[~]*$") {
X    set icon="ccode.icon";
X  }
X
X# object files
X  if (name==".*\.o[~]*$") {
X    set icon="ocode.icon";
X  }
X
X# c header files
X  if (name==".*\.h[~]*$") {
X    set icon="hcode.icon";
X  }
X
X# yacc source files
X  if (name==".*\.y[~]*$") {
X    set icon="ycode.icon";
X  }
X
X# lex source files
X  if (name==".*\.l[~]*$") {
X    set icon="lcode.icon";
X  }
X
X# emacs lisp files
X  if (name==".*\.el[~]*$") {
X    set icon="elisp.icon";
X  }
X  if (name=="^.emacs$") {
X    set icon="elisp.icon";
X  }
X  if (name==".*\.elc$") {
X    set icon="elispc.icon";
X  }
X
X# libraries
X  if (name==".*\.a$") {
X    set icon="lib.icon";
X  }
X
X# manual pages
X  set checkpath = True;
X  if (name==".*/man[1-8l]/.*") {
X    set deficon = "manpage.icon";
X  }
X  set checkpath = False;
X
X# compressed files
X  if (name==".*\.[ZF]$") {
X    set icon="z.icon";
X  }
X
X# text source files
X  if (name==".*\.txt[~]*$") {
X    set icon="text.icon";
X  }
X  if (name==".*\.tex[~]*$") {
X    set icon="text.icon";
X  }
X
X# zoo, arc, zip files
X  if (name==".zoo$") {
X    set icon="lib.icon";
X  }
X  if (name==".zip$") {
X    set icon="lib.icon";
X  }
X  if (name==".arc$") {
X    set icon="lib.icon";
X  }
X
X# sit, tar, shar files
X  if (name==".shar$") {
X    set icon="lib.icon";
X  }
X  if (name==".tar$") {
X    set icon="lib.icon";
X  }
X  if (name==".sit$") {
X    set icon="lib.icon";
X  }
X
X# image files
X  if (name==".p[pgmn]m$") {
X    set icon="flower.icon";
X  }
X  if (name==".gif$") {
X    set icon="flower.icon";
X  }
X  if (name==".ras*$") {
X    set icon="flower.icon";
X  }
X
X# sound files
X  if (name==".au$") {
X    set icon="mermaid.icon";
X  }
X
X# Misc icons
X  if (name=="^[Mm]ake[fF]ile[~]*$") {
X      set icon="makefile.icon";
X  }
X  if (name=="^[iI][Mm]ake[Ff]ile[~]*$") {
X      set icon="makefile.icon";
X  }
X  if (name==".*\.icon[~]*$") {
X    set icon="icon.icon";
X  }
X  if (name=="^core$") {
X    set icon="core.icon";
X  }
X
X# application icons
X  if (name=="^xdtm$") {
X    set icon="xdtm.icon";
X  }
X}
X
X# application manager defaults
X
Xdefine "programming" = {
X  { name = "emacs";
X    icon = "emacs.icon";
X    prog = "emacs !@";  # doesn't catch filenames in current dir
X    options = MSEL;     # emacs's fault not mine...
X  }
X  {
X    name = "C Debugger";
X    icon = "prog.icon";
X    prog = "xterm -T 'Gnu C Debugger' -e gdb !@";
X    options = OSEL;
X  }
X  {
X    name = "Make All";
X    icon = "make.icon";
X    prog = "xterm -e sh -c 'make | less'";
X    options = NSEL;
X  }
X  {
X    name = "Make etags";
X    icon = "make.icon";
X    prog = "make etags";
X    options = NSEL;
X  }
X  {
X    name = "Make Clean";
X    icon = "make.icon";
X    prog = "make clean";
X    options = NSEL;
X  }
X  { 
X    name = "Make Makefile";
X    icon = "make.icon";
X    prog = "xmkmf";
X    options = NSEL;
X  }
X}
Xdefine "misc" = {
X  { 
X    name = "X Clock";
X    icon = "clock.icon";
X    prog = "xclock";
X    options = NSEL;
X  }
X  {
X    name = "X Bitmap";
X    icon = "piccy.icon";
X    prog = "bitmap -nodashed !@";
X    options = OSEL;
X  }
X}
X
Xdefine "games" = {
X  {
X    name = "Nethack";
X    icon = "ghost.icon";
X    prog = "xterm -T 'Nethack' -e nethack";
X    options = NSEL;
X  }
X}
X
Xdefine "editing" = {
X  {
X    name = "X Terminal";
X    icon = "prog.icon";
X    prog = "xterm -T 'X Terminal'";
X    options = NSEL;
X  }
X  {
X    name = "Spell Check";
X    icon = "prog.icon";
X    prog = "xterm -T 'Spell Check' -e ispell !@";
X    options = MSEL;
X  }
X  {
X    name = "Edit : vi";
X    icon = "dragon.icon";
X    prog = "xterm -T 'Vi' -e vi !@";
X    options = OSEL;
X  }
X  {
X    name = "Edit : Emacs";
X    icon = "emacs.icon";
X    prog = "xterm -T 'Emacs' -e emacs !@";
X    options = MSEL;
X  }
X  {
X    name = "Edit : Ved";
X    icon = "alien.icon";
X    prog = "xterm -T 'Poplog Ved' -e ved !@";
X    options = OSEL;
X  }
X  {
X    name = "Word Count";
X    icon = "wordc.icon";
X    prog = "xterm -T 'Word Count' -e sh -c 'wc !@ | less'";
X    options = MSEL;
X  }
X}
X
Xdefine "rlogins" = {
X  {
X    name = "TSUNA";
X    icon = "fish.icon";
X    prog = "xterm -e rlogin tsuna";
X    options = NSEL;
X  }
X  {
X    name = "CSTE";
X    icon = "snail.icon";
X    prog = "xterm -e rlogin cste";
X    options = NSEL;
X  }
X  {
X    name = "LUCRETIA";
X    icon = "mermaid.icon";
X    prog = "xterm -e rlogin lucretia";
X    options = NSEL;
X  }
X}
SHAR_EOF
chmod 0644 xdtm/xdtmrc ||
echo 'restore of xdtm/xdtmrc failed'
Wc_c="`wc -c < 'xdtm/xdtmrc'`"
test 5773 -eq "$Wc_c" ||
	echo 'xdtm/xdtmrc: original size 5773, current size' "$Wc_c"
fi
exit 0

--
Dan Heller
O'Reilly && Associates       Z-Code Software    Comp-sources-x:
Senior Writer                President          comp-sources-x at uunet.uu.net
argv at ora.com                 argv at zipcode.com



More information about the Comp.sources.x mailing list