source: trunk/third/xmh/compfuncs.c @ 9661

Revision 9661, 3.6 KB checked in by ghudson, 28 years ago (diff)
MsgSaveChanges takes an extra argument now; no change in behavior.
Line 
1/*
2 * $XConsortium: compfuncs.c,v 2.17 89/10/06 15:02:26 converse Exp $
3 *
4 *
5 *                    COPYRIGHT 1987, 1989
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
16 * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
17 * ADDITION TO THAT SET FORTH ABOVE.
18 *
19 * Permission to use, copy, modify, and distribute this software and its
20 * documentation for any purpose and without fee is hereby granted, provided
21 * that the above copyright notice appear in all copies and that both that
22 * copyright notice and this permission notice appear in supporting
23 * documentation, and that the name of Digital Equipment Corporation not be
24 * used in advertising or publicity pertaining to distribution of the software
25 * without specific, written prior permission.
26 */
27
28/* comp.c -- action procedures to handle composition buttons. */
29
30#include "xmh.h"
31
32
33/* Reset this composition widget to be one with just a blank message
34   template. */
35
36/*ARGSUSED*/
37void DoResetCompose(widget, client_data, call_data)
38    Widget      widget;         /* unused */
39    XtPointer   client_data;
40    XtPointer   call_data;      /* unused */
41{
42    Scrn        scrn = (Scrn) client_data;
43    Msg         msg;
44    XtCallbackRec       confirms[2];
45
46    confirms[0].callback = (XtCallbackProc) DoResetCompose;
47    confirms[0].closure = (XtPointer) scrn;
48    confirms[1].callback = (XtCallbackProc) NULL;
49    confirms[1].closure = (XtPointer) NULL;
50
51    if (MsgSetScrn((Msg) NULL, scrn, confirms, (XtCallbackList) NULL) ==
52        NEEDS_CONFIRMATION)
53        return;
54
55    msg = TocMakeNewMsg(DraftsFolder);
56    MsgLoadComposition(msg);
57    MsgSetTemporary(msg);
58    MsgSetReapable(msg);
59    (void) MsgSetScrn(msg, scrn, (XtCallbackList) NULL, (XtCallbackList) NULL);
60}
61
62/*ARGSUSED*/
63void XmhResetCompose(w, event, params, num_params)
64    Widget      w;
65    XEvent      *event;
66    String      *params;
67    Cardinal    *num_params;
68{
69    Scrn scrn = ScrnFromWidget(w);
70    DoResetCompose(w, (XtPointer) scrn, (XtPointer) NULL);
71}
72
73
74/* Send the message in this widget.  Avoid sending the same message twice.
75   (Code elsewhere actually makes sure this button is disabled to avoid
76   sending the same message twice, but it doesn't hurt to be safe here.) */
77
78/*ARGSUSED*/
79void XmhSend(w, event, params, num_params)
80    Widget      w;
81    XEvent      *event;
82    String      *params;
83    Cardinal    *num_params;
84{
85    Scrn scrn = ScrnFromWidget(w);
86    if (scrn->msg == NULL) return;
87    if (MsgChanged(scrn->msg) || ! MsgGetReapable(scrn->msg)) {
88        MsgSend(scrn->msg);
89        MsgSetReapable(scrn->msg);
90    }
91}
92
93
94/* Save any changes to the message.  This also makes this message permanent. */
95
96/*ARGSUSED*/
97void XmhSave(w, event, params, num_params)
98    Widget      w;
99    XEvent      *event;
100    String      *params;
101    Cardinal    *num_params;
102{
103    Scrn scrn = ScrnFromWidget(w);
104    DEBUG("XmhSave\n")
105    if (scrn->msg == NULL) return;
106    MsgSetPermanent(scrn->msg);
107    if (MsgSaveChanges(scrn->msg, 1))
108        MsgClearReapable(scrn->msg);
109}
110
111
112/* Utility routine; creates a composition screen containing a forward message
113   of the messages in the given msglist. */
114
115CreateForward(mlist)
116  MsgList mlist;
117{
118    Scrn scrn;
119    Msg msg;
120    scrn = NewCompScrn();
121    msg = TocMakeNewMsg(DraftsFolder);
122    MsgLoadForward(scrn, msg, mlist);
123    MsgSetTemporary(msg);
124    MsgSetScrnForComp(msg, scrn);
125    MapScrn(scrn);
126}
Note: See TracBrowser for help on using the repository browser.