# -*- Mode: C -*-
# =======================================================================
# This is a sample xdtmrc file.
# 
# See the help file for details of the syntax.
#
# Author: Edward Groenendaal.
#         (additions by Henry Thomas)
#
# If you design any icons for use with xdtm, or have written a nice
# xdtmrc why don't you mail them to me at 'eddyg@cogs.sussex.ac.uk' and
# I'll include any nice bits in the next release of xdtm.
#
# NOTE: This file will only work with xdtm version 2.0 or later.
# =======================================================================

# Change this path to include the icon directories 
# In the release xdtmrc the string '{icon dir}' should be used, this is 
# substituted for the real icon directory automatically during installation
# by imake.

set path = "/usr/X386/lib/X11/icons/small:/usr/X386/lib/X11/icons/xpm:/usr/X386/lib/X11/xdtm/icons/small";

# Check the whole path or just filenames when doing regular expression matches.
# checking for just filename is a LOT quicker that on the whole path

set checkpath=False;

# Default icon in case all rules fail

#set deficon="text.xbm";
set deficon="generic_file.xpm";

# =======================================================================

if (type == dir)
  {
    set deficon = "generic_dir.xpm" ;

    if (name == "^\.\.$")
      {
	set icon = "dot_dot.xpm" ;
      }

    if (name == "^\.$")
      {
	set ignore ;
      }

    if (name == "^\..*")
      {
	set ignore ;
      }

    if (name == "^X11$")
      {
	set icon = "x.xbm" ;
      }
  }

if (type == block)
  {
    set deficon = "block.xbm" ;

    if (name == "^fd.*")
      {
        set icon = "floppy.xpm" ;
      }
  }

if (type == character)
  {
    set deficon = "character.xbm" ;

    if (name == "^tty.*")
      {
	set icon = "tty.xbm" ;
      }
  }

if (type == slink)
  {
    set deficon = "slink.xbm" ;

    # We are now checking the destination of the link 

    if (type == dir)
      {
	set icon = "generic_dir.xpm" ;
      }  

    #use the slink icon if destination NOT a directory.
  }

if (type == socket)
  {
    set icon = "socket.xbm" ;
  }

