/*********************************************************************** * * * Copy selected items from the left list to the right list. * * * ***********************************************************************/ static void copy_cb(Widget w, XtPointer cd, XmAnyCallbackStruct *cbs) { int icnt, pos, pcnt, *posl; XmString *items; if (XmListGetSelectedPos(var2NtSList, &posl, &pcnt)) { pos = posl[pcnt-1] + 1; XtFree((char *)posl); } else pos = 0; XmListDeselectAllItems(var2NtSList); if (w == exprNtSText) { char *expr = XmTextGetString(w); if (!strempty(expr)) { XmString xms = XmStringCreateSimple(expr); XmListAddItem(var2NtSList, xms, pos); XmStringFree(xms); } XtFree(expr); /* * ugly... I don't want to show the scanner after hitting the * KActivate in the text widget */ no_scan = True; } else if (w == copyNtSButton) { XtVaGetValues(var1NtSList, XmNselectedItemCount, &icnt, XmNselectedItems, &items, NULL); XmListAddItems(var2NtSList, items, icnt, pos); } else if (w == copyAllNtSButton) { XtVaGetValues(var1NtSList, XmNitemCount, &icnt, XmNitems, &items, NULL); clear_selector_columns(2); XmListAddItems(var2NtSList, items, icnt, pos); } else if (w == var1NtSList) { XmListCallbackStruct *cbsl = (XmListCallbackStruct *) cbs; if (cbsl->event->type == ButtonRelease) XmListAddItem(var2NtSList, cbsl->item, pos); } XmListSelectPos(var2NtSList, pos, False); }
int main(int argc, char **argv) { Widget toplevel, widget, bb, list; XtAppContext app; XmString item; Arg args[10]; int n = 0; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "ComBox", NULL, 0, &argc, argv, NULL, NULL); bb = XmCreateForm(toplevel, "bb", NULL, 0); XtManageChild(bb); widget = XmCreateDropDownComboBox(bb, "combo", args, n); XtVaSetValues(widget, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); /* use list routine to add items */ list = CB_List(widget); item = XmStringCreateSimple("Item 1"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 2"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 3"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 4"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 5"); XmListAddItem(list,item,0); XmComboBoxUpdate(widget); XtManageChild(widget); XtRealizeWidget(toplevel); #if 0 XdbPrintResources(CB_ListShell(widget)); XdbPrintResources(widget); #endif check_geometry(widget); LessTifTestMainLoop(toplevel); exit(0); }
void pp_display_filter_acct_cb(Widget w, XtPointer *call_data, XmAnyCallbackStruct *client_data) { int i; XmString temp; if (pp_main_poplist_shell == NULL) { create_pp_main_poplist_shell(product_packages_shell); } XmListDeleteAllItems (pp_main_poplist); XmListDeselectAllItems (pp_main_poplist); for (i = 0; i < num_pp_ext_ids_list; i++) { temp = XmStringCreateSimple (pp_ext_ids_list[i].description); XmListAddItem (pp_main_poplist, temp, 0); XmStringFree (temp); } /* Set the text field that will be populated when user selects * a value from the list. */ XtVaSetValues (pp_main_poplist, XmNuserData, pp_filter_account_no_txt, NULL); position_poplist (w,pp_main_poplist_shell); XtManageChild (pp_main_poplist_form); XtPopup (pp_main_poplist_shell, XtGrabNone); }
/* * Callback for the add name button. This simply calls the blist_name_append * function and adds the name to the UI. */ static void blist_addname(Widget widget, XtPointer client_data, XtPointer cbs) { char *new_name, *end_ptr, buf[MAXNAMELEN]; XEvent *e = ((XmAnyCallbackStruct *)cbs)->event; XmString xmstr; Calendar *c = (Calendar *)client_data; Browselist *bl = (Browselist *)c->browselist; int insert_location; XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_NONE, NULL); bl_clear_pending_change(bl); bl_list_is_changed(bl); set_message(bl->message, " "); new_name = XmTextFieldGetString(bl->username); /* crush out leading white space for the name comparison/insert process */ while ((*new_name == ' ') || (*new_name == '\t')) new_name++; /* compress off trailing whitespace */ end_ptr = new_name; while (*end_ptr) end_ptr++; while ((end_ptr > new_name) && ((*(end_ptr - 1) == ' ') || (*(end_ptr - 1) == '\t'))) end_ptr--; *end_ptr = NULL; if (blank_buf(new_name)) { set_message(bl->message, catgets(c->DT_catd, 1, 603, "Type a name to add in the User Name field")); return; } if (embedded_blank(new_name)) { set_message(bl->message, catgets(c->DT_catd, 1, 684, "User Names may not have embedded blanks or tabs")); return; } if ((insert_location = blist_name_append(c, new_name, BLIST_INSERT)) != -1) { xmstr = XmStringCreateLocalized(new_name); XmListAddItem(bl->browse_list, xmstr, insert_location); XmStringFree(xmstr); cm_select_text(bl->username, e->xbutton.time); } else { sprintf(buf, "%s %s", new_name, catgets(c->DT_catd, 1, 604, "is already in the list")); set_message(bl->message, buf); } XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_ANY, NULL); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeComboBoxAddItem(Widget w,XmString item,int position) { XfeComboBoxPart * cp = _XfeComboBoxPart(w); /* XmListPart * lp = _XfeXmListPart(w); */ assert( _XfeIsAlive(w) ); assert( XfeIsComboBox(w) ); XmListAddItem(cp->list,item,position); #if 0 DtComboBoxWidget combo = (DtComboBoxWidget)combo_w; DtComboBoxPart *combo_p = (DtComboBoxPart*)&(combo->combo_box); XmStringTable list_items = ((XmListWidget)combo_p->list)->list.items; int i; if (item && ((XmListWidget)combo_p->list)->list.itemCount) { for (i = 0; i < combo_p->item_count; i++) if (XmStringCompare(item, list_items[i])) break; if ((i < combo_p->item_count) && unique) return; } XmListAddItem(combo_p->list, item, pos); SyncWithList(combo_p); if (combo_p->label) { SetMaximumLabelSize(combo_p); if (combo_p->type == XmDROP_DOWN_LIST_BOX) { ClearShadow(combo, TRUE); if (combo_p->recompute_size) SetComboBoxSize(combo); LayoutChildren(combo); DrawShadow(combo); } } if (combo_p->type == XmDROP_DOWN_COMBO_BOX) SetTextFieldData(combo_p, NULL); else SetLabelData(combo_p, NULL, FALSE); #endif }
void UIaddlist(char *line) { XmString item = XmStringCreateSimple(line); XmListAddItem(AnimList, item, 0); /* add item to the end of the list */ XmStringFree(item); }
void __vi_push_tag(String text) { XmString str; if ( ! active ) return; str = XmStringCreateSimple( text ); XmListAddItem( db_list, str, 1 ); XmStringFree( str ); }
static void motListAddItem(Ihandle* ih, int pos, const char* value) { XmString str = iupmotStringCreate(value); /* The utility functions use 0=last 1=first */ if (ih->data->is_dropdown || ih->data->has_editbox) XmComboBoxAddItem(ih->handle, str, pos+1, False); else XmListAddItem(ih->handle, str, pos+1); XmStringFree(str); }
int main(int argc, char **argv) { Widget toplevel, widget, bb, list; XtAppContext app; XmString item; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "ComBox", NULL, 0, &argc, argv, NULL, NULL); bb = XmCreateBulletinBoard(toplevel, "bb", NULL, 0); XtManageChild(bb); widget = XmCreateComboBox(bb, "widget", NULL, 0); /* use list routine to add items */ list = CB_List(widget); item = XmStringCreateSimple("Item 1"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 2"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 3"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 4"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 5"); XmListAddItem(list,item,0); XmComboBoxUpdate(widget); XtManageChild(widget); XtRealizeWidget(toplevel); check_geometry(widget); LessTifTestMainLoop(toplevel); exit(0); }
static void Load(Widget w) { char *l8590_memname; static char nodename[13]; static NCI_ITM itmlst[] = {{12,NciNODE_NAME,nodename,0},{0,0,0,0}}; int i; XtPointer temp; int nid; int found = False; XtVaGetValues(w, XmNuserData, &temp, NULL); nid = (intptr_t)temp; l8590_memname = TreeGetPath(nid); XmListDeleteAllItems(w); for (i=1;i<17;i++) { int ctx = 0; int dig_nid; int status; XmString item; char digname[512]; sprintf(digname,"%s:L8590_%d",l8590_memname,i); status = TreeFindNode(digname,&dig_nid); if (status & 1) { TreeGetNci(dig_nid,itmlst); item = XmStringCreateSimple(nodename); XmListAddItem(w, item, 0); XmStringFree(item); found = True; } else break; } TreeFree(l8590_memname); if (!found) { XmString item = XmStringCreateSimple("Add L8590_1"); XmListAddItem(w, item, 0); XmStringFree(item); } }
void RGISGrpPanel::Add (DBObjTableField *group) { XmString string; string = XmStringCreate (group->Name (),UICharSetNormal); XmListAddItem (GroupListWGT,string,group->RowID () + 1); XmListSelectItem (GroupListWGT,string,True); XmStringFree (string); XtSetSensitive (DeleteButtonWGT,True); XtSetSensitive (LoadButtonWGT,True); XtSetSensitive (SaveButtonWGT,True); }
void wxListBox::SetString(unsigned int n, const wxString& s) { wxSizeKeeper sk( this ); Widget listBox = (Widget) m_mainWidget; wxXmString text( s ); // delete the item and add it again. // FIXME isn't there a way to change it in place? XmListDeletePos (listBox, n+1); XmListAddItem (listBox, text(), n+1); sk.Restore(); }
void set_scroller_list(Screen_Obj *sop, const char *string_list[], int nlist) { #ifdef HAVE_MOTIF int j; XmString item; /* first delete any old items */ XmListDeselectAllItems(sop->so_obj); XmListDeleteAllItems(sop->so_obj); for(j=0; j<nlist; j++) { item = XmStringCreateSimple((char *)string_list[j]); XmListAddItem(sop->so_obj, item, 0); XmStringFree(item); } XtManageChild(sop->so_obj); #endif /* HAVE_MOTIF */ }
static void Reset(Widget w) { int status; Widget list_w = XtNameToWidget(XtParent(w),"*interpreters"); static struct descriptor_d cli = {0, DTYPE_T, CLASS_D, 0}; static DESCRIPTOR(initial, "_I=0"); static DESCRIPTOR(clis, "(clis()[_I++]//\"\\0\")"); XtPointer user_data; int nid; String selections; String selection; int ctx = 0; int first = 1; XtVaGetValues(list_w, XmNuserData, &user_data, NULL); nid = (intptr_t)user_data; XmListDeselectAllItems(list_w); XmListDeleteAllItems(list_w); TdiExecute(&initial,&cli MDS_END_ARG); while ((status=TdiExecute(&clis, &cli MDS_END_ARG)&1 && cli.length > 0 && strlen(cli.pointer) > 0)) { XmString item; item = XmStringCreateSimple(cli.pointer); if (!XmListItemExists(list_w,item)) XmListAddItem(list_w,item,0); XmStringFree(item); } selections = XmdsGetNidText(nid); for (selection=strtok(selections,"\n");selection;selection=strtok(0,"\n")) { XmString item = XmStringCreateSimple(selection); XmListSelectItem(list_w, item, 0); if (first) { first = 0; XmListSetItem(list_w, item); } XmStringFree(item); } XtFree(selections); return; }
extern void blist_init_ui(Calendar *c) { int i; XmString xmstr; BlistData *bd; Browselist *bl = (Browselist *)c->browselist; XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_NONE, NULL); XmListDeleteAllItems(bl->browse_list); for (i = 1; i <= bl->blist_data->count; i++) { bd = (BlistData *)CmDataListGetData(bl->blist_data, i); if (bd && bd->name && bd->tag != BLIST_DELETE) { xmstr = XmStringCreateLocalized(bd->name); if (!XmListItemExists(bl->browse_list, xmstr)) XmListAddItem(bl->browse_list, xmstr, 0); XmStringFree(xmstr); } } XmTextFieldSetString(bl->username, ""); XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_ANY, NULL); }
// Enter LINE in history void add_to_history(const string& line) { if (!gdb->isReadyWithPrompt()) return; set_history_from_line(line); if (gdb_history.size() < 2 || line != gdb_history[gdb_history.size() - 2]) { gdb_history += ""; if (gdb_history_w) { MString xm_line(line, LIST_CHARSET); int pos = gdb_history.size(); XmListAddItem(gdb_commands_w, xm_line.xmstring(), pos - 1); XmListSelectPos(gdb_commands_w, 0, False); XmListSetBottomPos(gdb_commands_w, 0); } } gdb_current_history = gdb_history.size(); set_history_from_line(""); if (gdb_history_w) { XmListSelectPos(gdb_commands_w, 0, False); XmListSetBottomPos(gdb_commands_w, 0); } gdb_new_history = false; add_to_arguments(line); update_arguments(); update_combo_boxes(line); #if WITH_READLINE add_history(line.chars()); #endif }
Widget RGISGrdPanel::Load (DBObjData *data) { int itemPosition = 0; DBObjTable *layerTable = data->Table (DBrNLayers); DBObjRecord *record; XmString string; XmListDeleteAllItems (LayerListWGT); for (record = layerTable->First ();record != (DBObjRecord *) NULL;record = layerTable->Next ()) { string = XmStringCreate (record->Name (),UICharSetNormal); XmListAddItem (LayerListWGT, string, ++itemPosition); XmStringFree (string); } XmListDeselectAllItems (LayerListWGT); record = layerTable->Item (); string = XmStringCreate (record->Name (),UICharSetNormal); XmListSelectItem (LayerListWGT,string,False); XmStringFree (string); XtVaSetValues (LayerListWGT,XmNuserData, data, NULL); return (Form ()); }
void populate_emf_external_id_scrolled_list() { XmString temp; RETCODE ret_code; char display_string[300]; int status; int lm; char active_dt[9]; char inactive_dt[9]; char external_id_type[81]; char external_id[50]; char full_active_dt[33]; char full_inactive_dt[33]; int id_type; /*get emf group list from db */ dbcmd(dbproc1, "select external_id,external_id_type,active_date,inactive_date,"); dbfcmd(dbproc1," convert(char(8),active_date,%d),", gdatefmt); dbfcmd(dbproc1," convert(char(8),inactive_date,%d)", gdatefmt); dbcmd(dbproc1," from CUSTOMER_ID_EQUIP_MAP "); dbfcmd(dbproc1,"WHERE subscr_no = %d ",emf_active_subscr_no); dbfcmd(dbproc1," and subscr_no_resets = %d ",emf_active_subscr_no_resets); br_dbsqlexec(dbproc1); if (Sybase_error) { dbcancel(dbproc1); } status = 0; num_active_external_ids = 0; free (active_external_ids); active_external_ids = NULL; XmListDeselectAllItems (emf_external_list); XmListDeleteAllItems (emf_external_list); while((ret_code = dbresults(dbproc1)) != NO_MORE_RESULTS) { if(ret_code == FAIL) { dbcancel(dbproc1); break; } dbbind(dbproc1,1,NTBSTRINGBIND,0,external_id); dbbind(dbproc1,2,INTBIND,0,&id_type); dbbind(dbproc1,3,NTBSTRINGBIND,0,full_active_dt); dbbind(dbproc1,4,NTBSTRINGBIND,0,full_inactive_dt); dbbind(dbproc1,5,NTBSTRINGBIND,0,active_dt); dbbind(dbproc1,6,NTBSTRINGBIND,0,inactive_dt); while (dbnextrow(dbproc1) != NO_MORE_ROWS) { /* Found an entry. */ num_active_external_ids++; active_external_ids = (EXTERNAL_ID_DATA_TYPE *) realloc (active_external_ids,num_active_external_ids * sizeof (EXTERNAL_ID_DATA_TYPE)); strcpy (active_external_ids[num_active_external_ids - 1].external_id,external_id); strcpy (active_external_ids[num_active_external_ids - 1].full_active_dt,full_active_dt); strcpy (active_external_ids[num_active_external_ids - 1].active_dt,active_dt); strcpy (active_external_ids[num_active_external_ids - 1].full_inactive_dt,full_inactive_dt); strcpy (active_external_ids[num_active_external_ids - 1].inactive_dt,inactive_dt); active_external_ids[num_active_external_ids - 1].external_id_type = id_type; if(strlen(external_id) > EXTERNAL_ID_LEN-1) external_id[EXTERNAL_ID_LEN-1] = '\0'; strcpy (external_id_type,""); for (lm = 0; lm < num_cmf_external_id_type_codes; lm++) { if (id_type == cmf_external_id_type_list[lm].db_code) { strcpy (external_id_type,cmf_external_id_type_list[lm].description); break; } } if(strlen(external_id_type) > 20) external_id_type[20] = '\0'; sprintf (display_string,"%-48.48s %-20.20s %-9s %-9s ", external_id,external_id_type,active_dt,inactive_dt); temp = XmStringCreateSimple (display_string); XmListAddItem (emf_external_list, temp, 0); /* Add as last item in list */ XmStringFree (temp); } } if(Sybase_error) { dbcancel(dbproc1); } }
/*************************************<->************************************* * * wspUpdateWorkspaceList (pPres) * * * Description: * ----------- * Updates the list widget containing all the workspaces. * Sets the ones for this client. * * Inputs: * ------ * pPres = ptr to presence dialog data * * Outputs: * ------- * none * * Comments: * --------- ******************************<->***********************************/ static void wspUpdateWorkspaceList( PtrWsPresenceData pPres ) { int n; XmString xmsTmp, *pxmsSelected; WmScreenData *pSD; Arg args[5]; int wsnum, numSelected; /* * Update the list of workspaces to -- one may have been * renamed since the last time we were up. */ pSD = pPres->pCDforClient->pSD; for (wsnum = 0; wsnum < pSD->numWorkspaces; wsnum++) { xmsTmp = XmStringCopy (pSD->pWS[wsnum].title); if (!XmStringCompare (xmsTmp, pPres->ItemStrings[wsnum])) { /* * Replace the string in our local list */ XmStringFree (pPres->ItemStrings[wsnum]); pPres->ItemStrings[wsnum] = xmsTmp; /* * Replace the item in the scrolled list. */ XmListDeletePos (pPres->workspaceListW, 1+wsnum); XmListAddItem (pPres->workspaceListW, xmsTmp, 1+wsnum); } else { XmStringFree (xmsTmp); } } /* * Highlight the workspaces this client resides in */ XmListDeselectAllItems (pPres->workspaceListW); pxmsSelected = (XmString *) XtMalloc (pPres->pCDforClient->pSD->numWorkspaces * sizeof (XmString)); numSelected = 0; for (wsnum = 0; wsnum < pPres->pCDforClient->pSD->numWorkspaces; wsnum++) { if (ClientInWorkspace (&pPres->pCDforClient->pSD->pWS[wsnum], pPres->pCDforClient)) { pxmsSelected[numSelected++] = pPres->ItemStrings[wsnum]; pPres->ItemSelected[wsnum] = True; } else { pPres->ItemSelected[wsnum] = False; pPres->pCDforClient->putInAll = False; } if (pPres->pCDforClient->pSD->pActiveWS->id == pPres->pCDforClient->pSD->pWS[wsnum].id) { /* save item number of current workspace */ pPres->currentWsItem = 1+wsnum; } } /* set the selected items */ n = 0; XtSetArg (args[n], XmNselectedItems, pxmsSelected); n++; XtSetArg (args[n], XmNselectedItemCount, numSelected); n++; XtSetValues (pPres->workspaceListW, args, n); /* set state of all workspaces button */ n = 0; XtSetArg (args[n], XmNset, pPres->pCDforClient->putInAll); n++; XtSetValues (pPres->allWsW, args, n); /* set name of window we're popped up for */ wspSetWindowName (pPres); XtFree ((char *) pxmsSelected); } /* END OF FUNCTION */
void UpdatePresenceWorkspaces( WmScreenData *pSD ) { PtrWsPresenceData pPres = &pSD->presence; int wsnum; XmString xmsTmp; if (pPres->shellW) { if (pPres->numWorkspaces < pSD->numWorkspaces) { if (((pPres->ItemStrings = (XmStringTable) XtRealloc ((char *)pPres->ItemStrings, (pSD->numWorkspaces * sizeof(XmString *)))) == NULL) || ((pPres->ItemSelected = (Boolean *) XtRealloc ((char *)pPres->ItemSelected, (pSD->numWorkspaces * sizeof(Boolean)))) == NULL)) { Warning (((char *)GETMESSAGE(52, 5, "Insufficient memory to create Occupy Workspace dialog."))); pPres->shellW = NULL; return; } } /* * Replace the names in the dialog's list */ for (wsnum = 0; wsnum < pPres->numWorkspaces; wsnum++) { if (wsnum < pSD->numWorkspaces) { xmsTmp = XmStringCopy (pSD->pWS[wsnum].title); if (!XmStringCompare (xmsTmp, pPres->ItemStrings[wsnum])) { /* * Replace the string in our local list */ XmStringFree (pPres->ItemStrings[wsnum]); pPres->ItemStrings[wsnum] = xmsTmp; /* * Replace the item in the scrolled list. */ XmListDeletePos (pPres->workspaceListW, 1+wsnum); XmListAddItem (pPres->workspaceListW, xmsTmp, 1+wsnum); } else { XmStringFree (xmsTmp); } } else { /* * Delete this workspace from the list */ XmStringFree (pPres->ItemStrings[wsnum]); pPres->ItemStrings[wsnum] = NULL; XmListDeletePos (pPres->workspaceListW, 1+wsnum); } } for (; wsnum < pSD->numWorkspaces; wsnum++) { /* * Add these workspaces to the list. */ xmsTmp = XmStringCopy (pSD->pWS[wsnum].title); pPres->ItemStrings[wsnum] = xmsTmp; XmListAddItem (pPres->workspaceListW, xmsTmp, 1+wsnum); if (pPres->pCDforClient && (ClientInWorkspace (&pPres->pCDforClient->pSD->pWS[wsnum], pPres->pCDforClient))) { XmListSelectPos (pPres->workspaceListW, 1+wsnum, TRUE); pPres->ItemSelected[wsnum] = True; } else { pPres->ItemSelected[wsnum] = False; } } pPres->numWorkspaces = pSD->numWorkspaces; } } /* END OF FUNCTION UpdatePresenceWorkspaces */
/*********************************************************************** * * * Set the left selector column. * * * ***********************************************************************/ void set_selector_column(XmString xmstr, int pos) { if (selector_dialog) XmListAddItem(var1NtSList, xmstr, pos); }
static void build_gui(Widget toplevel) { Widget main_w, menubar, widget, sat_frame, sky_frame, gps_frame; Widget gps_form, gps_data, sw; Arg args[100]; XGCValues gcv; Atom delw; int i; XmString string; XmString file, help, about, quit; /*@ -immediatetrans -usedef @*/ /* the root application window */ XtSetArg(args[0], XmNwidth, LEFTSIDE_WIDTH + SATDIAG_SIZE + 26); XtSetArg(args[1], XmNheight, SATDATA_HEIGHT + 14 * MAX_FONTSIZE + 12); /*@ +immediatetrans +usedef @*/ XtSetValues(toplevel, args, 2); /*@ -onlytrans @*/ main_w = XtVaCreateManagedWidget("main_window", xmMainWindowWidgetClass, toplevel, NULL); /* Construct the menubar */ file = XmStringCreateLocalized("File"); help = XmStringCreateLocalized("Help"); menubar = XmVaCreateSimpleMenuBar(main_w, "menubar", XmVaCASCADEBUTTON, file, 'F', XmVaCASCADEBUTTON, help, 'H', NULL); XmStringFree(file); if ((widget = XtNameToWidget(menubar, "button_1"))) XtVaSetValues(menubar, XmNmenuHelpWidget, widget, NULL); quit = XmStringCreateLocalized("Quit"); (void)XmVaCreateSimplePulldownMenu(menubar, "file_menu", 0, file_cb, XmVaPUSHBUTTON, quit, 'Q', NULL, NULL, NULL); XmStringFree(quit); about = XmStringCreateLocalized("About"); (void)XmVaCreateSimplePulldownMenu(menubar, "help_menu", 1, help_cb, XmVaPUSHBUTTON, help, 'H', NULL, NULL, XmVaSEPARATOR, XmVaPUSHBUTTON, about, 'A', NULL, NULL, NULL); XmStringFree(help); XmStringFree(about); XtManageChild(menubar); /* a form to assist with geometry negotiation */ form = XtVaCreateManagedWidget("form", xmFormWidgetClass, main_w, XmNfractionBase, 3, NULL); /* satellite frame */ sat_frame = XtVaCreateWidget("satellite_frame", xmFrameWidgetClass, form, XmNshadowType, XmSHADOW_ETCHED_IN, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 1, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 2, XmNleftAttachment, XmATTACH_FORM, NULL); (void)XtVaCreateManagedWidget("Satellite List", xmLabelGadgetClass, sat_frame, XmNchildType, XmFRAME_TITLE_CHILD, XmNchildVerticalAlignment, XmALIGNMENT_CENTER, NULL); /* the left half of the screen */ left = XtVaCreateManagedWidget("left", xmFormWidgetClass, sat_frame, NULL); /* skyview frame */ sky_frame = XtVaCreateWidget("skyview_frame", xmFrameWidgetClass, form, XmNshadowType, XmSHADOW_ETCHED_IN, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 2, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, NULL); (void)XtVaCreateManagedWidget("Skyview", xmLabelGadgetClass, sky_frame, XmNchildType, XmFRAME_TITLE_CHILD, XmNchildVerticalAlignment, XmALIGNMENT_CENTER, NULL); /* the right half of the screen */ right = XtVaCreateManagedWidget("right", xmFormWidgetClass, sky_frame, NULL); /* the application status bar */ status_form = XtVaCreateManagedWidget("status_form", xmFormWidgetClass, form, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 2, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, left, XmNfractionBase, 3, NULL); status_frame = XtVaCreateWidget("status_frame", xmFrameWidgetClass, status_form, XmNshadowType, XmSHADOW_ETCHED_IN, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); (void)XtVaCreateManagedWidget("Message Data", xmLabelGadgetClass, status_frame, XmNchildType, XmFRAME_TITLE_CHILD, XmNchildVerticalAlignment, XmALIGNMENT_CENTER, NULL); status = XtVaCreateManagedWidget("status", xmTextFieldWidgetClass, status_form, XmNcursorPositionVisible, False, XmNeditable, False, XmNmarginHeight, 1, XmNhighlightThickness, 0, XmNshadowThickness, 2, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); /* gps information frame */ gps_form = XtVaCreateManagedWidget("gps_form", xmFormWidgetClass, form, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 2, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, status_form, XmNfractionBase, 3, NULL); gps_frame = XtVaCreateWidget("gps_frame", xmFrameWidgetClass, gps_form, XmNshadowType, XmSHADOW_ETCHED_IN, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); (void)XtVaCreateManagedWidget("GPS Data", xmLabelGadgetClass, gps_frame, XmNchildType, XmFRAME_TITLE_CHILD, XmNchildVerticalAlignment, XmALIGNMENT_CENTER, NULL); sw = XtVaCreateManagedWidget("scrolled_w", xmScrolledWindowWidgetClass, gps_frame, XmNscrollingPolicy, XmAUTOMATIC, NULL); gps_data = XtVaCreateWidget("gps_data", xmFormWidgetClass, sw, XmNfractionBase, 30, NULL); /* satellite location and SNR data panel */ satellite_list = XtVaCreateManagedWidget("satellite_list", xmListWidgetClass, left, XmNbackground, get_pixel(toplevel, "snow"), XmNlistSizePolicy, XmCONSTANT, XmNhighlightThickness, 0, XmNlistSpacing, 4, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); /* the satellite diagram */ satellite_diagram = XtVaCreateManagedWidget("satellite_diagram", xmDrawingAreaWidgetClass, right, XmNbackground, get_pixel(toplevel, "snow"), XmNheight, SATDIAG_SIZE + 24, XmNwidth, SATDIAG_SIZE, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); gcv.foreground = BlackPixelOfScreen(XtScreen(satellite_diagram)); gc = XCreateGC(XtDisplay(satellite_diagram), RootWindowOfScreen(XtScreen(satellite_diagram)), GCForeground, &gcv); register_canvas(satellite_diagram, gc); XtVaSetValues(satellite_diagram, XmNuserData, gc, NULL); /*@i@*/XtAddCallback(satellite_diagram, XmNexposeCallback, redraw, NULL); /*@i@*/XtAddCallback(satellite_diagram, XmNresizeCallback, resize, NULL); /* the data display */ (void)XtVaCreateManagedWidget("Time", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 5, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 6, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); (void)XtVaCreateManagedWidget("Latitude", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 5, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 12, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); (void)XtVaCreateManagedWidget("Longitude", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 5, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 18, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); (void)XtVaCreateManagedWidget("Altitude", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 18, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 5, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 24, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); (void)XtVaCreateManagedWidget("Speed", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 24, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 5, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); text_1 = XtVaCreateManagedWidget("time", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 15, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 6, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, NULL); text_2 = XtVaCreateManagedWidget("latitude", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 15, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 12, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, NULL); text_3 = XtVaCreateManagedWidget("longitude", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 15, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 18, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, NULL); text_4 = XtVaCreateManagedWidget("altitude", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 18, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 15, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 24, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, NULL); text_5 = XtVaCreateManagedWidget("speed", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 24, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 15, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 5, NULL); (void)XtVaCreateManagedWidget("EPH", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 20, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 6, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 15, NULL); (void)XtVaCreateManagedWidget("EPV", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 20, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 12, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 15, NULL); (void)XtVaCreateManagedWidget("Climb", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 20, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 18, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 15, NULL); (void)XtVaCreateManagedWidget("Track", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 18, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 20, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 24, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 15, NULL); (void)XtVaCreateManagedWidget("Status", xmLabelGadgetClass, gps_data, XmNalignment, XmALIGNMENT_END, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 24, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 20, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 15, NULL); text_7 = XtVaCreateManagedWidget("eph", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 30, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 6, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 20, NULL); text_8 = XtVaCreateManagedWidget("epv", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 30, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 12, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 20, NULL); text_9 = XtVaCreateManagedWidget("climb", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 30, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 18, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 20, NULL); text_6 = XtVaCreateManagedWidget("track", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 18, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 30, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 24, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 20, NULL); text_10 = XtVaCreateManagedWidget("status", xmTextFieldWidgetClass, gps_data, XmNeditable, False, XmNcursorPositionVisible, False, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 24, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 30, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 30, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 20, NULL); XtManageChild(gps_data); XtManageChild(sat_frame); XtManageChild(sky_frame); XtManageChild(gps_frame); XtVaSetValues(main_w, XmNmenuBar, menubar, XmNworkWindow, form, NULL); XtRealizeWidget(toplevel); delw = XmInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", (Boolean)False); /*@ -nullpass @*/ (void)XmAddWMProtocolCallback(toplevel, delw, (XtCallbackProc)quit_cb, NULL); /*@ +onlytrans @*/ /* create empty list items to be replaced on update */ string = XmStringCreateSimple(" "); for (i = 0; i <= MAXCHANNELS; i++) XmListAddItem(satellite_list, string, 0); XmStringFree(string); }
void pp_display_avail_components() { typedef struct { char item [200]; int total; } DUPLICATES; DUPLICATES *Duplicates = NULL; /* List of duplicates assigned */ DUPLICATES TempDup; XmString temp; char TempString[10]; int i, n, NumDuplicates; char display_string [200]; char trunc_external_id[49]; char trunc_comp_text[81]; XmListDeleteAllItems (ppp_prov_list); XmListDeselectAllItems (ppp_prov_list); show_busy_cursor(pp_provision_shell,TRUE); n = 0; NumDuplicates = 0; /* set up and display each item */ for (i = 0; i < num_pp_prov_components; i++) { strcpy (trunc_comp_text, pp_prov_components[i].comp_text); if (strlen(trunc_comp_text) > 40) trunc_comp_text[40] = '\0'; strcpy (trunc_external_id, pp_prov_components[i].external_id); if (strlen(trunc_external_id) > 20) trunc_external_id[20] = '\0'; sprintf (display_string, "%-10d %-40s %-20s", pp_prov_components[i].comp_id, trunc_comp_text, trunc_external_id); if(pp_prov_components[i].is_reqd) { strcat (display_string," Y "); } else { strcat (display_string," N "); } /* Add all the items to the Duplicates list - for duplicates counter (** MR **) */ if (NumDuplicates == 0) /* No duplicates */ { NumDuplicates++; sprintf (TempDup.item, "%s", display_string); TempDup.total = 1; if (! (Duplicates = (DUPLICATES *) realloc(Duplicates, sizeof(DUPLICATES) * (NumDuplicates + 1)))) { printf ("Could not perform reallac for list of Duplicates. Exiting"); exit (1); } Duplicates[0] = TempDup; } else { /* go through the list to see if the element is already there */ for (n = 0; n < NumDuplicates; n++) { if (strcmp (Duplicates[n].item, display_string) == 0) { Duplicates[n].total++; break; } } if (n == NumDuplicates) /* Item not in list - add */ { NumDuplicates++; sprintf (TempDup.item, "%s", display_string); TempDup.total = 1; if (! (Duplicates = (DUPLICATES *) realloc(Duplicates, sizeof(DUPLICATES) * (NumDuplicates + 1)))) { printf ("Could not perform reallac for list of Duplicates. Exiting"); exit (1); } Duplicates[NumDuplicates-1] = TempDup; } } } /* Now add all the items into the list box */ for (n=0; n < NumDuplicates; n++) { sprintf (TempString, " %d", Duplicates[n].total); strcat (Duplicates[n].item, TempString); temp = XmStringCreateSimple (Duplicates[n].item); XmListAddItem (ppp_prov_list,temp,0); XmStringFree (temp); } show_busy_cursor(pp_provision_shell,FALSE); }
void display_cmf_level_selection(Widget w) { int status; int ret_code; int i; int account_no; char external_id[49]; XmString temp; if (pp_assoc_poplist_shell == NULL) { create_pp_assoc_poplist_shell(pp_provision_shell); } num_pp_elig_cmfs = 0; XmListDeleteAllItems (pp_assoc_poplist); XmListDeselectAllItems(pp_assoc_poplist); dbfcmd(dbproc1, "exec pp_select_elig_cmf_component @comp_id = %d,",pp_prov_components[gassoc_selection].comp_id); dbfcmd(dbproc1, " @hier_id = %d, ", ghierarchy_id); dbfcmd(dbproc1, " @ext_id_type = %d ", gAcctExtIdType); if(safe_dbexec(dbproc1,"SELECT_ELIGIBLE_CMFS", "select_eligible_cmfs")) return; while ((status = safe_dbresults (dbproc1, "SELECT_ELIGIBLE_CMFS", "select_eligible_cmfs")) != NO_MORE_RESULTS) { if (status == FAIL) return; dbbind (dbproc1, 1, INTBIND, 0, &account_no); dbbind (dbproc1, 2, NTBSTRINGBIND, 0, external_id); while ((ret_code = dbnextrow(dbproc1)) != NO_MORE_ROWS) { if(ret_code == FAIL) return; /* process results */ num_pp_elig_cmfs++; pp_elig_cmfs = (ELIG_CMF_TYPE *) realloc (pp_elig_cmfs, num_pp_elig_cmfs * sizeof(ELIG_CMF_TYPE)); pp_elig_cmfs[num_pp_elig_cmfs - 1].account_no = account_no; strcpy (pp_elig_cmfs[num_pp_elig_cmfs - 1].external_id,external_id); } } for (i = 0; i < num_pp_elig_cmfs; i++) { temp = XmStringCreateSimple (pp_elig_cmfs[i].external_id); XmListAddItem (pp_assoc_poplist, temp, 0); XmStringFree (temp); } position_poplist (w,pp_assoc_poplist_shell); XtManageChild (pp_assoc_poplist_form); XtPopup (pp_assoc_poplist_shell, XtGrabNone); }
int main(int argc, char **argv) { Widget toplevel, widget, bb, list; XtAppContext app; XmString item; Arg args[10]; int n = 0; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "ComBox", NULL, 0, &argc, argv, NULL, NULL); bb = XmCreateBulletinBoard(toplevel, "bb", NULL, 0); XtManageChild(bb); widget = XmCreateDropDownComboBox(bb, "combo", args, n); #if 0 /* causes a core dump and reports a warning */ XtDestroyWidget(CB_EditBox(widget)); /* causes a core dump */ XtDestroyWidget(CB_List(widget)); /* reports warning if list or edit box are unmanaged */ XtUnmanageChild(CB_List(widget)); XtUnmanageChild(CB_EditBox(widget)); /* does not report warning if scrolled window is unmanaged */ XtUnmanageChild(CB_ScrolledW(widget)); #endif /* use list routine to add items */ list = CB_List(widget); item = XmStringCreateSimple("Item 1"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 2"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 3"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 4"); XmListAddItem(list,item,0); item = XmStringCreateSimple("Item 5"); XmListAddItem(list,item,0); XmComboBoxUpdate(widget); XtManageChild(widget); XtRealizeWidget(toplevel); #if 1 XdbPrintResources(CB_ListShell(widget)); XdbPrintResources(widget); #endif check_geometry(widget); LessTifTestMainLoop(toplevel); exit(0); }
static int ReadChannel(InStoreStruct *setup, int chunk,int samples,unsigned short *buffer,int *samples_read,int *nid,float *calib) { int chunk_address = 0x0B000 | chunk; int points_to_read; int status=1; int tries; for (points_to_read = chunksize; status & 1 && points_to_read; points_to_read = chunksize) { struct { unsigned short status; unsigned short bytcnt; unsigned int dummy;} iosb = {0,0}; int try; static DESCRIPTOR_A(calib_a, sizeof(*calib), DTYPE_NATIVE_FLOAT, 0, 2*sizeof(*calib)); static DESCRIPTOR_NID(nid_dsc,0); void *arglist[] = {0,&nid_dsc,&calib_a MDS_END_ARG}; calib_a.pointer = (char *)calib; nid_dsc.pointer = (char *)nid; arglist[0] = (void *)(sizeof(arglist)/sizeof(arglist[0])); AccessTraq(setup,chunk_address,24,arglist,TdiData); pio(8,0,0); for (try = 0;(try < 20) && (!(CamQ(0)&1)) && (status & 1);try++) {pio(8,0,0);} pio(10,0,0); return_on_error(DevCamChk(CamQstopw(setup->name,0,2,points_to_read,buffer + *samples_read,16,(short *)&iosb),&one,0),status); status = status & 1 ? iosb.status : status; *samples_read += iosb.bytcnt/2; if (iosb.bytcnt/2 != points_to_read) break; chunk_address += max_chunks_per_io; } return status; } static int AccessTraq(InStoreStruct *setup, int data,int memsize,void *arglist,int (*routine)()) { int try; int status; int called = 0; if (max_time > 0) { if ((time(0)-start_time) > max_time) { printf("T4012 AccessTraq timeout, data=%d\n",data); return DEV$_BAD_MODE; } } piomem(17,0,&data,memsize); for (try = 0;(try < 30) && (!(CamQ(0)&1)) && (status &1);try++) { if (arglist && !called) { called = 1; LibCallg(arglist,routine); } else DevWait((float).001); piomem(17,0,&data,memsize); } if (try == 30) status = DEV$_CAM_NOSQ; if (arglist &&!called) LibCallg(arglist,routine); return status; } int t4012__dw_setup( struct descriptor *niddsc, struct descriptor *methoddsc, Widget parent) { static String uids[] = {"T4012.uid"}; static int nid; static MrmRegisterArg uilnames[] = {{"nid",(XtPointer)0},{"Load",(XtPointer)Load}}; static NCI_ITM nci[] = {{4, NciCONGLOMERATE_NIDS, (unsigned char *)&nid, 0}, {0, NciEND_OF_LIST, 0, 0}}; TreeGetNci(*(int *)niddsc->pointer, nci); uilnames[0].value = (char *)0+nid; return XmdsDeviceSetup(parent, (int *)niddsc->pointer, uids, XtNumber(uids), "T4012", uilnames, XtNumber(uilnames), 0); } static void Load(Widget w) { char *t4012name; char dignam[512]; int i; XtPointer user_data; int nid; int found = False; XtVaGetValues(w, XmNuserData, &user_data, NULL); nid = (intptr_t)user_data; t4012name = TreeGetPath(nid); strcpy(dignam,t4012name); strcat(dignam,":T28%%_"); TreeFree(t4012name); XmListDeleteAllItems(w); for (i=1;i<17;i++) { int dig_nid; int status; XmString item; int len = strlen(dignam); dignam[len++]=i<10 ? '0' : '1'; dignam[len++]='0'+(i % 10); dignam[len++]=0; status = TreeFindNode(dignam,&dig_nid); if (status & 1) { NCI_ITM itmlst[] = {{512,NciNODE_NAME,0,0},{0,0,0,0}}; itmlst[0].pointer = dignam; TreeGetNci(dig_nid,itmlst); item = XmStringCreateSimple(dignam); XmListAddItem(w, item, 0); XmStringFree(item); found = True; } else break; } if (!found) { XmString item = XmStringCreateSimple("Add T28xx_01"); XmListAddItem(w, item, 0); XmStringFree(item); } }
void AliasListUiItem::handleAddButtonPress() { char *key_str = NULL; char *value_str = NULL; PropStringPair *new_pair = NULL; XtVaGetValues(key_widget, XmNvalue, &key_str, NULL); XtVaGetValues(value_widget, XmNvalue, &value_str, NULL); if(key_str != NULL) if(strlen(key_str) > 0) { new_pair = new PropStringPair; int *pos_list, num_pos; new_pair->label = strdup(key_str); if(value_str != NULL) new_pair->value = strdup(value_str); else new_pair->value = NULL; if(XmListGetSelectedPos(this->getWidget(), &pos_list, &num_pos)) { if(list_items == NULL) list_items = new DtVirtArray<PropStringPair *>(10); list_items->insert(new_pair,pos_list[0] - 1); XmListAddItem(this->getWidget(), XmStringCreateLocalized( formatPropPair( new_pair->label, new_pair->value)), pos_list[0]); XmListSelectPos(this->getWidget(), pos_list[0], TRUE); XmListSetPos(this->getWidget(), pos_list[0]); } else { if(list_items == NULL) list_items = new DtVirtArray<PropStringPair *>(10); list_items->insert(new_pair,0); XmListAddItem(this->getWidget(), XmStringCreateLocalized( formatPropPair( new_pair->label, new_pair->value)), 1); XmListSelectPos(this->getWidget(), 1, TRUE); XmListSetPos(this->getWidget(), 1); } props_changed = TRUE; } }
/* if the site add is okayed, then we check to see if the input is * good, and if it is, we bring it up for editing */ void site_edit_add_ok_callback(Widget w, XtPointer client_data, XtPointer call_data) { XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data; char *new_sid_str, buf[20]; int i, new_sid, list_size; Widget d; XmString xmstr; char sub[25]; int k, j; /* get the new pid in string form */ XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &new_sid_str); /* find a number and complain if it isn't one */ /* skip over any initial spaces */ k=0; while(new_sid_str[k] == ' ') k++; /* read in an integer (the prod id) */ j=0; while(isdigit((int)(new_sid_str[k]))) sub[j++] = new_sid_str[k++]; sub[j] = '\0'; free(new_sid_str); /* check if we got digits */ if(j==0) { d = XmCreateErrorDialog(w, "Error", NULL, 0); xmstr = XmStringCreateLtoR("The entered value is not a number.\nPlease try again.", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(d, XmNmessageString, xmstr, NULL); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON)); XtManageChild(d); XmStringFree(xmstr); return; } else new_sid = atoi(sub); /* check to see if the number exists already. if it does, complain */ for(i=0; i<icao_list->size; i++) if(new_sid == icao_list->keys[i]) { d = XmCreateInformationDialog(w, "Error", NULL, 0); xmstr = XmStringCreateLtoR("The specified site ID number already exists.", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(d, XmNmessageString, xmstr, NULL); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON)); XtManageChild(d); return; } /* check to see if the number is within a defined range */ if( !((new_sid >=0) && (new_sid <= 999)) && /* WSR-88D */ !((new_sid >=3000) && (new_sid <= 3050)) ) { /* TDWR */ d = XmCreateInformationDialog(w, "Error", NULL, 0); xmstr = XmStringCreateLtoR("The specified site ID is not in a defined range.\n 0-999 for WSR-88D; 3000-3050 for TDWR", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(d, XmNmessageString, xmstr, NULL); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON)); XtManageChild(d); return; } /* if not, add default values for the pid in to the preference fields */ assoc_insert_i(radar_type_list, new_sid, 0); assoc_insert_s(icao_list, new_sid, " "); /* then set it up to be edited */ sprintf(buf, "%d", new_sid); xmstr = XmStringCreateLtoR(buf, XmFONTLIST_DEFAULT_TAG); XtVaSetValues(site_id_label, XmNlabelString, xmstr, NULL); XtVaGetValues(si_list, XmNitemCount, &list_size, NULL); XmListAddItem(si_list, xmstr, list_size+1); XmListSelectItem(si_list, xmstr, True); XtVaSetValues(XtParent(si_list), XmNwidth, 130, NULL); XtUnmanageChild(w); }
/* if the product add is okayed, then we check to see if the input is * good, and if it is, we bring it up for editing */ void product_edit_add_ok_callback(Widget w, XtPointer client_data, XtPointer call_data) { XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data; char *new_pid_str, buf[20]; int i, new_pid, list_size; Widget d; XmString xmstr; char sub[25]; int k, j; /* get the new pid in string form */ XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &new_pid_str); /* find a number and complain if it isn't one */ /* skip over any initial spaces */ k=0; while(new_pid_str[k] == ' ') k++; /* read in an integer (the prod id) */ j=0; while(isdigit((int)(new_pid_str[k]))) sub[j++] = new_pid_str[k++]; sub[j] = '\0'; free(new_pid_str); /* check if we got digits */ if(j==0) { d = XmCreateErrorDialog(w, "Error", NULL, 0); xmstr = XmStringCreateLtoR("The entered value is not a number.\nPlease try again.", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(d, XmNmessageString, xmstr, NULL); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON)); XtManageChild(d); XmStringFree(xmstr); return; } else new_pid = atoi(sub); /* check to see if the number exists already. if it does, complain */ for(i=0; i<msg_type_list->size; i++) if(new_pid == msg_type_list->keys[i]) { d = XmCreateInformationDialog(w, "Error", NULL, 0); xmstr = XmStringCreateLtoR("The specified product ID already exists.\nEnter another number.", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(d, XmNmessageString, xmstr, NULL); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON)); XtManageChild(d); XmStringFree(xmstr); return; } /* check to see if the number is within the range produced by the radar */ if( !((new_pid >=0) && (new_pid <= 1999)) ) { d = XmCreateInformationDialog(w, "Error", NULL, 0); xmstr = XmStringCreateLtoR("The specified product ID is beyond the valid range.\nEnter another number (1-1999).", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(d, XmNmessageString, xmstr, NULL); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON)); XtManageChild(d); XmStringFree(xmstr); return; } /* if not, add default values for the pid in to the preference fields */ assoc_insert_i(product_res, new_pid, -1); assoc_insert_i(digital_legend_flag, new_pid, -1); assoc_insert_s(digital_legend_file, new_pid, ".lgd"); assoc_insert_s(dig_legend_file_2, new_pid, ".lgd"); assoc_insert_s(configured_palette, new_pid, ".plt"); assoc_insert_s(config_palette_2, new_pid, ".plt"); assoc_insert_i(associated_packet, new_pid, 0); assoc_insert_i(msg_type_list, new_pid, -1); /* CVG 9.1 - added packet 1 coord override for geographic products */ assoc_insert_i(packet_1_geo_coord_flag, new_pid, 0); /* CVG 9.1 - added override of colors for non-2d array packets */ assoc_insert_s(override_palette, new_pid, ".plt"); assoc_insert_i(override_packet, new_pid, 0); /* CVG 9.3 - added elevation flag */ assoc_insert_i(elev_flag, new_pid, 0); assoc_insert_s(legend_units, new_pid, "units"); /* then set it up to be edited */ sprintf(buf, "%d", new_pid); xmstr = XmStringCreateLtoR(buf, XmFONTLIST_DEFAULT_TAG); XtVaSetValues(id_label, XmNlabelString, xmstr, NULL); XtVaGetValues(pi_list, XmNitemCount, &list_size, NULL); XmListAddItem(pi_list, xmstr, list_size+1); XmListSelectItem(pi_list, xmstr, True); XtVaSetValues(XtParent(pi_list), XmNwidth, 150, NULL); XtUnmanageChild(w); XmStringFree(xmstr); }
void pp_display_prov_pkg_cb(Widget w, XtPointer *call_data, XmAnyCallbackStruct *client_data) { int package_id; char package_desc[100]; int i; int status; int ret_code; XmString temp; int valid_date_found = 0; char *start_date = NULL; if (pp_poplist_shell == NULL) { create_pp_poplist_shell(pp_provision_shell); } valid_date_found = validate_date (ppp_start_date_txt,&start_date); if (!valid_date_found) { return; } if (strcmp(start_date,"") == 0) { post_dialog (pp_provision_shell,XmDIALOG_ERROR,"Start Date cannot be blank."); return; } num_pp_elig_pkgs = 0; XmListDeselectAllItems (pp_poplist); XmListDeleteAllItems (pp_poplist); dbfcmd(dbproc1, "exec pp_select_eligible_pkgs @account_no = %d,",gaccount_no); dbfcmd(dbproc1, " @lang_code = %d, ", gGUIlanguage); dbfcmd(dbproc1, " @input_date = '%s' ", start_date); if(safe_dbexec(dbproc1,"SELECT_ELIGIBLE_PKGS", "select_eligible_pkgs")) return; while ((status = safe_dbresults (dbproc1, "SELECT_ELIGIBLE_PKGS", "select_eligible_pkgs")) != NO_MORE_RESULTS) { if (status == FAIL) return; dbbind (dbproc1, 1, INTBIND, 0, &package_id); dbbind (dbproc1, 2, NTBSTRINGBIND, 0, package_desc); while ((ret_code = dbnextrow(dbproc1)) != NO_MORE_ROWS) { if(ret_code == FAIL) return; /* process results */ num_pp_elig_pkgs++; pp_elig_pkgs = (DB_POPLIST_TYPE *) realloc (pp_elig_pkgs, num_pp_elig_pkgs * sizeof(DB_POPLIST_TYPE)); pp_elig_pkgs[num_pp_elig_pkgs - 1].db_code = package_id; strcpy (pp_elig_pkgs[num_pp_elig_pkgs - 1].description,package_desc); } } for (i = 0; i < num_pp_elig_pkgs; i++) { temp = XmStringCreateSimple (pp_elig_pkgs[i].description); XmListAddItem (pp_poplist, temp, 0); XmStringFree (temp); } position_poplist (w,pp_poplist_shell); XtManageChild (pp_poplist_form); XtPopup (pp_poplist_shell, XtGrabNone); }