/** 
 * This script is being run when a skin is selected.
 * The script produces a custom user interface with a lot of goodies.
 */
import se.datadosen.component.*;
import se.datadosen.util.*;
import se.datadosen.jalbum.event.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;

engine.processBeanShellFile(new File(programDirectory, "includes/printing.bsh"));

// Controls that are to be imported into JAlbum as variables
ControlPanel ui = new ControlPanel() {
	JCheckBox includeKeyboardSupport = new JCheckBox("Include Keyboard Support");
	JCheckBox chooseRandomIconForFolder = new JCheckBox("Choose Random Icon For Folders");
	JCheckBox includeJumpToPageAction = new JCheckBox("Include Jump-To-Page Facility");
	JCheckBox includeFirstLastPageActions = new JCheckBox("Include First & Last Page Actions");
	JCheckBox showAudioConsole = new JCheckBox("Show Background Voice Annotations Console");
	JCheckBox includeSaveProtection = new JCheckBox("Include Image Save-Protection");
	JCheckBox includeNavigationHelpTips = new JCheckBox("Include Navigation Tips (mostly shortcuts)");
	JComboBox contextHelpStyle = new JComboBox( new Object[]
		{ "None", "ToolTip", "StatusBar", "Both" }
	);
	JComboBox navigationBarVerticalLocation = new JComboBox( new Object[]
		{ "", "Top", "Bottom", "Both" }
	);
	JTextField externalHomePath = new JTextField(20);
	JTextField title = new JTextField(20);
	JComboBox iconSet = new JComboBox();
	JTextField copyright = new JTextField(20);
	JComboBox language = new JComboBox();
	JCheckBox prefetchSiblingSlides = new JCheckBox("Prefetch/Preload Sibling Slides");

	JComboBox printing = getPrintingComboBox();

	JCheckBox includeMoveForwardFacility = new JCheckBox("Include Move-Forward Facility");

	JCheckBox includeSlideShow = new JCheckBox("Include Slide Show");
	JCheckBox cyclicSlideShow = new JCheckBox("Cyclic Slide Show");
	JTextField slideShowDelay = new JTextField(2);
	JTextField slideShowCommentDelay = new JTextField(2);

	JCheckBox includeSlidePageThumbnails = new JCheckBox("Include Thumbnails");
	JTextField slidePageThumbnailCount = new JTextField(3);
	JTextField slidePageThumbnailRatio = new JTextField(3);
	JComboBox movieSlideDimension = new JComboBox(new Object[]
		{ "", "160x120", "320x240", "640x480", "800x600", "1024x768" }
	);

	JComboBox slideCommentHorizontalAlign = new JComboBox(new Object[]
		{ "", "Left", "Center", "Right" }
	);
	JComboBox slideCommentVerticalPosition = new JComboBox(new Object[]
		{ "", "TOP_ABOVE_NAVIGATION", "TOP_UNDER_NAVIGATION", "BOTTOM" }
	);
	JTextField slideCommentPrefix = new JTextField(20);
	JTextField slideCommentPostfix = new JTextField(20);

	JComboBox metadataDisplayMode = new JComboBox(new Object[]
		{ "", "all", "verbose", "custom", "iptc-only" }
	);
	JTextArea customMetadataFields = new JTextArea(4, 20);

	JCheckBox includeBlendingEffectOnSlides = new JCheckBox("Include Page Blending/Fading");
	JCheckBox includeBlendingEffectOnIndexes = new JCheckBox("Include Page Blending/Fading");

	JComboBox borderType = new JComboBox();
	JComboBox thumbnailBorderType = new JComboBox();
	JComboBox folderThumbnailBorderType = new JComboBox();

	JTextField borderSize = new JTextField(3);
	JTextField thumbnailBorderSize = new JTextField(3);
	JTextField folderThumbnailBorderSize = new JTextField(3);

	JColorSelector borderColor = new JColorSelector("Border Color");
	JColorSelector thumbnailBorderColor = new JColorSelector("Thumbnail Border Color");
	JColorSelector folderThumbnailBorderColor = new JColorSelector("Folder Thumbnail Border Color");

	JTextField thumbnailTooltipContent = new JTextField(20);
	JTextField thumbnailCaptionContent = new JTextField(20);
	JTextField folderTooltipContent = new JTextField(20);
	JTextField folderCaptionContent = new JTextField(20);
	JTextField slideCaptionContent = new JTextField(20);

	/////////////// Filters
	JCheckBox keepFiltersDefinedOutsideFMTabs = new JCheckBox("Keep filters defined outside of Filter Management Tabs");

	JCheckBox includeFixedShapeFilterOnThumbnails = new JCheckBox("Crop thumbs to fixed size");
	JCheckBox prescaleFixedShapeFilterOnThumbnails = new JCheckBox("Prescale");
	JCheckBox includeFixedShapeFilterOnSlides = new JCheckBox("Crop slides to fixed size");
	JCheckBox prescaleFixedShapeFilterOnSlides = new JCheckBox("Prescale");

	JCheckBox includeGrayScaleFilterOnThumbnails = new JCheckBox("Grayscale thumbs");
	JCheckBox includeGrayScaleFilterOnSlides = new JCheckBox("Grayscale slides");

	JCheckBox includeZoomFilterOnThumbnails = new JCheckBox("Thumbnails zoom");
	JCheckBox prescaleZoomFilterOnThumbnails = new JCheckBox("Prescale");
	JTextField zoomFilterPercentOnThumbnails = new JTextField(2);
	JCheckBox includeZoomFilterOnSlides = new JCheckBox("Slides zoom");
	JCheckBox prescaleZoomFilterOnSlides = new JCheckBox("Prescale");
	JTextField zoomFilterPercentOnSlides = new JTextField(2);

	JCheckBox includeLogoFilterOnThumbnails = new JCheckBox("Logo on thumbs");
	JCheckBox prescaleLogoFilterOnThumbnails = new JCheckBox("Prescale");
	JTextField logoFilterSourceOnThumbnails = new JTextField(15);
	JTextField logoFilterMarginOnThumbnails = new JTextField(2);
	JTextField logoFilterHorizontalOffsetOnThumbnails = new JTextField(2);
	JTextField logoFilterVerticalOffsetOnThumbnails = new JTextField(2);
	JComboBox logoFilterHorizontalAlignOnThumbnails = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox logoFilterVerticalAlignOnThumbnails = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);
	JCheckBox includeLogoFilterOnSlides = new JCheckBox("Logo on slides");
	JCheckBox prescaleLogoFilterOnSlides = new JCheckBox("Prescale");
	JTextField logoFilterSourceOnSlides = new JTextField(15);
	JTextField logoFilterMarginOnSlides = new JTextField(2);
	JTextField logoFilterHorizontalOffsetOnSlides = new JTextField(2);
	JTextField logoFilterVerticalOffsetOnSlides = new JTextField(2);
	JComboBox logoFilterHorizontalAlignOnSlides = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox logoFilterVerticalAlignOnSlides = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);

	JCheckBox includeTextFilterOnThumbnails = new JCheckBox("Text on thumbs");
	JCheckBox prescaleTextFilterOnThumbnails = new JCheckBox("Prescale");
	JTextField textFilterTextOnThumbnails = new JTextField(15);
	JComboBox textFilterFontFaceOnThumbnails = new JComboBox();
	JComboBox textFilterFontStyleOnThumbnails = new JComboBox( new Object[]
		{"plain", "bold", "italic", "bolditalic"}
	);
	JTextField textFilterFontSizeOnThumbnails = new JTextField(2);
	JColorSelector textFilterColorOnThumbnails = new JColorSelector("Text Color");
	JCheckBox textFilterAntiAliasOnThumbnails = new JCheckBox("Anti-alias");
	JTextField textFilterMarginOnThumbnails = new JTextField(2);
	JTextField textFilterHorizontalOffsetOnThumbnails = new JTextField(2);
	JTextField textFilterVerticalOffsetOnThumbnails = new JTextField(2);
	JComboBox textFilterHorizontalAlignOnThumbnails = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox textFilterVerticalAlignOnThumbnails = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);
	JCheckBox includeTextFilterOnSlides = new JCheckBox("Text on slides");
	JCheckBox prescaleTextFilterOnSlides = new JCheckBox("Prescale");
	JTextField textFilterTextOnSlides = new JTextField(15);
	JComboBox textFilterFontFaceOnSlides = new JComboBox();
	JComboBox textFilterFontStyleOnSlides = new JComboBox( new Object[]
		{"plain", "bold", "italic", "bolditalic"}
	);
	JTextField textFilterFontSizeOnSlides = new JTextField(2);
	JColorSelector textFilterColorOnSlides = new JColorSelector("Text Color");
	JCheckBox textFilterAntiAliasOnSlides = new JCheckBox("Anti-alias");
	JTextField textFilterMarginOnSlides = new JTextField(2);
	JTextField textFilterHorizontalOffsetOnSlides = new JTextField(2);
	JTextField textFilterVerticalOffsetOnSlides = new JTextField(2);
	JComboBox textFilterHorizontalAlignOnSlides = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox textFilterVerticalAlignOnSlides = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);

	JCheckBox includeShadowTextFilterOnThumbnails = new JCheckBox("Shadow Text on thumbs");
	JCheckBox prescaleShadowTextFilterOnThumbnails = new JCheckBox("Prescale");
	JTextField shadowTextFilterTextOnThumbnails = new JTextField(15);
	JComboBox shadowTextFilterFontFaceOnThumbnails = new JComboBox();
	JComboBox shadowTextFilterFontStyleOnThumbnails = new JComboBox( new Object[]
		{"plain", "bold", "italic", "bolditalic"}
	);
	JTextField shadowTextFilterFontSizeOnThumbnails = new JTextField(2);
	JColorSelector shadowTextFilterTextColorOnThumbnails = new JColorSelector("Text Color");
	JColorSelector shadowTextFilterShadowColorOnThumbnails = new JColorSelector("Shadow Color");
	JTextField shadowTextFilterShadowDistanceOnThumbnails = new JTextField(2);
	JCheckBox shadowTextFilterAntiAliasOnThumbnails = new JCheckBox("Anti-alias");
	JTextField shadowTextFilterMarginOnThumbnails = new JTextField(2);
	JTextField shadowTextFilterHorizontalOffsetOnThumbnails = new JTextField(2);
	JTextField shadowTextFilterVerticalOffsetOnThumbnails = new JTextField(2);
	JComboBox shadowTextFilterHorizontalAlignOnThumbnails = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox shadowTextFilterVerticalAlignOnThumbnails = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);
	JCheckBox includeShadowTextFilterOnSlides = new JCheckBox("Shadow Text on slides");
	JCheckBox prescaleShadowTextFilterOnSlides = new JCheckBox("Prescale");
	JTextField shadowTextFilterTextOnSlides = new JTextField(15);
	JComboBox shadowTextFilterFontFaceOnSlides = new JComboBox();
	JComboBox shadowTextFilterFontStyleOnSlides = new JComboBox( new Object[]
		{"plain", "bold", "italic", "bolditalic"}
	);
	JTextField shadowTextFilterFontSizeOnSlides = new JTextField(2);
	JColorSelector shadowTextFilterTextColorOnSlides = new JColorSelector("Text Color");
	JColorSelector shadowTextFilterShadowColorOnSlides = new JColorSelector("Shadow Color");
	JTextField shadowTextFilterShadowDistanceOnSlides = new JTextField(2);
	JCheckBox shadowTextFilterAntiAliasOnSlides = new JCheckBox("Anti-alias");
	JTextField shadowTextFilterMarginOnSlides = new JTextField(2);
	JTextField shadowTextFilterHorizontalOffsetOnSlides = new JTextField(2);
	JTextField shadowTextFilterVerticalOffsetOnSlides = new JTextField(2);
	JComboBox shadowTextFilterHorizontalAlignOnSlides = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox shadowTextFilterVerticalAlignOnSlides = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);

	JCheckBox includeWatermarkTextFilterOnThumbnails = new JCheckBox("Watermark Text on thumbs");
	JCheckBox prescaleWatermarkTextFilterOnThumbnails = new JCheckBox("Prescale");
	JTextField watermarkTextFilterTextOnThumbnails = new JTextField(15);
	JComboBox watermarkTextFilterFontFaceOnThumbnails = new JComboBox();
	JComboBox watermarkTextFilterFontStyleOnThumbnails = new JComboBox( new Object[]
		{"plain", "bold", "italic", "bolditalic"}
	);
	JTextField watermarkTextFilterFontSizeOnThumbnails = new JTextField(2);
	JColorSelector watermarkTextFilterColorOnThumbnails = new JColorSelector("Text Color");
	JCheckBox watermarkTextFilterAntiAliasOnThumbnails = new JCheckBox("Anti-alias");
	JTextField watermarkTextFilterMarginOnThumbnails = new JTextField(2);
	JTextField watermarkTextFilterHorizontalOffsetOnThumbnails = new JTextField(2);
	JTextField watermarkTextFilterVerticalOffsetOnThumbnails = new JTextField(2);
	JComboBox watermarkTextFilterHorizontalAlignOnThumbnails = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox watermarkTextFilterVerticalAlignOnThumbnails = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);
	JTextField watermarkTextFilterStrengthPercentOnThumbnails = new JTextField(2);
	JCheckBox includeWatermarkTextFilterOnSlides = new JCheckBox("Watermark Text on slides");
	JCheckBox prescaleWatermarkTextFilterOnSlides = new JCheckBox("Prescale");
	JTextField watermarkTextFilterTextOnSlides = new JTextField(15);
	JComboBox watermarkTextFilterFontFaceOnSlides = new JComboBox();
	JComboBox watermarkTextFilterFontStyleOnSlides = new JComboBox( new Object[]
		{"plain", "bold", "italic", "bolditalic"}
	);
	JTextField watermarkTextFilterFontSizeOnSlides = new JTextField(2);
	JColorSelector watermarkTextFilterColorOnSlides = new JColorSelector("Shadow Color");
	JCheckBox watermarkTextFilterAntiAliasOnSlides = new JCheckBox("Anti-alias");
	JTextField watermarkTextFilterMarginOnSlides = new JTextField(2);
	JTextField watermarkTextFilterHorizontalOffsetOnSlides = new JTextField(2);
	JTextField watermarkTextFilterVerticalOffsetOnSlides = new JTextField(2);
	JComboBox watermarkTextFilterHorizontalAlignOnSlides = new JComboBox( new Object[]
		{"left", "right", "center"}
	);
	JComboBox watermarkTextFilterVerticalAlignOnSlides = new JComboBox( new Object[]
		{"top", "bottom", "center"}
	);
	JTextField watermarkTextFilterStrengthPercentOnSlides = new JTextField(2);
};