if (type == file)
  {
    set deficon = "generic_file.xpm" ;

    # Ignore files starting with a dot

    if (name == "^%.*")
      {     
	set ignore ;
      }

    # Ignore files starting and finishing with a #

    if (name == "^#.*#$")
      {
	set ignore ;
      }

    # check for shared libraries

    if (name == ".*\.so\..*")
      {
	set icon = "lib.xbm" ;
      }

    if (name == ".*\.sa\..*")
      {
	set icon = "lib.xbm" ;
      }

    # set icons for excutable files

    if (type == exe)
      { 
	set deficon = "prog.xbm" ;

    # ignore executables starting with a dot

	if (name == "^\..*")
	  {
	    set ignore ;
	  }

    # ignore excutables starting with a %

	if (name == "^%.*")
	  {
	    set ignore ;
	  }

    # ignore excutables surounded by #'s (emacs auto-save file)

    if (name == "^#.*#$")
      {
        set ignore ;
      }

    # use the xdtm icon for xdtm

    if (name == "^xdtm$")
      {
        set icon = "xdtm.xbm" ;
      }
  }
  
  # c source files and c++ ones

  if (name == ".*\.[cC][c~]*$")
    {
      set icon = "dot_c.xpm" ;
    }
  if (name == ".*\.(cc|C|CC|c\+\+|C\+\+)~?")
    {
      set icon = "dot_cc.xpm" ;
    }

  # object files

  if (name == ".*\.o[~]*$")
    {
      set icon = "dot_o.xpm" ;
    }

  # c header files

  if (name == ".*\.h[~]*$")
    {
      set icon = "dot_h.xpm" ;
    }

  # yacc source files

  if (name == ".*\.y[~]*$")
    {
      set icon = "ycode.xbm" ;
    }

  # lex source files

  if (name == ".*\.l[~]*$")
    {
      set icon = "lcode.xbm" ;
    }

  # emacs lisp files

  if (name == ".*\.el[~]*$")
    {
      set icon = "elisp.xbm" ;
    }

  if (name == "^.emacs$")
    {
      set icon = "elisp.xbm" ;
    }

  if (name == ".*\.elc$")
    {
      set icon = "elispc.xbm" ;
    }

  # libraries

  if (name == ".*\.(a|sa)$")
    {
      set cmd = "xterm -title 'Library Symbols' -e xdtm.sh nm -eT !@" ;
      set icon="lib.xbm" ;
    }

  # manual pages

  set checkpath = True ;

  if (name == ".*/(cat|man)[1-8ln]/.*")
    {
      set icon = "manpage.xbm" ;
      set cmd = "xterm -title 'Manual page' -e sh -c 'nroff -man !@ | less'" ;
    }

  set checkpath = False ;

  if (name == ".*\.man$")
    {
      set icon = "manpage.xbm" ;
      set cmd = "xterm -title 'Manual page' -e sh -c 'nroff -man !@ | less'";
    }

  # compressed files

  if (name == ".*\.[zZF]$")
    {
      set icon = "z.xbm" ;
    }

  # text source files

  if (name == ".*\.txt[~]*$")
    {
      set icon = "fil.xpm" ;
    }

  if (name == ".*\.tex[~]*$")
    {
      set icon = "fil.xpm" ;
    }
  
  # README file

  if (name == "^[Rr][Ee][Aa][Dd][Mm][Ee]$")
    {
      set icon = "text.xbm" ;
    }

  # TAGS file

  if (name == "^TAGS$")
    {
      set icon = "tag.xbm" ;
    }

  # app-default files

  if (name == "^.*\.ad$")
    {
      set icon = "text.xbm" ;
      set cmd = "xrdb -merge !@" ;
    }

  set checkpath = True ;

  if (name == ".*/app-defaults/.*")
    {
      set icon = "text.xbm" ;
      set cmd = "xrdb -merge !@" ;
    }

  set checkpath = False ;

  # sit, tar, shar files

  if (name == ".shar$")
    {
      set icon = "lib.xbm" ;
    }

  if (name == ".tar$")
    {
      set icon = "lib.xbm" ;
    }

  if (name == ".sit$")
    {
      set icon = "lib.xbm" ;
    }

  # image files

  if (name == "\.p[pgmn]m$")
    {
      set icon = "flower.xbm" ;
    }

  if (name == "\.gif$")
    {
      set icon = "dot_gif.xpm" ;
      set cmd = "xgif !@" ;
    }

  if (name == "\.dl$")
    {
      set icon = "dot_gif.xpm" ;
      set cmd = "xdl !@" ;
    }

  if (name == "\.gl$")
    {
      set icon = "dot_gif.xpm" ;
      set cmd = "xviewgl -F !@" ;
    }

  if (name == "\.ras*$")
    {
      set icon = "flower.xbm" ;
    }

  if (name == "\.tiff$")
    {
      set icon = "dot_tiff.xpm" ;
      set cmd = "xloadimage !@" ;
    }

  if (name == "\.xpm$")
    {
      set cmd = "sxpm !@" ;
    }

  # sound files

  if (name == ".au$")
    {
      set icon = "mermaid.xbm" ;
    }

  # Misc icons

  if (name == "^[Mm]ake[fF]ile[~]*$")
    {
      set icon = "makefile.xbm" ;
    }

  if (name == "^[Mm]ake[fF]ile\..*")
    {
      set icon = "makefile.xbm" ;
    }

  if (name == "^[iI][Mm]ake[Ff]ile[~]*$")
    {
      set icon = "makefile.xbm" ;
    }

  if (name == ".*\.xbm[~]*$")
    {
      set icon = "dot_xbm.xpm" ;
      set cmd = "bitmap !@" ;
    }

  if (name == ".*\.xpm[~]*$")
    {
      set icon = "dot_xpm.xpm" ;
    }

  if (name == "^core$")
   {
      set icon = "core.xpm" ;
   }

  # application icons

  if (name == "^xdtm$")
    {
      set icon = "xdtm.xbm" ;
    }

  # TeX stuff

  if (name == ".dvi$")
    {
      set icon = "text.xbm" ;
      set cmd = "xdvi !@" ;
    }
}

# =======================================================================
# Application manager defaults
# =======================================================================

