1c9e2be55Smrg/* 2c9e2be55Smrg * $XConsortium: compfuncs.c,v 2.18 92/04/08 12:20:08 rws Exp $ 3c9e2be55Smrg * 4c9e2be55Smrg * 5c9e2be55Smrg * COPYRIGHT 1987, 1989 6c9e2be55Smrg * DIGITAL EQUIPMENT CORPORATION 7c9e2be55Smrg * MAYNARD, MASSACHUSETTS 8c9e2be55Smrg * ALL RIGHTS RESERVED. 9c9e2be55Smrg * 10c9e2be55Smrg * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND 11c9e2be55Smrg * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. 12c9e2be55Smrg * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR 13c9e2be55Smrg * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 14c9e2be55Smrg * 15c9e2be55Smrg * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT 16c9e2be55Smrg * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN 17c9e2be55Smrg * ADDITION TO THAT SET FORTH ABOVE. 18c9e2be55Smrg * 19c9e2be55Smrg * Permission to use, copy, modify, and distribute this software and its 20c9e2be55Smrg * documentation for any purpose and without fee is hereby granted, provided 21c9e2be55Smrg * that the above copyright notice appear in all copies and that both that 22c9e2be55Smrg * copyright notice and this permission notice appear in supporting 23c9e2be55Smrg * documentation, and that the name of Digital Equipment Corporation not be 24c9e2be55Smrg * used in advertising or publicity pertaining to distribution of the software 25c9e2be55Smrg * without specific, written prior permission. 26c9e2be55Smrg */ 27c9e2be55Smrg/* $XFree86: xc/programs/xmh/compfuncs.c,v 1.2 2001/08/01 00:45:06 tsi Exp $ */ 28c9e2be55Smrg 29c9e2be55Smrg/* comp.c -- action procedures to handle composition buttons. */ 30c9e2be55Smrg 31c9e2be55Smrg#include "xmh.h" 32c9e2be55Smrg#include "actions.h" 33c9e2be55Smrg 34c9e2be55Smrg/* Reset this composition widget to be one with just a blank message 35c9e2be55Smrg template. */ 36c9e2be55Smrg 37c9e2be55Smrg/*ARGSUSED*/ 38c9e2be55Smrgvoid DoResetCompose( 39c9e2be55Smrg Widget widget, /* unused */ 40c9e2be55Smrg XtPointer client_data, 41c9e2be55Smrg XtPointer call_data) /* unused */ 42c9e2be55Smrg{ 43c9e2be55Smrg Scrn scrn = (Scrn) client_data; 44c9e2be55Smrg Msg msg; 45c9e2be55Smrg XtCallbackRec confirms[2]; 46c9e2be55Smrg 47c9e2be55Smrg confirms[0].callback = (XtCallbackProc) DoResetCompose; 48c9e2be55Smrg confirms[0].closure = (XtPointer) scrn; 49c9e2be55Smrg confirms[1].callback = (XtCallbackProc) NULL; 50c9e2be55Smrg confirms[1].closure = (XtPointer) NULL; 51c9e2be55Smrg 52c9e2be55Smrg if (MsgSetScrn((Msg) NULL, scrn, confirms, (XtCallbackList) NULL) == 53c9e2be55Smrg NEEDS_CONFIRMATION) 54c9e2be55Smrg return; 55c9e2be55Smrg 56c9e2be55Smrg msg = TocMakeNewMsg(DraftsFolder); 57c9e2be55Smrg MsgLoadComposition(msg); 58c9e2be55Smrg MsgSetTemporary(msg); 59c9e2be55Smrg MsgSetReapable(msg); 60c9e2be55Smrg (void) MsgSetScrn(msg, scrn, (XtCallbackList) NULL, (XtCallbackList) NULL); 61c9e2be55Smrg} 62c9e2be55Smrg 63c9e2be55Smrg/*ARGSUSED*/ 64c9e2be55Smrgvoid XmhResetCompose( 65c9e2be55Smrg Widget w, 66c9e2be55Smrg XEvent *event, 67c9e2be55Smrg String *params, 68c9e2be55Smrg Cardinal *num_params) 69c9e2be55Smrg{ 70c9e2be55Smrg Scrn scrn = ScrnFromWidget(w); 71c9e2be55Smrg DoResetCompose(w, (XtPointer) scrn, (XtPointer) NULL); 72c9e2be55Smrg} 73c9e2be55Smrg 74c9e2be55Smrg 75c9e2be55Smrg/* Send the message in this widget. Avoid sending the same message twice. 76c9e2be55Smrg (Code elsewhere actually makes sure this button is disabled to avoid 77c9e2be55Smrg sending the same message twice, but it doesn't hurt to be safe here.) */ 78c9e2be55Smrg 79c9e2be55Smrg/*ARGSUSED*/ 80c9e2be55Smrgvoid XmhSend( 81c9e2be55Smrg Widget w, 82c9e2be55Smrg XEvent *event, 83c9e2be55Smrg String *params, 84c9e2be55Smrg Cardinal *num_params) 85c9e2be55Smrg{ 86c9e2be55Smrg Scrn scrn = ScrnFromWidget(w); 87c9e2be55Smrg if (scrn->msg == NULL) return; 88c9e2be55Smrg if (MsgChanged(scrn->msg) || ! MsgGetReapable(scrn->msg)) { 89c9e2be55Smrg MsgSend(scrn->msg); 90c9e2be55Smrg MsgSetReapable(scrn->msg); 91c9e2be55Smrg } 92c9e2be55Smrg} 93c9e2be55Smrg 94c9e2be55Smrg 95c9e2be55Smrg/* Save any changes to the message. This also makes this message permanent. */ 96c9e2be55Smrg 97c9e2be55Smrg/*ARGSUSED*/ 98c9e2be55Smrgvoid XmhSave( 99c9e2be55Smrg Widget w, 100c9e2be55Smrg XEvent *event, 101c9e2be55Smrg String *params, 102c9e2be55Smrg Cardinal *num_params) 103c9e2be55Smrg{ 104c9e2be55Smrg Scrn scrn = ScrnFromWidget(w); 105c9e2be55Smrg DEBUG("XmhSave\n") 106c9e2be55Smrg if (scrn->msg == NULL) return; 107c9e2be55Smrg MsgSetPermanent(scrn->msg); 108c9e2be55Smrg if (MsgSaveChanges(scrn->msg)) 109c9e2be55Smrg MsgClearReapable(scrn->msg); 110c9e2be55Smrg} 111c9e2be55Smrg 112c9e2be55Smrg 113c9e2be55Smrg/* Utility routine; creates a composition screen containing a forward message 114c9e2be55Smrg of the messages in the given msglist. */ 115c9e2be55Smrg 116c9e2be55Smrgvoid CreateForward( 117c9e2be55Smrg MsgList mlist, 118c9e2be55Smrg String *params, 119c9e2be55Smrg Cardinal num_params) 120c9e2be55Smrg{ 121c9e2be55Smrg Scrn scrn; 122c9e2be55Smrg Msg msg; 123c9e2be55Smrg scrn = NewCompScrn(); 124c9e2be55Smrg msg = TocMakeNewMsg(DraftsFolder); 125c9e2be55Smrg MsgLoadForward(scrn, msg, mlist, params, num_params); 126c9e2be55Smrg MsgSetTemporary(msg); 127c9e2be55Smrg MsgSetScrnForComp(msg, scrn); 128c9e2be55Smrg MapScrn(scrn); 129c9e2be55Smrg} 130