// Path: org.greip/src/org/greip/nls/Messages.java
// public class Messages extends NLS {
// 	private static final String BUNDLE_NAME = "org.greip.nls.messages"; //$NON-NLS-1$
// 
// 	// Color choosers
// 	public static String Blue;
// 	public static String Green;
// 	public static String Red;
// 	public static String Hue;
// 	public static String Saturation;
// 	public static String Brightness;
// 
// 	// Font chooser
// 	public static String Font;
// 	public static String Size;
// 	public static String Bold;
// 	public static String Italic;
// 
// 	// Calculator
// 	public static String Error;
// 	public static String Overflow;
// 
// 	static {
// 		// initialize resource bundle
// 		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
// 	}
// 
// 	private Messages() {
// 	}
// }


import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.greip.nls.Messages;

	private ColorCircle colorCircle;
	private IColorSliderConnector connector;

	public ColorCircleChooser(final Composite parent, final ColorResolution colorResolution, final boolean showInfo,
			final boolean showHistory) {
		super(parent, colorResolution, showInfo, showHistory);
		setRGB(getBackground().getRGB());
	}

	private void createColorCircle(final Composite parent) {
		colorCircle = new ColorCircle(parent, getColorResolution());
		colorCircle.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
		colorCircle.addListener(SWT.Modify, e -> setNewRGB(determineNewRGB()));
		colorCircle.addListener(SWT.Selection, e -> notifyListeners(SWT.Selection, new Event()));
	}

	private RGB determineNewRGB() {
		final float hue = colorCircle.getRGB().getHSB()[0];
		final float[] hsb = connector.getRGB().getHSB();
		final float saturation = hsb[2];
		final float brightness = hsb[1] == 0.0f ? 1.0f : hsb[1];

		final RGB rgb = new RGB(hue, saturation, brightness);
		connector.setRGB(rgb);

		return rgb;
	}

	private void createSliders(final Composite parent) {
		final ColorResolution colorResolution = getColorResolution();

// Path: org.greip/src/org/greip/nls/Messages.java
// public class Messages extends NLS {
// 	private static final String BUNDLE_NAME = "org.greip.nls.messages"; //$NON-NLS-1$
// 
// 	// Color choosers
// 	public static String Blue;
// 	public static String Green;
// 	public static String Red;
// 	public static String Hue;
// 	public static String Saturation;
// 	public static String Brightness;
// 
// 	// Font chooser
// 	public static String Font;
// 	public static String Size;
// 	public static String Bold;
// 	public static String Italic;
// 
// 	// Calculator
// 	public static String Error;
// 	public static String Overflow;
// 
// 	static {
// 		// initialize resource bundle
// 		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
// 	}
// 
// 	private Messages() {
// 	}
// }


// Path: org.greip/src/org/greip/color/ColorCircleChooser.java
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.greip.nls.Messages;

	private ColorCircle colorCircle;
	private IColorSliderConnector connector;

	public ColorCircleChooser(final Composite parent, final ColorResolution colorResolution, final boolean showInfo,
			final boolean showHistory) {
		super(parent, colorResolution, showInfo, showHistory);
		setRGB(getBackground().getRGB());
	}

	private void createColorCircle(final Composite parent) {
		colorCircle = new ColorCircle(parent, getColorResolution());
		colorCircle.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
		colorCircle.addListener(SWT.Modify, e -> setNewRGB(determineNewRGB()));
		colorCircle.addListener(SWT.Selection, e -> notifyListeners(SWT.Selection, new Event()));
	}

	private RGB determineNewRGB() {
		final float hue = colorCircle.getRGB().getHSB()[0];
		final float[] hsb = connector.getRGB().getHSB();
		final float saturation = hsb[2];
		final float brightness = hsb[1] == 0.0f ? 1.0f : hsb[1];

		final RGB rgb = new RGB(hue, saturation, brightness);
		connector.setRGB(rgb);

		return rgb;
	}

	private void createSliders(final Composite parent) {
		final ColorResolution colorResolution = getColorResolution();

		final SliderPanel panel = new SliderPanel(parent, SWT.VERTICAL, colorResolution, Messages.Saturation, Messages.Brightness);
