Ejemplo n.º 1
0
void on_txt_save(Fl_Widget* w,void* data)
{
	Fl_Native_File_Chooser c;
	c.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE);
	c.title("Сохранить");
	c.preset_file("result.txt");
	
	c.filter("Text (*.txt)");
	c.show();
	txt_out->buffer()->savefile(c.filename());
}
Ejemplo n.º 2
0
void DialogMain::loadImage()
{
    if ( cbUseThreshold != NULL )
    {
        if ( cbUseThreshold->value() > 0 )
        {
            cbUseThreshold->value( 0 );
            thresholdControl();
        }
    }

    Fl_Native_File_Chooser nFC;

    nFC.title( "Choose a RAW image file to open" );
    nFC.type( Fl_Native_File_Chooser::BROWSE_FILE );
    nFC.filter( " RAW Image\t*.raw\n" );
    nFC.directory( currentPath );
    nFC.preset_file(NULL);

    int retVal = nFC.show();
    if ( retVal == 0 )
    {
        if ( strlen(nFC.filename()) == 0 )
        {
            boxImageFileName->label(" ");
            fl_alert("No image selected.");
            return;
        }

        if ( dentalRAW == NULL )
        {
            dentalRAW = new DentalRAWReader();
        }

        if ( dentalRAW != NULL )
        {
            fl_cursor( FL_CURSOR_WAIT, 0, 0 );

#if( UNICODE && DEBUG )
            if ( sizeof(TCHAR) != 2 )
            {
                fl_alert("What's wrong? why it is not unicode ?");
                return;
            }
#endif

            _TSTRING refPath =  _TCM2W( nFC.filename() );

            if ( dentalRAW->Load( refPath.c_str() ) == true )
            {
                rawimagefilename = nFC.filename();

                boxImageFileName->label( rawimagefilename.c_str() );
                boxImageFileName->redraw();
            }
            else
            {
                fl_alert("Failed to load RAW image:\n%s", nFC.filename() );
            }

            if ( dentalRAW->GetAnalisysReport( weight_report ) == false )
            {
                memset( &weight_report, 0, sizeof (weight_report) );
            }

            if( vsThresholdMin != NULL )
            {
                vsThresholdMin->range( 0.0f, float( dentalRAW->getMaximumLevel() ) - 1.0f );
                vsThresholdMin->value( 0 );
            }

            if( vsThresholdMax != NULL )
            {
                vsThresholdMax->range( 1.0f, float( dentalRAW->getMaximumLevel() ) );
                vsThresholdMax->value( dentalRAW->getMaximumLevel() );
            }

            updateImageInfo();
            drawHistogram();
            importRAWimage();

            fl_cursor( FL_CURSOR_DEFAULT, 0, 0 );
        }
    }
}