示例#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;
}
示例#2
0
static PyObject *
forms_deactivate_all_forms(PyObject *f, PyObject *args)
{
	fl_deactivate_all_forms();
	Py_INCREF(Py_None);
	return Py_None;
}
示例#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;
}
示例#4
0
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;
}