/* gui.c */ /* * Vis5D system for visualizing five dimensional gridded data sets. * Copyright (C) 1990 - 2000 Bill Hibbard, Johan Kellum, Brian Paul, * Dave Santek, and Andre Battaiola. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * As a special exception to the terms of the GNU General Public * License, you are permitted to link Vis5D with (and distribute the * resulting source and executables) the LUI library (copyright by * Stellar Computer Inc. and licensed for distribution with Vis5D), * the McIDAS library, and/or the NetCDF library, where those * libraries are governed by the terms of their own licenses. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "../config.h" #include #include #include #include #include #include #include #include #include "../lui5/lui.h" #include "../lui5/pixmaps.h" #include "analysis.h" #include "api.h" #include "cursor.h" #include "displaywidget.h" #include "graphics.h" /*TODO: remove this!!!! */ #include "gui.h" #include "labels.h" #include "slice.h" #include "script.h" #include "tclsave.h" #include "main_i.h" #include "imain.h" #include "igui.h" #include "rgbsliders.h" #include "isocolor.h" #include "uvwwidget.h" #include "mwmborder.h" #include "sounding.h" #include "soundingGUI.h" #define MM_NORMAL 1 #define MM_TRAJ 2 #define MM_LABEL 3 #define MM_SLICE 4 #define MM_PROBE 5 #define MM_SOUND 6 #define MM_CLIP 7 #define MM_MAX 69 static GuiContext gtx_table[VIS5D_MAX_CONTEXTS]; /*****************************************************************/ /* New 5.0 stuff that may or may not be relavent later */ /*****************************************************************/ static int keystatus = 0; static int currentkey= 0; static int key1status = 0; static int key2status = 0; static int key3status = 0; static int key4status = 0; static int key5status = 0; static int key6status = 0; static int key7status = 0; static int key8status = 0; static int key9status = 0; static Window keywin = 0; static LUI_NEWLABEL *keylabel = NULL; static LUI_NEWBUTTON *keyexit = NULL; static void group_event( int gindex, int type, int status ); static int do_one_time[VIS5D_MAX_DPY_CONTEXTS]; static int do_once = 1; int top_margin = 0; int bottom_margin = 0; int left_margin = 0; int right_margin = 0; char title_string[MAX_TITLES][200]; int title_x_position[MAX_TITLES]; int title_y_position[MAX_TITLES]; char title_font[MAX_TITLES][200]; int number_of_titles = 0; int redo_the_gui = 0; /* WLH 11 Nov 98 */ int redo_this_gui[VIS5D_MAX_DPY_CONTEXTS]; char the_gui_dpy_name[1000]; /* MJK 12.04.98 */ int update_linked_slices_sliders (int index, int type, int num); int set_window_decor (Display *dpy, Window win); int set_window_decor_all (int index); /* MJK 12.04.98 begin */ int cb_chvar[VIS5D_MAX_DPY_CONTEXTS]; int cb_chvindex[VIS5D_MAX_DPY_CONTEXTS]; int cb_chvvar[VIS5D_MAX_DPY_CONTEXTS]; int cb_dindex = 0; /* MJK 12.07.98 */ static int mode_cb( LUI_BUTTON *pb ); static int reverse_cb( LUI_NEWBUTTON *pb ); void hide_colorbar_window( int index ); void hide_chcolorbar_window( int index ); static void map_map_window (int index, int state); static int tp_close_color_cb( LUI_NEWBUTTON *b); static int tp_monocolor_cb( LUI_NEWBUTTON *b); static int tp_multicolor_cb( LUI_NEWBUTTON *b); int tp_dindex = 0; /* MJK 12.04.98 begin */ void mod_vpos_slider (int index, LUI_NEWSLIDER *s, int ivar, int is_wind, float lev) { float xmin, xmax, ymin, ymax, zmin, zmax, hgtmin, hgtmax; float hgt, x, y, z, lat, lon, vertargs[MAXVERTARGS]; int itime, vertsys, itop, ibot, nr, nc; char label[20]; GuiContext gtx = get_gui_gtx (index); if (is_wind) { int u1, v1, w1, u2, v2, w2, ut, vt, wt; vis5d_get_wind_vars (index, >x->u1owner, &u1, >x->v1owner, &v1, >x->w1owner, &w1, >x->u2owner, &u2, >x->v2owner, &v2, >x->w2owner, &w2, >x->tuowner, &ut, >x->tvowner, &vt, >x->twowner, &wt); ivar = (ivar == 0) ? u1 : u2; } if (ivar < 0) ivar = 0; vis5d_get_dtx_timestep (index, &itime); vis5d_gridPRIME_to_xyzPRIME (index, itime, ivar, 0.0, 0.0, lev, &x, &y, &z); vis5d_xyzPRIME_to_geo (index, itime, ivar, x, y, z, &lat, &lon, &hgt); vis5d_get_box_bounds (index, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax); vis5d_xyzPRIME_to_geo (index, itime, ivar, xmin, ymin, zmin, &lat, &lon, &hgtmin); vis5d_xyzPRIME_to_geo (index, itime, ivar, xmax, ymax, zmax, &lat, &lon, &hgtmax); label[0] = '\0'; if (s == gtx->map_pos_slider) strcat (label, "Map "); vis5d_get_dtx_vertical (index, &vertsys, vertargs); if (vertsys == VERT_NONEQUAL_MB) { strcat (label, "Level"); LUI_NewSliderChange (s, label, "mb", height_to_pressure (hgtmax), height_to_pressure (hgtmin), height_to_pressure (hgt)); } else { strcat (label, "Height"); LUI_NewSliderChange (s, label, "km", hgtmin, hgtmax, hgt); } } int check_map_color (int index) { GuiContext gtx = get_gui_gtx (index); int cur_map; float bg, r, g, b, a; int vindex = gtx->array_of_ctxs[0]; if (!vis5d_graphics_mode (index, VIS5D_MAP, VIS5D_GET)) return 0; bg = vis5d_graphics_mode (index, VIS5D_REVERSE, VIS5D_GET); cur_map = -1; if (vis5d_enable_sfc_map (index, VIS5D_GET)) { if (!vis5d_graphics_mode (index, VIS5D_TOPO, VIS5D_GET)) { vis5d_get_color (index, VIS5D_DARK_MAP, 0, &r, &g, &b, &a); if ((r == bg) && (g == bg) && (b == bg)) cur_map = VIS5D_DARK_MAP; } } else { vis5d_get_color (index, VIS5D_LIGHT_MAP, 0, &r, &g, &b, &a); if ((r == bg) && (g == bg) && (b == bg)) cur_map = VIS5D_LIGHT_MAP; } if (cur_map != -1) { int cur_rgb, cur_var; float fg; fg = 1.0 - bg; vis5d_set_color (index, cur_map, 0, fg, fg, fg, 1.0); LUI_ButtonColor (gtx->map_button, fg, fg, fg); get_current_rgbsliders (gtx, &cur_rgb, &cur_var); if (cur_rgb == cur_map) refresh_rgb_sliders2 (gtx); } vis5d_signal_redraw (gtx->context_index, 1); return 0; } /* MJK 12.04.98 end */ GuiContext get_gui_gtx( int index ) { GuiContext gtx; if ((gtx = gtx_table[index]) == NULL || index<0 || index>=VIS5D_MAX_CONTEXTS) { printf("bad gui_context\n"); return NULL; } return gtx; } GuiContext get_gui_gtx2( int index ) { GuiContext gtx; if ((gtx = gtx_table[index]) == NULL || index<0 || index>=VIS5D_MAX_CONTEXTS) { return NULL; } return gtx; } /* * Deallocate a context and everything it points to. */ void destroy_gui_context( GuiContext gtx ) { if (gtx->fakewin){ XDestroyWindow( GuiDpy, gtx->fakewin); } if (gtx->CloneWindow){ XDestroyWindow( GuiDpy, gtx->CloneWindow); } if (gtx->IsoWindow){ XDestroyWindow( GuiDpy, gtx->IsoWindow); } if (gtx->HSliceWindow){ XDestroyWindow( GuiDpy, gtx->HSliceWindow); } if (gtx->VSliceWindow){ XDestroyWindow( GuiDpy, gtx->VSliceWindow); } if (gtx->WindWindow){ XDestroyWindow( GuiDpy, gtx->WindWindow); } if (gtx->ExprWindow){ XDestroyWindow( GuiDpy, gtx->ExprWindow); } if (gtx->SaveWindow){ XDestroyWindow( GuiDpy, gtx->SaveWindow); } if (gtx->SaveFileWindow){ XDestroyWindow( GuiDpy, gtx->SaveFileWindow); } if (gtx->RestoreWindow){ XDestroyWindow( GuiDpy, gtx->RestoreWindow); } if (gtx->SavePicWindow){ XDestroyWindow( GuiDpy, gtx->SavePicWindow); } if (gtx->SaveSceneWindow){ XDestroyWindow( GuiDpy, gtx->SaveSceneWindow); } if (gtx->TrajWindow){ XDestroyWindow( GuiDpy, gtx->TrajWindow); } if (gtx->sm1){ XDestroyWindow( GuiDpy, gtx->sm1); } if (gtx->sm2){ XDestroyWindow( GuiDpy, gtx->sm2); } if (gtx->sm3){ XDestroyWindow( GuiDpy, gtx->sm3); } if (gtx->SoundCtrlWindow){ XDestroyWindow( GuiDpy, gtx->SoundCtrlWindow); } if (gtx->VerifyWindow){ XDestroyWindow( GuiDpy, gtx->VerifyWindow); } if (gtx->AlertWindow){ XDestroyWindow( GuiDpy, gtx->AlertWindow); } if (gtx->GroupWindow){ XDestroyWindow( GuiDpy, gtx->GroupWindow); } if (gtx->rgb_sliders_window){ XDestroyWindow( GuiDpy, gtx->rgb_sliders_window); } if (gtx->isocolor_subwin1){ XDestroyWindow( GuiDpy, gtx->isocolor_subwin1); } if (gtx->isocolor_subwin2){ XDestroyWindow( GuiDpy, gtx->isocolor_subwin2); } if (gtx->error_window){ XDestroyWindow( GuiDpy, gtx->error_window); } if (gtx->isocolor_window){ XDestroyWindow( GuiDpy, gtx->isocolor_window); } if (gtx->display_window){ XDestroyWindow( GuiDpy, gtx->display_window); } if (gtx->uvw_window){ XDestroyWindow( GuiDpy, gtx->uvw_window); } if (gtx->CpWindow){ XDestroyWindow( GuiDpy, gtx->CpWindow); } free( gtx ); } /* * Allocate a new vis5d context, initialize to default values. */ GuiContext create_gui_context( int index ) { GuiContext gtx; static int first_time = 1; if (first_time) { int i; for (i=0;icontext_index = index; } return gtx; } static int cb_graphic[VIS5D_MAX_DPY_CONTEXTS]; static int cb_var[VIS5D_MAX_DPY_CONTEXTS]; static int cb_vindex[VIS5D_MAX_DPY_CONTEXTS]; static int cb_vvar[VIS5D_MAX_DPY_CONTEXTS]; Display *GuiDpy; /* The X display for the GUI */ int GuiScr; /* The X screen number for the GUI */ Visual *GuiVisual; /* The X visual for the GUI */ Colormap GuiColormap; /* The X colormap for the GUI */ int GuiDepth; /* The depth of the GUI visual */ Window GuiBigWin; /* Big Fake Win for seperate dpy */ int GuiBigWinWidth; int GuiBigWinHeight; int Current_GuiBigWin_Width; int Current_GuiBigWin_Height; int Current_GuiBigWin_x; int Current_GuiBigWIn_y; int Being_Resized_From_X_Loop; #define BW 6 #define BUTTONSIZE 93 /* Width of regular buttons */ #define RADIOSIZE 120 /* Width of radio buttons */ /* depends on window border size: */ #ifdef stellar # define SPACE 15 #else # define SPACE 40 #endif /* * List of external functions and expressions per context. */ static int NumFuncs[VIS5D_MAX_DPY_CONTEXTS]; static int FuncType[VIS5D_MAX_DPY_CONTEXTS][MAX_FUNCS]; static char FuncName[VIS5D_MAX_DPY_CONTEXTS][MAX_FUNCS][1000]; static int FuncOwner[VIS5D_MAX_DPY_CONTEXTS][VIS5D_MAX_CONTEXTS]; static char *Copyright[] = { " Vis5D version " VERSION " Copyright (C) 1990 - 2000 ", " Bill Hibbard, Johan Kellum, Brian Paul ", " and Andre Battaiola " }; static char *ModeInfo1[] = { " Change the Viewing Angle ", " ", " Mouse Buttons ", "--------------------------", " rotate | zoom & | trans- ", " view | clip | late " }; static char *ModeInfo2[] = { " Make & View Trajectories ", " ", " Mouse Buttons ", "--------------------------", " rotate | make | move ", " view | trajec | cursor " }; static char *ModeInfo3[] = { " Make & Edit Text Labels ", " ", " Mouse Buttons ", "--------------------------", " make | move | delete ", " label | label | label " }; static char *ModeInfo4[] = { " Change Slice Positions ", " ", " Mouse Buttons ", "--------------------------", " rotate | zoom & | move ", " view | clip | slice " }; static char *ModeInfo5[] = { " Probe Data With Cursor ", " ", " Mouse Buttons ", "--------------------------", " rotate | zoom & | move ", " view | clip | cursor " }; static char *ModeInfo6[] = { " Change Clipping Plane ", " Positions ", " Mouse Buttons ", "--------------------------", " rotate | toggle | move ", " view | planes | planes ", }; static char v5dfile[1000]; static int new_function_cb( LUI_NEWBUTTON *pb, int state ); void init_irregular_var_colortable( GuiContext gtx, int varowner, int var ) { int index; unsigned int *table; float *p; index = gtx->context_index; /* Textplots */ vis5d_get_color_table_params( index, VIS5D_TEXTPLOT, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_TEXTPLOT, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, -2 ); vis5d_color_table_set_alpha( p, 255 ); vis5d_color_table_recompute( table, 256, p, 1, 1 ); } static void init_var_colortable( GuiContext gtx, int varowner, int var ) { int index; unsigned int *table; float *p; index = gtx->context_index; /* Isosurfaces */ vis5d_get_color_table_params( index, VIS5D_ISOSURF, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_ISOSURF, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, 255 ); vis5d_color_table_recompute( table, 256, p, 1, 1 ); /* CHSlices */ vis5d_get_color_table_params( index, VIS5D_CHSLICE, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_CHSLICE, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, -2 ); /* MJK 2.8.99 vis5d_color_table_set_alpha( p, 255 ); */ vis5d_color_table_recompute( table, 256, p, 1, 1 ); /* CVSlices */ vis5d_get_color_table_params( index, VIS5D_CVSLICE, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_CVSLICE, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, -2 ); /* MJK 2.8.99 vis5d_color_table_set_alpha( p, 255 ); */ vis5d_color_table_recompute( table, 256, p, 1, 1 ); /* Volumes */ vis5d_get_color_table_params( index, VIS5D_VOLUME, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_VOLUME, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, -1 ); vis5d_color_table_recompute( table, 256, p, 1, 1 ); /* Trajectories */ vis5d_get_color_table_params( index, VIS5D_TRAJ, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_TRAJ, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, 255 ); vis5d_color_table_recompute( table, 256, p, 1, 1 ); /* Topography */ vis5d_get_color_table_params( index, VIS5D_TOPO, varowner, var, &p); vis5d_get_color_table_address( index, VIS5D_TOPO, varowner, var, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, 255 ); vis5d_color_table_recompute( table, 256, p, 1, 1 ); } void init_colortables( int index ) { int yo, spandex, howmany, whichones[VIS5D_MAX_CONTEXTS]; GuiContext gtx = get_gui_gtx(index); int var, numvars; float *p; vis5d_get_num_of_ctxs_in_display( index, &howmany, whichones); for (yo = 0; yo < howmany; yo++){ spandex = whichones[yo]; vis5d_get_ctx_numvars( spandex, &numvars); for (var=0;var= 1){ unsigned int *table; spandex = whichones[0]; vis5d_get_color_table_params( index, VIS5D_TOPO, whichones[0], -1, &p); vis5d_get_color_table_address( index, VIS5D_TOPO, whichones[0], -1, &table ); vis5d_color_table_init_params( p, 1, 1 ); vis5d_color_table_set_alpha( p, 255 ); vis5d_color_table_recompute( table, 256, p, 1, 1 ); vis5d_reset_topo_colors( index ); } } void init_some_colortables( int dindex, int vindex ) { GuiContext gtx = get_gui_gtx(dindex); int var, numvars; vis5d_get_ctx_numvars( vindex, &numvars); for (var=0;varcontext_index; GuiContext gtx = get_gui_gtx(index); verify_value = 1; return 0; } static int OK_cb( LUI_NEWBUTTON *pb ) { int index = pb->context_index; GuiContext gtx = get_gui_gtx(index); alrighty_value = 1; return 0; } static int cancel_cb( LUI_NEWBUTTON *pb ) { int index = pb->context_index; GuiContext gtx = get_gui_gtx(index); verify_value = 0; return 0; } /*** verify *********************************************************** Open the verification window with a prompt asking the user to specify either an OK or CANCEL. Input: prompt - a string which asks the user what he wants to do. Ex: "Do you want to exit?" Returned: 1 = OK selected 0 = CANCEL selected **********************************************************************/ int verify( int index, char *prompt ) { XEvent pe; GuiContext gtx = get_gui_gtx(index); LUI_NewLabelChangeText( gtx->VerifyLabel, prompt ); verify_value = -1; XMapWindow( GuiDpy, gtx->VerifyWindow ); while (verify_value < 0) { if (XPending(GuiDpy)) { XNextEvent(GuiDpy, &pe); LUI_EventDispatch(&pe); } } XUnmapWindow( GuiDpy, gtx->VerifyWindow ); XSync( GuiDpy, 0 ); vis5d_signal_redraw(index, 1); return(verify_value); } int alrighty( int index, char *prompt ) { XEvent pe; GuiContext gtx = get_gui_gtx(index); LUI_NewLabelChangeText( gtx->OKLabel, prompt ); alrighty_value = -1; XMapWindow( GuiDpy, gtx->OKWindow ); while (alrighty_value < 0) { if (XPending(GuiDpy)) { XNextEvent(GuiDpy, &pe); LUI_EventDispatch(&pe); } } XUnmapWindow( GuiDpy, gtx->OKWindow ); XSync( GuiDpy, 0 ); return(alrighty_value); } int show_group_color_key( char *prompt ) { Window box1; LUI_NEWLABEL *eq1; if (keywin == 0){ keywin = LUI_CreateWindowAt( LUI_RootWindow, 100, 200, 300, 160); XMapWindow(GuiDpy, keywin); /* keylabel = LUI_NewLabelCreate(keywin, LUI_LEFT, LUI_TOP, 300, 55, "nil" );*/ box1 = XCreateSimpleWindow(GuiDpy, keywin, 10, 10, 40, 40, 1, LUI_AllocateColorInt(0,0,0), LUI_AllocateColorInt(255, 0, 255)); XMapWindow(GuiDpy, box1); eq1 = LUI_NewLabelCreate(keywin, 55,20,20,20,"=1"); keyexit = LUI_PushButtonCreate(keywin, 230, 60, 60, 30, "Close"); } /* LUI_NewLabelChangeText( keylabel, prompt);*/ XMapWindow(GuiDpy, keywin); return 0; } void set_current_display( int cur ) { Current_Display = cur; } void get_current_display( int *cur ) { *cur = Current_Display; } /*** alert *********************************************************** Open the alert window with a message and wait until the user clicks on "OK". Input: prompt - a message string **********************************************************************/ int alert( int index, char *prompt ) { XEvent pe; GuiContext gtx = get_gui_gtx(index); if (gtx->AlertLabel == NULL ) return 0; LUI_NewLabelChangeText( gtx->AlertLabel, prompt ); verify_value = -1; XMapWindow( GuiDpy, gtx->AlertWindow ); while (verify_value < 0) { if (XPending(GuiDpy)) { XNextEvent(GuiDpy, &pe); LUI_EventDispatch(&pe); } } XUnmapWindow( GuiDpy, gtx->AlertWindow ); vis5d_signal_redraw(index, 1); return 1; } void set_display_border_color( int index, int R, int G, int B) { unsigned long bumber; GuiContext gtx = get_gui_gtx(index); #ifdef NO_BORDERS XSetWindowBorderWidth( GfxDpy, get_win(index), 0); #else XSetWindowBorderWidth( GfxDpy, get_win(index), 1); #endif gtx->borderR = R; gtx->borderG = G; gtx->borderB = B; XSync(GfxDpy, 0); bumber = SND_AllocateColorInt(R, G, B); XSetWindowBorder( GfxDpy, get_win(index), bumber); } void get_display_border_color( int index, int *R, int *G, int *B) { GuiContext gtx = get_gui_gtx(index); *R = gtx->borderR; *G = gtx->borderG; *B = gtx->borderB; } void set_display_matrix( int rows, int cols ) { DisplayRows = rows; DisplayCols = cols; } void get_display_matrix( int *rows, int *cols ) { *rows = DisplayRows; *cols = DisplayCols; } void unmap_all_windows( void ) { int y; GuiContext gtx; for (y = 0; y < VIS5D_MAX_DPY_CONTEXTS; y++){ vis5d_unmap_3d_window(y); } } void enable_gui_button_windows( int vindex, int dindex, int type, int num, int mode) { GuiContext gtx = get_gui_gtx(dindex); if (type == VIS5D_HWIND){ if (mode != 0){ if (num == 0){ LUI_ButtonSetState(gtx->hwind1BUTTON,1); } else{ LUI_ButtonSetState(gtx->hwind2BUTTON,1); } gtx->cur_hwind = num; gtx->cur_hstream = -1; gtx->cur_hwindmap = 1; gtx->cur_hstreammap = 0; } else{ if (num == 0){ LUI_ButtonSetState(gtx->hwind1BUTTON,0); } else{ LUI_ButtonSetState(gtx->hwind2BUTTON,0); } gtx->cur_hwind = -1; gtx->cur_hwindmap = 0; } } else if (type == VIS5D_VWIND){ if (mode != 0){ if (num == 0){ LUI_ButtonSetState(gtx->vwind1BUTTON,1); } else{ LUI_ButtonSetState(gtx->vwind2BUTTON,1); } gtx->cur_vwind = num; gtx->cur_vstream = -1; gtx->cur_vwindmap = 1; gtx->cur_vstreammap = 0; } else{ if (num == 0){ LUI_ButtonSetState(gtx->vwind1BUTTON,0); } else{ LUI_ButtonSetState(gtx->vwind2BUTTON,0); } gtx->cur_vwind = -1; gtx->cur_vwindmap = -1; } } else if (type == VIS5D_HSTREAM){ if (mode != 0){ LUI_ButtonSetState(gtx->hstreamBUTTON,1); gtx->cur_hwind = -1; gtx->cur_hstream = num; gtx->cur_hwindmap = 0; gtx->cur_hstreammap = 1; } else{ gtx->cur_hstream = -1; gtx->cur_hstreammap = -1; } } else if (type == VIS5D_VSTREAM){ if (mode != 0){ LUI_ButtonSetState(gtx->vstreamBUTTON,1); gtx->cur_vwind = -1; gtx->cur_vstream = num; gtx->cur_vwindmap = 0; gtx->cur_vstreammap = 1; } else{ LUI_ButtonSetState(gtx->vstreamBUTTON,0); } } else{ if (type == VIS5D_HSLICE){ if (mode != 0){ gtx->cur_hslice = num; gtx->cur_hslicevindex = vindex; gtx->cur_hslicemap = 1; } else{ if (gtx->cur_hslice == num && gtx->cur_hslicevindex == vindex){ gtx->cur_hslice = -1; gtx->cur_hslicevindex = -1; gtx->cur_hslicemap = 0; } } } else if (type == VIS5D_VSLICE){ if (mode != 0){ gtx->cur_vslice = num; gtx->cur_vslicevindex = vindex; gtx->cur_vslicemap = 1; } else{ if (gtx->cur_vslice == num && gtx->cur_vslicevindex == vindex){ gtx->cur_vslice = -1; gtx->cur_vslicevindex = -1; gtx->cur_vslicemap = 0; } } } else if (type == VIS5D_CHSLICE){ if (mode != 0){ cb_chvindex[dindex] = vindex; cb_chvvar[dindex] = num; cb_chvar[dindex] = get_button_gtx_index(dindex, vindex, num); } else{ if (cb_chvindex[dindex] == vindex && cb_chvvar[dindex] == num && cb_chvar[dindex] == get_button_gtx_index(dindex,vindex, num)){ cb_chvindex[dindex] = -1; cb_chvvar[dindex] = -1; cb_chvar[dindex] = -1; } } } else if (type == VIS5D_CVSLICE){ if (mode != 0){ cb_vindex[dindex] = vindex; cb_vvar[dindex] = num; cb_var[dindex] = get_button_gtx_index(dindex, vindex, num); cb_graphic[dindex]= VIS5D_CVSLICE; } else{ if (cb_vindex[dindex] == vindex && cb_vvar[dindex] == num && cb_var[dindex] == get_button_gtx_index(dindex,vindex, num)){ cb_vindex[dindex] = -1; cb_vvar[dindex] = -1; cb_var[dindex] = -1; cb_graphic[dindex]= -1; } } } else if (type == VIS5D_ISOSURF){ if (mode != 0){ gtx->cur_isosurf = num; gtx->cur_isosurfvindex = vindex; gtx->cur_isosurfmap = 1; } else{ if (gtx->cur_isosurf == num && gtx->cur_isosurfvindex == vindex){ gtx->cur_isosurf = -1; gtx->cur_isosurfvindex = -1; gtx->cur_isosurfmap = 0; } } } else if (type == VIS5D_VOLUME){ vis5d_get_volume(dindex, >x->CurrentVolumeOwner, >x->CurrentVolume); if (mode != 0){ gtx->CurrentVolume = num; gtx->CurrentVolumeOwner = vindex; cb_vindex[dindex] = vindex; cb_vvar[dindex] = num; cb_var[dindex] = get_button_gtx_index(dindex, vindex, num); cb_graphic[dindex]= VIS5D_VOLUME; } else{ if (gtx->CurrentVolume == num && gtx->CurrentVolumeOwner == vindex){ gtx->CurrentVolume = -1; gtx->CurrentVolumeOwner = -1; cb_vindex[dindex] = -1; cb_vvar[dindex] = -1; cb_var[dindex] = -1; cb_graphic[dindex]= -1; } } } } } void enable_and_make_gui_button_graphics( int vindex, int dindex, int type, int num, int mode) { GuiContext gtx = get_gui_gtx(dindex); int curtime, numtimes, time, times; if (type == VIS5D_HWIND){ if (mode != 0){ vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_HWIND, num, VIS5D_ON); vis5d_get_dtx_timestep(dindex, &curtime); vis5d_get_dtx_numtimes(dindex, &numtimes); for (time=0;timearray_of_ctxs[0], VIS5D_HWIND, num, VIS5D_OFF); } vis5d_invalidate_dtx_frames(dindex); } else if (type == VIS5D_VWIND){ if (mode != 0){ vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_VWIND, num, VIS5D_ON); vis5d_get_dtx_timestep(dindex, &curtime); vis5d_get_dtx_numtimes(dindex, &numtimes); for (time=0;timearray_of_ctxs[0], VIS5D_VWIND, num, VIS5D_OFF); } vis5d_invalidate_dtx_frames(dindex); } else if (type == VIS5D_HSTREAM){ if (mode != 0){ vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_HSTREAM, num, VIS5D_ON); vis5d_get_dtx_timestep(dindex, &curtime); vis5d_get_dtx_numtimes(dindex, &numtimes); for (time=0;timearray_of_ctxs[0], VIS5D_HSTREAM, num, VIS5D_OFF); } vis5d_invalidate_dtx_frames(dindex); } else if (type == VIS5D_VSTREAM){ if (mode != 0){ vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_VSTREAM, num, VIS5D_ON); vis5d_get_dtx_timestep(dindex, &curtime); vis5d_get_dtx_numtimes(dindex, &numtimes); for (time=0;timearray_of_ctxs[0], VIS5D_VSTREAM, num, VIS5D_OFF); } vis5d_invalidate_dtx_frames(dindex); } else{ if (type == VIS5D_HSLICE){ if (mode != 0){ vis5d_enable_graphics(vindex, VIS5D_HSLICE, num, VIS5D_ON); vis5d_get_ctx_numtimes( vindex, &numtimes ); vis5d_get_ctx_timestep( vindex, &curtime); for ( times = 0; times < numtimes; times++){ vis5d_make_hslice( vindex, times, num, times==curtime); } } else{ vis5d_enable_graphics(vindex, VIS5D_HSLICE, num, VIS5D_OFF); } } else if (type == VIS5D_VSLICE){ if (mode != 0){ vis5d_enable_graphics(vindex, VIS5D_VSLICE, num, VIS5D_ON); vis5d_get_ctx_numtimes( vindex, &numtimes ); vis5d_get_ctx_timestep( vindex, &curtime); for ( times = 0; times < numtimes; times++){ vis5d_make_vslice( vindex, times, num, times==curtime); } } else{ vis5d_enable_graphics(vindex, VIS5D_VSLICE, num, VIS5D_OFF); } } else if (type == VIS5D_CHSLICE){ if (mode != 0){ vis5d_enable_graphics(vindex, VIS5D_CHSLICE, num, VIS5D_ON); vis5d_get_ctx_numtimes( vindex, &numtimes ); vis5d_get_ctx_timestep( vindex, &curtime); for ( times = 0; times < numtimes; times++){ vis5d_make_chslice( vindex, times, num, times==curtime); } } else{ vis5d_enable_graphics(vindex, VIS5D_CHSLICE, num, VIS5D_OFF); } } else if (type == VIS5D_CVSLICE){ if (mode != 0){ vis5d_enable_graphics(vindex, VIS5D_CVSLICE, num, VIS5D_ON); vis5d_get_ctx_numtimes( vindex, &numtimes ); vis5d_get_ctx_timestep( vindex, &curtime); for ( times = 0; times < numtimes; times++){ vis5d_make_cvslice( vindex, times, num, times==curtime); } } else{ vis5d_enable_graphics(vindex, VIS5D_CVSLICE, num, VIS5D_OFF); } } else if (type == VIS5D_ISOSURF){ if (mode != 0){ vis5d_enable_graphics(vindex, VIS5D_ISOSURF, num, VIS5D_ON); vis5d_get_ctx_numtimes( vindex, &numtimes ); vis5d_get_ctx_timestep( vindex, &curtime); for ( times = 0; times < numtimes; times++){ vis5d_make_isosurface( vindex, times, num, times==curtime); } } else{ vis5d_enable_graphics(vindex, VIS5D_ISOSURF, num, VIS5D_OFF); } } else if (type == VIS5D_VOLUME){ int cvo, cv; vis5d_get_volume(dindex, &cvo, &cv); if (mode != 0){ if ((cvo != vindex || cv != num) && cvo != -1){ vis5d_enable_graphics(cvo, VIS5D_VOLUME, cv, VIS5D_OFF); } vis5d_enable_graphics(vindex, VIS5D_VOLUME, num, VIS5D_ON); gtx->CurrentVolume = num; gtx->CurrentVolumeOwner = vindex; vis5d_set_volume( dindex, vindex, num); } else{ if (cv == num && cvo == vindex){ vis5d_set_volume( dindex, -1, -1); } } } } } /* HERE */ int update_linked_buttons( int vindex, int dindex, int type, int var, int state ) { int *next_vindex, *next_type, *next_var; int cur_dindex, cur_vindex, cur_type, cur_var; int do_once; GuiContext gtx = get_gui_gtx(dindex); do_once = 1; cur_vindex = vindex; cur_type = type; cur_var = var; while(1){ if(gtx->group_index > 0){ if(!vis5d_get_group_graphic_link(cur_vindex,cur_type,cur_var, &next_vindex,&next_type,&next_var)){ return 0; } } else{ if(!vis5d_get_slice_link(cur_vindex,cur_type,cur_var, &next_vindex,&next_type,&next_var)){ return 0; } } if (vindex == cur_vindex && type == cur_type && var == cur_var && do_once == 0){ return 1; } else if (vindex == cur_vindex && type == cur_type && var == cur_var && do_once == 1){ do_once = 0; } vis5d_get_ctx_display_index( cur_vindex, &cur_dindex); enable_gui_button_windows(cur_vindex, cur_dindex, cur_type, cur_var, state); enable_and_make_gui_button_graphics(cur_vindex, cur_dindex, cur_type, cur_var, state); cur_vindex = *next_vindex; cur_type = *next_type; cur_var = *next_var; } } void map_all_windows( int onlyrecolor ) { GuiContext gtx; int x, y, yo, wstep, hstep, width, height; int Kurrant; XWindowAttributes winatts; int R,G,B, gindex; static GC gc; XGCValues vals; yo = 0; get_current_display( &Kurrant ); XGetWindowAttributes( GfxDpy, BigWindow, &winatts); for (y = 0; y < DisplayRows; y++){ for (x = 0; x < DisplayCols; x++){ gtx = get_gui_gtx2(yo); if (!gtx){ /* yo++; */ } else{ vis5d_get_display_group( yo, &gindex ); gtx->group_index = gindex; width = winatts.width-(right_margin*DisplayCols)- (left_margin*DisplayCols); height = winatts.height-(bottom_margin*DisplayRows)- (top_margin*DisplayRows); if (DisplayRows == 1 && DisplayCols == 1){ wstep = width-8; hstep = height-8; } else{ wstep = ((width-4) -(DisplayCols*8)) / DisplayCols; hstep = ((height-4) -(DisplayRows*8))/ DisplayRows; } if (!StaticWin){ wstep = wstep > hstep ? hstep : wstep; hstep = hstep > wstep ? wstep : hstep; } if (DisplayRows == 1 && DisplayCols == 1){ set_display_border_color(0, 0, 0, 0 ); } else if (gtx->group_index >= 1){ switch(gtx->group_index){ case 1: set_display_border_color( yo, 255, 0, 255); break; case 2: set_display_border_color( yo, 255, 255, 0 ); break; case 3: set_display_border_color( yo, 0, 255, 255); break; case 4: set_display_border_color( yo, 255, 180, 50); break; case 5: set_display_border_color( yo, 180, 50, 255); break; case 6: set_display_border_color( yo, 50, 255, 180); break; case 7: set_display_border_color( yo, 255, 50, 180); break; case 8: set_display_border_color( yo, 180, 255, 50); break; case 9: set_display_border_color( yo, 50, 180, 255); break; default: printf("something is awry\n"); } } else if (gtx->context_index == Kurrant){ set_display_border_color(yo, 255, 255, 255); } else { set_display_border_color(yo, 165, 42, 42); } if (onlyrecolor == 0){ vis5d_map_3d_window( gtx->context_index ); vis5d_moveresize_3d_window( gtx->context_index, x * 8 + 4 + x * wstep + (left_margin*(x+1)) + (right_margin*x), y * 8 + 4 + y * hstep + (top_margin*(y+1)) + (bottom_margin*y), wstep, hstep); vis5d_invalidate_dtx_frames(gtx->context_index); } yo++; } } } wstep = wstep + right_margin + left_margin; hstep = hstep + bottom_margin + top_margin; if (DisplayRows == 1 && DisplayCols == 1){ vis5d_resize_BIG_window((wstep+8)*DisplayCols, (hstep+8)*DisplayRows); } else if (DisplayRows != 0 && DisplayCols != 0){ vis5d_resize_BIG_window((wstep+8)*DisplayCols+4, (hstep+8)*DisplayRows+4); } /* draw titles */ for (yo=0; yofid); XFreeFontInfo(NULL, fontinfo, 0); strcpy(ring,title_string[yo]); len = strlen(ring); XDrawString(GfxDpy, BigWindow, gc, title_x_position[yo], title_y_position[yo], ring, len); } } } /**********************************************************************/ /***** Widget callback functions *****/ /**********************************************************************/ #ifdef LEAVEOUT static int debug_cb( LUI_BUTTON *pb ) { int index = pb->context_index; GuiContext gtx = get_gui_gtx(index); /* Debug = !Debug;*/ return 0; } #endif /* toggle trajectory ribbon button */ static int ribbon_cb( LUI_NEWBUTTON *pb ) { float UserTrajStep, UserTrajLength; int dyo, dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; int RibbonFlag; int index = pb->context_index; GuiContext gtx = get_gui_gtx(index); vis5d_get_traj(index, &UserTrajStep, &UserTrajLength, &RibbonFlag); RibbonFlag = !RibbonFlag; if (gtx->group_index > 0){ vis5d_get_num_of_dtxs_in_group( gtx->group_index, &dhowmany, dwhichones); for (dyo = 0; dyo < dhowmany; dyo++){ vis5d_set_traj(dwhichones[dyo], UserTrajStep, UserTrajLength, RibbonFlag); } } else{ vis5d_set_traj(index, UserTrajStep, UserTrajLength, RibbonFlag); } group_event(gtx->group_index, 100, RibbonFlag); vis5d_signal_redraw(index, 1); return 0; } /* delete last trajectory */ static int dellast_cb( LUI_NEWBUTTON *pb ) { int index = pb->context_index; GuiContext gtx = get_gui_gtx(index); vis5d_delete_last_traj(index); vis5d_invalidate_dtx_frames(index); return 0; } /* delete trajectory set */ static int delset_cb( LUI_NEWBUTTON *pb ) { char msg[100]; int index = pb->context_index; GuiContext gtx = get_gui_gtx(index); sprintf(msg,"Delete trajectory set %d?", gtx->cur_trajset+1); if (verify(index, msg)) { vis5d_delete_traj_set(index, gtx->cur_trajset); } vis5d_invalidate_dtx_frames(index); return 0; } /* called when trajectory step type-in changes */ static int trajstep_cb( LUI_FIELD *field ) { float UserTrajStep, UserTrajLength; int dyo, dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; int RibbonFlag; int index = field->context_index; GuiContext gtx = get_gui_gtx(index); vis5d_get_traj(index, &UserTrajStep, &UserTrajLength, &RibbonFlag); UserTrajStep = LUI_FieldGetDouble( gtx->TrajStepField ); if (UserTrajStep<=0.0) { UserTrajStep = 1.0; LUI_FieldSetDouble( gtx->TrajStepField, 1.0 ); } if (gtx->group_index > 0){ vis5d_get_num_of_dtxs_in_group( gtx->group_index, &dhowmany, dwhichones); for (dyo = 0; dyo < dhowmany; dyo++){ vis5d_set_traj(dwhichones[dyo], UserTrajStep, UserTrajLength, RibbonFlag); } } else{ vis5d_set_traj(index, UserTrajStep, UserTrajLength, RibbonFlag); } return 0; } /* called when trajectory length type-in changes */ static int trajlength_cb( LUI_FIELD *field ) { float UserTrajStep, UserTrajLength; int dyo, dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; int RibbonFlag; int index = field->context_index; GuiContext gtx = get_gui_gtx(index); vis5d_get_traj(index, &UserTrajStep, &UserTrajLength, &RibbonFlag); UserTrajLength = LUI_FieldGetDouble( gtx->TrajLenField ); if (UserTrajLength<=0.0) { UserTrajLength = 1.0; LUI_FieldSetDouble( gtx->TrajLenField, 1.0 ); } if (gtx->group_index > 0){ vis5d_get_num_of_dtxs_in_group( gtx->group_index, &dhowmany, dwhichones); for (dyo = 0; dyo < dhowmany; dyo++){ vis5d_set_traj(dwhichones[dyo], UserTrajStep, UserTrajLength, RibbonFlag); } } else{ vis5d_set_traj(index, UserTrajStep, UserTrajLength, RibbonFlag); } return 0; } /* * Display the expression type-in window with the given expression shown. */ static void map_expr_window( int index, char *expr ) { GuiContext gtx = get_gui_gtx(index); strcpy( gtx->Expression, expr ); LUI_FieldSetText( gtx->expr_field, expr ); XMapWindow( GuiDpy, gtx->ExprWindow ); } /*** add_button_row *************************************************** Add a new row of variable buttons to the control panel window. Input: name - name of new variable newrow - which row of buttons this is to be. **********************************************************************/ /* DONT USE THIS ANYMORE BUT KEEP IT HERE FOR OLE TIMES SAKE */ /* make_another_gui() does all of this stuff */ static void add_button_row( int index, char *name, int newrow ) { float red[6], green[6], blue[6]; char *labels[6]; int j; int Nr, Nc, Nl[MAXVARS], LowLev[MAXVARS], MaxNl, MaxNlVar, WindNl, WindLow; GuiContext gtx = get_gui_gtx(index); /*index = display index */ vis5d_get_size(index, &Nr, &Nc, Nl, LowLev, &MaxNl, &MaxNlVar, &WindNl, &WindLow); for (j=0; jColumns; j++) { if (j==5) { /* volume button always white */ red[j] = green[j] = blue[j] = 1.0; } else { float alpha; vis5d_get_color( index, j, newrow, &red[j], &green[j], &blue[j], &alpha ); } if (Nl[newrow]>1 || (j==1 || j==3)) { labels[j] = name; } else { labels[j] = NULL; } } LUI_ContextIndex(index); LUI_ButtonMatrixAddRow( gtx->ButtonMatrix, labels, red, green, blue ); LUI_ButtonMatrixShowBottom( gtx->ButtonMatrix ); } /* called when a button in the clone window is selected */ static int do_clone_cb( LUI_NEWBUTTON *b, int state ) { int index = b->context_index; int vindex = b->indexowner; int newvar; int numvars; GuiContext gtx = get_gui_gtx(index); if (b->index==9999) { /* Cancel button */ } else if (b->index>=0) { /* clone an existing variable */ int var_to_clone = b->index; char newname[100]; int i; /* make name for new variable (original name plus quotes (')) */ vis5d_get_ctx_var_name( b->indexowner, var_to_clone, newname ); for (i=0;iindexowner, newname )<0) { break; } } if (i==MAXVARS || vis5d_make_clone_variable(b->indexowner, var_to_clone, newname, &newvar)<0) { /* error, unable to make new variable */ } else { /* add a row of buttons to the control panel */ make_another_gui(gtx->context_index, 0); hide_widgets( index ); show_widgets( index ); /* turn_off_everything(gtx->context_index); */ vis5d_reset_var_graphics(b->indexowner, newvar); } } else if (b->index<=0) { /* compute an external function variable */ int func = -(b->index+1); if (FuncType[index][func]==VIS5D_EXT_FUNC) { char funcname[1000]; if (gtx->funcpath[0]) { strcpy( funcname, gtx->funcpath ); } else { strcpy( funcname, FUNCTION_PATH ); } strcat( funcname, "/" ); strcat( funcname, FuncName[index][func] ); if (vis5d_compute_ext_func( index, funcname, &newvar) < 0 ) { /* error */ char str[1000]; sprintf(str, "External function \"%s\" failed", funcname ); alert( index, str ); } else { /* success */ if (newvar >= 0) { char newname[10]; vis5d_get_ctx_var_name( index, newvar, newname ); make_another_gui(gtx->context_index, 0); hide_widgets( index ); show_widgets( index ); /* turn_off_everything(gtx->context_index); */ vis5d_reset_var_graphics(index, newvar); } } } else if (FuncType[index][func]==VIS5D_EXPRESSION) { /* Recompute a variable defined by an expression */ int lo, var, flag; vis5d_get_ctx_numvars( vindex, &numvars ); lo = 0; flag = -1; for (var=0;varCloneWindow ); /*make_another_gui( gtx->context_index );*/ vis5d_signal_redraw(index, 1); return 0; } /* * Scan the list of variables for the type VIS5D_EXPRESSION. Put the * names of the expressions into the exprname array. * Return: number of expression variables */ static int find_expr_variables( int index, char exprname[][1000] ) { int var, numvars, vartype, num; int chowmany, cwhichones[VIS5D_MAX_CONTEXTS]; int cyo; num = 0; vis5d_get_num_of_ctxs_in_display( index, &chowmany, cwhichones); for (cyo = 0; cyo < chowmany; cyo++){ int vindex; vindex = cwhichones[cyo]; vis5d_get_ctx_numvars( vindex, &numvars ); for (var=0;varExprWindow ); } /* map the horizontal wind slice control window */ static void map_hwind_window( int index, int ws ) { float HWindDensity, HWindScale, HWindLevel; char str[1000]; GuiContext gtx = get_gui_gtx(index); int vindex = gtx->array_of_ctxs[0]; vis5d_get_hwindslice(index, ws, &HWindDensity, &HWindScale, &HWindLevel); gtx->cur_hwind = ws; /* MJK 12.04.98 begin */ XUnmapWindow( GuiDpy, gtx->HWindWindow ); sprintf( str, "HWind %d Scale:", ws+1 ); LUI_NewLabelChangeText( gtx->hwindscale_label, str ); LUI_FieldSetDouble( gtx->hwindscale_field, HWindScale ); LUI_FieldSetDouble( gtx->hwinddensity_field, HWindDensity ); { int state; state = vis5d_enable_sfc_graphics (vindex, VIS5D_HWIND, ws, VIS5D_GET); LUI_ButtonSetState (gtx->hwind_sfc_button, state); mod_vpos_slider (index, gtx->hwind_pos_slider, ws, 1, HWindLevel); } XMapWindow( GuiDpy, gtx->HWindWindow ); /* MJK 12.04.98 end */ } /* map the vertical wind slice control window */ static void map_vwind_window( int index, int ws ) { float VWindDensity, VWindScale; float row0, col0, row1, col1; char str[1000]; GuiContext gtx = get_gui_gtx(index); vis5d_get_vwindslice(index, ws, &VWindDensity, &VWindScale, &row0, &col0, &row1, &col1); gtx->cur_vwind = ws; XUnmapWindow( GuiDpy, gtx->WindWindow ); sprintf( str, "V-Wind %d Scale:", ws+1 ); LUI_NewLabelChangeText( gtx->windscale_label, str ); LUI_FieldSetDouble( gtx->windscale_field, VWindScale ); LUI_FieldSetDouble( gtx->winddensity_field, VWindDensity ); XMapWindow( GuiDpy, gtx->WindWindow ); } /* map the horizontal stream slice control window */ static void map_hstream_window( int index, int ws ) { float HStreamDensity, HStreamScale, HStreamLevel; char str[1000]; GuiContext gtx = get_gui_gtx(index); int vindex = gtx->array_of_ctxs[0]; vis5d_get_hstreamslice(index, ws, &HStreamDensity, &HStreamLevel); HStreamScale = 1.0; gtx->cur_hstream = ws; /* MJK 12.04.98 begin */ XUnmapWindow( GuiDpy, gtx->HWindWindow ); sprintf( str, "HStream Scale:" ); LUI_NewLabelChangeText( gtx->hwindscale_label, str ); LUI_FieldSetDouble( gtx->hwindscale_field, HStreamScale ); LUI_FieldSetDouble( gtx->hwinddensity_field, HStreamDensity ); { int state; state = vis5d_enable_sfc_graphics (vindex, VIS5D_HSTREAM, ws, VIS5D_GET); LUI_ButtonSetState (gtx->hwind_sfc_button, state); mod_vpos_slider (index, gtx->hwind_pos_slider, ws, 1, HStreamLevel); } XMapWindow( GuiDpy, gtx->HWindWindow ); /* MJK 12.04.98 end */ } /* map the vertical stream slice control window */ static void map_vstream_window( int index, int ws ) { float VStreamDensity, VStreamScale; float VStreamR1, VStreamC1, VStreamR2, VStreamC2; char str[1000]; GuiContext gtx = get_gui_gtx(index); vis5d_get_vstreamslice(index, ws, &VStreamDensity, &VStreamR1, &VStreamC1, &VStreamR2, &VStreamC2); VStreamScale = 1.0; gtx->cur_vstream = ws; XUnmapWindow( GuiDpy, gtx->WindWindow ); sprintf( str, "VStream %d Scale:", ws+1 ); LUI_NewLabelChangeText( gtx->windscale_label, str ); LUI_FieldSetDouble( gtx->windscale_field, VStreamScale ); LUI_FieldSetDouble( gtx->winddensity_field, VStreamDensity ); XMapWindow( GuiDpy, gtx->WindWindow ); } /* map the isosurface isolevel window */ /* MJK 12.04.98 begin */ static void map_isosurf_window( int dindex, int vindex, int var ) { float min, max, isolevel; char name[10], units[20]; GuiContext gtx = get_gui_gtx(dindex); int dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; int chowmany, cwhichones[VIS5D_MAX_CONTEXTS]; int times, dyo, cyo, good; char aname[30]; char rap[30]; if (gtx->group_index > 0){ vis5d_get_ctx_var_name( vindex, var, aname); vis5d_get_num_of_dtxs_in_group( gtx->group_index, &dhowmany, dwhichones); for (dyo = 0; dyo < dhowmany; dyo++){ vis5d_get_num_of_ctxs_in_display( dwhichones[dyo], &chowmany, cwhichones); for ( cyo = 0; cyo < chowmany; cyo++){ good = vis5d_find_var(cwhichones[cyo], aname); if (good>-1){ vis5d_get_ctx_var_range(cwhichones[cyo], good, &min, &max ); if (min > max ) { min = max = 0.0; isolevel = 0.0; } else { vis5d_get_isosurface(cwhichones[cyo], good, &isolevel); } vis5d_get_ctx_var_name (cwhichones[cyo], good, name); vis5d_get_var_units (cwhichones[cyo], good, units); if (dhowmany > 1){ strcpy( rap, return_var_and_index(name, cwhichones[cyo])); LUI_NewSliderChange( gtx_table[dwhichones[dyo]]->IsoSlider, rap, units, min, max, isolevel ); } else{ LUI_NewSliderChange( gtx_table[dwhichones[dyo]]->IsoSlider, name, units, min, max, isolevel ); } if(dwhichones[dyo] == dindex){ XMapWindow(GuiDpy, gtx->IsoWindow); } } } } } else{ vis5d_get_ctx_var_range( vindex, var, &min, &max ); if (min > max ) { min = max = 0.0; isolevel = 0.0; } else { vis5d_get_isosurface(vindex, var, &isolevel); } vis5d_get_num_of_ctxs_in_display( dindex, &chowmany, cwhichones); vis5d_get_ctx_var_name (vindex, var, name); vis5d_get_var_units (vindex, var, units); if (dhowmany > 1){ strcpy( rap, return_var_and_index(name, vindex)); LUI_NewSliderChange( gtx->IsoSlider,rap, units, min, max, isolevel ); } else{ LUI_NewSliderChange( gtx->IsoSlider, name, units, min, max, isolevel ); } XMapWindow(GuiDpy, gtx->IsoWindow); } } /* MJK 12.04.98 end */ /* map the horizontal contour line slice control window */ static void map_hslice_window( int dindex, int vindex, int var ) { char str[100]; float min, max; char name[10]; float HSliceInterval, HSliceLowLimit, HSliceHighLimit, HSliceLevel; GuiContext gtx = get_gui_gtx(dindex); vis5d_get_ctx_var_range(vindex, var, &min, &max); vis5d_get_ctx_var_name(vindex, var, name ); vis5d_get_hslice(vindex, var, &HSliceInterval, &HSliceLowLimit, &HSliceHighLimit, &HSliceLevel); /* MJK 12.04.98 begin */ { char units[20]; int lunits, lname, state; vis5d_get_var_units (vindex, var, units); if ((lunits = strlen (units)) > 0) { lname = strlen (name); if ((lname+lunits) > 5) sprintf (str, "%s H. Slice Int. (%s):", name, units); else sprintf (str, "%s Hor. Slice Interval (%s):", name, units); } else sprintf (str, "%s Hor. Slice Interval:", name); state = vis5d_enable_sfc_graphics (vindex, VIS5D_HSLICE, var, VIS5D_GET); LUI_ButtonSetState (gtx->hslice_sfc_button, state); mod_vpos_slider (dindex, gtx->hslice_pos_slider, var, 0, HSliceLevel); } /* MJK 12.04.98 end */ LUI_NewLabelChangeText( gtx->hslice_label, str ); if (HSliceLowLimit==min && HSliceHighLimit==max) sprintf( str, "%g", HSliceInterval ); else sprintf( str, "%g (%g,%g)", HSliceInterval, HSliceLowLimit, HSliceHighLimit ); LUI_FieldSetText( gtx->hslice_field, str ); XMapWindow(GuiDpy,gtx->HSliceWindow); } /* map the vertical contour line slice control window */ static void map_vslice_window( int dindex, int vindex, int var ) { char str[100]; float min, max; char name[10]; float VSliceInterval, VSliceLowLimit, VSliceHighLimit; float row0, col0, row1, col1; GuiContext gtx = get_gui_gtx(dindex); vis5d_get_ctx_var_range(vindex, var, &min, &max); vis5d_get_ctx_var_name( vindex, var, name ); vis5d_get_vslice(vindex, var, &VSliceInterval, &VSliceLowLimit, &VSliceHighLimit, &row0, &col0, &row1, &col1); /* MJK 12.04.98 begin */ { char units[20]; int lunits, lname; vis5d_get_var_units (vindex, var, units); if ((lunits = strlen (units)) > 0) { lname = strlen (name); if ((lname+lunits) > 5) sprintf (str, "%s V. Slice Int. (%s):", name, units); else sprintf (str, "%s Ver. Slice Interval (%s):", name, units); } else sprintf (str, "%s Ver. Slice Interval:", name); } /* MJK 12.04.98 end */ LUI_NewLabelChangeText( gtx->vslice_label, str ); if (VSliceLowLimit==min && VSliceHighLimit==max) sprintf( str, "%g", VSliceInterval ); else sprintf( str, "%g (%g,%g)", VSliceInterval, VSliceLowLimit, VSliceHighLimit ); LUI_FieldSetText( gtx->vslice_field, str ); XMapWindow(GuiDpy,gtx->VSliceWindow); } /* MJK 12.04.98 begin */ static void init_currents(void) { int yo; for (yo = 0; yo < VIS5D_MAX_DPY_CONTEXTS; yo++){ do_one_time[yo] = 1; cb_graphic[yo] = -1; cb_var[yo] = -1; cb_vvar[yo] = -1; cb_vindex[yo] = -1; cb_chvar[yo] = -1; cb_chvvar[yo] = -1; cb_chvindex[yo] = -1; } } #ifdef HAVE_LIBNETCDF static int tp_red_slider_cb( LUI_NEWSLIDER *s, float value ) { GuiContext gtx = get_gui_gtx(s->context_index); int dindex = gtx->context_index; int iindex = gtx->current_text_plot_iindex; float r, g, b, a; int var; float spacing, fontx, fonty, fontspace; vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_get_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, &r, &g, &b, &a); r = value; vis5d_set_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, r, g, b, a); vis5d_signal_redraw( dindex, 1); LUI_ButtonMatrixSetColor( gtx->TextPlotButtonMatrix, var, 0, r, g, b ); return 0; } static int tp_green_slider_cb( LUI_NEWSLIDER *s, float value ) { GuiContext gtx = get_gui_gtx(s->context_index); int dindex = gtx->context_index; int iindex = gtx->current_text_plot_iindex; float r, g, b, a; int var; float spacing, fontx, fonty, fontspace; vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_get_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, &r, &g, &b, &a); g = value; vis5d_set_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, r, g, b, a); vis5d_signal_redraw( dindex, 1); LUI_ButtonMatrixSetColor( gtx->TextPlotButtonMatrix, var, 0, r, g, b ); return 0; } static int tp_blue_slider_cb( LUI_NEWSLIDER *s, float value ) { GuiContext gtx = get_gui_gtx(s->context_index); int dindex = gtx->context_index; int iindex = gtx->current_text_plot_iindex; float r, g, b, a; int var; float spacing, fontx, fonty, fontspace; vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_get_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, &r, &g, &b, &a); b = value; vis5d_set_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, r, g, b, a); vis5d_signal_redraw( dindex, 1); LUI_ButtonMatrixSetColor( gtx->TextPlotButtonMatrix, var, 0, r, g, b ); return 0; } static int tp_alpha_slider_cb( LUI_NEWSLIDER *s, float value ) { GuiContext gtx = get_gui_gtx(s->context_index); int dindex = gtx->context_index; int iindex = gtx->current_text_plot_iindex; float r, g, b, a; int var; float spacing, fontx, fonty, fontspace; vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_get_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, &r, &g, &b, &a); a = value; vis5d_set_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, r, g, b, a); vis5d_signal_redraw( dindex, 1); LUI_ButtonMatrixSetColor( gtx->TextPlotButtonMatrix, var, 0, r, g, b ); return 0; } static int tp_colorbar_callback( LUI_COLORBAR *cb, int action ) { GuiContext gtx = get_gui_gtx( cb->context_index); float *p; int dindex = gtx->context_index; int iindex = gtx->current_text_plot_iindex; int var; float spacing, fontx, fonty, fontspace; unsigned int *ctable; vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); if (action==LUI_RGB_RESET || action==LUI_ALPHA_RESET || action==LUI_RGB_SHAPE || action==LUI_ALPHA_CHANGE || action==LUI_RGB_CHANGE) { vis5d_get_color_table_address( dindex, VIS5D_TEXTPLOT, iindex, var, &ctable); vis5d_get_color_table_params( dindex, VIS5D_TEXTPLOT, iindex, var, &p); if (action==LUI_RGB_RESET) { vis5d_color_table_init_params( p, 1, 0 ); vis5d_color_table_recompute( ctable, 256, p, 1, 0 ); } else if (action==LUI_ALPHA_RESET) { vis5d_color_table_init_params( p, 0, 1 ); vis5d_color_table_recompute( ctable, 256, p, 0, 1 ); } else if (action==LUI_RGB_SHAPE) { vis5d_color_table_recompute( ctable, 256, p, 1, 0 ); } else if (action==LUI_ALPHA_SHAPE) { vis5d_color_table_recompute( ctable, 256, p, 0, 1 ); } else if (action==LUI_ALPHA_CHANGE) { vis5d_signal_redraw( dindex, 1); } LUI_ColorBarRedraw( cb ); vis5d_signal_redraw(dindex, 1); } return 0; } void make_tp_color_window( GuiContext gtx ) { int dindex, iindex; int subx, suby; Window w; LUI_NEWBUTTON *b; LUI_NEWSLIDER *s; dindex = gtx->context_index; iindex = gtx->current_text_plot_iindex; if (!gtx->tp_color_window){ gtx->tp_color_window = LUI_CreateWindowAt( LUI_RootWindow, 10, 800, 380, 182 ); w = gtx->tp_color_window; gtx->tp_color_label = LUI_NewLabelCreate( w, LUI_LEFT, LUI_TOP, 310, 20, "default label" ); b = LUI_PushButtonCreate( w, LUI_NEXT_X, LUI_SAME_Y, 60, 20, "Close" ); b->index = gtx->context_index; LUI_ButtonCallback( b, tp_close_color_cb ); gtx->tp_monocolor = LUI_PushButtonCreate( w, 5, 30, 90, 20, " MonoColor" ); gtx->tp_monocolor->index = gtx->context_index; LUI_ButtonCallback( gtx->tp_monocolor, tp_monocolor_cb ); gtx->tp_multicolor = LUI_PushButtonCreate( w, 5, 70, 90, 20, "MultiColor" ); gtx->tp_multicolor->index = gtx->context_index; LUI_ButtonCallback( gtx->tp_multicolor, tp_multicolor_cb ); } w = gtx->tp_color_window; subx = 100; suby = 25; if (!gtx->tp_color_subwin1){ gtx->tp_color_subwin1 = LUI_CreateWindowAt( w, subx, suby, 280, 200 ); /* red slider */ s = LUI_NewSliderCreate( gtx->tp_color_subwin1, 0, 0, 270 ); gtx->tp_red_slider = s; LUI_NewSliderChange( s, "Red", NULL, 0.0, 1.0, 1.0 ); LUI_NewSliderCallback( s, tp_red_slider_cb ); gtx->tp_red_slider->context_index = dindex; /* green slider */ s = LUI_NewSliderCreate( gtx->tp_color_subwin1, 0, LUI_NEXT_Y, 270 ); gtx->tp_green_slider = s; LUI_NewSliderChange( s, "Green", NULL, 0.0, 1.0, 1.0 ); LUI_NewSliderCallback( s, tp_green_slider_cb ); gtx->tp_green_slider->context_index = dindex; /* blue slider */ s = LUI_NewSliderCreate( gtx->tp_color_subwin1, 0, LUI_NEXT_Y, 270 ); gtx->tp_blue_slider = s; LUI_NewSliderChange( s, "Blue", NULL, 0.0, 1.0, 1.0 ); LUI_NewSliderCallback( s, tp_blue_slider_cb ); gtx->tp_blue_slider->context_index = dindex; /* alpha slider */ s = LUI_NewSliderCreate( gtx->tp_color_subwin1, 0, LUI_NEXT_Y, 270 ); gtx->tp_alpha_slider = s; LUI_NewSliderChange( s, "Opacity", NULL, 0.0, 1.0, 1.0 ); LUI_NewSliderCallback( s, tp_alpha_slider_cb ); gtx->tp_alpha_slider->context_index = dindex; } LUI_FrameWidth(4); LUI_ColorBarPacking( PACK_COLOR('R','G','B','A') ); if (!gtx->tp_color_subwin2){ gtx->tp_color_subwin2 = LUI_CreateWindowAt( w, subx, suby, 280, 200 ); gtx->tp_colorbar = LUI_ColorBarCreate( gtx->tp_color_subwin2, 0, 0, 270, 154 ); LUI_ColorBarCallback( gtx->tp_colorbar, tp_colorbar_callback ); } gtx->tp_colorbar->context_index = gtx->context_index; XMapWindow( GuiDpy, gtx->tp_color_subwin2 ); } void hide_tp_color_window( GuiContext gtx) { XUnmapWindow(GuiDpy, gtx->tp_color_window); } void show_tp_color_window( GuiContext gtx, int var) { float r, g, b, a; unsigned int *color; int numvars; int colorvar; int status, row; unsigned int *table; char varname[40], units[20]; char label[100]; float *p; float min, max; int dindex = gtx->context_index; int iindex = gtx->current_text_plot_iindex; /* unmap window in case it's already displayed */ XUnmapWindow( GuiDpy, gtx->tp_color_subwin1); XUnmapWindow( GuiDpy, gtx->tp_color_subwin2); vis5d_get_itx_var_name( iindex, var, varname); sprintf( label, "%s textplot color:", varname ); LUI_NewLabelChangeText( gtx->tp_color_label, label ); vis5d_get_textplot_color_status( iindex, var, &status ); p = NULL; vis5d_get_itx_var_range(iindex, var, &min, &max); if (min != max){ XMapWindow(GuiDpy, gtx->tp_monocolor->window); XMapWindow(GuiDpy, gtx->tp_multicolor->window); } else{ XUnmapWindow(GuiDpy, gtx->tp_monocolor->window); XUnmapWindow(GuiDpy, gtx->tp_multicolor->window); } if (status == VIS5D_ON){ LUI_ButtonSetState(gtx->tp_multicolor,1); LUI_ButtonSetState(gtx->tp_monocolor,0); strcpy( units, " "); vis5d_get_color_table_address( dindex, VIS5D_TEXTPLOT, iindex, var, &table ); vis5d_get_color_table_params( dindex, VIS5D_TEXTPLOT, iindex, var, &p); if (p != NULL) { LUI_ColorBarChange (gtx->tp_colorbar, varname, units, min, max, table, 255, p); } XMapWindow( GuiDpy, gtx->tp_color_window ); XMapWindow( GuiDpy, gtx->tp_color_subwin2 ); } else{ LUI_ButtonSetState(gtx->tp_multicolor,0); LUI_ButtonSetState(gtx->tp_monocolor,1); vis5d_get_color( dindex, VIS5D_TEXTPLOT, (iindex*MAXVARS)+var, &r,&g,&b,&a ); LUI_NewSliderSetValue( gtx->tp_red_slider, r ); LUI_NewSliderSetValue( gtx->tp_green_slider, g ); LUI_NewSliderSetValue( gtx->tp_blue_slider, b ); LUI_NewSliderSetValue( gtx->tp_alpha_slider, a ); XMapWindow( GuiDpy, gtx->tp_color_window ); XMapWindow( GuiDpy, gtx->tp_color_subwin1 ); } } static int textplotspacing_cb( LUI_FIELD *field ) { GuiContext gtx = get_gui_gtx(tp_dindex); float spacing; int var, time, numtimes, curtime; int iindex = gtx->current_text_plot_iindex; float fontx, fonty, fontspace; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); spacing = LUI_FieldGetDouble( gtx->TextPlotSpacingField ); vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int textplotfontx_cb( LUI_FIELD *field ) { GuiContext gtx = get_gui_gtx(tp_dindex); float spacing; int curtime, var, time, numtimes; float fontx, fonty, fontspace; int iindex = gtx->current_text_plot_iindex; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fontx = LUI_FieldGetDouble( gtx->TextPlotFontX ); vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int textplotfonty_cb( LUI_FIELD *field ) { GuiContext gtx = get_gui_gtx(tp_dindex); float spacing; int curtime, var, time, numtimes; float fontx, fonty, fontspace; int iindex = gtx->current_text_plot_iindex; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fonty = LUI_FieldGetDouble( gtx->TextPlotFontY ); vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int textplotfontspace_cb( LUI_FIELD *field ) { GuiContext gtx = get_gui_gtx(tp_dindex); float spacing; int curtime, var, time, numtimes; float fontx, fonty, fontspace; int iindex = gtx->current_text_plot_iindex; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fontspace = LUI_FieldGetDouble( gtx->TextPlotFontSpace ); vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int fontxup_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); int iindex = gtx->current_text_plot_iindex; float spacing, fontx, fonty, fontspace; int curtime, var, time, numtimes; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fontx += 1.0; vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; LUI_FieldSetDouble( gtx->TextPlotFontX, fontx); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int fontxdown_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); int iindex = gtx->current_text_plot_iindex; float spacing, fontx, fonty, fontspace; int curtime, var, time, numtimes; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fontx -= 1.0; vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; LUI_FieldSetDouble( gtx->TextPlotFontX, fontx); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int tp_close_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); XUnmapWindow( GuiDpy, gtx->TextPlotWindow); return 0; } static int fontyup_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); int iindex = gtx->current_text_plot_iindex; float spacing, fontx, fonty, fontspace; int curtime, var, time, numtimes; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fonty += 1.0; vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; LUI_FieldSetDouble( gtx->TextPlotFontY, fonty); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int fontydown_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); int iindex = gtx->current_text_plot_iindex; float spacing, fontx, fonty, fontspace; int curtime, var, time, numtimes; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fonty -= 1.0; vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; LUI_FieldSetDouble( gtx->TextPlotFontY, fonty); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, curtime==time); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int fontspaceup_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); int iindex = gtx->current_text_plot_iindex; float spacing, fontx, fonty, fontspace; int curtime, var, time, numtimes; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fontspace += 5.0; vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; LUI_FieldSetDouble( gtx->TextPlotFontSpace, fontspace); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int fontspacedown_cb( LUI_NEWBUTTON *b ) { GuiContext gtx = get_gui_gtx(tp_dindex); int iindex = gtx->current_text_plot_iindex; float spacing, fontx, fonty, fontspace; int curtime, var, time, numtimes; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); fontspace -= 5.0; vis5d_set_text_plot( iindex, var, spacing, fontx, fonty, fontspace); gtx->current_text_plot_spacing = spacing; gtx->current_text_plot_fontx = fontx; gtx->current_text_plot_fonty = fonty; gtx->current_text_plot_fontspace = fontspace; LUI_FieldSetDouble( gtx->TextPlotFontSpace, fontspace); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(tp_dindex, 1); return 0; } static int TextPlotMatrix_cb( LUI_BUTTON_MATRIX *bm, int row, int col, int button ) { int dindex = bm->context_index; GuiContext gtx = get_gui_gtx(dindex); int iindex = gtx->current_text_plot_iindex; int time, curtime, numtimes; int var; float spacing; float fontx, fonty, fontspace; vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_get_itx_timestep(iindex, &curtime); if (button == Button1){ if (gtx->current_text_plot_iindex == iindex && gtx->current_text_plot_var == row){ vis5d_enable_irregular_graphics(iindex, VIS5D_TEXTPLOT, VIS5D_OFF); vis5d_set_text_plot(iindex, -1, spacing, fontx, fonty, fontspace); LUI_ButtonMatrixSetState( bm, row, col, 0); gtx->current_text_plot_var = -1; hide_tp_color_window(gtx); return 0; } else if (gtx->current_text_plot_iindex == iindex){ if (gtx->current_text_plot_var >= 0){ LUI_ButtonMatrixSetState( bm, gtx->current_text_plot_var, col, 0); } LUI_ButtonMatrixSetState( bm, row, col, 1); vis5d_enable_irregular_graphics(iindex, VIS5D_TEXTPLOT, VIS5D_ON); vis5d_set_text_plot(iindex, row, gtx->current_text_plot_spacing, gtx->current_text_plot_fontx, gtx->current_text_plot_fonty, gtx->current_text_plot_fontspace); gtx->current_text_plot_var = row; vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } vis5d_signal_redraw(dindex, 1); hide_tp_color_window(gtx); return 0; } } else if (button == Button3){ show_tp_color_window(gtx, var); return 0; } } int show_text_plot_window( int dindex, int iindex) { GuiContext gtx = get_gui_gtx(dindex); char *labels[1]; int i; float spacing; int var; LUI_NEWBUTTON *b; float red, green, blue, alpha; tp_dindex = dindex; vis5d_get_text_plot(iindex, &var, >x->current_text_plot_spacing, >x->current_text_plot_fontx, >x->current_text_plot_fonty, >x->current_text_plot_fontspace); if (!gtx->TextPlotWindow){ gtx->TextPlotWindow = LUI_CreateWindowAt( LUI_RootWindow, 200, 200, 400, 300); LUI_NewLabelCreate(gtx->TextPlotWindow, LUI_LEFT, LUI_TOP, 300, 20, "Choose Variable to Plot" ); b = LUI_PushButtonCreate(gtx->TextPlotWindow, 220, 15, 50, 20, "Close"); b->context_index = dindex; LUI_ButtonCallback( b, tp_close_cb); LUI_NewLabelCreate(gtx->TextPlotWindow, LUI_LEFT, 245, 65, 20, "Spacing:"); gtx->TextPlotSpacingField = LUI_FieldCreate( gtx->TextPlotWindow, 72, 245, 30, 20); LUI_FieldCallback( gtx->TextPlotSpacingField, textplotspacing_cb ); gtx->TextPlotSpacingField->context_index = dindex; LUI_NewLabelCreate(gtx->TextPlotWindow, 105, 245, 50, 20, "fontX:"); LUI_NewLabelCreate(gtx->TextPlotWindow, 105, 270, 50, 20, "fontY:"); LUI_NewLabelCreate(gtx->TextPlotWindow, 215, 245, 80, 20, "fontSpace:"); gtx->TextPlotFontX = LUI_FieldCreate( gtx->TextPlotWindow, 160, 245, 30, 20); gtx->TextPlotFontY = LUI_FieldCreate( gtx->TextPlotWindow, 160, 270, 30, 20); gtx->TextPlotFontSpace = LUI_FieldCreate( gtx->TextPlotWindow, 300, 245, 30, 20); gtx->TextPlotFontX->context_index = dindex; gtx->TextPlotFontY->context_index = dindex; gtx->TextPlotFontSpace->context_index = dindex; LUI_FieldCallback( gtx->TextPlotFontX, textplotfontx_cb); LUI_FieldCallback( gtx->TextPlotFontY, textplotfonty_cb); LUI_FieldCallback( gtx->TextPlotFontSpace, textplotfontspace_cb); b = LUI_PushButtonCreate( gtx->TextPlotWindow, 192, 244, 17, 11, "+"); b->context_index = gtx->context_index; LUI_ButtonCallback( b, fontxup_cb); b = LUI_PushButtonCreate( gtx->TextPlotWindow, 192, 255, 17, 11, "-"); b->context_index = gtx->context_index; LUI_ButtonCallback( b, fontxdown_cb); b = LUI_PushButtonCreate( gtx->TextPlotWindow, 192, 269, 17, 11, "+"); b->context_index = gtx->context_index; LUI_ButtonCallback( b, fontyup_cb); b = LUI_PushButtonCreate( gtx->TextPlotWindow, 192, 280, 17, 11, "-"); b->context_index = gtx->context_index; LUI_ButtonCallback( b, fontydown_cb); b = LUI_PushButtonCreate( gtx->TextPlotWindow, 332, 244, 17, 11, "+"); b->context_index = gtx->context_index; LUI_ButtonCallback( b, fontspaceup_cb); b = LUI_PushButtonCreate( gtx->TextPlotWindow, 332, 255, 17, 11, "-"); b->context_index = gtx->context_index; LUI_ButtonCallback( b, fontspacedown_cb); b->context_index = gtx->context_index; } LUI_FieldSetDouble( gtx->TextPlotSpacingField, gtx->current_text_plot_spacing); LUI_FieldSetDouble( gtx->TextPlotFontX, gtx->current_text_plot_fontx); LUI_FieldSetDouble( gtx->TextPlotFontY, gtx->current_text_plot_fonty); LUI_FieldSetDouble( gtx->TextPlotFontSpace, gtx->current_text_plot_fontspace); if (gtx->TextPlotButtonMatrix){ LUI_ButtonMatrixDestroy(gtx->TextPlotButtonMatrix); } gtx->TextPlotButtonMatrix = LUI_ButtonMatrixCreate(gtx->TextPlotWindow, 10, 30, 200, 206, 1); for (i = 0; i < gtx->IrregularNumVars[iindex]; i++){ labels[0] = gtx->IrregularVarName[i][iindex]; vis5d_get_color( gtx->context_index, VIS5D_TEXTPLOT, iindex*MAXVARS+i, &red, &green, &blue, &alpha); LUI_ButtonMatrixAddRow( gtx->TextPlotButtonMatrix, labels, &red, &green, &blue); } LUI_ButtonMatrixCallback( gtx->TextPlotButtonMatrix, TextPlotMatrix_cb); gtx->TextPlotButtonMatrix->context_index = dindex; gtx->current_text_plot_iindex = iindex; if (var >= 0){ LUI_ButtonMatrixSetState(gtx->TextPlotButtonMatrix, var, 0, 1); } XMapWindow( GuiDpy, gtx->TextPlotWindow); XMapWindow( GuiDpy, gtx->TextPlotButtonMatrix->mainwindow); gtx->current_text_plot_iindex = iindex; } #endif /* HAVE_LIBNETCDF */ /* * Display a color_table widget window. * Input: dindex - display context index * vindex - vis5d context index * graphic - either VIS5D_TOPO, VIS5D_CHSLICE, VIS5D_CVSLICE, * or VIS5D_VOLUME * var - which variable */ int show_colorbar_window( int dindex, int vindex, int graphic, int var ) { GuiContext gtx = get_gui_gtx(dindex); float min, max; unsigned int *colors; int vvar; char name[20], label[100], units[20]; float *p; XWindowAttributes winatts; XWindowAttributes winatts2; if (vindex < 0 || var < 0) return 0; vvar = get_button_ctx_row (dindex, var); switch (graphic) { case VIS5D_TOPO: vvar = 0; vis5d_get_topo_range (dindex, &min, &max); strcpy (units, "km"); strcpy (label, "Topography"); break; case VIS5D_CHSLICE: strcpy (label, "horiz slice "); break; case VIS5D_CVSLICE: strcpy (label, "vert slice "); break; case VIS5D_VOLUME: strcpy (label, "volume "); break; default: return 0; } if (graphic != VIS5D_TOPO) { vis5d_get_ctx_var_range (vindex, vvar, &min, &max); vis5d_get_var_units (vindex, vvar, units); vis5d_get_ctx_var_name (vindex, vvar, name); strcat (label, name); } vis5d_get_color_table_address (dindex, graphic, vindex, vvar, &colors); vis5d_get_color_table_params (dindex, graphic, vindex, vvar, &p); if (graphic == VIS5D_CHSLICE) { float level; vis5d_get_chslice (vindex, vvar, &level); XGetWindowAttributes( GuiDpy, gtx->chslice_pos_slider->window, &winatts2); XGetWindowAttributes( GuiDpy, gtx->CHSliceWindow, &winatts); XMoveResizeWindow(GuiDpy, gtx->chslice_pos_slider->window, winatts2.x, winatts.height-38, winatts2.width, winatts2.height); mod_vpos_slider (dindex, gtx->chslice_pos_slider, vvar, 0, level); XMapWindow (GuiDpy, gtx->CHSliceWindow); cb_dindex = dindex; cb_chvindex[cb_dindex] = vindex; cb_chvar[cb_dindex] = var; cb_chvvar[cb_dindex] = vvar; LUI_ColorBarSetSize( gtx->CHSliceColorbar, winatts.width, winatts.height - 68); LUI_ColorBarChange (gtx->CHSliceColorbar, label, units, min, max, colors, 255, p); LUI_ColorBarShow( gtx->CHSliceColorbar ); return 1; } XMapWindow (GuiDpy, gtx->ColorbarWindow); cb_dindex = dindex; cb_vindex[cb_dindex] = vindex; cb_graphic[cb_dindex] = graphic; cb_var[cb_dindex] = var; cb_vvar[cb_dindex] = vvar; XGetWindowAttributes( GuiDpy, gtx->ColorbarWindow, &winatts); LUI_ColorBarSetSize( gtx->Colorbar, winatts.width, winatts.height-28); LUI_ColorBarChange (gtx->Colorbar, label, units, min, max, colors, 255, p); LUI_ColorBarShow( gtx->Colorbar ); return 1; } void hide_colorbar_window( int index ) { GuiContext gtx = get_gui_gtx(index); XUnmapWindow (GuiDpy, gtx->ColorbarWindow); cb_graphic[cb_dindex] = -1; cb_var[cb_dindex] = -1; cb_vvar[cb_dindex] = -1; cb_vindex[cb_dindex] = -1; } void hide_chcolorbar_window( int index ) { GuiContext gtx = get_gui_gtx(index); XUnmapWindow (GuiDpy, gtx->CHSliceWindow); cb_chvar[cb_dindex] = -1; cb_chvvar[cb_dindex] = -1; cb_chvindex[cb_dindex] = -1; } #ifdef HAVE_LIBNETCDF static int tp_close_color_cb( LUI_NEWBUTTON *b) { GuiContext gtx = get_gui_gtx(b->index); XUnmapWindow(GuiDpy, gtx->tp_color_window); return 0; } static int tp_monocolor_cb( LUI_NEWBUTTON *b) { GuiContext gtx = get_gui_gtx(b->index); int iindex = gtx->current_text_plot_iindex; int curtime, var, time, numtimes; float spacing, fontx, fonty, fontspace; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_set_textplot_color_status( iindex, var, VIS5D_OFF); show_tp_color_window( gtx, var); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, time==curtime); } } static int tp_multicolor_cb( LUI_NEWBUTTON *b) { GuiContext gtx = get_gui_gtx(b->index); int iindex = gtx->current_text_plot_iindex; int curtime, var, time, numtimes; float spacing, fontx, fonty, fontspace; vis5d_get_itx_timestep(iindex, &curtime); vis5d_get_text_plot( iindex, &var, &spacing, &fontx, &fonty, &fontspace); vis5d_set_textplot_color_status( iindex, var, VIS5D_ON); show_tp_color_window( gtx, var); vis5d_get_itx_numtimes( iindex, &numtimes); for (time = 0; time < numtimes; time++){ vis5d_make_text_plot( iindex, time, curtime==time); } } #endif /* HAVE_LIBNETCDF */ static int cb_close_cb (LUI_NEWBUTTON *b) { if (b->index == 0) hide_colorbar_window (b->context_index); else hide_chcolorbar_window (b->context_index); return 0; } /* * Set the alpha value for all color table entries for a colored slice. * NOTE: the variable var which is passed is the var of the gui_ctx */ void set_slice_alpha( int index, int graphic, int vowner, int var, int alpha ) { GuiContext gtx = get_gui_gtx(index); unsigned int *colors; float *params; int vvar; vvar = get_button_ctx_row(index, var); vis5d_get_color_table_address (index, graphic, vowner, vvar, &colors); vis5d_get_color_table_params (index, graphic, vowner, vvar, ¶ms); vis5d_color_table_set_alpha (params, alpha); vis5d_color_table_recompute (colors, 256, params, 0, 1); if (((cb_graphic[cb_dindex] == graphic) && (cb_var[cb_dindex] == var)) || ((graphic == VIS5D_CHSLICE) && (cb_chvar[cb_dindex] == var))) { /* Change alpha of displayed colorbar widget */ char label[100], name[20], units[20]; float min, max; vis5d_get_ctx_var_range (vowner, vvar, &min, &max); vis5d_get_ctx_var_name (vowner, vvar, name); vis5d_get_var_units (vowner, vvar, units); if (graphic==VIS5D_CHSLICE) { strcpy (label, "horiz slice "); } else { strcpy (label, "vert slice "); } if (graphic==VIS5D_CHSLICE) { sprintf (label, "horiz slice %s", name); LUI_ColorBarChange (gtx->CHSliceColorbar, label, units, min, max, colors, 255, params); } else if (graphic==VIS5D_CVSLICE) { sprintf (label, "vert slice %s", name); LUI_ColorBarChange (gtx->Colorbar, label, units, min, max, colors, 255, params); } } } /* MJK 12.07.98 end */ /************************************************************/ /* Create the scene save requester. */ /************************************************************/ static void make_savescene_window( int index ) { GuiContext gtx = get_gui_gtx(index); LUI_NEWBUTTON *b; char **labels; int n, formats; vis5d_get_scene_formats( &formats ); gtx->SaveSceneWindow = LUI_CreateWindowAt( LUI_RootWindow, 50, 250, 290,222 ); LUI_NewLabelCreate( gtx->SaveSceneWindow, LUI_LEFT, LUI_TOP, 280, 30, "Save Scene" ); /* allocate array of 2 char pointers */ labels = (char **) malloc( 2 * sizeof(char *) ); /* make labels for radio button and update SceneFormats array */ n = 0; if (formats & VIS5D_VRML) { labels[n] = strdup("VRML"); gtx->SceneFormats[n] = VIS5D_VRML; n++; } if (formats & VIS5D_POV) { labels[n] = strdup("POV"); gtx->SceneFormats[n] = VIS5D_POV; n++; } gtx->SaveSceneRadio = LUI_RadioCreate( gtx->SaveSceneWindow, LUI_LEFT, LUI_NEXT_Y, 280, n, labels ); LUI_NewLabelCreate( gtx->SaveSceneWindow, LUI_LEFT, LUI_NEXT_Y, 280, 30, "File name: " ); gtx->SaveSceneField = LUI_FieldCreate( gtx->SaveSceneWindow, LUI_LEFT, LUI_NEXT_Y, 280, 26 ); b = LUI_PushButtonCreate( gtx->SaveSceneWindow, 30, LUI_NEXT_Y, 100, 26, "Save" ); LUI_ButtonCallback( b, ok_cb ); b = LUI_PushButtonCreate( gtx->SaveSceneWindow, 160, LUI_SAME_Y, 100, 26, "Cancel" ); LUI_ButtonCallback( b, cancel_cb ); XUnmapWindow( GuiDpy, gtx->SaveSceneWindow ); } /************************************************************/ /* Create the window save requester. */ /************************************************************/ static void make_savepic_window( int index ) { GuiContext gtx = get_gui_gtx(index); LUI_NEWBUTTON *b; char **labels; int n, formats; vis5d_get_image_formats( &formats ); gtx->SavePicWindow = LUI_CreateWindowAt( LUI_RootWindow, 50, 250, 290,222 ); LUI_NewLabelCreate( gtx->SavePicWindow, LUI_LEFT, LUI_TOP, 280, 30, "Save Window Image" ); /* allocate array of 6 char pointers */ labels = (char **) malloc( 6 * sizeof(char *) ); /* make labels for radio button and update SaveFormats array */ n = 0; /* The default format is the first available */ if (formats & VIS5D_RGB) { labels[n] = strdup("SGI .rgb"); gtx->SaveFormats[n] = VIS5D_RGB; n++; } if (formats & VIS5D_XWD) { labels[n] = strdup("xwd (X Window Dump)"); gtx->SaveFormats[n] = VIS5D_XWD; n++; } if (formats & VIS5D_GIF) { labels[n] = strdup("GIF"); gtx->SaveFormats[n] = VIS5D_GIF; n++; } if (formats & VIS5D_PS) { labels[n] = strdup("PostScript"); gtx->SaveFormats[n] = VIS5D_PS; n++; } if (formats & VIS5D_COLOR_PS) { labels[n] = strdup("Color PostScript"); gtx->SaveFormats[n] = VIS5D_COLOR_PS; n++; } /* MJK 11.19.98 */ if (formats & VIS5D_PPM) { labels[n] = strdup("24 bit ppm"); gtx->SaveFormats[n] = VIS5D_PPM; n++; } gtx->SavePicRadio = LUI_RadioCreate( gtx->SavePicWindow, LUI_LEFT, LUI_NEXT_Y, 280, n, labels ); LUI_NewLabelCreate( gtx->SavePicWindow, LUI_LEFT, LUI_NEXT_Y, 280, 30, "File name: " ); gtx->SavePicField = LUI_FieldCreate( gtx->SavePicWindow, LUI_LEFT, LUI_NEXT_Y, 280, 26 ); b = LUI_PushButtonCreate( gtx->SavePicWindow, 30, LUI_NEXT_Y, 100, 26, "Save" ); LUI_ButtonCallback( b, ok_cb ); b = LUI_PushButtonCreate( gtx->SavePicWindow, 160, LUI_SAME_Y, 100, 26, "Cancel" ); LUI_ButtonCallback( b, cancel_cb ); XUnmapWindow( GuiDpy, gtx->SavePicWindow ); } /********************************************************* Input: index - display or gui index vindex - vis5d data ctx Output: return 1 if the display contains the data set vindex, or return 0 if it does not. ***********************************************************/ int is_valid( int index, int vindex) { GuiContext gtx = get_gui_gtx(index); int yo, spandex; for (yo=0; yo < gtx->how_many_regular_contexts; yo++){ spandex = gtx->array_of_ctxs[yo]; if (vindex == spandex){ return 1; } } return 0; } /* BUG FIX MJK 8.10.98 */ /* added this function so when adding a display to a group */ /* all the other graphics in that group are turned off also */ /* this is so that all graphics are in sync. I could have serched */ /* though every graphics and mode in the other displays and set the */ /* newly group display to the same but that's too much work for now */ /* maybe do it later */ void group_turn_off_everything( int index ) { int dyo, dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; vis5d_get_num_of_dtxs_in_group( index, &dhowmany, dwhichones); for (dyo = 0; dyo < dhowmany; dyo++){ turn_off_everything( dwhichones[dyo] ); } } void turn_off_everything( int index ) { GuiContext gtx = get_gui_gtx(index); int i, j, ws; int ctxindex, ctxrow, yo; float r, g, b, a; if (gtx->how_many_regular_contexts>0){ /* take care of the button matix! */ for (i=0; i < gtx->total_numvars; i++){ for (j=0;jColumns;j++) { int ctxi, what; switch (j) { case 0: what = VIS5D_ISOSURF; break; case 1: what = VIS5D_HSLICE; break; case 2: what = VIS5D_VSLICE; break; case 3: what = VIS5D_CHSLICE; break; case 4: what = VIS5D_CVSLICE; break; case 5: what = VIS5D_VOLUME; break; default: /* better never happen! */ abort(); } ctxrow = get_button_ctx_row(index, i); ctxindex = get_button_ctx_index(index, i); vis5d_enable_graphics( ctxindex, what, ctxrow, VIS5D_OFF); LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 0 ); } } vis5d_set_volume( index, -1, -1 ); gtx->CurrentVolume = -1; gtx->CurrentVolume = -1; /* get those wind slices too! */ for (ws=0;wsarray_of_ctxs[0], VIS5D_HWIND, ws, VIS5D_OFF); LUI_ButtonSetState( gtx->hwind_button[ws], 0 ); vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_VWIND, ws, VIS5D_OFF); LUI_ButtonSetState( gtx->vwind_button[ws], 0 ); } vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_HSTREAM, 0, VIS5D_OFF); vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_VSTREAM, 0, VIS5D_OFF); LUI_ButtonSetState( gtx->hstream_button[0], 0 ); LUI_ButtonSetState( gtx->vstream_button[0], 0 ); for (i=0;ituowner, VIS5D_TRAJ, i, VIS5D_OFF); LUI_ButtonState( gtx->TrajButton[i], 0); } if (gtx->SoundCtrlWindow){ XUnmapWindow( GuiDpy, gtx->SoundCtrlWindow ); } LUI_ButtonState( gtx->normalBUTTON, 1 ); if (gtx->total_ctx_numtimes>1) { LUI_ButtonState( gtx->trajectoryBUTTON, 0); } gtx->cur_isosurf = gtx->cur_isosurfvindex = -1; gtx->cur_hslice = gtx->cur_hslicevindex = -1; gtx->cur_vslice = gtx->cur_vslicevindex = -1; gtx->cur_hwind = gtx->cur_vwind = -1; gtx->cur_hstream = gtx->cur_vstream = -1; cb_graphic[index] = -1; cb_var[index] = -1; cb_chvar[index] = -1; cb_vvar[index] = -1; cb_chvvar[index] = -1; gtx->cur_isosurfmap = 0; gtx->cur_hslicemap = 0; gtx->cur_vslicemap = 0; gtx->cur_hwindmap = 0; gtx->cur_vwindmap = 0; gtx->cur_hstreammap = 0; gtx->cur_vstreammap = 0; hide_isocolor_window( gtx ); hide_rgb_sliders( gtx ); } if (gtx->how_many_irregular_contexts>0){ for (i = 0; i < gtx->how_many_irregular_contexts; i++){ vis5d_enable_irregular_graphics(gtx->array_of_itxs[i], VIS5D_TEXTPLOT, VIS5D_OFF); if (gtx->TextPlotButtonMatrix){ for (j = 0; j < gtx->IrregularNumVars[gtx->array_of_itxs[i]]; j++){ LUI_ButtonMatrixSetState(gtx->TextPlotButtonMatrix, j, 0, 0); } } } gtx->current_text_plot_var = -1; } gtx->topoBUTTON->state = 0; gtx->map_button->state = 0; gtx->boxBUTTON->state = 1; gtx->clockBUTTON->state = 1; gtx->gridBUTTON->state = 0; gtx->contBUTTON->state = 1; gtx->reverseBUTTON->state = 0; gtx->perspec_button->state = 0; vis5d_graphics_mode(index, VIS5D_TOPO, VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_MAP, VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_BOX, VIS5D_ON); vis5d_graphics_mode(index, VIS5D_CLOCK,VIS5D_ON); vis5d_graphics_mode(index, VIS5D_GRID_COORDS,VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_CONTOUR_NUMBERS,VIS5D_ON); vis5d_graphics_mode(index, VIS5D_REVERSE,VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_PERSPECTIVE,VIS5D_OFF); gtx->MouseMode = MM_NORMAL; LUI_LabelChangeText( gtx->ModeInfoLabel, 6, ModeInfo1 ); vis5d_graphics_mode(index, VIS5D_CURSOR, VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_PROBE, VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_SOUND, VIS5D_OFF); vis5d_graphics_mode(index, VIS5D_CLIP, VIS5D_OFF); LUI_ButtonState( gtx->sliceBUTTON, 0); LUI_ButtonState( gtx->labelBUTTON, 0); LUI_ButtonState( gtx->probeBUTTON, 0); LUI_ButtonState( gtx->soundingBUTTON, 0); LUI_ButtonState( gtx->clippingBUTTON, 0); hide_widgets(index); } /* MJK 12.01.98 */ void update_button_matrix( int index ) { GuiContext gtx = get_gui_gtx(index); int ctxrow, ctxindex, yo, i, j; float r, g, b, a; for (yo=0; yo < gtx->how_many_regular_contexts; yo++){ for (i=0; i < gtx->total_numvars; i++){ for (j=0;jColumns-1;j++) { int ctxi, what; switch (j) { case 0: what = VIS5D_ISOSURF; break; case 1: what = VIS5D_HSLICE; break; case 2: what = VIS5D_VSLICE; break; case 3: what = VIS5D_CHSLICE; break; case 4: what = VIS5D_CVSLICE; break; default: /* better never happen! */ abort(); } ctxrow = get_button_ctx_row(index, i); ctxindex = get_button_ctx_index(index, i); vis5d_get_color(index, what, ctxindex*MAXVARS+ctxrow, &r, &g, &b, &a ); LUI_ButtonMatrixSetColor( gtx->ButtonMatrix, i, what, r, g, b ); if (vis5d_enable_graphics( ctxindex, what, ctxrow, VIS5D_GET )){ LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 1 ); } else{ LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 0 ); } } } } } /* This will update the button matrix, and if double_check = 1 */ /* then it will set all button sliders and windows to off but */ /* then check to see if any should be on. */ /* This take care of: GUI BUTTON MATRIX, SLIDERS, RGB CONTROLS.*/ /* Call. show_widgets after this. */ /* WLH 13 Oct 98 static void update_button_states( int index, int double_check ) */ /* WLH 13 Oct 98 */ void update_button_states( int index, int double_check ) { GuiContext gtx = get_gui_gtx(index); int i, j, ws; int ctxindex, ctxrow, yo; float r, g, b, a; int volo, volvar; if (gtx->how_many_regular_contexts > 0){ if (double_check){ gtx->cur_isosurf = -1; gtx->cur_isosurfvindex = -1; gtx->cur_isosurfmap = 0; gtx->cur_hslice = -1; gtx->cur_hslicevindex = -1; gtx->cur_hslicemap = 0; gtx->cur_vslice = -1; gtx->cur_vslicevindex = -1; gtx->cur_vslicemap = 0; cb_var[index] = -1; cb_vvar[index] = -1; cb_vindex[index] = -1; cb_graphic[index] = -1; cb_chvar[index] = -1; cb_chvvar[index] = -1; cb_chvindex[index] = -1; } vis5d_get_volume( index, &volo, &volvar); /* redraw all buttons with restored colors */ for (yo=0; yo < gtx->how_many_regular_contexts; yo++){ for (i=0; i < gtx->total_numvars; i++){ for (j=0;jColumns;j++) { int ctxi, what; switch (j) { case 0: what = VIS5D_ISOSURF; break; case 1: what = VIS5D_HSLICE; break; case 2: what = VIS5D_VSLICE; break; case 3: what = VIS5D_CHSLICE; break; case 4: what = VIS5D_CVSLICE; break; case 5: what = VIS5D_VOLUME; break; default: /* better never happen! */ abort(); } ctxrow = get_button_ctx_row(index, i); ctxindex = get_button_ctx_index(index, i); vis5d_get_color(index, what, ctxindex*MAXVARS+ctxrow, &r, &g, &b, &a ); LUI_ButtonMatrixSetColor( gtx->ButtonMatrix, i, what, r, g, b ); if (vis5d_enable_graphics( ctxindex, what, ctxrow, VIS5D_GET ) && (j != 5 || (j==5 && ctxindex==volo && ctxrow==volvar))){ LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 1 ); if (double_check){ switch (j) { case 0: gtx->cur_isosurf = ctxrow; gtx->cur_isosurfvindex = ctxindex; gtx->cur_isosurfmap = 1; break; case 1: gtx->cur_hslice = ctxrow; gtx->cur_hslicevindex = ctxindex; gtx->cur_hslicemap = 1; break; case 2: gtx->cur_vslice = ctxrow; gtx->cur_vslicevindex = ctxindex; gtx->cur_vslicemap = 1; break; case 3: cb_chvar[index] = ctxrow; cb_chvindex[index] = ctxindex; break; case 4: cb_chvvar[index] = ctxrow; cb_chvar[index] = i; cb_chvindex[index] = ctxindex; break; case 5: cb_var[index] = i; cb_vvar[index] = ctxrow; cb_vindex[index] = ctxindex; cb_graphic[index] = VIS5D_VOLUME; break; default: /* better never happen! */ abort(); } } } else{ LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 0 ); } } } } if (double_check){ gtx->cur_hwind = -1; gtx->cur_hwindmap = 0; gtx->cur_vwind = -1; gtx->cur_vwindmap = 0; gtx->cur_hstream = -1; gtx->cur_hstreammap = 0; gtx->cur_vstream = -1; gtx->cur_vstreammap = 0; gtx->uvw_map = 0; hide_isocolor_window( gtx ); hide_rgb_sliders( gtx ); } /* update wind slice buttons */ for (ws=0;wshwind_button[ws], r, g, b ); vis5d_get_color( index, VIS5D_VWIND, ws, &r, &g, &b, &a ); LUI_ButtonColor( gtx->vwind_button[ws], r, g, b ); /* on/off status */ if (vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_HWIND, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->hwind_button[ws], 1 ); if (double_check){ gtx->cur_hwind = ws; gtx->cur_hwindmap = 1; } } else { LUI_ButtonSetState( gtx->hwind_button[ws], 0 ); } if (vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_VWIND, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->vwind_button[ws], 1 ); if (double_check){ gtx->cur_vwind = ws; gtx->cur_vwindmap = 1; } } else { LUI_ButtonSetState( gtx->vwind_button[ws], 0 ); } } ws = 0; vis5d_get_color( index, VIS5D_HSTREAM, ws, &r, &g, &b, &a ); LUI_ButtonColor( gtx->hstream_button[ws], r, g, b ); vis5d_get_color( index, VIS5D_VSTREAM, ws, &r, &g, &b, &a ); LUI_ButtonColor( gtx->vstream_button[ws], r, g, b ); if (vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_HSTREAM, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->hstream_button[ws], 1 ); if (double_check){ gtx->cur_hstream = ws; gtx->cur_hstreammap = 1; } } else { LUI_ButtonSetState( gtx->hstream_button[ws], 0 ); } if (vis5d_enable_graphics(gtx->array_of_ctxs[0], VIS5D_VSTREAM, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->vstream_button[ws], 1 ); if (double_check){ gtx->cur_vstream = ws; gtx->cur_vstreammap = 1; } } else { LUI_ButtonSetState( gtx->vstream_button[ws], 0 ); } } } void show_widgets( int index ) { GuiContext gtx = get_gui_gtx(index); int i, j; int spandex; int ctxindex, ctxrow, yo, gindex; int dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; int dyo; cb_dindex = index; vis5d_get_display_group( index, &gindex ); ctxindex = gtx->array_of_ctxs[0]; gtx->group_index = gindex; if (gtx->how_many_regular_contexts <1){ return; } map_map_window(index, vis5d_graphics_mode (index, VIS5D_MAP, VIS5D_GET)); if (gtx->cur_isosurf>=0 && gtx->cur_isosurfmap == 1 && is_valid(index, gtx->cur_isosurfvindex)) { map_isosurf_window( index, gtx->cur_isosurfvindex, gtx->cur_isosurf ); } if (gtx->cur_hslice>=0 && gtx->cur_hslicemap == 1 && is_valid(index, gtx->cur_hslicevindex)) { map_hslice_window( index, gtx->cur_hslicevindex, gtx->cur_hslice ); } if (gtx->cur_vslice>=0 && gtx->cur_vslicemap == 1 && is_valid(index, gtx->cur_vslicevindex)) { map_vslice_window( index, gtx->cur_vslicevindex, gtx->cur_vslice ); } if (gtx->uvw_map){ show_uvw_widget( gtx ); } if (cb_graphic[cb_dindex]>=0 && cb_var[cb_dindex]>=0 && is_valid( index, cb_vindex[cb_dindex])) { show_colorbar_window( index, cb_vindex[cb_dindex], cb_graphic[cb_dindex], cb_var[cb_dindex] ); } if (cb_chvar[cb_dindex]>=0 && is_valid( index, cb_chvindex[cb_dindex])) { show_colorbar_window( index, cb_chvindex[cb_dindex], VIS5D_CHSLICE, cb_chvar[cb_dindex] ); } refresh_isocolor_window( gtx ); refresh_rgb_sliders2( gtx ); if (gtx->MouseMode==MM_TRAJ && gtx->TrajWindow){ XMapWindow( GuiDpy, gtx->TrajWindow ); } if (gtx->group_index >= 1 && gtx->MouseMode==MM_SOUND){ vis5d_get_num_of_dtxs_in_group( gtx->group_index, &dhowmany, dwhichones); for (dyo = 0; dyo < dhowmany; dyo++){ vis5d_map_sndwindow(dwhichones[dyo]); vis5d_draw_sounding_only( dwhichones[dyo], 1); } } else if (gtx->MouseMode==MM_SOUND){ /* MJK 3.9.99 */ vis5d_map_sndwindow( index ); vis5d_draw_sounding_only( index, 1); } /* Go through some of the Cp_window buttons */ if (gtx->GoTime == 1 || gtx->GoTime == -1){ gtx->animateBUTTON->state = 1; } else{ gtx->animateBUTTON->state = 0; } gtx->topoBUTTON->state = vis5d_graphics_mode(index, VIS5D_TOPO, VIS5D_GET); gtx->map_button->state = vis5d_graphics_mode(index, VIS5D_MAP, VIS5D_GET); gtx->boxBUTTON->state = vis5d_graphics_mode(index, VIS5D_BOX, VIS5D_GET); gtx->clockBUTTON->state = vis5d_graphics_mode(index, VIS5D_CLOCK,VIS5D_GET); gtx->gridBUTTON->state = vis5d_graphics_mode(index, VIS5D_GRID_COORDS,VIS5D_GET); gtx->contBUTTON->state = vis5d_graphics_mode(index, VIS5D_CONTOUR_NUMBERS,VIS5D_GET); gtx->reverseBUTTON->state = vis5d_graphics_mode(index, VIS5D_REVERSE,VIS5D_GET); gtx->perspec_button->state = vis5d_graphics_mode(index, VIS5D_PERSPECTIVE,VIS5D_GET); gtx->legendsBUTTON->state = vis5d_graphics_mode(index, VIS5D_LEGENDS, VIS5D_GET); if(gtx->stereoBUTTON){ int value; vis5d_stereo_get(index,&value); gtx->stereoBUTTON->state = value; } /* MJK 12.04.98 begin */ { gtx->animateBUTTON->state = (gtx->GoTime != 0); if (gtx->map_button) { float r, g, b, a; if (vis5d_enable_sfc_map (index, VIS5D_GET)) vis5d_get_color (index, VIS5D_DARK_MAP, 0, &r, &g, &b, &a); else vis5d_get_color (index, VIS5D_LIGHT_MAP, 0, &r, &g, &b, &a); LUI_ButtonColor (gtx->map_button, r, g, b); gtx->map_button->state = vis5d_graphics_mode (index, VIS5D_MAP, VIS5D_GET); } if ((gtx->cur_hwind >= 0) && (gtx->cur_hwindmap == 1)) { XUnmapWindow (GuiDpy, gtx->HWindWindow); map_hwind_window (index, gtx->cur_hwind); } if ((gtx->cur_hstream >= 0) && (gtx->cur_hstreammap == 1)) { XUnmapWindow (GuiDpy, gtx->HWindWindow); map_hstream_window (index, gtx->cur_hstream); } if ((gtx->cur_vwind >= 0) && (gtx->cur_vwindmap == 1)) { XUnmapWindow (GuiDpy, gtx->WindWindow); map_vwind_window (index, gtx->cur_vwind); } if ((gtx->cur_vstream >= 0) && (gtx->cur_vstreammap == 1)) { XUnmapWindow (GuiDpy, gtx->WindWindow); map_vstream_window (index, gtx->cur_vstream); } /* note that the hslice, hwind, and hstream SFC buttons were reset * when their windows were mapped. */ } { float level; vis5d_get_flatmap_level (ctxindex, &level); update_vpos_slider (index, VIS5D_MAP, -1, level); } /* MJK 12.07.98 */ /* update_button_states (index); */ update_snd_widgets (index); /* MJK 12.04.98 end */ } void hide_widgets( int index ) { GuiContext gtx = get_gui_gtx2(index); int howmany, whichones[VIS5D_MAX_CONTEXTS]; if (!gtx){ return; } vis5d_get_num_of_ctxs_in_display( index, &howmany, whichones); if (howmany > 0){ XUnmapWindow( GuiDpy, gtx->IsoWindow ); XUnmapWindow( GuiDpy, gtx->HSliceWindow ); XUnmapWindow( GuiDpy, gtx->VSliceWindow ); XUnmapWindow( GuiDpy, gtx->WindWindow ); if (gtx->uvw_window){ XUnmapWindow( GuiDpy, gtx->uvw_window); } LUI_ColorBarHide( gtx->Colorbar ); XUnmapWindow( GuiDpy, gtx->isocolor_window); XUnmapWindow( GuiDpy, gtx->rgb_sliders_window ); XUnmapWindow(GuiDpy, gtx->TrajWindow ); /* MJK 12.04.98 */ XUnmapWindow (GuiDpy, gtx->MapWindow); XUnmapWindow (GuiDpy, gtx->CHSliceWindow); XUnmapWindow (GuiDpy, gtx->HWindWindow); XUnmapWindow (GuiDpy, gtx->ColorbarWindow); vis5d_unmap_sndwindow( index); XUnmapWindow( GuiDpy, gtx->SoundCtrlWindow ); XUnmapWindow( GuiDpy, gtx->VerifyWindow ); XUnmapWindow( GuiDpy, gtx->AlertWindow ); if (gtx->CloneWindow) { XUnmapWindow( GuiDpy, gtx->CloneWindow ); } if (gtx->WindWindow) { XUnmapWindow( GuiDpy, gtx->WindWindow ); } if (gtx->ExprWindow){ XUnmapWindow( GuiDpy, gtx->ExprWindow ); } } vis5d_get_num_of_itxs_in_display( index, &howmany, whichones); if (howmany > 0){ if (gtx->TextPlotWindow){ XUnmapWindow(GuiDpy, gtx->TextPlotWindow); } } } /* * This is called after we execute a Tcl script, do a RESTORE, or compute * a new type-in expression. It updates the color and on/off state of * all GUI buttons. */ static void reset_widgets( int index ) { int i, j, time, var, ws, numvars; GuiContext gtx = get_gui_gtx(index); float r, g, b, a; vis5d_get_ctx_numvars( index, &numvars ); if (gtx->cur_isosurf>=0) { XUnmapWindow( GuiDpy, gtx->IsoWindow ); map_isosurf_window( index, gtx->cur_isosurfvindex, gtx->cur_isosurf ); } if (gtx->cur_hslice>=0) { XUnmapWindow( GuiDpy, gtx->HSliceWindow ); map_hslice_window( index, gtx->cur_hslicevindex, gtx->cur_hslice ); } if (gtx->cur_vslice>=0) { XUnmapWindow( GuiDpy, gtx->VSliceWindow ); map_vslice_window( index, gtx->cur_vslicevindex, gtx->cur_vslice ); } if (cb_graphic[cb_dindex]>=0 && cb_var[cb_dindex]>=0) { show_colorbar_window( index, cb_vindex[cb_dindex], cb_graphic[cb_dindex], cb_var[cb_dindex] ); } if (cb_chvar[cb_dindex]>=0) { show_colorbar_window( index, cb_chvindex[cb_dindex], VIS5D_CHSLICE, cb_chvar[cb_dindex] ); } if (gtx->cur_hwind>=0 || gtx->cur_vwind>=0 || gtx->cur_hstream>=0 || gtx->cur_vstream>=0) { XUnmapWindow( GuiDpy, gtx->WindWindow ); if (gtx->cur_hwind>=0) { map_hwind_window( index, gtx->cur_hwind ); } else if (gtx->cur_vwind>=0) { map_vwind_window( index, gtx->cur_vwind ); } else if (gtx->cur_hstream>=0) { map_hstream_window( index, gtx->cur_hstream ); } else { map_vstream_window( index, gtx->cur_vstream ); } } refresh_isocolor_window( gtx ); refresh_rgb_sliders( gtx ); /* redraw all buttons with restored colors */ for (i=0;iColumns;j++) { float r, g, b, a; int what; switch (j) { case 0: what = VIS5D_ISOSURF; break; case 1: what = VIS5D_HSLICE; break; case 2: what = VIS5D_VSLICE; break; case 3: what = VIS5D_CHSLICE; break; case 4: what = VIS5D_CVSLICE; break; case 5: what = VIS5D_VOLUME; break; default: /* better never happen! */ abort(); } vis5d_get_color( index, what, i, &r, &g, &b, &a ); LUI_ButtonMatrixSetColor( gtx->ButtonMatrix, i, what, r, g, b ); if (vis5d_enable_graphics( index, what, i, VIS5D_GET )) { LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 1 ); } else { LUI_ButtonMatrixSetState( gtx->ButtonMatrix, i, j, 0 ); } } } if (gtx->perspec_button != NULL) { int PerspecFlag; PerspecFlag = vis5d_graphics_mode(index, VIS5D_PERSPECTIVE, VIS5D_GET); LUI_ButtonSetState(gtx->perspec_button, PerspecFlag); } /* trajectory colors */ for (i=0;iTrajButton[i], (int)(r*255.0), (int)(g*255.0), (int)(b*255.0) ); } { float UserTrajStep, UserTrajLength; int RibbonFlag; vis5d_get_traj(index, &UserTrajStep, &UserTrajLength, &RibbonFlag); LUI_ButtonSetState( gtx->TrajRibbonButton, RibbonFlag); LUI_FieldSetDouble( gtx->TrajStepField, UserTrajStep ); LUI_FieldSetDouble( gtx->TrajLenField, UserTrajLength ); } /* update wind slice buttons */ for (ws=0;wshwind_button[ws], r, g, b ); vis5d_get_color( index, VIS5D_VWIND, ws, &r, &g, &b, &a ); LUI_ButtonColor( gtx->vwind_button[ws], r, g, b ); /* on/off status */ if (vis5d_enable_graphics(index, VIS5D_HWIND, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->hwind_button[ws], 1 ); } else { LUI_ButtonSetState( gtx->hwind_button[ws], 0 ); } if (vis5d_enable_graphics(index, VIS5D_VWIND, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->vwind_button[ws], 1 ); } else { LUI_ButtonSetState( gtx->vwind_button[ws], 0 ); } } /* update stream slice buttons */ ws = 0; vis5d_get_color( index, VIS5D_HSTREAM, ws, &r, &g, &b, &a ); LUI_ButtonColor( gtx->hstream_button[ws], r, g, b ); vis5d_get_color( index, VIS5D_VSTREAM, ws, &r, &g, &b, &a ); LUI_ButtonColor( gtx->vstream_button[ws], r, g, b ); if (vis5d_enable_graphics(index, VIS5D_HSTREAM, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->hstream_button[ws], 1 ); } else { LUI_ButtonSetState( gtx->hstream_button[ws], 0 ); } if (vis5d_enable_graphics(index, VIS5D_VSTREAM, ws, VIS5D_GET)) { LUI_ButtonSetState( gtx->vstream_button[ws], 1 ); } else { LUI_ButtonSetState( gtx->vstream_button[ws], 0 ); } } /* WLH 11 Nov 98 */ void recompute_graphics( int index, int numtrajs, float *lats, float *lons, float *alts, int *days, int *times, int *gps) { recompute_graphics_var(index, numtrajs, lats, lons, alts, days, times, gps, -1); } /* * This is called after we execute a Tcl script, do a RESTORE, or compute * a new type-in expression. It recomputes any graphics whose parameters * may have been changed by the script. */ /* WLH 11 Nov 98 void recompute_graphics( int index, int numtrajs, float *lats, float *lons, float *alts, int *days, int *times, int *gps) */ /* WLH 11 Nov 98 */ void recompute_graphics_var( int index, int numtrajs, float *lats, float *lons, float *alts, int *days, int *times, int *gps, int cvar) { GuiContext gtx = get_gui_gtx2(index); int dhowmany, dwhichones[VIS5D_MAX_CONTEXTS]; int chowmany, cwhichones[VIS5D_MAX_CONTEXTS]; int dnumtimes, cnumtimes, dyo, cyo, yo; int curtime, dcurtime, ccurtime, var, ws, time, numvars; vis5d_get_num_of_itxs_in_display( index, &chowmany, cwhichones); for ( cyo = 0; cyo < chowmany; cyo++){ vis5d_get_itx_numtimes( cwhichones[cyo], &cnumtimes ); vis5d_get_itx_timestep(cwhichones[cyo], &curtime); #ifdef HAVE_LIBNETCDF if (vis5d_enable_irregular_graphics(cwhichones[cyo], VIS5D_ISOSURF, VIS5D_GET)){ for (time=0;time= 0 && var != cvar) continue; /* WLH 21 Oct 98 */ if (vis5d_enable_graphics(cwhichones[cyo], VIS5D_ISOSURF, var, VIS5D_GET)) { for (time=0;time