///////////////////////////////////////////////////////////////////////////////
public void addToContainer(Component comp, Container cont, GridBagLayout gridbag, GridBagConstraints c)
{
	 gridbag.setConstraints(comp, c);
	 cont.add(comp);
}

public ControlPanel createControlPanel(String name)
{
	return createControlPanel(name, 5, 5);
}

public ControlPanel createControlPanel(String name, int hgap)
{
	return createControlPanel(name, hgap, 5);
}

public ControlPanel createControlPanel(String name, int hgap, int vgap)
{
	ControlPanel ccPanel = new ControlPanel(name);

	((RiverLayout)ccPanel.getLayout()).setHgap(hgap);
	((RiverLayout)ccPanel.getLayout()).setVgap(vgap);
	return ccPanel;
}

public void correctCheckBoxState(JCheckBox chk)
{
	chk.setSelected( !chk.isSelected() );
	chk.setSelected( !chk.isSelected() );
}

public void setItemsForComboBox(JComboBox combo, List items)
{
	Collections.sort(items);
	combo.removeAllItems();
	
	Iterator it = items.iterator();
	
	while( it.hasNext() )
		combo.addItem( it.next() );
}

public void setItemsForComboBox(JComboBox combo, Object[] items)
{
	Arrays.sort(items);
	combo.removeAllItems();

	for( int i=0; i<items.length; i++ )
		combo.addItem( items[i] );
}

