Example #1
0
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;
}
Example #2
0
void
fli_show_tooltip( const char * s,
                  int          x,
                  int          y )
{
    int maxw = 0,
        maxh = 0,
        extra;

    if ( ! s )
        return;

    create_it( );

    extra =
           1 + ( tip->boxtype != FL_FLAT_BOX && tip->boxtype != FL_BORDER_BOX );
    fl_get_string_dimension( tip->fntstyle, tip->fntsize,
                             s, strlen( s ), &maxw, &maxh );

    maxw += 7 + extra;
    maxh += 7 + extra;

    if ( maxw > 800 )
        maxw = 800;
    if ( maxh > 800 )
        maxh = 800;

    fl_freeze_form( tip->tooltipper );
    fl_set_form_geometry( tip->tooltipper, x, y, maxw, maxh );
    fl_set_object_label( tip->text, s );
    fl_unfreeze_form( tip->tooltipper );

    if ( ! tip->tooltipper->visible )
        fl_show_form( tip->tooltipper, FL_PLACE_GEOMETRY | FL_FREE_SIZE,
                      FL_NOBORDER, "Tooltip" );

    fl_update_display( 1 );
}
Example #3
0
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;
}
Example #4
0
void plot_graphes_dl(int src, int dst, int ctime)  //eNB -->UE
{

int i, dst_idx=1, curve_id=1;
char loss_rate[100];
char curve_label[100];
char simu_time[100];
int x_key_position=27;
int y_key_position=75;

if (otg_forms_info->idx_dl[src][dst]==MAX_SAMPLES-1){

  fl_update_display(1); //the function flushes the X buffer so the drawing requests are on their way to the server


 
  if (otg_forms_info->is_data_plot_dl == -1) 
    otg_forms_info->is_data_plot_dl=dst;

  if (otg_forms_info->is_data_plot_dl == dst) {
    fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][dst],
    otg_forms_info->data_owd_dl[src][dst], otg_forms_info->idx_dl[src][dst], "", "time", "ms"); 
		sprintf(curve_label, "%d%s%d", src,"-->", dst);
    fl_set_xyplot_key(form_dl->owd, 0, curve_label);
		fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position,   FL_ALIGN_BOTTOM_LEFT);   
    fl_set_xyplot_data (form_dl->throughput, otg_forms_info->data_ctime_dl[src][dst],
    otg_forms_info->data_throughput_dl[src][dst], otg_forms_info->idx_dl[src][dst], "", "time", "kbit/s"); 
		sprintf(curve_label, "%d%s%d", src,"-->", dst);
    fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
		fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position,   FL_ALIGN_BOTTOM_LEFT);   
                otg_kpi_nb_loss_pkts();
		sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
		fl_set_object_label(form_dl->loss_ratio, loss_rate);

		sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
		fl_set_object_label(form_dl->simu_time, simu_time);

  } 
  else {
    fl_set_xyplot_data (form_dl->owd, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
    otg_forms_info->data_owd_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "ms");  
		sprintf(curve_label, "%d%s%d", src,"-->", otg_forms_info->is_data_plot_dl);
    fl_set_xyplot_key(form_dl->owd, 0, curve_label);
		fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position,   FL_ALIGN_BOTTOM_LEFT);  
    fl_set_xyplot_data (form_dl->throughput, otg_forms_info->data_ctime_dl[src][otg_forms_info->is_data_plot_dl],
    otg_forms_info->data_throughput_dl[src][otg_forms_info->is_data_plot_dl], otg_forms_info->idx_dl[src][otg_forms_info->is_data_plot_dl], "", "time", "kB/s");
		sprintf(curve_label, "%d%s%d", src,"-->",otg_forms_info->is_data_plot_dl);
    fl_set_xyplot_key(form_dl->throughput, 0, curve_label);
		fl_set_xyplot_key_position(form_dl->throughput,x_key_position,y_key_position,   FL_ALIGN_BOTTOM_LEFT);  
  
                otg_kpi_nb_loss_pkts();
		sprintf(loss_rate, "%s%d","NB Loss pkts DL=",otg_info->total_loss_dl);
		fl_set_object_label(form_dl->loss_ratio, loss_rate);
		sprintf(simu_time, "%s%d","Simulation Time(ms)=", ctime);
		fl_set_object_label(form_dl->simu_time, simu_time);
  }

  for (dst_idx=1;dst_idx<=NB_UE_INST;dst_idx++){
    if (dst_idx!=otg_forms_info->is_data_plot_dl){
      fl_add_xyplot_overlay(form_dl->owd,curve_id++,
      otg_forms_info->data_ctime_dl[src][dst_idx],
      otg_forms_info->data_owd_dl[src][dst_idx],
      otg_forms_info->idx_dl[src][dst_idx],dst_idx+6);
			sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
    	fl_set_xyplot_key(form_dl->owd,  curve_id-1, curve_label);	
			fl_set_xyplot_key_position(form_dl->owd, x_key_position,y_key_position,   FL_ALIGN_BOTTOM_LEFT); 

      fl_add_xyplot_overlay(form_dl->throughput,curve_id++,
      otg_forms_info->data_ctime_dl[src][dst_idx],
      otg_forms_info->data_throughput_dl[src][dst_idx],
      otg_forms_info->idx_dl[src][dst_idx],dst_idx+6);
			sprintf(curve_label, "%d%s%d", src,"-->", dst_idx);
	    fl_set_xyplot_key(form_dl->throughput,  curve_id-1, curve_label);
			fl_set_xyplot_key_position(form_dl->throughput, x_key_position,y_key_position,   FL_ALIGN_BOTTOM_LEFT); 


    } 
  }

  for (i=0;i<otg_forms_info->idx_dl[src][dst];i++){
    otg_forms_info->data_ctime_dl[src][dst][otg_forms_info->idx_dl[src][dst]]=i;
    otg_forms_info->data_owd_dl[src][dst][i]= otg_forms_info->data_owd_dl[src][dst][i+1];
    otg_forms_info->data_throughput_dl[src][dst][i]= otg_forms_info->data_throughput_dl[src][dst][i+1];
  }
  otg_forms_info->idx_dl[src][dst]--;
}

   fl_check_forms();

}