showColorAt(event.x, event.y);
}
});
// Set up the image canvas scroll bars.
ScrollBar horizontal = imageCanvas.getHorizontalBar();
horizontal.setVisible(true);
horizontal.setMinimum(0);
horizontal.setEnabled(false);
horizontal.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
scrollHorizontally((ScrollBar) event.widget);
}
});
ScrollBar vertical = imageCanvas.getVerticalBar();
vertical.setVisible(true);
vertical.setMinimum(0);
vertical.setEnabled(false);
vertical.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
scrollVertically((ScrollBar) event.widget);
}
});
// Label to show the image size.
sizeLabel = new Label(shell, SWT.NONE);
sizeLabel.setText(ImageAnalyzer.bundle.getString("Size_initial"));
sizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the image depth.
depthLabel = new Label(shell, SWT.NONE);
depthLabel.setText(ImageAnalyzer.bundle.getString("Depth_initial"));
depthLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the transparent pixel.
transparentPixelLabel = new Label(shell, SWT.NONE);
transparentPixelLabel.setText(ImageAnalyzer.bundle.getString("Transparent_pixel_initial"));
transparentPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the time to load.
timeToLoadLabel = new Label(shell, SWT.NONE);
timeToLoadLabel.setText(ImageAnalyzer.bundle.getString("Time_to_load_initial"));
timeToLoadLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Separate the animation fields from the rest of the fields.
Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the logical screen size for animation.
screenSizeLabel = new Label(shell, SWT.NONE);
screenSizeLabel.setText(ImageAnalyzer.bundle.getString("Animation_size_initial"));
screenSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the background pixel.
backgroundPixelLabel = new Label(shell, SWT.NONE);
backgroundPixelLabel.setText(ImageAnalyzer.bundle.getString("Background_pixel_initial"));
backgroundPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the image location (x, y).
locationLabel = new Label(shell, SWT.NONE);
locationLabel.setText(ImageAnalyzer.bundle.getString("Image_location_initial"));
locationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the image disposal method.
disposalMethodLabel = new Label(shell, SWT.NONE);
disposalMethodLabel.setText(ImageAnalyzer.bundle.getString("Disposal_initial"));
disposalMethodLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the image delay time.
delayTimeLabel = new Label(shell, SWT.NONE);
delayTimeLabel.setText(ImageAnalyzer.bundle.getString("Delay_initial"));
delayTimeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show the background pixel.
repeatCountLabel = new Label(shell, SWT.NONE);
repeatCountLabel.setText(ImageAnalyzer.bundle.getString("Repeats_initial"));
repeatCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Separate the animation fields from the palette.
separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Label to show if the image has a direct or indexed palette.
paletteLabel = new Label(shell, SWT.NONE);
paletteLabel.setText(ImageAnalyzer.bundle.getString("Palette_initial"));
paletteLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// Canvas to show the image's palette.
paletteCanvas = new Canvas(shell, SWT.BORDER | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE);
paletteCanvas.setFont(fixedWidthFont);
paletteCanvas.getVerticalBar().setVisible(true);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
GC gc = new GC(paletteLabel);
paletteWidth = gc.stringExtent(ImageAnalyzer.bundle.getString("Max_length_string")).x;
gc.dispose();
gridData.widthHint = paletteWidth;
gridData.heightHint = 16 * 11; // show at least 16 colors
paletteCanvas.setLayoutData(gridData);
paletteCanvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
if (image != null)
paintPalette(event);
}
});
// Set up the palette canvas scroll bar.
vertical = paletteCanvas.getVerticalBar();
vertical.setVisible(true);
vertical.setMinimum(0);
vertical.setIncrement(10);
vertical.setEnabled(false);
vertical.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
scrollPalette((ScrollBar) event.widget);
}
});