示例#1
0
文件: nnn.c 项目: OrangeTide/xforms
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;
}
示例#2
0
void show_otg_form() {
  int eNB_id;
  char title[255];
  char *tArgv[] = { "OTG", "OTG" };
  int tArgc = 2;

  int major_owd = 6;
  int minor_owd = 3; 
  int major_thr = 5;
  int minor_thr = 2; 

  fl_initialize(&tArgc,tArgv,"OTG",0,0);
  for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) { //NB_eNB_INST
    form_dl= create_form_otg ();
    sprintf (title, "LTE eNB->UE (DL)");
    fl_show_form (form_dl->otg, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
    fl_set_form_position(form_dl->otg, 200, 200);
    fl_set_xyplot_ytics(form_dl->owd,major_owd, minor_owd);
    if (g_otg->owd_radio_access==1)
      fl_set_xyplot_ybounds(form_dl->owd,0,200);
    else
      fl_set_xyplot_ybounds(form_dl->owd,0,400);
    
    fl_set_xyplot_ytics(form_dl->throughput,major_thr, minor_thr);
    fl_set_xyplot_ybounds(form_dl->throughput,0,1000); 
    
    
    
    form_ul= create_form_otg ();
    sprintf (title, "LTE UE->eNB (UL)");
    fl_show_form (form_ul->otg, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
    fl_set_form_position(form_ul->otg, 850, 200);
    fl_set_xyplot_ytics(form_ul->owd,major_owd, minor_owd);
    if (g_otg->owd_radio_access==1)
      fl_set_xyplot_ybounds(form_ul->owd,0,200);
    else
      fl_set_xyplot_ybounds(form_ul->owd,0,400);
    
    //fl_set_positioner_ystep (form_ul->throughput, 100);
    //fl_set_xyplot_xgrid (form_ul->throughput, FL_GRID_MAJOR);
    fl_set_xyplot_ytics(form_ul->throughput,major_thr, minor_thr);
    fl_set_xyplot_ybounds(form_ul->throughput,0,1000); 
    
    
  }

    //create_form_clock();
    //fl_show_form(fclock, FL_PLACE_CENTER,FL_TRANSIENT,"clocks");
    //fl_do_forms();

  fl_check_forms();
}	
示例#3
0
void
edit_options(FL_OBJECT *obj, int m)

{
  int n = state.control[state.control_num];
  /*  The window in not created yet, do it now  */
  if (state.options == NULL) {
    state.options = create_form_Options();
    fl_set_form_minsize(state.options->Options, 
		  state.options->Options->w, state.options->Options->h);
    set_match_defaults(frame, n);
  }
  /*  Deactivate OPTIONS item in the menu */
  fl_set_menu_item_mode(obj, m, FL_PUP_GREY);
  fl_show_form(state.options->Options,  FL_FIX_SIZE, FL_FULLBORDER | FL_PLACE_FREE_CENTER, "Image options");
  set_minconst(frame[n].match.min, state.options->minconstW);
  set_initconst(frame[n].match.firstbright, state.options->initconstW);
  set_starconst(frame[n].match.nstar, state.options->starconstW);
  set_starerror(frame[n].match.poserrmax, state.options->starerrorW);
  set_maxres(frame[n].match.maxres, state.options->maxresW);
  set_starminmag(frame[n].map.minmag, state.options->starminmagW);
  set_starmaxmag(frame[n].map.maxmag, state.options->starmaxmagW);
  fl_set_input(state.options->logfileW, state.logfile);
  set_starminsize(frame[n].fits.minstar, state.options->starminsizeW);
  set_gridsize(frame[n].fits.maxsize, state.options->stargridW); 
  set_edgesize(frame[n].fits.border, state.options->staredgeW); 
  set_countsigma(frame[n].fits.sg_num, state.options->countsigmaW);
  set_countminval(frame[n].fits.minbright, state.options->countminvalW);
  set_inner(frame[n].fits.inner, state.options->starinnerW);
  set_outer(frame[n].fits.outer, state.options->starouterW);
  fl_set_button(state.options->starapertureW, frame[n].fits.aperture);
}
示例#4
0
Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips";
#endif

#include <stdio.h>
#include "origin.common.h"
#include "forms.h"
#include "xforms-compat.h"
#include "origin.panel.h"

/*
 * This file should contain ONLY the user interface and main()
 * to make splitting off the NeXT version easy
 */

int main(int argc, char *argv[]) {

#ifdef XFORMS
  FL_INITIALIZE("Origin");
#else
  fl_init();
  foreground();
#endif
  
  create_the_forms();
 
  internalsInit();

  fl_show_form(MainForm, FL_PLACE_SIZE, TRUE, "Move Origin");
 
  while(1) fl_do_forms();
}
示例#5
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;
}
示例#6
0
文件: proba0.c 项目: lcion/nadcn
void main(int argc, char **argv){
	crt_head = NULL;
	fl_initialize(&argc, argv, "FormDemo", 0, 0);
	mainfrm = create_form_hostanduser();
	fl_show_form(mainfrm->hostanduser, FL_PLACE_MOUSE,FL_TRANSIENT,"LanAdmin");
	fl_do_forms();
}
示例#7
0
文件: iclient.c 项目: lcion/nadcn
void connect_cback(FL_OBJECT *ob, long user_data){

   hauf = create_form_hostanduser();
   fl_show_form(hauf->hostanduser,FL_PLACE_MOUSE,FL_TRANSIENT,"LOGIN Form");

  fl_do_forms();

   //   printf("Aici va interveni o interfata de conectare\n");
}
main(int argc, char *argv[]) {
  fl_initialize(&argc,argv,"Randoms",0,0);
  the_gui = create_form_rgui();
  InitDistributionChoice();
  InitPlot();
  fl_show_form(the_gui->rgui,FL_PLACE_CENTER,FL_FULLBORDER,"Random Distributions");

  while (1)
    fl_do_forms();
}
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");
}
示例#10
0
NeoWindow::NeoWindow( char **args, Neoterics *owner ) : neo( owner ), mainWin( NULL ), options_box( NULL ),
                         nnet_plot( NULL ), chart_wind( NULL ) { //, portal( NULL ) {
#undef int
   int tmp = (int) 1;
   if ( ! neo->dontShowDisplayAtAll ) fl_initialize( &tmp, args, args[0], 0, 0 );
#define int short
   pixmap = NULL;
   display = XOpenDisplay( "" );
   if ( display == NULL ) throw( "cannot connect to server" );
   screen = DefaultScreen( display );
   mainWin = create_form_mainWindow();
   fl_show_form( mainWin->mainWindow, FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, neo->programName );
   ::XFlush( display );
   Window window = FL_ObjWin( mainWin->mainCanvas );
   if ( window == (Window) NULL ) throw( "cannot open window" );
   destination = window;
   gc = ::XCreateGC( display, window, 0, 0 );
   changed = true; // Why it has to be here and not at the top, I dont know

   fl_add_canvas_handler( mainWin->mainCanvas, Expose, expose_callback, (void *) this );
   fl_add_canvas_handler( mainWin->mainCanvas, ButtonPress, buttonRelease_callback, (void *) this );
   fl_add_canvas_handler( mainWin->mainCanvas, ButtonRelease, buttonRelease_callback, (void *) this );
   fl_set_scrollbar_return( mainWin->scroll_h, FL_RETURN_CHANGED );
   fl_set_scrollbar_return( mainWin->scroll_v, FL_RETURN_CHANGED );
   fl_set_object_callback( mainWin->scroll_h, scroll_callback, (long) this );
   fl_set_object_callback( mainWin->scroll_v, scroll_callback, (long) this );
   cmap = fl_get_canvas_colormap( mainWin->mainCanvas );

   action_color[moveForward].red = 0x0000; //  Forward color
   action_color[moveForward].green = 0x0000;
   action_color[moveForward].blue = 0xFFFF;
   action_color[turnRight].red = 0x0000; //  Turn Right
   action_color[turnRight].green = 0x0000;
   action_color[turnRight].blue = 0xFFFF;
   action_color[turnLeft].red = 0x0000; //  Turn Left
   action_color[turnLeft].green = 0x0000;
   action_color[turnLeft].blue = 0xFFFF;
   action_color[eat].red = 0x0000; //  Eat
   action_color[eat].green = 0xFFFF;
   action_color[eat].blue = 0xFFFF;
   action_color[breed].red = 0xFFFF; //  Breed
   action_color[breed].green = 0x0000;
   action_color[breed].blue = 0xFFFF;
   action_color[fight].red = 0xFFFF; //  Fight
   action_color[fight].green = 0xFFFF;
   action_color[fight].blue = 0x0000;   

   if ( ! neo->startoffDisplaying ) neo->keepDrawing = false;

#define offscreen
#ifdef offscreen
   pixmap = XCreatePixmap( display, window, mainWin->mainCanvas->w, mainWin->mainCanvas->h,
			   DefaultDepth( display, screen ) );
#endif
}
示例#11
0
static PyObject *
form_show_form(formobject *f, PyObject *args)
{
	int place, border;
	char *name;
	if (!PyArg_Parse(args, "(iis)", &place, &border, &name))
		return NULL;
	fl_show_form(f->ob_form, place, border, name);
	Py_INCREF(Py_None);
	return Py_None;
}
void
info_display (FL_OBJECT *ob, long data)
{
    if (info_displayed == 0)
    {
        fl_show_form (fd_receiver_info->receiver_info, FL_PLACE_CENTER, FL_FULLBORDER, "IRA Info");
        info_displayed = 1;
    }
    else
    {
        fl_raise_form(fd_receiver_info->receiver_info);
    }
}
void
display_waterfall (FL_OBJECT *ob, long data)
{
    if (wfall_displayed == 0)
    {
        fl_show_form(fd_receiver_waterfall->receiver_waterfall, FL_PLACE_CENTER,FL_FULLBORDER,"IRA WaterFall");
        wfall_displayed = 1;
    }
    else
    {
        fl_raise_form(fd_receiver_waterfall->receiver_waterfall);
    }
}
void
spectrum_display (FL_OBJECT *ob, long data)
{
    if (spectrum_displayed == 0)
    {
        fl_show_form(fd_receiver_spectrum->receiver_spectrum, FL_PLACE_CENTER,FL_FULLBORDER,"IRA Spectrum");
        spectrum_displayed = 1;
    }
    else
    {
        fl_raise_form(fd_receiver_spectrum->receiver_spectrum);
    }
}
void
pulsar_display (FL_OBJECT *ob, long data)
{
    if (pulsar_displayed == 0)
    {
        fl_show_form(fd_receiver_pulsar->receiver_pulsar,FL_PLACE_CENTER,FL_FULLBORDER,"IRA Pulsar");
        pulsar_displayed = 1;
    }
    else
    {
        fl_raise_form(fd_receiver_pulsar->receiver_pulsar);
    }
}
void
tp_display (FL_OBJECT *ob, long data)
{
    if (tp_displayed == 0)
    {
        fl_show_form (fd_receiver_continuum->receiver_continuum, FL_PLACE_CENTER, FL_FULLBORDER, "IRA Continuum");
        tp_displayed = 1;
    }
    else
    {
        fl_raise_form(fd_receiver_continuum->receiver_continuum);
    }
}
示例#17
0
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);

}
void
interferometer_display (FL_OBJECT *ob, long data)
{
    if (inter_displayed == 0)
    {
        fl_show_form (fd_receiver_interferometer->receiver_interferometer,
                      FL_PLACE_CENTER, FL_FULLBORDER, "IRA Interferometer");
        inter_displayed = 1;
    }
    else
    {
        fl_raise_form(fd_receiver_interferometer->receiver_interferometer);
    }
}
示例#19
0
int
main( int    argc,
      char * argv[ ] )
{
    FL_FORM *form;
    FL_OBJECT *obj;

    fl_initialize( &argc, argv, "FormDemo", 0, 0 );

    form = fl_bgn_form( FL_UP_BOX, 360, 140);

    obj = fl_add_button( FL_TOUCH_BUTTON, 50, 30, 40, 30, "@<<" );
    fl_set_object_boxtype( obj, FL_FRAME_BOX );
    fl_set_object_color( obj, FL_COL1, FL_INDIANRED );
    fl_set_object_callback( obj, show_val, -5 );
    fl_set_button_shortcut( obj, "1", 0 );

    obj = fl_add_button( FL_TOUCH_BUTTON, 90, 30, 40, 30, "@<" );
    fl_set_object_boxtype( obj, FL_FRAME_BOX );
    fl_set_object_color( obj, FL_COL1, FL_INDIANRED );
    fl_set_object_callback( obj,  show_val, -1 );
    fl_set_button_shortcut( obj, "2",  0 );

    valobj = obj = fl_add_box( FL_BORDER_BOX, 130, 30, 100, 30, "" );
    fl_set_object_color( obj, FL_LEFT_BCOL, FL_LEFT_BCOL );

    obj = fl_add_button( FL_TOUCH_BUTTON, 230, 30, 40, 30, "@>" );
    fl_set_object_boxtype( obj, FL_FRAME_BOX );
    fl_set_object_color( obj, FL_COL1, FL_INDIANRED );
    fl_set_object_callback( obj, show_val, 1 );
    fl_set_button_shortcut( obj, "3", 0 );

    obj = fl_add_button( FL_TOUCH_BUTTON, 270, 30, 40, 30, "@>>" );
    fl_set_object_boxtype( obj, FL_FRAME_BOX );
    fl_set_object_callback( obj, show_val, 5 );
    fl_set_object_color( obj, FL_COL1, FL_INDIANRED );
    fl_set_button_shortcut( obj, "4", 0 );

    fl_add_button( FL_NORMAL_BUTTON, 220, 90, 100, 30, "Exit" );

    fl_end_form( );

    fl_show_form( form, FL_PLACE_CENTER, FL_NOBORDER, "Touch Buttons" );

    fl_do_forms( );
    fl_finish( );

    return 0;
}
示例#20
0
int
main( int    argc,
      char * argv[ ] )
{
    fl_initialize( &argc, argv, "FormDemo", 0, 0 );
    fd_ttt = create_form_ttt( );

    fl_show_form( fd_ttt->ttt, FL_PLACE_CENTER, FL_TRANSIENT, "PixmapBrowser" );

    fl_set_fselector_placement( FL_PLACE_FREE );
    fl_set_fselector_callback( load_file, 0 );
    fl_show_fselector( "Load a Pixmap file", NULL, "*.x?m", NULL );
    fl_do_forms( );
    return 0;
}
示例#21
0
文件: iclient.c 项目: lcion/nadcn
int main(int argc, char *argv[]){

   FL_FORM *form;
   FL_OBJECT *obj;
  
  fl_initialize(&argc, argv, "FormDemo", 0, 0);
  form = fl_bgn_form(FL_UP_BOX,320,120);
    fl_add_box(FL_NO_BOX,160,40,0,0,"Welcome to LanAdmin");
    obj = fl_add_button(FL_NORMAL_BUTTON,40,70,80,30,"Connect");
    fl_set_object_callback(obj, connect_cback,0);
    obj = fl_add_button(FL_NORMAL_BUTTON,200,70,80,30,"Leave");
    fl_set_object_callback(obj, leave_cback,0);
  fl_end_form();

  fl_show_form(form,FL_PLACE_MOUSE,FL_TRANSIENT,"LanAdmin");

  fl_do_forms();
  return 0;
}
示例#22
0
文件: main.c 项目: rmr93/Projeto1_fsc
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;
}
示例#23
0
文件: proba0.c 项目: lcion/nadcn
void cb_hau_acc(FL_OBJECT *ob, long user_data){//incarc inca o forma - si introduc obiectul in lista
unc_pl *p1u, *p2u;
int varza;
	if((p2u = malloc(sizeof(unc_pl))) == NULL){
		printf("Aut of memory\n");
		fl_finish();
		exit(0);
	}
	p2u->p_unceas = create_form_unCeas();
	p2u->next = NULL;
	schimba(&varza);
	printf("%d\n",varza);
	if(crt_head == NULL){
		crt_head = p2u;
	}
	else{
		p1u = crt_head;
		while(p1u->next != NULL)p1u = p1u->next;
		p1u->next = p2u;
	}
	fl_show_form(p2u->p_unceas->unCeas, FL_PLACE_MOUSE,FL_TRANSIENT,"Ceas");
}
示例#24
0
int main(int argc, char *argv[])
{
  Int4 entries;
  FL_IOPT opt;

  CheckHost();

  /* There is a conflict between forms and xew about the meaning of
     the arguments: The "-p" option is taken as "-privat" by
     fl_initialize(), forcing a private colourmap.  This is what we
     want anyway, so ok... :-).  We just call GetArgs() first, because
     fl_initialize() removes the "-p" from argv[] ....  */

  GetArgs(argc, argv);

  /* Force private colourmap (why do I need opt?) */
  fl_set_defaults( FL_PDPrivateMap, &opt );

  fl_initialize(&argc, argv, "XEw", NULL, 0);

  /* Set up our signal handlers */
  signal(SIGINT, SigHandler);
  signal(SIGTERM, SigHandler);

  create_the_forms();
  set_object_defaults();
  /* load logo  */
  fl_set_pixmap_data(img_pxm, xew_logo_xpm);

  fl_show_form(xew_mainf,FL_PLACE_MOUSE, FL_FULLBORDER, "xew");

  entries = ReadFiles();
  FillBrowser( entries );

  fl_do_forms();

  return EXIT_FAILURE ;   /* shouldn't be reached */

}
示例#25
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 );
}
示例#26
0
int
main( int    argc,
      char * argv[ ] )
{

   fl_initialize( &argc, argv, "FormDemo", 0, 0 );

   create_form_form( );
   fill_in( barchart );
   fill_in( horbarchart );
   fill_in( linechart );
   fl_set_object_helper( linechart, "A LineChart" );
   fill_in( filledchart );
   fill_in( spikechart );
   fill_in( piechart );
   fill_in( specialpiechart );

   fl_show_form( form, FL_PLACE_CENTER, FL_TRANSIENT, "Charts" );

   fl_do_forms( );

   fl_finish( );
   return 0;
}
int main(int argc, char *argv[])
{
	void lmst_update (FL_OBJECT *, long);
	int i;
	void dismiss_psr();
	void spectrum_hide();
	void tp_hide ();
	void hide_waterfall();
	void hide_interferometer();
	void hide_info();
	void receiver_leave();
	int close_sub ();
	int close_main ();
	char *p;
	char fntstr[128];
	char d[128];
	int binwidth;
	
	/*
	 * Init xforms library
	 */
   fl_initialize(&argc, argv, "Ira", 0, 0);
   fl_get_app_resources (NULL, 0);
   
   time (&started_at);
   
   /*
    * Create various windows, including the main one
	*/
   fd_receiver_main = create_form_receiver_main();
	fl_set_form_atclose(fd_receiver_main->receiver_main, close_main, 0);
	
   fd_receiver_pulsar = create_form_receiver_pulsar();
   fl_set_form_atclose (fd_receiver_pulsar->receiver_pulsar, close_sub, dismiss_psr);
   
   fd_receiver_spectrum = create_form_receiver_spectrum();
   fl_set_form_atclose (fd_receiver_spectrum->receiver_spectrum, close_sub, spectrum_hide);
   
   fd_receiver_continuum = create_form_receiver_continuum();
   fl_set_form_atclose (fd_receiver_continuum->receiver_continuum, close_sub, tp_hide);
   
   fd_receiver_waterfall = create_form_receiver_waterfall();
   fl_set_form_atclose (fd_receiver_waterfall->receiver_waterfall, close_sub, hide_waterfall);
   
   fd_receiver_info = create_form_receiver_info();
   fl_set_form_atclose (fd_receiver_info->receiver_info, close_sub, hide_info);
   
   fd_receiver_lproblem = create_form_receiver_lproblem ();
   fd_receiver_error = create_form_receiver_error ();
   
   fd_receiver_shutdown = create_form_receiver_shutdown ();
   
   
   flps_init();
   fl_free_pixmap_pixmap(fd_receiver_main->ira_xpm_button);
   fl_set_pixmap_data(fd_receiver_main->ira_xpm_button, Ira_xpm);
   
	sprintf (version_info, "Ver: %s  (BETA)", VERSION);
   
   /*
    * Stuff lines in info window
	*/
   for (i = 0; ; i++)
   {
	   if (ira_info[i] == NULL)
	   {
		   break;
	   }
	   fl_add_browser_line (fd_receiver_info->info_browser, ira_info[i]);
   }
   fl_set_browser_fontsize(fd_receiver_info->info_browser, 14);
   
   /* fill-in form initialization code */
   fl_set_object_label (fd_receiver_main->startup_text, "PLEASE WAIT.........");
   
   /* show the first form */
   fl_show_form(fd_receiver_main->receiver_main,FL_PLACE_CENTER,FL_FULLBORDER,"IRA Control Panel");
   fl_check_forms();
   
   /*
    * Now we check a raft of environment variables, and use those to initialize
	*   various settable values
	*/
	
	refmult = 1.0;
	if ((p = getenv ("RCVR_REF_MULT")) != NULL)
	{
   		refmult = atof(p);
	}
   fl_set_slider_value (fd_receiver_main->refmult_slider, refmult);
   
   seti_integ = 15;
   if ((p = getenv ("RCVR_SETI_INTEG")) != NULL)
   {
   		seti_integ = (int)atof(p);
	}
   fl_set_slider_value (fd_receiver_main->seti_integ_slider, (float)seti_integ);
   
   strcpy (datadir, ".");
   if ((p = getenv ("RCVR_DATA_DIR")) != NULL)
   {
   		strcpy (datadir, p);
	}
  
  	/*
	 * Set the input field for freq, as well as the actual frequency
	 */
   if ((p = getenv ("RCVR_INITIAL_FREQ")) != NULL)
   {
	   fl_set_input (fd_receiver_main->frequency_input, p); 
	   frequency = atof(p);
	   sky_freq = frequency;
	   sky_locked = 1;
   }
   
   /*
    * Start out with sky_freq unavailable for input
	*/
   fl_deactivate_object (fd_receiver_main->sky_freq_input);
   fl_set_input (fd_receiver_main->sky_freq_input, "--------");
   
   /* If there's a sky_freq parameter, use it, and re-activate the
    *  sky_freq_input control
	*/
   if ((p = getenv ("RCVR_SKY_FREQ")) != NULL)
   {
	   if (abs(atof(p) - frequency) > 100.0)
	   {
			   
		   sky_locked = 0;
		   fl_set_input (fd_receiver_main->sky_freq_input, p);
			sky_freq = atof(p);
			fl_activate_object (fd_receiver_main->sky_freq_input);
			fl_set_button (fd_receiver_main->sky_lock_button, 0);
		}
		else
		{
			sky_freq = atof(p);
			fl_set_button (fd_receiver_main->sky_lock_button, 1);
			sky_locked = 1;
		}
	}
	PUSHVAR("ifreq", frequency);
	PUSHVAR("skyfreq", sky_freq);
   /*
    * 
    * And again for RF gain
	*/
	if ((p = getenv ("RCVR_RF_GAIN")) != NULL)
	{
   		rf_gain = atoi(p);
	}
   fl_set_slider_value (fd_receiver_main->rf_gain_slider, rf_gain);
	PUSHVAR("igain", rf_gain);
   /*
    * Gain correction values for A and B sides
	*/
   if ((p = getenv ("RCVR_COR_A")) != NULL)
   {
	   gc_a = atof(p);
	  
   }
   sprintf (d, "%f", gc_a);
   fl_set_input (fd_receiver_main->gc_a, d);
   
   if ((p = getenv ("RCVR_COR_B")) != NULL)
   {
	   gc_b = atof(p);
   }
   sprintf (d, "%f", gc_b);
   fl_set_input (fd_receiver_main->gc_b, d);
   
	/*
	 * Set bounds/values for DC gain
	 */
	if ((p = getenv ("RCVR_DC_GAIN")) != NULL)
	{
		dc_gain = atof(p);
	}
   fl_set_slider_value (fd_receiver_main->dc_gain_control, dc_gain);

   
   /*
    * And again for DC offset
	*/
	if ((p = getenv ("RCVR_DC_OFFSET")) != NULL)
	{
		dc_offset = atof(p);
	}
   fl_set_slider_value (fd_receiver_main->dc_offset_control, dc_offset);
   /*
    * Receiver DC Gain multiplier
	*/
   if ((p = getenv ("RCVR_DC_MULT")) != NULL)
   {
	   int which;
	   
	   dc_mult = (double)atoi(p);
	   which = 1;
	   /*
	    * It's a choice widget, so we need to set 'which' appropriately
		*/
	   switch ((int)dc_mult)
	   {
		case 1:
			which = 1;
			break;
		case 5:
			which = 2;
			break;
		case 10:
			which = 3;
			break;
		case 15:
			which = 4;
			break;
		case 20:
			which = 5;
			break;
		case 25:
			which = 6;
			break;
		case 30:
			which=7;
			break;
		case 35:
			which = 8;
			break;
		case 40:
			which = 9;
			break;
		}
		fl_set_choice (fd_receiver_main->mult_choice, which);
   } 
   
   /*
    * Total power integration value
	*/
	tp_integration = 5;
	if ((p = getenv ("RCVR_TP_INTEG")) != NULL)
	{
		tp_integration = atoi(p);
	}
   fl_set_slider_value (fd_receiver_main->continuum_int, (double)atof(getenv("RCVR_TP_INTEG")) );
   
   /*
    * Spectral integration
	*/
	spec_integration = 15;
	if ((p = getenv ("RCVR_SPEC_INTEG")) != NULL)
	{
		spec_integration = atoi(p);
	}
   fl_set_slider_value (fd_receiver_main->spec_int_slider, (double)atof(getenv("RCVR_SPEC_INTEG")) );
   
   /*
    * Sigma_K for SETI analysis
	*/
	sigma_k = 2.5;
	if ((p = getenv ("RCVR_SIGMA_K")) != NULL)
	{
   		sigma_k = atof(p);
	}
   fl_set_slider_value (fd_receiver_main->sigma_k_slider, sigma_k);
   
   /*
    * Check desired receiver mode
	*/
   if (getenv("RCVR_MODE") != NULL)
   {
   	strcpy (rcvr_mode, getenv("RCVR_MODE"));
	}
	else
	{
		strcpy (rcvr_mode, "unknown");
	}
	
	/*
	 * Interferometer?  Create the interferometer window
	 */
   if (strcmp (rcvr_mode, "interferometer") == 0)
   {
	   fd_receiver_interferometer = create_form_receiver_interferometer();
	   fl_set_form_atclose (fd_receiver_interferometer->receiver_interferometer, close_sub, 
	   	hide_interferometer);
   }
   /*
    * Otherwise, delete the "show interferograms" control
	*/
   else
   {
	   fl_delete_object  (fd_receiver_main->interferometer_button);
   }
   
   /*
    * Various values
	*/
	declination = -28.3;
	if ((p = getenv ("RCVR_DECLINATION")) != NULL)
	{
		declination = atof(p);
	}
	fl_set_input (fd_receiver_main->declination_input, getenv("RCVR_DECLINATION"));
	
	longitude = 0.0;
	if ((p = getenv ("RCVR_LONGITUDE")) != NULL)
	{
		longitude = atof(p);
	}
	seti_size = 500000;
	if ((p = getenv ("RCVR_SETI_SIZE")) != NULL)
	{
   		seti_size = atoi (p);
	}

    bandwidth = 5000000;
    if ((p = getenv ("RCVR_BANDWIDTH")) != NULL)
    {
		bandwidth = atoi (p);
	}

   psr_rate = 10000;
   if ((p = getenv ("RCVR_PSR_RATE")) != NULL)
   {
   		psr_rate = atoi (getenv ("RCVR_PSR_RATE"));
	}
   for (i = 0; i < NNOTCHES; i++)
   {
	   notches[i] = -1.0;
   }
   if ((p = getenv ("RCVR_NOTCHES")) != NULL)
   {
	   char *tp;
	   char pcopy[128];
	   FILE *fp;
	   
	   strcpy (pcopy, p);
	   
	   tp = strtok (pcopy, ",");
	   notches[0] = atof(tp);
	   for (i = 1; i < NNOTCHES; i++)
	   {
		   tp = strtok (NULL, ",");
		   if (tp == NULL)
		   {
			   break;
		   }
		   notches[i] = atof(tp);
	   }
   }
   if ((p = getenv ("RCVR_NOTCH_SIZE")) != NULL)
   {
	   notch_length = atoi(p);
   		fl_set_slider_value (fd_receiver_spectrum->notch_slider, (double)notch_length);
	}
	if ((p = getenv ("RCVR_DM")) != NULL)
	{
		pulsar_dm = atof(p);
		fl_set_slider_value (fd_receiver_main->dm_input, (double)pulsar_dm);
	}
	PUSHVAR("idm", pulsar_dm);
	
	if ((p = getenv ("PULSAR_RATE")) != NULL)
	{
		pulsar_rate = atof(p);
		fl_set_input (fd_receiver_main->pulsar_rate_input, p);
	}
	if ((p = getenv ("PULSAR_FOLDING")) != NULL)
	{
		pulsar_folding = atoi(p);
		fl_set_choice (fd_receiver_main->pulsar_choice, pulsar_folding/5);
	}
	/*
	 * Set spec_fft_size based on width of spectral plot display
	 */
   {
	   FL_Coord x, y, w, h;
	   
   		fl_get_object_bbox (fd_receiver_spectrum->spectral_plot, &x, &y, &w, &h);
   		spec_fft_size = w-130;
	}
	
	tp_maxval = 100000;
	tp_span = 20000;
	
	/*
	 * Establish parameters for TP plot
	 */
	if ((p = getenv("RCVR_TP_MAXVAL")) != NULL)
	{
		tp_maxval = (double)atoi(p);
	}
	if ((p = getenv ("RCVR_TP_SPAN")) != NULL)
	{
		tp_span = (double)atoi(p);
	}
	tp_minval = tp_maxval - tp_span;
	fl_set_slider_value (fd_receiver_continuum->tp_max_slider, (double)tp_maxval);
	fl_set_slider_value (fd_receiver_continuum->tp_span_slider, (double)tp_span);  
	fl_set_xyplot_ybounds(fd_receiver_continuum->tp_chart, (double)tp_minval, (double)tp_maxval);
   fl_set_xyplot_ytics(fd_receiver_continuum->tp_chart, 10, 1);
   fl_set_xyplot_xgrid (fd_receiver_continuum->tp_chart, FL_GRID_MINOR);
   fl_set_xyplot_ygrid (fd_receiver_continuum->tp_chart, FL_GRID_MINOR);
   fl_set_object_posthandler(fd_receiver_continuum->tp_chart, continuum_plot_post);
   
   /*
    * Set a post handler for inteferometer display
	*/
   if (strcmp (rcvr_mode, "interferometer") == 0)
   {
   		fl_set_object_posthandler(fd_receiver_interferometer->interferometer_chart, continuum_plot_post);
		if ((p = getenv ("RCVR_INT_GAIN")) != NULL)
		{
			interferometer_gain = atof(p);
		}
		if ((p = getenv ("RCVR_INT_SPAN")) != NULL)
		{
			interferometer_span = atof(p);
		}
		if ((p = getenv ("RCVR_PHCORR")) != NULL)
		{
			interferometer_phase = atof(p);
		}
		if ((p = getenv ("RCVR_DELAY")) != NULL)
		{
			interferometer_delay = atof(p);
		}
		fl_set_xyplot_ytics (fd_receiver_interferometer->interferometer_chart, 10, 1);
		fl_set_xyplot_xgrid (fd_receiver_interferometer->interferometer_chart, FL_GRID_MINOR);
		fl_set_xyplot_ygrid (fd_receiver_interferometer->interferometer_chart, FL_GRID_MINOR);
		fl_set_slider_value (fd_receiver_interferometer->int_gain_slider, interferometer_gain);
		fl_set_slider_value (fd_receiver_interferometer->int_span_slider, interferometer_span);
		fl_set_slider_value (fd_receiver_interferometer->phase_adjust, interferometer_phase);
		fl_set_slider_value (fd_receiver_interferometer->delay_adjust, interferometer_delay);
		fl_set_xyplot_ybounds (fd_receiver_interferometer->interferometer_chart, -1*interferometer_span,
			interferometer_span);
	}
   
   fl_add_timeout (1000.0, (FL_TIMEOUT_CALLBACK)lmst_update, 0);
   
   /*
    * Setup parameters for spectral plot
	*/
	if ((p = getenv ("RCVR_SPEC_MAX")) != NULL)
	{
		current_smax = atoi(p);
	}
	if ((p = getenv ("RCVR_SPEC_SPAN")) != NULL)
	{
		current_span = atoi(p);
	}
	if ((p = getenv ("RCVR_SPEC_FLAT")) != NULL)
	{
		spec_flat_on = atoi(p);
		fl_set_button (fd_receiver_spectrum->flaten_button, spec_flat_on);
	}
	if ((p = getenv ("RCVR_SPEC_METHOD")) != NULL)
	{
		spec_method = atoi (p);
	}
	fl_set_xyplot_xgrid(fd_receiver_spectrum->spectral_plot, FL_GRID_MINOR);
	fl_set_xyplot_ygrid(fd_receiver_spectrum->spectral_plot, FL_GRID_MINOR);
	fl_set_xyplot_ybounds(fd_receiver_spectrum->spectral_plot, (double)(current_smax-current_span), (double)
		current_smax);
	fl_set_xyplot_ytics(fd_receiver_spectrum->spectral_plot, 10, 1);
	fl_set_xyplot_xtics(fd_receiver_spectrum->spectral_plot, 10, 1);
	
	fl_set_object_posthandler(fd_receiver_spectrum->spectral_plot, spectral_plot_post);
	fl_set_choice (fd_receiver_spectrum->spec_method_choice, spec_method);
	fl_set_choice_fontsize (fd_receiver_spectrum->spec_method_choice, 14);
	
	fl_set_slider_value (fd_receiver_spectrum->spec_max_slider, (double)current_smax);
	fl_set_slider_value (fd_receiver_spectrum->spec_span_slider, (double)current_span);
	
	/*
	 * Set post handler for pulsar display
	 */
	fl_set_object_posthandler(fd_receiver_pulsar->pulsar_plot, pulsar_plot_post);
	
	/*
	 * Set parameters for waterfall (SETI) display
	 */
	{
		FL_Coord x, y;
		FL_Coord w, h;
		fl_get_object_bbox(fd_receiver_waterfall->waterfall_display, &x, &y, &w, &h);
		fl_set_slider_bounds (fd_receiver_waterfall->wfall_seg_slider, 1.0, (float)seti_size/w);
		fl_set_object_dblbuffer(fd_receiver_waterfall->waterfall_display, 1);
		
		if ((p = getenv ("RCVR_WFALL_SEGMENT")) != NULL)
		{
			waterfall_segment = atoi(p);
			fl_set_slider_value (fd_receiver_waterfall->wfall_seg_slider, (double)waterfall_segment);
		}
		if ((p = getenv ("RCVR_WFALL_FINE")) != NULL)
		{
			waterfall_fine = atoi(p);
			fl_set_slider_value (fd_receiver_waterfall->fine_segment, waterfall_fine);
		}
		if ((p = getenv ("RCVR_WFALL_BRIGHTNESS")) != NULL)
		{
			double w;
			
			w = atof(p);
			if (fabsf(w-1.0) < 0.1)
			{
				fl_set_choice (fd_receiver_waterfall->wfall_brightness, 1);
				w = 1.0;
			}
			if (fabsf(w-0.75) < 0.1)
			{
				fl_set_choice (fd_receiver_waterfall->wfall_brightness, 2);
				w = 0.75;
			}
			if (fabsf(w-0.66) < 0.1)
			{
				fl_set_choice (fd_receiver_waterfall->wfall_brightness, 3);
				w = 0.66;
			}
			if (fabsf(w-0.50) < 0.1)
			{
				fl_set_choice (fd_receiver_waterfall->wfall_brightness, 4);
				w = 0.50;
			}
			waterfall_brightness = (float)w;
		}
	}
	if ((p = getenv ("RCVR_TRANS_THRESH")) != NULL)
	{
		transient_threshold = atof(p);
		fl_set_slider_value (fd_receiver_main->trans_thr_slider, transient_threshold);
	}
	if ((p = getenv ("RCVR_TRANS_DUR")) != NULL)
	{
		transient_duration = atof(p);
		fl_set_slider_value (fd_receiver_main->trans_dur_slider, transient_duration);
	}
	/*
	 * Open various FIFOs--that's where we get our data from
	 */
	if ((seti_fd = open ("ra_seti_fifo", O_RDONLY|O_NONBLOCK)) > 0)
   {
	   fcntl (seti_fd, F_SETFL, 0);
	   fl_add_io_callback (seti_fd, FL_READ, (FL_IO_CALLBACK)handle_seti_io, fd_receiver_main);
   }
   if ((pulsar_fd = open ("ra_psr_fifo", O_RDONLY|O_NONBLOCK)) > 0)
   {
	    fcntl (pulsar_fd, F_SETFL, 0);
		fl_add_io_callback (pulsar_fd, FL_READ, (FL_IO_CALLBACK)handle_pulsar_io, fd_receiver_main);
   }
   if ((dicke_fd = open ("ra_switching_fifo", O_RDONLY|O_NONBLOCK)) > 0)
   {
	    fcntl (dicke_fd, F_SETFL, 0);
	    fl_set_object_label (fd_receiver_main->dicke_mode, "DICKE: ON");
		fl_add_io_callback (dicke_fd, FL_READ, (FL_IO_CALLBACK)handle_dicke_io, fd_receiver_main);
   }
   if (strcmp (rcvr_mode, "interferometer") == 0)
   {
	   if ((inter_fd = open ("ra_inter_fifo", O_RDONLY|O_NONBLOCK)) > 0)
	   {
		    fcntl (inter_fd, F_SETFL, 0);
	    	fl_add_io_callback (inter_fd, FL_READ, (FL_IO_CALLBACK)handle_inter_io, fd_receiver_main);
		}
	}
	if (strcmp (rcvr_mode, "split") == 0)
	{
		if ((validation_fd = open ("ra_validation_fifo", O_RDONLY|O_NONBLOCK)) > 0)
		{
			fcntl (validation_fd, F_SETFL, 0);
			split_mode = 1;
			fl_add_io_callback (validation_fd, FL_READ, (FL_IO_CALLBACK)handle_validation_io, fd_receiver_main);
		}
	}
	fl_set_oneliner_font (FL_FIXEDBOLDITALIC_STYLE, FL_MEDIUM_FONT);
	fl_set_oneliner_color (FL_GREEN, FL_BLACK);

   while(fl_do_forms())
         ;
   return 0;
}
示例#28
0
int main(int argc, char **argv) {

    // initialize the world with particle2 file?
    if (argc>1) {
	char *file = argv[1];
	if (!strcmp(file, "."))
	    particle2_read_stream(stdin, "stdin");
	else {
	    FILE *fp;
	    fp = fopen(file, "r");
	    if (fp==NULL) {
		fprintf(stderr, "Can't open particle file %s\n", file);
		exit(1);
	    }
	    particle2_read_stream(fp, file);
	    fclose(fp);
	}
    }

    /* initialize Xforms */
    fl_initialize(&argc, argv, "n-body", 0, 0);
    ui = create_form_nbody();

    // draw the UI window
    fl_show_form(ui->nbody,  	/* form */
	FL_PLACE_SIZE,   /* pos & size flags */
	FL_FULLBORDER,   /* border flags */
	argv[0]          /* window name */
    );

    // set up so we can draw in the big window of "ui" using OpenGL
    // set bits-per-pixel and other attributes of window

    // attributes for RGBA, without z-buffer, single-buffered
    // int single_attrs[] =
    //	{GLX_RGBA, GLX_DEPTH_SIZE, 0, GLX_RED_SIZE, 4, None};

    // attributes for RGBA, without z-buffer, double-buffered
    int double_attrs[] =
	{GLX_RGBA, GLX_DEPTH_SIZE, 0, GLX_RED_SIZE, 4, GLX_DOUBLEBUFFER, None};

    glxf_bind_pane(&pane,
	ui->pane,		// window
	double_attrs,		// requested attributes for window
	handle_event		// event_handler for window
    );

    // set viewport for OpenGL
    glMatrixMode(GL_PROJECTION);
    gluOrtho2D(0, 1, 0, 1);
    glMatrixMode(GL_MODELVIEW);
    // leave matrix mode at MODELVIEW so that later transformations
    // (glScale, glTranslate) go into that matrix

    // save info about current transformations
    view.update();

    // disable z-buffer and lighting
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);

    dt_proc(ui->dt_slider, 0);	// initialize world.timestep

    world.draw();		// draw the world (clear the screen)

    // Xforms handles events until exit button is pushed

    // the following loop repeats continuously when the world is "running",
    // otherwise it sleeps in fl_do_forms() waiting for mouse motion or other
    // Xwindows events, so as to not eat up unneeded CPU time

    // We have callback procedures set up for the sliders, but not for
    // the run and exit buttons.
    // fl_check_forms() and fl_do_forms() return only when an event occurs
    // (button, slider, mouse motion...) for which no callback procedure has
    // been set.
    // Therefore, control returns here when the run or exit buttons is hit.

    FL_OBJECT *obj;
    do {
	if (world.running) {		// if running:
	    world.step(world.timestep);	// take a time step
	    world.draw();		// redraw
	    obj = fl_check_forms();	// do a (non-blocking) check for events
	}
	else				// if not running:
	    obj = fl_do_forms();	// sleep until next event comes

	if (obj == ui->run_button) {
	    // user just hit the run button; toggle it
	    world.running = !world.running;
	}
    } while (obj != ui->exit_button);	// keep going until exit button is hit

    return 0;
}
void g3d_show_grasp_planning_form(void)
{
  fl_show_form(GRASP_PLANNING_FORM, FL_PLACE_SIZE, TRUE, "Grasp Planning");
}
示例#30
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;
}