import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
}
public long compose() {
- this.lcdCanvas = new Canvas( shell, SWT.EMBEDDED );
+ shell.setLayout(new FormLayout());
+
+ this.lcdCanvas = new Canvas(shell, SWT.EMBEDDED); //TODO:
int x = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_X,
EmulatorConfig.DEFAULT_WINDOW_X);
// EmulatorConfig.DEFAULT_WINDOW_ROTATION );
// has to be portrait mode at first booting time
short rotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
-
+
composeInternal(lcdCanvas, x, y, resolutionW, resolutionH, scale, rotationId, false);
logger.info("resolution : " + resolutionW + "x" + resolutionH + ", scale : " + scale);
int x, int y, int resolutionW, int resolutionH,
int scale, short rotationId, boolean isOnUsbKbd) {
- lcdCanvas.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
-
- imageRegistry = ImageRegistry.getInstance();
-
- shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
+ shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
+ shell.setLocation(x, y);
- shell.setLocation( x, y );
+ String emulatorName = SkinUtil.makeEmulatorName(config);
+ shell.setText(emulatorName);
- String emulatorName = SkinUtil.makeEmulatorName( config );
- shell.setText( emulatorName );
+ lcdCanvas.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
- if ( SwtUtil.isWindowsPlatform() ) {
- shell.setImage( imageRegistry.getIcon( IconName.EMULATOR_TITLE_ICO ) );
+ imageRegistry = ImageRegistry.getInstance();
+ if (SwtUtil.isWindowsPlatform()) {
+ shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE_ICO));
} else {
- shell.setImage( imageRegistry.getIcon( IconName.EMULATOR_TITLE ) );
+ shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE));
}
arrangeSkin(resolutionW, resolutionH, scale, rotationId);
SkinUtil.trimShell(shell, currentImage);
}
- /* not using a layout */
+ /* arrange the lcd */
SkinUtil.adjustLcdGeometry(lcdCanvas, currentLcdWidth, currentLcdHeight,
scale, rotationId, skinMode);
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
Canvas lcdCanvas, int resolutionW, int resolutionH,
int scale, short rotationId, SkinMode mode) {
- RotationType rotation = SkinRotation.getRotation(rotationId);
float convertedScale = convertScale(scale);
+ int l = 0, t = 0, w = 0, h = 0;
if (mode == SkinMode.GENERAL) {
+ RotationInfo rotation = RotationInfo.getValue(rotationId);
+
/* resoultion, that is lcd size in general skin mode */
- if (RotationInfo.LANDSCAPE == RotationInfo.getValue(rotationId) ||
- RotationInfo.REVERSE_LANDSCAPE == RotationInfo.getValue(rotationId)) {
- lcdCanvas.setBounds(0, 0,
- (int)(resolutionH * convertedScale),
- (int)(resolutionW * convertedScale));
+ if (RotationInfo.LANDSCAPE == rotation ||
+ RotationInfo.REVERSE_LANDSCAPE == rotation) {
+ w = (int)(resolutionH * convertedScale);
+ h = (int)(resolutionW * convertedScale);
} else {
- lcdCanvas.setBounds(0, 0,
- (int)(resolutionW * convertedScale),
- (int)(resolutionH * convertedScale));
+ w = (int)(resolutionW * convertedScale);
+ h = (int)(resolutionH * convertedScale);
}
+ } else {
+ RotationType rotation = SkinRotation.getRotation(rotationId);
- return;
- }
-
- LcdType lcd = rotation.getLcd(); /* from dbi */
- RegionType region = lcd.getRegion();
+ LcdType lcd = rotation.getLcd(); /* from dbi */
+ RegionType region = lcd.getRegion();
- Integer left = region.getLeft();
- Integer top = region.getTop();
- Integer width = region.getWidth();
- Integer height = region.getHeight();
+ Integer left = region.getLeft();
+ Integer top = region.getTop();
+ Integer width = region.getWidth();
+ Integer height = region.getHeight();
- int l = (int) (left * convertedScale);
- int t = (int) (top * convertedScale);
- int w = (int) (width * convertedScale);
- int h = (int) (height * convertedScale);
+ l = (int) (left * convertedScale);
+ t = (int) (top * convertedScale);
+ w = (int) (width * convertedScale);
+ h = (int) (height * convertedScale);
+ }
- lcdCanvas.setBounds(l, t, w, h);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, l);
+ data.top = new FormAttachment(0, t);
+ data.width = w;
+ data.height = h;
+ lcdCanvas.setLayoutData(data);
}
public static SkinRegion getHardKeyArea( int currentX, int currentY, short rotationId, int scale ) {