michael@parns.nsc.com (Michael C. Wagnitz) (03/22/90)
Submitted-by: michael@parns.nsc.com (Michael C. Wagnitz) Posting-number: Volume 6, Issue 46 Archive-name: xmail/part06 #! /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 6 (of 6)." # Contents: windows.c xmail.man # Wrapped by michael@harley on Tue Mar 20 15:28:08 1990 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'\" \(24406 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 TORTIOUS 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. AddMenuWindow: X * 4. CreateFolderButton: and X * 5. CreateInputWindow. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#include "global.h" X#include "Mailwatch.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, name, help_text) XWidget parent; XString name; XString help_text; X{ X Arg args[MAXARGS]; X Cardinal indx, n; X XtTextSource new; X char trans[BUFSIZ]; X X static String p_Trans = "#override \ X !Shift<Btn2Down>: SetHelp(%s)\n\ X <Btn2Up>: MenuPopdown(help)"; X X if (*help_text) { X for (indx = 0; HelpNames[indx]; indx++) X if (strcmp(name, HelpNames[indx]) == 0) break; X X if (HelpNames[indx]) { X (void) sprintf(trans, p_Trans, name, name); X XtOverrideTranslations(parent, XtParseTranslationTable(trans)); X X n = 0; X XtSetArg(args[n], XtNstring, (XtArgVal) help_text); n++; X XtSetArg(args[n], XtNlength, (XtArgVal) strlen(help_text)); n++; X XtSetArg(args[n], XtNeditType, (XtArgVal) XttextRead); n++; X X HelpStrings[indx] = XtStringSourceCreate(WidgetOf(WidgetOf(WidgetOf(toplevel, "vpane"), "help"), "helpWindow"), args, n); X } X } X} /* AddHelpText */ X X X/* X** @(#)AddMenuWindow() - create menu popup for the specified widget X*/ Xvoid XAddMenuWindow(parent, name, action, list) XWidget parent; XString name; XString action; XmenuList_p *list; X{ X Arg args[MAXARGS]; 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) unhighlight()"; X X static String b_Trans = X "<EnterWindow>: set() \n\ X <LeaveWindow>: unset() \n\ X <Btn3Up>: SetCursor(True) notify() SetCursor() reset()"; X X static String m_Trans = X "<Btn3Up>: MenuPopdown(%s)"; X X static String L_Trans[] = { NULL, X "! Shift <Btn1Down>: highlight() %s(%s) unhighlight()", X "! Ctrl <Btn1Down>: highlight() %s(%s) unhighlight()", X "! Shift Ctrl <Btn1Down>: highlight() %s(%s) unhighlight()", 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", 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 n = 0; X XtSetArg(args[n], XtNdefaultDistance, 1); n++; X layout = XtCreateManagedWidget("menu", formWidgetClass, menu, args, n); 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 n = --indx; X/* X** add length for accelerator keys menu notes X*/ X indx = XTextWidth(TextFontStr, list[n]->label, j) + 12; X if (n > 0) X indx += XTextWidth(TextFontStr, Labels[n], strlen(Labels[n])); X X n = 0; X XtSetArg(args[n], XtNwidth, indx); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(b_Trans)); n++; X/* X** create the menu buttons X*/ X previous = NULL; X for (indx = 0; list[indx] != NULL; indx++, n = 3) { X strcpy(tag, list[indx]->label); /* set window id from label */ X if ((c = (char *)index(tag, ' '))) *c = '\0'; X X sprintf(trans, "%-*.*s", j, j, list[indx]->label); X X if (Labels[indx]) /* add accel. note if needed */ X strcat(trans, Labels[indx]); X else X strcat(trans, " "); /* keep all labels aligned */ X X if (indx == 1 && list[indx + 1]) /* 2 option menu is narrower */ X strcat(trans, " "); X X XtSetArg(args[n], XtNlabel, trans); n++; X XtSetArg(args[n], XtNfromVert, previous); n++; X next = XtCreateManagedWidget(tag, commandWidgetClass, layout, args, n); 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} /* 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, 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 help_text; /* pointer to button specific info */ X{ X Arg args[MAXARGS]; X Widget button; X Cardinal n; X char trans[BUFSIZ]; X/* X** Insert name of XtActionProc (and parameter(s)) in the translation list X*/ X (void) sprintf(trans, "\ X <Btn1Down>: highlight() %s(%s) unhighlight()", action, command); X n = 0; X XtSetArg(args[n], XtNwidth, XMail.buttonWidth); n++; X XtSetArg(args[n], XtNheight, XMail.buttonHeight); n++; X XtSetArg(args[n], XtNresize, False); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(trans)); n++; X button = XtCreateManagedWidget(name, commandWidgetClass, parent, args, n); X X if (help_text) X AddHelpText(button, name, help_text); X X if (list) X AddMenuWindow(button, name, action, list); X} /* AddButton */ X X Xvoid XCreateButtons(parent) XWidget parent; X{ X menuList_p *list; X menuList b1, b2, b3, b4, b5; 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_Help_Text); 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 b4.label = "Write to author"; b4.func = (XtCallbackProc) Save; b4.data = "W"; X list[0] = &b1; list[1] = &b2; list[2] = &b3; list[3] = &b4; list[4] = NULL; X AddButton(parent, "save", "DoSave", "s", list, Save_Help_Text); 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_Help_Text); X X b1.label = "hold"; b1.func = (XtCallbackProc) DoWith; b1.data = "hold"; X list[0] = &b1; list[1] = NULL; X AddButton(parent, "hold", "DoSelected", "hold", list, Hold_Help_Text); X X b1.label = "delete"; b1.func = (XtCallbackProc) DoWith; b1.data = "d"; X b2.label = "undelete"; b2.func = (XtCallbackProc) DoIt; b2.data = "u"; X list[0] = &b1; list[1] = &b2; list[2] = NULL; X AddButton(parent, "delete", "DoSelected", "d", list, Delete_Help_Text); X X b1.label = "Newmail"; b1.func = (XtCallbackProc) DoIt; b1.data = "file %"; X#ifdef SUNOS_4 X b2.label = "inc (no commit)"; b2.func = (XtCallbackProc) DoIt; b2.data = "inc"; X list[0] = &b1; list[1] = &b2; list[2] = NULL; X#else X list[0] = &b1; list[1] = NULL; X#endif X AddButton(parent, "Newmail", "DoCmd", "file %", list, NewMail_Help_Text); 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_Help_Text); 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_Help_Text); 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_Help_Text); 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_Help_Text); X X XtFree((menuList *) list); X X CreateFileWindow(parent); 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[10]; X Cardinal n; X Widget cw; X X static String w_Trans = "\ X <Btn1Down>: DoNothing()\n\ X <Btn2Down>: DoNothing()\n\ X <Btn3Down>: DoNothing()"; X X n = 0; X XtSetArg(args[n], XtNhSpace, XMail.commandHSpace); n++; X XtSetArg(args[n], XtNvSpace, XMail.commandVSpace); n++; X XtSetArg(args[n], XtNallowResize, (XtArgVal) False); n++; X XtSetArg(args[n], XtNmax, XMail.commandMinHeight); n++; X XtSetArg(args[n], XtNmin, XMail.commandMinHeight); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(w_Trans)); n++; X#ifndef X11R3 X XtSetArg(args[n], XtNshowGrip, (XtArgVal) False); n++; X#endif X cw = XtCreateManagedWidget("commandPanel", boxWidgetClass, parent, args, n); 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[MAXARGS]; X Cardinal n; X Widget w; X X static String trans = "#override \ X Ctrl<Key>W: DeleteWord() beginning-of-line() end-of-line()\n\ X Ctrl<Key>U: DeleteLine()\n\ X Ctrl<Key>H: InsertSpace() delete-previous-character() beginning-of-line() end-of-line()\n\ X <Key>Delete: InsertSpace() delete-previous-character() beginning-of-line() end-of-line()\n\ X <Key>BackSpace: InsertSpace() delete-previous-character() beginning-of-line() end-of-line()\n\ X <Key>Return: DoNothing()"; X X n = 0; X XtSetArg(args[n], XtNwidth, XMail.fileBoxWidth); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNborderWidth, 0); n++; X XtSetArg(args[n], XtNstring, (XtArgVal) FileBuf); n++; X XtSetArg(args[n], XtNlength, (XtArgVal) BUFSIZ); n++; X XtSetArg(args[n], XtNeditType, (XtArgVal) XttextEdit); n++; X XtSetArg(args[n], XtNtextOptions, wordBreak); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(trans)); n++; X#ifndef X11R3 X XtSetArg(args[n], XtNautoFill, True); n++; X#endif X X w = XtCreateManagedWidget("fileWindow",asciiStringWidgetClass,parent,args,n); X writeText(w, "File: ", 0); X X AddHelpText(w, "file", File_Help_Text); X} /* CreateFileWindow */ X X X/* X** @(#)CreateFolderButton() - attach special Btn3 hook to list folders X*/ Xvoid XCreateFolderButton(parent) XWidget parent; X{ X Arg args[MAXARGS]; X Widget button; /* button which pops up a menu when pressed */ X Cardinal n; X X static String b_Trans = "\ X <Btn1Down>: highlight() Folder() unhighlight() \n\ X <Btn3Down>: SetCursor(True) SetFolders() MenuPopup(popupList) SetCursor()"; X X X/* X** create the command button and add popup menu translations and callback X*/ X n = 0; X XtSetArg(args[n], XtNwidth, XMail.buttonWidth); n++; X XtSetArg(args[n], XtNheight, XMail.buttonHeight); n++; X XtSetArg(args[n], XtNresize, False); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(b_Trans)); n++; X button = XtCreateManagedWidget("Folder", commandWidgetClass, parent, args, n); X X AddHelpText(button, "folder", Folder_Help_Text); X} /* CreateFolderButton */ X X X/* X** @(#)CreateHelpWindow() - create popup window for the help text X*/ Xvoid XCreateHelpWindow(parent) XWidget parent; X{ X Arg args[MAXARGS]; X Cardinal n; X Widget w; X X X n = 0; X XtSetArg(args[n], XtNborderWidth, 3); n++; X w = XtCreatePopupShell("help", overrideShellWidgetClass, parent, args, n); X X n = 0; X XtSetArg(args[n], XtNwidth, XMail.helpWidth); n++; X XtSetArg(args[n], XtNheight, XMail.helpHeight); n++; X XtSetArg(args[n], XtNfont, HelpFontStr); n++; X XtSetArg(args[n], XtNeditType, (XtArgVal) XttextRead); n++; X XtSetArg(args[n], XtNtextOptions, wordBreak); n++; X XtCreateManagedWidget("helpWindow", asciiStringWidgetClass, w, args, n); 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[MAXARGS]; X Cardinal n; X Widget w; X X static String translations = X "<Key>: DoNothing() \n\ X <Btn1Down>: select-start() SetSelect() \n\ X <Btn3Down>: select-start() SetSelect() \n\ X <Btn3Up>: DoSelected(p)"; X X n = 0; X XtSetArg(args[n], XtNheight, XMail.indexHeight); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNstring, (XtArgVal) IndexBuf); n++; X XtSetArg(args[n], XtNlength, (XtArgVal) INDEXSIZE); n++; X XtSetArg(args[n], XtNeditType, (XtArgVal) XttextEdit); n++; X XtSetArg(args[n], XtNtextOptions, scrollVertical | wordBreak); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(translations)); X n++; X w = XtCreateManagedWidget("indexWindow",asciiStringWidgetClass,parent,args,n); X X AddHelpText(w, "index", Index_Help_Text); X} /* CreateIndexWindow */ X X X/* X** @(#)CreateStatusWindow() - place for messages from mail X*/ Xvoid XCreateStatusWindow(parent) XWidget parent; X{ X Arg args[MAXARGS]; X Cardinal n; X Widget w; X X static String w_Trans = "\ X <Btn1Down>: DoNothing()\n\ X <Btn3Down>: DoNothing()"; X X n = 0; X XtSetArg(args[n], XtNwidth, (XtArgVal) XMail.shellWidth); n++; X XtSetArg(args[n], XtNallowResize, (XtArgVal) False); n++; X XtSetArg(args[n], XtNmax, (XtArgVal) XMail.buttonHeight); n++; X XtSetArg(args[n], XtNmin, (XtArgVal) XMail.buttonHeight); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNjustify, (XtArgVal) XtJustifyCenter); n++; X XtSetArg(args[n], XtNlabel, (XtArgVal) "Establishing connections"); n++; X XtSetArg(args[n], XtNresize, (XtArgVal) False); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(w_Trans)); n++; X#ifndef X11R3 X XtSetArg(args[n], XtNshowGrip, (XtArgVal) False); n++; X#endif X w = XtCreateManagedWidget("statusWindow", labelWidgetClass, parent, args, n); X X AddHelpText(w, "status", Status_Help_Text); X} /* CreateStatusWindow */ X X X/* X** @(#)CreateSubWindows() - create all the xmail subwindows. X*/ Xvoid XCreateSubWindows(parent) XWidget parent; X{ X Arg args[MAXARGS]; X Cardinal k, n; X Widget icon, mb, vpane; X/* X** Special added actions X*/ Xstatic XtActionsRec actionTable[] = { X {"DeleteWord", (XtActionProc) DeleteWord}, X {"DeleteLine", (XtActionProc) DeleteLine}, X {"Iconify", (XtActionProc) Iconify}, X {"InsertSpace", (XtActionProc) InsertSpace}, X {"Folder", (XtActionProc) Folder}, X {"SetPopup", (XtActionProc) SetPopup}, X {"SetFolders", (XtActionProc) SetFolders}, X {"SetHelp", (XtActionProc) SetHelp}, X {"DoNothing", (XtActionProc) DoNothing}, X {"DoSelected", (XtActionProc) DoSelected}, X {"SetAliases", (XtActionProc) SetAliases}, X {"SetCursor", (XtActionProc) SetCursor}, X {"SetDirectory", (XtActionProc) SetDirectory}, X {"SetSelect", (XtActionProc) SetSelect}, X {"DoAutograph", (XtActionProc) DoAutograph}, X {"DoDone", (XtActionProc) DoDone}, X {"DoCmd", (XtActionProc) DoCmd}, X {"DoReply", (XtActionProc) DoReply}, X {"DoSave", (XtActionProc) DoSave}, X {"MyNotify", (XtActionProc) MyNotify}, X {"NextField", (XtActionProc) NextField}, X {"PrintMsg", (XtActionProc) PrintMsg}, X {"Quit", (XtActionProc) Quit}, X {NULL, NULL} X }; X X XtAddActions(actionTable, XtNumber(actionTable)); X X n = 0; X XtSetArg(args[n], XtNinput, (XtArgVal) True); n++; X XtSetArg(args[n], XtNwidth, (XtArgVal) XMail.shellWidth); n++; X XtSetArg(args[n], XtNgripIndent, (XtArgVal) 0); n++; X XtSetArg(args[n], XtNskipAdjust, (XtArgVal) True); n++; X X vpane = XtCreateManagedWidget("vpane", vPanedWidgetClass, parent, args, n); X X CreateHelpWindow(vpane); X CreateTitleBar(vpane); X CreateIndexWindow(vpane); X CreateStatusWindow(vpane); X CreateCommandPanel(vpane); X CreateTextWindow(vpane); X/* X** Create an icon window for the mailwatchWidget X*/ X n = 0; X XtSetArg(args[n], XtNwidth, (XtArgVal) mail_width); n++; X XtSetArg(args[n], XtNheight, (XtArgVal) mail_height); n++; X icon = XtCreateWidget("icon", applicationShellWidgetClass, toplevel, args, n); X mb = XtCreateManagedWidget("mailbox", mailwatchWidgetClass, icon, NULL, 0); X XtAddCallback(mb, XtNcallback, SetNewmail, NULL); X X} /* CreateSubWindows */ X X X/* X** @(#)CreateTextWindow() - AsciiTextWidget window, without special keys X*/ Xvoid XCreateTextWindow(parent) XWidget parent; X{ X Arg args[MAXARGS]; X Cardinal n; X Widget tw; X X X n = 0; X XtSetArg(args[n], XtNmin, XMail.textMinHeight); n++; X XtSetArg(args[n], XtNheight, XMail.textHeight); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNtextOptions, scrollVertical | wordBreak); n++; X tw = XtCreateManagedWidget("textWindow",asciiStringWidgetClass,parent,args,n); X X AddHelpText(tw, "text", Text_Help_Text); 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[MAXARGS]; X Cardinal n; X Pixmap logo; X Widget form, lg, tb; 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 n = 0; X XtSetArg(args[n], XtNdefaultDistance, 1); n++; X XtSetArg(args[n], XtNallowResize, (XtArgVal) False); n++; X XtSetArg(args[n], XtNmax, (XtArgVal) XMail.buttonHeight); n++; X XtSetArg(args[n], XtNmin, (XtArgVal) XMail.buttonHeight); n++; X#ifndef X11R3 X XtSetArg(args[n], XtNshowGrip, (XtArgVal) False); n++; X#endif X form = XtCreateManagedWidget("titleBar", formWidgetClass, parent, args, n); X X logo = XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, X national_bits, national_width, national_height); X n = 0; X XtSetArg(args[n], XtNborderWidth, 0); n++; X XtSetArg(args[n], XtNinternalWidth, 0); n++; X XtSetArg(args[n], XtNwidth, national_width); n++; X XtSetArg(args[n], XtNheight, (XtArgVal) XMail.buttonHeight); n++; X XtSetArg(args[n], XtNbitmap, (XtArgVal) logo); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(l_Trans)); n++; X lg = XtCreateManagedWidget("logo", commandWidgetClass, form, args, n); X X n = 0; X XtSetArg(args[n], XtNborderWidth, 0); n++; X XtSetArg(args[n], XtNwidth, XMail.shellWidth - national_width - 2); n++; X XtSetArg(args[n], XtNheight, (XtArgVal) XMail.buttonHeight); n++; X XtSetArg(args[n], XtNlabel, (XtArgVal) TITLE); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNjustify, (XtArgVal) XtJustifyLeft); n++; X XtSetArg(args[n], XtNfromHoriz, lg); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(w_Trans)); n++; X tb = XtCreateManagedWidget("titleBar", labelWidgetClass, form, args, n); X X AddHelpText(tb, "title", Title_Help_Text); 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[MAXARGS]; X Cardinal n; X X static String trans = "#override \ X <Key>Delete: delete-previous-character() beginning-of-line() end-of-line()\n\ X <Key>BackSpace: delete-previous-character() beginning-of-line() end-of-line()\n\ X Ctrl<Key>H: delete-previous-character() beginning-of-line() end-of-line()\n\ X Ctrl<Key>U: beginning-of-line() kill-to-end-of-line() \n\ X Ctrl<Key>W: delete-previous-word() beginning-of-line() end-of-line()\n\ X <Key>Return: NextField()"; X X static String b_trans = "#override \ X <Btn3Down>: SetAliases() MenuPopup(aliasList)\n\ X <Btn3Motion>: DoNothing()\n\ X <Btn3Up>: DoNothing()\n\ X <Key>Delete: delete-previous-character() beginning-of-line() end-of-line()\n\ X <Key>BackSpace: delete-previous-character() beginning-of-line() end-of-line()\n\ X Ctrl<Key>H: delete-previous-character() beginning-of-line() end-of-line()\n\ X Ctrl<Key>U: beginning-of-line() kill-to-end-of-line() \n\ X Ctrl<Key>W: delete-previous-word() beginning-of-line() end-of-line()\n\ X <Key>Return: NextField()"; X X n = XMail.shellWidth - 106; /* - (scn + 2*(internal width + def.dist.)) */ X n -= TEXTWIDTH * 9; /* minus the width of the label text */ X XtSetArg(args[0], XtNwidth, n); X X n = 1; X XtSetArg(args[n], XtNinput, True); n++; X XtSetArg(args[n], XtNheight, TEXTHEIGHT); n++; X XtSetArg(args[n], XtNvertDistance, (TEXTHEIGHT * 3.0) / 5.0); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNborderWidth, 0); n++; X XtSetArg(args[n], XtNstring, buf); n++; X XtSetArg(args[n], XtNlength, len); n++; X XtSetArg(args[n], XtNeditType, (XtArgVal) XttextEdit); n++; X XtSetArg(args[n], XtNtextOptions, wordBreak); n++; X X if (strcmp(name, "To") == 0 || strcmp(name, "Cc") == 0) { X XtSetArg(args[n],XtNtranslations,XtParseTranslationTable(b_trans)); n++; X } else { X XtSetArg(args[n],XtNtranslations,XtParseTranslationTable(trans)); n++; X } X X#ifndef X11R3 X XtSetArg(args[n], XtNautoFill, True); n++; X#endif X X return( XtCreateManagedWidget(name,asciiStringWidgetClass,parent,args,n) ); X} /* CreateInputWindow */ END_OF_FILE if test 24406 -ne `wc -c <'windows.c'`; then echo shar: \"'windows.c'\" unpacked with wrong size! fi # end of 'windows.c' fi if test -f 'xmail.man' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xmail.man'\" else echo shar: Extracting \"'xmail.man'\" \(15615 characters\) sed "s/^X//" >'xmail.man' <<'END_OF_FILE' X.\" X.\" @(#)xmail.l 1.0 90/02/20 NSC; 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. National Semiconductor X.\" Corporation makes no representations about the suitability of this software X.\" for any purpose. It is provided "as is" without express or implied warranty. X.\" X.\" NATIONAL SEMICONDUCTOR CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO X.\" THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND X.\" FITNESS, IN NO EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR X.\" ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER X.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF X.\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN X.\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X.\" X.\" Author: Michael C. Wagnitz - National Semiconductor Corporation X.\" X.ds nS National Semiconductor Corporation X.ds xM \fBxmail\fP X.\" X.TH XMAIL 1 "March 20, 1990" "NSC" X.SH NAME Xxmail \- X11 visual interface to the mail program X.SH SYNOPSIS X.B xmail X.RB "[\|" \-\fItoolkitoptions\fP "\|]" X.RB "[\|" \-\fIxmailoptions\fP "\|]" X.SH DESCRIPTION X\*(xM Xis the X11 visual interface to the X.B mail Xprogram. It offers functionality similar to the SunView mailtool, but with Xsome enhancements. X XThe \*(xM shell appearance is similar in layout to mailtool. XA title bar decorates the top of the shell, and carries the name and Xversion of the program, as well as information about the current mail folder Xand its content. X XImmediately below the title bar, an index window Xdisplays header information for the current mail folder. Message selection Xis indicated by highlight of the number of a particular message. XNew and unread mail are prefixed with 'N' and 'U' characters. Deleted Xmessages not yet removed from the index list have the letter 'D' preceding Xthe message number. Messages marked for saving (via the save button) will Xdisplay an asterisk (*) in front of their index number. X XBelow the index Xwindow, a status window displays status and error messages. The terminal Xbell is usually rung to draw attention to these messages. The bell can be Xdisabled from the command line or user resource file. X XThe center portion of the Xshell displays a panel with a selection of commonly used mail commands. XPressing and then releasing (\fIalso known as '\fBclicking\fP')\fR Xthe \fBleft\fR mouse button while the cursor is within a Xparticular command button box invokes that mail command. X XEach button in the command panel also offers an expanded menu of choices. XPressing the \fBright\fR mouse button presents the user with the Xexpanded menu. \fBDragging\fR the cursor over one of these selections X\fIwhile still holding the right button down\fR causes the particular Xselection to highlight. \fBReleasing\fR the right button while a selection Xis highlighted invokes that particular command action. X XKeyboard accelerators for these actions are indicated by appropriate entries Xin the command menus. Users may take advantage of these accelerators by Xholding down the Shift and/or Control key(s) prior to clicking the left mouse Xbutton on the desired command. X XA grip along the right edge of the command panel allows the user to slide the Xstatus window/command panel combination up and down in the \*(xM shell, to Xaccommodate those times when the user is reviewing a short list of longer than Xaverage messages, or a longer list of relatively short messages. X XMessage text is displayed in the bottom window of the \*(xM shell. XLike the index window above, scroll bars provide easy access to any portion of Xthe text. Because the reading of a very large message can take more than a few Xmoments, \*(xM decides when starting mail or changing folders that a Xmessage longer Xthan 65,000 characters will \fBnot\fR be automatically displayed. X XA modified mailWatch widget (ala xwatch) is used as the \*(xM icon Xwindow. The mailbox flag will be raised and mail shown inside, Xwhenever new mail arrives. XIn the non-iconic state, the \fBNewmail\fR command button is highlighted Xto signal new mail arrival. Clicking on the Newmail button will Xreset the flag and highlighting, and deliver the new mail to your display. X XPressing the \fBmiddle\fR mouse button on any window or command button of the X\*(xM shell while holding down either \fBShift\fR key will cause help Xinformation relating to that window (or button) to be displayed in Xthe \fItext\fR (bottom) window. XReleasing the mouse button will cause the help information to disappear. X XDuring command execution, the cursor is changed to a watch face Xto indicate that \*(xM is busy. Upon completion of the activity, the Xcursor is restored to its previous value. X.SH OPTIONS XA non-existent or illegal option command line specification will cause Xdisplay of the usage statement and \*(xM termination. X.TP X\fB\-toolkitoptions\fR XAll standard X11 toolkit options are accepted on the command line. X.TP X\fB\-xmailoptions\fR X\*(xM also accepts the following additional options: X.RS X.TP X\fB\-nb\fR Xtells \*(xM to \fBnot\fR ring the terminal bell when issuing status messages. X.TP X\fB\-helpfont \fIfontname\fR Xtells \*(xM to use the following font specification when displaying help text. X.TP X\fB\-n\fR Xtells mail to \fBnot\fR initialize from the system default Mail.rc file. X.TP X\fB\-U\fR Xtells mail to convert internet style addresses into uucp format. X.TP X\fB\-f\ \fI+foldername\fR Xtells mail to start by processing the specified folder. X.TP X\fB\-s\ \fIsubject\fR Xtells \*(xM to set the subject string (for the next send request) to Xthe indicated subject. Setting the subject string here does not automatically Xinvoke the send mechanism. That must still be invoked via the \fIsend\fR Xcommand button. X.TP X\fB\-ls\fR Xtells \*(xM to \fBnot\fR show the last message of a folder by default. This Xoption is equivalent to setting the \*(xM resource \fIShow_Last\fR to False. X.RE X.SH "SENDING MESSAGES" XAll Send and reply operations invoke the user's preferred editor (as Xdefined by the user's \fBEDITOR\fR environment variable) to create or modify Xthe message prior to delivery. An appropriate xterm window will be created Xto contain the edit session. The \fIdefault\fR editor will be \fBvi\fR, if no XEDITOR or VISUAL (mail) environment variable definition exists. X XUpon completion of the send/reply editing session, a smaller window will be Xdisplayed which contains \fITo:\fR, \fISubject:\fR, and \fICc:\fR fields for Xthe current message composition. Help is available for each of these popup Xshell window fields, by pressing the middle mouse button while holding down Xeither Shift key. A menu of user defined mail aliases is available from Xeither the To: or Cc: windows. Pressing the right mouse btton while the Xcursor is in either of these input fields will display the alias names Xmenu. If the user has no mail aliases defined, the terminal bell will be rung Xto indicate that no alias names menu is forthcoming. X XLike the \fIFile:\fR window which is used to enter file and folder names, the Xcontent of the send window popup fields may be modified by the user as needed. XThe backspace and delete keys remove the previous character, the control_W Xcombination deletes Xthe previous word, and the control_U combination deletes the entire Xline of information. Pressing the Return key in any of these three Xfields causes the cursor to automatically warp to the next field. X XUsers may append their \fISign\fP or \fIsign\fP autograph (see \fBmail(1)\fR) Xonce only to the end of the message text. XPressing the \fIDeliver\fR button causes the message Xto be delivered, while the right mouse button displays a menu for the Deliver, X\fICancel\fR (and delete), and Cancel (and save in your dead.letter file) Xcommands. X XMail forwarded to another user will be bracketed by a '\fIBegin Forwarded XMessage/End Forwarded Message\fR' string Xpair when using the '\fIforward message\fR' Send command menu option. Also Xincluded will be a '\fIForwarded: Mail from ...\fR' line in the mail header. X XReply messages will include a '\fIIn-Reply-To: Mail from ...\fR' string in the Xmail Xheader. Like the '\fIForwarded:\fR' header described above, it will include Xthe name of the original sender, as well as the date the original message was Xreceived. X.SH FOLDERS XIf the right mouse button is pressed while the cursor is within the Xcommand panel \fBfolder\fR button, \*(xM will display a menu of available Xmail folders. XDragging the cursor while still holding the right mouse button down will allow Xthe user to highlight a particular folder name. Releasing the right button Xwhile a name is highlighted causes a copy of that name to be written in Xthe command panel file window. The menu list is then unmapped. XReleasing the right button while outside Xany folder selection causes the folder menu list to disappear. X XFolders which are actually directories (that might possibly contain additional Xfolder files) Xare displayed with a trailing slash character. Clicking the \fBleft\fR mouse Xbutton within a directory folder (\fIwhile still holding down the right Xmouse button\fR) causes \*(xM to search that directory and display (on a higher Xmenu level) any files found there. Dragging the cursor over Xone of these selections and releasing the right mouse button copies the Xcomplete folder path name to the file window. This nesting of folder names Xmay occur as often as there are legitimate folder directories. Clicking the Xleft mouse button on an empty folder directory rings the terminal bell. XDragging the cursor beyond one of these nested menu levels causes that menu to Xdisappear, without making a selection. Re-clicking the left mouse button on Xthe directory folder redisplays the nested menu. X XThe first request for the folder menu extracts (from mail or the system) the Xnecessary information to create the menu. Subsequent requests simply redisplay Xthat menu. To force \*(xM to recalculate the folder menu content, press Xthe \fBNewmail\fR button, which causes \*(xM to destroy the current folder Xmenu and re-display your system mail folder. XThis provides access to folders created after the start of \*(xM. X.SH FONTS X\*(xM supports a variety of fixed width fonts, adjusting its window dimensions Xaccordingly. The user is free to enlarge the window, but may not shrink it Xbeyond a minimum usable display. The default font for text is specified as X9x15, and the default font for help information is 8x13bold. Text font can Xbe specified on the command line using the standard toolkit font options -fn Xor -font. The helpfont can be specified on the command line using the -helpfont Xoption. The fixed width font 'fixed' also works well within the \*(xM program. XSome alternative font selections, particularly those with variable widths, may Xpromote shell sizes that make \*(xM effectively unusable, and should be avoided. X.SH RESOURCES X\*(xM allows resource definitions for each of its component windows and Xcommand buttons. Color may be added (on a color display device) to enhance Xthe visual display. X XThe following resources names are recognized: X.RS X.TP X\fB*bellRing\fR XNormally true, this boolean enables ringing of the terminal bell during Xstatus and error message display. X.TP X\fB*helpFont\fR Xdenotes a preferred font to use when displaying help information. X.TP X\fB*mailopt_n\fR Xduplicates the effect of the \fI-n\fR command line option. X.TP X\fB*mailopt_U\fR Xduplicates the effect of the \fI-U\fR command line option. X.TP X\fB*MFileName\fR Xduplicates the effect of the \fI-f folder\fR command line option. X.TP X\fB*SubjectStr\fR Xduplicates the effect of the \fI-s subject\fR command line option. X.TP X\fB*Show_Last\fR XNormally true, this boolean enables display of the last message in a folder, Xproviding no other is newer or unread. Setting this resource to false causes Xfolder displays to start with the first (or new or unread) message. X.TP X\fB*icon\fR Xcontrols resources for the \fIicon\fR window. In addition to Xspecifications of foreground and background colors, it is possible Xto also specify mailWatch widget resources, such as the following: X.RS X.TP X\fB*icon*reverseVideo\fR XIf set to true, reverses the foreground and background colors for the icon. X.TP X\fB*icon*update\fR XSpecifies the update interval for checking new mail (default is 30 seconds) X.TP X\fB*icon*bell\fR XIf set to False, prevents the mailWatch widget from ringing the bell when Xnew mail arrives X.RE X.TP X\fB*titleBar\fR Xcontrols resources for the \fItitleBar\fR window X.TP X\fB*indexWindow\fR Xcontrols resources for the \fIindex\fR window X.TP X\fB*statusWindow\fR Xcontrols resources for the \fIstatus\fR window X.TP X\fB*commandPanel\fR Xcontrols resources for the \fIcommand panel\fR X.TP X\fB*fileWindow\fR Xcontrols resources for the \fIfile window\fR within the command panel X.TP X\fB*textWindow\fR Xcontrols resources for the \fItext\fR window X.TP X\fB*list\fR Xcontrols resources for the \fIfolder list\fR popup window X.TP X\fB*save\fR Xcontrols resources for the \fIsave\fR command button X.TP X\fB*Folder\fR Xcontrols resources for the \fIFolder\fR command button X.TP X\fB*copy\fR Xcontrols resources for the \fIcopy\fR command button X.TP X\fB*quit\fR Xcontrols resources for the \fIquit\fR command button X.TP X\fB*menu\fR Xcontrols resources for all of the command button popup menus X.TP X\fB*To\fR Xcontrols resources for the \fITo:\fR entry window X.TP X\fB*Subject\fR Xcontrols resources for the \fISubject:\fR entry window X.TP X\fB*Cc\fR Xcontrols resources for the \fICc:\fR entry window X.TP X\fB*Autograph\fR Xcontrols resources for the \fIAutograph\fR command button X.TP X\fB*Deliver\fR Xcontrols resources for the \fIDeliver\fR command button X.TP X\fB*Cancel\fR Xcontrols resources for the \fICancel\fR command button X.RE X XA set of default resource definitions is provided in the Xfile \fB/usr/lib/X11/app-defaults/XMail\fR. The user may wish to include the Xappropriate resource definitions in their ~/.Xdefaults file, to tailor their Xpreference for colors and/or fonts. X.SH AUTHOR X.ce 3 XCopyright 1989 - \*(nS XALL RIGHTS RESERVED X XMichael Wagnitz, \*(nS, Santa Clara, CA X.LP XMuch of the design and insight for \*(xM was provided by Xcontributions from the following authors: X XThe xdbx contribution by Po Cheung (po@volta.ece.utexas.edu) X.RS XCopyright 1989 The University of Texas at Austin X.RE X XThe mailWatch widget by Dan Heller (argv@sun.com) X.RS Xused as the \*(xM icon window. X.RE X.SH "SEE ALSO" Xmail(1) X.SH BUGS XDue to non-ICCCM compliance between the R3 release of X11 window managers Xand the X11 sun server, the following bug is known to exist when using \*(xM Xunder X11 Release 3. X XKeyboard input focus in the \fIFile:\fP window \fBmay\fP be lost for a Xperiod of time after a folders menu list creation (\fIsee \fBFOLDERS\fP Xabove\fR). XThis input focus loss will prevent keyboard modification to any file or folder Xspecifications in that window. The pasting of folder menu selections and Xthe use of the folder button are not affected by this loss. XDestroying the folder menu list (\fIby selecting the Newmail command\fP) should Xrelieve the input problem (until the folder menu list is again created). END_OF_FILE if test 15615 -ne `wc -c <'xmail.man'`; then echo shar: \"'xmail.man'\" unpacked with wrong size! fi # end of 'xmail.man' fi echo shar: End of archive 6 \(of 6\). cp /dev/null ark6isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 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 dan ----------------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com 632 Petaluma Ave, Sebastopol, CA 95472 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104 Opinions expressed reflect those of the author only.