1 /* $TOG: I18nMain.c /main/4 1997/08/11 12:31:36 samborn $ */
3 * (c) Copyright 1996 Digital Equipment Corporation.
4 * (c) Copyright 1996 Hewlett-Packard Company.
5 * (c) Copyright 1996 International Business Machines Corp.
6 * (c) Copyright 1996 Sun Microsystems, Inc.
7 * (c) Copyright 1996 Novell, Inc.
8 * (c) Copyright 1996 FUJITSU LIMITED.
9 * (c) Copyright 1996 Hitachi.
11 /************************************<+>*************************************
12 ****************************************************************************
16 ** Description: Controls the Dtstyle I18N customization dialog
19 ****************************************************************************
20 ************************************<+>*************************************/
22 /*+++++++++++++++++++++++++++++++++++++++*/
24 /*+++++++++++++++++++++++++++++++++++++++*/
27 #include <Xm/MwmUtil.h>
32 #include <Xm/LabelG.h>
33 #include <Xm/PushBG.h>
34 #include <Xm/RowColumn.h>
35 #include <Xm/ToggleBG.h>
36 #include <Xm/SeparatoG.h>
37 #include <Xm/VendorSEP.h>
38 #include <Xm/MessageB.h>
40 #include <Dt/DialogBox.h>
42 #include <Dt/TitleBox.h>
43 #include <Dt/UserMsg.h>
44 #include <Dt/Message.h>
45 #include <Dt/HourGlass.h>
50 #include "SaveRestore.h"
55 /*+++++++++++++++++++++++++++++++++++++++*/
56 /* include extern functions */
57 /*+++++++++++++++++++++++++++++++++++++++*/
61 /*+++++++++++++++++++++++++++++++++++++++*/
63 /*+++++++++++++++++++++++++++++++++++++++*/
65 #define MSG_IMMEDIATE ((char *)GETMESSAGE(19, 20, "The new XmNpreeditType value will take effect\nas applications are restarted."))
66 #define MSG_LATER ((char *)GETMESSAGE(19, 21, "Your selection will take effect\n at your next session."))
68 /*+++++++++++++++++++++++++++++++++++++++*/
69 /* Internal Functions */
70 /*+++++++++++++++++++++++++++++++++++++++*/
72 static int InitI18nValues(Widget shell);
73 static void SetImServerHosts(I18nEnv *env);
74 static void SetImsToggleList(I18nEnv *env);
75 static void SetImsMode(I18nEnv *env);
76 static void SetPreeditType(I18nEnv *env, XmStringTable preeditTable,
79 static Widget BuildI18nDlg(Widget shell);
80 static void FormLayoutCB(Widget w, XtPointer client_data, XtPointer call_data);
81 static void MapCB(Widget w, XtPointer client_data, XtPointer call_data);
82 static void SystemDefaultCB(Widget w, XtPointer client_data,
84 static void ServerHostCB(Widget w, XtPointer client_data, XtPointer call_data);
85 static void UpdateImList(I18nEnv *env, char *hostname);
86 static void TextFocusCB(Widget w, XtPointer client_data, XtPointer call_data);
87 static void TextLosingFocusCB(Widget w, XtPointer client_data,
89 static void ButtonCB(Widget w, XtPointer client_data, XtPointer call_data);
90 static int SaveSelectedValues(I18nEnv *env);
91 static void SetFileSelValues(I18nEnv *env);
92 static void ResetLastSavedValues(I18nEnv *env);
94 static void OkWarnCB(Widget w, XtPointer client_data, XtPointer call_data);
95 static void CancelWarnCB(Widget w, XtPointer client_data, XtPointer call_data);
97 static void ListItemSelectCB(Widget w, XtPointer client_data,
99 static void MoveUpCB(Widget w, XtPointer client_data, XtPointer call_data);
100 static void MoveDownCB(Widget w, XtPointer client_data, XtPointer call_data);
102 static XmStringTable CopyST (XmStringTable st, int nst);
103 static void FreeST (XmStringTable st, int nst);
105 /*+++++++++++++++++++++++++++++++++++++++*/
106 /* Internal Variables */
107 /*+++++++++++++++++++++++++++++++++++++++*/
111 Widget systemDefault;
112 Widget inputMethodTB;
113 Widget serverHostLabel;
115 Widget inputMethodLabel;
116 Widget inputMethodRC;
117 Widget imStartModeTB;
118 Widget imStartModeRC;
120 Widget resumeCurrentImTG;
121 Widget preeditTypeTB;
122 Widget preeditTypeList;
123 int preeditTypeListLastPos;
124 Boolean preeditHasChanged;
125 XmStringTable preeditSavedVal;
128 Widget buttonMoveDown;
130 Widget defaultButton;
135 static saveRestore save = {FALSE, 0, };
137 static char i18nRes[150]="";
139 static char *defaultPreedit[] =
145 #define NUM_PREEDIT 4
147 /*+++++++++++++++++++++++++++++++++++++++*/
149 /*+++++++++++++++++++++++++++++++++++++++*/
157 if (style.i18nDialog == NULL) {
158 _DtTurnOnHourGlass(shell);
160 ret = InitI18nValues(shell);
161 XtManageChild(style.i18nDialog);
163 _DtI18nErrorDialog(ret) ;
164 _DtTurnOffHourGlass(shell);
168 XtManageChild(style.i18nDialog);
169 raiseWindow(XtWindow(XtParent(style.i18nDialog)));
173 /*+++++++++++++++++++++++++++++++++++++++*/
175 /*+++++++++++++++++++++++++++++++++++++++*/
178 InitI18nValues(Widget shell)
183 XmString *str = style.xrdb.preeditType;
189 /* Get all the needed values from the environment. */
190 if ((ret = _DtI18nGetEnvValues(env)) == NoError) {
191 /* Update the display with the values */
192 SetImServerHosts(env);
196 /* Get the preeditType resource value */
197 while (str[num_preedit]) num_preedit++;
199 SetPreeditType(env, style.xrdb.preeditType, num_preedit);
201 i18n.preeditHasChanged = False;
203 /* Save the initial value in case of a reset. */
204 i18n.preeditSavedVal = style.xrdb.preeditType;
205 i18n.preeditSavedNum = num_preedit;
212 SetImServerHosts(I18nEnv *env)
214 Cardinal num_hosts = 0 ;
216 /* Set the TextField of the ComboBox with the value found in
217 the IMS selection file */
218 XtVaSetValues(XtNameToWidget(i18n.serverHostCB,"Text"),
219 XmNvalue, env->file_sel->hostname, NULL);
221 /* update ComboBox with list of server hostnames found in
222 "imServerHosts" resource */
224 if (style.xrdb.imServerHosts)
225 while (style.xrdb.imServerHosts[num_hosts]) num_hosts ++ ;
227 /* TBD: need to add file_sel->hostname if not null
228 or localhost, if not already present */
230 XtVaSetValues(i18n.serverHostCB,
231 XmNitemCount, num_hosts,
232 XmNitems, style.xrdb.imServerHosts, NULL);
236 SetImsToggleList(I18nEnv *env)
240 Widget *im_tog = NULL;
242 Boolean found = FALSE;
243 Cardinal default_index = 0;
245 /* create new toggles */
247 if (env->ims_sel->ims_list_size > 0)
248 im_tog = (Widget*)XtMalloc(sizeof(Widget)
249 * env->ims_sel->ims_list_size);
252 for (i=0; i< env->ims_sel->ims_list_size; i++) {
253 string = XmStringCreateLocalized(env->ims_sel->ims_list[i].im_label);
255 XtSetArg(args[n], XmNlabelString, string); n++;
256 XtSetArg(args[n], XmNsensitive,
257 !(env->ims_sel->ims_list[i].inactive)); n++;
258 XtSetArg(args[n], XmNuserData,
259 env->ims_sel->ims_list[i].im_name); n++;
261 /* Need to default to the file_sel->im_name, if in the list */
262 if (strcmp(env->file_sel->im_name,
263 env->ims_sel->ims_list[i].im_name) == 0) {
265 XtSetArg(args[n], XmNset, True); n++;
268 if (env->ims_sel->ims_list[i].im_default) {
272 im_tog[i] = XmCreateToggleButtonGadget(i18n.inputMethodRC,
274 XmStringFree(string);
277 if (env->ims_sel->ims_list_size > 0)
278 XtManageChildren(im_tog, env->ims_sel->ims_list_size);
280 /* If we provided toggle buttons, but the file_sel->im_name was not
281 found, default it to the default from the locale file. */
283 if (im_tog && !found) {
285 XtSetArg(args[n], XmNset, True); n++;
286 XtSetValues(im_tog[default_index], args, n);
290 XtFree((char *) im_tog);
292 _DtTurnOffHourGlass(i18n.inputMethodTB);
296 SetImsMode(I18nEnv *env)
299 /* only called once at startup, or when resetting the saved values */
300 if (env->file_sel->start_mode == 0)
301 XmToggleButtonGadgetSetState(i18n.askAtLoginTG, True, True);
303 XmToggleButtonGadgetSetState(i18n.resumeCurrentImTG, True, True);
309 XmStringTable preeditTable,
312 XmStringTable loc_preeditTable ;
314 loc_preeditTable = CopyST(preeditTable, preeditTableNum);
316 /* initialize List with preeditType values */
317 XtVaSetValues(i18n.preeditTypeList,
318 XmNvisibleItemCount, preeditTableNum,
319 XmNitemCount, preeditTableNum,
320 XmNitems, loc_preeditTable,
321 XmNselectedItemCount, 1,
322 XmNselectedItems, loc_preeditTable, NULL);
324 /* set the last item position - This is the number of items in the list. */
325 i18n.preeditTypeListLastPos = preeditTableNum;
327 /* If more than one item in the list, set the Button MoveDown sentivity to
329 if (preeditTableNum > 1)
330 XtVaSetValues(i18n.buttonMoveDown, XmNsensitive, True, NULL);
332 XtVaSetValues(i18n.buttonMoveUp, XmNsensitive, False, NULL);
336 /*+++++++++++++++++++++++++++++++++++++++*/
338 /*+++++++++++++++++++++++++++++++++++++++*/
345 XmString button_string[NUM_LABELS];
348 Widget inputMethodForm;
349 Widget imStartModeForm;
350 Widget preeditTypeForm;
352 Widget widgetList1[6];
354 /* get i18n resource values */
356 /* Set up DialogBoxDialog button labels */
357 button_string[0] = CMPSTR(_DtOkString);
358 button_string[1] = CMPSTR(_DtCancelString);
359 button_string[2] = CMPSTR(_DtHelpString);
361 /* Create toplevel DialogBox */
363 /* Initialize the i18n structure */
364 i18n.pictLabel = NULL;
365 i18n.systemDefault = NULL;
366 i18n.inputMethodTB = NULL;
367 i18n.serverHostLabel = NULL;
368 i18n.serverHostCB = NULL;
369 i18n.inputMethodLabel = NULL;
370 i18n.inputMethodRC = NULL;
371 i18n.imStartModeTB = NULL;
372 i18n.imStartModeRC = NULL;
373 i18n.askAtLoginTG = NULL;
374 i18n.resumeCurrentImTG = NULL;
375 i18n.preeditTypeTB = NULL;
376 i18n.preeditTypeList = NULL;
377 i18n.buttonMoveUp = NULL;
378 i18n.buttonMoveDown = NULL;
379 i18n.warnDialog = NULL;
382 * Note that save.poscnt has been initialized elsewhere.
383 * save.posArgs may contain information from restoreBeep().*/
385 XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);
387 XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
389 XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
392 __DtCreateDialogBoxDialog(shell, "i18nDialog", save.posArgs,
394 XtAddCallback(style.i18nDialog, XmNhelpCallback,
395 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_I18N_DIALOG);
397 XmStringFree(button_string[0]);
398 XmStringFree(button_string[1]);
399 XmStringFree(button_string[2]);
401 widgetList1[0] = _DtDialogBoxGetButton(style.i18nDialog,2);
403 XtSetArg(args[n], XmNautoUnmanage, False); n++;
404 XtSetArg(args[n], XmNcancelButton, widgetList1[0]); n++;
405 XtSetValues (style.i18nDialog, args, n);
408 XtSetArg(args[n], XmNtitle,
409 ((char *)GETMESSAGE(19, 1, "Style Manager - Internationalization")));
411 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
412 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
413 XtSetValues (XtParent(style.i18nDialog), args, n);
416 XtSetArg(args[n], XmNallowOverlap, False); n++;
417 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
418 form = XmCreateForm(style.i18nDialog, "i18nForm", args, n);
421 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
422 XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
423 XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
424 XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
425 XtSetArg(args[n], XmNstring, NULL); n++;
426 XtSetArg(args[n], XmNshadowThickness, 0); n++;
427 XtSetArg(args[n], XmNimageName, I18N_ICON); n++;
428 XtSetArg(args[n], XmNtraversalOn, False); n++;
429 widgetList1[count++] = i18n.pictLabel =
430 _DtCreateIcon(form, "i18npictLabel", args, n);
433 XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
434 XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
435 string = CMPSTR(((char *)GETMESSAGE(19, 2, "Default")));
436 XtSetArg(args[n], XmNlabelString, string); n++;
437 widgetList1[count++] = i18n.systemDefault =
438 XmCreatePushButtonGadget(form, "systemDefault", args, n);
439 XmStringFree(string);
442 string = CMPSTR((char *)GETMESSAGE(19, 3, "Input Method"));
443 XtSetArg(args[n], XmNtitleString, string); n++;
444 widgetList1[count++] = i18n.inputMethodTB =
445 _DtCreateTitleBox(form, "inputMethodTB", args, n);
446 XmStringFree(string);
449 XtSetArg(args[n], XmNallowOverlap, False); n++;
450 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
452 XmCreateForm(i18n.inputMethodTB, "inputMethodForm", args, n);
455 string = CMPSTR((char *)GETMESSAGE(19, 4, "Input Method Start Mode"));
456 XtSetArg(args[n], XmNtitleString, string); n++;
457 widgetList1[count++] = i18n.imStartModeTB =
458 _DtCreateTitleBox(form, "imStartModeTB", args, n);
459 XmStringFree(string);
462 XtSetArg(args[n], XmNallowOverlap, False); n++;
463 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
465 XmCreateForm(i18n.imStartModeTB, "imStartModeForm", args, n);
468 string = CMPSTR((char *)GETMESSAGE(19, 5, "Preedit Type"));
469 XtSetArg(args[n], XmNtitleString, string); n++;
470 widgetList1[count++] = i18n.preeditTypeTB =
471 _DtCreateTitleBox(form, "preeditTypeTB", args, n);
472 XmStringFree(string);
475 XtSetArg(args[n], XmNallowOverlap, False); n++;
476 XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
478 XmCreateForm(i18n.preeditTypeTB, "preeditTypeForm", args, n);
480 /* Create widgets inside the inputMethodForm */
482 string = CMPSTR((char *)GETMESSAGE(19, 6, "Server Host :"));
483 XtSetArg(args[n], XmNlabelString, string); n++;
484 i18n.serverHostLabel =
485 XmCreateLabelGadget(inputMethodForm, "serverHostLabel", args, n);
488 XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); n++;
490 (Widget) XmCreateComboBox(inputMethodForm, "serverHostCB", args, n);
492 XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
493 XmNactivateCallback, ServerHostCB, NULL);
494 XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
495 XmNfocusCallback, TextFocusCB, NULL);
496 XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
497 XmNlosingFocusCallback, TextLosingFocusCB, NULL);
501 string = CMPSTR((char *)GETMESSAGE(19, 7, "Input Method"));
502 XtSetArg(args[n], XmNlabelString, string); n++;
503 i18n.inputMethodLabel =
504 XmCreateLabelGadget(inputMethodForm, "inputMethodLabel", args, n);
507 XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
508 XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
510 XmCreateRadioBox(inputMethodForm, "inputMethodRC", args, n);
513 /* Create widgets inside the imStartModeForm */
515 XtSetArg(args[n], XmNmarginWidth, 0); n++;
516 XtSetArg(args[n], XmNmarginHeight, 0); n++;
518 XmCreateRadioBox(imStartModeForm, "imStartModeRC", args, n);
521 string = CMPSTR((char *)GETMESSAGE(19, 8, "Ask at login"));
522 XtSetArg(args[n], XmNlabelString, string); n++;
524 XmCreateToggleButtonGadget(i18n.imStartModeRC, "askAtLoginTG",
526 XmStringFree(string);
529 string = CMPSTR((char *)GETMESSAGE(19, 9, "Resume Current Input Method"));
530 XtSetArg(args[n], XmNlabelString, string); n++;
531 i18n.resumeCurrentImTG =
532 XmCreateToggleButtonGadget(i18n.imStartModeRC, "resumeCurrentImTG",
534 XmStringFree(string);
536 /* Create widgets inside the preeditTypeForm */
539 XtSetArg(args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
540 i18n.preeditTypeList =
541 (Widget) XmCreateList(preeditTypeForm, "preeditTypeList", args, n);
544 string = CMPSTR((char *)GETMESSAGE(19, 10, "Move Up"));
545 XtSetArg(args[n], XmNlabelString, string); n++;
546 XtSetArg(args[n], XmNsensitive, False); n++;
548 XmCreatePushButtonGadget(preeditTypeForm, "buttonMoveUp", args, n);
549 XmStringFree(string);
552 string = CMPSTR((char *)GETMESSAGE(19, 11, "Move Down"));
553 XtSetArg(args[n], XmNlabelString, string); n++;
554 XtSetArg(args[n], XmNsensitive, False); n++;
555 i18n.buttonMoveDown =
556 XmCreatePushButtonGadget(preeditTypeForm, "buttonMoveDown", args, n);
557 XmStringFree(string);
559 XtAddCallback(style.i18nDialog, XmNmapCallback, FormLayoutCB, NULL);
560 XtAddCallback(style.i18nDialog, XmNmapCallback, MapCB, shell);
561 XtAddCallback(style.i18nDialog, XmNcallback, ButtonCB, NULL);
562 XtAddCallback(i18n.systemDefault, XmNactivateCallback,
563 SystemDefaultCB, NULL);
564 XtAddCallback(i18n.preeditTypeList, XmNbrowseSelectionCallback,
565 ListItemSelectCB, NULL);
566 XtAddCallback(i18n.buttonMoveUp, XmNactivateCallback,
568 XtAddCallback(i18n.buttonMoveDown, XmNactivateCallback,
572 XtManageChildren(widgetList1,count);
574 XtManageChild(inputMethodForm);
575 XtManageChild(imStartModeForm);
576 XtManageChild(preeditTypeForm);
578 XtManageChild(i18n.serverHostLabel);
579 XtManageChild(i18n.serverHostCB);
580 XtManageChild(i18n.inputMethodLabel);
581 XtManageChild(i18n.inputMethodRC);
583 XtManageChild(i18n.imStartModeRC);
584 XtManageChild(i18n.askAtLoginTG);
585 XtManageChild(i18n.resumeCurrentImTG);
587 XtManageChild(i18n.preeditTypeList);
588 XtManageChild(i18n.buttonMoveUp);
589 XtManageChild(i18n.buttonMoveDown);
591 return(style.i18nDialog);
595 /*+++++++++++++++++++++++++++++++++++++++*/
597 /*+++++++++++++++++++++++++++++++++++++++*/
601 XtPointer client_data,
602 XtPointer call_data )
609 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
610 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
611 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
612 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
613 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
614 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
615 XtSetValues (i18n.pictLabel, args, n);
619 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
620 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
621 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
622 XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
623 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
624 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
625 XtSetValues (i18n.systemDefault, args, n);
627 /* Input Method TitleBox */
629 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
630 XtSetArg(args[n], XmNtopWidget, i18n.pictLabel); n++;
631 XtSetArg(args[n], XmNtopOffset, style.horizontalSpacing); n++;
632 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
633 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
634 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
635 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
636 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
637 XtSetValues (i18n.inputMethodTB, args, n);
639 /* Input Method widgets */
642 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
643 XtSetArg(args[n], XmNtopOffset, 2*style.verticalSpacing); n++;
644 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
645 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
646 XtSetArg(args[n], XmNleftOffset, 0); n++;
647 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
648 XtSetValues (i18n.serverHostLabel, args, n);
651 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
652 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
653 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
654 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
655 XtSetArg(args[n], XmNleftWidget, i18n.serverHostLabel); n++;
656 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
657 XtSetValues (i18n.serverHostCB, args, n);
660 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
661 XtSetArg(args[n], XmNtopWidget, i18n.serverHostCB); n++;
662 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
663 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
664 XtSetArg(args[n], XmNleftOffset, 0); n++;
665 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
666 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
667 XtSetValues (i18n.inputMethodLabel, args, n);
670 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
671 XtSetArg(args[n], XmNtopWidget, i18n.inputMethodLabel); n++;
672 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
673 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
674 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
675 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
676 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
677 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
678 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
679 XtSetValues (i18n.inputMethodRC, args, n);
681 /* Input Method Start Mode TitleBox */
683 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
684 XtSetArg(args[n], XmNtopWidget, i18n.inputMethodTB); n++;
685 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
686 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
687 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
688 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
689 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
690 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
691 XtSetValues (i18n.imStartModeTB, args, n);
693 /* IM Start Mode RC */
695 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
696 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
697 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
698 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
699 XtSetArg(args[n], XmNleftOffset, 0); n++;
700 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
701 XtSetArg(args[n], XmNrightOffset, 0); n++;
702 XtSetValues (i18n.imStartModeRC, args, n);
704 /* Preedit Type TitleBox */
706 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
707 XtSetArg(args[n], XmNtopWidget, i18n.imStartModeTB); n++;
708 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
709 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
710 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
711 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
712 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
713 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
714 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
715 XtSetValues (i18n.preeditTypeTB, args, n);
717 /* Preedit Type widgets */
719 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
720 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
721 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
722 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
723 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
724 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
725 XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
726 XtSetValues (i18n.preeditTypeList, args, n);
729 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
730 XtSetArg(args[n], XmNtopOffset, 2*style.verticalSpacing); n++;
731 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
732 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
733 XtSetArg(args[n], XmNleftWidget, i18n.preeditTypeList); n++;
734 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
735 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
736 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
737 XtSetValues (i18n.buttonMoveUp, args, n);
740 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
741 XtSetArg(args[n], XmNtopWidget, i18n.buttonMoveUp); n++;
742 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
743 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
744 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
745 XtSetArg(args[n], XmNleftWidget, i18n.preeditTypeList); n++;
746 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
747 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
748 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
749 XtSetValues (i18n.buttonMoveDown, args, n);
751 XtRemoveCallback(style.i18nDialog, XmNmapCallback, FormLayoutCB, NULL);
754 /*+++++++++++++++++++++++++++++++++++++++*/
756 /*+++++++++++++++++++++++++++++++++++++++*/
760 XtPointer client_data,
761 XtPointer call_data )
764 static int first_time = 1;
769 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
771 if (!save.restoreFlag)
772 putDialog ((Widget)client_data, w);
774 XtRemoveCallback(style.i18nDialog, XmNmapCallback, MapCB, NULL);
778 /*+++++++++++++++++++++++++++++++++++++++*/
779 /* ServerHostCB - get the new hostname, */
780 /* query its list of im and update the */
782 /*+++++++++++++++++++++++++++++++++++++++*/
786 XtPointer client_data,
787 XtPointer call_data )
791 _DtTurnOnHourGlass(i18n.inputMethodTB);
792 /* Get the current hostname in the TextField of the ComboBox,
794 XtVaGetValues(XtNameToWidget(i18n.serverHostCB,"Text"),
795 XmNvalue, &hostname, NULL);
797 /* Update the display and query for new IM on this host. */
798 UpdateImList(&i18n_env, hostname);
807 Widget *im_tog = NULL;
810 /* Clean first the existing list */
812 /* destroy toggle in radio box is any */
813 XtVaGetValues(i18n.inputMethodRC, XmNchildren, &im_tog,
814 XmNnumChildren, &n, NULL);
816 XtUnmanageChildren(im_tog, n);
817 for (i=0; i<n; i++) XtDestroyWidget(im_tog[i]);
821 /* Empty what we used to have here */
822 if (env->ims_sel->ims_list_size) {
823 XtFree((char *) env->ims_sel->ims_list);
824 env->ims_sel->ims_list = NULL;
825 env->ims_sel->ims_list_size = 0 ;
828 /* then update the env struct with new ims name and status */
829 ret = _DtI18nGetImList(env, hostname);
830 if (ret != NoError) {
831 _DtTurnOffHourGlass(i18n.inputMethodTB);
832 _DtI18nErrorDialog(ret);
837 /*+++++++++++++++++++++++++++++++++++++++*/
838 /* SystemDefaultCB */
839 /*+++++++++++++++++++++++++++++++++++++++*/
843 XtPointer client_data,
844 XtPointer call_data )
846 static XmStringTable preeditTable = NULL ;
852 /* Set the Server Host to local, that is use the NULL string */
853 XtVaSetValues(XtNameToWidget(i18n.serverHostCB,"Text"),
854 XmNvalue, "local", NULL);
856 UpdateImList(env, "local");
858 /* Set the Input Method Start Mode to Ask at login */
859 XmToggleButtonGadgetSetState(i18n.askAtLoginTG, True, True);
862 /* Set the preeditType list to the default in Motif */
863 preeditTable = (XmStringTable) XtMalloc(NUM_PREEDIT *
865 for ( i = 0; i < NUM_PREEDIT; i ++ )
866 preeditTable[i] = XmStringCreate(defaultPreedit[i],
870 SetPreeditType(env, preeditTable, NUM_PREEDIT);
872 /* Mark that the preeditType list has changed. */
873 i18n.preeditHasChanged = True;
879 /*+++++++++++++++++++++++++++++++++++++++*/
880 /* TextFocusCB - disable the default */
881 /* button in the dialog, so that return */
882 /* in the TextField doesn't activate it. */
883 /*+++++++++++++++++++++++++++++++++++++++*/
887 XtPointer client_data,
888 XtPointer call_data )
890 XtVaGetValues(style.i18nDialog, XmNdefaultButton, &i18n.defaultButton,
892 XtVaSetValues(style.i18nDialog, XmNdefaultButton, NULL, NULL);
898 /*+++++++++++++++++++++++++++++++++++++++*/
899 /* TextLosingFocusCB - enable the */
900 /* default button, so that return key in */
901 /* the dialog activate it. */
902 /*+++++++++++++++++++++++++++++++++++++++*/
906 XtPointer client_data,
907 XtPointer call_data )
909 XtVaSetValues(style.i18nDialog, XmNdefaultButton, i18n.defaultButton,
916 /*+++++++++++++++++++++++++++++++++++++++*/
918 /* callback for PushButtons in DialogBox */
919 /*+++++++++++++++++++++++++++++++++++++++*/
923 XtPointer client_data,
924 XtPointer call_data )
929 DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
933 switch (cb->button_position)
937 ret = SaveSelectedValues(env);
947 /* reset the i18n values from last saved values */
948 ResetLastSavedValues(env);
950 if (i18n.preeditHasChanged) {
951 /* Reset the preeditType value from the saved one. */
952 SetPreeditType(env, i18n.preeditSavedVal, i18n.preeditSavedNum);
954 i18n.preeditHasChanged = False;
959 XtCallCallbacks(style.i18nDialog, XmNhelpCallback, (XtPointer)NULL);
972 char *preeditStr = NULL, *tmpStr;
973 int i, num_preedit = 0;
974 XmStringTable list_preedit;
975 static char preeditTypeRes[1024];
977 /* Get the values from the UI and update the FileSel structure */
978 SetFileSelValues(env);
980 /* Write these values in the IMS Selection File */
981 ret = _DtI18nWriteImSelectionFile(env);
983 /* Save the preeditType resource value if needed */
984 if (i18n.preeditHasChanged) {
986 if (style.xrdb.writeXrdbImmediate)
987 InfoDialog(MSG_IMMEDIATE, style.shell, False);
989 InfoDialog(MSG_LATER, style.shell, False);
991 /* generate a string from the list to set the resource */
992 XtVaGetValues(i18n.preeditTypeList,
993 XmNitemCount, &num_preedit,
994 XmNitems, &list_preedit, NULL);
996 /* Save this value in case of a Cancel */
997 if (i18n.preeditSavedVal) {
998 FreeST(i18n.preeditSavedVal, i18n.preeditSavedNum);
1001 i18n.preeditSavedVal = CopyST(list_preedit, num_preedit);
1002 i18n.preeditSavedNum = num_preedit;
1004 for (i = 0; i < num_preedit; i++) {
1005 /* get the text of the XmString */
1006 tmpStr = XmStringUnparse(list_preedit[i], NULL, XmCHARSET_TEXT,
1007 XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL);
1008 /* realloc mallocs the first time */
1009 preeditStr = XtRealloc(preeditStr,
1010 strlen(preeditStr) + strlen(tmpStr) + 2);
1012 /* insert the comma before the second, third. etc */
1014 strcat(preeditStr, ",");
1015 strcat(preeditStr, tmpStr);
1018 strcpy(preeditStr, tmpStr);
1023 /* if writeXrdbImmediate true write to Xrdb else send to
1026 sprintf(preeditTypeRes, "*preeditType: %s\n", preeditStr);
1030 if(style.xrdb.writeXrdbImmediate)
1031 _DtAddToResource(style.display, preeditTypeRes);
1033 SmNewPreeditSettings(preeditTypeRes);
1035 /* Reset the state of the list. */
1036 i18n.preeditHasChanged = False;
1052 /* The hostname value is stored in the ImsSel structure. */
1053 env->file_sel->hostname = XtNewString(env->ims_sel->host_name);
1055 /* Get the selected IM from the selected Toggle button */
1056 XtVaGetValues(i18n.inputMethodRC, XmNchildren, &im_tog,
1057 XmNnumChildren, &n, NULL);
1059 for (i=0; i<n; i++) {
1060 if (XmToggleButtonGadgetGetState(im_tog[i]) == TRUE) {
1061 XtVaGetValues(im_tog[i], XmNuserData,
1062 &(env->file_sel->im_name),
1069 env->file_sel->im_name = NULL;
1071 /* Get the start mode from the askAtLoginTG state */
1072 if (XmToggleButtonGadgetGetState(i18n.askAtLoginTG) == TRUE)
1073 env->file_sel->start_mode = 0;
1075 env->file_sel->start_mode = 1;
1079 ResetLastSavedValues(
1083 if (env->file_sel->start_mode == -1) return;
1085 /* Reset the TextField of the ComboBox to the last saved hostname. */
1086 XtVaSetValues(XtNameToWidget(i18n.serverHostCB,"Text"),
1087 XmNvalue, env->file_sel->hostname, NULL);
1089 UpdateImList(env, env->file_sel->hostname);
1091 /* Reset the saved start mode */
1096 /************************************************************************
1098 * restore any state information saved with savei18n.
1099 * This is called from restoreSession with the application
1100 * shell and the special xrm database retrieved for restore.
1101 ************************************************************************/
1107 XrmName xrm_name[5];
1108 XrmRepresentation rep_type;
1111 xrm_name [0] = XrmStringToQuark ("i18nDlg");
1112 xrm_name [2] = NULL;
1114 /* get x position */
1115 xrm_name [1] = XrmStringToQuark ("x");
1116 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
1117 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr));
1119 save.restoreFlag = True;
1122 /* get y position */
1123 xrm_name [1] = XrmStringToQuark ("y");
1124 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
1125 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr)); save.poscnt++;
1128 xrm_name [1] = XrmStringToQuark ("ismapped");
1129 XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
1130 /* Are we supposed to be mapped? */
1131 if (strcmp(value.addr, "True") == 0)
1132 popup_i18nBB(shell);
1135 /************************************************************************
1138 * This routine will write out to the passed file descriptor any state
1139 * information this dialog needs. It is called from saveSessionCB with the
1140 * file already opened.
1141 * All information is saved in xrm format. There is no restriction
1142 * on what can be saved. It doesn't have to be defined or be part of any
1143 * widget or Xt definition. Just name and save it here and recover it in
1144 * restoreBackdrop. The suggested minimum is whether you are mapped, and your
1146 ************************************************************************/
1152 Dimension width, height;
1153 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
1154 XmVendorShellExtObject vendorExt;
1155 XmWidgetExtData extData;
1157 if (style.i18nDialog != NULL)
1159 if (XtIsManaged(style.i18nDialog))
1160 sprintf(bufr, "*i18nDlg.ismapped: True\n");
1162 sprintf(bufr, "*i18nDlg.ismapped: False\n");
1164 /* Get and write out the geometry info for our Window */
1165 x = XtX(XtParent(style.i18nDialog));
1166 y = XtY(XtParent(style.i18nDialog));
1168 /* Modify x & y to take into account window mgr frames
1169 * This is pretty bogus, but I don't know a better way to do it.
1171 extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
1172 vendorExt = (XmVendorShellExtObject)extData->widget;
1173 x -= vendorExt->vendor.xOffset;
1174 y -= vendorExt->vendor.yOffset;
1176 width = XtWidth(style.i18nDialog);
1177 height = XtHeight(style.i18nDialog);
1179 sprintf(bufr, "%s*i18nDlg.x: %d\n", bufr, x);
1180 sprintf(bufr, "%s*i18nDlg.y: %d\n", bufr, y);
1181 sprintf(bufr, "%s*i18nDlg.width: %d\n", bufr, width);
1182 sprintf(bufr, "%s*i18nDlg.height: %d\n", bufr, height);
1183 write (fd, bufr, strlen(bufr));
1188 /*+++++++++++++++++++++++++++++++++++++++*/
1189 /* cancelWarnCB - callback for the */
1190 /* cancel button of the warnDialog */
1191 /*+++++++++++++++++++++++++++++++++++++++*/
1196 XtPointer client_data,
1197 XtPointer call_data )
1205 /*+++++++++++++++++++++++++++++++++++++++*/
1206 /* okWarnCB - callback for the */
1207 /* OK button of the warnDialog */
1208 /*+++++++++++++++++++++++++++++++++++++++*/
1213 XtPointer client_data,
1214 XtPointer call_data )
1220 /*+++++++++++++++++++++++++++++++++++++++*/
1221 /* _DtI18nSetSensitiveImTB - set the */
1222 /* sensitivity of the TitleBox. This is */
1223 /* used when changing host, while getting*/
1225 /* Also recreate the toggle list. */
1226 /*+++++++++++++++++++++++++++++++++++++++*/
1229 _DtI18nSetSensitiveImTB(
1231 Boolean sensitivity )
1233 static Boolean first_time = True;
1235 XtSetSensitive(i18n.inputMethodRC, sensitivity);
1238 SetImsToggleList(env);
1239 /* Save the initial values in case of a Cancel */
1241 SetFileSelValues(env);
1259 err_str = GETMESSAGE(19, 30,
1260 "The environment variable HOME is not defined.");
1263 err_str = GETMESSAGE(19, 31,
1264 "The environment variable LANG is not defined.");
1266 case ErrNoCDELocale:
1267 err_str = GETMESSAGE(19, 32,
1268 "This locale is not supported by the desktop.");
1273 err_str = GETMESSAGE(19, 33,
1274 "Cannot create the user Input Method Selection file");
1278 case ErrNoSelectionFile:
1279 err_str = GETMESSAGE(19, 34,
1280 "Cannot find the user Input Method Selection file.");
1282 case ErrSaveSelection:
1283 err_str = GETMESSAGE(19, 35,
1284 "Cannot save the user Input Method Selection file.");
1288 case ErrUnknownHost:
1289 err_str = GETMESSAGE(19, 36, "Unknown host");
1291 case ErrNoDtimsstart:
1292 err_str = GETMESSAGE(19, 37,
1293 "dtimsstart was not found.\nPerhaps the desktop environment\nis not properly installed.");
1295 case ErrRemoteFailed:
1296 err_str = GETMESSAGE(19, 38, "Remote execution failed on\n the selected host.");
1300 err_str = GETMESSAGE(19, 39, "Cannot initialize remote execution");
1303 err_str = GETMESSAGE(19, 40, "Getting the Input Method on the \nselected host is taking too long");
1307 err_str = GETMESSAGE(19, 41, "Unknown error");
1311 ErrDialog(err_str, style.i18nDialog);
1314 /*+++++++++++++++++++++++++++++++++++++++*/
1315 /* ListItemSelectCB - callback for the */
1316 /* selection on an item in the preedit */
1318 /*+++++++++++++++++++++++++++++++++++++++*/
1323 XtPointer client_data,
1324 XtPointer call_data )
1326 XmListCallbackStruct *listCBS = (XmListCallbackStruct *) call_data;
1328 /* Set the sensitivity of the MoveUp and MoveDown buttons depending
1329 on the selected item position. MoveUp is insensitive is the first
1330 item in the list is selected; MoveDown is insensitive if the last
1331 item in the list is selected */
1333 if (listCBS->item_position == 1)
1334 XtSetSensitive(i18n.buttonMoveUp, False);
1336 XtSetSensitive(i18n.buttonMoveUp, True);
1338 if (listCBS->item_position == i18n.preeditTypeListLastPos)
1339 XtSetSensitive(i18n.buttonMoveDown, False);
1341 XtSetSensitive(i18n.buttonMoveDown, True);
1346 /*+++++++++++++++++++++++++++++++++++++++*/
1347 /* MoveUpCB - callback for the */
1349 /*+++++++++++++++++++++++++++++++++++++++*/
1354 XtPointer client_data,
1355 XtPointer call_data )
1360 if (XmListGetSelectedPos(i18n.preeditTypeList, &position_list,
1363 /* there should be only one selected per our selection
1364 policy set on the list, but consider the first selected one
1367 /* this should always be the case as the MoveUp button should be
1368 insensitive when the first item is selected, but check anyway */
1370 if (position_list[0] > 1) {
1371 XmStringTable list_items;
1373 int sel_pos = position_list[0];
1374 int sel_index = sel_pos - 1;
1376 XtVaGetValues(i18n.preeditTypeList, XmNitems, &list_items, NULL);
1378 /* makes an array of two XmStrings by reversing the selected
1379 one and the item preceeding it */
1380 items[0] = list_items[sel_index];
1381 items[1] = list_items[sel_index - 1];
1383 /* this call preserves selected state */
1384 XmListReplaceItemsPos(i18n.preeditTypeList,
1389 /* it's now 1, so set the MoveUp button insensitive */
1390 XtSetSensitive(i18n.buttonMoveUp, False);
1393 if (sel_pos == i18n.preeditTypeListLastPos) {
1394 /* it's not anymore the last one, so set the MoveDown
1396 XtSetSensitive(i18n.buttonMoveDown, True);
1399 /* preeditType has changed */
1400 i18n.preeditHasChanged = True;
1405 /*+++++++++++++++++++++++++++++++++++++++*/
1406 /* MoveDownCB - callback for the */
1407 /* MoveDown button */
1408 /*+++++++++++++++++++++++++++++++++++++++*/
1413 XtPointer client_data,
1414 XtPointer call_data )
1419 if (XmListGetSelectedPos(i18n.preeditTypeList, &position_list,
1422 /* there should be only one selected per our selection
1423 policy set on the list, but consider the first selected one
1426 /* this should always be the case as the Move Down button should be
1427 insensitive when the first item is selected, but check anyway */
1429 if (position_list[0] != i18n.preeditTypeListLastPos) {
1430 XmStringTable list_items;
1432 int sel_pos = position_list[0];
1433 int sel_index = sel_pos - 1;
1435 XtVaGetValues(i18n.preeditTypeList, XmNitems, &list_items, NULL);
1437 /* makes an array of two XmStrings by reversing the selected
1438 one and the item succeeding it */
1439 items[0] = list_items[sel_index + 1];
1440 items[1] = list_items[sel_index];
1442 /* this call preserves selected state */
1443 XmListReplaceItemsPos(i18n.preeditTypeList,
1447 if (sel_pos == (i18n.preeditTypeListLastPos - 1)) {
1448 /* it's now the last one, so set the MoveDown button
1450 XtSetSensitive(i18n.buttonMoveDown, False);
1454 /* it's not anymore the first one, so set the MoveUp
1456 XtSetSensitive(i18n.buttonMoveUp, True);
1459 /* preeditType has changed */
1460 i18n.preeditHasChanged = True;
1467 static XmStringTable
1468 CopyST (XmStringTable st, int nst)
1470 XmStringTable lst = (XmStringTable) XtMalloc(sizeof(XmString) * nst);
1473 for (i=0; i < nst ; i++) {
1474 lst[i] = XmStringCopy(st[i]);
1482 FreeST (XmStringTable st, int nst)
1486 for (i=0; i < nst ; i++) {
1487 XmStringFree(st[i]);