示例#1
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);
}
示例#2
0
FL_FORM *
dial_create_spec_form( void )
{
    if ( dial_attrib )
        return dial_attrib->dialattrib;

    dial_attrib = create_form_dialattrib( );
    fl_addto_choice( dial_attrib->dir, dial_dir[ 0 ].name );
    fl_addto_choice( dial_attrib->dir, dial_dir[ 1 ].name );

    setup_how_return_menu( dial_attrib->returnsetting );
    fl_set_menu_item_mode( dial_attrib->returnsetting, 5,
                           FL_PUP_BOX | FL_PUP_GRAY );
    fl_set_menu_item_mode( dial_attrib->returnsetting, 6,
                           FL_PUP_BOX | FL_PUP_GRAY );
    return dial_attrib->dialattrib;
}
示例#3
0
FL_FORM *
counter_create_spec_form( void )
{
    if ( cnt_attrib )
        return cnt_attrib->counterattrib;

    cnt_attrib = create_form_counterattrib( );

    setup_how_return_menu( cnt_attrib->returnsetting );
    fl_set_menu_item_mode( cnt_attrib->returnsetting, 5,
                           FL_PUP_BOX | FL_PUP_GRAY );
    fl_set_menu_item_mode( cnt_attrib->returnsetting, 6,
                           FL_PUP_BOX | FL_PUP_GRAY );

    fl_set_counter_precision( cnt_attrib->prec, 0 );
    fl_set_counter_step( cnt_attrib->prec, 1, 2 );
    fl_set_counter_bounds( cnt_attrib->prec, 0, DBL_DIG );

    return cnt_attrib->counterattrib;
}
示例#4
0
void *
superspec_to_spec( FL_OBJECT * obj )
{
    void *v = obj->spec;
    SuperSPEC *ssp = obj->u_vdata;
    int i = 0;

    if ( ! ssp )
        return v;

    if ( obj->objclass == FL_BROWSER )
    {
        FLI_BROWSER_SPEC *sp = obj->spec;

        fl_clear_browser( obj );

        sp->h_pref = ssp->h_pref;
        sp->v_pref = ssp->v_pref;

        for ( i = 1; i <= ssp->nlines; i++ )
            fl_addto_browser( obj, ssp->content[ i ] );
    }
    else if ( obj->objclass == FL_CHOICE )
    {
        fl_clear_choice( obj );

        ( ( FLI_CHOICE_SPEC * ) obj->spec)->align = ssp->align;

        for ( i = 1; i <= ssp->nlines; i++ )
        {
            fl_addto_choice( obj, ssp->content[ i ] );
            if ( ssp->shortcut[ i ] )
                fl_set_choice_item_shortcut( obj, i, ssp->shortcut[ i ] );
            fl_set_choice_item_mode( obj, i, ssp->mode[ i ] );
        }

        if ( ssp->nlines >= ssp->int_val )
            fl_set_choice( obj, ssp->int_val );
    }
    else if ( obj->objclass == FL_MENU )
    {
        fl_clear_menu( obj );

        for ( i = 1; i <= ssp->nlines; i++ )
        {
            fl_addto_menu( obj, ssp->content[ i ] );
            if ( ssp->shortcut[ i ] )
                fl_set_menu_item_shortcut( obj, i, ssp->shortcut[ i ] );
            if ( ssp->callback[ i ] )
                fl_set_menu_item_callback( obj, i,
                               ( FL_PUP_CB ) fl_strdup( ssp->callback[ i ] ) );
            fl_set_menu_item_mode( obj, i, ssp->mode[ i ] );
            if ( ssp->mval[ i ] != i )
                fl_set_menu_item_id( obj, i, ssp->mval[ i ] );
        }
    }
    else if (    obj->objclass == FL_SLIDER
              || obj->objclass == FL_VALSLIDER
              || obj->objclass == FL_THUMBWHEEL)
    {
        FLI_SLIDER_SPEC *sp = obj->spec;

        sp->val    = ssp->val;
        sp->min    = ssp->min;
        sp->max    = ssp->max;
        sp->step   = ssp->step;
        sp->prec   = ssp->prec;
        sp->ldelta = ssp->ldelta;
        sp->rdelta = ssp->rdelta;
        sp->slsize = ssp->slsize;
    }
    else if (    ISBUTTON( obj->objclass )
              || obj->objclass == FL_PIXMAP
              || obj->objclass == FL_BITMAP )
    {
        FL_BUTTON_SPEC *sp = obj->spec;

        for ( i = 0; i < 5; i++ )
            sp->react_to[ i ] = ( ssp->mbuttons & ( 1 << i ) ) != 0;
        if ( ISBUTTON( obj->objclass ) )
            fl_set_button_mouse_buttons( obj, ssp->mbuttons );

        sp->val = ssp->int_val;

        if ( ISBUTTON( obj->objclass ) )
            fl_set_button( obj, sp->val );
    }
    else if ( obj->objclass == FL_POSITIONER )
    {
        FLI_POSITIONER_SPEC *sp = obj->spec;

        sp->xstep      = ssp->xstep;
        sp->ystep      = ssp->ystep;
        sp->xmin       = ssp->xmin;
        sp->xmax       = ssp->xmax;
        sp->xval       = ssp->xval;
        sp->ymin       = ssp->ymin;
        sp->ymax       = ssp->ymax;
        sp->yval       = ssp->yval;
    }
    else if ( obj->objclass == FL_COUNTER )
    {
        FLI_COUNTER_SPEC *sp = obj->spec;

        sp->val        = ssp->val;
        sp->sstep      = ssp->sstep;
        sp->lstep      = ssp->lstep;
        sp->min        = ssp->min;
        sp->max        = ssp->max;
        sp->prec       = ssp->prec;
    }
    else if ( obj->objclass == FL_SPINNER )
    {
        FLI_SPINNER_SPEC *sp = obj->spec;

        fl_set_spinner_value( obj, ssp->val );
        fl_set_spinner_bounds( obj, ssp->min, ssp->max );
        fl_set_spinner_step( obj, ssp->step );
        fl_set_spinner_precision( obj, ssp->prec );
        sp->orient = ssp->orient;
    }
    else if ( obj->objclass == FL_DIAL )
    {
        FLI_DIAL_SPEC *sp = obj->spec;

        sp->min       = ssp->min;
        sp->max       = ssp->max;
        sp->val       = ssp->val;
        sp->step      = ssp->step;
        sp->thetai    = ssp->thetai;
        sp->thetaf    = ssp->thetaf;
        sp->direction = ssp->direction;
    }
    else if ( obj->objclass == FL_XYPLOT )
    {
        FLI_XYPLOT_SPEC *sp = obj->spec;

        sp->xmajor         = ssp->xmajor;
        sp->xminor         = ssp->xminor;
        sp->ymajor         = ssp->ymajor;
        sp->yminor         = ssp->yminor;
        sp->xscale         = ssp->xscale;
        sp->yscale         = ssp->yscale;
        sp->xgrid          = ssp->xgrid;
        sp->ygrid          = ssp->ygrid;
        sp->xbase          = ssp->xbase;
        sp->ybase          = ssp->ybase;
        sp->grid_linestyle = ssp->grid_linestyle;
        sp->mark_active    = ssp->mark_active;
    }
    else if ( obj->objclass == FL_SCROLLBAR )
    {
        FLI_SCROLLBAR_SPEC *scbsp = obj->spec;
        FLI_SLIDER_SPEC *sp = scbsp->slider->spec;

        sp->val    = ssp->val;
        sp->min    = ssp->min;
        sp->max    = ssp->max;
        sp->prec   = ssp->prec;
        sp->step   = ssp->step;
        sp->slsize = ssp->slsize;
        sp->ldelta = ssp->ldelta;
        sp->rdelta = ssp->rdelta;
    }
    else if ( obj->objclass == FL_SLIDER )
    {
        FLI_SPINNER_SPEC *sp = obj->spec;

        ssp->val = fl_get_spinner_value( obj );
        fl_get_spinner_bounds( obj, &ssp->min, &ssp->max );
        ssp->step = fl_get_spinner_step( obj );
        ssp->prec = fl_get_spinner_precision( obj );
        ssp->orient = sp->orient;
    }
    else if ( obj->objclass == FL_INPUT )
    {
        /* Simply reset some attributes of the object to the defaults -
           this makes only sense when, during testing, text was entered
           into the input field and new we need to get rid of it */

        FLI_INPUT_SPEC *sp = obj->spec;

        sp->position = -1;
        sp->endrange = -1;
        sp->lines    = sp->ypos = 1;
        *sp->str     = '\0';
    }

    return v;
}
示例#5
0
文件: impcon.c 项目: fstltna/ImpFE
void handleServInp(int socket, void *data)
{
	int br;
	char locBuf[]="\0\0";

	if ((br=read(socket, &locBuf[0], 1)) == 1)
	{
		if (LoseNextChar)
		{
			LoseNextChar=FALSE;
			return;
		}
		strcat(&ServBuf[0], &locBuf[0]);
		/* Check for Newline */
		if (locBuf[0] == '\n')
		{
		    /* Parse it */
		    fe_parse(ServBuf);
		    ServBuf[0]='\0';
		}
		else {
			/* Check for a prompt line */
			if (DoingLogin)
			{
				if ((locBuf[0] == ':') && (ServBuf[0] == ':') &&
					(ServBuf[1] != '\0'))
				{
					fl_addto_browser_chars(fd_ImpFeMain->MainBrowser, ServBuf);
					if (strcmp(ServBuf, ":Enter player name:") == 0)
					{
						LoseNextChar=TRUE;
						if (game_player[0] != '\0')
						{
							write_str("!");
							write_str(game_player);
							write_str("\n");
							fl_addto_browser_chars(fd_ImpFeMain->MainBrowser,
												   game_player);
							fl_addto_browser_chars(fd_ImpFeMain->MainBrowser,
												   "\n");
						}
					}
					else if (strcmp(ServBuf, ":Enter player password:"******"\n");
							fl_addto_browser_chars(fd_ImpFeMain->MainBrowser,
												   game_player_pswd);
							fl_addto_browser_chars(fd_ImpFeMain->MainBrowser,
												   "\n");
						}
						DoingLogin=FALSE;
					}
					ServBuf[0]='\0';
				}
			}
		}
	}
	else
	{
		/* Remove the callback */
		fl_remove_io_callback(GameSocket, MyCond, handleServInp);
		/* Close the socket */
		close(GameSocket);
		GameSocket=-1;
		fl_set_menu_item_mode(fd_ImpFeMain->MainServerMenu,
							  MAIN_SERVER_MENU_CLOSE, FL_PUP_GREY);
		fl_set_menu_item_mode(fd_ImpFeMain->MainServerMenu,
							  MAIN_SERVER_MENU_OPEN, FL_PUP_NONE);
		fl_set_object_label(fd_ImpFeMain->StatusBox, "Offline");
		fe_puts("*** Connection to server terminated...\n");
		AtMainPrompt=FALSE;
	}
}