Exemplo n.º 1
0
Widget CreateErrorDialog(Widget widgetParent)
{
   int i, lng;
   Widget error, bouton;
   XmString label;
   Arg args[8];

   lng = c_getulng();

   i = 0;
   label = XmStringCreateLtoR(labelQuitter[lng], XmSTRING_DEFAULT_CHARSET);
   XtSetArg(args[i], XmNokLabelString, label); i++;
   error = (Widget)XmCreateErrorDialog(widgetParent, "popup", args, i);
   XtSetArg(args[i], XmNinitialResourcesPersistent, False); i++;
   CheckColormap(error);

   bouton = (Widget)XmMessageBoxGetChild(error, XmDIALOG_CANCEL_BUTTON);
   XtUnmanageChild(bouton);

   bouton = (Widget)XmMessageBoxGetChild(error, XmDIALOG_HELP_BUTTON);
   XtUnmanageChild(bouton);

   XtAddCallback(error, XmNokCallback, (XtCallbackProc) ErrorQuit, NULL);

   return error;

   }
Exemplo n.º 2
0
void errwin(const char *s)
{
    static XmString str;
    log_results((char *)s);
    if ((!inwin) || (!ismaster))
    {
        fprintf(stderr, "%s\n", s);
        return;
    }
    if (error_popup)
    {
        XmStringFree(str);
        str = XmStringCreateLtoR((char *)s, charset);
        XtVaSetValues(error_popup,
                      XmNmessageString, str,
                      NULL);
        XtManageChild(error_popup);
        return;
    }
    str = XmStringCreateLtoR((char *)s, charset);
    error_popup = XmCreateErrorDialog(app_shell, (char *)"errordlg", NULL, 0);
    XtVaSetValues(error_popup,
                  XmNmessageString, str,
                  XmNdialogTitle, XmStringCreateLtoR((char *)"Error", charset),
                  XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
                  NULL);
    XtAddCallback(error_popup, XmNhelpCallback, (XtCallbackProc)error_helpCB,
                  (XtPointer)NULL);
    XtUnmanageChild(XmMessageBoxGetChild(error_popup, XmDIALOG_CANCEL_BUTTON));
    XtManageChild(error_popup);
}
Exemplo n.º 3
0
static void PlotterNotFoundHP(Agent *plotter, void *client_data, void *)
{
#if !NDEBUG
    PlotWindowInfo *plot = (PlotWindowInfo *)client_data;
    assert(plot->plotter == 0 || plot->plotter == plotter);
#endif

    plotter->removeHandler(Died, PlotterNotFoundHP, client_data);

    string base = app_data.plot_command;
    if (base.contains(' '))
	base = base.before(' ');

    Arg args[10];
    Cardinal arg = 0;
    MString msg = rm( capitalize(base) + " could not be started.");
    XtSetArg(args[arg], XmNmessageString, msg.xmstring()); arg++;
    Widget dialog = 
	verify(XmCreateErrorDialog(find_shell(),
				   XMST("no_plotter_dialog"), args, arg));
    XtUnmanageChild(XmMessageBoxGetChild
		    (dialog, XmDIALOG_CANCEL_BUTTON));
    XtAddCallback(dialog, XmNhelpCallback, ImmediateHelpCB, XtPointer(0));

    Delay::register_shell(dialog);
    manage_and_raise(dialog);
}
Exemplo n.º 4
0
void CtrlBox(int argc,  char **argv) {
	XtAppContext app;
       	Widget 	toplevel, box, temp;
       	Widget   buttons[10];
       	int  	nbuttons;
        char*	exitPoint = names[EXIT_PROGRAM];
	if (argc > 1) {
		argv[0] = "Remote";
		if (argc > 2) exitPoint = "Back to PC desktop    ";
	}
	else argv[0] = "Local";
       	argc = 1;

       	toplevel =  XtVaAppInitialize(&app,"CtrlBox",NULL, 0, &argc, argv, NULL, NULL);

       	box = XtVaCreateManagedWidget("box",xmRowColumnWidgetClass, toplevel, NULL);

       	nbuttons = 0;
       	while(names[nbuttons] != 0) {
		if (nbuttons == EXIT_PROGRAM )
		buttons[nbuttons] = XtVaCreateManagedWidget(exitPoint,
                        xmPushButtonWidgetClass, box, NULL, 0);
		else
		buttons[nbuttons] = XtVaCreateManagedWidget(names[nbuttons],
			xmPushButtonWidgetClass, box, NULL, 0);
		XtAddCallback(buttons[nbuttons],XmNactivateCallback, callback,
			&values[nbuttons]);
	    nbuttons++;
	}

	// Create a popup error message dialog; no cancel, no help button 
	errorDialog = XmCreateErrorDialog(box, "errorDialog", NULL, 0);
	temp = XmMessageBoxGetChild(errorDialog, XmDIALOG_CANCEL_BUTTON);
	XtUnmanageChild(temp);
	temp = XmMessageBoxGetChild(errorDialog, XmDIALOG_HELP_BUTTON);
	XtUnmanageChild(temp);

	// Create a popup dialog to get the filename; no help button 
	fileDialog = XmCreateFileSelectionDialog(box, "fileDialog", NULL, 0);
	XtVaSetValues(fileDialog, XmNwidth, 400, NULL);
  	temp = XmFileSelectionBoxGetChild(fileDialog, XmDIALOG_HELP_BUTTON);
  	XtUnmanageChild(temp);

  	XtAddCallback(fileDialog, XmNokCallback, OpenFile, NULL);
	XtAddCallback(fileDialog, XmNcancelCallback, Cancel, NULL);

	XtManageChildren(buttons,nbuttons);
	XtRealizeWidget(toplevel);
        XMoveWindow (XtDisplay(toplevel), XtWindow(toplevel), 0, 0);
	XWarpPointer(XtDisplay(box), None, XtWindow(box), 0, 0, 0, 0, 400, 300);
	XtAppMainLoop(app);
}
Exemplo n.º 5
0
void MessageBox::show(std::string name, std::string message, std::string title, int messageBoxType)
{
  Arg args[4];
  Widget widget;

  XtSetArg(args[0], XmNmessageString, (XmStringCreateLtoR((char*)message.c_str(), XmSTRING_DEFAULT_CHARSET)));
  XtSetArg(args[1], XmNtitleString, (XmStringCreateLtoR((char*)title.c_str(), XmSTRING_DEFAULT_CHARSET)));
  XtSetArg(args[2], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL);
  XtSetArg(args[3], XmNtitle, title.c_str());
  widget = XmCreateErrorDialog(Application::getWidget(), (char*)name.c_str(), args, 4);
  XtUnmanageChild(XmMessageBoxGetChild(widget, XmDIALOG_HELP_BUTTON));
  XtUnmanageChild(XmMessageBoxGetChild(widget, XmDIALOG_CANCEL_BUTTON));
  XtManageChild(widget);
  XtRealizeWidget(widget);
}
Exemplo n.º 6
0
void CoWowMotif::DisplayError( const char *title, const char *text)
{
    Arg	    arg[10];
    Widget  err_widget, w;
    XmString cstr, ctitle;
    XmFontList fontlist;
    XFontStruct *font;
    XmFontListEntry fontentry;

    // Set default fontlist
    font = XLoadQueryFont( XtDisplay(m_parent),
	      "-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1");
    fontentry = XmFontListEntryCreate( (char*) "tag1", XmFONT_IS_FONT, font);
    fontlist = XmFontListAppendEntry( NULL, fontentry);
    XtFree( (char *)fontentry);

    cstr = XmStringCreateLtoR( (char*) text, XmSTRING_DEFAULT_CHARSET);
    ctitle = XmStringCreateLtoR( (char*) title, XmSTRING_DEFAULT_CHARSET);    
    XtSetArg(arg[0],XmNheight,75);
    XtSetArg(arg[1],XmNwidth,200);
    XtSetArg(arg[2],XmNmessageString, cstr);
    XtSetArg(arg[3],XmNx,400);
    XtSetArg(arg[4],XmNy,300);
    XtSetArg(arg[5],XmNdialogTitle, ctitle);
    XtSetArg(arg[6], XmNbuttonFontList, fontlist);
    XtSetArg(arg[7], XmNlabelFontList, fontlist);

    err_widget = XmCreateErrorDialog( m_parent,(char*) "err_widget",arg,8);
    XtAddCallback(err_widget, XmNokCallback, 
		(XtCallbackProc) error_ok_cb, NULL);

    XmStringFree( cstr);
    XmStringFree( ctitle);
    XmFontListFree( fontlist);
      
    XtManageChild(err_widget);	       
    
    w = XmMessageBoxGetChild(err_widget, XmDIALOG_CANCEL_BUTTON);
    XtUnmanageChild( w);    
    
    w = XmMessageBoxGetChild(err_widget, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild( w);    

} /* END DisplayErrorBox */
Exemplo n.º 7
0
void	vi_fatal_message(Widget parent, String str)
{
    Widget	db = XmCreateErrorDialog( parent, "Fatal", NULL, 0 );
    XmString	msg = XmStringCreateSimple( str );

    XtVaSetValues( XtParent(db),
		   XmNtitle,		"Fatal",
		   0
		   );
    XtVaSetValues( db,
		   XmNmessageString,	msg,
		   0
		   );
    XtAddCallback( XtParent(db), XmNpopdownCallback, __vi_cancel_cb, 0 );

    XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_CANCEL_BUTTON ) );
    XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_HELP_BUTTON ) );

    __vi_modal_dialog( db );

    exit(0);
}
Exemplo n.º 8
0
Widget CreateViewText ( Widget parent )
/************************************************************************
 * CreateViewText							*
 *									*
 * Widget CreateViewText( parent )					*
 *									*
 * Input parameters:							*
 * parent	Widget							*
 *									*
 * Output parameters:							*
 * CreateViewText	Widget						*
 *									*
 **									*
 ***********************************************************************/
{
	Arg	args[20];
	int	n;
/*---------------------------------------------------------------------*/
/*
 * Create a label widget to hold filename 
 */
	n = 0;
	viewlabel_widget = CreateLabelWidget( parent, "filename",
					"View File", args, n);
	viewfile_widget = CreateScrolledText( parent, "viewfile");

	n = 0;
	XtSetArg(args[n], XmNautoUnmanage, False); n++;
	viewerror_widget = XmCreateErrorDialog( parent, "viewerror",
						args, n);
	XtAddCallback( viewerror_widget, XmNokCallback,
			(XtCallbackProc)unviewerror_callback, NULL);
	XtUnmanageChild( XmMessageBoxGetChild( viewerror_widget,
					XmDIALOG_HELP_BUTTON));
	XtUnmanageChild( XmMessageBoxGetChild( viewerror_widget,
					XmDIALOG_CANCEL_BUTTON));
	return( viewfile_widget );
}
Exemplo n.º 9
0
void packet_selection_menu(Widget w, XtPointer client_data, XtPointer call_data) 
{
   Widget dialog, form, d;
   Widget again_box;
   Widget area_comp_but, table_comp_but;
   int i,j;
   /* CVG 9.0 - change name for clarity */
   int list_size;

   unsigned char is_set;

   XmString xmstr;
   XmString *xmstr_packetselect;
   static char *helpfile = HELP_FILE_PACKET_SELECT;

  Prod_header *hdr;
  Graphic_product *gp;

/* DEBUG */
/* fprintf(stderr,"DEBUG - ENTERING packet_selection_menu()\n"); */


    hdr = (Prod_header *)(sd->icd_product);
    gp  = (Graphic_product *)(sd->icd_product + 96);

    
  /* set up the main active screen */    
    if(selected_screen == SCREEN_1) {
        sd = sd1;       
    }
    
    if(selected_screen == SCREEN_2) {
        sd = sd2;
    }

    if(selected_screen == SCREEN_3) {
        sd = sd3;
    }
    

   /* make sure that a icd product has been loaded and parsed */
   if(sd->icd_product == NULL) { 
     d = XmCreateErrorDialog(shell, "Error", NULL, 0);
     xmstr = XmStringCreateLtoR("A valid product has not been loaded for display",
                XmFONTLIST_DEFAULT_TAG);
     XtVaSetValues(XtParent(d), XmNtitle, "Error", NULL);
     XtVaSetValues(d, XmNmessageString, xmstr, NULL);
     XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
     XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
     XtManageChild(d);
     XmStringFree(xmstr);
     return;
   }


   if(sd->num_layers == 0) { 
     d = XmCreateInformationDialog(shell, "NOTE", NULL, 0);
     xmstr = XmStringCreateLtoR("The selected product has no data for display "
                                "(no Sym Block, no GAB, no TAB).",
                XmFONTLIST_DEFAULT_TAG);
     XtVaSetValues(XtParent(d), XmNtitle, "NOTE", NULL);
     XtVaSetValues(d, XmNmessageString, xmstr, NULL);
     XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
     XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
     XtManageChild(d);
     XmStringFree(xmstr);
     
     return;
   }
 

/*  BY=PASS HERE //////////////////////////////////////////////////////////// */
/*  THIS WORKS FOR THE NON-PROBLEM PRODUCTS USING select_all_packets */
/*  select_layer_or_packet DOES NOT WORK (for DPA) without opening */
/*  the dilog  */
   if(select_all_flag==TRUE) {
    
         /* overlay_but is on the main menu */
         XtVaGetValues(overlay_but,
             XmNset,    &is_set,
             NULL);
         
         if(is_set == XmSET) {   
            check_overlay(FALSE); /* do not overlay non-geographic content */

         } else {
            overlay_flag = FALSE;

         }

       /*  Fixed overlay issues with 56 USP, 57 DHR, and 108 DPA */
       /*          DPA still requires special handling due to multiple  */
       /*          2D array packets        */
       if(
           gp->prod_code == 81) {
            
             /*  Must open the dialog for DPA */
           
       } else {
           
           select_all_packets(NULL, NULL, NULL);
 
           return;          
       }  


    } /*  end if select_all_flag */
/* END BY-PASS HERE ///////////////////////////////////////////////////////// */


   if(verbose_flag)
       fprintf(stderr,"inside packet selection menu: num of layers=%u\n", 
                                                                  sd->num_layers);


   /* allocate memory for the composite string list */
   list_size=0;
   for(i=0; i<sd->num_layers; i++) {
      list_size += sd->layers[i].num_packets;
/* fprintf(stderr,"DEBUG num packets in layer %d is %d\n", */
/*                              i+1, sd->layers[i].num_packets + 1);     */
   }
   list_size += sd->num_layers;
/* DEBUG */
/*    fprintf(stderr,"DEBUG total number of list entries (layers + packets is %d\n", */
/*                                         list_size); */

   xmstr_packetselect = (XmString*)XtMalloc(sizeof(XmString) * list_size);




   list_index=0;  /* keep track of where we are in the output array */
   
   /* BUILD THE LIST OF LAYERS AND PACKETS FROM THE LAYER INFO SCREEN DATA */
   for(i=0; i<sd->num_layers; i++) {
       char entry_string[100];
       int index;
  
       if(verbose_flag)
           printf("current layer=%i\n",i+1);

       sprintf(entry_string,
           "%04d: Layer %3i      -----------------------------------------",
                                                   list_index,  i+1);
       xmstr_packetselect[list_index] = 
           XmStringCreateLtoR(entry_string, XmFONTLIST_DEFAULT_TAG);
       list_index++;

       if(verbose_flag)
           printf("store %s\n",entry_string);
    
       for(j=0; j<sd->layers[i].num_packets;j++) {
           char secondary_descript[51];
           /* create a string to be placed into the list */
           index = transfer_packet_code(sd->layers[i].codes[j]);
    
           if(sd->layers[i].codes[j]==0x0802 || sd->layers[i].codes[j]==0x0E03 ||
              sd->layers[i].codes[j]==0x3501 || sd->layers[i].codes[j]==0xAF1F ||
              sd->layers[i].codes[j]==0xBA07 || sd->layers[i].codes[j]==0xBA0F ) {
               sprintf(entry_string,
                       "%04d:       Item %03i:  Traditional Packet %4Xx - %s", 
                       list_index, j+1, sd->layers[i].codes[j], 
                       packet_name[index]);
           
           } else if(sd->layers[i].codes[j]==2801 || 
                     sd->layers[i].codes[j]==2802 ||
                     sd->layers[i].codes[j]==2803 || 
                     sd->layers[i].codes[j]==2804 ||
                     sd->layers[i].codes[j]==2805 || 
                     sd->layers[i].codes[j]==2806 ) {
               get_component_subtype(secondary_descript, sd->layers[i].codes[j], 
                                                       sd->layers[i].offsets[j] );
               sprintf(entry_string,
                       "%04d:       Item %03i:  Generic Component  28:%d  - %s %s", 
                   list_index, j+1, sd->layers[i].codes[j]-2800, 
                   packet_name[index], secondary_descript);
           
           } else
               sprintf(entry_string,
                       "%04d:       Item %03i:  Traditional Packet %4u  - %s", 
                       list_index, j+1, sd->layers[i].codes[j], 
                       packet_name[index]);
    
           if(verbose_flag)
               printf("store %s\n",entry_string);
           
           xmstr_packetselect[list_index] = 
             XmStringCreateLtoR(entry_string,XmFONTLIST_DEFAULT_TAG);
           list_index++;
       } /*  end for num packets */
       
   } /*  end for num layers */

   if(verbose_flag)
       fprintf(stderr, "done creating list\n");

   /* CREATE AND OPEN THE PACKET SELECTION DIALOG WINDOW */

   xmstr =  XmStringCreateLtoR("Product Packets", XmFONTLIST_DEFAULT_TAG);
   dialog = XmCreateSelectionDialog(shell, "packet_displayd", NULL, 0);
   XtVaSetValues(dialog,
         XmNlistItems,        xmstr_packetselect,
         XmNlistItemCount,    list_index,
         XmNvisibleItemCount, 12,
         XmNdialogStyle,      XmDIALOG_PRIMARY_APPLICATION_MODAL,
         XmNlistLabelString,  xmstr,
         XmNmarginHeight,     0,
         XmNmarginWidth,      0,
         NULL);
   XmStringFree(xmstr);

   XtVaSetValues(XtParent(dialog), 
         XmNtitle,     sel_prod_buf,
         NULL);    


   /* default select first item in list */
   XmListSelectPos(XmSelectionBoxGetChild(dialog, XmDIALOG_LIST), 1, True);


   if(verbose_flag)
       printf("  total number of packets and layers = %d\n",  list_index);
   overlay_flag = FALSE;

   /* add a toggle to say whether we want an overlay */

  form = XtVaCreateManagedWidget("form", xmFormWidgetClass, dialog,
     NULL);

   overbut = XtVaCreateManagedWidget("Overlay Selected Packets / Components", 
      xmToggleButtonWidgetClass, form, 
      XmNtopAttachment,      XmATTACH_FORM,
      XmNtopOffset,          5,
      XmNleftAttachment,   XmATTACH_FORM,
      XmNleftOffset,       185,
      XmNrightAttachment,   XmATTACH_FORM,
      XmNrightOffset,       185,
      NULL);

   /* CVG 9.0 - make a change to not use, instead test for is_set */
   XtAddCallback(overbut, XmNvalueChangedCallback, overlayflag_callback, NULL);



    area_comp_but = XtVaCreateManagedWidget("Area Comp Display Options...",
       xmPushButtonWidgetClass, form,
       XmNtopAttachment,       XmATTACH_WIDGET,
       XmNtopWidget,           overbut,
       XmNtopOffset,           10,
       XmNleftAttachment,      XmATTACH_FORM,
       XmNleftOffset,          122,
       XmNbottomAttachment,    XmATTACH_FORM,
       XmNbottomOffset,        10,
       XmNrightAttachment,     XmATTACH_NONE,
       XmNwidth,               170,
       XmNheight,              25,
       NULL);
    XtAddCallback(area_comp_but, XmNactivateCallback, 
                                             area_comp_opt_window_callback, NULL);




    table_comp_but = XtVaCreateManagedWidget("Table Comp Display Options...",
       xmPushButtonWidgetClass, form,
       XmNtopAttachment,       XmATTACH_WIDGET,
       XmNtopWidget,           overbut,
       XmNtopOffset,           10,
       XmNleftAttachment,      XmATTACH_WIDGET,
       XmNleftWidget,          area_comp_but,
       XmNleftOffset,          30,
       XmNbottomAttachment,    XmATTACH_NONE,
       XmNrightAttachment,     XmATTACH_NONE,
       
       XmNwidth,               170,
       XmNheight,              25,
       NULL);
    XtAddCallback(table_comp_but, XmNactivateCallback, 
                                           table_comp_opt_window_callback, NULL);

    XtSetSensitive(table_comp_but, False);





   /* get rid of buttons 'n' stuff we don't want */
   XtUnmanageChild(XmSelectionBoxGetChild(dialog, XmDIALOG_SELECTION_LABEL));
   XtUnmanageChild(XmSelectionBoxGetChild(dialog, XmDIALOG_TEXT));

   XtAddCallback(dialog, XmNokCallback, packetselectall_callback, NULL);
   
   XtAddCallback(dialog, XmNapplyCallback, packetselection_Callback, NULL);

   XtAddCallback(dialog, XmNhelpCallback, help_window_callback, helpfile);


   XtVaSetValues(dialog,
          XmNokLabelString,     
               XmStringCreateLtoR("OK (Select All)", XmFONTLIST_DEFAULT_TAG),
          XmNapplyLabelString,     
               XmStringCreateLtoR("Single Layer/Packet", XmFONTLIST_DEFAULT_TAG),
          NULL);
/*  is there a problem (minor memory leak) here? */
   
   XtManageChild(dialog);
   packetsel_dialog = dialog;


   
   /* free allocated memory for the xmstring */
   for(i=0; i<list_index; i++)
       XmStringFree(xmstr_packetselect[i]);
   
   XtFree((char*)xmstr_packetselect);
   
/* DEBUG */
/* fprintf(stderr,"DEBUG packet_selection_menu() - " */
/*                "number of list entry strings freed is %d\n", */
/*                                           list_index+1); */
   
    
    /*  Fixed overlay issues with 56 USP, 57 DHR, and 108 DPA */
    /*          DPA still requires special handling due to multiple  */
    /*          2D array packets */
    if(

       gp->prod_code == 81) {   


        
        if((gp->prod_code == 81) && (dpa_info_flag == TRUE)) {
            xmstr = XmStringCreateLtoR(
              "The DPA product requires special attention.  Because of the      \n"
              "nature of the product, each layer / packet must be displayed     \n"
              "individually. The 'Select All' function is ignored.            \n\n"
              "DPA is considered a non-geographic product because an LFM        \n"
              "projection is not used when displayed. The 'Overlay Packet'      \n"
              "selection is ignored when either the previously displayed product\n"
              "or the product being displayed is configured as non-geographic.  \n",
              XmFONTLIST_DEFAULT_TAG);

            d = XmCreateInformationDialog(dialog, "NOTE", NULL, 0);
            XtVaSetValues(XtParent(d), XmNtitle, "NOTE", NULL);
            XtVaSetValues(d, XmNmessageString, xmstr, NULL);
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
            XtManageChild(d);
   
            again_box = XtVaCreateManagedWidget("Do Not Show This Message Again "\
                                                "                               "\
                                                "                               ", 
                 xmToggleButtonWidgetClass,  d,
                 XmNset,                     XmUNSET,
                 NULL);
            XtAddCallback(again_box, XmNvalueChangedCallback, 
                                                         dpa_not_again_cb, NULL);
            
            XmStringFree(xmstr);
         
        } /*  end second if product_code 81 && dpa_info_flag */
        
    } /*  end first if product_code 81 */


     
}  /*  end packet_selection_menu */
Exemplo n.º 10
0
Arquivo: Main.c Projeto: juddy/edcde
void 
ErrDialog(
        char *errString,
        Widget visualParent )
{
    int           n;
    Arg           args[10];
    XmString      ok;

    /* create the compound string */
    style.tmpXmStr = CMPSTR(errString);

    style.errParent = visualParent;

    if (style.errDialog == NULL)     /* create it */
    {
        ok = XmStringCreateLocalized((String) _DtOkString);

        n = 0;
        XtSetArg(args[n], XmNokLabelString, ok); n++;
        XtSetArg(args[n], XmNmessageString, style.tmpXmStr);                n++;
        XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC);                n++;
        XtSetArg (args[n], XmNautoUnmanage, False);                         n++;
        XtSetArg (args[n], XmNdefaultPosition, False);                      n++;
        style.errDialog = XmCreateErrorDialog(style.shell,"ErrorNotice",args,n);

        XtAddCallback (style.errDialog, XmNokCallback, UnmanageCB, NULL);
        XtAddCallback (style.errDialog, XmNcancelCallback, UnmanageCB, NULL);
        XtAddCallback (style.errDialog, XmNmapCallback, CenterMsgCB, NULL);
        XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog,
                                                XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog,
                                                XmDIALOG_HELP_BUTTON));

        /* set the dialog shell parent title */
        n=0;
        XtSetArg (args[n], XmNmwmInputMode,
                        MWM_INPUT_PRIMARY_APPLICATION_MODAL); n++;
        XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
        XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 3, "Error")));   n++;
        XtSetValues (XtParent(style.errDialog), args, n);
    }
    else                 /* change the string */
    {
        n = 0;
        XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++;
        XtSetValues (style.errDialog, args, n);
    }

    /* free the compound string */
    XmStringFree (style.tmpXmStr);

    if (XtIsManaged(style.errParent) || XtParent(style.errParent) == NULL)
    {
        XtManageChild(style.errDialog);
        /* ring the bell (PM behavior) */
        XBell(style.display, 0);
    }
    else
    {
        XtAddEventHandler(XtParent(style.errParent), StructureNotifyMask, 0,
                          (XtEventHandler)errParentMap, NULL);
    }

}
Exemplo n.º 11
0
Widget XmCreateErrorDialog_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateErrorDialog(parent, name, arglist, argcount);}
Exemplo n.º 12
0
Arquivo: Main.c Projeto: juddy/edcde
      char * title;
      char * master;

      okLabel = XmStringCreateLocalized(GETMESSAGE(1, 2, "OK"));
      template = (GETMESSAGE(1,3, "The password you entered does not match\nthe password for user %s.\n\nPlease reenter the password, or select the\nCancel button to terminate the operation."));
      master = XtMalloc(strlen(template) + strlen(appArgs.user) + 10);
      sprintf(master, template, appArgs.user);
      message = XmStringCreateLocalized(master);
      title = (GETMESSAGE(1,4, "Action Invoker - Password Error"));

      /* Post an error dialog */
      n = 0;
      XtSetArg(args[n], XmNtitle, title); n++;
      XtSetArg(args[n], XmNmessageString, message); n++;
      XtSetArg(args[n], XmNokLabelString, okLabel); n++;
      err = XmCreateErrorDialog(dlog, "err", args, n);
      XtUnmanageChild(XmMessageBoxGetChild(err, XmDIALOG_CANCEL_BUTTON));
      XtUnmanageChild(XmMessageBoxGetChild(err, XmDIALOG_HELP_BUTTON));
      XtManageChild(err);
      XtAddCallback(err, XmNokCallback, ErrOkCallback, err);

      XFlush(XtDisplay(dlog));
      XmUpdateDisplay(dlog);
      LogFailure();
      XmStringFree(okLabel);
      XmStringFree(message);
      XtFree(master);
   }
}

