Revision: 4788
http://sourceforge.net/p/vexi/code/4788
Author: clrg
Date: 2015-05-02 16:30:06 +0000 (Sat, 02 May 2015)
Log Message:
-----------
Minor refactor
- more readable non-static functions
- order of functions in Box
- improve encapsulation (reduce direct Box property access)
Modified Paths:
--------------
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Canvas.java
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWTBase.java
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp
Modified:
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Canvas.java
===================================================================
---
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Canvas.java
2015-05-02 12:35:32 UTC (rev 4787)
+++
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Canvas.java
2015-05-02 16:30:06 UTC (rev 4788)
@@ -42,8 +42,8 @@
set(TILE_IMAGE);
}
public Object getImage() { return getBuffer(); }
- public int getWidth() { return scale(width); }
- public int getHeight() { return scale(height); }
+ public int getWidth() { return scale(width()); }
+ public int getHeight() { return scale(height()); }
private int scale(int coord){
return (int)(dotsPerPixel*coord);
@@ -123,13 +123,13 @@
}
private BufferedImage getBuffer(){
- if(width==0 || height==0){
+ if(width()==0 || height()==0){
buffer = null;
}else if(buffer==null){
- buffer = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
+ buffer = new BufferedImage(width(), height(),
BufferedImage.TYPE_INT_ARGB);
}else{
- final int heightPixels = (int)(height*dotsPerPixel);
- final int widthPixels = (int)(width*dotsPerPixel);
+ final int heightPixels = (int)(height()*dotsPerPixel);
+ final int widthPixels = (int)(width()*dotsPerPixel);
if(buffer.getHeight()!=(heightPixels) ||
buffer.getWidth()!=(widthPixels)){
BufferedImage buffer1 = new
BufferedImage(widthPixels, heightPixels, BufferedImage.TYPE_INT_ARGB);
Graphics2D g0 =
(Graphics2D)buffer.getGraphics();
Modified:
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java
===================================================================
---
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java
2015-05-02 12:35:32 UTC (rev 4787)
+++
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java
2015-05-02 16:30:06 UTC (rev 4788)
@@ -181,7 +181,7 @@
static protected boolean isLockingKeyOn(int k) throws JSExn {
for (int i=0; i<allSurfaces.size(); i++) {
Surface s = (Surface)allSurfaces.elementAt(i);
- if (Box.testDisplay(s.root)) {
+ if (s.root.display()) {
try {
return s._isLockingKeyOn(k);
} catch(Exception e) {
@@ -531,21 +531,21 @@
int rootx = x - s.x;
// right aligned
if (!leftAlign && rightAlign) {
- rootx = s.width - (rootx + leftInset + rightInset +
root.width);
+ rootx = s.width - (rootx + leftInset + rightInset +
root.width());
}
// center aligned
if (!leftAlign && !rightAlign) {
- rootx = rootx - (s.width - (root.width + leftInset +
rightInset)) / 2;
+ rootx = rootx - (s.width - (root.width() + leftInset +
rightInset)) / 2;
}
// top aligned
int rooty = y - s.y;
// bottom aligned
if (!topAlign && bottomAlign) {
- rooty = s.height - (rooty + topInset + bottomInset +
root.height);
+ rooty = s.height - (rooty + topInset + bottomInset +
root.height());
}
// center aligned
if (!topAlign && !bottomAlign) {
- rooty = rooty - (s.height - (root.height + topInset +
bottomInset)) / 2;
+ rooty = rooty - (s.height - (root.height() + topInset +
bottomInset)) / 2;
}
root.setRootPosition(rootx, rooty);
@@ -574,20 +574,20 @@
int y = this.y;
// horizontal
if (leftAlign) {
- x = root.x;
+ x = root.x();
} else if (rightAlign) {
- x = root.x+s.width-leftInset-rightInset-pendingWidth;
+ x = root.x()+s.width-leftInset-rightInset-pendingWidth;
} else {
- x = root.x+(s.width-leftInset-rightInset-pendingWidth)/2;
+ x = root.x()+(s.width-leftInset-rightInset-pendingWidth)/2;
}
x += s.x;
// vertical
if (topAlign) {
- y = root.y;
+ y = root.y();
} else if (bottomAlign) {
- y = root.y+s.height-leftInset-rightInset-pendingHeight;
+ y = root.y()+s.height-leftInset-rightInset-pendingHeight;
} else {
- y = root.y+(s.height-topInset-bottomInset-pendingHeight)/2;
+ y = root.y()+(s.height-topInset-bottomInset-pendingHeight)/2;
}
y += s.y;
// propagate to frame/window
@@ -638,12 +638,12 @@
/** Only run if scheduled */
public Object run(Object o) {
- if (resizable == Box.testShrink(root)) {
- resizable = !Box.testShrink(root);
+ if (resizable == root.shrink()) {
+ resizable = !root.shrink();
setResizable(resizable);
}
- if (visible != Box.testDisplay(root)) {
- visible = Box.testDisplay(root);
+ if (visible != root.display()) {
+ visible = root.display();
_makeVisible(visible);
surfaceDisplayed();
}
@@ -688,7 +688,7 @@
* the root box of the surface
*/
public void dirty() {
- dirty(0, 0, root.width, root.height);
+ dirty(0, 0, root.width(), root.height());
}
/** Signals that a rendered area is no longer valid. It is intended
@@ -728,7 +728,7 @@
*/
static public Surface createSurface(Box b, boolean framed) throws JSExn {
Surface old = fromBox(b);
- boolean firevisible = old==null && Box.testDisplay(b);
+ boolean firevisible = old==null && b.display();
// fire pre-cascade visible traps
WriteTrapChain trapchain = null;
if (firevisible) {
@@ -820,11 +820,11 @@
// }
// }
// reflow to new size as set by the frame
- int cwidth = root.contentwidth;
- int cheight = root.contentheight;
+ int cwidth = root.contentwidth();
+ int cheight = root.contentheight();
mouseUpdateRequired = root.surfaceReflow(this, pendingWidth,
pendingHeight) || mouseUpdateRequired;
- if (Box.testShrink(root) && (cwidth!=root.contentwidth ||
cheight!=root.contentheight)) {
- setMinimumSize(root.contentwidth, root.contentheight);
+ if (root.shrink() && (cwidth!=root.contentwidth() ||
cheight!=root.contentheight())) {
+ setMinimumSize(root.contentwidth(), root.contentheight());
}
} while (abort);
@@ -833,8 +833,8 @@
if (dirt==null) return null;
final PixelBuffer buf = _getPixelBuffer();
- final int rwidth = root.width;
- final int rheight = root.height;
+ final int rwidth = root.width();
+ final int rheight = root.height();
// final int scar_y = rheight-scarImage.height;
for (int i = 0; dirt != null && i < numregions; i++) {
// DirtyList indicates invalid dirty rects (4 consecutive
@@ -992,15 +992,15 @@
int numregions = r.numregions;
int[] regions = r.regions;
- final int rwidth = root.width;
- final int rheight = root.height;
+ final int rwidth = root.width();
+ final int rheight = root.height();
// REMARK: whilst in theory only blitting the dirty areas
// would seem more efficient, in practise it results in a
// large slowdown due to a delay in processing each blit,
// so instead we just blit a single all-encompassing area
// NB: original implementation in r4011
- int x = root.width;
- int y = root.height;
+ int x = root.width();
+ int y = root.height();
int w = 0;
int h = 0;
for (int i = 0; i < numregions; i++) {
Modified:
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java
===================================================================
---
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java
2015-05-02 12:35:32 UTC (rev 4787)
+++
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java
2015-05-02 16:30:06 UTC (rev 4788)
@@ -147,7 +147,7 @@
newDim.width = minimumSize.width + leftInset +
rightInset;
}
frame.setSize(newDim);
- blit(backbuffer, leftInset, topInset, leftInset, topInset,
root.width + leftInset, root.height + topInset);
+ blit(backbuffer, leftInset, topInset, leftInset, topInset,
root.width() + leftInset, root.height() + topInset);
// frame.repaint();
}
};
@@ -157,9 +157,9 @@
Rectangle r = gr.getClipBounds();
// ugly hack for Java1.4 dynamicLayout on Win32 -- this
catches expansions during smooth resize
- int newwidth = Math.max(r.x - leftInset + r.width, root.width);
- int newheight = Math.max(r.y - topInset + r.height,
root.height);
- if (newwidth > root.width || newheight > root.height) {
+ int newwidth = Math.max(r.x - leftInset + r.width,
root.width());
+ int newheight = Math.max(r.y - topInset + r.height,
root.height());
+ if (newwidth > root.width() || newheight > root.height()) {
int w = window.getWidth() - leftInset - rightInset;
int h = window.getHeight() - topInset - bottomInset;
AWTSurface.this.componentResized(w, h);
@@ -275,7 +275,7 @@
if (r==null) {
if (blithack) {
blithack = false;
- blit(backbuffer, 0, 0, 0, 0, root.width, root.height);
+ blit(backbuffer, 0, 0, 0, 0, root.width(), root.height());
}
return null;
}
@@ -384,7 +384,7 @@
public void windowClosed(WindowEvent e) { }
public void windowClosing(WindowEvent e) { Close(); }
public void windowIconified(WindowEvent e) { Minimized(true); }
- public void windowDeiconified(WindowEvent e) { window.repaint(0, 0,
root.width, root.height); Minimized(false); }
+ public void windowDeiconified(WindowEvent e) { window.repaint(0, 0,
root.width(), root.height()); Minimized(false); }
public void windowActivated(WindowEvent e) { Focused(true); }
public void windowDeactivated(WindowEvent e) { Focused(false); }
public void componentMoved(ComponentEvent e) {
PosChange(window.getLocation().x, window.getLocation().y); }
@@ -465,7 +465,7 @@
// ugly hack for Java1.4 dynamicLayout on Win32 -- this catches
contractions during smooth resize
int newwidth = window.getWidth() - leftInset - rightInset;
int newheight = window.getHeight() - topInset - bottomInset;
- if (newwidth != root.width || newheight != root.height) {
+ if (newwidth != root.width() || newheight != root.height()) {
componentResized(newwidth, newheight);
}
Modified:
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWTBase.java
===================================================================
---
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWTBase.java
2015-05-02 12:35:32 UTC (rev 4787)
+++
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/AWTBase.java
2015-05-02 16:30:06 UTC (rev 4788)
@@ -501,7 +501,7 @@
newDim.width = minimumSize.width + leftInset +
rightInset;
}
frame.setSize(newDim);
- blit(backbuffer, leftInset, topInset, leftInset, topInset,
root.width + leftInset, root.height + topInset);
+ blit(backbuffer, leftInset, topInset, leftInset, topInset,
root.width() + leftInset, root.height() + topInset);
// frame.repaint();
}
};
@@ -511,9 +511,9 @@
Rectangle r = gr.getClipBounds();
// ugly hack for Java1.4 dynamicLayout on Win32 -- this
catches expansions during smooth resize
- int newwidth = Math.max(r.x - leftInset + r.width, root.width);
- int newheight = Math.max(r.y - topInset + r.height,
root.height);
- if (newwidth > root.width || newheight > root.height) {
+ int newwidth = Math.max(r.x - leftInset + r.width,
root.width());
+ int newheight = Math.max(r.y - topInset + r.height,
root.height());
+ if (newwidth > root.width() || newheight > root.height()) {
int w = window.getWidth() - leftInset - rightInset;
int h = window.getHeight() - topInset - bottomInset;
AWTSurface.this.componentResized(w, h);
@@ -629,7 +629,7 @@
if (r==null) {
if (blithack) {
blithack = false;
- blit(backbuffer, 0, 0, 0, 0, root.width, root.height);
+ blit(backbuffer, 0, 0, 0, 0, root.width(), root.height());
}
return null;
}
@@ -731,7 +731,7 @@
public void windowClosed(WindowEvent e) { }
public void windowClosing(WindowEvent e) { Close(); }
public void windowIconified(WindowEvent e) { Minimized(true); }
- public void windowDeiconified(WindowEvent e) { window.repaint(0, 0,
root.width, root.height); Minimized(false); }
+ public void windowDeiconified(WindowEvent e) { window.repaint(0, 0,
root.width(), root.height()); Minimized(false); }
public void windowActivated(WindowEvent e) { Focused(true); }
public void windowDeactivated(WindowEvent e) { Focused(false); }
public void componentMoved(ComponentEvent e) {
PosChange(window.getLocation().x, window.getLocation().y); }
@@ -812,7 +812,7 @@
// ugly hack for Java1.4 dynamicLayout on Win32 -- this catches
contractions during smooth resize
int newwidth = window.getWidth() - leftInset - rightInset;
int newheight = window.getHeight() - topInset - bottomInset;
- if (newwidth != root.width || newheight != root.height) {
+ if (newwidth != root.width() || newheight != root.height()) {
componentResized(newwidth, newheight);
}
Modified:
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java
===================================================================
---
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java
2015-05-02 12:35:32 UTC (rev 4787)
+++
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java
2015-05-02 16:30:06 UTC (rev 4788)
@@ -449,13 +449,13 @@
}
buf.initGraphics();
- if (pendingWidth < root.width || pendingHeight < root.height) {
+ if (pendingWidth < root.width() || pendingHeight <
root.height()) {
buf.g.setColor(rootcolor);
- if (pendingWidth < root.width) {
- buf.g.fillRect(pendingWidth, 0, root.width,
Math.max(pendingHeight, root.height));
+ if (pendingWidth < root.width()) {
+ buf.g.fillRect(pendingWidth, 0, root.width(),
Math.max(pendingHeight, root.height()));
}
- if (pendingHeight < root.height) {
- buf.g.fillRect(0, pendingHeight,
Math.max(pendingWidth, root.width), root.height);
+ if (pendingHeight < root.height()) {
+ buf.g.fillRect(0, pendingHeight,
Math.max(pendingWidth, root.width()), root.height());
}
}
r = super.render();
@@ -468,15 +468,15 @@
// useful optimisation;
setBackgroundColor();
- int x = root.width;
- int y = root.height;
+ int x = root.width();
+ int y = root.height();
int w = 0;
int h = 0;
final int numregions = r.numregions;
final int[] regions = r.regions;
- final int rwidth = root.width;
- final int rheight = root.height;
+ final int rwidth = root.width();
+ final int rheight = root.height();
// REMARK: whilst in theory only blitting the dirty areas
// would seem more efficient, in practise it results in a
// large slowdown due to a delay in processing each blit,
Modified:
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp
===================================================================
---
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp
2015-05-02 12:35:32 UTC (rev 4787)
+++
branches/vexi3_integrated_layout/org.vexi-core.main/src/main/jpp/org/vexi/core/Box.jpp
2015-05-02 16:30:06 UTC (rev 4788)
@@ -1,4 +1,4 @@
-// Copyright 2000-2011 the Contributors, as shown in the revision logs.
+// Copyright 2000-2015 the Contributors, as shown in the revision logs.
// Licensed under the GNU General Public License version 2 ("the License").
// You may not use this file except in compliance with the License.
@@ -185,24 +185,25 @@
}
}
- protected final Surface getSurface() { return
Surface.fromBox(getRoot(this)); }
- private static final Box getRoot(Box b) { return b.parent == null ? b :
getRoot(b.parent); }
+ private final Box getRoot() { return parent == null ? this :
parent.getRoot(); }
- private static final int getXInParent(Box b) { Box p = b.parent; return
p==null ? 0 : ((p.test(PACK) || p.test(ALIGN_LEFT)) ? b.x :
b.x+((p.width-b.width)/(p.test(ALIGN_RIGHT)?1:2))); }
- private static final int getYInParent(Box b) { Box p = b.parent; return
p==null ? 0 : ((p.test(PACK) || p.test(ALIGN_TOP)) ? b.y :
b.y+((p.height-b.height)/(p.test(ALIGN_BOTTOM)?1:2))); }
- private static final int globalToLocalX(Box b, int x) { return
b.parent==null ? x : globalToLocalX(b.parent, x - getXInParent(b)); }
- private static final int globalToLocalY(Box b, int y) { return
b.parent==null ? y : globalToLocalY(b.parent, y - getYInParent(b)); }
- private static final int localToGlobalX(Box b, int x) { return
b.parent==null ? x : localToGlobalX(b.parent, x + getXInParent(b)); }
- private static final int localToGlobalY(Box b, int y) { return
b.parent==null ? y : localToGlobalY(b.parent, y + getYInParent(b)); }
+ private final int getXInParent() { return parent==null ? 0 :
((parent.test(PACK) || parent.test(ALIGN_LEFT)) ? x :
x+((parent.width-width)/(parent.test(ALIGN_RIGHT)?1:2))); }
+ private final int getYInParent() { return parent==null ? 0 :
((parent.test(PACK) || parent.test(ALIGN_TOP)) ? y :
y+((parent.height-height)/(parent.test(ALIGN_BOTTOM)?1:2))); }
+ private final int globalToLocalX(int x) { return parent==null ? x :
parent.globalToLocalX(x - getXInParent()); }
+ private final int globalToLocalY(int y) { return parent==null ? y :
parent.globalToLocalY(y - getYInParent()); }
+ private final int localToGlobalX(int x) { return parent==null ? x :
parent.localToGlobalX(x + getXInParent()); }
+ private final int localToGlobalY(int y) { return parent==null ? y :
parent.localToGlobalY(y + getYInParent()); }
- // useful debugging reflow problems
- private static final int depth(Box b) { return b.parent==null ? 0 :
depth(b.parent)+1; }
+ // useful debugging
+ //private final int depth() { return parent==null ? 0 : parent.depth()+1; }
+ //private final String name() { try { JS str = get(JSU.S("name")); return
str==null?"null":str.toString(); } catch (JSExn e) { throw new Error(); } }
private static final int min(int a, int b) { return (a<b) ? a : b; }
private static final int max(int a, int b) { return (a>b) ? a : b; }
private final boolean inside(int x, int y) { return test(DISPLAY) && x >=
0 && y >= 0 && x < width && y < height; }
-
+ private final boolean hasText() { return text != EMPTY_STRING; }
+
// TRAPFLAGS helper functions
private final void trap_setclear(int mask, boolean set) { if (set)
set(mask); else clear(mask); }
private final void trap_set(int mask) { trapflags |= mask; }
@@ -214,13 +215,15 @@
final protected void set(int mask) { flags |= mask; }
final private void clear(int mask) { flags &= ~mask; }
final private boolean test(int mask) { return ((flags & mask) == mask); }
+
+
+ // Required by Surface/Platform
/////////////////////////////////////////
+
+ public final int getIntFillcolor() { return fillcolor; }
+ public final Surface getSurface() { return Surface.fromBox(getRoot()); }
- public final int getIntFillcolor() {
- return fillcolor;
- }
-
/** for Surface to set the x/y properties of the root box */
- protected final void setRootPosition(int x, int y) throws JSExn {
+ public final void setRootPosition(int x, int y) throws JSExn {
//#repeat x/y X_TRAP/Y_TRAP
if (x != this.x) {
PUT_BOX_FIELD(SC_x,JSU.N(x),this.x=x,X_TRAP);
@@ -229,12 +232,19 @@
}
/** for Platform/Surface to check if a root box is visible */
- public static final boolean testDisplay(Box b) { return b.test(DISPLAY); }
+ public final boolean display() { return test(DISPLAY); }
/** for Platform/Surface to find out if root box is resizable */
- public static final boolean testShrink(Box b) { return b.test(SHRINK); }
+ public final boolean shrink() { return test(SHRINK); }
+ public final int contentwidth() { return contentwidth; }
+ public final int contentheight() { return contentheight; }
+ public final int x() { return x; }
+ public final int y() { return y; }
+ public final int width() { return width; }
+ public final int height() { return height; }
+
// Flags
//////////////////////////////////////////////////////////////////////
private static final boolean HORIZONTAL = true;
@@ -246,7 +256,7 @@
private static final int VSHRINK = 0x00000008;
private static final int SHRINK = HSHRINK | VSHRINK;
- static final protected int TILE_IMAGE = 0x00000010;
+ protected static final int TILE_IMAGE = 0x00000010;
private static final int CURSOR = 0x00000020;
private static final int MOUSEINSIDE = 0x00000040;
private static final int MOUSEINSIDE_BLOCKED = 0x00000080;
@@ -378,14 +388,14 @@
private BasicTree bt = null;
// rendering properties
- int fontsize = 0;
- int fillcolor = DEFAULT_FILLCOLOR;
- int textcolor = DEFAULT_COLOR;
- int textwidth = 0;
- int textheight = 0;
- Font font = DEFAULT_FONT;
- JSString text = EMPTY_STRING;
- Texture texture = null;
+ private int fontsize = 0;
+ private int fillcolor = DEFAULT_FILLCOLOR;
+ private int textcolor = DEFAULT_COLOR;
+ private int textwidth = 0;
+ private int textheight = 0;
+ private Font font = DEFAULT_FONT;
+ private JSString text = EMPTY_STRING;
+ protected Texture texture = null;
// FEATURE: path support
//private Path path = null;
@@ -400,18 +410,18 @@
protected static int MAX_DIMENSION = Short.MAX_VALUE;
// specified directly by user
- protected int minwidth = 0;
- protected int maxwidth = MAX_DIMENSION;
- protected int minheight = 0;
- protected int maxheight = MAX_DIMENSION;
+ private int minwidth = 0;
+ private int maxwidth = MAX_DIMENSION;
+ private int minheight = 0;
+ private int maxheight = MAX_DIMENSION;
// computed during reflow
- protected int x = 0;
- protected int y = 0;
- public int width = 0;
- public int height = 0;
- protected int contentwidth = 0; // == min(maxwidth, max(minwidth,
textwidth, sum(child.contentwidth)))
- protected int contentheight = 0;
+ private int x = 0;
+ private int y = 0;
+ private int width = 0;
+ private int height = 0;
+ private int contentwidth = 0; // == min(maxwidth, max(minwidth, textwidth,
sum(child.contentwidth)))
+ private int contentheight = 0;
// Instance Methods
/////////////////////////////////////////////////////////////////////
@@ -460,8 +470,8 @@
return;
}
// go again relative to parent
- x += getXInParent(cur);
- y += getYInParent(cur);
+ x += cur.getXInParent();
+ y += cur.getYInParent();
}
}
@@ -1074,8 +1084,8 @@
/** renders self and children within the specified region; all rendering
operations are clipped to xIn,yIn,wIn,hIn */
public void render(int parentx, int parenty, int cx1, int cy1, int cx2,
int cy2, PixelBuffer buf) {
- int globalx = parentx + getXInParent(this);
- int globaly = parenty + getYInParent(this);
+ int globalx = parentx + getXInParent();
+ int globaly = parenty + getYInParent();
// intersect the x,y,w,h rendering window with ourselves; quit if it's
empty
cx1 = max(cx1, globalx);
@@ -1482,13 +1492,8 @@
textwidth = iwidth > Short.MAX_VALUE ? Short.MAX_VALUE : (short)iwidth;
textheight = iheight > Short.MAX_VALUE ? Short.MAX_VALUE :
(short)iheight;
}
-
-
- //////// INSTANCE FUNCTIONS ///////////////////////////////////////
- boolean hasText() { return text != EMPTY_STRING; }
-
// Input event handling ///////////////////////////////////////////
/** initiate a move event - should only ever be invoked by surface or
inputevent */
@@ -1567,8 +1572,8 @@
b.propagateLeave();
continue;
}
- int b_mx = mousex-getXInParent(b);
- int b_my = mousey-getYInParent(b);
+ int b_mx = mousex-b.getXInParent();
+ int b_my = mousey-b.getYInParent();
if (b.inside(b_mx, b_my)) {
if (b.propagateMove(b_mx, b_my)) {
interrupted = true;
@@ -1588,8 +1593,8 @@
b.propagateLeave();
continue;
}
- int b_mx = mousex-getXInParent(b);
- int b_my = mousey-getYInParent(b);
+ int b_mx = mousex-b.getXInParent();
+ int b_my = mousey-b.getYInParent();
if (b.inside(b_mx, b_my)) {
packedhit = true;
if (b.propagateMove(b_mx, b_my)) {
@@ -1677,8 +1682,8 @@
if (!test(PACK)) {
// absolute layout - check all children
for (Box b = getChild(i=treeSize()-1); b != null; b =
getChild(--i)) {
- int b_mx = mousex-getXInParent(b);
- int b_my = mousey-getYInParent(b);
+ int b_mx = mousex-b.getXInParent();
+ int b_my = mousey-b.getYInParent();
if (b.inside(b_mx, b_my)) {
if (b.propagateEvent(event, _event, value, b_mx, b_my)) {
return true;
@@ -1753,10 +1758,10 @@
* @group(y) */
case "x":
Surface s = getSurface();
- return JSU.N(globalToLocalX(Box.this, s==null ? 0 :
getSurface().getMouseX()));
+ return JSU.N(Box.this.globalToLocalX(s==null ? 0 :
getSurface().getMouseX()));
case "y":
Surface s = getSurface();
- return JSU.N(globalToLocalY(Box.this, s==null ? 0 :
getSurface().getMouseY()));
+ return JSU.N(Box.this.globalToLocalY(s==null ? 0 :
getSurface().getMouseY()));
//#end
return super.get(key);
}
@@ -1796,8 +1801,8 @@
*
* @group(y)
* @type(Number) */
- case "x": return JSU.N(localToGlobalX(to, 0) -
localToGlobalX(from, 0));
- case "y": return JSU.N(localToGlobalY(to, 0) -
localToGlobalY(from, 0));
+ case "x": return JSU.N(to.localToGlobalX(0) -
from.localToGlobalX(0));
+ case "y": return JSU.N(to.localToGlobalY(0) -
from.localToGlobalY(0));
//#end
return super.get(key);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn