Annotation of researchv9/X11/src/X.V11R1/clients/xmh/folder.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char rcs_id[] = "$Header: folder.c,v 1.11 87/09/11 08:18:05 toddb Exp $";
        !             3: #endif lint
        !             4: /*
        !             5:  *                       COPYRIGHT 1987
        !             6:  *                DIGITAL EQUIPMENT CORPORATION
        !             7:  *                    MAYNARD, MASSACHUSETTS
        !             8:  *                     ALL RIGHTS RESERVED.
        !             9:  *
        !            10:  * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
        !            11:  * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
        !            12:  * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR
        !            13:  * ANY PURPOSE.  IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
        !            14:  *
        !            15:  * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS,
        !            16:  * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT
        !            17:  * SET FORTH ABOVE.
        !            18:  *
        !            19:  *
        !            20:  * Permission to use, copy, modify, and distribute this software and its
        !            21:  * documentation for any purpose and without fee is hereby granted, provided
        !            22:  * that the above copyright notice appear in all copies and that both that
        !            23:  * copyright notice and this permission notice appear in supporting documentation,
        !            24:  * and that the name of Digital Equipment Corporation not be used in advertising
        !            25:  * or publicity pertaining to distribution of the software without specific,
        !            26:  * written prior permission.
        !            27:  */
        !            28: 
        !            29: /* folder.c -- implement buttons relating to folders and other globals. */
        !            30: 
        !            31: #include "xmh.h"
        !            32: 
        !            33: 
        !            34: /* Close this toc&view scrn.  If this is the last toc&view, quit xmh. */
        !            35: 
        !            36: void ExecCloseScrn(scrn)
        !            37: Scrn scrn;
        !            38: {
        !            39:     extern void exit();
        !            40:     Toc toc;
        !            41:     int i, count;
        !            42:     count = 0;
        !            43:     for (i=0 ; i<numScrns ; i++)
        !            44:        if (scrnList[i]->kind == STtocAndView && scrnList[i]->mapped)
        !            45:            count++;
        !            46:     if (count <= 1) {
        !            47:        for (i = numScrns - 1; i >= 0; i--)
        !            48:            if (scrnList[i] != scrn) {
        !            49:                if (MsgSetScrn((Msg) NULL, scrnList[i]))
        !            50:                    return;
        !            51:            }
        !            52:        for (i = 0; i < numFolders; i++) {
        !            53:            toc = folderList[i];
        !            54:            if (TocConfirmCataclysm(toc))
        !            55:                return;
        !            56:        }
        !            57:        if (MsgSetScrn((Msg) NULL, scrn))
        !            58:            return;
        !            59:        DestroyPromptWindow();
        !            60: /*     for (i = 0; i < numFolders; i++) {
        !            61:            toc = folderList[i];
        !            62:            if (toc->scanfile && toc->curmsg)
        !            63:                CmdSetSequence(toc, "cur", MakeSingleMsgList(toc->curmsg));
        !            64:        }
        !            65: */
        !            66:        exit(0);
        !            67:     }
        !            68:     else {
        !            69:        if (MsgSetScrn((Msg) NULL, scrn)) return;
        !            70:        DestroyScrn(scrn);
        !            71:     }
        !            72: }
        !            73: 
        !            74: 
        !            75: /* Open the selected folder in this screen. */
        !            76: 
        !            77: void ExecOpenFolder(scrn)
        !            78: Scrn scrn;
        !            79: {
        !            80:     Toc toc;
        !            81:     toc = SelectedToc(scrn);
        !            82:     TocSetScrn(toc, scrn);
        !            83: }
        !            84: 
        !            85: 
        !            86: 
        !            87: /* Compose a new message. */
        !            88: 
        !            89: void ExecComposeMessage(scrn)
        !            90: Scrn scrn;
        !            91: {
        !            92:     Msg msg;
        !            93:     scrn = NewCompScrn();
        !            94:     msg = TocMakeNewMsg(DraftsFolder);
        !            95:     MsgLoadComposition(msg);
        !            96:     MsgSetTemporary(msg);
        !            97:     MsgSetReapable(msg);
        !            98:     (void) MsgSetScrnForComp(msg, scrn);
        !            99:     MapScrn(scrn);
        !           100: }
        !           101: 
        !           102: 
        !           103: 
        !           104: /* Make a new scrn displaying the given folder. */
        !           105: 
        !           106: void ExecOpenFolderInNewWindow(scrn)
        !           107: Scrn scrn;
        !           108: {
        !           109:     Toc toc;
        !           110:     toc = SelectedToc(scrn);
        !           111:     scrn = CreateNewScrn(STtocAndView);
        !           112:     TocSetScrn(toc, scrn);
        !           113:     MapScrn(scrn);
        !           114: }
        !           115: 
        !           116: 
        !           117: 
        !           118: /* Create a new xmh folder. */
        !           119: 
        !           120: void ExecCreateFolder(scrn)
        !           121: Scrn scrn;
        !           122: {
        !           123:     void CreateFolder();
        !           124:     MakePrompt(scrn, "Create folder named:", CreateFolder);
        !           125: }
        !           126: 
        !           127: 
        !           128: 
        !           129: /* Delete the selected folder.  Requires confirmation! */
        !           130: 
        !           131: void ExecDeleteFolder(scrn)
        !           132: Scrn scrn;
        !           133: {
        !           134:     char *foldername, str[100];
        !           135:     Toc toc;
        !           136:     int i;
        !           137:     foldername = BBoxNameOfButton(scrn->curfolder);
        !           138:     toc = TocGetNamed(foldername);
        !           139:     if (TocConfirmCataclysm(toc)) return;
        !           140:     (void) sprintf(str, "Are you sure you want to destroy %s?", foldername);
        !           141:     if (!Confirm(scrn, str)) return;
        !           142:     TocSetScrn(toc, (Scrn) NULL);
        !           143:     TocDeleteFolder(toc);
        !           144:     for (i=0 ; i<numScrns ; i++)
        !           145:        if (scrnList[i]->folderbuttons)
        !           146:            BBoxDeleteButton(BBoxFindButtonNamed(scrnList[i]->folderbuttons,
        !           147:                                                 foldername));
        !           148: }
        !           149: 
        !           150: 
        !           151: 
        !           152:                        /* Debugging stuff only. */
        !           153: void ExecSyncOn()
        !           154: {
        !           155: #ifdef X11
        !           156:     (void) XSynchronize(theDisplay, TRUE);
        !           157: #endif
        !           158: }
        !           159: void ExecSyncOff()
        !           160: {
        !           161: #ifdef X11
        !           162:     (void) XSynchronize(theDisplay, FALSE);
        !           163: #endif
        !           164: }
        !           165: 
        !           166: 
        !           167: 
        !           168: /* Create a new folder with the given name. */
        !           169: 
        !           170: void CreateFolder(name)
        !           171:   char *name;
        !           172: {
        !           173:     Toc toc;
        !           174:     int i, position;
        !           175:     extern void PrepareDoubleClickFolder();
        !           176:     for (i=0 ; name[i] > ' ' ; i++) ;
        !           177:     name[i] = 0;
        !           178:     toc = TocGetNamed(name);
        !           179:     if (toc || i == 0) {
        !           180:        Feep();
        !           181:        return;
        !           182:     }
        !           183:     toc = TocCreateFolder(name);
        !           184:     if (toc == NULL) {
        !           185:        Feep();
        !           186:        return;
        !           187:     }
        !           188:     for (position = 0; position < numFolders; position++)
        !           189:        if (folderList[position] == toc)
        !           190:            break;
        !           191:     for (i = 0; i < numScrns; i++)
        !           192:        if (scrnList[i]->folderbuttons)
        !           193:            BBoxAddButton(scrnList[i]->folderbuttons, name,
        !           194:                          PrepareDoubleClickFolder, position, TRUE);
        !           195: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.