Debian Codegraph @

gui/XDo/src/ColAttribute.c

raw
1
2 /*******************************************************************************
3 ColAttribute.c
4
5 .VERSION
6 090825 last modif
7
8 *******************************************************************************/
9
10 #include <stdio.h>
11 #include "UxLib.h"
12 #include "UxPushB.h"
13 #include "UxText.h"
14 #include "UxLabel.h"
15 #include "UxForm.h"
16 #include "UxTranSh.h"
17
18 /*******************************************************************************
19 Includes, Defines, and Global variables from the Declarations Editor:
20 *******************************************************************************/
21
22 #include <ExternResources.h>
23 #include <midas_def.h>
24
25 /*******************************************************************************
26 The definition of the context structure:
27 If you create multiple instances of your interface, the context
28 structure ensures that your callbacks use the variables for the
29 correct instance.
30
31 For each swidget in the interface, each argument to the Interface
32 function, and each variable in the Instance Specific section of the
33 Declarations Editor, there is an entry in the context structure.
34 and a #define. The #define makes the variable name refer to the
35 corresponding entry in the context structure.
36 *******************************************************************************/
37
38 typedef struct
39 {
40 swidget UxColAttribute;
41 swidget Uxform8;
42 swidget Uxlabel24;
43 swidget Uxnewform;
44 swidget UxpushButton8;
45 swidget UxpushButton9;
46 } _UxCColAttribute;
47
48 #define ColAttribute UxColAttributeContext->UxColAttribute
49 #define form8 UxColAttributeContext->Uxform8
50 #define label24 UxColAttributeContext->Uxlabel24
51 #define newform UxColAttributeContext->Uxnewform
52 #define pushButton8 UxColAttributeContext->UxpushButton8
53 #define pushButton9 UxColAttributeContext->UxpushButton9
54
55 static _UxCColAttribute *UxColAttributeContext;
56
57 extern int AppendDialogText();
58
59 extern void display_col_table();
60
61
62 /*******************************************************************************
63 Forward declarations of functions that are defined later in this file.
64 *******************************************************************************/
65
66 swidget create_ColAttribute();
67
68 /*******************************************************************************
69 The following are callback functions.
70 *******************************************************************************/
71
72 static void activateCB_pushButton8( UxWidget, UxClientData, UxCallbackArg )
73 Widget UxWidget;
74 XtPointer UxClientData, UxCallbackArg;
75 {
76 _UxCColAttribute *UxSaveCtx, *UxContext;
77 swidget UxThisWidget;
78
79 UxThisWidget = UxWidgetToSwidget( UxWidget );
80 UxSaveCtx = UxColAttributeContext;
81 UxColAttributeContext = UxContext =
82 (_UxCColAttribute *) UxGetContext( UxThisWidget );
83 {
84 extern int tidost;
85 extern char ostchoice[60];
86 extern int collabchan;
87 char *text;
88 char newf[TBL_FORLEN+1],comm[160];
89
90 text = UxGetText(UxFindSwidget("newform"));
91 if (text != NULL) strcpy(newf,text);
92 XtFree(text);
93 sprintf(comm,"NAME/COLUMN %s #%d %s",ostchoice,collabchan,newf);
94 AppendDialogText(comm);
95 TCTCLO(tidost);
96 TCTOPN(ostchoice,F_I_MODE,&tidost);
97 display_col_table(UxGetWidget(UxFindSwidget("readtable")));
98
99 }
100 UxColAttributeContext = UxSaveCtx;
101 }
102
103 static void activateCB_pushButton9( UxWidget, UxClientData, UxCallbackArg )
104 Widget UxWidget;
105 XtPointer UxClientData, UxCallbackArg;
106 {
107 _UxCColAttribute *UxSaveCtx, *UxContext;
108 swidget UxThisWidget;
109
110 UxThisWidget = UxWidgetToSwidget( UxWidget );
111 UxSaveCtx = UxColAttributeContext;
112 UxColAttributeContext = UxContext =
113 (_UxCColAttribute *) UxGetContext( UxThisWidget );
114 {
115 extern swidget attri;
116 UxPopdownInterface(attri);
117 }
118 UxColAttributeContext = UxSaveCtx;
119 }
120
121 /*******************************************************************************
122 The 'init_' function sets the private properties for all the
123 swidgets to the values specified in the Property Table.
124 Some properties need to be set after the X widgets have been
125 created and the setting of these properties is done in the
126 'build_' function after the UxCreateWidget call.
127 *******************************************************************************/
128
129 static void _Uxinit_ColAttribute()
130 {
131 UxPutTitle( ColAttribute, "Column Format" );
132 UxPutBackground( ColAttribute, WindowBackground );
133 UxPutHeight( ColAttribute, 130 );
134 UxPutWidth( ColAttribute, 300 );
135 UxPutY( ColAttribute, 460 );
136 UxPutX( ColAttribute, 780 );
137
138 UxPutBackground( form8, WindowBackground );
139 UxPutHeight( form8, 120 );
140 UxPutWidth( form8, 300 );
141 UxPutY( form8, 10 );
142 UxPutX( form8, 10 );
143 UxPutUnitType( form8, "pixels" );
144 UxPutResizePolicy( form8, "resize_none" );
145
146 UxPutLabelString( label24, "New Format" );
147 UxPutForeground( label24, TextForeground );
148 UxPutFontList( label24, BoldTextFont );
149 UxPutBackground( label24, LabelBackground );
150 UxPutHeight( label24, 30 );
151 UxPutWidth( label24, 110 );
152 UxPutY( label24, 20 );
153 UxPutX( label24, 10 );
154
155 UxPutForeground( newform, TextForeground );
156 UxPutFontList( newform, TextFont );
157 UxPutBackground( newform, TextBackground );
158 UxPutHeight( newform, 40 );
159 UxPutWidth( newform, 150 );
160 UxPutY( newform, 20 );
161 UxPutX( newform, 120 );
162
163 UxPutLabelString( pushButton8, "Apply" );
164 UxPutForeground( pushButton8, ButtonForeground );
165 UxPutFontList( pushButton8, BoldTextFont );
166 UxPutBackground( pushButton8, ButtonBackground );
167 UxPutHeight( pushButton8, 30 );
168 UxPutWidth( pushButton8, 110 );
169 UxPutY( pushButton8, 90 );
170 UxPutX( pushButton8, 20 );
171
172 UxPutLabelString( pushButton9, "Cancel" );
173 UxPutForeground( pushButton9, ButtonForeground );
174 UxPutFontList( pushButton9, BoldTextFont );
175 UxPutBackground( pushButton9, ButtonBackground );
176 UxPutHeight( pushButton9, 30 );
177 UxPutWidth( pushButton9, 110 );
178 UxPutY( pushButton9, 90 );
179 UxPutX( pushButton9, 150 );
180
181 }
182
183 /*******************************************************************************
184 The 'build_' function creates all the swidgets and X widgets,
185 and sets their properties to the values specified in the
186 Property Editor.
187 *******************************************************************************/
188
189 static swidget _Uxbuild_ColAttribute()
190 {
191 /* Create the swidgets */
192
193 ColAttribute = UxCreateTransientShell( "ColAttribute", NO_PARENT );
194 UxPutContext( ColAttribute, UxColAttributeContext );
195
196 form8 = UxCreateForm( "form8", ColAttribute );
197 label24 = UxCreateLabel( "label24", form8 );
198 newform = UxCreateText( "newform", form8 );
199 pushButton8 = UxCreatePushButton( "pushButton8", form8 );
200 pushButton9 = UxCreatePushButton( "pushButton9", form8 );
201
202 _Uxinit_ColAttribute();
203
204 /* Create the X widgets */
205
206 UxCreateWidget( ColAttribute );
207 UxCreateWidget( form8 );
208 UxCreateWidget( label24 );
209 UxCreateWidget( newform );
210 UxCreateWidget( pushButton8 );
211 UxCreateWidget( pushButton9 );
212
213 UxAddCallback( pushButton8, XmNactivateCallback,
214 activateCB_pushButton8,
215 (XtPointer) UxColAttributeContext );
216
217 UxAddCallback( pushButton9, XmNactivateCallback,
218 activateCB_pushButton9,
219 (XtPointer) UxColAttributeContext );
220
221
222 /* Finally, call UxRealizeInterface to create the X windows
223 for the widgets created above. */
224
225 UxRealizeInterface( ColAttribute );
226
227 return ( ColAttribute );
228 }
229
230 /*******************************************************************************
231 The following function includes the code that was entered
232 in the 'Initial Code' and 'Final Code' sections of the
233 Declarations Editor. This function is called from the
234 'Interface function' below.
235 *******************************************************************************/
236
237 static swidget _Ux_create_ColAttribute()
238 {
239 swidget rtrn;
240 _UxCColAttribute *UxContext;
241
242 UxColAttributeContext = UxContext =
243 (_UxCColAttribute *) UxMalloc( sizeof(_UxCColAttribute) );
244
245 rtrn = _Uxbuild_ColAttribute();
246
247 return(rtrn);
248 }
249
250 /*******************************************************************************
251 The following is the 'Interface function' which is the
252 external entry point for creating this interface.
253 This function should be called from your application or from
254 a callback function.
255 *******************************************************************************/
256
257 swidget create_ColAttribute()
258 {
259 swidget _Uxrtrn;
260
261 _Uxrtrn = _Ux_create_ColAttribute();
262
263 return ( _Uxrtrn );
264 }
265
266 /*******************************************************************************
267 END OF FILE
268 *******************************************************************************/
269