Exemplo n.º 13
0
int yesno(const char *msg1, const char *s1, const char *s2, const char *helptext)
{
    char buf[256];
    static XmString str, str1, str2;
    XEvent event;

    ht = (char *)helptext;

    keep_grab = True;

    if (noask)
    {
        return 1;
    }
    if (!inwin)
    {
        fprintf(stderr, "%s\n", msg1);
        fprintf(stderr, "%s\n", "(y)es/(n)o:");
        fgets(buf, 256, stdin);
        if (buf[0] == 'y')
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
    if (yesno_popup)
    {
        XmStringFree(str);
        XmStringFree(str1);
        XmStringFree(str2);
        str = XmStringCreateLtoR((char *)msg1, charset);
        XtVaSetValues(yesno_popup,
                      XmNmessageString, str,
                      NULL);
        if (s1 != NULL)
        {
            XtVaSetValues(yesno_popup,
                          XmNokLabelString, str1 = XmStringCreateLtoR((char *)s1, charset),
                          NULL);
        }
        else
        {
            XtVaSetValues(yesno_popup,
                          XmNokLabelString, str1 = XmStringCreateLtoR((char *)"OK", charset),
                          NULL);
        }
        if (s2 != NULL)
        {
            XtVaSetValues(yesno_popup,
                          XmNcancelLabelString, str2 = XmStringCreateLtoR((char *)s2, charset),
                          NULL);
        }
        else
        {
            XtVaSetValues(yesno_popup,
                          XmNcancelLabelString, str2 = XmStringCreateLtoR((char *)"Cancel", charset),
                          NULL);
        }
    }
    else
    {
        str = XmStringCreateLtoR((char *)msg1, charset);
        yesno_popup = XmCreateErrorDialog(app_shell, (char *)"warndlg", NULL, 0);
        XtVaSetValues(yesno_popup,
                      XmNmessageString, str,
                      XmNdialogTitle, XmStringCreateLtoR((char *)"Warning", charset),
                      NULL);
        if (s1 != NULL)
        {
            XtVaSetValues(yesno_popup, XmNokLabelString, str1 = XmStringCreateLtoR((char *)s1, charset),
                          NULL);
        }
        else
        {
        }
        if (s2 != NULL)
        {
            XtVaSetValues(yesno_popup, XmNcancelLabelString, str2 = XmStringCreateLtoR((char *)s2, charset),
                          NULL);
        }
        else
        {
        }
        XtAddCallback(yesno_popup, XmNokCallback, (XtCallbackProc)yesnoCB, (XtPointer)&keep_grab);
        XtAddCallback(yesno_popup, XmNcancelCallback, (XtCallbackProc)yesnoCB, (XtPointer)&keep_grab);

        XtAddCallback(yesno_popup, XmNhelpCallback, (XtCallbackProc)yesnoCB, (XtPointer)&keep_grab);
    }
    XtManageChild(yesno_popup);
    XtAddGrab(XtParent(yesno_popup), True, False);
    while (keep_grab || XtAppPending(app_con))
    {
        XtAppNextEvent(app_con, &event);
        XtDispatchEvent(&event);
    }
    return yesno_retval;
}
Exemplo n.º 14
0
void 
MakeDialog( DialogType dtype )
{
    register int i, j;

    int		width;
    
    FILE	*fp, *fopen();
    char	buffer[128];
    char	*str;

    Widget	w, text;
    Dimension	txt_width, txt_height;
    XmString	ok, cancel, nw, sv;

    Widget      tlev;

    /*
     *  do things common to all dialogs...
     */

    ok     = ReadCatalogXms(MC_LABEL_SET, MC_OK_LABEL, MC_DEF_OK_LABEL);
    cancel = ReadCatalogXms(MC_LABEL_SET, MC_CANCEL_LABEL, MC_DEF_CANCEL_LABEL);

    i = InitArg(MessageBox);
    XtSetArg(argt[i], XmNmarginHeight,		MBOX_MARGIN_HEIGHT	); i++;
    XtSetArg(argt[i], XmNmarginWidth,		MBOX_MARGIN_WIDTH	); i++;
    XtSetArg(argt[i], XmNshadowThickness,	SHADOW_THICKNESS	); i++;
    XtSetArg(argt[i], XmNokLabelString,		ok			); i++;
    XtSetArg(argt[i], XmNcancelLabelString,	cancel			); i++;
    XtSetArg(argt[i], XmNnoResize,		False			); i++;
    XtSetArg(argt[i], XmNresizePolicy,		XmRESIZE_ANY		); i++;

    /*
     *  create the various dialogs...
     */

    /* JET - check the matte widget, and if non-null, well use that as
     * the parent for dialogs.  Otherwise use table (the original
     * toplevel widget for this func).  This is useful for Xinerama so
     * that child dialogs are centered on the matte, and not the whole
     * SLS screen.
     */
    if (matte != (Widget)NULL)
      tlev = matte;
    else
      tlev = table;


    switch (dtype) {

    case error:
	xmstr = ReadCatalogXms(MC_ERROR_SET, MC_LOGIN, "");
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;

	w = XmCreateErrorDialog(tlev, "error_message", argt, i);
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

	error_message = w;
	break;


    case help:
	xmstr = ReadCatalogXms(MC_HELP_SET, MC_HELP, MC_DEF_HELP);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;
	w = XmCreateInformationDialog(tlev, "help_message", argt, i);
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

        txt_width = DisplayWidth (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_height = DisplayHeight (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_width = (txt_width > 850) ? 800 : txt_width - 50;
        txt_height = (txt_height > 900) ? 750 : txt_height - 150;
        i = InitArg(Text);
        XtSetArg(argt[i], XmNheight, txt_height); i++;
        XtSetArg(argt[i], XmNwidth, txt_width); i++;
        XtSetArg(argt[i], XmNeditMode, XmMULTI_LINE_EDIT); i++;
        XtSetArg(argt[i], XmNscrollBarDisplayPolicy, XmAS_NEEDED); i++;
        XtSetArg(argt[i], XmNscrollingPolicy, XmAUTOMATIC); i++;
        XtSetArg(argt[i], XmNeditable, False); i++;
	str = (char*) ReadCatalog(MC_HELP_SET, MC_HELP, MC_DEF_HELP);
        XtSetArg(argt[i], XmNvalue, strdup(str)); i++;
        text = XmCreateScrolledText(w, "help_message_text", argt, i);

        XtManageChild(text);
        XtManageChild(w);
        help_message = w;
	break;


    case copyright:
	if ((fp = fopen(COPYRIGHT,"r")) == NULL)
#if defined( __hp_osf )
	    xmstr = XmStringCreate("Cannot open copyright file '/usr/X11/copyright'.",
				XmFONTLIST_DEFAULT_TAG);
#else
	    xmstr = XmStringCreate("Cannot open copyright file '/etc/copyright'.",
				XmFONTLIST_DEFAULT_TAG);
#endif
	else {
	    xmstr = (XmString) NULL;
	
	    while (fgets(buffer, 128, fp) != NULL) {
		j = strlen(buffer);
		if ( buffer[j-1] == '\n' ) buffer[j-1] = '\0';
	    
		if ( xmstr != NULL )
		    xmstr = XmStringConcat(xmstr, XmStringSeparatorCreate());

		xmstr = XmStringConcat(xmstr,
	    			       XmStringCreate(buffer,
				       XmFONTLIST_DEFAULT_TAG));
	    }	    
	}

	fclose(fp);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;

	w = XmCreateInformationDialog(tlev, "copyright_msg", argt, i);
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
	
	XtAddCallback(w, XmNokCallback, CopyrightCB, (XtPointer) 0);    

	copyright_msg = w;
	break;
    

    case hostname:
	    
	nw = ReadCatalogXms(MC_LABEL_SET, MC_NW_LABEL,  MC_DEF_NW_LABEL);
	sv = ReadCatalogXms(MC_LABEL_SET, MC_START_LABEL, MC_DEF_START_LABEL);

	xmstr = ReadCatalogXms(MC_HELP_SET, MC_SYSTEM, MC_DEF_SYSTEM);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;
	XtSetArg(argt[i], XmNokLabelString,		nw		); i++;
	XtSetArg(argt[i], XmNcancelLabelString,		sv		); i++;

	w = XmCreateWarningDialog(tlev, "hostname_msg", argt, i);

	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

	XmStringFree(nw);
	XmStringFree(sv);

	hostname_message = w;
	break;


    case expassword:

	xmstr = ReadCatalogXms(MC_ERROR_SET, MC_PASSWD_EXPIRED, 
			    MC_DEF_PASSWD_EXPIRED);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;

	w = XmCreateQuestionDialog(tlev, "password_msg", argt, i);

	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

	passwd_message = w;
	break;


    case help_chooser:
	xmstr = ReadCatalogXms(MC_HELP_SET, MC_HELP_CHOOSER, MC_DEF_HELP_CHOOSER);

	w = XmCreateInformationDialog(tlev, "help_message", argt, i);
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

        txt_width = DisplayWidth (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_height = DisplayHeight (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_width = (txt_width > 850) ? 800 : txt_width - 50;
        txt_height = (txt_height > 900) ? 750 : txt_height - 150;
        i = InitArg(Text);
        XtSetArg(argt[i], XmNheight, txt_height); i++;
        XtSetArg(argt[i], XmNwidth, txt_width); i++;
        XtSetArg(argt[i], XmNeditMode, XmMULTI_LINE_EDIT); i++;
        XtSetArg(argt[i], XmNscrollBarDisplayPolicy, XmAS_NEEDED); i++;
        XtSetArg(argt[i], XmNscrollingPolicy, XmAUTOMATIC); i++;
        XtSetArg(argt[i], XmNeditable, False); i++;
        str = (char*)
	      ReadCatalog(MC_HELP_SET, MC_HELP_CHOOSER, MC_DEF_HELP_CHOOSER);
        XtSetArg(argt[i], XmNvalue, strdup(str)); i++;
        text = XmCreateScrolledText(w, "help_message_text", argt, i);

        XtManageChild(text);
        XtManageChild(w);
        help_message = w;
        break;
    }
Exemplo n.º 15
0
/* 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);
  
}
Exemplo n.º 16
0
void
InfoPop ( Widget parent,	int type,
	  char *message,	Boolean help,
	  Boolean cancel,	void (*HelpCB)(),
	  void (*CancelCB)() )
{
	Widget		dialog;
	XmString	xmstr;
	char		buf[4096];

	if ( message == NULL ) return;
/*
 *  Create an information dialog of the type requested in function call.
 */
	switch ( type ) {
	case ERROR:
	  dialog = XmCreateErrorDialog ( parent, "ERROR", NULL, 0 );
	  strcpy ( buf, "ERROR:\n" );
	break;
	  
	case INFORMATION:
	  dialog = XmCreateInformationDialog ( parent, "INFORMATION", NULL, 0 );
	  strcpy ( buf, "INFORMATION:\n" );
	break;

	case QUESTION:
	  dialog = XmCreateQuestionDialog ( parent, "QUESTION", NULL, 0 );
	  strcpy ( buf, "QUESTION:\n" );
	break;

	case WARNING:
	  dialog = XmCreateWarningDialog ( parent, "WARNING", NULL, 0 );
	  strcpy ( buf, "WARNING:\n" );
	break;

	case WORKING:
	  dialog = XmCreateWorkingDialog ( parent, "WORKING", NULL, 0 );
	  strcpy ( buf, "WORKING:\n" );
	break;

	default:
	break;
	}

/*
 *	Write message to dialog.
 */
	strcat ( buf, message );
	xmstr = XmStringCreateLtoR ( buf, XmFONTLIST_DEFAULT_TAG);
	XtVaSetValues ( dialog,
		XmNmessageString,	xmstr,
		NULL );

	XmStringFree ( xmstr );

/*
 *	Add callbacks to buttons or, alternatively, delete the buttons.
 */
	if ( !help ) XtUnmanageChild ( 
	    XmMessageBoxGetChild ( dialog, XmDIALOG_HELP_BUTTON ) );
	else
	    XtAddCallback ( dialog, XmNhelpCallback, HelpCB, NULL );

	if ( !cancel ) XtUnmanageChild (
	    XmMessageBoxGetChild ( dialog, XmDIALOG_CANCEL_BUTTON ) );
	else
	    XtAddCallback ( dialog, XmNcancelCallback, CancelCB, NULL );

/*
 *	Manage popup.
 */
	XtManageChild ( dialog );
	XtPopup ( XtParent ( dialog ), XtGrabNone );
}
Exemplo n.º 17
0
/* 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);
}