NeoWindow::~NeoWindow() { /*if ( portal != NULL ) { delete portal; portal = NULL; }*/ if ( pixmap != (Pixmap) NULL ) { ::XFreePixmap( display, pixmap ); pixmap = NULL; } fl_remove_canvas_handler( mainWin->mainCanvas, Expose, expose_callback ); fl_remove_canvas_handler( mainWin->mainCanvas, ButtonPress, buttonRelease_callback ); fl_remove_canvas_handler( mainWin->mainCanvas, ButtonRelease, buttonRelease_callback ); fl_hide_form( mainWin->mainWindow ); fl_free_form( mainWin->mainWindow ); mainWin = NULL; if ( options_box != NULL ) { fl_hide_form( options_box->options ); fl_free_form( options_box->options ); options_box = NULL; } if ( nnet_plot != NULL ) { fl_hide_form( nnet_plot->neural_net_plot ); fl_free_form( nnet_plot->neural_net_plot ); nnet_plot = NULL; } if ( chart_wind != NULL ) { fl_hide_form( chart_wind->chart_window ); fl_free_form( chart_wind->chart_window ); chart_wind = NULL; } ::XFlush( display ); ::XFreeGC( display, gc ); ::XCloseDisplay( display ); fl_finish(); }
const char * fl_show_simple_input( const char * str1, const char * defstr ) { if ( fd_input ) { fl_hide_form( fd_input->form ); fl_free_form( fd_input->form ); fli_safe_free( fd_input ); } else fl_deactivate_all_forms( ); fli_safe_free( ret_str ); fd_input = create_input( str1, defstr ); fl_show_form( fd_input->form, FL_PLACE_HOTSPOT, FL_TRANSIENT, "Input" ); fl_update_display( 0 ); while ( fl_do_only_forms( ) != fd_input->but ) /* empty */ ; ret_str = fl_strdup( fl_get_input( fd_input->input ) ); fl_hide_form( fd_input->form ); fl_free_form( fd_input->form ); fli_safe_free( fd_input ); fl_activate_all_forms( ); return ret_str; }
static void display_forms( FLI_FORMBROWSER_SPEC * sp ) { int f; int y_pos; FL_OBJECT *canvas = sp->canvas; FL_FORM **form = sp->form; int nforms = sp->nforms; int top_form = sp->top_form; int left_edge = - sp->left_edge; int height = canvas->h; /* - (2 * absbw); */ if ( ! FL_ObjWin( sp->canvas ) ) return; fli_inherit_attributes( sp->parent, sp->canvas ); for ( f = 0; f < top_form; f++ ) if ( form[ f ]->visible ) fl_hide_form( form[ f ] ); fli_inherit_attributes( sp->parent, sp->vsl ); fli_inherit_attributes( sp->parent, sp->hsl ); /* I prefer to keep scrollbar unresizable */ sp->vsl->resize = sp->hsl->resize = FL_RESIZE_NONE; y_pos = sp->scroll == FL_JUMP_SCROLL ? 0 : -sp->top_edge; for ( f = top_form; y_pos < height && f < nforms; f++ ) { if ( form[ f ]->visible ) set_form_position( form[ f ], left_edge, y_pos ); else { fl_prepare_form_window( form[ f ], 0, FL_NOBORDER, "Formbrowser" ); form[ f ]->parent_obj = sp->parent; XReparentWindow( fl_get_display( ), form[ f ]->window, FL_ObjWin( sp->canvas ), left_edge, y_pos ); fl_show_form_window( form[ f ] ); } y_pos += form[ f ]->h; } for ( ; f < nforms; f++ ) if ( form[ f ]->visible ) fl_hide_form( form[ f ] ); }
int main( int argc, char * argv[ ] ) { FD_newbut *cbform ; fl_initialize( &argc, argv, "FormDemo", 0, 0 ); cbform = create_form_newbut( ); fl_show_form( cbform->newbut, FL_PLACE_CENTER, FL_TRANSIENT, "test" ); while( fl_do_forms( ) != cbform->bexit ) /* empty */ ; fl_hide_form( cbform->newbut ); fl_free_form( cbform->newbut ); free( cbform ); fprintf( stderr,"sleeping\n" ); sleep( 2 ); cbform = create_form_newbut( ); fl_show_form( cbform->newbut, FL_PLACE_CENTER, 0, 0 ); while( fl_do_forms() != cbform->bexit ) /* empty */; fl_finish( ); return 0; }
FL_FORM * fl_replace_formbrowser( FL_OBJECT * ob, int num, FL_FORM * form ) { FL_FORM *old_form; FLI_FORMBROWSER_SPEC *sp; if ( ! IsFormBrowserClass( ob ) ) { M_err( "fl_replace_formbrowser", "%s not a formbrowser", ob ? ob->label : "null" ); return NULL; } sp = ob->spec; if ( num <= 0 || num > sp->nforms ) { M_err( "fl_replace_formbrowser", "Invalid argument -- %d not between 1 and %d", num, sp->nforms ); return NULL; } old_form = sp->form[ --num ]; fl_hide_form( old_form ); sp->form[ num ] = form; display_forms( sp ); return old_form; }
void unc_ret_cb(FL_OBJECT *ob, long user_data){//return din ceas - sterg si obiectul din lista unc_pl *p1u, *p2u; //caut in lista pointerul corespunzatoar formei pe care vreau sa o sterg for(p2u = p1u = crt_head; p1u->p_unceas->retOB != ob && p1u != NULL; p2u = p1u, p1u = p1u->next); fl_hide_form(p1u->p_unceas->unCeas); fl_free_form(p1u->p_unceas->unCeas); if(p1u == p2u){//nodul eliberat a fost capul listei if(p1u->next == NULL){// a fost singurul nod in lista free(p1u); crt_head = NULL; } else{ //nu a fost singurul nod in lista crt_head = p1u->next; free(p1u); } } else{ //nu a fost capul listei if(p1u->next == NULL){ //a fost coada listei free(p1u); p2u->next = NULL; } else{ p2u->next = p1u->next; free(p1u); } } }
static void form_dealloc(formobject *f) { releaseobjects(f->ob_form); if (f->ob_form->visible) fl_hide_form(f->ob_form); fl_free_form(f->ob_form); PyObject_Del(f); }
void tp_hide (FL_OBJECT *ob, long data) { if (tp_displayed == 1) { fl_hide_form (fd_receiver_continuum->receiver_continuum); tp_displayed = 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 ) ); }
void hide_waterfall (FL_OBJECT *ob, long data) { if (wfall_displayed == 1) { fl_hide_form (fd_receiver_waterfall->receiver_waterfall); wfall_displayed = 0; } }
void hide_info (FL_OBJECT *ob, long data) { if (info_displayed == 1) { fl_hide_form (fd_receiver_info->receiver_info); info_displayed = 0; } }
void dismiss_psr (FL_OBJECT *ob, long data) { if (pulsar_displayed != 0) { fl_hide_form (fd_receiver_pulsar->receiver_pulsar); pulsar_displayed = 0; } }
void hide_interferometer (FL_OBJECT *ob, long data) { if (inter_displayed == 1) { fl_hide_form (fd_receiver_interferometer->receiver_interferometer); inter_displayed = 0; } }
void spectrum_hide (FL_OBJECT *ob, long data) { if (spectrum_displayed == 1) { fl_hide_form(fd_receiver_spectrum->receiver_spectrum); spectrum_displayed = 0; } }
void NeoWindow::HandleChartWindowObject( FL_OBJECT *obj ) { FD_chart_window *box = chart_wind; if ( obj == box->ok ) { fl_hide_form( box->chart_window ); fl_free_form( box->chart_window ); Refresh( true ); chart_wind = NULL; } }
void NeoWindow::HandleNNetPlotObject( FL_OBJECT *obj ) { FD_neural_net_plot *box = nnet_plot; if ( obj == box->ok ) { fl_remove_canvas_handler( nnet_plot->mainCanvas, Expose, expose_callback ); fl_hide_form( box->neural_net_plot ); fl_free_form( box->neural_net_plot ); Refresh( true ); nnet_plot = NULL; } }
void anim_reactive_collision_interface(AnimProb * AnimProbPt) { int NofCoef; NofCoef = XYZ_ANIM.animation[0]->nof_coef; ZANIM = AnimProbPt; if (ARCI != NULL) { fl_hide_form(ARCI); fl_free_form(ARCI); ARCI = NULL; } ARCI = fl_bgn_form(FL_UP_BOX, 200, 370); ARCI_REAC_TIME = fl_add_valslider (FL_HOR_SLIDER, 10, 10, 180, 20, "Reaction Time"); fl_set_slider_bounds (ARCI_REAC_TIME, 0, 3); fl_set_slider_value (ARCI_REAC_TIME, 1); fl_set_slider_step (ARCI_REAC_TIME, 0.1); ARCI_CONST_BLOCKS = fl_add_button(FL_NORMAL_BUTTON, 10, 50, 180, 20, "Constitute Blocks"); fl_set_object_callback(ARCI_CONST_BLOCKS, anim_arci_cb, 10); ARCI_NOF_BLOCK = fl_add_text(FL_NORMAL_TEXT, 10, 80, 180, 20, ""); anim_udpate_nof_blocks(); ARCI_NOF_ATTEMPTS = fl_add_valslider (FL_HOR_SLIDER, 10, 110, 180, 20, "Number of Attempt for Solving Collisions"); fl_set_slider_bounds (ARCI_NOF_ATTEMPTS, 0, 1000); fl_set_slider_value (ARCI_NOF_ATTEMPTS, 100); fl_set_slider_step (ARCI_NOF_ATTEMPTS, 10); ARCI_SOLVE_COL = fl_add_button(FL_NORMAL_BUTTON, 10, 150, 180, 20, "Solve Blocks"); fl_set_object_callback(ARCI_SOLVE_COL, anim_arci_cb, 11); ARCI_SOLVED = fl_add_text(FL_NORMAL_TEXT, 10, 180, 180, 20, ""); anim_udpate_solved(); ARCI_SHOW_SOL = fl_add_button(FL_NORMAL_BUTTON, 10, 210, 180, 20, "Show Solution(s)"); fl_set_object_callback(ARCI_SHOW_SOL, anim_arci_cb, 12); ARCI_OPTIM = fl_add_button(FL_NORMAL_BUTTON, 10, 240, 180, 20, "Optimize Solution(s)"); fl_set_object_callback(ARCI_OPTIM, anim_arci_cb, 13); ARCI_OPTIMIZED = fl_add_text(FL_NORMAL_TEXT, 10, 270, 180, 20, ""); anim_udpate_optimized(); ARCI_SHOW_OPTIM = fl_add_button(FL_NORMAL_BUTTON, 10, 300, 180, 20, "Show Optimized Solution(s)"); fl_set_object_callback(ARCI_SHOW_OPTIM, anim_arci_cb, 14); ARCI_CLOSE = fl_add_button(FL_NORMAL_BUTTON, 10, 330, 180, 20, "Close"); fl_set_object_callback(ARCI_CLOSE, anim_arci_cb, 15); fl_end_form(); fl_show_form (ARCI, FL_PLACE_SIZE, FL_FULLBORDER, "Reactive collisions"); }
void g3d_destroy_pathDeformForm(void){ fl_hide_form(PATH_DEFORM_FORM); g3d_delete_retract_frame(); g3d_delete_gvis_checkb(); g3d_delete_ndraw_counter(); g3d_delete_nbRetract_input(); g3d_delete_dof1_counter(); g3d_delete_dof2_counter(); g3d_delete_node_frame(); g3d_delete_vis_graph_frame(); g3d_fl_free_form(PATH_DEFORM_FORM); }
void uiError(char *str1, char *str2, char *str3) { fl_deactivate_form(MainForm); fl_set_object_label(Error1, str1); fl_set_object_label(Error2, str2); fl_set_object_label(Error3, str3); fl_show_form(ErrorForm, FL_PLACE_MOUSE, TRUE, ""); while (fl_do_forms() != OkButton); fl_hide_form(ErrorForm); fl_activate_form(MainForm); }
int fl_addto_formbrowser( FL_OBJECT * ob, FL_FORM * form ) { FLI_FORMBROWSER_SPEC *sp; if ( ! IsFormBrowserClass( ob ) ) { M_err( "fl_addto_formbrowser", "%s not a formbrowser", ob ? ob->label : "null" ); return 0; } if ( ! form ) { M_err( "fl_addto_formbrowser", "Invalid argument" ); return 0; } if ( form->attached ) { M_err( "fl_addto_formbrowser", "Already attached ?" ); return 0; } sp = ob->spec; if ( form->visible == FL_VISIBLE ) fl_hide_form( form ); if ( ! form->form_callback ) fl_set_form_callback( form, form_cb, NULL ); parentize_form( form, ob ); sp->form = fl_realloc( sp->form, ( sp->nforms + 1 ) * sizeof *sp->form ); sp->form[ sp->nforms++ ] = form; form->attached = 1; if ( form->pre_attach ) form->pre_attach( form ); if ( sp->max_width < form->w ) sp->max_width = form->w; sp->max_height += form->h; display_forms( sp ); return sp->nforms; }
int main(int argc, char * argv[]) { //DEFININDO SEMENTE DO RAND srand(time(NULL)); cria_processos_chamada=0; primeira_vez=1; XInitThreads(); //DEFINICOES DO FORMULARIO FD_projeto *fd_projeto; fl_initialize( &argc, argv, 0, 0, 0 ); fd_projeto = create_form_projeto(); fl_show_form( fd_projeto->projeto, FL_PLACE_CENTERFREE, FL_FULLBORDER, "Núcleo Gerenciador de Processos" ); // THREAD DO NÚCLEO pthread_attr_setscope(&T_NUCLEO_ATTR, PTHREAD_SCOPE_SYSTEM); pthread_attr_init(&T_NUCLEO_ATTR); pthread_create(&T_NUCLEO, &T_NUCLEO_ATTR, (void *) &nucleo, NULL); //LOOP DO FORMULARIO while(1) { //printf("passei antees do_forms\n"); //fflush(stdout); fl_do_forms(); sleep(1); } //pthread_join(T_ESCALONADOR, NULL); //FINALIZANDO FORMULARIO if ( fl_form_is_visible( fd_projeto->projeto ) ) fl_hide_form( fd_projeto->projeto ); fl_free( fd_projeto ); fl_finish(); return 0; }
/* 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 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; } }
/* If the control panel is visible, hide it and then delete it. */ void Quit_cb(FL_OBJECT *ob, long data) { CtrlPanelOn=0; fl_hide_form(fd_ctrlpanel->ctrlpanel); fl_free_form(fd_ctrlpanel->ctrlpanel); }
void fli_hide_tooltip( void ) { if ( tip && tip->tooltipper->visible ) fl_hide_form( tip->tooltipper ); }
int fl_show_question( const char * str, int ans ) { FL_OBJECT *retobj; char shortcut[ 4 ]; int k = 0; if ( fd_yesno ) { fl_hide_form( fd_yesno->form ); fl_free_form( fd_yesno->form ); fl_free( fd_yesno ); } else fl_deactivate_all_forms( ); fd_yesno = create_yesno( ); default_ans = ans; fli_parse_goodies_label( fd_yesno->yes, FLQuestionYesLabel ); fli_parse_goodies_label( fd_yesno->no, FLQuestionNoLabel ); /* We don't set a shortcut if the first letter of the "yes" label is identical to all letters in the "no" label */ while ( fd_yesno->no->label[ k ] && tolower( ( int ) fd_yesno->yes->label[ 0 ] ) == tolower( ( int ) fd_yesno->yes->label[ k ] ) ) k++; if ( fd_yesno->no->label[ k ] ) { shortcut[ 0 ] = fd_yesno->yes->label[ 0 ]; shortcut[ 1 ] = tolower( ( int ) fd_yesno->yes->label[ 0 ] ); shortcut[ 2 ] = toupper( ( int ) fd_yesno->yes->label[ 0 ] ); shortcut[ 3 ] = '\0'; fl_set_button_shortcut( fd_yesno->yes, shortcut, 1 ); shortcut[ 0 ] = fd_yesno->no->label[ k ]; shortcut[ 1 ] = toupper( ( int ) fd_yesno->no->label[ k ] ); shortcut[ 2 ] = tolower( ( int ) fd_yesno->no->label[ k ] ); fl_set_button_shortcut( fd_yesno->no, shortcut, 1 ); } fli_get_goodie_title( fd_yesno->form, FLQuestionTitle ); fli_handle_goodie_font( fd_yesno->yes, fd_yesno->str ); fli_handle_goodie_font( fd_yesno->no, NULL ); fl_set_object_label( fd_yesno->str, str ); if ( ans == 1 ) fl_set_form_hotobject( fd_yesno->form, fd_yesno->yes ); else if ( ans == 0 ) fl_set_form_hotobject( fd_yesno->form, fd_yesno->no ); else fl_set_form_hotspot( fd_yesno->form, -1, -1 ); fl_show_form( fd_yesno->form, FL_PLACE_HOTSPOT, FL_TRANSIENT, fd_yesno->form->label ); fl_update_display( 0 ); while ( ( retobj = fl_do_only_forms( ) ) != fd_yesno->yes && retobj != fd_yesno->no ) /* empty */; k = retobj == fd_yesno->yes; fl_hide_form( fd_yesno->form ); fl_free_form( fd_yesno->form ); fli_safe_free( fd_yesno ); fl_activate_all_forms( ); return k; }
void g3d_hide_grasp_planning_form(void) { fl_hide_form(GRASP_PLANNING_FORM); }
void cb_hau_quit(FL_OBJECT *ob, long user_data){ fl_hide_form(hauf->hostanduser); }
void OkButtonProc(FL_OBJECT *obj, long val) { fl_hide_form(ErrorForm); fl_activate_form(MainForm); }
int change_object( FL_OBJECT * obj, int all ) { FL_OBJECT *retobj; FD_generic_attrib *ui = fd_generic_attrib; FL_FORM * spec_form = NULL; attrib_init( ui ); /* Save current attributes for later restore */ curobj = obj; save_edited_object( obj ); /* Show only required parts */ if ( all ) { fl_show_object( ui->labelobj ); fl_show_object( ui->scobj ); fl_show_object( ui->nameobj ); fl_show_object( ui->cbnameobj ); fl_show_object( ui->argobj ); if ( ( spec_form = create_spec_form( curobj ) ) ) { FL_OBJECT *t; t = fl_addto_tabfolder( fd_attrib->attrib_folder, "Spec", spec_form ); fl_set_object_shortcut( t, "#S", 1 ); } } else { fl_hide_object( ui->labelobj ); fl_hide_object( ui->scobj ); fl_hide_object( ui->nameobj ); fl_hide_object( ui->cbnameobj ); fl_hide_object( ui->argobj ); } /* Show attributes of the current object */ show_attributes( obj ); /* Do interaction */ fl_deactivate_all_forms( ); /* Disable selection */ no_selection = 1; fl_show_form( fd_attrib->attrib, FL_PLACE_GEOMETRY, FL_FULLBORDER, "Attributes" ); fl_set_app_mainform( fd_attrib->attrib ); /* Both cancel and readyobj should have their own callbacks, so we don't need to call fl_do_forms(), but since attribute editing can't be invoked for more than one item at a time we need to block the process_xevent. TODO */ do { XEvent xev; retobj = fl_do_forms( ); if ( retobj == FL_EVENT ) fl_XNextEvent( &xev ); } while ( ! ( ( retobj == fd_attrib->readyobj && validate_attributes( curobj ) ) || retobj == fd_attrib->cancelobj ) ); if ( retobj == fd_attrib->cancelobj ) { restore_edited_object( obj ); redraw_the_form( 0 ); } else { reread_spec_form( obj ); readback_attributes( obj ); spec_to_superspec( obj ); } cleanup_saved_object( ); fl_set_app_mainform( fd_control->control ); fl_set_folder_bynumber( fd_attrib->attrib_folder, 1 ); if ( spec_form ) fl_delete_folder( fd_attrib->attrib_folder, spec_form ); fl_hide_form( fd_attrib->attrib ); fl_activate_all_forms( ); no_selection = 0; return retobj == fd_attrib->readyobj; }