static void ForwardHTMLCB () { /* * Callback to step back to the previous HTML document. */ char *htext; char *file; int error, verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("ForwardHTMLCB\n"); /* * Read in the previous file. Read in last file if at end of list. */ file = ListNext ( historyList ); printf("Next file = %s\n", file ); if ( file == NULL ) file = ListTail ( historyList ); printf("Next file = %s\n", file ); htext = ReadHyperTextFile ( file, &error ); Free ( file ); HTMLSetText ( help.htlmWid, htext, NULL, NULL, 0, 0, NULL ); XtFree ( htext ); }
static void BackHTMLCB () { /* * Callback to step back to the previous HTML document. */ char *htext; char *file; int error, verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("BackHTMLCB\n"); /* * Read in the previous file. Read in the home page if there is none. */ file = ListPrev ( historyList ); printf("Back file = %s\n", file ); if ( file == NULL ) file = ListHead ( historyList ); printf("Back file = %s\n", file ); htext = ReadHyperTextFile ( file, &error ); Free ( file ); HTMLSetText ( help.htlmWid, htext, NULL, NULL, 0, 0, NULL ); XtFree ( htext ); }
void VPWindSymbolCB ( Widget w, XtPointer clientData, XtPointer call_data ) /* * Called when a model wind symbol button is picked. */ { GuiVertProfileObjectType *vpt; char *symbol; int verbose; ButtonObject *bo = (ButtonObject *) clientData; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "VPWindSymbolCB\n" ); vpt = GetGuiVertProfileDialog(); symbol = strdup ( bo->string ); FreeVectorSymbolVP ( vpt ); SetVectorSymbolVP ( vpt, symbol ); Free ( symbol ); return; }
void SFMarkerTypeCB ( Widget w, XtPointer clientData, XtPointer call_data ) { /* * This routine sets the surface marker type. */ GuiSfcObsDialogType *sfc; BooleanType verbose; char *marker_type; ButtonObject *bo = (ButtonObject *) clientData; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; verbose = GetVerboseLevel(); if ( verbose > VERBOSE_0 ) printf("SFMarkerTypeCB\n"); sfc = GetGuiSfcObsDialog(); /* * Set plot type. */ marker_type = strdup ( bo->string ); FreeSfcMarkerType ( sfc ); SetSfcMarkerType ( sfc, marker_type ); /* * Free. */ Free ( marker_type ); }
void ScalePanelCB ( Widget w, XtPointer clientData, XtPointer callData ) { GuiImgSelectDialogType *img; char *str; ButtonObject *bo = (ButtonObject *) clientData; XmToggleButtonCallbackStruct *cbs = ( XmToggleButtonCallbackStruct * ) callData; if ( GetVerboseLevel() > VERBOSE_0 ) printf("scalepanelcb\n"); if ( ! cbs->set ) return; /* * Build a new product panel. */ img = GetGuiImgSelectDialog(); RemoveButtonsFromPanel (GetImgProdPanelObj(img)); str = builddirpath ( bo->string, bo->label ); AddButtonsToPanel (GetImgProdPanelObj(img), ProductPanelCB, bo->i, str); SetImgScalePanelSetbutton(img, bo); /* * Clear out the file list panel. */ RemoveProductsFromList ( GetImgTimeListW(img) ); Free ( str ); }
/* * Redraws the line attributes sample line widget */ void RefreshLineAttributesSampleCB ( Widget w, XtPointer client_data, XtPointer xt_call_data ) { int width, type, color; Widget sample; GuiLineAttributesDialogType *atr; atr = GetGuiLineAttributesDialog(); width = GetLineAttributesWidth(atr); type = GetLineAttributesType(atr); color = GetLineAttributesColor(atr); sample = GetLineAttributesSampleW (atr); if (GetVerboseLevel() > VERBOSE_0 ) { printf("RefreshSampleLine() width: %d",width); printf(" type: %d",type); printf(" color: %d\n",color); } DrawSampleLine ( sample, color, type, width ) ; }
void ResetLutFileCB (Widget w, XtPointer client_data, XtPointer xt_call_data ) /* * Reset image Look Up Table. */ { int cbank, verbose; WindowObjectType *wo; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) xt_call_data; wo = GetActiveWindowObject(); /* * Get Gempak Color bank number. * -1 no image loaded * 1 satellite * 2 nids/nowrad */ cbank = GetGempakColorBank( wo ); verbose = GetVerboseLevel(); if( verbose > VERBOSE_1 ) { printf ("ResetLutFileCB, bank: %d", cbank ); } if ( cbank == -1 ) return; ResetImageColors ( wo, cbank ); }
/* * * Add a list of directory entries buttons to a RC widget. * * */ int AddButtonsToPanel ( ButtonParentObjectType *bpo, void (*func)(), int metObjectType, char *fulldirectorypath ) { int cnt, i, j, count; ButtonObject *bo; int argc; char **argv; int returnStatus; if ( GetVerboseLevel() > VERBOSE_0 ) printf("AddButtonsToPanel\n"); /* * Get the sorted directory listing... */ argc = readdirectory ( fulldirectorypath, &argv , NULL, NULL); if( argc <= 0 ) return ( 1 ); returnStatus = UpdateButtonPanel( bpo, func, metObjectType, fulldirectorypath, argc, argv); free ( argv ); return ( returnStatus ); }
int DisplayRadarRing( WindowObjectType *wo, MetObjectType *mot ) { RadarRingObjectType *mobj; MetObjectType *gmobj; int verbose, iret; mobj = (RadarRingObjectType *) mot->metObjectContent; assert( mobj ); verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "DisplayRadarRing\n" ); prring ( &mobj->nstn, mobj->stations, mobj->stid, mobj->lat, mobj->lon, &mobj->color, &mobj->number, &mobj->increment, &mobj->minimum, mobj->units, &verbose, &iret, strlen(mobj->stations), strlen(mobj->stid), strlen(mobj->units) ); SetMetObjectDrawnFlag( mot, True ); return(0); }
int DisplayLatLonGrid( WindowObjectType *wo, MetObjectType *mot ) { int verbose, iret; LatLonGridObjectType *lobj; lobj = (LatLonGridObjectType *) mot->metObjectContent; assert( lobj ); verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "DisplayLatLonGrid\n" ); pllgrid ( lobj->line_color, lobj->line_type, lobj->line_width, lobj->lat_inc, lobj->lon_inc, lobj->label_freq, &iret, strlen( lobj->line_color), strlen( lobj->line_type), strlen( lobj->line_width), strlen( lobj->lat_inc), strlen( lobj->lon_inc), strlen( lobj->label_freq)); SetMetObjectDrawnFlag( mot, True ); return(0); }
void StringListFree( int cnt, char **m ) { int i; int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "StringListFree" ); if( verbose > VERBOSE_1 ) { printf ( " cnt = %d,",cnt ); printf ( " *string = %x",m ); } if( verbose > VERBOSE_0 ) printf ( "\n" ); if( ! m ) return; /* * Free each non-null character string in the "m". */ for( i = 0; i < cnt; i++ ) if( m[i] ) Free( m[i] ); /* * Free the "m". */ Free ( m ); }
void RollEnhanceCB ( Widget w, XtPointer client_data, XtPointer xt_call_data ) { WindowObjectType *wo; int cbank; int scale; int verbose; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) xt_call_data; verbose = GetVerboseLevel(); wo = GetActiveWindowObject(); cbank = GetGempakColorBank( wo ); scale = cbs->value ; if( verbose > VERBOSE_1 ) printf ("RollEnhanceCB - value: %d", cbs->value ); if ( cbank == -1 ) return; RollColorEnhancement ( wo, cbank, scale ); if( DefaultDepthOfScreen(DefaultScreenOfDisplay(XtDisplay(w))) != 8 ) { RefreshDisplay ( ); /* Necessary for > 8-bit displays to redraw images with new pixel values reflecting new read-only color table entries */ } }
void VPLineTypeCB ( Widget w, XtPointer clientData, XtPointer call_data ) /* * Called when a model line type button is picked. */ { GuiVertProfileObjectType *vpt; char *linetype; int verbose; ButtonObject *bo = (ButtonObject *) clientData; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "VPLineTypeCB\n" ); vpt = GetGuiVertProfileDialog(); linetype = strdup ( bo->string ); FreeLineTypeVP ( vpt ); SetLineTypeVP ( vpt, linetype ); Free ( linetype ); return; }
void HelpCB ( Widget parent ) { char *file, *dpath; int verbose; /* * Callback to popup HTML dialog. */ verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("HelpCB\n"); dpath = GetConfigValue ("GarpHTML"); file = builddirpath ( dpath, home_html ); /* * Initialize hypertext file list. */ historyList = ListCreate(); if ( file ) ListAddEntry ( historyList, strdup(file) ); /* * Popup HTML dialog. */ XtManageChild ( help.dialog ); XtPopup ( XtParent ( help.dialog ), XtGrabNone); Free ( dpath ); Free ( file ); }
void FadeScaleCB (Widget w, XtPointer client_data, XtPointer xt_call_data ) { WindowObjectType *wo; int cbank; int scale; int fadeWid; int verbose; GuiImageEnhanceDialogType *img; Widget fadeW = NULL; XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) xt_call_data; fadeWid = (int) client_data; verbose = GetVerboseLevel(); wo = GetActiveWindowObject(); /* * Get Gempak Color bank number. * -1 no image loaded * 1 satellite * 2 nids/nowrad */ cbank = GetGempakColorBank( wo ); scale = cbs->value ; if( verbose > VERBOSE_1 ) printf ("FadeScaleCB - value: %d\n", cbs->value ); if ( cbank == -1 ) return; ChangeImageBrightness ( wo, cbank, scale ); if( DefaultDepthOfScreen(DefaultScreenOfDisplay(XtDisplay(w))) != 8 ) { RefreshDisplay ( ); /* Necessary for > 8-bit displays to redraw images with new pixel values reflecting new read-only color table entries */ } /* * Synchronize the fade slider controls. Set the one who did NOT * call this routine. */ img = GetGuiImageEnhanceDialog(); if ( fadeWid == MAIN_CONTROL_FADER ) fadeW = GetSatImageFadeScaleW ( img ); else if ( fadeWid == ENHANCE_POPUP_FADER ) fadeW = GetImageFadeScaleW ( img ); if( fadeW ) XtVaSetValues ( fadeW, XmNvalue, scale, NULL ); }
static void CrossingAnchorCB() { int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("CrossingAnchorCB\n"); }
static void add_list ( char *times, int *nt, char ***list, int *list_size, int *iret ) { char word[20], buf[80]; char *save_times; char **listp; char **tlist; int i; int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "add_list\n" ); *iret = NORMAL; save_times = times; /* * Return if there are no times to add. */ if ( *nt <= 0 ) return; if ( verbose > VERBOSE_1 ) { printf(" list_size = %d\n", *list_size ); printf(" nt = %d\n", *nt ); } if ( *list_size == 0 ) { *list = StringListAllocate ( MAX_LIST ); } tlist = *list; for (i=(*list_size), listp = &(tlist[*list_size]); i<(*list_size+*nt); i++) { next_word ( ×, word, iret ); *listp = (char *) malloc(strlen(word) + 1); strcpy(*listp, word ); if ( verbose > VERBOSE_1 ) { sprintf(buf, "add_list - %d %s", i, *listp); printf ( "%s\n", buf ); } listp++; } times = save_times; /* * Null terminate the array. */ *listp = (char *) NULL; }
char *GridInfoObjectToText( GridInfoObjectType *gio ) { int byteCount; int i; int verbose; GridType *gt; char *allText; int lineCount; char *tileFormatLine = "Count Time1 Time2 Level1 Level2 VCoord Field\n\n"; verbose = GetVerboseLevel(); byteCount = lineCount = 0; allText = malloc( (EXTRA_LINES + gio->numberOfGrids) * CHARS_PER_LINE ); if( ! allText ) { printf("*** GridInfoObjectToText: Malloc failed\n"); return( NULL ); } byteCount += sprintf(allText, "File is %s.\nNumber of Grids %d, maxPossibleGrids %d.\n", gio->fileName, gio->numberOfGrids, gio->maxPossibleGrids ); lineCount++; byteCount += sprintf( &(allText[byteCount]), tileFormatLine ); lineCount++; for( i = 0, gt = gio->gridList; i < gio->numberOfGrids; i++, gt++ ) { byteCount += sprintf(&(allText[byteCount]), "%5d %15s %15s %5d %5d %6s %6s\n", i, gt->time1, gt->time2, gt->levels[0], gt->levels[1], gt->verticalCoordinate, gt->gridField ); lineCount++; } if ( verbose > VERBOSE_1 ) { printf( " GridInfoObjectToText: %d lines", lineCount ); printf( "%d bytes\n", byteCount ); printf( " %s\n", allText ); } return( allText ); }
void VPVectorFdfDirCB (Widget w, XtPointer clientData, XtPointer xt_call_data ) /* * Called when a new FDF chapter is chosen. */ { GuiVertProfileObjectType *vpt; Widget vector_list; char *model, *chapter, *directory; int verbose; ButtonObject *bo = (ButtonObject *) clientData; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) xt_call_data; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "VPVectorFdfDirCB\n" ); vpt = GetGuiVertProfileDialog(); chapter = strdup ( bo->string ); /* * Save FDF chapter. */ FreeModelVPVectorDir ( vpt ); SetModelVPVectorDir ( vpt, chapter ); /* * Refill the scrolled list. */ vector_list = GetVectorListVPW( vpt ); XtUnmanageChild ( vector_list ); RemoveProductsFromList ( vector_list ); model = strdup ( GetModelTypeVP ( vpt ) ); directory = GetConfigValue( "vpvectorfdf" ); BuildFieldList ( vector_list, directory, chapter, model, &(vpt->vector_list) ); XtManageChild ( vector_list ); Free ( model ); Free ( chapter ); Free ( directory ); return; }
void ClearTextfieldCB(Widget w, XtPointer client_data, XtPointer xt_call_data) { BooleanType verbose; XmAnyCallbackStruct *call_data = (XmAnyCallbackStruct *) xt_call_data ; verbose = GetVerboseLevel(); if ( verbose > VERBOSE_0 ) printf("ClearTextfieldCB\n"); }
void SFPlotTypeCB ( Widget w, XtPointer clientData, XtPointer call_data ) { /* * This routine set the surface plot type and rebuilds the date/time * scrolled list. */ GuiSfcObsDialogType *sfc; BooleanType verbose; char *plot_type, *plot_label; ButtonObject *bo = (ButtonObject *) clientData; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; verbose = GetVerboseLevel(); if ( verbose > VERBOSE_0 ) printf("SFPlotTypeCB\n"); sfc = GetGuiSfcObsDialog(); /* * Set plot type. */ plot_type = strdup ( bo->string ); plot_label = strdup ( bo->label ); FreeGuiSfcObsType ( sfc ); SetGuiSfcObsType ( sfc, plot_type ); FreeGuiSfcObsLabel ( sfc ); SetGuiSfcObsLabel ( sfc, plot_label ); /* * Redraw station parameter textfield widgets. */ DefaultSfcParameters (); /* * Rebuild date/time scrolled list. */ SurfaceObsIconCB ( w, NULL, NULL ); /* * Free. */ Free ( plot_type ); Free ( plot_label ); }
int UpdateButtonPanel ( ButtonParentObjectType *bpo, void (*func)(), int metObjectType, char *fulldirectorypath, int argc, char **argv) { ButtonObject *bo; int cnt, i, j, count; if ( GetVerboseLevel() > VERBOSE_0 ) printf("UpdateButtonPanel\n"); cnt = bpo->button_cnt; if ( cnt < 0 || cnt > MAXBUTTONS ) return( 1 ); for ( bo = &(bpo->buttons[cnt]), i = 0; i < argc; i++, bo++ ) { bo->w = XtCreateManagedWidget (argv[i], xmToggleButtonWidgetClass, bpo->parent, NULL, 0 ); XtAddCallback ( bo->w, XmNvalueChangedCallback, func, bo ); /* * Fill in all the fields for this button object. Save the * metObjectType in the integer placeholder (i). */ bo->ismanaged = 1; bo->i = metObjectType; bo->string = strdup ( fulldirectorypath ); bo->label = argv[i]; /* * Each string will get free'd when button destroyed */ } bpo->button_cnt += argc; bpo->button_alloc_cnt = bpo->button_cnt; return ( 0 ); }
void DefaultSfcParametersCB (Widget w, XtPointer clientData, XtPointer call_data ) { BooleanType verbose; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; verbose = GetVerboseLevel(); if ( verbose > VERBOSE_0 ) printf("DefaultSfcParametersCB\n"); DefaultSfcParameters(); }
/////////////////////////////////////////////////////////////////////////////// // HandleNotify /////////////////////////////////////////////////////////////////////////////// void cUserNotifyStdout::HandleNotify( int level, const TCHAR* format, va_list& args ) { if(GetVerboseLevel() < level) return; // all verbose output now goes to stderr if(level < iUserNotify::V_VERBOSE) { _vtprintf(format, args); fflush( stdout ); } else { _vftprintf(stderr, format, args); fflush( stderr ); } }
void GetProfilerFiles ( char ***snfile, char *begin_time, int duration, ListParentObjectType *dattim_list, int *nfiles ) /* * Get a list of files which will be needed to plot the cross section. */ { AbsTime int_time, list_time; int i, j=0, iret; int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) { printf ( "GetProfilerFiles [duration %d]\n", duration ); printf ( "GetProfilerFiles [listcound %d]\n", dattim_list->listcount ); printf ( "begin time %s\n", begin_time); } for ( j=0; j<duration; j++ ) { for ( i=0; i<dattim_list->listcount; i++ ) { /* * Do comparisons in integer time. */ int_time = yyyymmddhhmm2sec ( begin_time ); int_time += j * SECONDS_PER_HOUR; list_time = yyyymmddhhmm2sec ( dattim_list->label[i] ); /*if ( int_time == list_time ) {*/ if ( ( int_time > ( list_time - SECONDS_PER_HOUR ) ) && ( int_time < ( list_time + SECONDS_PER_HOUR ) ) ) { if( verbose > VERBOSE_1 ) { printf("adding %d ?\n", i ); printf("adding %s ?\n", dattim_list->label[i] ); printf("adding %s ?\n", dattim_list->string[i] ); } /* * Add only new file to list. */ AddString ( 300, nfiles, snfile, dattim_list->string[i] ); break; } } } }
static void add_file ( char *infile, int *nt, char ***file, int *list_size, int *iret ) { char **filep; char **tfile; int i; int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "add_file\n" ); *iret = NORMAL; /* * Return if there are no file to add. */ if ( *nt <= 0 ) return; if ( verbose > VERBOSE_1 ) { printf(" list_size = %d\n", *list_size ); printf(" nt = %d\n", *nt ); } if ( *list_size == 0 ) { *file = StringListAllocate ( MAX_LIST ); /* *file = (char **) malloc (MAX_LIST * sizeof( char * ) ); */ } tfile = *file; for (i=(*list_size), filep = &(tfile[*list_size]); i<(*list_size+*nt); i++) { *filep = (char *) malloc(strlen(infile) + 1); strcpy(*filep, infile ); if ( verbose > VERBOSE_1 ) printf(" %s\n", *filep); filep++; } /* * Null terminate the array. */ /* *filep = (char *) NULL; */ }
void ImageIconCB (Widget w, XtPointer client_data, XtPointer xt_call_data ) { WindowObjectType *wo; ButtonObject *bo; GuiImgSelectDialogType *img; static Boolean first = True; XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) xt_call_data; wo = GetActiveWindowObject(); img = GetGuiImgSelectDialog(); if ( GetVerboseLevel() > VERBOSE_0 ) printf("ImageIconCB\n"); /* * Initiate busy cursor. */ SetupAbortProcess( wo ); /* * Build image source panel first time through */ if ( first ) { BuildImageSource ( GetImgSourcePanelObj(img) ); RemoveProductsFromList ( GetImgTimeListW(img) ); } /* * Update the scrolled file list if it has existed before */ bo = GetImgProdPanelSetbutton(img); if ( bo ) UpdateScrolledList( bo ); /* * Cancel busy cursor. */ CancelAbortProcess( wo, False ); first = False; }
/*--------------------------------------------------------------------------- This routine is adapted from Mosaic-2.0. We only read GIF files, for now. Written by HRL. Modified by COMET. ----------------------------------------------------------------------------*/ unsigned char *ReadBitmap(char *datafile,int *w,int *h,XColor *colrs,int *bg) { unsigned char *bit_data; FILE *fp; int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ( "ReadBitmap\n" ); *bg = -1; /* Obviously this isn't going to work. */ fp = fopen(datafile, "r"); if (fp != NULL) { bit_data = ReadGIF(fp, w, h, colrs); if (bit_data != NULL) { if (fp != stdin) fclose(fp); return(bit_data); } rewind(fp); /* bit_data = ReadXbmBitmap(fp, datafile, w, h, colrs); if (bit_data != NULL) { if (fp != stdin) fclose(fp); return(bit_data); } rewind(fp); bit_data = ReadXpm3Pixmap(fp, datafile, w, h, colrs, bg); if (bit_data != NULL) { if (fp != stdin) fclose(fp); return(bit_data); }*/ } if (fp != stdin) fclose(fp); return((unsigned char *)NULL); }
static void HomeHTMLCB () { /* * Return to homepage callback. */ WbAnchorCallbackData call_data; XtPointer client_data; int verbose; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("HomeHTMLCB\n"); call_data.href = strdup ( home_html ); HTMLRefCB ( help.htlmWid, client_data, &call_data ); Free ( call_data.href ); }
void ProfilerIconCB (Widget w, XtPointer client_data, XtPointer xt_call_data ) /* * This function is called when the user clicks on the wind profiler * icon or menu item. */ { GuiProfilerDialogType *wpf; WindowObjectType *wo; int nstn, nfiles, iret; int i, verbose; XmPushButtonCallbackStruct *call_data = (XmPushButtonCallbackStruct *) xt_call_data; verbose = GetVerboseLevel(); if( verbose > VERBOSE_0 ) printf ("ProfilerIconCB\n"); /* * Get dialog structure. */ wpf = GetGuiProfilerDialog(); wo = GetActiveWindowObject(); /* * Enguage busy cursor. */ SetupAbortProcess( wo ); /* * Get date/times and files. */ BuildProfilerList ( nfiles, &(wpf->dattim_list) ); /* * Cancel busy cursor. */ CancelAbortProcess( wo, False ); }