this.pressedKeyEventList = new LinkedList<KeyEventData>();
int style = SWT.NO_TRIM;
- this.shell = new Shell( Display.getDefault(), style );
+ if (skinMode == SkinMode.NONE) {
+ style = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.BORDER;
+ }
+ this.shell = new Shell(Display.getDefault(), style);
}
public void setCommunicator( SocketCommunicator communicator ) {
shell.setImage( imageRegistry.getIcon( IconName.EMULATOR_TITLE ) );
}
- arrangeSkin( lcdWidth, lcdHeight, scale, rotationId );
+ arrangeSkin(lcdWidth, lcdHeight, scale, rotationId);
- this.isOnUsbKbd = isOnUsbKbd;
-
- if ( null == currentImage ) {
- logger.severe( "Fail to load initial skin image file. Kill this skin process!!!" );
- SkinUtil.openMessage( shell, null, "Fail to load Skin image file.", SWT.ICON_ERROR, config );
- System.exit( -1 );
+ if (skinMode != SkinMode.NONE && null == currentImage) {
+ logger.severe("Failed to load initial skin image file. Kill this skin process.");
+ SkinUtil.openMessage(shell, null,
+ "Failed to load Skin image file.", SWT.ICON_ERROR, config);
+ System.exit(-1);
}
seteHoverColor();
+ this.isOnUsbKbd = isOnUsbKbd;
setMenu();
-
}
private void setMenu() {
private void arrangeSkin( int lcdWidth, int lcdHeight, int scale, short rotationId ) {
- Image tempImage = null;
- Image tempKeyPressedImage = null;
this.currentLcdWidth = lcdWidth;
this.currentLcdHeight = lcdHeight;
this.currentScale = scale;
this.currentRotationId = rotationId;
this.currentAngle = SkinRotation.getAngle( rotationId );
- if ( null != currentImage ) {
- tempImage = currentImage;
- }
- if ( null != currentKeyPressedImage ) {
- tempKeyPressedImage = currentKeyPressedImage;
- }
+ if (skinMode != SkinMode.NONE) {
+ Image tempImage = null;
+ Image tempKeyPressedImage = null;
- shell.redraw();
+ if (null != currentImage) {
+ tempImage = currentImage;
+ }
+ if (null != currentKeyPressedImage) {
+ tempKeyPressedImage = currentKeyPressedImage;
+ }
- currentImage = SkinUtil.createScaledImage( imageRegistry, shell, rotationId, scale, ImageType.IMG_TYPE_MAIN );
- currentKeyPressedImage = SkinUtil.createScaledImage( imageRegistry, shell, rotationId, scale,
- ImageType.IMG_TYPE_PRESSED );
+ currentImage = SkinUtil.createScaledImage(
+ imageRegistry, shell, rotationId, scale, ImageType.IMG_TYPE_MAIN);
+ currentKeyPressedImage = SkinUtil.createScaledImage(
+ imageRegistry, shell, rotationId, scale, ImageType.IMG_TYPE_PRESSED);
- if (tempImage != null) {
- tempImage.dispose();
- }
- if (tempKeyPressedImage != null) {
- tempKeyPressedImage.dispose();
- }
+ if (tempImage != null) {
+ tempImage.dispose();
+ }
+ if (tempKeyPressedImage != null) {
+ tempKeyPressedImage.dispose();
+ }
- /* custom window shape */
- SkinUtil.trimShell(shell, currentImage);
+ /* custom window shape */
+ SkinUtil.trimShell(shell, currentImage);
+ }
/* not using a layout */
- SkinUtil.adjustLcdGeometry(lcdCanvas, scale, rotationId);
+ SkinUtil.adjustLcdGeometry(lcdCanvas, scale, rotationId, skinMode);
- if( null != currentImage ) {
+ /* set window size */
+ if (null != currentImage) {
ImageData imageData = currentImage.getImageData();
- shell.setMinimumSize( imageData.width, imageData.height );
- shell.setSize( imageData.width, imageData.height );
+ shell.setMinimumSize(imageData.width, imageData.height);
+ shell.setSize(imageData.width, imageData.height);
}
+ shell.redraw();
+ shell.pack();
}
private void addShellListener( final Shell shell ) {
}
};
- shell.addPaintListener( shellPaintListener );
+ if (skinMode != SkinMode.NONE) {
+ shell.addPaintListener(shellPaintListener);
+ }
FocusListener shellFocusListener = new FocusListener() {
@Override
};
- shell.addMouseTrackListener( shellMouseTrackListener );
+ if (skinMode != SkinMode.NONE) {
+ shell.addMouseTrackListener(shellMouseTrackListener);
+ }
shellMouseMoveListener = new MouseMoveListener() {
@Override
} //end of mouseMove
};
- shell.addMouseMoveListener( shellMouseMoveListener );
+ if (skinMode != SkinMode.NONE) {
+ shell.addMouseMoveListener(shellMouseMoveListener);
+ }
shellMouseListener = new MouseListener() {
@Override
}
};
- shell.addMouseListener( shellMouseListener );
+ if (skinMode != SkinMode.NONE) {
+ shell.addMouseListener(shellMouseListener);
+ }
shellMenuDetectListener = new MenuDetectListener() {
@Override
import java.io.File;
import java.util.List;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Rectangle;
import org.tizen.emulator.skin.dbi.RotationType;
import org.tizen.emulator.skin.image.ImageRegistry;
import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
+import org.tizen.emulator.skin.mode.SkinMode;
/**
return sdbPath;
}
- public static void adjustLcdGeometry( Canvas lcdCanvas, int scale, short rotationId ) {
+ public static void adjustLcdGeometry(
+ Canvas lcdCanvas, int scale, short rotationId, SkinMode mode) {
- RotationType rotation = SkinRotation.getRotation( rotationId );
+ RotationType rotation = SkinRotation.getRotation(rotationId);
LcdType lcd = rotation.getLcd();
RegionType region = lcd.getRegion();
- Integer left = region.getLeft();
- Integer top = region.getTop();
+ Integer left = (mode != SkinMode.NONE) ? region.getLeft() : 0;
+ Integer top = (mode != SkinMode.NONE) ? region.getTop() : 0;
Integer width = region.getWidth();
Integer height = region.getHeight();
- float convertedScale = convertScale( scale );
-
- int l = (int) ( left * convertedScale );
- int t = (int) ( top * convertedScale );
- int w = (int) ( width * convertedScale );
- int h = (int) ( height * convertedScale );
+ float convertedScale = convertScale(scale);
- lcdCanvas.setBounds( l, t, w, h );
+ int l = (int) (left * convertedScale);
+ int t = (int) (top * convertedScale);
+ int w = (int) (width * convertedScale);
+ int h = (int) (height * convertedScale);
+ lcdCanvas.setBounds(l, t, w, h);
}
public static SkinRegion getHardKeyArea( int currentX, int currentY, short rotationId, int scale ) {