public List getBorderTypes()
{
	Iterator it = Arrays.asList(new File(skinDirectory,"res/borders").listFiles()).iterator();
	List result = new LinkedList();
	
	result.add( "" );
	while( it.hasNext() )
	{
		File file = (File)it.next();
		
		if( !file.isDirectory() )
			continue;
		
		result.add( file.getName() );
	}
	return result;
}

public List getIconSets()
{
	Iterator it = Arrays.asList(new File(skinDirectory,"res/actions").listFiles()).iterator();
	List result = new LinkedList();
	
	result.add( "" );
	while( it.hasNext() )
	{
		File file = (File)it.next();
		
		if( !file.isDirectory() )
			continue;
		
		result.add( file.getName() );
	}
	return result;
}

public List getSupportedLanguages()
{
	File baseResourceDir = new File(skinDirectory, "texts");
	Iterator it = Arrays.asList(baseResourceDir.listFiles()).iterator();
	List result = new LinkedList();
	
	while( it.hasNext() )
	{
		String file_name = ((File)it.next()).getName().toLowerCase();
		
		if( !file_name.startsWith("texts_") || !file_name.endsWith(".properties") )
			continue;
		
		int end_index = file_name.indexOf(".properties");
		
		result.add( file_name.substring(6, end_index) );
	}
	return result;
}

