Beispiel #1
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 #2
0
         /* this is here for a callback that does nothing */
         break;
      default:
         break;
   }
}

#if 0 /* No Audio mute at the moment */
void Audio_cb(GtkWidget *ob, long data)
{
   if(fl_get_button(gtk_xlav->Audio))
      write(out_pipe,"a1\n",3);
   else
      write(out_pipe,"a0\n",3);
}
static void dl_traffic_on_off( FL_OBJECT *button, long arg) {

    if (fl_get_button(button)) {
        fl_set_object_label(button, "DL Traffic ON");
        otg_enabled = 1;
        fl_set_object_color(button, FL_GREEN, FL_GREEN);
    } else {
        fl_set_object_label(button, "DL Traffic OFF");
        otg_enabled = 0;
        fl_set_object_color(button, FL_RED, FL_RED);
    }
}
static void ia_receiver_on_off( FL_OBJECT *button, long arg) {

    if (fl_get_button(button)) {
        fl_set_object_label(button, "IA Receiver ON");
        openair_daq_vars.use_ia_receiver = 1;
        fl_set_object_color(button, FL_GREEN, FL_GREEN);
    } else {
        fl_set_object_label(button, "IA Receiver OFF");
        openair_daq_vars.use_ia_receiver = 0;
        fl_set_object_color(button, FL_RED, FL_RED);
    }
}
void
set_sky_locked (FL_OBJECT *ob, long data)
{
    sky_locked = fl_get_button (ob);
    if (sky_locked != 0)
    {
        fl_deactivate_object (fd_receiver_main->sky_freq_input);
        fl_set_input (fd_receiver_main->sky_freq_input, "--------");
        write_rcvr_params ("skyfreq", frequency);
    }
    else
    {
        fl_activate_object (fd_receiver_main->sky_freq_input);
    }
}
/* fonctions de destruction des objets forms */
void g3d_delete_steering_form(void)
{int n,i;

 n = 4; 

  if(fl_get_button(steering_obj)){fl_hide_form(STEERING_FORM);}

  fl_free_object(obj1);
  fl_free_object(obj2);

  for(i=0;i<n;i++){
    BUTTON_TAB_OBJ[i]->u_vdata = NULL;
    BUTTON_TAB_OBJ[i]->next = NULL;
    BUTTON_TAB_OBJ[i]->prev = NULL;
    fl_free_object(BUTTON_TAB_OBJ[i]);
  }
  GROUP->next = NULL;
  GROUP->prev = NULL;
  fl_free_object(GROUP);
  fl_free_form(STEERING_FORM);

  free(BUTTON_TAB_OBJ);
}
static void CB_gvis_checkb(FL_OBJECT *ob, long arg){
  int val;
  val = fl_get_button(ob);
  p3d_set_gvis(val);
}
static void CB_discreet_checkb(FL_OBJECT *ob, long arg){
  int val;
  val = fl_get_button(ob);
  p3d_set_is_visibility_discreet(val);
}
static void CB_retract_checkb(FL_OBJECT *ob, long arg){
  int val;
  val = fl_get_button(ob);
  p3d_set_test_reductib(val);
}
Beispiel #10
0
/* Handle the entry internally. Make an image or play the sound.... */
static void HandleInternal( Int4 index )
{
  unsigned char *sndbuf;
  unsigned char *pImgBuf ;
  char **xpmbuf=NULL;
  static char imagetext[50];
  int nc;
  unsigned short samplerate;

  /* Sound sample size: The specs says a short here, with the next
     short empty.  But some entries are (32 bits) ints, and the game
     engine accepts it.  Examples include entries 164--171 (and many
     more) in strife0.wad (shareware v. 1.1), and #50 in the "Clint
     Eastwood DOOM (II?) sfx" pwad.... */
  Uint4 nsamples;
  short w, h, dx, dy;
  
  switch ( pEntryTag[index] )
    {
    case TAG_SFX  : 
      /* Read sound header */
      fseek( WADfp, pDirEnt[index].start + 2, SEEK_SET );
      fread( &samplerate, sizeof(short), 1, WADfp );
      fread( &nsamples, sizeof(Uint4), 1, WADfp );
      if ( nsamples != pDirEnt[index].size - 8)
	Message("Warning, sample size = %d, while Directory size = %d.\n",
		nsamples, pDirEnt[index].size); 
      sndbuf = malloc( nsamples );
      if ( !sndbuf ) {
	Message("can't malloc data for snd buf (%d bytes)\n",nsamples);
	return;
      }
      /* read the samples */
      fread( sndbuf, 1, nsamples, WADfp );
      if ( fl_get_button(rev_but) )            	/* reverse ! */
	ReverseBuffer( sndbuf, nsamples );
      PlayRaw( sndbuf, nsamples, samplerate );
      free( sndbuf );
      break;
    case TAG_FLAT :
    case TAG_FULL :
    case TAG_IMG  : 
      pImgBuf = ParseImgBlock(pDirEnt[index], pEntryTag[index], 
			      &w, &h, &dx, &dy, WADfp);
      /* I planned to use the offsets (dx,dy) for better placement of
	 the image, but I need to find out some useful heuristics
	 for how to do it..... 
	 printf("image: %dx%d, ofs left %d, top %d\n",w,h,dx,dy);
	 */
      if ( pImgBuf && w <= 320 && h <= 200 && 
	   (xpmbuf = CreateXpmImage( pImgBuf, w, h, 0, &nc)) ) {
	fl_free_pixmap_pixmap( img_pxm );
	fl_set_pixmap_data( img_pxm, xpmbuf );
	sprintf(imagetext,"#%d, %dx%d, %d colours",index,w,h,nc);
	fl_set_object_label(img_txt, imagetext);
      }
      else {
	Message("error creating image. (%p, %hdx%hd, %p)\n", 
		pImgBuf, w, h, xpmbuf);
	return;
      }
      break;
    default : Message("entry %d, Not implemented\n",index); break;
    }
}
/*========================================*/
void starapertureC(FL_OBJECT *obj, long val)

{
  int n = state.control[state.control_num];
  frame[n].fits.aperture = fl_get_button(obj);
}
void
change_rfi_marking (FL_OBJECT *ob, long data)
{
    mark_rfi = fl_get_button (ob);
}
void
change_flatten (FL_OBJECT *ob, long data)
{
    spec_flat_on = fl_get_button (ob);
}