define "programming" = {
  { name = "emacs";
    icon = "emacs.xbm";
    prog = "emacs !@"; 
    options = MSEL;    
  }
  {
    name = "C Debugger";
    icon = "prog.xbm";
    prog = "xterm -T 'Gnu C Debugger' -e gdb !@";
    options = OSEL;
  }
  {
    name = "Make All";
    icon = "make.xbm";
    prog = "xterm -e sh -c 'make | less'";
    options = NSEL;
  }
  {
    name = "Make etags";
    icon = "make.xbm";
    prog = "make etags";
    options = NSEL;
  }
  {
    name = "Make Clean";
    icon = "make.xbm";
    prog = "make clean";
    options = NSEL;
  }
  { 
    name = "Make Makefile";
    icon = "make.xbm";
    prog = "xmkmf";
    options = NSEL;
  }
}
# -----------------------------------------------------------------------

define "misc" = {
  { 
    name = "X Clock";
    icon = "xclock.xpm";
    prog = "xclock";
    options = NSEL;
  }
  {
    name = "X Bitmap";
    icon = "bitmap.xpm";
    prog = "bitmap -nodashed !@";
    options = OSEL;
  }
  {
    name = "Compress";
    icon = "z.xbm";
    prog = "compress !@";
    options = MSEL;
  }
  {
    name = "Uncompress";
    icon = "text.xbm";
    prog = "uncompress !@";
    options = MSEL;
  }
}

# -----------------------------------------------------------------------
define "graphics" = {
  {
    name = "X view";
    icon = "dot_gif.xpm";
    prog = "xv !@";
    options = MSEL;
  }
  {
    name = "X gif";
    icon = "dot_gif.xpm";
    prog = "xgif !@";
    options = OSEL;
  }
  {
    name = "X gl";
    icon = "dot_gif.xpm";
    prog = "xviewgl -F !@";
    options = OSEL;
  }
 }
# -----------------------------------------------------------------------
define "games" = {
  {
    name = "Nethack";
    icon = "ghost.xbm";
    prog = "/usr/games/nethack";
    options = NSEL;
  }
}

# -----------------------------------------------------------------------
define "editing" = {
  {
    name = "X Terminal";
    icon = "prog.xbm";
    prog = "xterm -T 'X Terminal'";
    options = NSEL;
  }
  {
    name = "Spell Check";
    icon = "prog.xbm";
    prog = "xterm -T 'Spell Check' -e ispell !@";
    options = MSEL;
  }
  {
    name = "Edit : vi";
    icon = "dragon.xpm";
    prog = "xterm -T 'Vi' -e vi !@";
    options = OSEL;
  }
  {
    name = "Edit : Emacs";
    icon = "emacs.xbm";
    prog = "xterm -T 'Emacs' -e emacs !@";
    options = MSEL;
  }
  {
    name = "Edit : Ved";
    icon = "alien.xbm";
    prog = "xterm -T 'Poplog Ved' -e ved !@";
    options = OSEL;
  }
  {
    name = "Word Count";
    icon = "wordc.xbm";
    prog = "xterm -T 'Word Count' -e sh -c 'wc !@ | less'";
    options = MSEL;
  }
}

# -----------------------------------------------------------------------
define "remote logins" = {
  {
    name = "tsuna";
    icon = "fish.xbm";
    prog = "xterm -e rlogin tsuna";
    options = NSEL;
  }
  {
    name = "syma";
    icon = "hedgehog.xbm";
    prog = "xterm -e rlogin syma";
    options = NSEL;
  }
  {
    name = "cste";
    icon = "snail.xbm";
    prog = "xterm -e rlogin cste";
    options = NSEL;
  }
  {
    name = "dinkum";
    icon = "prog.xbm";
    prog = "xterm -e rlogin dinkum";
    options = NSEL;
  }
  {
    name = "cousteau";
    icon = "prog.xbm";
    prog = "xterm -e rlogin cousteau";
    options = NSEL;
  }
  {
    name = "surya";
    icon = "prog.xbm";
    prog = "xterm -e rlogin surya";
    options = NSEL;
  }
  {
    name = "lucretia";
    icon = "mermaid.xbm";
    prog = "xterm -e rlogin lucretia";
    options = NSEL;
  }
}
# -----------------------------------------------------------------------
