Beispiel #1
0
void FreezY_cb(FL_OBJECT *ob, long data)
{
  if (CtrlPanelOn)
    {
      double max,min;
      max = fl_get_slider_value(YMax_Slider);
      min = fl_get_slider_value(YMin_Slider);
      fl_set_slider_bounds(YMax_Slider,max,min);
      fl_set_slider_bounds(YMin_Slider,max,min);
    }
}  
Beispiel #2
0
void mass_proc(FL_OBJECT *obj, long foo) {
    if (!world.curp) return;
    world.curp->mass = fl_get_slider_value(ui->mass_slider);
    world.curp->radius = sqrt(world.curp->mass);
    printf("mass=%g for particle %d\n", world.curp->mass, world.curp-world.pt);
    world.draw();
}
Beispiel #3
0
void XMax_cb(FL_OBJECT *ob, long data)
{
  float max,min;
  int i;
  for(i=0;i<GlobalNoOfOverlays;i++)
    {
      fl_get_xyplot_xbounds(CHART[i],&min,&max);
      max = (float)fl_get_slider_value(ob);
      fl_set_xyplot_xbounds(CHART[i],(double)min,(double)max);
    }
}
Beispiel #4
0
void YMin_cb(FL_OBJECT *ob, long data)
{
  float max,min;
  int i;
  fprintf(stderr,"%ld\n",data);
  for(i=0;i<GlobalNoOfOverlays;i++)
    {
      fl_get_xyplot_ybounds(CHART[i],&min,&max);
      min = (float)fl_get_slider_value(ob);
      fl_set_xyplot_ybounds(CHART[i],(double)min,(double)max);
    }
}
void
adjust_rf_gain (FL_OBJECT *ob, long data)
{
    double val;

    val = fl_get_slider_value (ob);
    if ((val - (int) val)  >= 0.5)
    {
        val += 1.0;
    }
    rf_gain = (int)val;
    write_rcvr_params("igain", rf_gain);
    detector_peak = 0.0;
}
static void anim_arci_cb (FL_OBJECT * obj, long arg) {
  switch (arg) {
  case 10 :
    ZANIM->ColOptions.ColBlockExtTime = fl_get_slider_value(ARCI_REAC_TIME);
    anim_col_avoidance_step1(ZANIM);
    anim_udpate_nof_blocks();
    anim_udpate_solved();
    anim_interface_update();
    break;
  case 11 : 
    ZANIM->ColOptions.NofAttempts = fl_get_slider_value(ARCI_NOF_ATTEMPTS);
    anim_col_avoidance_step2(ZANIM);
    anim_udpate_nof_blocks();
    anim_udpate_solved();
    anim_udpate_optimized();
    break;
  case 12 :
    anim_show_form(ZANIM->ColAvoidRes, ZANIM->Robot);
    break;
  case 13 :
    anim_col_avoidance_step3(ZANIM);
    anim_udpate_optimized();    
    break;
  case 14 :
    anim_show_form(ZANIM->ColOpt2Res, ZANIM->Robot);
    break;
  case 15 :
    fl_hide_form(ARCI);
    fl_free_form(ARCI);
    ARCI = NULL;
    anim_interface_update();
    break;
  default :
    PrintWarning (("anim_reac_col_interface.c -- unknown command"));
    break;
  }
}
void
adjust_dm (FL_OBJECT *ob, long data)
{
    double f1, f2;
    char buf[32];
    double K;

    K = 1.0/(2.410331 * 10e-4);

    f1 = frequency-(bandwidth/2);
    f2 = frequency+(bandwidth/2);
    f1 /= 1.0e6;
    f2 /= 1.0e6;
    pulsar_dm = fl_get_slider_value (ob);
    pulsar_delay = (1.0/(f1*f1)) - (1.0/(f2*f2));
    pulsar_delay *= pulsar_dm ;
    pulsar_delay *= K;
    sprintf (buf, "%9.4f", pulsar_delay * 1000);
    fl_set_object_label (fd_receiver_main->pulsar_delay_display, buf);
    write_rcvr_params ("idm", pulsar_dm);
}
void
set_transient_duration (FL_OBJECT *ob, long data)
{
    double round();
    transient_duration = round(fl_get_slider_value (ob));
}
void
set_transient_threshold (FL_OBJECT *ob, long data)
{
    transient_threshold = fl_get_slider_value (ob);
}
void
set_notch_length (FL_OBJECT *ob, long data)
{
    notch_length = (int)fl_get_slider_value (ob);
    write_notches ();
}
void adjust_dc_offset(FL_OBJECT *ob, long data)
{
    dc_offset = fl_get_slider_value(ob);
    detector_peak = 0.0;
}
void adjust_spec_int(FL_OBJECT *ob, long data)
{
    spec_integration = fl_get_slider_value(ob);
}
void
adjust_spectral_span(FL_OBJECT *ob, long data)
{
    current_span = (int)fl_get_slider_value(ob);
    fl_set_xyplot_ybounds(fd_receiver_spectrum->spectral_plot, (double)current_smax-current_span, (double)current_smax);
}
void adjust_tp_span (FL_OBJECT *ob, long data)
{
    tp_span = fl_get_slider_value (ob);
    tp_minval = tp_maxval - tp_span;
    fl_set_xyplot_ybounds (fd_receiver_continuum->tp_chart, tp_minval, tp_maxval);
}
Beispiel #15
0
void NeoWindow::HandleOptionsObject( FL_OBJECT *obj ) { // Handle command from form on options dialog
   FD_options *box = options_box;
   if ( obj == box->ok ) {
      fl_hide_form( box->options );
      fl_free_form( box->options );
      Refresh( true );
      options_box = NULL;
   } else if ( obj == box->initial_pop )
      neo->initial_creatures = fl_get_slider_value( obj );
   else if ( obj == box->initial_plant )
      neo->num_initial_food_locs = fl_get_slider_value( obj );
   else if ( obj == box->initial_flesh )
      neo->num_initial_meat_locs = fl_get_slider_value( obj );
   else if ( obj == box->give_head_start )
      neo->bGiveHeadStart = fl_get_button( obj );
   else if ( obj == box->allow_sex )
      neo->bAllowSexual = fl_get_button( obj );
   else if ( obj == box->allow_asex )
      neo->bAllowAsexual = fl_get_button( obj );
   else if ( obj == box->terrain_size )
      neo->terrain_size = atoi( fl_get_choice_text( obj ) );
   else if ( obj == box->scale ) 
      neo->scale = fl_get_slider_value( obj );
   else if ( obj == box->prob_crossover ) 
      neo->prob_crossover = fl_get_slider_value( obj );
   else if ( obj == box->prob_mutation ) 
      neo->prob_mutation = fl_get_slider_value( obj );
   else if ( obj == box->max_pop ) 
      neo->maximum_creatures = fl_get_slider_value( obj );
   else if ( obj == box->min_pop ) 
      neo->nMinimumPopulation = fl_get_slider_value( obj );
   else if ( obj == box->age_factor ) 
      neo->age_factor = fl_get_slider_value( obj );
   else if ( obj == box->carcass_decay_rate ) 
      neo->nCarcassDecayRate = fl_get_slider_value( obj );
   else if ( obj == box->waste_decay_rate ) 
      neo->nWasteDecayRate = fl_get_slider_value( obj );
   else if ( obj == box->poison_decay_rate ) 
      neo->nPoisonDecayRate = fl_get_slider_value( obj );
   else if ( obj == box->give_head_start ) 
      neo->bGiveHeadStart = fl_get_button( obj );
   else if ( obj == box->allow_sex ) 
      neo->bAllowSexual = fl_get_button( obj );
   else if ( obj == box->allow_asex ) 
      neo->bAllowAsexual = fl_get_button( obj );
   else if ( obj == box->maintain_min_pop ) 
      neo->bKeepMinimumPopulation = fl_get_button( obj );
   else if ( obj == box->use_survivor ) 
      neo->bUseSurvivorForMinimum = fl_get_button( obj );
   else if ( obj == box->save_sim ) 
      if ( fl_get_button( obj ) )
	 neo->saveEveryNsteps = fl_get_slider_value( box->save_every );
      else 
	 neo->saveEveryNsteps = -1;
   else if ( obj == box->file_name )
      strcpy( neo->fileName, fl_get_input( obj ) );
}
Beispiel #16
0
void dt_proc(FL_OBJECT *obj, long foo) {
    world.timestep = pow(10., fl_get_slider_value(ui->dt_slider));
    printf("timestep=%g\n", world.timestep);
}
void
waterfall_adjust_segment (FL_OBJECT *ob, long data)
{
    waterfall_segment = (int)fl_get_slider_value(ob);
}
void adjust_continuum_int(FL_OBJECT *ob, long data)
{
    tp_integration = fl_get_slider_value(ob);
}
void
adjust_seti_integ (FL_OBJECT *ob, long data)
{
    seti_integ = (int)fl_get_slider_value (ob);
}
void
adjust_refmult (FL_OBJECT *ob, long data)
{
    refmult = fl_get_slider_value (ob);
}
void
adjust_sigma_k (FL_OBJECT *ob, long data)
{
    sigma_k = fl_get_slider_value (ob);
}
void adjust_waterfall_int(FL_OBJECT *ob, long data)
{
    waterfall_integration = (int)fl_get_slider_value (ob);
}
void
adjust_interferometer_delay (FL_OBJECT *ob, long data)
{
    interferometer_delay = fl_get_slider_value (ob);
    write_rcvr_params ("delay", interferometer_delay);
}
void
adjust_interferometer_gain (FL_OBJECT *ob, long data)
{
    interferometer_gain = fl_get_slider_value (ob);
}
void
adjust_interferometer_span (FL_OBJECT *ob, long data)
{
    interferometer_span = fl_get_slider_value (ob);
    fl_set_xyplot_ybounds (fd_receiver_interferometer->interferometer_chart, -1*interferometer_span, interferometer_span);
}
Beispiel #26
0
void handle_event(XEvent *event) {
    /* see /usr/include/X11/X.h for definitions of X Windows event types */

    // you won't want to leave these printf's in here for your finished program,
    // but they should help you get started and debug.

    static int xprev, yprev, xstart, ystart;

    switch (event->type) {
	case ButtonPress:    /* button press */
	    printf("  ButtonPress.  button %d at (%d, %d)\n",
		event->xbutton.button, event->xbutton.x, event->xbutton.y);
	    switch (event->xbutton.button) {
		case 1:
		    world.curp = world.pick_particle(event->xbutton.x,
			event->xbutton.y, view);
		    if (!world.curp) break;
		    if (is_key_pressed(pane.display, XK_Shift_L) ||
		        is_key_pressed(pane.display, XK_Shift_R)) {
			    world.delete_particle(world.curp);
			    world.curp = NULL;
			}
		    else
			fl_set_slider_value(ui->mass_slider, world.curp->mass);
			    // set slider to show the mass of this particle
		    break;
		case 2:
		    {
			Vec2 p = view.screen_to_world(event->xbutton.x,
			    event->xbutton.y);
			world.curp = world.insert_particle(p[0], p[1], 0, 0,
			    fl_get_slider_value(ui->mass_slider));
		    }
		    break;
		case 3:
		    // save these for later use when MotionNotify event comes
		    xstart = xprev = event->xbutton.x;
		    ystart = yprev = event->xbutton.y;
		    break;
	    }
	    world.draw();
	    break;

	case ButtonRelease:  /* button release */
	    printf("  ButtonRelease. button %d\n", event->xbutton.button);
	    break;

	case MotionNotify:   /* mouse pointer moved */
	    printf("  MotionNotify at (%d, %d) state=%d=(%s %s %s)\n",
		event->xmotion.x, event->xmotion.y,
		event->xmotion.state,
		event->xmotion.state&Button1Mask ? "button1" : ".",
		event->xmotion.state&Button2Mask ? "button2" : ".",
		event->xmotion.state&Button3Mask ? "button3" : ".");
	    if (world.curp && (
		event->xmotion.state & (Button1Mask|Button2Mask))) {
		    /* printf("moving particle %d\n", world.curp-world.pt); */
		    world.curp->pos = view.screen_to_world(event->xmotion.x,
			event->xmotion.y);
	    }
	    else if (event->xmotion.state & Button3Mask) {
		if (is_key_pressed(pane.display, XK_Shift_L) ||
		    is_key_pressed(pane.display, XK_Shift_R)) {
			float s = 1. + (event->xmotion.x - xprev)/100.;
			/* printf("s=%g\n", s); */
			Vec2 pos = view.screen_to_world(xstart, ystart);
			// scale view around the point where user moused down
			glTranslatef(pos[0], pos[1], 0.);
			glScalef(s, s, 1.);
			glTranslatef(-pos[0], -pos[1], 0.);
		}
		else {
		    float t = view.viewport.width*view.relscale();
		    glTranslatef((event->xmotion.x - xprev)/t,
			-(event->xmotion.y - yprev)/t, 0.);
		}
		view.update();
		xprev = event->xmotion.x;
		yprev = event->xmotion.y;
	    }
	    world.draw();
	    break;

	case EnterNotify:       /* mouse pointer entered window */
	    printf("  EnterNotify.\n");
	    break;

	case LeaveNotify:       /* mouse pointer left window */
	    printf("  LeaveNotify.\n");
	    break;

	case KeyPress:          /* key pressed */
	case KeyRelease:        /* key released */
	    {
		char buf[10];
		int n;
		KeySym keysym;

		printf(event->type==KeyPress ? "  KeyPress." : "  KeyRelease.");
		n = XLookupString(&event->xkey, buf, sizeof buf - 1,
		    &keysym, 0);
		buf[n] = 0;
		/* print key as ascii and in hexadecimal */
		/* see /usr/include/X11/keysymdef.h for key codes */
		printf(" key=(%c)=0x%x\n", keysym, keysym);
	    }
	    break;

	case Expose:            /* window just uncovered */
	    printf("  Expose.\n");
	    world.draw();
	    break;

	case VisibilityNotify:  /* window occluded or exposed */
	    printf("  VisibilityNotify.\n");
	    break;

	default:
	    printf("  unknown event type.\n");
	    break;
    }
}
void
adjust_interferometer_phase (FL_OBJECT *ob, long data)
{
    interferometer_phase = fl_get_slider_value (ob);
    write_rcvr_params ("phcorr", interferometer_phase);
}