projects
/
org.ibex.core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d8ee62e
)
2003/09/16 05:02:44
author
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 07:35:37 +0000
(07:35 +0000)
committer
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 07:35:37 +0000
(07:35 +0000)
darcs-hash:
20040130073537
-2ba56-
5405dea7567ab1a55983d4c0fe04be391d688b7c
.gz
Makefile
patch
|
blob
|
history
src/org/xwt/Box.java.pp
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index
e38135e
..
73093fe
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-49,7
+49,7
@@
all_java_sources := $(patsubst src/%.java, build/java/%.java, $(shell find
all_java_sources += $(patsubst src/%.java.pp, build/java/%.java, $(shell find src -name '*.java.pp'))
superclass_org.xwt.plat.Platform:;
all_java_sources += $(patsubst src/%.java.pp, build/java/%.java, $(shell find src -name '*.java.pp'))
superclass_org.xwt.plat.Platform:;
-ifeq ($(platform),)
+ifneq ($(platform),)
plat_deps := $(shell make -s superclass_org.xwt.plat.$(platform) platform= )
endif
plat_deps := $(shell make -s superclass_org.xwt.plat.$(platform) platform= )
endif
diff --git
a/src/org/xwt/Box.java.pp
b/src/org/xwt/Box.java.pp
index
50ef309
..
959deff
100644
(file)
--- a/
src/org/xwt/Box.java.pp
+++ b/
src/org/xwt/Box.java.pp
@@
-204,7
+204,11
@@
public final class Box extends JS.Scope {
/** Checks if the Box's size has changed, dirties it if necessary, and makes sure childrens' sizes are up to date */
void repack() {
if (!needs_reflow) return;
/** Checks if the Box's size has changed, dirties it if necessary, and makes sure childrens' sizes are up to date */
void repack() {
if (!needs_reflow) return;
- if (numChildren() == 0) { contentwidth = minwidth; contentheight = minheight; return; }
+ if (numChildren() == 0) {
+ contentwidth = max(textwidth, minwidth);
+ contentheight = max(textheight, minheight);
+ return;
+ }
// --- Phase 0 ----------------------------------------------------------------------
// recurse
// --- Phase 0 ----------------------------------------------------------------------
// recurse
@@
-393,7
+397,7
@@
public final class Box extends JS.Scope {
if (tile) renderTiledImage(globalx, globaly, clipx, clipy, clipw, cliph, buf);
else renderStretchedImage(globalx, globaly, clipx, clipy, clipw, cliph, buf);
if (tile) renderTiledImage(globalx, globaly, clipx, clipy, clipw, cliph, buf);
else renderStretchedImage(globalx, globaly, clipx, clipy, clipw, cliph, buf);
- //if (text != null && !text.equals("")) renderText(x, y, w, h, buf);
+ if (text != null && !text.equals("")) renderText(x, y, clipx, clipy, clipw, cliph, buf);
// now subtract the pad region from the clip region before proceeding
clipw = min(max(clipx, globalx + hpad) + clipw, globalx + width - hpad) - clipx;
// now subtract the pad region from the clip region before proceeding
clipw = min(max(clipx, globalx + hpad) + clipw, globalx + width - hpad) - clipx;
@@
-445,11
+449,21
@@
public final class Box extends JS.Scope {
}
}
}
}
- void renderText(int x, int y, int w, int h, DoubleBuffer buf) {
- /*
- if ((textcolor & 0xFF000000) == 0x00000000) return;
- buf.setClip(x, y, w + x, h + y);
+ void renderText(int x, int y, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) {
+
+ Log.log(this, "rendering text: " + text);
+ //buf.setClip(clipx, clipy, clipw, cliph);
+ try {
+ ImageDecoder id = org.xwt.imp.Font.render(new FileInputStream("COMIC.TTF"), 24, text);
+ Picture p = Platform.createPicture(id);
+ buf.drawPicture(p, x, y);
+ buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
+ } catch (Exception e) {
+ Log.log(this, e);
+ }
+
+ /*
buf.drawString(font(), text, x + hpad, y + vpad + Platform.getMaxAscent(font()) - 1, textcolor);
buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
int i=0; while(i<font().length() && !Character.isDigit(font().charAt(i))) i++;
buf.drawString(font(), text, x + hpad, y + vpad + Platform.getMaxAscent(font()) - 1, textcolor);
buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
int i=0; while(i<font().length() && !Character.isDigit(font().charAt(i))) i++;
@@
-467,7
+481,7
@@
public final class Box extends JS.Scope {
y + vpad + (xwf == null ? Platform.getMaxAscent(font()) : xwf.getMaxAscent()) + 2 + 1,
textcolor);
}
y + vpad + (xwf == null ? Platform.getMaxAscent(font()) : xwf.getMaxAscent()) + 2 + 1,
textcolor);
}
- */
+ */
}
}
@@
-970,7
+984,20
@@
public final class Box extends JS.Scope {
public void put(Box b, Object value) {
String t = value == null ? "null" : value.toString();
if (t.equals(b.text)) return;
public void put(Box b, Object value) {
String t = value == null ? "null" : value.toString();
if (t.equals(b.text)) return;
- // FIXME text is broken
+ b.text = t;
+ if (t == null) {
+ b.textwidth = b.textheight = 0;
+ } else {
+ try {
+ ImageDecoder id = org.xwt.imp.Font.render(new FileInputStream("COMIC.TTF"), 24, b.text);
+ b.textwidth = id.getWidth();
+ b.textheight = id.getHeight();
+ } catch (Exception e) {
+ Log.log(this, e);
+ }
+ }
+ b.dirty();
+ MARK_FOR_REFLOW_b;
} });
specialBoxProperties.put("font", new SpecialBoxProperty() {
public Object get(Box b) { return b.font; }
} });
specialBoxProperties.put("font", new SpecialBoxProperty() {
public Object get(Box b) { return b.font; }