Exemplo n.º 1
0
void
EDFBFont::ForceFontAliasing(bool enable)
{
	if(fEngine == NULL) return;
	EAutolock <EDFBGraphicsEngine> autolock(fEngine);
	if(autolock.IsLocked() == false || fEngine->InitCheck() != E_OK) return;

	if(fForceFontAliasing != enable)
	{
		fForceFontAliasing = enable;

		DFBFontDescription fontdesc;
		fontdesc.flags = (DFBFontDescriptionFlags)(DFDESC_ATTRIBUTES | DFDESC_HEIGHT);
		fontdesc.attributes = (fForceFontAliasing ? DFFA_MONOCHROME : DFFA_NONE);
		fontdesc.height = ETK_DIRECTFONT_DEFAULT_SIZE;

		IDirectFBFont *newFont = NULL;
		fEngine->dfbDisplay->CreateFont(fEngine->dfbDisplay, fFilename, &fontdesc, &newFont);
		if(newFont)
		{
			fDFBFont->Release(fDFBFont);
			fDFBFont = newFont;

			int height = 0;
			fDFBFont->GetHeight(fDFBFont, &height);
			float sizes = (float)height;
			SetFixedSize(&sizes, 1);
		}
	}
}
Exemplo n.º 2
0
EDFBFont::EDFBFont(EDFBGraphicsEngine *dfbEngine, const char *filename)
	: EFontEngine(), fScalable(false), fForceFontAliasing(false), fFilename(NULL), fEngine(NULL)
{
	if(dfbEngine == NULL) return;

	fEngine = dfbEngine;

	EAutolock <EDFBGraphicsEngine> autolock(fEngine);
	if(autolock.IsLocked() == false || fEngine->InitCheck() != E_OK) {fEngine = NULL; return;}

	DFBFontDescription fontdesc;
	fontdesc.flags = (DFBFontDescriptionFlags)(DFDESC_ATTRIBUTES | DFDESC_HEIGHT);
	fontdesc.attributes = DFFA_NONE;
	fontdesc.height = ETK_DIRECTFONT_DEFAULT_SIZE;

	if(fEngine->dfbDisplay->CreateFont(fEngine->dfbDisplay, filename, &fontdesc, &fDFBFont) != DFB_OK)
	{
		ETK_DEBUG("[FONT]: CreateFont(%s) failed.", filename);
		fEngine = NULL;
		return;
	}

	EPath aPath(filename);
	if(aPath.Path() != NULL) fFilename = EStrdup(aPath.Path());
	SetFamily(aPath.Leaf() ? aPath.Leaf() : "DFB-Default");
	SetStyle("Regular");

	int height = 0;
	fDFBFont->GetHeight(fDFBFont, &height);
	float sizes = (float)height;
	SetFixedSize(&sizes, 1);

	SetRenderMode(E_FONT_RENDER_DIRECTLY);
}
Exemplo n.º 3
0
void TIFFRangeOptionsDialog::Control_Show( Control& sender )
{
   AdjustToContents();
   Info_Label.SetMinWidth();
   Info_Label.AdjustToContents();
   Info_Label.SetMinHeight();
   AdjustToContents();
   SetFixedSize();
}
void AdaptiveStretchCurveGraphInterface::Resize( int width, int height )
{
   m_gridBitmap = Bitmap::Null();
   m_curveBitmap = Bitmap::Null();

   GUI->CurveGraph_Control.SetFixedSize( m_width = width, m_height = height );
   SetVariableSize();
   AdjustToContents();
   SetFixedSize();

   UpdateControls();
}
Exemplo n.º 5
0
EFontFT2::EFontFT2(const EEntry *entry, eint32 faceIndex)
	: EFontEngine(), fFilename(NULL), fFaceIndex(-1), nFaces(-1), fFace(NULL), fScalable(false), fForceFontAliasing(false)
{
	EPath aPath;
	if(entry == NULL || entry->Exists() == false || entry->GetPath(&aPath) != E_OK) return;
	EString filename = aPath.Path();
#ifdef _WIN32
	filename.ReplaceAll("/", "\\");
#endif

	SetRenderMode(E_FONT_RENDER_PIXMAP);

	EAutolock <ELocker> autolock(&etk_ft2_font_locker);
	if(!_etk_ft2_initialized_) return;

	FT_Error error = FT_New_Face(_etk_ft2_library_, filename.String(), faceIndex, &fFace);
	if(error || !fFace)
	{
		ETK_DEBUG("[FONT]: %s --- CAN NOT load face[%s:%d].", __PRETTY_FUNCTION__, aPath.Path(), faceIndex);
		return;
	}

	if(FT_Select_Charmap(fFace, FT_ENCODING_UNICODE))
	{
//		ETK_DEBUG("[FONT]: %s --- font[%s] don't support ENCODING_UNICODE.", __PRETTY_FUNCTION__, aPath.Path());

		if(FT_Select_Charmap(fFace, FT_ENCODING_NONE))
		{
//			ETK_WARNING("[FONT]: %s --- font[%s] don't support unicode at all.", __PRETTY_FUNCTION__, aPath.Path());
			FT_Done_Face(fFace);
			fFace = NULL;
			return;
		}
	}

	fFilename = EStrdup(filename.String());
	fFaceIndex = faceIndex;
	nFaces = fFace->num_faces;

	EString family = fFace->family_name;
	if(family.Length() <= 0)
	{
		family = aPath.Leaf();
		eint32 cFound;
		if((cFound = family.FindFirst('.')) >= 0) family.Remove(cFound, -1);
		if(family.Length() < 0) family = "Unknown";
	}
	SetFamily(family.String());

	EString style = fFace->style_name;
	if(style.Length() <= 0)
	{
		if((fFace->style_flags & FT_STYLE_FLAG_BOLD) && (fFace->style_flags & FT_STYLE_FLAG_ITALIC))
			style = "Bold Italic";
		else if(fFace->style_flags & FT_STYLE_FLAG_BOLD)
			style = "Bold";
		else if(fFace->style_flags & FT_STYLE_FLAG_ITALIC)
			style = "Italic";
		else
			style = "Regular";
	}
	SetStyle(style.String());

	if(FT_IS_SCALABLE(fFace)) fScalable = true;

	if(fFace->num_fixed_sizes > 0)
	{
		float *sizes = new float[(int)fFace->num_fixed_sizes];
		for(int i = 0; i < fFace->num_fixed_sizes; i++) sizes[i] = (float)(fFace->available_sizes[i].height);
		SetFixedSize(sizes, (eint32)fFace->num_fixed_sizes);
		delete[] sizes;
	}

	FT_Done_Face(fFace);
	fFace = NULL;
}
Exemplo n.º 6
0
JPEG2000OptionsDialog::JPEG2000OptionsDialog(
    const ImageOptions& o, const JPEG2000ImageOptions& t, bool isJPC ) :
    Dialog(), options(), jp2Options()
{
    int labelWidth1 = Font().Width( String( "Decompression Layers:" ) + 'M' );

    Lossless_RadioButton.SetText( "Lossless" );
    Lossless_RadioButton.SetToolTip( "Nondestructive compression" );
    Lossless_RadioButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::CompressionMode_Click, *this );

    Lossy_RadioButton.SetText( "Lossy" );
    Lossy_RadioButton.SetToolTip( "Destructive compression" );
    Lossy_RadioButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::CompressionMode_Click, *this );

    CompressionRate_NumericControl.label.SetText( "Compression Rate:" );
    CompressionRate_NumericControl.label.SetMinWidth( labelWidth1 );
    CompressionRate_NumericControl.slider.SetScaledMinWidth( 125 );
    CompressionRate_NumericControl.slider.SetRange( 1, 999 );
    CompressionRate_NumericControl.SetReal( true );
    CompressionRate_NumericControl.SetRange( 0.01, 0.99 );
    CompressionRate_NumericControl.SetPrecision( 2 );
    CompressionRate_NumericControl.SetToolTip( "Compression factor: compressed/original size" );

    UnsignedSample_CheckBox.SetText( "Unsigned Samples" );
    UnsignedSample_CheckBox.SetToolTip( "Write unsigned sample values" );

    Compression_Sizer.SetMargin( 6 );
    Compression_Sizer.Add( Lossless_RadioButton );
    Compression_Sizer.AddSpacing( 6 );
    Compression_Sizer.Add( Lossy_RadioButton );
    Compression_Sizer.Add( CompressionRate_NumericControl );
    Compression_Sizer.AddSpacing( 8 );
    Compression_Sizer.Add( UnsignedSample_CheckBox );

    Compression_GroupBox.SetTitle( "Compression" );
    Compression_GroupBox.SetSizer( Compression_Sizer );
    Compression_GroupBox.AdjustToContents();
    Compression_GroupBox.SetMinSize();

    //

    DecompressionLayers_Label.SetText( "Decompression Layers:" );
    DecompressionLayers_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
    DecompressionLayers_Label.SetMinWidth( labelWidth1 );

    DecompressionLayers_SpinBox.SetRange( 2, 10 );
    DecompressionLayers_SpinBox.SetMinWidth( Font().Width( "000000" ) );

    DecompressionLayers_Sizer.SetSpacing( 6 );
    DecompressionLayers_Sizer.Add( DecompressionLayers_Label );
    DecompressionLayers_Sizer.Add( DecompressionLayers_SpinBox );
    DecompressionLayers_Sizer.AddStretch();

    ProgressionOrder_Label.SetText( "Progression Order:" );
    ProgressionOrder_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
    ProgressionOrder_Label.SetMinWidth( labelWidth1 );

    ProgressionOrder_ComboBox.AddItem( "LRCP: Layer-Resolution-Component-Position" );
    ProgressionOrder_ComboBox.AddItem( "RLCP: Resolution-Layer-Component-Position" );
    ProgressionOrder_ComboBox.AddItem( "RPCL: Resolution-Position-Component-Layer" );
    ProgressionOrder_ComboBox.AddItem( "PCRL: Position-Component-Resolution-Layer" );
    ProgressionOrder_ComboBox.AddItem( "CPRL: Component-Position-Resolution-Layer" );

    ProgressionOrder_Sizer.SetSpacing( 6 );
    ProgressionOrder_Sizer.Add( ProgressionOrder_Label );
    ProgressionOrder_Sizer.Add( ProgressionOrder_ComboBox, 100 );

    Progressive_Sizer.SetMargin( 6 );
    Progressive_Sizer.SetSpacing( 6 );
    Progressive_Sizer.Add( DecompressionLayers_Sizer );
    Progressive_Sizer.Add( ProgressionOrder_Sizer );

    Progressive_GroupBox.SetTitle( "Progressive Decoding" );
    Progressive_GroupBox.EnableTitleCheckBox();
    Progressive_GroupBox.SetSizer( Progressive_Sizer );
    Progressive_GroupBox.AdjustToContents();
    Progressive_GroupBox.SetMinSize();

    //

    TileWidth_NumericEdit.label.SetText( "Tile Width:" );
    TileWidth_NumericEdit.label.SetMinWidth( labelWidth1 );
    TileWidth_NumericEdit.SetInteger();
    TileWidth_NumericEdit.SetRange( 16, 8192 );

    TileHeight_NumericEdit.label.SetText( "Tile Height:" );
    TileHeight_NumericEdit.SetInteger();
    TileHeight_NumericEdit.SetRange( 16, 8192 );

    Tiled_Sizer.SetMargin( 6 );
    Tiled_Sizer.Add( TileWidth_NumericEdit );
    Tiled_Sizer.AddStretch( 25 );
    Tiled_Sizer.Add( TileHeight_NumericEdit );
    Tiled_Sizer.AddStretch( 75 );

    Tiled_GroupBox.SetTitle( "Tiled Image" );
    Tiled_GroupBox.EnableTitleCheckBox();
    Tiled_GroupBox.SetSizer( Tiled_Sizer );
    Tiled_GroupBox.AdjustToContents();
    Tiled_GroupBox.SetMinSize();

    //

    ICCProfile_CheckBox.SetText( "ICC Profile" );
    ICCProfile_CheckBox.SetToolTip( "Embed an ICC profile" );

    Resolution_CheckBox.SetText( "Resolution" );
    Resolution_CheckBox.SetToolTip( "Embed image resolution information" );

    EmbeddedData_Sizer.SetMargin( 6 );
    EmbeddedData_Sizer.Add( ICCProfile_CheckBox );
    EmbeddedData_Sizer.Add( Resolution_CheckBox );

    EmbeddedData_GroupBox.SetTitle( "Embedded Data" );
    EmbeddedData_GroupBox.SetSizer( EmbeddedData_Sizer );
    EmbeddedData_GroupBox.AdjustToContents();
    EmbeddedData_GroupBox.SetMinSize();

    if ( isJPC )
        EmbeddedData_GroupBox.Hide();

    //

    OK_PushButton.SetText( "OK" );
    OK_PushButton.SetDefault();
    OK_PushButton.SetCursor( StdCursor::Checkmark );
    OK_PushButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::Button_Click, *this );

    Cancel_PushButton.SetText( "Cancel" );
    Cancel_PushButton.SetCursor( StdCursor::Crossmark );
    Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::Button_Click, *this );

    BottomSection_Sizer.SetSpacing( 8 );
    BottomSection_Sizer.AddStretch();
    BottomSection_Sizer.Add( OK_PushButton );
    BottomSection_Sizer.Add( Cancel_PushButton );

    //

    Global_Sizer.SetMargin( 8 );
    Global_Sizer.SetSpacing( 8 );
    Global_Sizer.Add( Compression_GroupBox );
    Global_Sizer.Add( Progressive_GroupBox );
    Global_Sizer.Add( Tiled_GroupBox );
    Global_Sizer.Add( EmbeddedData_GroupBox );
    Global_Sizer.AddSpacing( 8 );
    Global_Sizer.Add( BottomSection_Sizer );

    SetSizer( Global_Sizer );
    AdjustToContents();
    SetFixedSize();

    SetWindowTitle( isJPC ? "JPEG2000 Code Stream Options" : "JPEG2000 JP2 Options" );

    OnReturn( (pcl::Dialog::return_event_handler)&JPEG2000OptionsDialog::Dialog_Return, *this );

    options = o;
    jp2Options = t;

    Lossless_RadioButton.SetChecked( !jp2Options.lossyCompression );

    Lossy_RadioButton.SetChecked( jp2Options.lossyCompression );

    CompressionRate_NumericControl.Enable( jp2Options.lossyCompression );
    CompressionRate_NumericControl.SetValue( jp2Options.compressionRate );

    UnsignedSample_CheckBox.SetChecked( !jp2Options.signedSample );

    Progressive_GroupBox.SetChecked( jp2Options.numberOfLayers > 1 );

    DecompressionLayers_SpinBox.SetValue( jp2Options.numberOfLayers );

    ProgressionOrder_ComboBox.SetCurrentItem( jp2Options.progressionOrder );

    Tiled_GroupBox.SetChecked( jp2Options.tiledImage );

    TileWidth_NumericEdit.SetValue( jp2Options.tileWidth );
    TileHeight_NumericEdit.SetValue( jp2Options.tileHeight );

    ICCProfile_CheckBox.SetChecked( options.embedICCProfile );
    Resolution_CheckBox.SetChecked( jp2Options.resolutionData );
}
FileDataCachePreferencesDialog::FileDataCachePreferencesDialog( FileDataCache* theCache ) :
   Dialog(),
   cache( theCache )
{
   int labelWidth1 = Font().Width( String( "Cache duration (days):" ) + 'T' );
   int ui4 = LogicalPixelsToPhysical( 4 );

   //

   const char* persistentCacheToolTip =
   "<p>Use a persistent file cache to store statistical data and noise "
   "estimates of all integrated images. A persistent cache is kept across "
   "PixInsight sessions. If you disable this option, the file cache will "
   "still be used, but only during the current session; as soon as you exit "
   "the PixInsight Core application, all the cached information will be lost. "
   "With the persistent cache option enabled, all cache items will be stored "
   "and will be available the next time you run PixInsight.</p>"
   "<p>The cache greatly improves performance when the same images are being "
   "integrated several times; for example to find optimal pixel rejection "
   "parameters, or to check different HDR composition thresholds.</p>";

   PersistentCache_CheckBox.SetText( "Persistent file cache" );
   PersistentCache_CheckBox.SetToolTip( persistentCacheToolTip );
   PersistentCache_CheckBox.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this );

   PersistentCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   PersistentCache_Sizer.Add( PersistentCache_CheckBox );
   PersistentCache_Sizer.AddStretch();

   //

   const char* cacheDurationToolTip =
   "<p>Persistent file cache items can be automatically removed after a "
   "specified period without accessing the corresponding files. Enter the "
   "desired period in days, or specify zero to disable this <i>automatic purge</i> "
   "feature, so that existing file cache items will never be removed "
   "automatically.</p>";

   CacheDuration_Label.SetText( "Cache duration (days):" );
   CacheDuration_Label.SetMinWidth( labelWidth1 );
   CacheDuration_Label.SetToolTip( cacheDurationToolTip );
   CacheDuration_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   CacheDuration_SpinBox.SetRange( 0, 90 );
   CacheDuration_SpinBox.SetMinimumValueText( "<Forever>" );
   CacheDuration_SpinBox.SetToolTip( cacheDurationToolTip );
   CacheDuration_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&FileDataCachePreferencesDialog::SpinBox_ValueUpdated, *this );

   CacheDuration_Sizer.SetSpacing( 4 );
   CacheDuration_Sizer.Add( CacheDuration_Label );
   CacheDuration_Sizer.Add( CacheDuration_SpinBox );
   CacheDuration_Sizer.AddStretch();

   //

   ClearCache_PushButton.SetText( "Clear Memory Cache Now" );
   ClearCache_PushButton.SetToolTip(
      "Click this button to remove all cache items currently stored in volatile RAM." );
   ClearCache_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this );

   ClearCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   ClearCache_Sizer.Add( ClearCache_PushButton, 100 );

   //

   PurgeCache_PushButton.SetText( "Purge Persistent Cache Now" );
   PurgeCache_PushButton.SetToolTip(
      "Click this button to remove all stored persistent cache items." );
   PurgeCache_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this );

   PurgeCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   PurgeCache_Sizer.Add( PurgeCache_PushButton, 100 );

   //

   OK_PushButton.SetText( "OK" );
   OK_PushButton.SetDefault();
   OK_PushButton.SetCursor( StdCursor::Checkmark );
   OK_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this );

   Cancel_PushButton.SetText( "Cancel" );
   Cancel_PushButton.SetCursor( StdCursor::Crossmark );
   Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this );

   Buttons_Sizer.SetSpacing( 8 );
   Buttons_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   Buttons_Sizer.Add( OK_PushButton );
   Buttons_Sizer.Add( Cancel_PushButton );

   //

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( PersistentCache_Sizer );
   Global_Sizer.Add( CacheDuration_Sizer );
   Global_Sizer.Add( ClearCache_Sizer );
   Global_Sizer.Add( PurgeCache_Sizer );
   Global_Sizer.AddSpacing( 4 );
   Global_Sizer.Add( Buttons_Sizer );

   SetSizer( Global_Sizer );
   AdjustToContents();
   SetFixedSize();

   //

   SetWindowTitle( cache->CacheName() + " Preferences" );

   OnReturn( (pcl::Dialog::return_event_handler)&FileDataCachePreferencesDialog::Dialog_Return, *this );

   cacheEnabled = cache->IsEnabled();
   cacheDuration = cache->Duration();

   Update();
}
HistogramAutoClipSetupDialog::HistogramAutoClipSetupDialog() : Dialog()
{
   pcl::Font fnt = Font();
   int labelWidth = fnt.Width( String( '0', 10 ) );

   m_shadowsAutoClipping = TheHistogramTransformationInterface->m_shadowsAutoClipping;
   m_highlightsAutoClipping = TheHistogramTransformationInterface->m_highlightsAutoClipping;

   ShadowsAmount_NumericControl.label.SetText( "Shadows:" );
   ShadowsAmount_NumericControl.label.SetFixedWidth( labelWidth );
   ShadowsAmount_NumericControl.slider.SetScaledFixedWidth( 250 );
   ShadowsAmount_NumericControl.slider.SetRange( 0, 200 );
   ShadowsAmount_NumericControl.SetReal();
   ShadowsAmount_NumericControl.SetRange( 0.0, 100.0 );
   ShadowsAmount_NumericControl.SetPrecision( 3 );
   ShadowsAmount_NumericControl.SetToolTip( "Shadows auto clipping amount" );
   ShadowsAmount_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&HistogramAutoClipSetupDialog::__ClippingAmount_ValueUpdated, *this );

   HighlightsAmount_NumericControl.label.SetText( "Highlights:" );
   HighlightsAmount_NumericControl.label.SetFixedWidth( labelWidth );
   HighlightsAmount_NumericControl.slider.SetScaledFixedWidth( 250 );
   HighlightsAmount_NumericControl.slider.SetRange( 0, 200 );
   HighlightsAmount_NumericControl.SetReal();
   HighlightsAmount_NumericControl.SetRange( 0.0, 100.0 );
   HighlightsAmount_NumericControl.SetPrecision( 3 );
   HighlightsAmount_NumericControl.SetToolTip( "Highlights auto clipping amount" );
   HighlightsAmount_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&HistogramAutoClipSetupDialog::__ClippingAmount_ValueUpdated, *this );

   ClippingParameters_Sizer.SetMargin( 8 );
   ClippingParameters_Sizer.SetSpacing( 6 );
   ClippingParameters_Sizer.Add( ShadowsAmount_NumericControl );
   ClippingParameters_Sizer.Add( HighlightsAmount_NumericControl );

   ClippingParameters_GroupBox.SetTitle( "Clipping Amounts (Percentage of total pixels)" );
   ClippingParameters_GroupBox.SetSizer( ClippingParameters_Sizer );

   OK_PushButton.SetText( "OK" );
   OK_PushButton.SetDefault();
   OK_PushButton.SetCursor( StdCursor::Checkmark );
   OK_PushButton.OnClick( (Button::click_event_handler)&HistogramAutoClipSetupDialog::__Button_Click, *this );

   Cancel_PushButton.SetText( "Cancel" );
   Cancel_PushButton.SetCursor( StdCursor::Crossmark );
   Cancel_PushButton.OnClick( (Button::click_event_handler)&HistogramAutoClipSetupDialog::__Button_Click, *this );

   Buttons_Sizer.SetSpacing( 8 );
   Buttons_Sizer.AddStretch();
   Buttons_Sizer.Add( OK_PushButton );
   Buttons_Sizer.Add( Cancel_PushButton );

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( ClippingParameters_GroupBox );
   Global_Sizer.AddSpacing( 4 );
   Global_Sizer.Add( Buttons_Sizer );

   SetSizer( Global_Sizer );
   AdjustToContents();
   SetFixedSize();

   SetWindowTitle( "Histogram Auto Clipping Setup" );

   OnReturn( (Dialog::return_event_handler)&HistogramAutoClipSetupDialog::__Dialog_Return, *this );

   ShadowsAmount_NumericControl.SetValue( 100*m_shadowsAutoClipping );
   HighlightsAmount_NumericControl.SetValue( 100*m_highlightsAutoClipping );

   Update();
}
DynamicCropPreferencesDialog::DynamicCropPreferencesDialog() : Dialog()
{
   savedColor = fillColor;

   pcl::Font fnt = Font();
   int buttonWidth = fnt.Width( String( "Cancel" ) + String( 'M', 4 ) );

   Black_RadioButton.SetText( "Black" );
   Black_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );

   White_RadioButton.SetText( "White" );
   White_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );

   Alpha_Label.SetText( "Alpha Blend:" );
   Alpha_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   Alpha_Slider.SetRange( 0, 255 );
   Alpha_Slider.SetStepSize( 10 );
   Alpha_Slider.SetTickFrequency( 10 );
   Alpha_Slider.SetTickStyle( TickStyle::NoTicks );
   Alpha_Slider.SetScaledMinWidth( 265 );
   Alpha_Slider.OnValueUpdated( (Slider::value_event_handler)&DynamicCropPreferencesDialog::Slider_ValueUpdated, *this );

   FillColor_Sizer.SetMargin( 8 );
   FillColor_Sizer.SetSpacing( 6 );
   FillColor_Sizer.Add( Black_RadioButton );
   FillColor_Sizer.Add( White_RadioButton );
   FillColor_Sizer.AddSpacing( 10 );
   FillColor_Sizer.Add( Alpha_Label );
   FillColor_Sizer.Add( Alpha_Slider );

   FillColor_GroupBox.SetTitle( "Fill Color" );
   FillColor_GroupBox.SetSizer( FillColor_Sizer );

   OK_PushButton.SetText( "OK" );
   OK_PushButton.SetMinWidth( buttonWidth );
   OK_PushButton.SetDefault();
   OK_PushButton.SetCursor( StdCursor::Checkmark );
   OK_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );

   Cancel_PushButton.SetText( "Cancel" );
   Cancel_PushButton.SetMinWidth( buttonWidth );
   Cancel_PushButton.SetCursor( StdCursor::Crossmark );
   Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );

   Buttons_Sizer.SetSpacing( 8 );
   Buttons_Sizer.AddStretch();
   Buttons_Sizer.Add( OK_PushButton );
   Buttons_Sizer.Add( Cancel_PushButton );

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( FillColor_GroupBox );
   Global_Sizer.AddSpacing( 4 );
   Global_Sizer.Add( Buttons_Sizer );

   SetSizer( Global_Sizer );
   AdjustToContents();
   SetFixedSize();

   SetWindowTitle( "DynamicCrop Interface Preferences" );

   OnReturn( (pcl::Dialog::return_event_handler)&DynamicCropPreferencesDialog::Dialog_Return, *this );

   Black_RadioButton.SetChecked( Red( fillColor ) == 0 );
   White_RadioButton.SetChecked( Red( fillColor ) != 0 );

   Alpha_Slider.SetValue( Alpha( fillColor ) );

   Update();
}