public void setupComponents()
{
	List border_types = getBorderTypes();
	String[] font_faces = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

	setItemsForComboBox(ui.iconSet, getIconSets());
	setItemsForComboBox(ui.language, getSupportedLanguages());

	setItemsForComboBox(ui.textFilterFontFaceOnThumbnails, font_faces);
	setItemsForComboBox(ui.textFilterFontFaceOnSlides, font_faces);
	setItemsForComboBox(ui.shadowTextFilterFontFaceOnThumbnails, font_faces);
	setItemsForComboBox(ui.shadowTextFilterFontFaceOnSlides, font_faces);
	setItemsForComboBox(ui.watermarkTextFilterFontFaceOnThumbnails, font_faces);
	setItemsForComboBox(ui.watermarkTextFilterFontFaceOnSlides, font_faces);

	setItemsForComboBox(ui.borderType, border_types);
	setItemsForComboBox(ui.thumbnailBorderType, border_types);
	setItemsForComboBox(ui.folderThumbnailBorderType, border_types);
	
	// Setting proper widths for the components to limit them
	ui.borderType.getPreferredSize().width = 100;
	ui.thumbnailBorderType.getPreferredSize().width = 100;
	ui.folderThumbnailBorderType.getPreferredSize().width = 100;
	ui.language.getPreferredSize().width = 50;
	ui.metadataDisplayMode.getPreferredSize().width = 100;
	ui.movieSlideDimension.getPreferredSize().width = 100;

	ui.textFilterFontFaceOnThumbnails.setPreferredSize( new Dimension(150, 20) );
	ui.textFilterFontFaceOnSlides.setPreferredSize( new Dimension(150, 20) );
	ui.shadowTextFilterFontFaceOnThumbnails.setPreferredSize( new Dimension(150, 20) );
	ui.shadowTextFilterFontFaceOnSlides.setPreferredSize( new Dimension(150, 20) );
	ui.watermarkTextFilterFontFaceOnThumbnails.setPreferredSize( new Dimension(150, 20) );
	ui.watermarkTextFilterFontFaceOnSlides.setPreferredSize( new Dimension(150, 20) );

	// Allow other languages than specified in list
	ui.language.setEditable(true);
	// Set default language
	ui.language.setSelectedItem(System.getProperty("user.language"));

	ui.movieSlideDimension.setEditable(true);
	ui.textFilterFontFaceOnThumbnails.setEditable(true);
	ui.textFilterFontFaceOnSlides.setEditable(true);

	// Adding some descriptions, as the labels themselves are not descriptive enough!
	ui.prescaleFixedShapeFilterOnThumbnails.setToolTipText("Apply filter before scaling");
	ui.prescaleFixedShapeFilterOnSlides.setToolTipText("Apply filter before scaling");
	ui.prescaleZoomFilterOnThumbnails.setToolTipText("Apply filter before scaling");
	ui.prescaleZoomFilterOnSlides.setToolTipText("Apply filter before scaling");
	ui.prescaleLogoFilterOnThumbnails.setToolTipText("Apply filter before scaling");
	ui.prescaleLogoFilterOnSlides.setToolTipText("Apply filter before scaling");
	ui.prescaleTextFilterOnThumbnails.setToolTipText("Apply filter before scaling");
	ui.prescaleTextFilterOnSlides.setToolTipText("Apply filter before scaling");
	ui.prescaleShadowTextFilterOnThumbnails.setToolTipText("Apply filter before scaling");
	ui.prescaleShadowTextFilterOnSlides.setToolTipText("Apply filter before scaling");
	ui.prescaleWatermarkTextFilterOnThumbnails.setToolTipText("Apply filter before scaling");
	ui.prescaleWatermarkTextFilterOnSlides.setToolTipText("Apply filter before scaling");

	ui.logoFilterSourceOnSlides.setToolTipText("Full logo source path here");
	ui.logoFilterSourceOnThumbnails.setToolTipText("Full logo source path here");

	ui.includeMoveForwardFacility.setToolTipText("One click moving-forward facility on slide pages if there is no 'Link to originals via scaled images'");

	ui.borderColor.setToolTipText("Only effects when the border type is 'solid'");
	ui.thumbnailBorderColor.setToolTipText("Only effects when the border type is 'solid'");
	ui.folderThumbnailBorderColor.setToolTipText("Only effects when the border type is 'solid'");

	ui.keepFiltersDefinedOutsideFMTabs.setToolTipText("You should check this option just in case you want to mix the previously entered filters, via Advanced tab, with these ones here.");

	ui.slideCaptionContent.setToolTipText("Available options are Title|FileName|FileType|Date|Dimension|SlideDimension|FileSize|<any EXIF/IPTC field name>");
	ui.thumbnailTooltipContent.setToolTipText("Available options are Title|FileName|FileType|InternalComment|ExternalComment|Date|Dimension|SlideDimension|FileSize");
	ui.thumbnailCaptionContent.setToolTipText("Available options are Title|FileName|FileType|InternalComment|ExternalComment|Date|Dimension|SlideDimension|FileSize");
	ui.folderTooltipContent.setToolTipText("Available options are Title|FileName|Date|Header|Footer|SlideCount");
	ui.folderCaptionContent.setToolTipText("Available options are Title|FileName|Date|Header|Footer|SlideCount");

	ui.slidePageThumbnailRatio.setToolTipText("A number greater than zero and less than or equal to one");

    ui.customMetadataFields.setLineWrap(true);
	// Event Handlers
	ui.metadataDisplayMode.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
	    String sel_item = (String) ui.metadataDisplayMode.getSelectedItem();

	    ui.customMetadataFields.setEnabled(sel_item.equalsIgnoreCase("custom") || sel_item.equals(""));
	   }
	});

	ui.includeSlidePageThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
        ui.slidePageThumbnailCount.setEnabled(ui.includeSlidePageThumbnails.isSelected());
        ui.slidePageThumbnailRatio.setEnabled(ui.includeSlidePageThumbnails.isSelected());
	   }
	});
	correctCheckBoxState(ui.includeSlidePageThumbnails);

	ui.includeSlideShow.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.cyclicSlideShow.setEnabled(ui.includeSlideShow.isSelected());
		ui.slideShowDelay.setEnabled(ui.includeSlideShow.isSelected());
		ui.slideShowCommentDelay.setEnabled(ui.includeSlideShow.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeSlideShow);

	ui.includeZoomFilterOnThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.zoomFilterPercentOnThumbnails.setEnabled(ui.includeZoomFilterOnThumbnails.isSelected());
		ui.prescaleZoomFilterOnThumbnails.setEnabled(ui.includeZoomFilterOnThumbnails.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeZoomFilterOnThumbnails);

	ui.includeFixedShapeFilterOnThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleFixedShapeFilterOnThumbnails.setEnabled(ui.includeFixedShapeFilterOnThumbnails.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeFixedShapeFilterOnThumbnails);

	ui.includeFixedShapeFilterOnSlides.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleFixedShapeFilterOnSlides.setEnabled(ui.includeFixedShapeFilterOnSlides.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeFixedShapeFilterOnSlides);

	ui.includeZoomFilterOnSlides.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.zoomFilterPercentOnSlides.setEnabled(ui.includeZoomFilterOnSlides.isSelected());
		ui.prescaleZoomFilterOnSlides.setEnabled(ui.includeZoomFilterOnSlides.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeZoomFilterOnSlides);

	ui.includeLogoFilterOnThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleLogoFilterOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
		ui.logoFilterSourceOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
		ui.logoFilterMarginOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
		ui.logoFilterHorizontalOffsetOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
		ui.logoFilterVerticalOffsetOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
		ui.logoFilterHorizontalAlignOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
		ui.logoFilterVerticalAlignOnThumbnails.setEnabled(ui.includeLogoFilterOnThumbnails.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeLogoFilterOnThumbnails);

	ui.includeLogoFilterOnSlides.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleLogoFilterOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
		ui.logoFilterSourceOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
		ui.logoFilterMarginOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
		ui.logoFilterHorizontalOffsetOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
		ui.logoFilterVerticalOffsetOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
		ui.logoFilterHorizontalAlignOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
		ui.logoFilterVerticalAlignOnSlides.setEnabled(ui.includeLogoFilterOnSlides.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeLogoFilterOnSlides);

	ui.includeTextFilterOnThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleTextFilterOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterTextOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterFontFaceOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterFontStyleOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterFontSizeOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterColorOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterAntiAliasOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterMarginOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterHorizontalOffsetOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterVerticalOffsetOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterHorizontalAlignOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
		ui.textFilterVerticalAlignOnThumbnails.setEnabled(ui.includeTextFilterOnThumbnails.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeTextFilterOnThumbnails);

	ui.includeTextFilterOnSlides.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleTextFilterOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterTextOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterFontFaceOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterFontStyleOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterFontSizeOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterColorOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterAntiAliasOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterMarginOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterHorizontalOffsetOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterVerticalOffsetOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterHorizontalAlignOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
		ui.textFilterVerticalAlignOnSlides.setEnabled(ui.includeTextFilterOnSlides.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeTextFilterOnSlides);

	ui.includeShadowTextFilterOnThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleShadowTextFilterOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterTextOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterFontFaceOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterFontStyleOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterFontSizeOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterTextColorOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterShadowColorOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterShadowDistanceOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterAntiAliasOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterMarginOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterHorizontalOffsetOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterVerticalOffsetOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterHorizontalAlignOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
		ui.shadowTextFilterVerticalAlignOnThumbnails.setEnabled(ui.includeShadowTextFilterOnThumbnails.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeShadowTextFilterOnThumbnails);

	ui.includeShadowTextFilterOnSlides.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleShadowTextFilterOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterTextOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterFontFaceOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterFontStyleOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterFontSizeOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterTextColorOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterShadowColorOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterShadowDistanceOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterAntiAliasOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterMarginOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterHorizontalOffsetOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterVerticalOffsetOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterHorizontalAlignOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
		ui.shadowTextFilterVerticalAlignOnSlides.setEnabled(ui.includeShadowTextFilterOnSlides.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeShadowTextFilterOnSlides);

	ui.includeWatermarkTextFilterOnThumbnails.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleWatermarkTextFilterOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterTextOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterFontFaceOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterFontStyleOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterFontSizeOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterColorOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterAntiAliasOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterMarginOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterHorizontalOffsetOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterVerticalOffsetOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterHorizontalAlignOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterVerticalAlignOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
		ui.watermarkTextFilterStrengthPercentOnThumbnails.setEnabled(ui.includeWatermarkTextFilterOnThumbnails.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeWatermarkTextFilterOnThumbnails);

	ui.includeWatermarkTextFilterOnSlides.addItemListener(new ItemListener() {
	   public void itemStateChanged(ItemEvent e) {
		ui.prescaleWatermarkTextFilterOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterTextOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterFontFaceOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterFontStyleOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterFontSizeOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterColorOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterAntiAliasOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterMarginOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterHorizontalOffsetOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterVerticalOffsetOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterHorizontalAlignOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterVerticalAlignOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
		ui.watermarkTextFilterStrengthPercentOnSlides.setEnabled(ui.includeWatermarkTextFilterOnSlides.isSelected());
	    }
	});
	correctCheckBoxState(ui.includeWatermarkTextFilterOnSlides);
}

