void create_inter_postscript (FL_OBJECT *ob, long data) { fl_object_ps_dump(fd_receiver_interferometer->interferometer_chart, NULL); }
void create_pulsar_postscript (FL_OBJECT *ob, long data) { fl_object_ps_dump(fd_receiver_pulsar->pulsar_plot, NULL); }
void create_spec_postscript (FL_OBJECT *ob, long data) { fl_object_ps_dump(fd_receiver_spectrum->spectral_plot, NULL); }
void create_tp_postscript (FL_OBJECT *ob, long data) { fl_object_ps_dump(fd_receiver_continuum->tp_chart, NULL); }
void NeoWindow::HandleMainWinObject( FL_OBJECT *obj ) { // Handle command from form on main window int scale = neo->scale, i; if ( obj == mainWin->pause ) { // Pause/un-pause if ( ! neo->setup ) return; neo->started = true; neo->paused = ! neo->paused; Refresh( true ); } else if ( obj == mainWin->step ) { // If paused, update by one timestep neo->started = true; if ( neo->paused ) neo->nextStep = true; } else if ( obj == mainWin->add_food ) { // Add food to world neo->borrowed_energy -= neo->food_button_increment; } else if ( obj == mainWin->remove_food ) { // Remove food neo->borrowed_energy += neo->food_button_increment; } else if ( obj == mainWin->file_menu ) { const char *choice = fl_get_menu_text( obj ); if ( ! strcmp( "New", choice ) ) { neo->started = false; neo->paused = true; neo->SetUpRun(); // Set up the run Refresh( true ); //portal = new NeoPortal( 1115 ); //( portal = new NeoPortal() )->CallServer( "localhost", 1115 ); } else if ( ! strcmp( "Close", choice ) ) { neo->started = false; neo->paused = true; Refresh( true ); } else if ( ! strcmp( "Load", choice ) ) { const char *output = NULL; if ( ( output = fl_show_fselector( "Load simulation from file:" , ".", "*", neo->fileName ) ) != NULL ) { strcpy( neo->fileName, output ); neo->LoadSimulation(); Refresh( true ); } } else if ( ! strcmp( "Save", choice ) ) { const char *output = NULL; if ( ( output = fl_show_fselector( "Save simulation to file:" , ".", "*", neo->fileName ) ) != NULL ) { strcpy( neo->fileName, output ); neo->SaveSimulation(); } Refresh(); } else if ( ! strcmp( "Print...", choice ) ) { char tmp[50]; sprintf( tmp, "%s.%08d.ps", neo->fileName, neo->time_step ); const char *output = NULL; if ( ( output = fl_show_fselector( "Print simulation to PostScript file:" , ".", "*", tmp ) ) != NULL ) { fl_object_ps_dump( mainWin->mainCanvas, tmp ); } } else if ( ! strcmp( "Quit", choice ) ) { neo->done = true; neo->started = false; neo->keepDrawing = false; } } else if ( obj == mainWin->other_menu ) { const char *choice = fl_get_menu_text( obj ); if ( ! strcmp( "Update Display", choice ) ) { neo->keepDrawing = ! neo->keepDrawing; Refresh( true ); // Need to update the whole screen } else if ( ! strcmp( "NNet Window", choice ) ) { nnet_plot = create_form_neural_net_plot(); fl_add_canvas_handler( nnet_plot->mainCanvas, Expose, expose_callback, (void *) this ); fl_show_form( nnet_plot->neural_net_plot, FL_PLACE_MOUSE, FL_TRANSIENT, "Neural Net Plot" ); RedrawNNetPlot(); } else if ( ! strcmp( "Chart Window", choice ) ) { chart_wind = create_form_chart_window(); fl_show_form( chart_wind->chart_window, FL_PLACE_MOUSE, FL_TRANSIENT, "Population Statistics" ); } else if ( ! strcmp( "Leave Trails", choice ) ) { neo->leaveTrails = ! neo->leaveTrails; if ( ! neo->leaveTrails ) Refresh( true ); } else if ( ! strcmp( "Add Bug", choice ) ) { const char *output = NULL; fl_add_fselector_appbutton( "Number", fselector_callback, this ); if ( ( output = fl_show_fselector( "Add creature from file:", ".", "*", neo->creatureFile ) ) != NULL ) { for ( int jj = 0; jj < neo->initialBugSeed; jj ++ ) { strcpy( neo->creatureFile, output ); new Creature( Introduced, neo ); } } fl_remove_fselector_appbutton( "Number" ); Draw( true ); } else if ( ! strcmp( "Save Bug", choice ) ) { if ( neo->output_creature < 0 ) return; const char *output = NULL; if ( ( output = fl_show_fselector( "Save creature to file:" , ".", "*", neo->creatureFile ) ) != NULL ) { Creature *creature = neo->ppCreatureList[ neo->output_creature ]; if ( creature != NULL ) creature->WriteGenotype( (char *) output ); } } else if ( ! strcmp( "Options...", choice ) ) { options_box = create_form_options(); FD_options *box = options_box; if ( neo->started ) { fl_deactivate_object( box->initial_parameters_group ); fl_set_object_label( box->initial_params_frame, "Initial Parameters (currently inactive)" ); } fl_set_slider_value( box->initial_pop, neo->initial_creatures ); fl_set_slider_value( box->initial_plant, neo->num_initial_food_locs ); fl_set_slider_value( box->initial_flesh, neo->num_initial_meat_locs ); fl_set_button( box->give_head_start, neo->bGiveHeadStart ); fl_set_button( box->allow_sex, neo->bAllowSexual ); fl_set_button( box->allow_asex, neo->bAllowAsexual ); char tmp[5]; sprintf( tmp, "%d", neo->terrain_size ); fl_set_choice_text( box->terrain_size, tmp ); fl_set_slider_value( box->scale, neo->scale ); fl_set_slider_value( box->prob_crossover, neo->prob_crossover ); fl_set_slider_value( box->prob_mutation, neo->prob_mutation ); fl_set_slider_value( box->max_pop, neo->maximum_creatures ); fl_set_slider_value( box->min_pop, neo->nMinimumPopulation ); fl_set_slider_value( box->age_factor, neo->age_factor ); fl_set_slider_value( box->carcass_decay_rate, neo->nCarcassDecayRate ); fl_set_slider_value( box->waste_decay_rate, neo->nWasteDecayRate ); fl_set_slider_value( box->poison_decay_rate, neo->nPoisonDecayRate ); fl_set_button( box->give_head_start, neo->bGiveHeadStart ); fl_set_button( box->maintain_min_pop, neo->bKeepMinimumPopulation ); fl_set_button( box->use_survivor, neo->bUseSurvivorForMinimum ); fl_set_slider_value( box->save_every, neo->saveEveryNsteps ); if ( neo->saveEveryNsteps == -1 ) fl_set_button( box->save_sim, 0 ); else fl_set_button( box->save_sim, 1 ); fl_set_input( box->file_name, neo->fileName ); fl_show_form( box->options, FL_PLACE_MOUSE, FL_TRANSIENT, "Key Commands" ); } } }