nsgmls: resolve coverity warnings related to uninitialed members in C++ classes
[oweals/cde.git] / cde / programs / dtpad / optionsCB.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: optionsCB.c /main/3 1995/11/01 10:39:09 rswiston $ */
24 /**********************************<+>*************************************
25 ***************************************************************************
26 **
27 **  File:        optionsCB.c
28 **
29 **  Project:     DT dtpad, a memo maker type editor based on the Dt Editor
30 **               widget.
31 **
32 **  Description:
33 **  -----------
34 **
35 **      This file contains the callbacks for the [Options] menu items.
36 **
37 *******************************************************************
38 **  (c) Copyright Hewlett-Packard Company, 1991, 1992.  All rights are
39 **  reserved.  Copying or other reproduction of this program
40 **  except for archival purposes is prohibited without prior
41 **  written consent of Hewlett-Packard Company.
42 ********************************************************************
43 **
44 ********************************************************************
45 **  (c) Copyright 1993, 1994 Hewlett-Packard Company
46 **  (c) Copyright 1993, 1994 International Business Machines Corp.
47 **  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
48 **  (c) Copyright 1993, 1994 Novell, Inc.
49 ********************************************************************
50 **
51 **
52 **************************************************************************
53 **********************************<+>*************************************/
54 #include "dtpad.h"
55 #include <Dt/HourGlass.h>
56
57
58 /************************************************************************
59  * OverstrikeCB - set Editor widget overstike and "Options" menu
60  *      "Overstrike" radio button state based on value passed in
61  *      call_data->set.
62  *
63  *        NOTE: The default overstrike state for the entire (pPad) edit
64  *              session is also reset.
65  ************************************************************************/
66 /* ARGSUSED */
67 void
68 OverstrikeCB(
69         Widget w,
70         caddr_t client_data,
71         caddr_t call_data)
72 {
73     Arg al[1];
74     Editor *pPad = (Editor *)client_data;
75     XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *) 
76                                        call_data;
77                                        
78     XtSetArg(al[0], DtNoverstrike, (Boolean) cb->set);
79     XtSetValues(pPad->editor, al, 1);
80     pPad->xrdb.overstrike = (Boolean) cb->set;  /* reset edit session default */
81
82 }
83
84
85 /************************************************************************
86  * WordWrapCB - set Editor widget word wrap state and the default state
87  *      for the new line radio button in the "Save As" File menu dialog
88  *      based on value passed in call_data->set.
89  *
90  *        NOTE: The default word wrap state for the entire (pPad) edit
91  *              session is also reset.
92  ************************************************************************/
93 /* ARGSUSED */
94 void
95 WordWrapCB(
96         Widget w,
97         caddr_t client_data,
98         caddr_t call_data)
99 {
100     Arg al[1];
101     Editor *pPad = (Editor *)client_data;
102     XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *) 
103                                        call_data;
104     SaveAs *pSaveAs = &pPad->fileStuff.fileWidgets.saveAs;
105     Select *pSelect = &pPad->fileStuff.fileWidgets.select;
106
107     XtSetArg(al[0], DtNwordWrap, (Boolean) cb->set);
108     XtSetValues(pPad->editor, al, 1);
109
110     pPad->xrdb.wordWrap = (Boolean) cb->set;    /* reset edit session default */
111
112     /* -----> set the default state for the "add new lines?" radio boxes in the
113      *        "Save As" file selection box and the "Save" prompt dialog
114      *        (these radio boxes are included only if word wrap is on) */
115     if (pSaveAs->toggleWidgets.newl_radio != (Widget) 0) {
116         if (pPad->xrdb.wordWrap == True) {
117             XtManageChild(pSaveAs->toggleWidgets.newl_radio);
118         } else {
119             XtUnmanageChild(pSaveAs->toggleWidgets.newl_radio);
120         }
121     }
122     if (pSelect->toggleWidgets.newl_radio != (Widget) 0) {
123         if (pPad->xrdb.wordWrap == True) {
124             XtManageChild(pSelect->separator);
125             XtManageChild(pSelect->toggleWidgets.newl_radio);
126         } else {
127             XtUnmanageChild(pSelect->separator);
128             XtUnmanageChild(pSelect->toggleWidgets.newl_radio);
129         }
130     }
131
132 }
133
134
135 /************************************************************************
136  * StatusLineCB - set Editor widget statusLine based on value passed in
137  *      call_data->set.
138  *
139  *        NOTE: The default statusLine state for the entire (pPad) edit
140  *              session is also reset.
141  ************************************************************************/
142 /* ARGSUSED */
143 void
144 StatusLineCB(
145         Widget w,
146         caddr_t client_data,
147         caddr_t call_data)
148 {
149     Arg al[1];
150     Editor *pPad = (Editor *)client_data;
151     XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *) 
152                                        call_data;
153                                        
154     XtSetArg(al[0], DtNshowStatusLine, (Boolean) cb->set);
155     XtSetValues(pPad->editor, al, 1);
156     pPad->xrdb.statusLine = (Boolean) cb->set;  /* reset edit session default */
157  
158     /* Reset the resize increment and minimum window size properties. */
159     SetAppShellResizeHints(pPad);
160 }