v13i049: xmail, Part07/11

Michael Wagnitz stratus!voder!nsc!berlioz.nsc.com!michael at uunet.UU.NET
Sun Jun 16 05:44:49 AEST 1991


Submitted-by: stratus!voder!nsc!berlioz.nsc.com!michael at uunet.UU.NET (Michael Wagnitz)
Posting-number: Volume 13, Issue 49
Archive-name: xmail/part07

#! /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 7 (of 11)."
# Contents:  windows.c
# Wrapped by michael at harley on Fri May  3 13:35:52 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'windows.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'windows.c'\"
else
echo shar: Extracting \"'windows.c'\" \(23480 characters\)
sed "s/^X//" >'windows.c' <<'END_OF_FILE'
X/*
X * xmail - X window system interface to the mail program
X *
X * Copyright 1989 The University of Texas at Austin
X *
X * Author:	Po Cheung
X * Date:	March 10, 1989
X *
X * Permission to use, copy, modify, and distribute this software and
X * its documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation.  The University of Texas at Austin makes no 
X * representations about the suitability of this software for any purpose.  
X * It is provided "as is" without express or implied warranty.
X *
X * Copyright 1990 by National Semiconductor Corporation
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of National Semiconductor Corporation not
X * be used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS"
X * WITHOUT EXPRESS OR IMPLIED WARRANTY.  NATIONAL SEMICONDUCTOR CORPORATION
X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X * PERFORMANCE OF THIS SOFTWARE.
X *
X * The following software modules were created and are Copyrighted by National
X * Semiconductor Corporation:
X *
X * 1. AddHelpText:
X * 2. AddInfoHandler:
X * 3. AddMenuWindow:
X * 4. AddSetMenu:
X * 5. CreateFolderButton: and
X * 6. CreateInputWindow.
X *
X * Author:  Michael C. Wagnitz - National Semiconductor Corporation
X *
X */
X
X
X#include "global.h"
X#include "MailwatchP.h"
X#include "patchlevel.h"
X#include "icon.mail"
X#include "national.bm"
X
X
X/*
X** @(#)AddHelpText() - add help text to string resources for help widget
X*/
Xvoid
XAddHelpText(parent, help_text)
XWidget parent;
XString	help_text;
X{
X Arg		args[3];
X String		name;
X
X static String	p_Trans = "#override \
X			!Shift<Btn2Down>: ShowHelp()\n\
X				<Btn2Up>: MenuPopdown(help)";
X
X XtOverrideTranslations(parent, XtParseTranslationTable(p_Trans));
X
X HelpList.name[HelpList.indx] = name = parent->core.name;
X
X XtSetArg(args[0], XtNstring, (XtArgVal) help_text);
X XtSetArg(args[1], XtNlength, (XtArgVal) strlen(help_text));
X XtSetArg(args[2], XtNeditType, (XtArgVal) XawtextRead);
X
X HelpList.text[HelpList.indx] = XtCreateWidget(name, asciiSrcObjectClass,
X                           XtNameToWidget(toplevel, "topBox.help.helpWindow"),
X                           args, 3);
X HelpList.indx += 1;
X} /* AddHelpText */
X
X
Xvoid
XAddInfoHandler(widget, message)
XWidget widget;
Xchar *message;
X{
X if (XMail.Show_Info)
X    XtAddEventHandler(widget,
X		  (EventMask) (EnterWindowMask|LeaveWindowMask),
X		  False,
X		  info_handler,
X		  (caddr_t) message);
X}
X
X
X/* 
X** @(#)AddMenuWindow() - create menu popup for the specified widget
X*/
Xvoid
XAddMenuWindow(parent, action, list, info_text)
XWidget		parent;
XString		action;
XmenuList_p	*list;
XString		*info_text;
X{
X Arg	 	args[6];
X Cardinal	j, k, n, indx;
X Widget		menu, layout, previous, next;
X char		tag[BUFSIZ], trans[BUFSIZ], *c;		
X
X static String p_Trans =
X	"<Btn3Down>:	SetPopup(%s) MenuPopup(%s)";
X
X static String b_Trans =
X	"<EnterWindow>:	highlight() set() \n\
X	 <LeaveWindow>: unset()  unhighlight()\n\
X	 <Btn3Up>:	notify() reset()";
X
X static String m_Trans =
X	"<Btn3Up>:	MenuPopdown(%s)";
X
X static String L_Trans[] = { NULL,
X	"! Shift      <Btn1Down>: %s(%s)",
X	"!       Ctrl <Btn1Down>: %s(%s)",
X	"! Shift Ctrl <Btn1Down>: %s(%s)",
X	NULL };
X
X static String Labels[] = { NULL,
X	" [Shift]",
X	"        [Ctrl]",
X	" [Shift][Ctrl]",
X	NULL };
X
X
X if (list[0]) {
X    (void) sprintf(tag, "%s_menu", parent->core.name);
X    (void) sprintf(trans, p_Trans, tag, tag);
X    XtOverrideTranslations(parent, XtParseTranslationTable(trans));
X
X    (void) sprintf(trans, m_Trans, tag);
X    XtSetArg(args[0], XtNtranslations, XtParseTranslationTable(trans));
X    menu = XtCreatePopupShell(tag, overrideShellWidgetClass, parent, args, ONE);
X
X    XtSetArg(args[0], XtNdefaultDistance, (XtArgVal) 1);
X    layout = XtCreateManagedWidget("menu", formWidgetClass, menu, args, ONE);
X/*
X** Find widest label for this menu
X*/
X    for (j = k = n = indx = 0; list[indx] != NULL; indx++)
X        if ((k = strlen(list[indx]->label)) > j) {
X           j = k;
X           n = indx;
X          }
X    k = XTextWidth(XMail.buttonFont, list[n]->label, j) + 12;
X
X    if (--indx > 0)	/* add length for accelerator keys menu notes */
X       k += XTextWidth(XMail.buttonFont, Labels[indx], strlen(Labels[indx]));
X/*
X** create the menu buttons
X*/
X    previous = NULL;
X    XtSetArg(args[0], XtNwidth, k);
X    XtSetArg(args[1], XtNfont, XMail.buttonFont);
X    XtSetArg(args[2], XtNjustify, XtJustifyLeft);
X    XtSetArg(args[3], XtNtranslations, XtParseTranslationTable(b_Trans));
X    for (indx = 0; list[indx] != NULL; indx++) {
X        strcpy(tag, list[indx]->label);		/* set window name by label */
X        if ((c = strchr(tag, ' '))) *c = '\0';	/* first word only */
X        sprintf(trans, "%-*.*s", j, j, list[indx]->label);
X        if (Labels[indx])			/* add accel. note if needed */
X           strcat(trans, Labels[indx]);
X
X        XtSetArg(args[4], XtNlabel, trans);
X        XtSetArg(args[5], XtNfromVert, previous);
X        next = XtCreateManagedWidget(tag, commandWidgetClass, layout, args, 6);
X
X        if (info_text)
X           AddInfoHandler(next, info_text[indx]);
X
X        XtAddCallback(next, XtNcallback, list[indx]->func, list[indx]->data);
X        previous = next;
X
X	if (L_Trans[indx]) {
X	   sprintf(trans, L_Trans[indx], action, list[indx]->data);
X           XtOverrideTranslations(parent, XtParseTranslationTable(trans));
X          }
X       }
X/*
X** Dummy out any remaining combinations of accelerators to do nothing
X*/
X    for (; L_Trans[indx] != NULL; indx++) {
X	sprintf(trans, L_Trans[indx], "DoNothing", "");
X        XtOverrideTranslations(parent, XtParseTranslationTable(trans));
X       }
X   }
X} /* AddMenuWindow */
X
X
X/*
X** @(#)AddButton() - add a button to the command window
X**                   include help and an auxilary commands popup menu
X*/
Xvoid
XAddButton(parent, name, action, command, list, info_text, help_text)
XWidget		parent;			/* widget which holds this button */
XString		name;			/* Label for button (and children) */
XString		action;			/* name of the XtActionProc to call */
XString		command;		/* passed as param(s) to ActionProc */
XmenuList_p	*list;			/* aux. menu buttons list w/ cbacks */
XString		*info_text;		/* pointer to button specific info */
XString		help_text;		/* pointer to button specific help */
X{
X Arg		args[5];
X Widget		button;
X char		trans[BUFSIZ];
X/*
X** Insert name of XtActionProc (and parameter(s)) in the translation list
X*/
X (void) sprintf(trans, "#override <Btn1Down>: %s(%s)", action, command);
X
X XtSetArg(args[0], XtNwidth, XMail.buttonWidth);
X XtSetArg(args[1], XtNheight, XMail.buttonHeight);
X XtSetArg(args[2], XtNresize, False);
X XtSetArg(args[3], XtNfont, XMail.buttonFont);
X XtSetArg(args[4], XtNtranslations, XtParseTranslationTable(trans));
X button = XtCreateManagedWidget(name, commandWidgetClass, parent, args, 5);
X
X if (info_text)
X    AddInfoHandler(button, info_text[0]);
X
X if (help_text)
X    AddHelpText(button, help_text);
X
X if (list)
X    AddMenuWindow(button, action, list, info_text);
X} /* AddButton */
X
X
X/* 
X** @(#)AddSetMenu() - add hook to create menu for toggling mail options
X*/
Xvoid
XAddSetMenu(w)
XWidget		w;
X{
X Widget		parent = XtNameToWidget(w, "preserve");
X static String p_Trans = "#override \
X    <Btn3Down>: SetMenu() MenuPopup(set_menu)";
X
X XtOverrideTranslations(parent, XtParseTranslationTable(p_Trans));
X} /* AddSetMenu */
X
X
Xvoid
XCreateButtons(parent)
XWidget parent;
X{
X menuList_p	*list;
X menuList	b1, b2, b3, b4;
X
X
X list = (menuList **) XtMalloc(5 * sizeof(menuList *));
X
X b1.label = "read";        b1.func = (XtCallbackProc) DoWith;  b1.data = "p";
X b2.label = "next";        b2.func = (XtCallbackProc) DoIt;    b2.data = "n";
X b3.label = "previous";    b3.func = (XtCallbackProc) DoIt;    b3.data = "-";
X b4.label = "full header"; b4.func = (XtCallbackProc) DoWith;  b4.data = "P";
X list[0] = &b1; list[1] = &b2; list[2] = &b3; list[3] = &b4; list[4] = NULL;
X AddButton(parent, "read", "DoSelected", "p", list, Read_Info, Read_Help);
X
X b1.label = "save";	b1.func = (XtCallbackProc) Save;	b1.data = "s";
X b2.label = "Save to author"; b2.func = (XtCallbackProc) Save;	b2.data = "S";
X b3.label = "write";	b3.func = (XtCallbackProc) Save;	b3.data = "w";
X list[0] = &b1; list[1] = &b2; list[2] = &b3; list[3] = NULL;
X AddButton(parent, "save", "DoSave", "s", list, Save_Info, Save_Help);
X
X CreateFolderButton(parent);
X
X b1.label = "copy";	b1.func = (XtCallbackProc) Save;	b1.data = "c";
X b2.label = "Copy to author"; b2.func = (XtCallbackProc) Save;	b2.data = "C";
X list[0] = &b1; list[1] = &b2; list[2] = NULL;
X AddButton(parent, "copy", "DoSave", "c", list, Copy_Info, Copy_Help);
X
X AddButton(parent, "preserve", "DoSelected", "preserve", NULL, Hold_Info, Hold_Help);
X
X b1.label = "delete";	b1.func = (XtCallbackProc) DoWith;	b1.data = "d";
X b2.label = "undelete";	b2.func = (XtCallbackProc) DoWith;	b2.data = "u";
X list[0] = &b1; list[1] = &b2; list[2] = NULL;
X AddButton(parent, "delete", "DoSelected", "d", list, Delete_Info, Delete_Help);
X
X b1.label = "Newmail"; b1.func = (XtCallbackProc) DoIt; b1.data = "file %";
X b2.label = "inc (no commit)"; b2.func = (XtCallbackProc) DoIt; b2.data = "inc";
X b3.label = "Drop Folders"; b3.func = (XtCallbackProc) DropIt; b3.data = "drop";
X list[0] = &b1; list[1] = &b2; list[2] = &b3; list[3] = NULL;
X AddButton(parent, "Newmail", "DoCmd", "file %", list, NewMail_Info, NewMail_Help);
X
X b1.label = "quit";	b1.func = (XtCallbackProc) DoQuit;	b1.data = "q";
X b2.label = "exit";	b2.func = (XtCallbackProc) DoQuit;	b2.data = "x";
X list[0] = &b1; list[1] = &b2; list[2] = NULL;
X AddButton(parent, "quit", "Quit", "q", list, Quit_Info, Quit_Help);
X
X b1.label = "print"; b1.func = (XtCallbackProc) DoPrint; b1.data = "";
X list[0] = &b1; list[1] = NULL;
X AddButton(parent, "Print", "PrintMsg", "", list, Print_Info, Print_Help);
X
X b1.label="send a message";    b1.func = (XtCallbackProc) Reply; b1.data = "s";
X b2.label="forward message";   b2.func = (XtCallbackProc) Reply; b2.data = "S";
X list[0] = &b1; list[1] = &b2; list[2] = NULL;
X AddButton(parent, "Send", "DoReply", "s", list, Send_Info, Send_Help);
X
X b1.label="reply";             b1.func = (XtCallbackProc) Reply; b1.data = "r";
X b2.label="reply included";    b2.func = (XtCallbackProc) Reply; b2.data = "R";
X b3.label="replyall";          b3.func = (XtCallbackProc) Reply; b3.data = "a";
X b4.label="replyall included"; b4.func = (XtCallbackProc) Reply; b4.data = "A";
X list[0] = &b1; list[1] = &b2; list[2] = &b3;
X list[3] = &b4; list[4] = NULL;
X AddButton(parent, "reply", "DoReply", "r", list, Reply_Info, Reply_Help);
X
X XtFree((menuList *) list);
X
X CreateFileWindow(parent);
X
X AddSetMenu(parent);		/* add a menu for toggling mail options */
X
X} /* CreateButtons */
X
X
X/*
X** @(#)CreateCommandPanel() - add buttons, and set up the file menu.
X*/
Xvoid
XCreateCommandPanel(parent)
XWidget parent;
X{
X Arg		args[8];
X Widget		cw;
X
X static String w_Trans = "\
X	<Btn1Down>:	DoNothing()\n\
X	<Btn2Down>:	DoNothing()\n\
X	<Btn3Down>:	DoNothing()";
X
X XtSetArg(args[0], XtNhSpace, XMail.commandHSpace);
X XtSetArg(args[1], XtNvSpace, XMail.commandVSpace);
X XtSetArg(args[2], XtNallowResize, (XtArgVal) False);
X XtSetArg(args[3], XtNmax, XMail.commandHeight);
X XtSetArg(args[4], XtNmin, XMail.commandHeight);
X XtSetArg(args[5], XtNfont, XMail.buttonFont);
X XtSetArg(args[6], XtNtranslations, XtParseTranslationTable(w_Trans));
X XtSetArg(args[7], XtNshowGrip, (XtArgVal) False);
X
X cw = XtCreateManagedWidget("commandPanel", boxWidgetClass, parent, args, 8);
X
X CreateButtons(cw);
X} /* CreateCommandPanel */
X
X
X/*
X** @(#)CreateFileWindow() - for user entry of file and folder names
X** Includes a special set of action routines for the keys to do
X** Delete/Backspace, Ctrl-U, Ctrl-W, and insert-selection().
X*/
Xvoid
XCreateFileWindow(parent)
XWidget parent;
X{
X Arg		args[9];
X Widget		w;
X
X static String	trans = "#override \n\
X  Ctrl <Key>a:		beginning-of-file() \n\
X  Ctrl <Key>b:		backward-character() \n\
X  Ctrl <Key>d:		CheckInsert() delete-next-character() \n\
X  Ctrl <Key>e:		end-of-file() \n\
X  Ctrl <Key>f:		forward-character() \n\
X  Ctrl <Key>h:		DeleteChar() \n\
X  Ctrl <Key>j:		DoNothing() \n\
X  Ctrl <Key>m:		DoNothing() \n\
X  Ctrl <Key>u:		DeleteLine() \n\
X  Ctrl <Key>w:		DeleteWord() \n\
X  Meta <Key>b:		backward-word() \n\
X  Meta <Key>d:		CheckInsert() delete-next-word() \n\
X  Meta <Key>f:		forward-word() \n\
X       <Key>Delete:	DeleteChar() \n\
X       <Key>BackSpace:	DeleteChar() \n\
X       <Key>Linefeed:	DoNothing() \n\
X       <Key>Return:	DoNothing() \n\
X       <Key>Right:	forward-character() \n\
X       <Key>Left:	backward-character() \n\
X       <Key>:		CheckInsert() insert-char()\n\
X       <Btn1Down>:	select-start() \n\
X       <Btn2Down>:	CheckInsert() insert-selection(PRIMARY, CUT_BUFFER0)";
X
X
X XtSetArg(args[0], XtNwidth, XMail.fileBoxWidth);
X XtSetArg(args[1], XtNheight, XMail.buttonHeight);
X XtSetArg(args[2], XtNborderWidth, 1);
X XtSetArg(args[3], XtNfont, XMail.buttonFont);
X XtSetArg(args[4], XtNeditType, XawtextEdit);
X XtSetArg(args[5], XtNstring, (XtArgVal) FileBuf);
X XtSetArg(args[6], XtNlength, (XtArgVal) BUFSIZ);
X XtSetArg(args[7], XtNuseStringInPlace, (XtArgVal) True);
X XtSetArg(args[8], XtNtranslations, XtParseTranslationTable(trans));
X
X w = XtCreateManagedWidget("fileWindow", asciiTextWidgetClass, parent, args, 9);
X
X writeText(w, "File: ", 0);		/* insert label and position cursor */
X
X AddInfoHandler(w, "Specify the name of a mail folder");
X
X AddHelpText(w, File_Help);
X} /* CreateFileWindow */
X
X
X/*
X** @(#)CreateFolderButton() - attach special Btn3 hook to list folders
X*/
Xvoid
XCreateFolderButton(parent)
XWidget	parent;
X{
X Arg		args[5];
X Widget		button;
X
X static String	trans = "#override \n\
X			<Btn1Down>: Folder() \n\
X			<Btn3Down>: SetFolders() MenuPopup(popupList)";
X
X XtSetArg(args[0], XtNwidth, XMail.buttonWidth);
X XtSetArg(args[1], XtNheight, XMail.buttonHeight);
X XtSetArg(args[2], XtNresize, False);
X XtSetArg(args[3], XtNfont, XMail.buttonFont);
X XtSetArg(args[4], XtNtranslations, XtParseTranslationTable(trans));
X button = XtCreateManagedWidget("Folder", commandWidgetClass, parent, args, 5);
X
X AddInfoHandler(button, Folder_Info[0]);
X
X AddHelpText(button, Folder_Help);
X} /* CreateFolderButton */
X
X
X/* 
X** @(#)CreateHelpWindow() - create popup window for the help text
X*/
Xvoid
XCreateHelpWindow(parent)
XWidget parent;
X{
X Arg	args[4];
X Widget	w;
X static String	trans = "#override \n\
X  <Key>Linefeed:	MenuPopdown(help)";
X
X XtSetArg(args[0], XtNborderWidth, 3);
X w = XtCreatePopupShell("help", overrideShellWidgetClass, parent, args, 1);
X
X XtSetArg(args[0], XtNwidth, XMail.helpWidth);
X XtSetArg(args[1], XtNheight, XMail.helpHeight);
X XtSetArg(args[2], XtNfont, XMail.helpFont);
X XtSetArg(args[3], XtNtranslations, XtParseTranslationTable(trans));
X
X XtCreateManagedWidget("helpWindow", asciiTextWidgetClass, w, args, 4);
X} /* CreateHelpWindow */
X
X
X/* 
X** Index window is a AsciiTextWidget, with special key assignments
X*/
Xvoid
XCreateIndexWindow(parent)
XWidget parent;
X{
X Arg	args[6];
X Widget	w;
X
X XtSetArg(args[0], XtNheight, XMail.indexHeight);
X XtSetArg(args[1], XtNfont, XMail.textFont);
X XtSetArg(args[2], XtNdisplayCaret, (XtArgVal) False);
X XtSetArg(args[3], XtNeditType, XawtextEdit);
X XtSetArg(args[4], XtNscrollVertical, XawtextScrollAlways);
X XtSetArg(args[5], XtNstring, "");
X
X w = XtCreateManagedWidget("indexWindow", asciiTextWidgetClass,parent,args,6);
X
X AddHelpText(w, Index_Help);
X} /* CreateIndexWindow */
X
X
X/*
X** @(#)CreateStatusWindow() - place for messages from mail
X*/
Xvoid
XCreateStatusWindow(parent)
XWidget parent;
X{
X Arg		args[10];
X Widget		w;
X
X static String w_Trans = "\
X	<Btn1Down>:	DoNothing()\n\
X	<Btn3Down>:	DoNothing()";
X
X XtSetArg(args[0], XtNallowResize, False);
X XtSetArg(args[1], XtNmin, XMail.buttonHeight);
X XtSetArg(args[2], XtNmax, XMail.buttonHeight);
X XtSetArg(args[3], XtNshowGrip, False);
X
X XtSetArg(args[4], XtNwidth, XMail.shellWidth);
X XtSetArg(args[5], XtNfont, XMail.textFont);
X XtSetArg(args[6], XtNjustify, XtJustifyCenter);
X XtSetArg(args[7], XtNlabel, "Establishing connections");
X XtSetArg(args[8], XtNresize, False);
X XtSetArg(args[9], XtNtranslations, XtParseTranslationTable(w_Trans));
X
X w = XtCreateManagedWidget("statusWindow", labelWidgetClass, parent, args, 10);
X
X AddHelpText(w, Status_Help);
X} /* CreateStatusWindow */
X
X
X/*
X** @(#)CreateSubWindows() - create all the xmail subwindows.
X*/
Xvoid
XCreateSubWindows(parent)
XWidget parent;
X{
X Arg		args[4];
X Widget		icon, mb, topbox;
X int		n, x, y;
X
X
X XtSetArg(args[0], XtNinput,      True);
X XtSetArg(args[1], XtNwidth,      XMail.shellWidth);
X XtSetArg(args[2], XtNgripIndent, 0);
X XtSetArg(args[3], XtNskipAdjust, True);
X
X topbox = XtCreateManagedWidget("topBox", panedWidgetClass, parent, args, 4);
X
X CreateHelpWindow(topbox);
X CreateTitleBar(topbox);
X CreateIndexWindow(topbox);
X CreateStatusWindow(topbox);
X CreateCommandPanel(topbox);
X CreateTextWindow(topbox);
X/*
X** Create an icon window for the mailwatchWidget
X*/
X XtSetArg(args[0], XtNwidth, (XtArgVal) mail_width);
X XtSetArg(args[1], XtNheight, (XtArgVal) mail_height);
X n = 2;
X if (XMail.iconGeometry) {
X    ParseIconGeometry(XMail.iconGeometry, &x, &y);
X    XtSetArg(args[n], XtNx, (XtArgVal) x);		n++;
X    XtSetArg(args[n], XtNy, (XtArgVal) y);		n++;
X   }
X icon = XtCreateWidget("icon", applicationShellWidgetClass, toplevel, args, n);
X mb = XtCreateManagedWidget("mailbox", mailwatchWidgetClass, icon, NULL, 0);
X XtAddCallback(mb, XtNcallback, SetNewmail, NULL);
X} /* CreateSubWindows */ 
X
X
X/* 
X** @(#)CreateTextWindow() - AsciiTextWidget window, without special keys
X*/
Xvoid
XCreateTextWindow(parent)
XWidget parent;
X{
X Arg 		args[11];
X Widget		form, face, tw;
X
X
X XtSetArg(args[0], XtNmin, XMail.textHeight / 3);
X XtSetArg(args[1], XtNheight, XMail.textHeight);
X XtSetArg(args[2], XtNwidth, XMail.shellWidth);
X form = XtCreateManagedWidget("textWindow", formWidgetClass, parent, args, 3);
X
X XtSetArg(args[0], XtNleft, XtChainRight);
X XtSetArg(args[1], XtNright, XtChainRight);
X XtSetArg(args[2], XtNtop, XtChainTop);
X XtSetArg(args[3], XtNbottom, XtChainTop);
X XtSetArg(args[4], XtNvertDistance, 0);
X XtSetArg(args[5], XtNhorizDistance, XMail.shellWidth - 48);
X XtSetArg(args[6], XtNborderWidth, 0);
X XtSetArg(args[7], XtNheight, 48);
X XtSetArg(args[8], XtNwidth, 48);
X XtSetArg(args[9], XtNinternalWidth, 0);
X face = XtCreateWidget("face", labelWidgetClass, form, args, 10);
X
X XtSetArg(args[0], XtNleft, XtChainLeft);
X XtSetArg(args[1], XtNright, XtChainRight);
X XtSetArg(args[2], XtNtop, XtChainTop);
X XtSetArg(args[3], XtNbottom, XtChainBottom);
X /* see above... */
X XtSetArg(args[5], XtNhorizDistance, 0);
X /* see above... */
X XtSetArg(args[7], XtNheight, XMail.textHeight);
X XtSetArg(args[8], XtNfont, XMail.textFont);
X XtSetArg(args[9], XtNstring, "");
X XtSetArg(args[10], XtNscrollVertical, XawtextScrollAlways);
X tw = XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, 11);
X
X AddHelpText(tw, Text_Help);
X
X HelpList.name[HelpList.indx] = XtNewString("text2");
X
X XtSetArg(args[0], XtNstring, (XtArgVal) Text2_Help);
X XtSetArg(args[1], XtNlength, (XtArgVal) strlen(Text2_Help));
X HelpList.text[HelpList.indx] = XtCreateWidget("text2", asciiSrcObjectClass,
X                        XtNameToWidget(toplevel, "topBox.help.helpWindow"),
X                        args, 2);
X HelpList.indx += 1;
X} /* CreateTextWindow */
X
X
X/*
X** @(#)CreateTitleBar() - creates the title bar displayed at top of shell
X**			  Include Nat. Semi. Corp. logo in top left corner.
X*/
Xvoid
XCreateTitleBar(parent)
XWidget parent;
X{
X Arg		args[8];
X Pixmap		logo;
X Widget		form, lg, tb;
X char		buf[20];
X
X static String w_Trans = "\
X	<Btn1Down>:	DoNothing()\n\
X	<Btn2Down>:	DoNothing()\n\
X	<Btn3Down>:	DoNothing()";
X
X static String l_Trans = "\
X	<Btn1Down>:	Iconify()\n\
X	<Btn2Down>:	Iconify()\n\
X	<Btn3Down>:	Iconify()";
X
X XtSetArg(args[0], XtNdefaultDistance, 1);
X XtSetArg(args[1], XtNallowResize, (XtArgVal) False);
X XtSetArg(args[2], XtNmax, (XtArgVal) XMail.buttonHeight);
X XtSetArg(args[3], XtNmin, (XtArgVal) XMail.buttonHeight);
X XtSetArg(args[4], XtNshowGrip, (XtArgVal) False);
X
X form = XtCreateManagedWidget("titleBar", formWidgetClass, parent, args, 5);
X
X logo = XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root,
X                        national_bits, national_width, national_height);
X
X XtSetArg(args[0], XtNborderWidth, 0);
X XtSetArg(args[1], XtNheight, (XtArgVal) XMail.buttonHeight);
X XtSetArg(args[2], XtNwidth, national_width);
X XtSetArg(args[3], XtNinternalWidth, 0);
X XtSetArg(args[4], XtNbitmap, (XtArgVal) logo);
X XtSetArg(args[5], XtNtranslations, XtParseTranslationTable(l_Trans));
X lg = XtCreateManagedWidget("logo", commandWidgetClass, form, args, 6);
X
X sprintf(buf, "%s%d", TITLE, PATCHLEVEL);
X
X XtSetArg(args[2], XtNwidth, XMail.shellWidth - national_width - 2);
X XtSetArg(args[3], XtNlabel, (XtArgVal) buf);
X XtSetArg(args[4], XtNfont, XMail.textFont);
X XtSetArg(args[5], XtNjustify, (XtArgVal) XtJustifyLeft);
X XtSetArg(args[6], XtNfromHoriz, lg);
X XtSetArg(args[7], XtNtranslations, XtParseTranslationTable(w_Trans));
X tb = XtCreateManagedWidget("title", labelWidgetClass, form, args, 8);
X
X AddHelpText(tb, Title_Help);
X} /* CreateTitleBar */
X
X
X/*
X** @(#)CreateInputWindow() - for specifying recipient, subject, and Cc list
X** Has its own set of translations for editing.
X** Special actions for Delete/Backspace, Ctrl-U, and Ctrl-W.
X*/
XWidget
XCreateInputWindow(parent, name, buf, len)
XWidget		parent;
XString		name;
XString		buf;
XCardinal	len;
X{
X Arg		args[9];
X int		n;
X Widget		w;
X
X n  = XMail.shellWidth - 26;	/* - (20 + 2 * (internal_width+def_dist)) */
X n -= figureWidth(XMail.buttonFont)*9-10; /* less label width+fudge factor */
X
X XtSetArg(args[0], XtNwidth, n);
X XtSetArg(args[1], XtNinput, True);
X XtSetArg(args[2], XtNheight, XMail.buttonHeight + XMail.borderWidth);
X XtSetArg(args[3], XtNfont, XMail.buttonFont);
X XtSetArg(args[4], XtNborderWidth, 1);
X XtSetArg(args[5], XtNstring, buf);
X XtSetArg(args[6], XtNlength, len);
X XtSetArg(args[7], XtNuseStringInPlace, True);
X XtSetArg(args[8], XtNeditType, XawtextEdit);
X
X w = XtCreateManagedWidget(name, asciiTextWidgetClass, parent, args, 9);
X
X return( w );
X} /* CreateInputWindow */
X
X/* 
X** @(#)ParseIconGeometry() - Parse the icon geometry
X*/
Xvoid
XParseIconGeometry(str, x, y)
Xchar	*str;
Xint	*x, *y;
X{
X int		res;
X unsigned int	w, h;
X
X *x = 0;
X *y = 0;
X res = XParseGeometry(str, x, y, &w, &h);
X if ((res & (XNegative|XValue)) == (XNegative|XValue))
X    *x = RootWidth + *x - mail_width;
X if ((res & (YNegative|YValue)) == (YNegative|YValue))
X    *y = RootHeight + *y - mail_height;
X} /* ParseIconGeometry */
END_OF_FILE
if test 23480 -ne `wc -c <'windows.c'`; then
    echo shar: \"'windows.c'\" unpacked with wrong size!
fi
# end of 'windows.c'
fi
echo shar: End of archive 7 \(of 11\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 11 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
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