public void doMainLayout()
{
	RiverLayout layout = (RiverLayout)ui.getLayout();
	layout.setHgap(0);
	layout.setVgap(0);

	JTabbedPane tabbedPane = new JTabbedPane();
	JTabbedPane tabFilterManagementSet = new JTabbedPane();
	JPanel pnlGeneralSet = new JPanel(new RiverLayout(2, 2));
	JPanel pnlFilterManagementSet = new JPanel(new RiverLayout(2, 2));
	JPanel pnlFilterManagementGeneralSet = new JPanel(new RiverLayout(2, 2));
	JPanel pnlIndexSet = new JPanel(new RiverLayout(2, 2));
	JPanel pnlAbout = new JPanel(new RiverLayout(2, 2));
	JLabel lblWarning = new JLabel("Note: You must Rebuild the whole album after making any changes in filter settings.");

	tabFilterManagementSet.addTab("General Filters", pnlFilterManagementGeneralSet);
	tabFilterManagementSet.addTab("Text Filter", getTextFilterPanel());
	tabFilterManagementSet.addTab("Shadow Text Filter", getShadowTextFilterPanel());
	tabFilterManagementSet.addTab("Watermark Text Filter", getWatermarkTextFilterPanel());

	lblWarning.setToolTipText("For more information on filters, please refer to the Documentation and User Guide link on the About tab");
	pnlFilterManagementSet.add(lblWarning);
	pnlFilterManagementSet.add("br", ui.keepFiltersDefinedOutsideFMTabs);
	pnlFilterManagementSet.add("p vtop hfill vfill", tabFilterManagementSet);

	tabbedPane.addTab("General", pnlGeneralSet);
	tabbedPane.addTab("Slide", getSlideSet());
	tabbedPane.addTab("Index", pnlIndexSet);
	tabbedPane.addTab("Filter Management", pnlFilterManagementSet);
	tabbedPane.addTab("About...", pnlAbout);
	ui.add("vtop hfill vfill", tabbedPane);

	pnlGeneralSet.add("p vtop hfill", getGeneralPanel());
	pnlGeneralSet.add("p hfill", getOnlinePrintingPanel());

	pnlFilterManagementGeneralSet.add("p vtop", getFixedShapeFilterPanel());
	pnlFilterManagementGeneralSet.add("left", getZoomFilterPanel());
	pnlFilterManagementGeneralSet.add("left hfill", getGrayScaleFilterPanel());
	pnlFilterManagementGeneralSet.add("p vtop hfill", getLogoFilterPanel());

	pnlIndexSet.add("p vtop hfill", getBorderPanel());
	pnlIndexSet.add("p hfill", getIndexEffectsPanel());
	pnlIndexSet.add("p hfill", getIndexContentPanel());

	pnlAbout.add("p hfill", getAboutPanel());
}

public void setupThemeNotification()
{
	window.addJAlbumListener(new JAlbumAdapter() {
		public void styleChanged(JAlbumEvent e) {
			// Load the current style's default user variables found in the file
			// "res/styles/<styleName>/theme.properties".
			if( !window.useLayoutHints.isSelected() )
				return;

			String chosenStyle = window.style.getSelectedItem();
			int index = chosenStyle.toLowerCase().indexOf(".css");

			chosenStyle = (index!=-1) ? chosenStyle.substring(0, index) : chosenStyle;

			File styleDefaultsFile = new File(skinDirectory, "res/styles/" + chosenStyle + "/theme.properties");

			if (!styleDefaultsFile.exists())
				return;

			Properties styleDefaults = new Properties();

			styleDefaults.load(new FileInputStream(styleDefaultsFile));
			se.datadosen.util.PropertyBinder.syncUI(styleDefaults, ui);
		}

		public void	skinChanged(JAlbumEvent e) {
			window.removeJAlbumListener(this);
		}
	});
}

public void setupImageLinkingNotification()
{
    Enumeration btns = window.imageLinking.getElements();

    btns.nextElement();
    final JRadioButton rdoLinkToOriginals = ((JRadioButton)btns.nextElement());

    rdoLinkToOriginals.addItemListener( new ItemListener() {
        public void itemStateChanged(ItemEvent e)
        {
            ui.includeMoveForwardFacility.setEnabled( !rdoLinkToOriginals.isSelected() );
        }
    });

    ui.includeMoveForwardFacility.setEnabled( !rdoLinkToOriginals.isSelected() );
}

///////////////////////////////////////////////////////////////////////////////
public ControlPanel getGeneralPanel()
{
	ControlPanel ccGeneral = createControlPanel("General", 5);

	ccGeneral.add(ui.includeKeyboardSupport);
	ccGeneral.add("tab", ui.includeSaveProtection);
	ccGeneral.add("br", ui.includeFirstLastPageActions);
	ccGeneral.add("tab", ui.includeJumpToPageAction);
	ccGeneral.add("br", ui.chooseRandomIconForFolder);
	ccGeneral.add("tab", ui.showAudioConsole);
	ccGeneral.add("br", new JLabel("Context Help Style"));
	ccGeneral.add(ui.contextHelpStyle);
	ccGeneral.add("tab", ui.includeNavigationHelpTips);
	ccGeneral.add("br", new JLabel("Navigation Bar Location"));
	ccGeneral.add(ui.navigationBarVerticalLocation);
	ccGeneral.add("tab", new JLabel("Icon Set"));
	ccGeneral.add(ui.iconSet);
	ccGeneral.add(new JLabel("Language"));
	ccGeneral.add(ui.language);
	ccGeneral.add("br", new JLabel("Album Title"));
	ccGeneral.add("hfill", ui.title);
	ccGeneral.add("br", new JLabel("External HOME Path"));
	ccGeneral.add("hfill", ui.externalHomePath);
	ccGeneral.add("br", new JLabel("Copyright Message"));
	ccGeneral.add("hfill", ui.copyright);
	return ccGeneral;
}

public ControlPanel getOnlinePrintingPanel()
{
	ControlPanel ccOnlinePrinting = new ControlPanel("On-line print ordering");

	ccOnlinePrinting.add(new JLabel("Printing service linking"));
	ccOnlinePrinting.add(ui.printing);

	ccOnlinePrinting.add("p", new JLabel("Each slide may contain a link that puts that image into a shopping cart for printing and delivery."));
	return ccOnlinePrinting;
}

///////////////////////////////////////////////////////////////////////////////
public ControlPanel getFixedShapeFilterPanel()
{
	ControlPanel ccFilter = createControlPanel("Fixed Shape/Size", 0, 0);

	ccFilter.add(ui.includeFixedShapeFilterOnThumbnails);
	ccFilter.add("br", ui.prescaleFixedShapeFilterOnThumbnails);
	ccFilter.add("br", ui.includeFixedShapeFilterOnSlides);
	ccFilter.add("br", ui.prescaleFixedShapeFilterOnSlides);
	return ccFilter;
}

public ControlPanel getGrayScaleFilterPanel()
{
	ControlPanel ccFilter = createControlPanel("Gray Scale", 0, 0);

	ccFilter.add(ui.includeGrayScaleFilterOnThumbnails);
	ccFilter.add("br", ui.includeGrayScaleFilterOnSlides);
	ccFilter.add("br", new JLabel(" "));
	ccFilter.add("br", new JLabel(" "));
	ccFilter.add("br", new JLabel(" "));
	return ccFilter;
}

public ControlPanel getZoomFilterPanel()
{
	ControlPanel ccFilter = createControlPanel("Zoom", 2, 0);

	ccFilter.add(ui.includeZoomFilterOnThumbnails);
	ccFilter.add("tab", ui.zoomFilterPercentOnThumbnails);
	ccFilter.add(new JLabel("%"));
	ccFilter.add("br", ui.prescaleZoomFilterOnThumbnails);
	ccFilter.add("br", ui.includeZoomFilterOnSlides);
	ccFilter.add("tab", ui.zoomFilterPercentOnSlides);
	ccFilter.add(new JLabel("%"));
	ccFilter.add("br", ui.prescaleZoomFilterOnSlides);
	return ccFilter;
}

