static void ui_edit_displayFType(char *name, struct SimpleListType *listDescriptorPtr) { if (krui_setFTypeEntry(name)) { sprintf(ui_edit_ftypeName, "%s", krui_getFTypeName()); sprintf(ui_edit_actFuncName, "%s", krui_getFTypeActFuncName()); sprintf(ui_edit_outFuncName, "%s", krui_getFTypeOutFuncName()); ui_list_buildList(listDescriptorPtr); ui_xSetString(ui_edit_ftypeNameWidget , ui_edit_ftypeName); ui_xSetLabel(ui_edit_actFuncNameWidget, ui_edit_actFuncName); ui_xSetLabel(ui_edit_outFuncNameWidget, ui_edit_outFuncName); XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr, listDescriptorPtr->noOfItems, 0, True); } else { ui_xSetString(ui_edit_ftypeNameWidget , ""); ui_xSetLabel(ui_edit_actFuncNameWidget, ""); ui_xSetLabel(ui_edit_outFuncNameWidget, ""); listDescriptorPtr->noOfItems = 0; ui_xAddListEntry(listDescriptorPtr, "*** no sites ***"); ui_list_noOfSites = 0; XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr, listDescriptorPtr->noOfItems, 0, True); } }
void ui_edit_ftypeDeleteSite (Widget w, struct SimpleListType *listDescriptorPtr, caddr_t call) { XawListReturnStruct *listStructPtr; int i; listStructPtr = XawListShowCurrent(listDescriptorPtr->listWidget); if ((listStructPtr->list_index == XAW_LIST_NONE) OR (ui_list_noOfFTypeSites <= 0)) return; /* no site selected */ /* remove this entry from the array */ free((listDescriptorPtr->listPtr)[listStructPtr->list_index]); for (i = listStructPtr->list_index + 1; i <= listDescriptorPtr->noOfItems - 1; i++) (listDescriptorPtr->listPtr)[i-1] = (listDescriptorPtr->listPtr)[i]; if (ui_list_noOfFTypeSites-- == 1) { /* last site deleted */ (listDescriptorPtr->listPtr)[0] = XtNewString("*** no sites"); XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr, 1, 0, True); } else XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr, --listDescriptorPtr->noOfItems, 0, True); }
static void switch_dlg_pol_alter (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; char **list; uint32_t sz; int np; SwitchPos *sp; SwitchBand *sb; XawListReturnStruct *cur = NULL; if (0 != pgm->pols_loaded) { pgm->pol_idx = XAW_LIST_NONE; cur = XawListShowCurrent (pgm->switch_dlg_pol_list); i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (pgm->switch_dlg_pol_list, arglist, i); XawListChange (pgm->switch_dlg_pol_list, NULL, 0, 0, True); XtSetSensitive (pgm->switch_dlg_pol_list, False); mnuStrFree (list, sz); pgm->pols_loaded = 0; } if (pgm->band_idx != XAW_LIST_NONE) { sp = pgm->sp + pgm->pos_idx; sb = sp->bands + pgm->band_idx; np = sb->num_pol; if (0 == np) return; list = calloc (sizeof (char *), np); for (i = 0; i < np; i++) { list[i] = calloc (5, sizeof (char)); sprintf (list[i], "%s", tpiGetPolStr (sb->pol[i].pol)); } XawListChange (pgm->switch_dlg_pol_list, list, np, 0, True); if (np) XtSetSensitive (pgm->switch_dlg_pol_list, True); pgm->pols_loaded = 1; pgm->pol_idx = XAW_LIST_NONE; if ((NULL != cur) && (cur->list_index != XAW_LIST_NONE)) { pgm->pol_idx = cur->list_index; XawListHighlight (pgm->switch_dlg_pol_list, cur->list_index); free (cur); } } }
/**************************************************************** ... *****************************************************************/ void city_dialog_update_improvement_list(struct city_dialog *pdialog) { int i, n, flag; for(i=0, n=0, flag=0; i<B_LAST; ++i) if(pdialog->pcity->improvements[i]) { if(!pdialog->improvlist_names_ptrs[n] || strcmp(pdialog->improvlist_names_ptrs[n], get_improvement_name(i))) flag=1; strcpy(pdialog->improvlist_names[n], get_improvement_name(i)); pdialog->improvlist_names_ptrs[n]=pdialog->improvlist_names[n]; n++; } if(pdialog->improvlist_names_ptrs[n]!=0) { pdialog->improvlist_names_ptrs[n]=0; flag=1; } if(flag || n==0) { XawListChange(pdialog->improvement_list, pdialog->improvlist_names_ptrs, n, 0, False); /* force refresh of viewport so the scrollbar is added. * Buggy sun athena requires this */ XtVaSetValues(pdialog->improvement_viewport, XtNforceBars, False, NULL); XtVaSetValues(pdialog->improvement_viewport, XtNforceBars, True, NULL); } }
static void switch_dlg_purge_cmds (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; int sz; char **list; if (0 != pgm->cmds_loaded) { pgm->cmd_idx = XAW_LIST_NONE; i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (pgm->switch_dlg_cmd_list, arglist, i); XawListChange (pgm->switch_dlg_cmd_list, NULL, 0, 0, True); XtSetSensitive (pgm->switch_dlg_cmd_list, False); XtSetSensitive (pgm->switch_dlg_pol_sel, False); free (list); //the strings are constant, we don't own them pgm->cmds_loaded = 0; switch_dlg_purge_dtl (pgm); } }
static void switch_dlg_purge_dtl (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; int sz; char **list; if (0 != pgm->dtls_loaded) { pgm->dtl_idx = XAW_LIST_NONE; i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (pgm->switch_dlg_cmd_detail, arglist, i); XawListChange (pgm->switch_dlg_cmd_detail, NULL, 0, 0, True); XtSetSensitive (pgm->switch_dlg_cmd_detail, False); XtSetSensitive (pgm->switch_dlg_cmd_type, False); mnuStrFree (list, sz); switch_dlg_purge_byte (pgm); pgm->dtls_loaded = 0; } }
void LoadListBox (Option *opt, char *emptyText, int n1, int n2) { static char *dummyList[2]; dummyList[0] = emptyText; // empty listboxes tend to crash X, so display user-supplied warning string instead XawListChange(opt->handle, *(char*)opt->target ? opt->target : dummyList, 0, 0, True); }
void ui_edit_setSite(Widget w, struct SimpleListType *listDescriptorPtr, caddr_t call) { XawListReturnStruct *listStructPtr; listStructPtr = XawListShowCurrent(listDescriptorPtr->listWidget); if (listStructPtr->list_index == XAW_LIST_NONE) { ui_confirmOk("No site in the site list selected!"); return; } ui_xStringFromAsciiWidget(ui_edit_siteNameWidget, ui_edit_siteName, MAX_NAME_LENGTH); ui_correctName(ui_edit_siteName); ui_checkError(krui_changeSiteTableEntry(listStructPtr->string, ui_edit_siteName, ui_edit_siteFuncName)); if (ui_kernelError < 0) ui_confirmOk("Name or function invalid!"); else { free((listDescriptorPtr->listPtr)[listStructPtr->list_index]); (listDescriptorPtr->listPtr)[listStructPtr->list_index] = XtNewString(ui_edit_siteName); XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr, listDescriptorPtr->noOfItems, 0, True); } }
void ui_edit_newSite (Widget w, struct SimpleListType *listDescriptorPtr, caddr_t call) { ui_xStringFromAsciiWidget(ui_edit_siteNameWidget, ui_edit_siteName, MAX_NAME_LENGTH); ui_correctName(ui_edit_siteName); if ((strlen(ui_edit_siteName) == 0) OR (strlen(ui_edit_siteFuncName) == 0)) { ui_confirmOk("Invalid name or function!"); return; } ui_checkError(krui_createSiteTableEntry(ui_edit_siteName, ui_edit_siteFuncName)); if (ui_kernelError >= 0) { if (ui_list_noOfSites++ == 0) { /* first entry is "*** no sites ***" */ free((listDescriptorPtr->listPtr)[0]); (listDescriptorPtr->listPtr)[0] = XtNewString(ui_edit_siteName); } else ui_xAddListEntry(listDescriptorPtr, ui_edit_siteName); XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr, listDescriptorPtr->noOfItems, 0, True); } }
static void Layer_Remove(int victim) { LayerPtr layer = (LayerPtr)Hash_Delete(layer_hash, victim); int index; Widget temp; int i; for ( index = 0 ; layer_list_map[index] != victim ; index++ ); free(layer->instances); free(layer->name); free(layer); temp = layer_toggles[index]; XtUnmanageChild(temp); for ( i = index + 1; i < num_layers ; i++ ) { layer_name_list[i-1] = layer_name_list[i]; layer_list_map[i-1] = layer_list_map[i]; layer_toggles[i-1] = layer_toggles[i]; } num_layers--; layer_toggles[num_layers] = temp; XawListChange(layer_list_widget, layer_name_list, num_layers, 0, TRUE); }
static void fav_list_dlg_load_favlist (PgmState * a) { char **list; int i; Iterator l; int num_strings; // message(a,"Select the list to use, please.\nPress Return to select entry. Use Escape or Backspace to cancel the action.\n"); if (NULL == a->favourite_lists) { errMsg ("Sorry, no FavLists here. Create some, please.\n"); return; } if (iterBTreeInit (&l, a->favourite_lists)) { errMsg ("error initializing iterator.\n"); return; } num_strings = iterGetSize (&l); list = calloc (sizeof (char *), num_strings); for (i = 0; i < num_strings; i++) { FavList *fl; iterSetIdx (&l, i); fl = iterGet (&l); list[i] = strdup (fl->name); } iterClear (&l); XawListChange (a->flist_list, list, num_strings, 0, True); if (num_strings) XtSetSensitive (a->flist_list, True); a->flist_loaded = 1; }
void fav_list_dlg_load_fav (PgmState * pgm) { char **list; // int num_strings; if (NULL == pgm->current_fav_list) { return; } if (pgm->current_fav_list->size == 0) { return; } list = mnuStrFav (pgm->current_fav_list->favourites, pgm->current_fav_list->size); XawListChange (pgm->fav_list, list, pgm->current_fav_list->size, 0, True); if (pgm->current_fav_list->size) XtSetSensitive (pgm->fav_list, True); pgm->fav_loaded = 1; }
static void switch_dlg_purge_bands (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; int sz; char **list; if (0 != pgm->bands_loaded) { pgm->band_idx = XAW_LIST_NONE; i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (pgm->switch_dlg_band_list, arglist, i); XawListChange (pgm->switch_dlg_band_list, NULL, 0, 0, True); XtSetSensitive (pgm->switch_dlg_band_list, False); mnuStrFree (list, sz); i = 0; XtSetArg (arglist[i], XtNstring, NULL); i++; XtSetArg (arglist[i], XtNsensitive, False); i++; XtSetValues (pgm->itf_txt, arglist, i); pgm->bands_loaded = 0; switch_dlg_purge_pols (pgm); } }
void NewList(Widget listwidget, String *list) { /* install the new list */ XawListChange(listwidget, list, 0, 0, True); /* install the wheel scrolling for the scrollbar */ InstallScroll(listwidget); }
static void switch_dlg_load_pols (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; char buf[20]; char **list; int np; SwitchPos *sp; SwitchBand *sb; if (pgm->pols_loaded) return; if (pgm->band_idx == XAW_LIST_NONE) return; sp = pgm->sp + pgm->pos_idx; sb = sp->bands + pgm->band_idx; np = sb->num_pol; sprintf (buf, "%u", sb->lof); i = 0; XtSetArg (arglist[i], XtNstring, buf); i++; XtSetArg (arglist[i], XtNsensitive, True); i++; XtSetValues (pgm->switch_dlg_lof, arglist, i); sprintf (buf, "%u", sb->f_max); i = 0; XtSetArg (arglist[i], XtNstring, buf); i++; XtSetArg (arglist[i], XtNsensitive, True); i++; XtSetValues (pgm->switch_dlg_uf, arglist, i); sprintf (buf, "%u", sb->f_min); i = 0; XtSetArg (arglist[i], XtNstring, buf); i++; XtSetArg (arglist[i], XtNsensitive, True); i++; XtSetValues (pgm->switch_dlg_lf, arglist, i); if (0 == np) return; list = calloc (sizeof (char *), np); for (i = 0; i < np; i++) { list[i] = calloc (5, sizeof (char)); sprintf (list[i], "%s", tpiGetPolStr (sb->pol[i].pol)); } XawListChange (pgm->switch_dlg_pol_list, list, np, 0, True); if (np) XtSetSensitive (pgm->switch_dlg_pol_list, True); pgm->pols_loaded = 1; pgm->pol_idx = XAW_LIST_NONE; }
/************************************************************************** Fills in the preset list. **************************************************************************/ static void update_cma_preset_list(void) { static char *preset_lines[256]; static char preset_text[256][256]; int i; if (cmafec_preset_num()) { /* Add all CMA presets to the list. */ for (i = 0; i < cmafec_preset_num(); i++) { fc_strlcpy(preset_text[i], cmafec_preset_get_descr(i), sizeof(preset_text[i])); preset_lines[i] = preset_text[i]; } XawListChange(preset_list, preset_lines, cmafec_preset_num(), 0, True); } else { /* Show intro message in the preset list. */ XawListChange(preset_list, initial_preset_list, 8, 0, True); } }
void schedChanged (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; int sz; char **list; int num_strings; char **mnu_str; int idx; // XawListReturnStruct *lr; // lr=XawListShowCurrent(pgm->sched_list); i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (pgm->sched_list, arglist, i); XawListChange (pgm->sched_list, NULL, 0, 0, True); XtSetSensitive (pgm->sched_list, False); mnuStrFree (list, sz); mnu_str = mnuStrRse (pgm->r_sch, pgm->r_sch_sz); if (mnu_str == NULL) return; num_strings = pgm->r_sch_sz; XawListChange (pgm->sched_list, mnu_str, num_strings, 0, True); XtSetSensitive (pgm->sched_list, True); if (pgm->sched_idx == XAW_LIST_NONE) idx = XAW_LIST_NONE; else idx = (pgm->sched_idx < pgm->r_sch_sz) ? pgm->sched_idx : pgm->r_sch_sz - 1; XawListHighlight (pgm->sched_list, idx); // free(lr); }
/******************************************************************************* Name: FileToDialog Description: copies selected list string to dialog's asciitext window Arguments: w - list widget client_data - dialog widget call_data - list string selected Returns: None Contrubuting Programmers: Albert Leigh - MacDonnell Douglas Stan Smith - Barrios some guy upstairs *******************************************************************************/ static void FileToDialog( Widget w, XtPointer client_data, XtPointer call_data) { XawListReturnStruct *item = (XawListReturnStruct *)call_data; char *ptr; int i,rtn; if (!strcmp(item->string, "../")) { path[strlen(path) - 1] = '\0'; ptr = strrchr(path, '/'); ptr++; *(ptr) = '\0'; /* for(i = 0; i < number_entries; i++) free(filenames[i]); */ if (filenames != NULL) { free(filenames[0]); free(filenames); } XawListChange(w, GetDirectory(), 0, 0, True); } else if (strrchr(item->string, '/')) { strcat(path, item->string); XawListChange(w, GetDirectory(), 0, 0, True); } else { XtSetArg(args[0], XtNvalue, item->string); XtSetValues((Widget)client_data, args, 1); } }
static void AddSessionNames(int count, String *names) { int i; XawListChange (chooseSessionListWidget, names, count, 0, True); /* * Highlight the first unlocked session, if any. */ for (i = 0; i < sessionNameCount; i++) if (!sessionsLocked[i]) break; SessionSelected (i < sessionNameCount ? i : -1, True); }
static void combo_list_popup(Widget w, XtPointer client_data, XtPointer call_data) { MwComboWidget cw = (MwComboWidget)XtParent(w); int x, y, xe, ye; Window child; Dimension height, width; if (cw->combo.shell == None) { } combo_status = WAITING; XtVaGetValues(XtParent(w), XtNheight, &height, XtNwidth, &width, (char *)0); XTranslateCoordinates(XtDisplay(w), XtWindow(XtParent(w)), DefaultRootWindow(XtDisplay(w)), 0, height, &x, &y, &child); XtVaSetValues(cw->combo.shell, XtNx, x, XtNy, y, XtNwidth, width, XtNheight, 200, XtNborderWidth, 1, (char *)0); XawListChange(cw->combo.list, cw->combo.data, cw->combo.ndata, 0, True); XtPopup(cw->combo.shell, XtGrabNonexclusive); while (combo_status == WAITING) { XEvent event; XtAppNextEvent(XtWidgetToApplicationContext(w), &event); if (event.type == ButtonPress) { xe = event.xbutton.x_root; ye = event.xbutton.y_root; if (xe <= x || xe >= (x+width) || ye <= y || ye >= (y+200)) combo_status = ABORT; } else if (event.type == KeyPress) { combo_status = ABORT; } XtDispatchEvent(&event); } XtPopdown(cw->combo.shell); }
static void switch_dlg_load_pos (PgmState * pgm) { char **list; int i; if ((NULL == pgm->sp) || (0 == pgm->num_pos) || (1 == pgm->pos_loaded)) return; list = calloc (sizeof (char *), pgm->num_pos); for (i = 0; i < pgm->num_pos; i++) { list[i] = calloc (30, sizeof (char)); sprintf (list[i], "Pos: %u", i); } XawListChange (pgm->switch_dlg_pos_list, list, pgm->num_pos, 0, True); if (pgm->num_pos) XtSetSensitive (pgm->switch_dlg_pos_list, True); pgm->pos_loaded = 1; }
static void switch_dlg_load_dtl (PgmState * pgm) { char **list; int i, nd; SwitchPos *sp; SwitchBand *sb; SwitchPol *sl; SwitchCmd *sc; if (pgm->dtls_loaded) return; if (pgm->cmd_idx == XAW_LIST_NONE) return; sp = pgm->sp + pgm->pos_idx; sb = sp->bands + pgm->band_idx; sl = sb->pol + pgm->pol_idx; sc = sl->cmds + pgm->cmd_idx; nd = sc->len; XtSetSensitive (pgm->switch_dlg_cmd_type, True); XawListHighlight (pgm->switch_dlg_cmd_type, sc->what); if (0 == nd) return; if (nd > 8) nd = 8; list = calloc (sizeof (char *), nd); for (i = 0; i < nd; i++) { list[i] = calloc (sizeof (char), 5); sprintf (list[i], "0x%2.2x", sc->data[i]); } XawListChange (pgm->switch_dlg_cmd_detail, list, nd, 0, True); if (nd) XtSetSensitive (pgm->switch_dlg_cmd_detail, True); pgm->dtls_loaded = 1; pgm->dtl_idx = XAW_LIST_NONE; }
/************************************************************************** ... **************************************************************************/ void update_find_dialog(Widget find_list) { int i, j; for(i=0, ncities_total=0; i<game.nplayers; i++) ncities_total+=city_list_size(&game.players[i].cities); city_name_ptrs=(char **)malloc(ncities_total*sizeof(char*)); for(i=0, j=0; i<game.nplayers; i++) { struct genlist_iterator myiter; genlist_iterator_init(&myiter, &game.players[i].cities.list, 0); for(; ITERATOR_PTR(myiter); ITERATOR_NEXT(myiter)) { struct city *pcity=(struct city *)ITERATOR_PTR(myiter); *(city_name_ptrs+j++)=mystrdup(pcity->name); } } if(ncities_total) XawListChange(find_list, city_name_ptrs, ncities_total, 0, True); }
/************************************************************************** ... **************************************************************************/ void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog) { int i; struct genlist_iterator myiter; genlist_iterator_init(&myiter, &pdialog->treaty.clauses, 0); for(i=0; i<MAX_NO_CLAUSES && ITERATOR_PTR(myiter); ITERATOR_NEXT(myiter)) { struct Clause *pclause=(struct Clause *)ITERATOR_PTR(myiter); switch(pclause->type) { case CLAUSE_ADVANCE: sprintf(pdialog->clauselist_strings[i], "The %s give %s", get_race_name_plural(pclause->from->race), advances[pclause->value].name); break; case CLAUSE_GOLD: sprintf(pdialog->clauselist_strings[i], "The %s give %d gold", get_race_name_plural(pclause->from->race), pclause->value); break; case CLAUSE_MAP: sprintf(pdialog->clauselist_strings[i], "The %s give their worldmap", get_race_name_plural(pclause->from->race)); break; } pdialog->clauselist_strings_ptrs[i]=pdialog->clauselist_strings[i]; i++; } pdialog->clauselist_strings_ptrs[i]=0; XawListChange(pdialog->dip_clauselist, pdialog->clauselist_strings_ptrs, 0, 0, False); xaw_set_bitmap(pdialog->dip_acceptthumb0, get_thumb_pixmap(pdialog->treaty.accept0)); xaw_set_bitmap(pdialog->dip_acceptthumb1, get_thumb_pixmap(pdialog->treaty.accept1)); }
/**************************************************************************** This function updates the list of servers after the server dialog has been displayed. LAN servers updated every 250 ms for 5 seconds, metaserver updated every 500 ms for 2 seconds. ****************************************************************************/ static void server_list_timer(XtPointer meta_list, XtIntervalId * id) { char errbuf[128]; if (!connectdlg_serverlist_shell) { return; } if (get_server_list(servers_list, errbuf, sizeof(errbuf)) != -1) { XawListChange(meta_list, servers_list, 0, 0, True); } /* else if (!lan_mode) { output_window_append(ftc_client, errbuf); } */ num_lanservers_timer++; if (lan_mode) { if (num_lanservers_timer == 20) { server_scan_finish(lan_scan); lan_scan = NULL; num_lanservers_timer = 0; return; } (void)XtAppAddTimeOut(app_context, 250, server_list_timer, (XtPointer)meta_list); } else { if (num_lanservers_timer == 4) { server_scan_finish(meta_scan); meta_scan = NULL; num_lanservers_timer = 0; return; } (void)XtAppAddTimeOut(app_context, 500, server_list_timer, (XtPointer)meta_list); } }
static void switch_dlg_load_bands (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; char **list; int nb; SwitchPos *sp; if (pgm->bands_loaded) return; if (pgm->pos_idx == XAW_LIST_NONE) return; sp = pgm->sp + pgm->pos_idx; nb = sp->num_bands; i = 0; XtSetArg (arglist[i], XtNstring, sp->initial_tuning_file); i++; XtSetArg (arglist[i], XtNsensitive, True); i++; XtSetValues (pgm->itf_txt, arglist, i); if (0 == nb) return; list = calloc (sizeof (char *), nb); for (i = 0; i < nb; i++) { list[i] = calloc (30, sizeof (char)); sprintf (list[i], "%u", sp->bands[i].lof); } XawListChange (pgm->switch_dlg_band_list, list, nb, 0, True); if (nb) XtSetSensitive (pgm->switch_dlg_band_list, True); pgm->bands_loaded = 1; pgm->band_idx = XAW_LIST_NONE; }
static void fav_list_dlg_purge_fav (PgmState * pgm) { Arg arglist[20]; Cardinal i = 0; int sz; char **list; if (pgm->fav_loaded) { pgm->fav_loaded = 0; pgm->fav_idx = XAW_LIST_NONE; i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (pgm->fav_list, arglist, i); XawListChange (pgm->fav_list, NULL, 0, 0, True); XtSetSensitive (pgm->fav_list, False); mnuStrFree (list, sz); } }
void schedLoad (PgmState * a) { int num_strings; char **mnu_str; if (clientGetSched (a->sock, &a->pr_sch, &a->pr_sch_sz)) return; if (!(a->r_sch = rsCloneSched (a->pr_sch, a->pr_sch_sz))) return; a->r_sch_sz = a->pr_sch_sz; mnu_str = mnuStrRse (a->r_sch, a->r_sch_sz); if (mnu_str == NULL) return; num_strings = a->r_sch_sz; XawListChange (a->sched_list, mnu_str, num_strings, 0, True); XtSetSensitive (a->sched_list, True); a->sched_idx = XAW_LIST_NONE; a->sched_loaded = 1; }
static void switch_dlg_load_cmds (PgmState * pgm) { char **list; int i, nc; SwitchPos *sp; SwitchBand *sb; SwitchPol *sl; if (pgm->cmds_loaded) return; if (pgm->pol_idx == XAW_LIST_NONE) return; sp = pgm->sp + pgm->pos_idx; sb = sp->bands + pgm->band_idx; sl = sb->pol + pgm->pol_idx; nc = sl->num_cmds; XtSetSensitive (pgm->switch_dlg_pol_sel, True); XawListHighlight (pgm->switch_dlg_pol_sel, sl->pol); if (0 == nc) return; list = calloc (sizeof (char *), nc); for (i = 0; i < nc; i++) { list[i] = (char *) spGetCmdStr (sl->cmds[i].what); } XawListChange (pgm->switch_dlg_cmd_list, list, nc, 0, True); if (nc) XtSetSensitive (pgm->switch_dlg_cmd_list, True); pgm->cmds_loaded = 1; pgm->cmd_idx = XAW_LIST_NONE; }
static void sched_purge (PgmState * a) { Arg arglist[20]; Cardinal i = 0; int sz; char **list; if (a->sched_loaded) { rsDestroy (a->r_sch, a->r_sch_sz); rsDestroy (a->pr_sch, a->pr_sch_sz); a->sched_loaded = 0; i = 0; XtSetArg (arglist[i], XtNlist, &list); i++; XtSetArg (arglist[i], XtNnumberStrings, &sz); i++; XtGetValues (a->sched_list, arglist, i); XawListChange (a->sched_list, NULL, 0, 0, True); XtSetSensitive (a->sched_list, False); mnuStrFree (list, sz); } }