v02i075: postit notes, Part02/02
Mike Wexler
mikew at wyse.wyse.com
Thu Jan 5 04:11:18 AEST 1989
Submitted-by: davy at riacs.edu (Dave Curry)
Posting-number: Volume 2, Issue 75
Archive-name: postit/part02
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 2 (of 2)."
# Contents: AUTHOR Plaid.h PlaidP.h util.c
# Wrapped by mikew at wyse on Wed Jan 4 10:09:53 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'AUTHOR' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'AUTHOR'\"
else
echo shar: Extracting \"'AUTHOR'\" \(1300 characters\)
sed "s/^X//" >'AUTHOR' <<'END_OF_FILE'
X(Message inbox:701)
XReturn-Path: mips!ames!rutgers!icarus.riacs.edu!davy
XReceived: by wyse.wyse.com (5.58/Wyse master/5-13-88)
X id AA17919; Tue, 3 Jan 89 13:20:14 PST
XReceived: by mips.com id AA25413(1.0); Tue, 3 Jan 89 13:17:09 PST
XReceived: Tue, 3 Jan 89 12:59:10 PST by ames.arc.nasa.gov (5.59/1.2)
XFrom: <mips!icarus.riacs.edu!davy>
XReceived: from icarus.riacs.edu by rutgers.edu (5.59/SMI4.0/RU1.0/3.03)
X id AA03600; Tue, 3 Jan 89 16:07:22 EST
XReceived: from intrepid.riacs.edu by icarus.riacs.edu (5.59/2.0G)
X id AA04134; Tue, 3 Jan 89 13:07:00 PST
XReceived: from localhost by intrepid.riacs.edu (5.59/2.0N)
X id AA02266; Tue, 3 Jan 89 13:09:23 PST
XMessage-Id: <8901032109.AA02266 at intrepid.riacs.edu>
XTo: mips!ames!mips!wyse!x-sources-request
XSubject: XPOSTIT - Post-it notes for X11 (part 1 of 2)
XDate: Tue, 03 Jan 89 13:09:20 -0800
X
X
XWell, I finally got around to rewriting my xpostit program for X11.
XXpostit allows you to place small "Post-it note" windows all over
Xyour screen, as opposed to sticking real Post-it notes all over your
Xworkstation.
X
XThis version is for X11 Release 3 and uses the Athena widgets. It
Xwill not run under X11 Release 2, since it uses the List widget,
Xwhich didn't exist then.
X
XDave Curry
XResearch Institute for Advanced Computer Science
Xdavy at riacs.edu
X
END_OF_FILE
if test 1300 -ne `wc -c <'AUTHOR'`; then
echo shar: \"'AUTHOR'\" unpacked with wrong size!
fi
# end of 'AUTHOR'
fi
if test -f 'Plaid.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Plaid.h'\"
else
echo shar: Extracting \"'Plaid.h'\" \(1276 characters\)
sed "s/^X//" >'Plaid.h' <<'END_OF_FILE'
X/*
X * $Header$
X *
X * Plaid.h - public definitions for the plaid widget.
X *
X * Based on the Template widget from the X11R3 distribution.
X *
X * David A. Curry
X * Research Institute for Advanced Computer Science
X * Mail Stop 230-5
X * NASA Ames Research Center
X * Moffett Field, CA 94086
X * davy at riacs.edu
X *
X * $Log$
X */
X#include <X11/copyright.h>
X
X#ifndef _Plaid_h
X#define _Plaid_h
X
X/*
X * Resources:
X *
X * Name Class RepType Default Value
X * ---- ----- ------- -------------
X * background Background Pixel XtDefaultBackground
X * border BorderColor Pixel XtDefaultForeground
X * borderWidth BorderWidth Dimension 1
X * callback Callback Callback NULL
X * destroyCallback Callback Pointer NULL
X * foreground Foreground Pixel XtDefaultForeground
X * height Height Dimension 0
X * mappedWhenManaged MappedWhenManaged Boolean True
X * sensitive Sensitive Boolean True
X * width Width Dimension 0
X * x Position Position 0
X * y Position Position 0
X */
X
X/*
X * Declare specific PlaidWidget class and instance datatypes.
X */
Xtypedef struct _PlaidClassRec* PlaidWidgetClass;
Xtypedef struct _PlaidRec* PlaidWidget;
X
X/*
X * Declare the class constant.
X */
Xextern WidgetClass plaidWidgetClass;
X
X#endif _Plaid_h
END_OF_FILE
if test 1276 -ne `wc -c <'Plaid.h'`; then
echo shar: \"'Plaid.h'\" unpacked with wrong size!
fi
# end of 'Plaid.h'
fi
if test -f 'PlaidP.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'PlaidP.h'\"
else
echo shar: Extracting \"'PlaidP.h'\" \(1035 characters\)
sed "s/^X//" >'PlaidP.h' <<'END_OF_FILE'
X/*
X * $Header$
X *
X * PlaidP.h - private definitions for the plaid widget.
X *
X * Based on the Template widget from the X11R3 distribution.
X *
X * David A. Curry
X * Research Institute for Advanced Computer Science
X * Mail Stop 230-5
X * NASA Ames Research Center
X * Moffett Field, CA 94086
X * davy at riacs.edu
X *
X * $Log$
X */
X#include <X11/copyright.h>
X
X#ifndef _PlaidP_h
X#define _PlaidP_h
X
X#include <X11/CoreP.h>
X#include "Plaid.h"
X
X/*
X * The plaid part of the class record is not used.
X */
Xtypedef struct {
X int empty;
X} PlaidClassPart;
X
X/*
X * Declare the class record for the widget.
X */
Xtypedef struct _PlaidClassRec {
X CoreClassPart core_class;
X PlaidClassPart plaid_class;
X} PlaidClassRec;
X
X/*
X * Declare the plaid class record type.
X */
Xextern PlaidClassRec plaidClassRec;
X
X/*
X * Resources specific to the plaid widget.
X */
Xtypedef struct {
X Pixel foreground;
X XtCallbackList input_callback;
X} PlaidPart;
X
X/*
X * Declare the widget type.
X */
Xtypedef struct _PlaidRec {
X CorePart core;
X PlaidPart plaid;
X} PlaidRec;
X
X#endif _PlaidP_h
END_OF_FILE
if test 1035 -ne `wc -c <'PlaidP.h'`; then
echo shar: \"'PlaidP.h'\" unpacked with wrong size!
fi
# end of 'PlaidP.h'
fi
if test -f 'util.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'util.c'\"
else
echo shar: Extracting \"'util.c'\" \(1843 characters\)
sed "s/^X//" >'util.c' <<'END_OF_FILE'
X#ifndef lint
Xstatic char *RCSid = "$Header$";
X#endif
X
X/*
X * util.c - utility routines.
X *
X * David A. Curry
X * Research Institute for Advanced Computer Science
X * Mail Stop 230-5
X * NASA Ames Research Center
X * Moffett Field, CA 94086
X * davy at riacs.edu
X *
X * $Log$
X */
X#include <X11/StringDefs.h>
X#include <X11/Intrinsic.h>
X#include <sys/param.h>
X#include <stdio.h>
X#include <pwd.h>
X
X#include "xpostit.h"
X
X/*
X * ByeBye - clean up and exit.
X */
Xvoid
XByeBye()
X{
X /*
X * If saving notes is on, save all notes.
X */
X if (app_res.save_notes)
X SaveAllNotes();
X
X XtUnmapWidget(toplevel);
X XCloseDisplay(display);
X
X exit(0);
X}
X
X/*
X * SetNoteDir - determine the path to the note directory.
X */
Xvoid
XSetNoteDir()
X{
X char *getenv();
X char *home, *s;
X struct passwd *pwd;
X char fname[MAXPATHLEN];
X
X /*
X * If it's an absolute path name,
X * we're done.
X */
X if (app_res.note_dir[0] == '/')
X return;
X
X /*
X * Find the user's home directory.
X */
X if ((home = getenv("HOME")) == NULL) {
X if ((pwd = getpwuid(getuid())) == NULL) {
X fprintf(stderr, "xpostit: who are you?\n");
X exit(1);
X }
X
X home = pwd->pw_dir;
X }
X
X /*
X * Save the path.
X */
X sprintf(fname, "%s/%s", home, app_res.note_dir);
X
X s = SafeAlloc(strlen(fname) + 1);
X app_res.note_dir = s;
X strcpy(s, fname);
X}
X
X/*
X * MakeFname - make a file name from a note index number.
X */
Xchar *
XMakeFname(index)
Xregister int index;
X{
X char *s;
X char fname[MAXPATHLEN];
X
X sprintf(fname, "%s/%s%d", app_res.note_dir, PostItNoteFname, index);
X s = SafeAlloc(strlen(fname) + 1);
X strcpy(s, fname);
X return(s);
X}
X
X/*
X * SafeAlloc - allocate n bytes of memory, exit if we run out.
X */
Xchar *
XSafeAlloc(nbytes)
Xregister int nbytes;
X{
X char *malloc();
X register char *s;
X
X if ((s = malloc(nbytes)) == NULL) {
X fprintf(stderr, "xpostit: out of memory.\n");
X exit(1);
X }
X
X bzero(s, nbytes);
X return(s);
X}
END_OF_FILE
if test 1843 -ne `wc -c <'util.c'`; then
echo shar: \"'util.c'\" unpacked with wrong size!
fi
# end of 'util.c'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked both archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
Moderator of comp.sources.x
More information about the Comp.sources.x
mailing list