import java.util.List;
import java.util.Map;
-import java.util.regex.Pattern;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Text;
import org.tizen.webuibuilder.BuilderConstants;
import org.tizen.webuibuilder.animator.AnimatorConstants;
import org.tizen.webuibuilder.animator.gef.command.AnimationPropertyChangeCommand;
private Button forward = null;
private Button repeat = null;
- private Text timeText = null;
+ //private Text timeText = null;
+ private Label timeText = null;
private String currentTime = null;
private Button easingPanel = null;
public void createControls(Composite parent) {
setLayout(new FormLayout());
- // Animation play control
+ int scaleTop = -7;
+ int textWidth = 114;
+ int textHeight = 21;
+ if(Platform.getOS().equals(Platform.OS_WIN32)) {
+ scaleTop = -7;
+ textWidth = 117;
+ textHeight = 21;
+ } else if(Platform.getOS().equals(Platform.OS_WIN32) ||
+ Platform.getOS().equals(Platform.OS_WIN32)) {
+ scaleTop = -3;
+ textWidth = 117;
+ textHeight = 21;
+ }
+ // Animation play control
// ------------------------------------------------------------------------------
// Backward
// -------------------------------------------------------------------------------
// TimeText
// -------------------------------------------------------------------------------
- timeText = new Text(this, SWT.SINGLE | SWT.CENTER);
-
+ //timeText = new Text(this, SWT.SINGLE | SWT.CENTER);
+ timeText = new Label(this, SWT.SINGLE | SWT.CENTER);
+
FormData timeTextFormData = new FormData();
timeTextFormData.top = new FormAttachment(0, 3);
timeTextFormData.left = new FormAttachment(0, 146);
- timeTextFormData.width = 114;
- timeTextFormData.height = 21;
+ timeTextFormData.width = textWidth;
+ timeTextFormData.height = textHeight;
timeText.setLayoutData(timeTextFormData);
timeText.setBackgroundImage(ResourceManager
.getImage(BuilderConstants.ICON_DIR,
- "animator_toolbar_time_input_window_input_text.png"));
+ "animator_toolbar_time_input_window.png"));
setCurrentTime("00 : 00 . 000");
Font initialFont = timeText.getFont();
FontData[] fontData = initialFont.getFontData();
}
Font newFont = new Font(getDisplay(), fontData);
timeText.setFont(newFont);
-
- timeText.addFocusListener(new FocusListener() {
-
- @Override
- public void focusLost(FocusEvent e) {
- timeText.clearSelection();
- textBoxState = 0;
- }
-
- @Override
- public void focusGained(FocusEvent e) {
- textBoxState = 1;
- }
- });
-
- timeText.addKeyListener(new KeyListener() {
-
- @Override
- public void keyReleased(KeyEvent e) {
- // TODO Auto-generated method stub
- char myChar = e.character;
- int caret = timeText.getCaretPosition();
-
- String fullTime = timeText.getText();
- String[] first = null;
- String[] second = null;
- first = fullTime.split(":");
- second = fullTime.split(Pattern.quote("."));
-
- int firstSplit = first[0].length() - 1;
- int secSplit = second[0].length() - 1;
-
- boolean isNumber = Character.isDigit(myChar);
- if (isNumber) {
- if (caret <= firstSplit) {
-
- setCurrentTime(fullTime);
- setTimeTextPoint();
- timeText.setSelection(caret);
- } else if (caret > firstSplit + 3 && caret <= firstSplit + 5) {
- int count = secSplit - firstSplit;
- if (count > 5) {
- if (firstSplit + 4 == caret) {
- char lastSec = second[0].charAt(second[0].length() - 2);
- fullTime = first[0] + ": " + myChar + lastSec + " ." + second[1];
- } else {
- char firstSec = second[0].charAt(second[0].length() - 4);
- fullTime = first[0] + ": " + firstSec + myChar + " ." + second[1];
- }
- } else if (count <= 4) {
- fullTime = first[0] + ": " + myChar + "0" + " ." + second[1];
- } else {
- }
- setCurrentTime(fullTime);
- setTimeTextPoint();
- timeText.setSelection(caret);
- } else if (caret > firstSplit + 8 && caret <= firstSplit + 11) {
- int count = second[1].length();
- if (count > 4) {
- fullTime = second[0] + "." + second[1].substring(0, 4);
- } else if (count == 0 || count == 1) {
- fullTime = second[0] + "." + " 000";
- } else if (count == 2) {
- fullTime = second[0] + "." + second[1].substring(0, 2) + "00";
- } else if (count == 3) {
- fullTime = second[0] + "." + second[1].substring(0, 3) + "0";
- }
- setCurrentTime(fullTime);
- setTimeTextPoint();
- timeText.setSelection(caret);
- } else {
- e.doit = false;
- }
- }
-
- if (caret > firstSplit && caret <= firstSplit + 2) {
- timeText.setSelection(firstSplit + 3);
- } else if (caret > secSplit && caret < secSplit + 3) {
- timeText.setSelection(secSplit + 3);
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- String fullTime = timeText.getText();
- char myChar = e.character;
- int caret = timeText.getCaretPosition();
-
- int selectionCount = timeText.getSelectionCount();
-
- String[] first = null;
- first = fullTime.split(":");
- int firstSplit = first[0].length() - 1;
-
- boolean isNumber = Character.isDigit(myChar);
- if (isNumber) {
- if (caret <= firstSplit) {
- } else if ((selectionCount >= 1 && caret > firstSplit + 1 && caret <= firstSplit + 5)
- || (selectionCount == 0 && caret >= firstSplit + 3 && caret < firstSplit + 5)) {
- } else if ((selectionCount >= 1 && caret > firstSplit + 7 && caret <= firstSplit + 11)
- || (selectionCount == 0 && caret >= firstSplit + 8 && caret < firstSplit + 11)) {
- } else {
- e.doit = false;
- }
- } else if (e.keyCode == SWT.ARROW_LEFT || e.keyCode == SWT.ARROW_RIGHT) {
-
- } else {
- e.doit = false;
- }
- }
- });
-
- timeText.addMouseListener(new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- int caret = timeText.getCaretPosition();
- String fullTime = timeText.getText();
-
- String[] first = null;
- String[] second = null;
- first = fullTime.split(":");
- second = fullTime.split(Pattern.quote("."));
-
- int firstSplit = first[0].length() - 1;
- int secSplit = second[0].length() - 1;
-
- if (caret < firstSplit) {
- timeText.setSelection(0, firstSplit);
- } else if (caret > firstSplit && caret <= secSplit) {
- timeText.setSelection(firstSplit + 3, secSplit);
- } else if (caret > secSplit) {
- timeText.setSelection(secSplit + 3, secSplit + 6);
- }
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- textBoxState = 1;
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- }
- });
-
- timeText.addListener(SWT.MouseEnter, new Listener() {
- @Override
- public void handleEvent(Event event) {
- textBoxState = 2;
- }
- });
-
- timeText.addListener(SWT.MouseExit, new Listener() {
- @Override
- public void handleEvent(Event event) {
- textBoxState = 0;
- }
- });
+ timeText.setDragDetect(false);
+// timeText.setEditable(false);
+//
+// timeText.addFocusListener(new FocusListener() {
+//
+// @Override
+// public void focusLost(FocusEvent e) {
+// timeText.clearSelection();
+// textBoxState = 0;
+// }
+//
+// @Override
+// public void focusGained(FocusEvent e) {
+// textBoxState = 1;
+// }
+// });
+//
+// timeText.addKeyListener(new KeyListener() {
+//
+// @Override
+// public void keyReleased(KeyEvent e) {
+// // TODO Auto-generated method stub
+// char myChar = e.character;
+// int caret = timeText.getCaretPosition();
+//
+// String fullTime = timeText.getText();
+// String[] first = null;
+// String[] second = null;
+// first = fullTime.split(":");
+// second = fullTime.split(Pattern.quote("."));
+//
+// int firstSplit = first[0].length() - 1;
+// int secSplit = second[0].length() - 1;
+//
+// boolean isNumber = Character.isDigit(myChar);
+// if (isNumber) {
+// if (caret <= firstSplit) {
+//
+// setCurrentTime(fullTime);
+// setTimeTextPoint();
+// timeText.setSelection(caret);
+// } else if (caret > firstSplit + 3 && caret <= firstSplit + 5) {
+// int count = secSplit - firstSplit;
+// if (count > 5) {
+// if (firstSplit + 4 == caret) {
+// char lastSec = second[0].charAt(second[0].length() - 2);
+// fullTime = first[0] + ": " + myChar + lastSec + " ." + second[1];
+// } else {
+// char firstSec = second[0].charAt(second[0].length() - 4);
+// fullTime = first[0] + ": " + firstSec + myChar + " ." + second[1];
+// }
+// } else if (count <= 4) {
+// fullTime = first[0] + ": " + myChar + "0" + " ." + second[1];
+// } else {
+// }
+// setCurrentTime(fullTime);
+// setTimeTextPoint();
+// timeText.setSelection(caret);
+// } else if (caret > firstSplit + 8 && caret <= firstSplit + 11) {
+// int count = second[1].length();
+// if (count > 4) {
+// fullTime = second[0] + "." + second[1].substring(0, 4);
+// } else if (count == 0 || count == 1) {
+// fullTime = second[0] + "." + " 000";
+// } else if (count == 2) {
+// fullTime = second[0] + "." + second[1].substring(0, 2) + "00";
+// } else if (count == 3) {
+// fullTime = second[0] + "." + second[1].substring(0, 3) + "0";
+// }
+// setCurrentTime(fullTime);
+// setTimeTextPoint();
+// timeText.setSelection(caret);
+// } else {
+// e.doit = false;
+// }
+// }
+//
+// if (caret > firstSplit && caret <= firstSplit + 2) {
+// timeText.setSelection(firstSplit + 3);
+// } else if (caret > secSplit && caret < secSplit + 3) {
+// timeText.setSelection(secSplit + 3);
+// }
+// }
+//
+// @Override
+// public void keyPressed(KeyEvent e) {
+// String fullTime = timeText.getText();
+// char myChar = e.character;
+// int caret = timeText.getCaretPosition();
+//
+// int selectionCount = timeText.getSelectionCount();
+//
+// String[] first = null;
+// first = fullTime.split(":");
+// int firstSplit = first[0].length() - 1;
+//
+// boolean isNumber = Character.isDigit(myChar);
+// if (isNumber) {
+// if (caret <= firstSplit) {
+// } else if ((selectionCount >= 1 && caret > firstSplit + 1 && caret <= firstSplit + 5)
+// || (selectionCount == 0 && caret >= firstSplit + 3 && caret < firstSplit + 5)) {
+// } else if ((selectionCount >= 1 && caret > firstSplit + 7 && caret <= firstSplit + 11)
+// || (selectionCount == 0 && caret >= firstSplit + 8 && caret < firstSplit + 11)) {
+// } else {
+// e.doit = false;
+// }
+// } else if (e.keyCode == SWT.ARROW_LEFT || e.keyCode == SWT.ARROW_RIGHT) {
+//
+// } else {
+// e.doit = false;
+// }
+// }
+// });
+//
+// timeText.addMouseListener(new MouseListener() {
+//
+// @Override
+// public void mouseUp(MouseEvent e) {
+// int caret = timeText.getCaretPosition();
+// String fullTime = timeText.getText();
+//
+// String[] first = null;
+// String[] second = null;
+// first = fullTime.split(":");
+// second = fullTime.split(Pattern.quote("."));
+//
+// int firstSplit = first[0].length() - 1;
+// int secSplit = second[0].length() - 1;
+//
+// if (caret < firstSplit) {
+// timeText.setSelection(0, firstSplit);
+// } else if (caret > firstSplit && caret <= secSplit) {
+// timeText.setSelection(firstSplit + 3, secSplit);
+// } else if (caret > secSplit) {
+// timeText.setSelection(secSplit + 3, secSplit + 6);
+// }
+// }
+//
+// @Override
+// public void mouseDown(MouseEvent e) {
+// textBoxState = 1;
+// }
+//
+// @Override
+// public void mouseDoubleClick(MouseEvent e) {
+// }
+// });
+//
+// timeText.addListener(SWT.MouseEnter, new Listener() {
+// @Override
+// public void handleEvent(Event event) {
+// textBoxState = 2;
+// }
+// });
+//
+// timeText.addListener(SWT.MouseExit, new Listener() {
+// @Override
+// public void handleEvent(Event event) {
+// textBoxState = 0;
+// }
+// });
timeText.addListener(SWT.Paint, new Listener() {
scale.setData("CompositeName", "scale");
FormData scaleFormData = new FormData();
- scaleFormData.top = new FormAttachment(0, -7);
+ scaleFormData.top = new FormAttachment(0, scaleTop);
scaleFormData.left = new FormAttachment(zoomOut);
scaleFormData.height = 32;
scaleFormData.width = 100;
timeBar.setPosition(positionTime);
contentContainer.refreshPlayHeader(true);
- timeText.clearSelection();
+ //timeText.clearSelection();
}
*
* @return {@link CLabel}
*/
- public Text getTimeText() {
+ public Label getTimeText() {
return timeText;
}