static void func_update() { char *label; int value; value = (int)xv_get(vsi.func_choice, PANEL_VALUE); label = (char *)xv_get(vsi.func_choice, PANEL_CHOICE_STRING, value); delete vsi.default_vsfunc; if (strcasecmp(label,"linear") == 0){ vsi.default_vsfunc = linear_scale(); vsi.myknots = LIN_KNOTS; xv_set(vsi.popup, FRAME_LEFT_FOOTER, "LEFT moves/creates, MIDDLE deletes points", NULL); }else if (strcasecmp(label,"spline") == 0){ vsi.default_vsfunc = spline_scale(); vsi.myknots = SPL_KNOTS; xv_set(vsi.popup, FRAME_LEFT_FOOTER, "LEFT moves/creates, MIDDLE deletes points", NULL); }else if (strcasecmp(label,"log") == 0){ vsi.default_vsfunc = log_scale(); }else if (strcasecmp(label,"power") == 0){ vsi.default_vsfunc = power_scale(); }else if (strcasecmp(label,"curve") == 0){ vsi.default_vsfunc = curve_scale(); vsi.myknots = CRV_KNOTS; xv_set(vsi.popup, FRAME_LEFT_FOOTER, "LEFT moves points", NULL); } }
/************************************************************************ * * * Create macro display window. It actually creates it when the first * message is displayed. * */ void msgmacro_win_create(Frame owner, int x, int y, int wd, int ht) { if (wmacromsg) { STDERR("msgmacro_win_create:Window has been created"); return; } if ((wmacromsg = (Wmsgprt *)malloc(sizeof(Wmsgprt))) == NULL) { PERROR("msgmacro_win_create:Cannot malloc"); return; } wmacromsg->owner = owner; wmacromsg->popup = NULL; wmacromsg->textsw = NULL; wmacromsg->x = x; wmacromsg->y = y; wmacromsg->wd = wd; wmacromsg->ht = ht; /* Since there is a BUG in Xview, we cannot wait to create a window. */ /* Until the bug is fixed, we create a window at start-up time (NOW). */ msgprt_win_create(wmacromsg); xv_set(wmacromsg->popup, FRAME_LABEL, "Macro Edit", NULL); xv_set(wmacromsg->textsw, TEXTSW_BROWSING, FALSE, WIN_KBD_FOCUS, TRUE, NULL); }
/************************************************************************ * * * Show Info message. * * Note that it DOES NOT prefix the message with a newline. * * */ void msginfo_print(char *format, ...) { char msgbuf[128]; /* message buffer */ va_list vargs; /* variable argument pointer */ /* Create window message if it is not created */ if (winfomsg->popup == NULL) { msgprt_win_create(winfomsg); xv_set(winfomsg->popup, FRAME_LABEL, "Info Messages", NULL); } if ( (xv_get(winfomsg->popup, XV_SHOW) == FALSE) || (format == NULL) ){ xv_set(winfomsg->popup, XV_SHOW, TRUE, NULL); xv_set(winfomsg->popup, FRAME_CMD_PUSHPIN_IN, TRUE, NULL); } if (format == NULL) return; va_start(vargs, format); (void)vsprintf(msgbuf, format, vargs); va_end(vargs); int point = (int)xv_get(winfomsg->textsw, TEXTSW_INSERTION_POINT); show_msg_text(winfomsg->textsw, msgbuf); if (point == 0){ xv_set(winfomsg->textsw, TEXTSW_FIRST, point, NULL); } }
/************************************************************************ * * * Turn on/off constant value item. * * (STATIC) * * */ void Win_arith::apply_proc(Panel_item, int val) { if (val == 0){ xv_set(winarith->constant_item, PANEL_SHOW_ITEM, FALSE, NULL); }else{ xv_set(winarith->constant_item, PANEL_SHOW_ITEM, TRUE, NULL); } }
void ResizeZTScale() { xv_set(ztscl_top_canvas, XV_X, 0, XV_Y, 0, XV_WIDTH, ZCvsWidth+ZTrkLabWidth, NULL); xv_set(ztscl_bot_canvas, XV_X, 0, XV_Y, ZCvsHeight+ZTSHEIGHT-1, XV_WIDTH, ZCvsWidth+ZTrkLabWidth, NULL); return; }
void set_vscale(float datamax, float datamin) { char buf[20]; sprintf(buf,"%-.4g", datamin); xv_set(vsi.min_data, PANEL_VALUE, buf, NULL); sprintf(buf,"%-.4g", datamax); xv_set(vsi.max_data, PANEL_VALUE, buf, NULL); settings_update(); func_update(); }
void ZTimeScale_disp_undisp() { if (ZoomWindowMapped) { if(Mode_ZDisplayTScale) { xv_set(ztscl_top_canvas, XV_SHOW, TRUE, NULL); xv_set(ztscl_bot_canvas, XV_SHOW, TRUE, NULL); }else { xv_set(ztscl_top_canvas, XV_SHOW, FALSE, NULL); xv_set(ztscl_bot_canvas, XV_SHOW, FALSE, NULL); } } ResizeZoomWindow(); }
/* this is an unfortunate consequence of having 2 event procs handling the * same canvas. Since we mapped the left mouse button twice, the user has * to decide which one to use: */ void tt_togglePicking() { if(tt_button_picking) { /* switch back to trvltime event proc */ SwitchTTZevtProc(); tt_button_picking= 0; xv_set(pick_but, PANEL_LABEL_STRING, "To Pick ", NULL); }else { /* switch back to original event proc */ RestoreZevtProc(); tt_button_picking= 1; xv_set(pick_but, PANEL_LABEL_STRING, "TrvlTme", NULL); } }
/************************************************************************ * * * Print out directory name on file-browser. It limits the length of * * the string to be printed out. * * */ static void show_dir_path(char *dirpath) { /* Append ... at the first three charcaters and cut-off the characters */ /* which can not be showed up on the control-panel. */ if (strlen(dirpath) > (fhdl->filename_wd / 8)){ char dirbuf[128]; (void) sprintf(dirbuf, "...%s", dirpath + strlen(dirpath) - (fhdl->filename_wd / 8)); xv_set(fhdl->dirmsg, PANEL_LABEL_STRING, dirbuf, NULL); }else{ xv_set(fhdl->dirmsg, PANEL_LABEL_STRING, dirpath, NULL); } }
static void canvas_resize_proc(Canvas, int w, int h) { /*fprintf(stderr,"canvas_resize_proc(%d, %d)\n", w, h);/*CMP*/ vsi.canvas_width = w; vsi.canvas_height = h; xv_set(vsi.range_label, XV_X, (vsi.canvas_width - (int)xv_get(vsi.range_label, XV_WIDTH))/2, NULL); xv_set(vsi.max_data, XV_X, vsi.canvas_width - (int)xv_get(vsi.max_data, XV_WIDTH), NULL); build_background(); build_curve_data(vsi.default_vsfunc); }
/************************************************************************ * * * Expression text callback routine. * (STATIC) * * */ void Win_math::text_proc(Panel_item item, Event *event) { short action = event_action(event); short chr = xview_to_ascii(action); fprintf(stderr,"char=0x%x\n", chr); /*fprintf(stderr,"posn=%d\n", (int)xv_get(item, PANEL_TEXT_CURSOR));*/ xv_set(item, PANEL_TEXT_SELECT_LINE, NULL); #ifndef LINUX textsw_set_selection(wm->expression_box, 1, 4, 1); #endif xv_set(wm->expression_box, TEXTSW_INSERTION_POINT, 4, NULL); }
static void CreateTracks(Frame frame) { int height, i, y; int tsHeight= 30; int panel_width = top_panel_width; if((FrmHeight-panel_width-tsHeight)/NumTracks < 30) tsHeight= 15; if (Mode_align) { /* reserve space for time scale */ height= (float)(FrmHeight-panel_width-tsHeight)/NumTracks; tsHeight= FrmHeight-panel_width-height*NumTracks; }else { height= (float)(FrmHeight-panel_width)/NumTracks; } y=panel_width; for(i=0; i < NumTracks; i++) { CreateTrk(frame, i, height, FrmWidth, y); y+=height; } /* create one for time scale if necessary */ CreateTimeScale(frame, y, tsHeight); if(!Mode_align) { extern Canvas tscl_canvas; /* xv_set(frame,XV_SHOW,FALSE,NULL); */ /* printf("remove time bar\n"); */ xv_set(tscl_canvas,XV_SHOW,FALSE,NULL); /*CreateTimeScale(frame, y, tsHeight);*/ } }
/* * Create object `window1' in the specified instance. */ Xv_opaque SoundingChart_GUI_window1_window1_create(SoundingChart_GUI_window1_objects *ip, Xv_opaque owner) { extern Notify_value window_event_func(Xv_window, Event *, Notify_arg, Notify_event_type); Xv_opaque obj; obj = xv_create(owner, FRAME, XV_KEY_DATA, INSTANCE, ip, XV_WIDTH, 661, XV_HEIGHT, 597, XV_LABEL, "Base Window", FRAME_SHOW_FOOTER, FALSE, FRAME_SHOW_RESIZE_CORNER, TRUE, NULL); xv_set(obj, WIN_CONSUME_EVENTS, WIN_MOUSE_BUTTONS, LOC_MOVE, LOC_DRAG, LOC_WINENTER, LOC_WINEXIT, WIN_ASCII_EVENTS, WIN_LEFT_KEYS, WIN_RIGHT_KEYS, WIN_TOP_KEYS, NULL, NULL); notify_interpose_event_func(obj, (Notify_func) window_event_func, NOTIFY_SAFE); return obj; }
/************************************************************************ * * * Stop Movie Playback procedure * * */ void Win_movie::stop_playback(void) { if (play_state == PLAYING){ // do nothing if NOT currently playing ipgwin_register_user_func(MOVIE_TICK, 1, 0, (void(*)(int)) NULL); play_state = NOT_PLAYING; if (number_of_frames > 1){ xv_set(frame_slider, PANEL_VALUE, frame_number + 1, XV_SHOW, TRUE, NULL); } framelist_select (frame_number) ; xv_set(movie_speedometer, PANEL_VALUE, 0, NULL); } }
/* * Create object `em_tp' in the specified instance. */ Xv_opaque eventman_em_bw_em_tp_create(eventman_em_bw_objects *ip, Xv_opaque owner) { extern Notify_value comment_text_proc(Xv_window, Event *, Notify_arg, Notify_event_type); Xv_opaque obj; obj = xv_create(owner, TEXTSW, XV_KEY_DATA, INSTANCE, ip, XV_X, 0, XV_Y, (int)xv_get(ip->em_cp, XV_Y) + (int)xv_get(ip->em_cp, XV_HEIGHT), XV_WIDTH, WIN_EXTEND_TO_EDGE, XV_HEIGHT, WIN_EXTEND_TO_EDGE, OPENWIN_SHOW_BORDERS, TRUE, NULL); gcm_initialize_colors(obj, "White", "Black"); xv_set(textsw_first(obj), WIN_CONSUME_EVENTS, WIN_MOUSE_BUTTONS, LOC_MOVE, LOC_DRAG, LOC_WINENTER, LOC_WINEXIT, WIN_ASCII_EVENTS, WIN_LEFT_KEYS, WIN_RIGHT_KEYS, WIN_TOP_KEYS, NULL, NULL); notify_interpose_event_func(textsw_first(obj), (Notify_func) comment_text_proc, NOTIFY_SAFE); return obj; }
void GetString(char *label, char *str, int numch) { Panel in_panel; int x, y; in_buf=(char *)Malloc(numch+1); if (in_buf==NULL) return; /* not enuff mem */ in_numch= numch; *in_buf='\0'; x= (int)xv_get(tracesFrame,XV_X); y= (int)xv_get(tracesFrame,XV_Y); in_frame=(Frame)xv_create(tracesFrame, FRAME_CMD, FRAME_LABEL, "", FRAME_DONE_PROC, in_done_proc, XV_X, FrmWidth/2+x-150, XV_Y, FrmHeight/2+y-50, XV_HEIGHT, 100, XV_WIDTH, 300, NULL); in_panel=(Panel)xv_get(in_frame, FRAME_CMD_PANEL); in_text=(Panel_item)xv_create(in_panel, PANEL_TEXT, XV_X, 10, XV_Y, 40, PANEL_LAYOUT, PANEL_VERTICAL, PANEL_LABEL_STRING, label, PANEL_VALUE_DISPLAY_WIDTH, 280, PANEL_NOTIFY_PROC, in_notify_proc, NULL); xv_set(in_frame, XV_SHOW, TRUE, NULL); in_loop=1; (void)xv_window_loop(in_frame); in_loop=0; xv_destroy_safe(in_frame); strncpy(str, in_buf, numch); free(in_buf); }
/************************************************************************ * * * Create error message window. It actually creates it when the first * * message is displayed. * */ void msgerr_win_create(Frame owner, int x, int y, int wd, int ht) { if (werrmsg) { STDERR("msgerr_win_create:Window has been created"); return; } if ((werrmsg = (Wmsgprt *)malloc(sizeof(Wmsgprt))) == NULL) { PERROR("msgerr_win_create:Cannot malloc"); return; } werrmsg->owner = owner; werrmsg->popup = NULL; werrmsg->textsw = NULL; werrmsg->x = x; werrmsg->y = y; werrmsg->wd = wd; werrmsg->ht = ht; /* Since there is a BUG in Xview, we cannot wait to create a window. */ /* Until the bug is fixed, we create a window at start-up time (NOW). */ msgprt_win_create(werrmsg); xv_set(werrmsg->popup, FRAME_LABEL, "Error Messages", NULL); }
static void update_em_evt_list() { EqEvent *cur= getCurrentEvt(); #if 0 EqEvent *evt= getEventHead(); #endif EqEvent *evt= getEventTail(); int idx= 0; char buf[1000]; while (evt) { if (evt->evt && evt->evt->next!=NULL) { sprintf(buf,"%s ...", evt->evt->name); }else { sprintf(buf,"%s", evt->evt->name); } #if 0 if (evt==cur) { xv_set(em_evt_i, PANEL_LIST_INSERT, idx, PANEL_LIST_STRING, idx, buf, PANEL_LIST_SELECT, idx, TRUE, NULL); }else { xv_set(em_evt_i, PANEL_LIST_INSERT, idx, PANEL_LIST_STRING, idx, buf, PANEL_LIST_SELECT, idx, FALSE, NULL); } evt=evt->next; #endif if (evt==cur) { xv_set(em_evt_i, PANEL_LIST_INSERT, 0, PANEL_LIST_STRING, 0, buf, PANEL_LIST_SELECT, 0, TRUE, NULL); }else { xv_set(em_evt_i, PANEL_LIST_INSERT, 0, PANEL_LIST_STRING, 0, buf, PANEL_LIST_SELECT, 0, FALSE, NULL); } evt=evt->prev; idx++; } xv_set(em_evt_i, XV_KEY_DATA, NUM_ITEMS, idx, NULL); }
static void em_reset() { int num= (int)xv_get(em_evt_i, XV_KEY_DATA, NUM_ITEMS); if(num>0) { xv_set(em_evt_i, PANEL_LIST_DELETE_ROWS, 0, num, NULL); } update_em_evt_list(); }
/************************************************************************ * * * Dismiss the popup window. * * (STATIC) * * */ void Win_math::done_proc(Frame subframe) { xv_set(subframe, XV_SHOW, FALSE, NULL); delete wm; wm = NULL; win_print_msg("Math: Exit"); }
/************************************************************************ * * * high_frame_set * * */ Panel_setting Win_movie::high_frame_set(Panel_item item, int, Event *) { int n = (int)xv_get(item, PANEL_VALUE); high_frame = n - 1; xv_set(low_frame_item, PANEL_MAX_VALUE, n, NULL); return (PANEL_NONE) ; }
/************************************************************************ * * * Dismiss the popup window. * * (STATIC) * * */ void Win_histenhance::done_proc(Frame subframe) { xv_set(subframe, XV_SHOW, FALSE, NULL); delete winhist; winhist = NULL; win_print_msg("Histogram: Exit"); }
/************************************************************************ * * * Dismiss the popup window. * * (STATIC) * * */ void Win_rot::done_proc(Frame subframe) { xv_set(subframe, XV_SHOW, FALSE, NULL); delete winrot; winrot = NULL; win_print_msg("Image rotation: Exit"); }
/************************************************************************ * * * Dismiss the popup window. * * (STATIC) * * */ void Win_arith::done_proc(Frame subframe) { xv_set(subframe, XV_SHOW, FALSE, NULL); delete winarith; winarith = NULL; win_print_msg("Arithmetic: Exit"); }
/************************************************************************ * * * Update the file list from the current directory. The files might be * * added or deleted. * * */ void filelist_update(void) { if (fhdl && fhdl->filename){ xv_set(fhdl->filename, PANEL_VALUE, "", NULL); (void) file_listing(dirname); } }
void tt_updateOTitem(STI_TIME it) { STE_TIME et = sti_to_ste(it); char buf[30]; float sec = (float)et.second + (float)et.usec / USECS_PER_SEC; sprintf(buf,"%d:%d:%.2f",et.hour,et.minute,sec); xv_set(ot_txt, PANEL_VALUE, buf, NULL); }
static Select_Info *initialize_Graph_Select_Reg(void){ Panel panel; Frame gsr_frame = NULL; Canvas gsr_cvs = NULL; Window gsr_win; Xv_Window window; Select_Info *ret_val = (Select_Info*)Malloc(sizeof(Select_Info)); gsr_frame = xv_create(tracesFrame, FRAME, XV_HEIGHT, gsrwin_h+40, XV_WIDTH, gsrwin_w, NULL); gsr_cvs = xv_create(gsr_frame, CANVAS, XV_X, 0, XV_Y, 40, CANVAS_REPAINT_PROC, redraw_gsrwin, CANVAS_RESIZE_PROC, resize_gsrwin, NULL); gsr_win = xv_get(canvas_paint_window(gsr_cvs), XV_XID); handle_colours(gsr_win); window = (Xv_Window)xv_get(gsr_cvs,CANVAS_NTH_PAINT_WINDOW,0); xv_set(window,WIN_EVENT_PROC,gsr_event_handle, WIN_CONSUME_EVENTS,WIN_MOUSE_BUTTONS,NULL, NULL); panel = (Panel)xv_create(gsr_frame, PANEL, XV_X, 0, XV_Y, 0, XV_HEIGHT, 40, NULL); (void)xv_create(panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Quit", PANEL_NOTIFY_PROC, close_gsr_win, PANEL_CLIENT_DATA,gsr_frame, NULL); (void)xv_create(panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Select All", PANEL_NOTIFY_PROC, gsr_select_all, XV_KEY_DATA, PANEL_SEL_REG,ret_val, NULL); (void)xv_create(panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Deselect All", PANEL_NOTIFY_PROC, gsr_deselect_all, XV_KEY_DATA, PANEL_SEL_REG,ret_val, NULL); (void)xv_create(panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Default Selection", PANEL_NOTIFY_PROC, gsr_default, XV_KEY_DATA, PANEL_SEL_REG,ret_val, NULL); init_selection_values(ret_val); ret_val->can = gsr_cvs; ret_val->board = gsr_frame; ret_val->wind = gsr_win; createGC(gsr_win, &ret_val->txtgc); fil_sel_reg(ret_val); return ret_val; }
void RedrawBothZTScale() { int *temp; if (Mode_align && Mode_ZDisplayTScale) { XClearWindow(theDisp, ztscl_top_win); DrawTimeScale(ztscl_top_win, ztscl_gc, ts_xstart+ZTrkLabWidth, ZTrkLabWidth, ts_tstart, time_inc, ZCvsWidth, ZTSHEIGHT, ZTotalSeconds, TS_UP); XClearWindow(theDisp, ztscl_bot_win); DrawTimeScale(ztscl_bot_win, ztscl_gc, ts_xstart+ZTrkLabWidth, ZTrkLabWidth, ts_tstart, time_inc, ZCvsWidth, ZTSHEIGHT, ZTotalSeconds, TS_DN); xv_set(ztscl_top_canvas,XV_SHOW,TRUE,NULL); xv_set(ztscl_bot_canvas,XV_SHOW,TRUE,NULL); } else { xv_set(ztscl_top_canvas,XV_SHOW,FALSE,NULL); xv_set(ztscl_bot_canvas,XV_SHOW,FALSE,NULL); } }
static void choice_notify_proc(Panel_item item, int value, Event *event) { char *val, buf[100]; if (value!=nsamp_or_sec) { val= (char *)xv_get(len_txt, PANEL_VALUE); if (value==0) { /* nsamp: save seconds and set nsamp */ sp_sec= atof(val); sprintf(buf,"%d",sp_nsamp); xv_set(len_txt, PANEL_VALUE, buf, NULL); } else { /* sec: save nsamp and set secs */ sp_nsamp= atoi(val); sprintf(buf,"%f",sp_sec); xv_set(len_txt, PANEL_VALUE, buf, NULL); } } nsamp_or_sec=value; }
/************************************************************************ * * * Initialize anything related to zoom. It is called when the user just* * selects the gtool Zoom. * * */ void Zoom_routine::start(Panel props, Gtype gtype) { WARNING_OFF(gtype); active = TRUE; xv_set(props, PANEL_ITEM_MENU, props_menu, NULL); Gtools::set_props_label("Zoom Properties"); // G_Set_LineWidth(Gframe::gdev, 2); Zoomf::draw_zoom_lines(); // Draw zoom-lines }