| 1 |
|
| 2 |
/******************************************************************************* |
| 3 |
transientShell8.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 "UxScList.h" |
| 14 |
#include "UxScrW.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 UxtransientShell8; |
| 41 |
swidget Uxform1; |
| 42 |
swidget UxscrolledWindow2; |
| 43 |
swidget UxpushButton2; |
| 44 |
} _UxCtransientShell8; |
| 45 |
|
| 46 |
#define transientShell8 UxTransientShell8Context->UxtransientShell8 |
| 47 |
#define form1 UxTransientShell8Context->Uxform1 |
| 48 |
#define scrolledWindow2 UxTransientShell8Context->UxscrolledWindow2 |
| 49 |
#define pushButton2 UxTransientShell8Context->UxpushButton2 |
| 50 |
|
| 51 |
static _UxCtransientShell8 *UxTransientShell8Context; |
| 52 |
|
| 53 |
extern int read_ost_table(), read_clas_table(), read_asso_table(); |
| 54 |
|
| 55 |
extern void add_ident_table(), display_col_table(), display_ident_table(); |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
swidget tablelist; |
| 61 |
|
| 62 |
/******************************************************************************* |
| 63 |
Forward declarations of functions that are defined later in this file. |
| 64 |
*******************************************************************************/ |
| 65 |
|
| 66 |
swidget create_transientShell8(); |
| 67 |
|
| 68 |
/******************************************************************************* |
| 69 |
The following are callback functions. |
| 70 |
*******************************************************************************/ |
| 71 |
|
| 72 |
static void browseSelectionCB_tablelist( UxWidget, UxClientData, UxCallbackArg ) |
| 73 |
Widget UxWidget; |
| 74 |
XtPointer UxClientData, UxCallbackArg; |
| 75 |
{ |
| 76 |
_UxCtransientShell8 *UxSaveCtx, *UxContext; |
| 77 |
swidget UxThisWidget; |
| 78 |
|
| 79 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 80 |
UxSaveCtx = UxTransientShell8Context; |
| 81 |
UxTransientShell8Context = UxContext = |
| 82 |
(_UxCtransientShell8 *) UxGetContext( UxThisWidget ); |
| 83 |
{ |
| 84 |
extern char ostchoice[60],claschoice[60],assochoice[60]; |
| 85 |
extern char *colchoice; |
| 86 |
extern int do8,tidcomm,tidost; |
| 87 |
extern swidget klist; |
| 88 |
XmListCallbackStruct *cbs; |
| 89 |
char *choice,type[2] ; |
| 90 |
char table_descr[60] ; |
| 91 |
int null,actval,dummy,uni; |
| 92 |
|
| 93 |
cbs = (XmListCallbackStruct *)UxCallbackArg; |
| 94 |
XmStringGetLtoR(cbs->item, XmSTRING_DEFAULT_CHARSET, &choice); |
| 95 |
if (!do8) { |
| 96 |
strcpy(ostchoice,choice); |
| 97 |
XtFree(choice); |
| 98 |
UxPopdownInterface(klist); |
| 99 |
if (read_ost_table()) |
| 100 |
display_ident_table(UxGetWidget(UxFindSwidget("identlist"))); |
| 101 |
/* XtVaGetValues(UxGetWidget(UxFindSwidget("readtable")),XmNitemCount,&upper,NULL); |
| 102 |
if (upper != 0) XmListDeleteAllItems(UxGetWidget(UxFindSwidget("readtable")));*/ |
| 103 |
SCDFND(tidost,"table_descr",type,&dummy,&dummy); |
| 104 |
TCTOPN("TAB_COMM",F_IO_MODE,&tidcomm); |
| 105 |
if (type[0] != ' ') { |
| 106 |
SCDRDC(tidost ,"table_descr",1 ,1,60,&actval,table_descr,&uni ,&null); |
| 107 |
TCEWRC(tidcomm,1,3,table_descr); |
| 108 |
} |
| 109 |
TCEWRC(tidcomm,1,2,ostchoice); |
| 110 |
TCTCLO(tidcomm); |
| 111 |
if (*colchoice) |
| 112 |
|
| 113 |
display_col_table(UxGetWidget(UxFindSwidget("readtable"))); |
| 114 |
|
| 115 |
} |
| 116 |
else if (do8 == 1){ |
| 117 |
strcpy(claschoice,choice); |
| 118 |
XtFree(choice); |
| 119 |
UxPopdownInterface(klist); |
| 120 |
read_clas_table(); |
| 121 |
} |
| 122 |
else { |
| 123 |
strcpy(assochoice,choice); |
| 124 |
XtFree(choice); |
| 125 |
UxPopdownInterface(klist); |
| 126 |
read_asso_table(); |
| 127 |
} |
| 128 |
} |
| 129 |
UxTransientShell8Context = UxSaveCtx; |
| 130 |
} |
| 131 |
|
| 132 |
static void activateCB_pushButton2( UxWidget, UxClientData, UxCallbackArg ) |
| 133 |
Widget UxWidget; |
| 134 |
XtPointer UxClientData, UxCallbackArg; |
| 135 |
{ |
| 136 |
_UxCtransientShell8 *UxSaveCtx, *UxContext; |
| 137 |
swidget UxThisWidget; |
| 138 |
|
| 139 |
UxThisWidget = UxWidgetToSwidget( UxWidget ); |
| 140 |
UxSaveCtx = UxTransientShell8Context; |
| 141 |
UxTransientShell8Context = UxContext = |
| 142 |
(_UxCtransientShell8 *) UxGetContext( UxThisWidget ); |
| 143 |
{ |
| 144 |
extern swidget klist; |
| 145 |
UxPopdownInterface(klist); |
| 146 |
} |
| 147 |
UxTransientShell8Context = UxSaveCtx; |
| 148 |
} |
| 149 |
|
| 150 |
/******************************************************************************* |
| 151 |
The 'init_' function sets the private properties for all the |
| 152 |
swidgets to the values specified in the Property Table. |
| 153 |
Some properties need to be set after the X widgets have been |
| 154 |
created and the setting of these properties is done in the |
| 155 |
'build_' function after the UxCreateWidget call. |
| 156 |
*******************************************************************************/ |
| 157 |
|
| 158 |
static void _Uxinit_transientShell8() |
| 159 |
{ |
| 160 |
UxPutTitle( transientShell8, "Select OST table" ); |
| 161 |
UxPutHeight( transientShell8, 353 ); |
| 162 |
UxPutWidth( transientShell8, 290 ); |
| 163 |
UxPutY( transientShell8, 300 ); |
| 164 |
UxPutX( transientShell8, 330 ); |
| 165 |
|
| 166 |
UxPutBackground( form1, ApplicBackground ); |
| 167 |
UxPutHeight( form1, 240 ); |
| 168 |
UxPutWidth( form1, 290 ); |
| 169 |
UxPutY( form1, 0 ); |
| 170 |
UxPutX( form1, 0 ); |
| 171 |
UxPutUnitType( form1, "pixels" ); |
| 172 |
UxPutResizePolicy( form1, "resize_none" ); |
| 173 |
|
| 174 |
UxPutScrollBarPlacement( scrolledWindow2, "bottom_left" ); |
| 175 |
UxPutBackground( scrolledWindow2, ApplicBackground ); |
| 176 |
UxPutWidth( scrolledWindow2, 270 ); |
| 177 |
UxPutHeight( scrolledWindow2, 316 ); |
| 178 |
UxPutShadowThickness( scrolledWindow2, 0 ); |
| 179 |
UxPutScrollBarDisplayPolicy( scrolledWindow2, "static" ); |
| 180 |
UxPutVisualPolicy( scrolledWindow2, "variable" ); |
| 181 |
UxPutY( scrolledWindow2, 10 ); |
| 182 |
UxPutX( scrolledWindow2, 10 ); |
| 183 |
UxPutScrollingPolicy( scrolledWindow2, "application_defined" ); |
| 184 |
|
| 185 |
UxPutVisibleItemCount( tablelist, 16 ); |
| 186 |
UxPutScrollBarDisplayPolicy( tablelist, "static" ); |
| 187 |
UxPutForeground( tablelist, TextForeground ); |
| 188 |
UxPutFontList( tablelist, TextFont ); |
| 189 |
UxPutBackground( tablelist, TextBackground ); |
| 190 |
UxPutHeight( tablelist, 320 ); |
| 191 |
UxPutWidth( tablelist, 190 ); |
| 192 |
|
| 193 |
UxPutForeground( pushButton2, CancelForeground ); |
| 194 |
UxPutFontList( pushButton2, BoldTextFont ); |
| 195 |
UxPutLabelString( pushButton2, "cancel" ); |
| 196 |
UxPutBackground( pushButton2, ButtonBackground ); |
| 197 |
UxPutHeight( pushButton2, 35 ); |
| 198 |
UxPutWidth( pushButton2, 210 ); |
| 199 |
UxPutY( pushButton2, 318 ); |
| 200 |
UxPutX( pushButton2, 0 ); |
| 201 |
|
| 202 |
} |
| 203 |
|
| 204 |
/******************************************************************************* |
| 205 |
The 'build_' function creates all the swidgets and X widgets, |
| 206 |
and sets their properties to the values specified in the |
| 207 |
Property Editor. |
| 208 |
*******************************************************************************/ |
| 209 |
|
| 210 |
static swidget _Uxbuild_transientShell8() |
| 211 |
{ |
| 212 |
/* Create the swidgets */ |
| 213 |
|
| 214 |
transientShell8 = UxCreateTransientShell( "transientShell8", NO_PARENT ); |
| 215 |
UxPutContext( transientShell8, UxTransientShell8Context ); |
| 216 |
|
| 217 |
form1 = UxCreateForm( "form1", transientShell8 ); |
| 218 |
scrolledWindow2 = UxCreateScrolledWindow( "scrolledWindow2", form1 ); |
| 219 |
tablelist = UxCreateScrolledList( "tablelist", scrolledWindow2 ); |
| 220 |
pushButton2 = UxCreatePushButton( "pushButton2", form1 ); |
| 221 |
|
| 222 |
_Uxinit_transientShell8(); |
| 223 |
|
| 224 |
/* Create the X widgets */ |
| 225 |
|
| 226 |
UxCreateWidget( transientShell8 ); |
| 227 |
UxCreateWidget( form1 ); |
| 228 |
UxPutTopOffset( scrolledWindow2, 0 ); |
| 229 |
UxPutTopAttachment( scrolledWindow2, "attach_form" ); |
| 230 |
UxPutRightOffset( scrolledWindow2, 2 ); |
| 231 |
UxPutRightAttachment( scrolledWindow2, "attach_form" ); |
| 232 |
UxPutLeftOffset( scrolledWindow2, 2 ); |
| 233 |
UxPutLeftAttachment( scrolledWindow2, "attach_form" ); |
| 234 |
UxPutBottomOffset( scrolledWindow2, 45 ); |
| 235 |
UxPutBottomAttachment( scrolledWindow2, "attach_form" ); |
| 236 |
UxCreateWidget( scrolledWindow2 ); |
| 237 |
|
| 238 |
UxCreateWidget( tablelist ); |
| 239 |
UxPutRightOffset( pushButton2, 10 ); |
| 240 |
UxPutRightAttachment( pushButton2, "attach_form" ); |
| 241 |
UxPutLeftOffset( pushButton2, 10 ); |
| 242 |
UxPutLeftAttachment( pushButton2, "attach_form" ); |
| 243 |
UxPutBottomOffset( pushButton2, 5 ); |
| 244 |
UxPutBottomAttachment( pushButton2, "attach_form" ); |
| 245 |
UxCreateWidget( pushButton2 ); |
| 246 |
|
| 247 |
|
| 248 |
UxAddCallback( tablelist, XmNbrowseSelectionCallback, |
| 249 |
browseSelectionCB_tablelist, |
| 250 |
(XtPointer) UxTransientShell8Context ); |
| 251 |
|
| 252 |
UxAddCallback( pushButton2, XmNactivateCallback, |
| 253 |
activateCB_pushButton2, |
| 254 |
(XtPointer) UxTransientShell8Context ); |
| 255 |
|
| 256 |
|
| 257 |
/* Finally, call UxRealizeInterface to create the X windows |
| 258 |
for the widgets created above. */ |
| 259 |
|
| 260 |
UxRealizeInterface( transientShell8 ); |
| 261 |
|
| 262 |
return ( transientShell8 ); |
| 263 |
} |
| 264 |
|
| 265 |
/******************************************************************************* |
| 266 |
The following function includes the code that was entered |
| 267 |
in the 'Initial Code' and 'Final Code' sections of the |
| 268 |
Declarations Editor. This function is called from the |
| 269 |
'Interface function' below. |
| 270 |
*******************************************************************************/ |
| 271 |
|
| 272 |
static swidget _Ux_create_transientShell8() |
| 273 |
{ |
| 274 |
swidget rtrn; |
| 275 |
_UxCtransientShell8 *UxContext; |
| 276 |
|
| 277 |
UxTransientShell8Context = UxContext = |
| 278 |
(_UxCtransientShell8 *) UxMalloc( sizeof(_UxCtransientShell8) ); |
| 279 |
|
| 280 |
rtrn = _Uxbuild_transientShell8(); |
| 281 |
|
| 282 |
return(rtrn); |
| 283 |
} |
| 284 |
|
| 285 |
/******************************************************************************* |
| 286 |
The following is the 'Interface function' which is the |
| 287 |
external entry point for creating this interface. |
| 288 |
This function should be called from your application or from |
| 289 |
a callback function. |
| 290 |
*******************************************************************************/ |
| 291 |
|
| 292 |
swidget create_transientShell8() |
| 293 |
{ |
| 294 |
swidget _Uxrtrn; |
| 295 |
|
| 296 |
_Uxrtrn = _Ux_create_transientShell8(); |
| 297 |
|
| 298 |
return ( _Uxrtrn ); |
| 299 |
} |
| 300 |
|
| 301 |
/******************************************************************************* |
| 302 |
END OF FILE |
| 303 |
*******************************************************************************/ |
| 304 |
|