public ControlPanel getLogoFilterPanel()
{
	ControlPanel ccFilter = createControlPanel("Logo", 0, 0);
	ControlPanel ccThumbnail = createControlPanel("", 2, 2);
	ControlPanel ccSlide = createControlPanel("", 2, 2);

	ccThumbnail.add(ui.includeLogoFilterOnThumbnails);
	ccThumbnail.add("left", ui.prescaleLogoFilterOnThumbnails);
	ccThumbnail.add("br", new JLabel("Logo Src"));
	ccThumbnail.add("tab hfill", ui.logoFilterSourceOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Align"));
	ccThumbnail.add("tab", ui.logoFilterHorizontalAlignOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Align"));
	ccThumbnail.add("tab", ui.logoFilterVerticalAlignOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Offset"));
	ccThumbnail.add("tab", ui.logoFilterHorizontalOffsetOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Offset"));
	ccThumbnail.add("tab", ui.logoFilterVerticalOffsetOnThumbnails);
	ccThumbnail.add("br", new JLabel("Margin"));
	ccThumbnail.add("tab", ui.logoFilterMarginOnThumbnails);

	ccSlide.add(ui.includeLogoFilterOnSlides);
	ccSlide.add("left", ui.prescaleLogoFilterOnSlides);
	ccSlide.add("br", new JLabel("Logo Src"));
	ccSlide.add("tab hfill", ui.logoFilterSourceOnSlides);
	ccSlide.add("br", new JLabel("Hor. Align"));
	ccSlide.add("tab", ui.logoFilterHorizontalAlignOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Align"));
	ccSlide.add("tab", ui.logoFilterVerticalAlignOnSlides);
	ccSlide.add("br", new JLabel("Hor. Offset"));
	ccSlide.add("tab", ui.logoFilterHorizontalOffsetOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Offset"));
	ccSlide.add("tab", ui.logoFilterVerticalOffsetOnSlides);
	ccSlide.add("br", new JLabel("Margin"));
	ccSlide.add("tab", ui.logoFilterMarginOnSlides);

	ccFilter.add(ccThumbnail);
	ccFilter.add("hfill", ccSlide);
	return ccFilter;
}

public JPanel getTextFilterPanel()
{
	JPanel pnlFilter = new JPanel(new RiverLayout(0, 2));
	ControlPanel ccThumbnail = createControlPanel("", 5, 2);
	ControlPanel ccSlide = createControlPanel("", 5, 2);

	ccThumbnail.add(ui.includeTextFilterOnThumbnails);
	ccThumbnail.add("left", ui.prescaleTextFilterOnThumbnails);
	ccThumbnail.add("br", new JLabel("Text"));
	ccThumbnail.add("tab", ui.textFilterTextOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Color"));
	ccThumbnail.add("tab", ui.textFilterColorOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Margin"));
	ccThumbnail.add("tab", ui.textFilterMarginOnThumbnails);
	ccThumbnail.add("br", new JLabel("Font Face"));
	ccThumbnail.add("tab", ui.textFilterFontFaceOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Font Style"));
	ccThumbnail.add("tab", ui.textFilterFontStyleOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Font Size"));
	ccThumbnail.add("tab", ui.textFilterFontSizeOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Align"));
	ccThumbnail.add("tab", ui.textFilterHorizontalAlignOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Align"));
	ccThumbnail.add("tab", ui.textFilterVerticalAlignOnThumbnails);
	ccThumbnail.add("tab", ui.textFilterAntiAliasOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Offset"));
	ccThumbnail.add("tab", ui.textFilterHorizontalOffsetOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Offset"));
	ccThumbnail.add("tab", ui.textFilterVerticalOffsetOnThumbnails);

	ccSlide.add(ui.includeTextFilterOnSlides);
	ccSlide.add("left", ui.prescaleTextFilterOnSlides);
	ccSlide.add("br", new JLabel("Text"));
	ccSlide.add("tab", ui.textFilterTextOnSlides);
	ccSlide.add("tab", new JLabel("Color"));
	ccSlide.add("tab", ui.textFilterColorOnSlides);
	ccSlide.add("tab", new JLabel("Margin"));
	ccSlide.add("tab", ui.textFilterMarginOnSlides);
	ccSlide.add("br", new JLabel("Font Face"));
	ccSlide.add("tab", ui.textFilterFontFaceOnSlides);
	ccSlide.add("tab", new JLabel("Font Style"));
	ccSlide.add("tab", ui.textFilterFontStyleOnSlides);
	ccSlide.add("tab", new JLabel("Font Size"));
	ccSlide.add("tab", ui.textFilterFontSizeOnSlides);
	ccSlide.add("br", new JLabel("Hor. Align"));
	ccSlide.add("tab", ui.textFilterHorizontalAlignOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Align"));
	ccSlide.add("tab", ui.textFilterVerticalAlignOnSlides);
	ccSlide.add("tab", ui.textFilterAntiAliasOnSlides);
	ccSlide.add("br", new JLabel("Hor. Offset"));
	ccSlide.add("tab", ui.textFilterHorizontalOffsetOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Offset"));
	ccSlide.add("tab", ui.textFilterVerticalOffsetOnSlides);

	pnlFilter.add("p vtop hfill", ccThumbnail);
	pnlFilter.add("br hfill", ccSlide);
	return pnlFilter;
}

public JPanel getShadowTextFilterPanel()
{
	JPanel pnlFilter = new JPanel(new RiverLayout(0, 2));
	ControlPanel ccThumbnail = createControlPanel("", 5, 2);
	ControlPanel ccSlide = createControlPanel("", 5, 2);

	ccThumbnail.add(ui.includeShadowTextFilterOnThumbnails);
	ccThumbnail.add("left", ui.prescaleShadowTextFilterOnThumbnails);
	ccThumbnail.add("br", new JLabel("Text"));
	ccThumbnail.add("tab", ui.shadowTextFilterTextOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Text Color"));
	ccThumbnail.add("tab", ui.shadowTextFilterTextColorOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Margin"));
	ccThumbnail.add("tab", ui.shadowTextFilterMarginOnThumbnails);
	ccThumbnail.add("br", new JLabel("Font Face"));
	ccThumbnail.add("tab", ui.shadowTextFilterFontFaceOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Font Style"));
	ccThumbnail.add("tab", ui.shadowTextFilterFontStyleOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Font Size"));
	ccThumbnail.add("tab", ui.shadowTextFilterFontSizeOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Align"));
	ccThumbnail.add("tab", ui.shadowTextFilterHorizontalAlignOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Align"));
	ccThumbnail.add("tab", ui.shadowTextFilterVerticalAlignOnThumbnails);
	ccThumbnail.add("tab", ui.shadowTextFilterAntiAliasOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Offset"));
	ccThumbnail.add("tab", ui.shadowTextFilterHorizontalOffsetOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Offset"));
	ccThumbnail.add("tab", ui.shadowTextFilterVerticalOffsetOnThumbnails);
	ccThumbnail.add("br", new JLabel("Shadow Color"));
	ccThumbnail.add("tab", ui.shadowTextFilterShadowColorOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Shadow Dist."));
	ccThumbnail.add("tab", ui.shadowTextFilterShadowDistanceOnThumbnails);

	ccSlide.add(ui.includeShadowTextFilterOnSlides);
	ccSlide.add("left", ui.prescaleShadowTextFilterOnSlides);
	ccSlide.add("br", new JLabel("Text"));
	ccSlide.add("tab", ui.shadowTextFilterTextOnSlides);
	ccSlide.add("tab", new JLabel("Text Color"));
	ccSlide.add("tab", ui.shadowTextFilterTextColorOnSlides);
	ccSlide.add("tab", new JLabel("Margin"));
	ccSlide.add("tab", ui.shadowTextFilterMarginOnSlides);
	ccSlide.add("br", new JLabel("Font Face"));
	ccSlide.add("tab", ui.shadowTextFilterFontFaceOnSlides);
	ccSlide.add("tab", new JLabel("Font Style"));
	ccSlide.add("tab", ui.shadowTextFilterFontStyleOnSlides);
	ccSlide.add("tab", new JLabel("Font Size"));
	ccSlide.add("tab", ui.shadowTextFilterFontSizeOnSlides);
	ccSlide.add("br", new JLabel("Hor. Align"));
	ccSlide.add("tab", ui.shadowTextFilterHorizontalAlignOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Align"));
	ccSlide.add("tab", ui.shadowTextFilterVerticalAlignOnSlides);
	ccSlide.add("tab", ui.shadowTextFilterAntiAliasOnSlides);
	ccSlide.add("br", new JLabel("Hor. Offset"));
	ccSlide.add("tab", ui.shadowTextFilterHorizontalOffsetOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Offset"));
	ccSlide.add("tab", ui.shadowTextFilterVerticalOffsetOnSlides);
	ccSlide.add("br", new JLabel("Shadow Color"));
	ccSlide.add("tab", ui.shadowTextFilterShadowColorOnSlides);
	ccSlide.add("tab", new JLabel("Shadow Dist."));
	ccSlide.add("tab", ui.shadowTextFilterShadowDistanceOnSlides);

	pnlFilter.add("p vtop hfill", ccThumbnail);
	pnlFilter.add("br hfill", ccSlide);
	return pnlFilter;
}

public JPanel getWatermarkTextFilterPanel()
{
	JPanel pnlFilter = new JPanel(new RiverLayout(0, 2));
	ControlPanel ccThumbnail = createControlPanel("", 5, 2);
	ControlPanel ccSlide = createControlPanel("", 5, 2);

	ccThumbnail.add(ui.includeWatermarkTextFilterOnThumbnails);
	ccThumbnail.add("left", ui.prescaleWatermarkTextFilterOnThumbnails);
	ccThumbnail.add("br", new JLabel("Text"));
	ccThumbnail.add("tab", ui.watermarkTextFilterTextOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Color"));
	ccThumbnail.add("tab", ui.watermarkTextFilterColorOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Margin"));
	ccThumbnail.add("tab", ui.watermarkTextFilterMarginOnThumbnails);
	ccThumbnail.add("br", new JLabel("Font Face"));
	ccThumbnail.add("tab", ui.watermarkTextFilterFontFaceOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Font Style"));
	ccThumbnail.add("tab", ui.watermarkTextFilterFontStyleOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Font Size"));
	ccThumbnail.add("tab", ui.watermarkTextFilterFontSizeOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Align"));
	ccThumbnail.add("tab", ui.watermarkTextFilterHorizontalAlignOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Align"));
	ccThumbnail.add("tab", ui.watermarkTextFilterVerticalAlignOnThumbnails);
	ccThumbnail.add("tab", ui.watermarkTextFilterAntiAliasOnThumbnails);
	ccThumbnail.add("br", new JLabel("Hor. Offset"));
	ccThumbnail.add("tab", ui.watermarkTextFilterHorizontalOffsetOnThumbnails);
	ccThumbnail.add("tab", new JLabel("Ver. Offset"));
	ccThumbnail.add("tab", ui.watermarkTextFilterVerticalOffsetOnThumbnails);
	ccThumbnail.add("br", new JLabel("Strength"));
	ccThumbnail.add("tab", ui.watermarkTextFilterStrengthPercentOnThumbnails);
	ccThumbnail.add(new JLabel("%"));

	ccSlide.add(ui.includeWatermarkTextFilterOnSlides);
	ccSlide.add("left", ui.prescaleWatermarkTextFilterOnSlides);
	ccSlide.add("br", new JLabel("Text"));
	ccSlide.add("tab", ui.watermarkTextFilterTextOnSlides);
	ccSlide.add("tab", new JLabel("Color"));
	ccSlide.add("tab", ui.watermarkTextFilterColorOnSlides);
	ccSlide.add("tab", new JLabel("Margin"));
	ccSlide.add("tab", ui.watermarkTextFilterMarginOnSlides);
	ccSlide.add("br", new JLabel("Font Face"));
	ccSlide.add("tab", ui.watermarkTextFilterFontFaceOnSlides);
	ccSlide.add("tab", new JLabel("Font Style"));
	ccSlide.add("tab", ui.watermarkTextFilterFontStyleOnSlides);
	ccSlide.add("tab", new JLabel("Font Size"));
	ccSlide.add("tab", ui.watermarkTextFilterFontSizeOnSlides);
	ccSlide.add("br", new JLabel("Hor. Align"));
	ccSlide.add("tab", ui.watermarkTextFilterHorizontalAlignOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Align"));
	ccSlide.add("tab", ui.watermarkTextFilterVerticalAlignOnSlides);
	ccSlide.add("tab", ui.watermarkTextFilterAntiAliasOnSlides);
	ccSlide.add("br", new JLabel("Hor. Offset"));
	ccSlide.add("tab", ui.watermarkTextFilterHorizontalOffsetOnSlides);
	ccSlide.add("tab", new JLabel("Ver. Offset"));
	ccSlide.add("tab", ui.watermarkTextFilterVerticalOffsetOnSlides);
	ccSlide.add("br", new JLabel("Strength"));
	ccSlide.add("tab", ui.watermarkTextFilterStrengthPercentOnSlides);
	ccSlide.add(new JLabel("%"));

	pnlFilter.add("p vtop hfill", ccThumbnail);
	pnlFilter.add("br hfill", ccSlide);
	return pnlFilter;
}

///////////////////////////////////////////////////////////////////////////////
public JPanel getSlideSet()
{
	GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
	JPanel pnlSlideSet = new JPanel(gridbag);

	constraints.fill = GridBagConstraints.BOTH;
	constraints.anchor = GridBagConstraints.NORTHWEST;
	constraints.weightx = 1.0;

	addToContainer(getSlideShowPanel(), pnlSlideSet, gridbag, constraints);
	addToContainer(getSlidePageThumbnailsPanel(), pnlSlideSet, gridbag, constraints);
	constraints.gridwidth = GridBagConstraints.REMAINDER;
	addToContainer(getSlideMiscPanel(), pnlSlideSet, gridbag, constraints);
	addToContainer(getPhotographicInfoPanel(), pnlSlideSet, gridbag, constraints);
	addToContainer(getSlideContentPanel(), pnlSlideSet, gridbag, constraints);
	addToContainer(getSlideCommentPanel(), pnlSlideSet, gridbag, constraints);
	constraints.gridwidth = GridBagConstraints.REMAINDER;
	constraints.gridheight = GridBagConstraints.REMAINDER;
	constraints.weighty = 1.0;
	addToContainer(Box.createGlue(), pnlSlideSet, gridbag, constraints);
	return pnlSlideSet;
}

public ControlPanel getSlideShowPanel()
{
	ControlPanel ccSlideShow = createControlPanel("Slide Show", 3);

	ccSlideShow.add(ui.includeSlideShow);
	ccSlideShow.add("br", ui.cyclicSlideShow);
	ccSlideShow.add("br", new JLabel("Delay (sec)"));
	ccSlideShow.add("tab", ui.slideShowDelay);
	ccSlideShow.add("br", new JLabel("Delay on Comments (sec)"));
	ccSlideShow.add("tab", ui.slideShowCommentDelay);
	return ccSlideShow;
}

public ControlPanel getSlidePageThumbnailsPanel()
{
	ControlPanel ccSlidePageThumbnails = createControlPanel("Slide Page Thumbnails", 3, 5);

	ccSlidePageThumbnails.add(ui.includeSlidePageThumbnails);
	ccSlidePageThumbnails.add("br", new JLabel("Count"));
	ccSlidePageThumbnails.add(ui.slidePageThumbnailCount);
	ccSlidePageThumbnails.add("br", new JLabel("Ratio"));
	ccSlidePageThumbnails.add(ui.slidePageThumbnailRatio);
	return ccSlidePageThumbnails;
}

public ControlPanel getSlideMiscPanel()
{
	ControlPanel ccMisc = createControlPanel("Misc", 3);

	ccMisc.add(new JLabel("Movie Slides Dimension"));
	ccMisc.add(ui.movieSlideDimension);
	ccMisc.add("br", ui.prefetchSiblingSlides);
	ccMisc.add("br", ui.includeBlendingEffectOnSlides);
	ccMisc.add("br", ui.includeMoveForwardFacility);
	return ccMisc;
}

public ControlPanel getPhotographicInfoPanel()
{
	ControlPanel ccExifInfo = createControlPanel("Photographic Information");
	JScrollPane scroll = new JScrollPane(ui.customMetadataFields);

	scroll.setPreferredSize( new Dimension(100, 60) );
	ccExifInfo.add(new JLabel("Meta-data Display Mode"));
	ccExifInfo.add("tab", ui.metadataDisplayMode);
	ccExifInfo.add("br", new JLabel("Meta-data Custom Fields"));
	ccExifInfo.add("tab hfill vfill", scroll);
	return ccExifInfo;
}

public ControlPanel getSlideContentPanel()
{
	ControlPanel ccSlideContent = createControlPanel("Slide Displayed Information", 3);

	ccSlideContent.add(new JLabel("Slide Caption Content"));
	ccSlideContent.add("tab hfill", ui.slideCaptionContent);
	return ccSlideContent;
}

public ControlPanel getSlideCommentPanel()
{
	ControlPanel ccSlideComment = createControlPanel("Slide Comment");
	
	ccSlideComment.add(new JLabel("Horizontal Align"));
	ccSlideComment.add("tab", ui.slideCommentHorizontalAlign);
	ccSlideComment.add(new JLabel("Vertical Position"));
	ccSlideComment.add(ui.slideCommentVerticalPosition);
	ccSlideComment.add("br", new JLabel("Comment Prefix"));
	ccSlideComment.add("tab hfill", ui.slideCommentPrefix);
	ccSlideComment.add("br", new JLabel("Comment Postfix"));
	ccSlideComment.add("tab hfill", ui.slideCommentPostfix);
	return ccSlideComment;
}

///////////////////////////////////////////////////////////////////////////////
public ControlPanel getBorderPanel()
{
	ControlPanel ccBorder = createControlPanel("Border", 3);

	ccBorder.add(new JLabel(" "));
	ccBorder.add("tab", new JLabel("Type"));
	ccBorder.add("tab", new JLabel("Size"));
	ccBorder.add("tab", new JLabel("Color"));
	ccBorder.add("br", new JLabel("Slide/General"));
	ccBorder.add("tab", ui.borderType);
	ccBorder.add("tab", ui.borderSize);
	ccBorder.add("tab", ui.borderColor);
	ccBorder.add("br", new JLabel("Thumbnail"));
	ccBorder.add("tab", ui.thumbnailBorderType);
	ccBorder.add("tab", ui.thumbnailBorderSize);
	ccBorder.add("tab", ui.thumbnailBorderColor);
	ccBorder.add("br", new JLabel("Folder Thumbnail"));
	ccBorder.add("tab", ui.folderThumbnailBorderType);
	ccBorder.add("tab", ui.folderThumbnailBorderSize);
	ccBorder.add("tab", ui.folderThumbnailBorderColor);
	return ccBorder;
}

public ControlPanel getIndexContentPanel()
{
	ControlPanel ccIndexContent = createControlPanel("Index Displayed Information", 3);

	ccIndexContent.add(new JLabel("Thumbnail Tooltip Content"));
	ccIndexContent.add("tab hfill", ui.thumbnailTooltipContent);
	ccIndexContent.add("br", new JLabel("Thumbnail Caption Content"));
	ccIndexContent.add("tab hfill", ui.thumbnailCaptionContent);

	ccIndexContent.add("br", new JLabel("Folder Tooltip Content"));
	ccIndexContent.add("tab hfill", ui.folderTooltipContent);
	ccIndexContent.add("br", new JLabel("Folder Caption Content"));
	ccIndexContent.add("tab hfill", ui.folderCaptionContent);
	return ccIndexContent;
}

public ControlPanel getIndexEffectsPanel()
{
	ControlPanel ccIndexEffects = createControlPanel("Page Effects", 3);

	ccIndexEffects.add(ui.includeBlendingEffectOnIndexes);
	return ccIndexEffects;
}


///////////////////////////////////////////////////////////////////////////////
public ControlPanel getAboutPanel()
{
	ControlPanel ccAbout = createControlPanel("About...", 5);
	JLinkLabel homeLink = new JLinkLabel("http://bluplusplus.armondavanes.com");
	JLinkLabel docLink = new JLinkLabel("http://bluplusplus.armondavanes.com/docs.html");
	JLinkLabel historyLink = new JLinkLabel("http://bluplusplus.armondavanes.com/history.html");
	JLinkLabel forumsLink = new JLinkLabel("http://forums.armondavanes.com");
	JLinkLabel contactLink = new JLinkLabel("Armond555@yahoo.com");
	
	homeLink.setURL("http://bluplusplus.armondavanes.com");
	homeLink.setToolTipText("http://bluplusplus.armondavanes.com");
	
	docLink.setURL("http://bppdocs.camner.net");
	docLink.setToolTipText("http://bppdocs.camner.net");
	
	historyLink.setURL("http://bluplusplus.armondavanes.com/history.html");
	historyLink.setToolTipText("http://bluplusplus.armondavanes.com/history.html");
	
	forumsLink.setURL("http://forums.armondavanes.com");
	forumsLink.setToolTipText("http://forums.armondavanes.com");

	contactLink.setURL("mailto:Armond555@yahoo.com");
	contactLink.setToolTipText("Armond555@yahoo.com");
	
	ccAbout.add(new JLabel("Skin Date/Version:"));
	ccAbout.add("tab", new JLabel("October 23, 2004 (v2.9)"));
	ccAbout.add("br", new JLabel("Home Page:"));
	ccAbout.add("tab", homeLink);
	ccAbout.add("br", new JLabel("Documentation & User Guide:"));
	ccAbout.add("tab", docLink);
	ccAbout.add("br", new JLabel("Changes History:"));
	ccAbout.add("tab", historyLink);
	ccAbout.add("br", new JLabel("Forums:"));
	ccAbout.add("tab", forumsLink);
	ccAbout.add("br", new JLabel("Contact Author:"));
	ccAbout.add("tab", new JLabel("Armond Avanes ("));
	ccAbout.add(contactLink);
	ccAbout.add(new JLabel(")"));
	return ccAbout;
}

///////////////////////////////////////////////////////////////////////////////
setupComponents();
doMainLayout();
setupThemeNotification();
setupImageLinkingNotification();

// Finally install components into JAlbum
window.setSkinUI(ui);
window.pack();
///////////////////////////////////////////////////////////////////////////////
