private boolean isOnKbd;
public ControlPanel controlPanel;
+ public Color colorPairTag;
+ public Canvas pairTagCanvas;
protected ScreenShotDialog screenShotDialog;
private Menu contextMenu;
private MenuItem panelItem; /* key window */
}
}
- return new SkinReopenPolicy( reopenSkin, isAboutToReopen );
+ return new SkinReopenPolicy(reopenSkin, isAboutToReopen);
}
shellCloseListener = new Listener() {
@Override
- public void handleEvent( Event event ) {
+ public void handleEvent(Event event) {
- if ( isShutdownRequested ) {
+ if (isShutdownRequested) {
removeShellListeners();
removeCanvasListeners();
- if ( !isAboutToReopen ) {
+ if (!isAboutToReopen) {
/* close the screen shot window */
if (null != screenShotDialog) {
Shell scShell = screenShotDialog.getShell();
cpShell.close();
}
controlPanel = null;
+ colorPairTag.dispose();
}
/* save config only for emulator close */
public void openKeyWindow() {
if (controlPanel != null) {
controlPanel.getShell().setVisible(true);
+ pairTagCanvas.setVisible(true);
return;
}
try {
controlPanel = new ControlPanel(shell, communicator, keyMapList);
+ colorPairTag = controlPanel.getPairTagColor();
+ pairTagCanvas.setVisible(true);
+
controlPanel.open();
} finally {
controlPanel = null;
public void hideKeyWindow() {
controlPanel.getShell().setVisible(false);
+ pairTagCanvas.setVisible(false);
}
private void addMenuItems(final Shell shell, final Menu menu) {
import org.tizen.emulator.skin.EmulatorSkin;
import org.tizen.emulator.skin.EmulatorSkinState;
import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
-import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
}
});
+ /* make a pair tag circle */
+ skin.pairTagCanvas = new Canvas(shell, SWT.NONE);
+ skin.pairTagCanvas.setBackground(
+ new Color(shell.getDisplay(), new RGB(38, 38, 38)));
+
+ skin.pairTagCanvas.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ if (skin.colorPairTag != null) {
+ e.gc.setBackground(skin.colorPairTag);
+ e.gc.setAntialias(SWT.ON);
+ e.gc.fillOval(0, 0, 8, 8);
+ }
+ }
+ });
+ skin.pairTagCanvas.setVisible(false);
+
arrangeSkin(scale, rotationId);
}
lcdBounds.y + (lcdBounds.height / 2) - (toggleButton.getImageSize().y / 2),
toggleButton.getImageSize().x, toggleButton.getImageSize().y);
+ /* arrange the pair tag */
+ skin.pairTagCanvas.setBounds(26, 13, 8, 8);
+
/* custom window shape */
trimPatchedShell(shell, currentState.getCurrentImage());
shell.removeMouseListener(shellMouseListener);
}
+ if (toggleButton != null) {
+ toggleButton.dispose();
+ }
+
+ if (skin.pairTagCanvas != null) {
+ skin.pairTagCanvas.dispose();
+ }
+
frameMaker.freePatches();
}
}
import java.util.logging.Logger;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.log.SkinLogger;
/* middle side */
gc.drawImage(imageL, 0, 0, imageL.getImageData().width, imageL.getImageData().height,
0, patchHeight, patchWidth, centerPatchHeight);
- gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
+ gc.setBackground(new Color(display, new RGB(38, 38, 38)));
gc.fillRectangle(patchWidth, patchHeight, centerPatchWidth, centerPatchHeight); /* center */
gc.drawImage(imageR, 0, 0, imageR.getImageData().width, imageR.getImageData().height,
patchWidth + centerPatchWidth, patchHeight, patchWidth, centerPatchHeight);
import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
public class ControlPanel extends SkinWindow {
private static final String PATCH_IMAGES_PATH = "images/key-window/";
+ private static final int SHELL_MARGIN_BOTTOM = 3;
+ private static final int PAIRTAG_CIRCLE_SIZE = 8;
+ private static final int PAIRTAG_MARGIN_BOTTOM = 6;
+ private static final int BUTTON_DEFAULT_CNT = 4;
+ private static final int BUTTON_VERTICAL_SPACING = 7;
private SkinPatches frameMaker;
private Image imageNormal; /* ImageButton image */
private Image imagePushed; /* pushed ImageButton image */
private Image imageFrame; /* nine-patch image */
private Color colorFrame;
+ private Color colorPairTag;
private SocketCommunicator communicator;
private List<KeyMapType> keyMapList;
this.shell = new Shell(Display.getDefault(), SWT.NO_TRIM | SWT.RESIZE);
this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
+ this.keyMapList = keyMapList;
+ this.communicator = communicator;
+ this.grabPosition = new Point(0, 0);
+
/* load image for HW key button */
ClassLoader loader = this.getClass().getClassLoader();
imageNormal = new Image(Display.getDefault(),
/* calculate the key window size */
int width = imageNormal.getImageData().width;
- int height = (imageNormal.getImageData().height * 4) + (4 * 3);
+ int height = (imageNormal.getImageData().height * BUTTON_DEFAULT_CNT) +
+ (BUTTON_VERTICAL_SPACING * (BUTTON_DEFAULT_CNT - 1)) +
+ (PAIRTAG_CIRCLE_SIZE + PAIRTAG_MARGIN_BOTTOM) +
+ SHELL_MARGIN_BOTTOM;
/* make a frame image */
this.imageFrame = frameMaker.getPatchedImage(width, height);
this.colorFrame = new Color(shell.getDisplay(), new RGB(38, 38, 38));
- this.keyMapList = keyMapList;
- this.communicator = communicator;
- this.grabPosition = new Point(0, 0);
+ /* generate a pair tag color of key window */
+ int red = (int) (Math.random() * 256);
+ int green = (int) (Math.random() * 256);
+ int blue = (int) (Math.random() * 256);
+ this.colorPairTag = new Color(shell.getDisplay(), new RGB(red, green, blue));
createContents();
trimPatchedShell(shell, imageFrame);
}
protected void createContents() {
- GridLayout shellGridLayout = new GridLayout(1, true);
+ GridLayout shellGridLayout = new GridLayout(1, false);
shellGridLayout.marginLeft = shellGridLayout.marginRight = frameMaker.getPatchWidth();
shellGridLayout.marginTop = shellGridLayout.marginBottom = frameMaker.getPatchHeight();
shellGridLayout.marginWidth = shellGridLayout.marginHeight = 0;
shell.setLayout(shellGridLayout);
+ /* make a pair tag circle */
+ Canvas pairTagCanvas = new Canvas(shell, SWT.NONE);
+ pairTagCanvas.setBackground(colorFrame);
+ pairTagCanvas.setLayoutData(new GridData(PAIRTAG_CIRCLE_SIZE,
+ PAIRTAG_CIRCLE_SIZE + PAIRTAG_MARGIN_BOTTOM));
+
+ pairTagCanvas.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ e.gc.setBackground(colorPairTag);
+ e.gc.setAntialias(SWT.ON);
+ e.gc.fillOval(0, 0, PAIRTAG_CIRCLE_SIZE, PAIRTAG_CIRCLE_SIZE);
+ }
+ });
+
+ /* */
ScrolledComposite compositeScroll = new ScrolledComposite(shell, SWT.V_SCROLL);
compositeScroll.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
+
Composite compositeBase = new Composite(compositeScroll, SWT.NONE);
- //compositeBase.setBackground(colorFrame);
+ compositeBase.setBackground(colorFrame);
GridLayout compositeGridLayout = new GridLayout(1, false);
compositeGridLayout.marginLeft = compositeGridLayout.marginRight = 0;
compositeGridLayout.marginTop = compositeGridLayout.marginBottom = 0;
compositeGridLayout.marginWidth = compositeGridLayout.marginHeight = 0;
compositeGridLayout.horizontalSpacing = 0;
- compositeGridLayout.verticalSpacing = 4;
+ compositeGridLayout.verticalSpacing = BUTTON_VERTICAL_SPACING;
compositeBase.setLayout(compositeGridLayout);
if (keyMapList != null && keyMapList.isEmpty() == false) {
imageHover.dispose();
imagePushed.dispose();
colorFrame.dispose();
+ colorPairTag.dispose();
frameMaker.freePatches();
}
shell.addListener(SWT.Close, shellCloseListener);
}
+
+ public Color getPairTagColor() {
+ return colorPairTag;
+ }
}