FD_landmin *create_form_landmin(void) { FL_OBJECT *obj; FD_landmin *fdui = (FD_landmin *) fl_calloc(1, sizeof(*fdui)); fdui->landmin = fl_bgn_form(FL_NO_BOX, 330, 280); obj = fl_add_box(FL_UP_BOX,0,0,330,280,""); obj = fl_add_text(FL_NORMAL_TEXT,10,10,70,30,"Connect to :"); fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); obj = fl_add_text(FL_NORMAL_TEXT,10,50,90,30,"Disconect from:"); fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); obj = fl_add_button(FL_NORMAL_BUTTON,60,250,220,20,"Quit"); fl_set_object_callback(obj,cb_land_quitb,0); obj = fl_add_clock(FL_DIGITAL_CLOCK,140,225,70,20,""); fl_set_object_color(obj,FL_INACTIVE,FL_CYAN); fdui->host_listOB = obj = fl_add_browser(FL_NORMAL_BROWSER,40,100,270,120,"Connected to:"); fl_set_object_color(obj,FL_WHITE,FL_YELLOW); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_object_callback(obj,cb_landseld_hst,0); fdui->landnhOB = obj = fl_add_choice(FL_NORMAL_CHOICE2,110,10,200,30,""); fl_set_object_callback(obj,cb_land_nh,0); fl_set_choice_entries(obj, fdchoice_0); fl_set_choice(obj,1); fdui->landdhOB = obj = fl_add_choice(FL_NORMAL_CHOICE2,110,50,200,30,""); fl_set_object_callback(obj,cb_land_dh,0); fl_set_choice_entries(obj, fdchoice_1); fl_set_choice(obj,1); fl_end_form(); fdui->landmin->fdui = fdui; return fdui; }
void InitDistributionChoice() { FL_OBJECT *cp = the_gui->DistributionChoice; fl_clear_choice(cp); fl_addto_choice(cp,CHOICES); fl_set_choice_fontsize(cp,FL_NORMAL_SIZE); fl_set_choice_fontstyle(cp,FL_BOLD_STYLE); fl_set_choice(cp,Normal); DistributionChoiceCB(cp,0); }
int main(int argc, char *argv[]) { void lmst_update (FL_OBJECT *, long); int i; void dismiss_psr(); void spectrum_hide(); void tp_hide (); void hide_waterfall(); void hide_interferometer(); void hide_info(); void receiver_leave(); int close_sub (); int close_main (); char *p; char fntstr[128]; char d[128]; int binwidth; /* * Init xforms library */ fl_initialize(&argc, argv, "Ira", 0, 0); fl_get_app_resources (NULL, 0); time (&started_at); /* * Create various windows, including the main one */ fd_receiver_main = create_form_receiver_main(); fl_set_form_atclose(fd_receiver_main->receiver_main, close_main, 0); fd_receiver_pulsar = create_form_receiver_pulsar(); fl_set_form_atclose (fd_receiver_pulsar->receiver_pulsar, close_sub, dismiss_psr); fd_receiver_spectrum = create_form_receiver_spectrum(); fl_set_form_atclose (fd_receiver_spectrum->receiver_spectrum, close_sub, spectrum_hide); fd_receiver_continuum = create_form_receiver_continuum(); fl_set_form_atclose (fd_receiver_continuum->receiver_continuum, close_sub, tp_hide); fd_receiver_waterfall = create_form_receiver_waterfall(); fl_set_form_atclose (fd_receiver_waterfall->receiver_waterfall, close_sub, hide_waterfall); fd_receiver_info = create_form_receiver_info(); fl_set_form_atclose (fd_receiver_info->receiver_info, close_sub, hide_info); fd_receiver_lproblem = create_form_receiver_lproblem (); fd_receiver_error = create_form_receiver_error (); fd_receiver_shutdown = create_form_receiver_shutdown (); flps_init(); fl_free_pixmap_pixmap(fd_receiver_main->ira_xpm_button); fl_set_pixmap_data(fd_receiver_main->ira_xpm_button, Ira_xpm); sprintf (version_info, "Ver: %s (BETA)", VERSION); /* * Stuff lines in info window */ for (i = 0; ; i++) { if (ira_info[i] == NULL) { break; } fl_add_browser_line (fd_receiver_info->info_browser, ira_info[i]); } fl_set_browser_fontsize(fd_receiver_info->info_browser, 14); /* fill-in form initialization code */ fl_set_object_label (fd_receiver_main->startup_text, "PLEASE WAIT........."); /* show the first form */ fl_show_form(fd_receiver_main->receiver_main,FL_PLACE_CENTER,FL_FULLBORDER,"IRA Control Panel"); fl_check_forms(); /* * Now we check a raft of environment variables, and use those to initialize * various settable values */ refmult = 1.0; if ((p = getenv ("RCVR_REF_MULT")) != NULL) { refmult = atof(p); } fl_set_slider_value (fd_receiver_main->refmult_slider, refmult); seti_integ = 15; if ((p = getenv ("RCVR_SETI_INTEG")) != NULL) { seti_integ = (int)atof(p); } fl_set_slider_value (fd_receiver_main->seti_integ_slider, (float)seti_integ); strcpy (datadir, "."); if ((p = getenv ("RCVR_DATA_DIR")) != NULL) { strcpy (datadir, p); } /* * Set the input field for freq, as well as the actual frequency */ if ((p = getenv ("RCVR_INITIAL_FREQ")) != NULL) { fl_set_input (fd_receiver_main->frequency_input, p); frequency = atof(p); sky_freq = frequency; sky_locked = 1; } /* * Start out with sky_freq unavailable for input */ fl_deactivate_object (fd_receiver_main->sky_freq_input); fl_set_input (fd_receiver_main->sky_freq_input, "--------"); /* If there's a sky_freq parameter, use it, and re-activate the * sky_freq_input control */ if ((p = getenv ("RCVR_SKY_FREQ")) != NULL) { if (abs(atof(p) - frequency) > 100.0) { sky_locked = 0; fl_set_input (fd_receiver_main->sky_freq_input, p); sky_freq = atof(p); fl_activate_object (fd_receiver_main->sky_freq_input); fl_set_button (fd_receiver_main->sky_lock_button, 0); } else { sky_freq = atof(p); fl_set_button (fd_receiver_main->sky_lock_button, 1); sky_locked = 1; } } PUSHVAR("ifreq", frequency); PUSHVAR("skyfreq", sky_freq); /* * * And again for RF gain */ if ((p = getenv ("RCVR_RF_GAIN")) != NULL) { rf_gain = atoi(p); } fl_set_slider_value (fd_receiver_main->rf_gain_slider, rf_gain); PUSHVAR("igain", rf_gain); /* * Gain correction values for A and B sides */ if ((p = getenv ("RCVR_COR_A")) != NULL) { gc_a = atof(p); } sprintf (d, "%f", gc_a); fl_set_input (fd_receiver_main->gc_a, d); if ((p = getenv ("RCVR_COR_B")) != NULL) { gc_b = atof(p); } sprintf (d, "%f", gc_b); fl_set_input (fd_receiver_main->gc_b, d); /* * Set bounds/values for DC gain */ if ((p = getenv ("RCVR_DC_GAIN")) != NULL) { dc_gain = atof(p); } fl_set_slider_value (fd_receiver_main->dc_gain_control, dc_gain); /* * And again for DC offset */ if ((p = getenv ("RCVR_DC_OFFSET")) != NULL) { dc_offset = atof(p); } fl_set_slider_value (fd_receiver_main->dc_offset_control, dc_offset); /* * Receiver DC Gain multiplier */ if ((p = getenv ("RCVR_DC_MULT")) != NULL) { int which; dc_mult = (double)atoi(p); which = 1; /* * It's a choice widget, so we need to set 'which' appropriately */ switch ((int)dc_mult) { case 1: which = 1; break; case 5: which = 2; break; case 10: which = 3; break; case 15: which = 4; break; case 20: which = 5; break; case 25: which = 6; break; case 30: which=7; break; case 35: which = 8; break; case 40: which = 9; break; } fl_set_choice (fd_receiver_main->mult_choice, which); } /* * Total power integration value */ tp_integration = 5; if ((p = getenv ("RCVR_TP_INTEG")) != NULL) { tp_integration = atoi(p); } fl_set_slider_value (fd_receiver_main->continuum_int, (double)atof(getenv("RCVR_TP_INTEG")) ); /* * Spectral integration */ spec_integration = 15; if ((p = getenv ("RCVR_SPEC_INTEG")) != NULL) { spec_integration = atoi(p); } fl_set_slider_value (fd_receiver_main->spec_int_slider, (double)atof(getenv("RCVR_SPEC_INTEG")) ); /* * Sigma_K for SETI analysis */ sigma_k = 2.5; if ((p = getenv ("RCVR_SIGMA_K")) != NULL) { sigma_k = atof(p); } fl_set_slider_value (fd_receiver_main->sigma_k_slider, sigma_k); /* * Check desired receiver mode */ if (getenv("RCVR_MODE") != NULL) { strcpy (rcvr_mode, getenv("RCVR_MODE")); } else { strcpy (rcvr_mode, "unknown"); } /* * Interferometer? Create the interferometer window */ if (strcmp (rcvr_mode, "interferometer") == 0) { fd_receiver_interferometer = create_form_receiver_interferometer(); fl_set_form_atclose (fd_receiver_interferometer->receiver_interferometer, close_sub, hide_interferometer); } /* * Otherwise, delete the "show interferograms" control */ else { fl_delete_object (fd_receiver_main->interferometer_button); } /* * Various values */ declination = -28.3; if ((p = getenv ("RCVR_DECLINATION")) != NULL) { declination = atof(p); } fl_set_input (fd_receiver_main->declination_input, getenv("RCVR_DECLINATION")); longitude = 0.0; if ((p = getenv ("RCVR_LONGITUDE")) != NULL) { longitude = atof(p); } seti_size = 500000; if ((p = getenv ("RCVR_SETI_SIZE")) != NULL) { seti_size = atoi (p); } bandwidth = 5000000; if ((p = getenv ("RCVR_BANDWIDTH")) != NULL) { bandwidth = atoi (p); } psr_rate = 10000; if ((p = getenv ("RCVR_PSR_RATE")) != NULL) { psr_rate = atoi (getenv ("RCVR_PSR_RATE")); } for (i = 0; i < NNOTCHES; i++) { notches[i] = -1.0; } if ((p = getenv ("RCVR_NOTCHES")) != NULL) { char *tp; char pcopy[128]; FILE *fp; strcpy (pcopy, p); tp = strtok (pcopy, ","); notches[0] = atof(tp); for (i = 1; i < NNOTCHES; i++) { tp = strtok (NULL, ","); if (tp == NULL) { break; } notches[i] = atof(tp); } } if ((p = getenv ("RCVR_NOTCH_SIZE")) != NULL) { notch_length = atoi(p); fl_set_slider_value (fd_receiver_spectrum->notch_slider, (double)notch_length); } if ((p = getenv ("RCVR_DM")) != NULL) { pulsar_dm = atof(p); fl_set_slider_value (fd_receiver_main->dm_input, (double)pulsar_dm); } PUSHVAR("idm", pulsar_dm); if ((p = getenv ("PULSAR_RATE")) != NULL) { pulsar_rate = atof(p); fl_set_input (fd_receiver_main->pulsar_rate_input, p); } if ((p = getenv ("PULSAR_FOLDING")) != NULL) { pulsar_folding = atoi(p); fl_set_choice (fd_receiver_main->pulsar_choice, pulsar_folding/5); } /* * Set spec_fft_size based on width of spectral plot display */ { FL_Coord x, y, w, h; fl_get_object_bbox (fd_receiver_spectrum->spectral_plot, &x, &y, &w, &h); spec_fft_size = w-130; } tp_maxval = 100000; tp_span = 20000; /* * Establish parameters for TP plot */ if ((p = getenv("RCVR_TP_MAXVAL")) != NULL) { tp_maxval = (double)atoi(p); } if ((p = getenv ("RCVR_TP_SPAN")) != NULL) { tp_span = (double)atoi(p); } tp_minval = tp_maxval - tp_span; fl_set_slider_value (fd_receiver_continuum->tp_max_slider, (double)tp_maxval); fl_set_slider_value (fd_receiver_continuum->tp_span_slider, (double)tp_span); fl_set_xyplot_ybounds(fd_receiver_continuum->tp_chart, (double)tp_minval, (double)tp_maxval); fl_set_xyplot_ytics(fd_receiver_continuum->tp_chart, 10, 1); fl_set_xyplot_xgrid (fd_receiver_continuum->tp_chart, FL_GRID_MINOR); fl_set_xyplot_ygrid (fd_receiver_continuum->tp_chart, FL_GRID_MINOR); fl_set_object_posthandler(fd_receiver_continuum->tp_chart, continuum_plot_post); /* * Set a post handler for inteferometer display */ if (strcmp (rcvr_mode, "interferometer") == 0) { fl_set_object_posthandler(fd_receiver_interferometer->interferometer_chart, continuum_plot_post); if ((p = getenv ("RCVR_INT_GAIN")) != NULL) { interferometer_gain = atof(p); } if ((p = getenv ("RCVR_INT_SPAN")) != NULL) { interferometer_span = atof(p); } if ((p = getenv ("RCVR_PHCORR")) != NULL) { interferometer_phase = atof(p); } if ((p = getenv ("RCVR_DELAY")) != NULL) { interferometer_delay = atof(p); } fl_set_xyplot_ytics (fd_receiver_interferometer->interferometer_chart, 10, 1); fl_set_xyplot_xgrid (fd_receiver_interferometer->interferometer_chart, FL_GRID_MINOR); fl_set_xyplot_ygrid (fd_receiver_interferometer->interferometer_chart, FL_GRID_MINOR); fl_set_slider_value (fd_receiver_interferometer->int_gain_slider, interferometer_gain); fl_set_slider_value (fd_receiver_interferometer->int_span_slider, interferometer_span); fl_set_slider_value (fd_receiver_interferometer->phase_adjust, interferometer_phase); fl_set_slider_value (fd_receiver_interferometer->delay_adjust, interferometer_delay); fl_set_xyplot_ybounds (fd_receiver_interferometer->interferometer_chart, -1*interferometer_span, interferometer_span); } fl_add_timeout (1000.0, (FL_TIMEOUT_CALLBACK)lmst_update, 0); /* * Setup parameters for spectral plot */ if ((p = getenv ("RCVR_SPEC_MAX")) != NULL) { current_smax = atoi(p); } if ((p = getenv ("RCVR_SPEC_SPAN")) != NULL) { current_span = atoi(p); } if ((p = getenv ("RCVR_SPEC_FLAT")) != NULL) { spec_flat_on = atoi(p); fl_set_button (fd_receiver_spectrum->flaten_button, spec_flat_on); } if ((p = getenv ("RCVR_SPEC_METHOD")) != NULL) { spec_method = atoi (p); } fl_set_xyplot_xgrid(fd_receiver_spectrum->spectral_plot, FL_GRID_MINOR); fl_set_xyplot_ygrid(fd_receiver_spectrum->spectral_plot, FL_GRID_MINOR); fl_set_xyplot_ybounds(fd_receiver_spectrum->spectral_plot, (double)(current_smax-current_span), (double) current_smax); fl_set_xyplot_ytics(fd_receiver_spectrum->spectral_plot, 10, 1); fl_set_xyplot_xtics(fd_receiver_spectrum->spectral_plot, 10, 1); fl_set_object_posthandler(fd_receiver_spectrum->spectral_plot, spectral_plot_post); fl_set_choice (fd_receiver_spectrum->spec_method_choice, spec_method); fl_set_choice_fontsize (fd_receiver_spectrum->spec_method_choice, 14); fl_set_slider_value (fd_receiver_spectrum->spec_max_slider, (double)current_smax); fl_set_slider_value (fd_receiver_spectrum->spec_span_slider, (double)current_span); /* * Set post handler for pulsar display */ fl_set_object_posthandler(fd_receiver_pulsar->pulsar_plot, pulsar_plot_post); /* * Set parameters for waterfall (SETI) display */ { FL_Coord x, y; FL_Coord w, h; fl_get_object_bbox(fd_receiver_waterfall->waterfall_display, &x, &y, &w, &h); fl_set_slider_bounds (fd_receiver_waterfall->wfall_seg_slider, 1.0, (float)seti_size/w); fl_set_object_dblbuffer(fd_receiver_waterfall->waterfall_display, 1); if ((p = getenv ("RCVR_WFALL_SEGMENT")) != NULL) { waterfall_segment = atoi(p); fl_set_slider_value (fd_receiver_waterfall->wfall_seg_slider, (double)waterfall_segment); } if ((p = getenv ("RCVR_WFALL_FINE")) != NULL) { waterfall_fine = atoi(p); fl_set_slider_value (fd_receiver_waterfall->fine_segment, waterfall_fine); } if ((p = getenv ("RCVR_WFALL_BRIGHTNESS")) != NULL) { double w; w = atof(p); if (fabsf(w-1.0) < 0.1) { fl_set_choice (fd_receiver_waterfall->wfall_brightness, 1); w = 1.0; } if (fabsf(w-0.75) < 0.1) { fl_set_choice (fd_receiver_waterfall->wfall_brightness, 2); w = 0.75; } if (fabsf(w-0.66) < 0.1) { fl_set_choice (fd_receiver_waterfall->wfall_brightness, 3); w = 0.66; } if (fabsf(w-0.50) < 0.1) { fl_set_choice (fd_receiver_waterfall->wfall_brightness, 4); w = 0.50; } waterfall_brightness = (float)w; } } if ((p = getenv ("RCVR_TRANS_THRESH")) != NULL) { transient_threshold = atof(p); fl_set_slider_value (fd_receiver_main->trans_thr_slider, transient_threshold); } if ((p = getenv ("RCVR_TRANS_DUR")) != NULL) { transient_duration = atof(p); fl_set_slider_value (fd_receiver_main->trans_dur_slider, transient_duration); } /* * Open various FIFOs--that's where we get our data from */ if ((seti_fd = open ("ra_seti_fifo", O_RDONLY|O_NONBLOCK)) > 0) { fcntl (seti_fd, F_SETFL, 0); fl_add_io_callback (seti_fd, FL_READ, (FL_IO_CALLBACK)handle_seti_io, fd_receiver_main); } if ((pulsar_fd = open ("ra_psr_fifo", O_RDONLY|O_NONBLOCK)) > 0) { fcntl (pulsar_fd, F_SETFL, 0); fl_add_io_callback (pulsar_fd, FL_READ, (FL_IO_CALLBACK)handle_pulsar_io, fd_receiver_main); } if ((dicke_fd = open ("ra_switching_fifo", O_RDONLY|O_NONBLOCK)) > 0) { fcntl (dicke_fd, F_SETFL, 0); fl_set_object_label (fd_receiver_main->dicke_mode, "DICKE: ON"); fl_add_io_callback (dicke_fd, FL_READ, (FL_IO_CALLBACK)handle_dicke_io, fd_receiver_main); } if (strcmp (rcvr_mode, "interferometer") == 0) { if ((inter_fd = open ("ra_inter_fifo", O_RDONLY|O_NONBLOCK)) > 0) { fcntl (inter_fd, F_SETFL, 0); fl_add_io_callback (inter_fd, FL_READ, (FL_IO_CALLBACK)handle_inter_io, fd_receiver_main); } } if (strcmp (rcvr_mode, "split") == 0) { if ((validation_fd = open ("ra_validation_fifo", O_RDONLY|O_NONBLOCK)) > 0) { fcntl (validation_fd, F_SETFL, 0); split_mode = 1; fl_add_io_callback (validation_fd, FL_READ, (FL_IO_CALLBACK)handle_validation_io, fd_receiver_main); } } fl_set_oneliner_font (FL_FIXEDBOLDITALIC_STYLE, FL_MEDIUM_FONT); fl_set_oneliner_color (FL_GREEN, FL_BLACK); while(fl_do_forms()) ; return 0; }
void * superspec_to_spec( FL_OBJECT * obj ) { void *v = obj->spec; SuperSPEC *ssp = obj->u_vdata; int i = 0; if ( ! ssp ) return v; if ( obj->objclass == FL_BROWSER ) { FLI_BROWSER_SPEC *sp = obj->spec; fl_clear_browser( obj ); sp->h_pref = ssp->h_pref; sp->v_pref = ssp->v_pref; for ( i = 1; i <= ssp->nlines; i++ ) fl_addto_browser( obj, ssp->content[ i ] ); } else if ( obj->objclass == FL_CHOICE ) { fl_clear_choice( obj ); ( ( FLI_CHOICE_SPEC * ) obj->spec)->align = ssp->align; for ( i = 1; i <= ssp->nlines; i++ ) { fl_addto_choice( obj, ssp->content[ i ] ); if ( ssp->shortcut[ i ] ) fl_set_choice_item_shortcut( obj, i, ssp->shortcut[ i ] ); fl_set_choice_item_mode( obj, i, ssp->mode[ i ] ); } if ( ssp->nlines >= ssp->int_val ) fl_set_choice( obj, ssp->int_val ); } else if ( obj->objclass == FL_MENU ) { fl_clear_menu( obj ); for ( i = 1; i <= ssp->nlines; i++ ) { fl_addto_menu( obj, ssp->content[ i ] ); if ( ssp->shortcut[ i ] ) fl_set_menu_item_shortcut( obj, i, ssp->shortcut[ i ] ); if ( ssp->callback[ i ] ) fl_set_menu_item_callback( obj, i, ( FL_PUP_CB ) fl_strdup( ssp->callback[ i ] ) ); fl_set_menu_item_mode( obj, i, ssp->mode[ i ] ); if ( ssp->mval[ i ] != i ) fl_set_menu_item_id( obj, i, ssp->mval[ i ] ); } } else if ( obj->objclass == FL_SLIDER || obj->objclass == FL_VALSLIDER || obj->objclass == FL_THUMBWHEEL) { FLI_SLIDER_SPEC *sp = obj->spec; sp->val = ssp->val; sp->min = ssp->min; sp->max = ssp->max; sp->step = ssp->step; sp->prec = ssp->prec; sp->ldelta = ssp->ldelta; sp->rdelta = ssp->rdelta; sp->slsize = ssp->slsize; } else if ( ISBUTTON( obj->objclass ) || obj->objclass == FL_PIXMAP || obj->objclass == FL_BITMAP ) { FL_BUTTON_SPEC *sp = obj->spec; for ( i = 0; i < 5; i++ ) sp->react_to[ i ] = ( ssp->mbuttons & ( 1 << i ) ) != 0; if ( ISBUTTON( obj->objclass ) ) fl_set_button_mouse_buttons( obj, ssp->mbuttons ); sp->val = ssp->int_val; if ( ISBUTTON( obj->objclass ) ) fl_set_button( obj, sp->val ); } else if ( obj->objclass == FL_POSITIONER ) { FLI_POSITIONER_SPEC *sp = obj->spec; sp->xstep = ssp->xstep; sp->ystep = ssp->ystep; sp->xmin = ssp->xmin; sp->xmax = ssp->xmax; sp->xval = ssp->xval; sp->ymin = ssp->ymin; sp->ymax = ssp->ymax; sp->yval = ssp->yval; } else if ( obj->objclass == FL_COUNTER ) { FLI_COUNTER_SPEC *sp = obj->spec; sp->val = ssp->val; sp->sstep = ssp->sstep; sp->lstep = ssp->lstep; sp->min = ssp->min; sp->max = ssp->max; sp->prec = ssp->prec; } else if ( obj->objclass == FL_SPINNER ) { FLI_SPINNER_SPEC *sp = obj->spec; fl_set_spinner_value( obj, ssp->val ); fl_set_spinner_bounds( obj, ssp->min, ssp->max ); fl_set_spinner_step( obj, ssp->step ); fl_set_spinner_precision( obj, ssp->prec ); sp->orient = ssp->orient; } else if ( obj->objclass == FL_DIAL ) { FLI_DIAL_SPEC *sp = obj->spec; sp->min = ssp->min; sp->max = ssp->max; sp->val = ssp->val; sp->step = ssp->step; sp->thetai = ssp->thetai; sp->thetaf = ssp->thetaf; sp->direction = ssp->direction; } else if ( obj->objclass == FL_XYPLOT ) { FLI_XYPLOT_SPEC *sp = obj->spec; sp->xmajor = ssp->xmajor; sp->xminor = ssp->xminor; sp->ymajor = ssp->ymajor; sp->yminor = ssp->yminor; sp->xscale = ssp->xscale; sp->yscale = ssp->yscale; sp->xgrid = ssp->xgrid; sp->ygrid = ssp->ygrid; sp->xbase = ssp->xbase; sp->ybase = ssp->ybase; sp->grid_linestyle = ssp->grid_linestyle; sp->mark_active = ssp->mark_active; } else if ( obj->objclass == FL_SCROLLBAR ) { FLI_SCROLLBAR_SPEC *scbsp = obj->spec; FLI_SLIDER_SPEC *sp = scbsp->slider->spec; sp->val = ssp->val; sp->min = ssp->min; sp->max = ssp->max; sp->prec = ssp->prec; sp->step = ssp->step; sp->slsize = ssp->slsize; sp->ldelta = ssp->ldelta; sp->rdelta = ssp->rdelta; } else if ( obj->objclass == FL_SLIDER ) { FLI_SPINNER_SPEC *sp = obj->spec; ssp->val = fl_get_spinner_value( obj ); fl_get_spinner_bounds( obj, &ssp->min, &ssp->max ); ssp->step = fl_get_spinner_step( obj ); ssp->prec = fl_get_spinner_precision( obj ); ssp->orient = sp->orient; } else if ( obj->objclass == FL_INPUT ) { /* Simply reset some attributes of the object to the defaults - this makes only sense when, during testing, text was entered into the input field and new we need to get rid of it */ FLI_INPUT_SPEC *sp = obj->spec; sp->position = -1; sp->endrange = -1; sp->lines = sp->ypos = 1; *sp->str = '\0'; } return v; }
FD_options *create_form_options(void) { FL_OBJECT *obj; FD_options *fdui = (FD_options *) fl_calloc(1, sizeof(*fdui)); fdui->options = fl_bgn_form(FL_NO_BOX, 470, 530); obj = fl_add_box(FL_UP_BOX,0,0,470,530,"Options"); fl_set_object_lsize(obj,FL_NORMAL_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP|FL_ALIGN_INSIDE); fl_set_object_lstyle(obj,FL_BOLD_STYLE); obj = fl_add_frame(FL_EMBOSSED_FRAME,20,370,210,130,""); obj = fl_add_frame(FL_EMBOSSED_FRAME,240,370,220,110,""); obj = fl_add_frame(FL_EMBOSSED_FRAME,20,190,440,170,""); fdui->prob_mutation = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,35,250,200,20,"Probabiliy of Mutation:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 3); fl_set_slider_value(obj, 0.008); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 0.001); fl_set_slider_increment(obj, 0.001, 0.001); fdui->prob_crossover = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,250,250,200,20,"Probabiliy of Crossover:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 3); fl_set_slider_value(obj, 0.002); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 0.001); fl_set_slider_increment(obj, 0.001, 0.001); fdui->max_pop = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,250,210,200,20,"Maximum Population:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 10000); fl_set_slider_value(obj, 2000); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 1); fl_set_slider_increment(obj, 10, 10); fdui->maintain_min_pop = obj = fl_add_checkbutton(FL_PUSH_BUTTON,260,380,20,20,"Maintain a Minimum Population?"); fdui->age_factor = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,35,290,200,20,"Age Factor:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 15); fl_set_slider_value(obj, 9); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 1); fl_set_slider_increment(obj, 1, 1); fdui->carcass_decay_rate = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,250,290,200,20,"Carcass Decay Rate:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 100000); fl_set_slider_value(obj, 10000); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 100); fl_set_slider_increment(obj, 100, 100); fdui->save_sim = obj = fl_add_checkbutton(FL_PUSH_BUTTON,45,380,20,20,"Save Simulation Every N Steps?"); fdui->save_every = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,40,420,170,20,"Save Every N Steps:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 100000); fl_set_slider_value(obj, 50000); fl_set_slider_size(obj, 0.12); fl_set_slider_step(obj, 100); fl_set_slider_increment(obj, 100, 100); fdui->file_name = obj = fl_add_input(FL_NORMAL_INPUT,40,465,170,20,"Default File Name:"); fl_set_object_lalign(obj,FL_ALIGN_TOP); fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON,360,490,80,30,"OK"); fdui->initial_params_frame = obj = fl_add_frame(FL_ENGRAVED_FRAME,20,20,440,160,"Initial Parameters"); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_object_lstyle(obj,FL_BOLD_STYLE); fdui->scale = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,35,210,200,20,"Display Scale Factor:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 1, 32); fl_set_slider_value(obj, 5); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 1); fl_set_slider_increment(obj, 1, 1); fdui->min_pop = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,265,420,170,20,"Minimum Population:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 100); fl_set_slider_value(obj, 5); fl_set_slider_size(obj, 0.12); fl_set_slider_step(obj, 1); fl_set_slider_increment(obj, 1, 1); fdui->use_survivor = obj = fl_add_checkbutton(FL_PUSH_BUTTON,280,450,20,20,"Use Survivor for Minimum?"); fdui->initial_parameters_group = fl_bgn_group(); fdui->terrain_size = obj = fl_add_choice(FL_NORMAL_CHOICE2,340,135,100,30,"Terrain Size (cells):"); fl_set_choice_entries(obj, fdchoice_terrain_size_0); fl_set_choice(obj,4); fdui->initial_pop = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,35,60,200,20,"Initial Population:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 2000); fl_set_slider_value(obj, 200); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 1); fl_set_slider_increment(obj, 10, 10); fdui->initial_plant = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,35,100,200,20,"Number of Initial Plant Locations:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 10000); fl_set_slider_value(obj, 1000); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 100); fl_set_slider_increment(obj, 100, 100); fdui->initial_flesh = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,250,100,200,20,"Number of Initial Flesh Locations:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 10000); fl_set_slider_value(obj, 1000); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 100); fl_set_slider_increment(obj, 100, 100); fdui->give_head_start = obj = fl_add_checkbutton(FL_PUSH_BUTTON,290,55,20,20,"Give A Head Start?"); fl_set_button(obj, 1); fdui->allow_asex = obj = fl_add_checkbutton(FL_PUSH_BUTTON,70,150,20,20,"Allow Asexual Reproduction?"); fl_set_button(obj, 1); fdui->allow_sex = obj = fl_add_checkbutton(FL_PUSH_BUTTON,70,130,20,20,"Allow Sexual Reproduction?"); fl_set_button(obj, 1); fl_end_group(); fdui->waste_decay_rate = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,35,330,200,20,"Waste Decay Rate:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 10000); fl_set_slider_value(obj, 20); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 5); fl_set_slider_increment(obj, 10, 10); fdui->poison_decay_rate = obj = fl_add_valslider(FL_HOR_BROWSER_SLIDER,250,330,200,20,"Poison Decay Rate:"); fl_set_object_lsize(obj,FL_DEFAULT_SIZE); fl_set_object_lalign(obj,FL_ALIGN_TOP); fl_set_slider_precision(obj, 0); fl_set_slider_bounds(obj, 0, 10000); fl_set_slider_value(obj, 20); fl_set_slider_size(obj, 0.10); fl_set_slider_step(obj, 5); fl_set_slider_increment(obj, 10, 10); fl_end_form(); fdui->options->fdui = fdui; return fdui; }