52 |
|
|
53 |
static Object CONTENT_KEY = new Object(); |
static Object CONTENT_KEY = new Object(); |
54 |
static Object BOX_KEY = new Object(); |
static Object BOX_KEY = new Object(); |
55 |
static TextStyle style = |
static Object UNCLIP = new Object(); |
56 |
GraphicsAPI.getInstance().getTextStyle("SansSerif", Font.PLAIN, 10); |
|
57 |
|
static Rectangle rect = new Rectangle(); |
58 |
|
static float[] boxwh = new float[2]; |
59 |
|
|
|
//CellContentView ccv = new TextCellContentView(style); |
|
|
//CellContentView ccv = new SpanCellContentView(style); |
|
|
//CellContentView ccv = new LinebrokenCellContentView(style); |
|
|
|
|
|
/** The ccv to use, if any. XXX hack for demo, remove |
|
|
*/ |
|
|
CellContentView cellContentView = null; // use viewcontext's by default |
|
|
public BoxCellView() {} |
|
|
public BoxCellView(CellContentView ccv) { cellContentView = ccv; } |
|
|
|
|
60 |
Dim d_clone; |
Dim d_clone; |
|
/* |
|
|
Dim d_cursor; |
|
|
Dim d_spaces; |
|
|
Dim d_mark; |
|
|
*/ |
|
|
|
|
|
// CompoundSpace space; |
|
|
|
|
|
/** @see #getSliceId. |
|
|
* To be compared using == |
|
|
**/ |
|
|
Object sliceId = null; |
|
61 |
|
|
62 |
public void setSpace(Space s) { |
public void setSpace(Space s) { |
63 |
d_clone = s.getCloneDim(); |
d_clone = s.getCloneDim(); |
|
/* |
|
|
d_cursor = s.getDim(Dims.d_cursor_id); |
|
|
d_spaces = s.getDim(Dims.d_spaces_id); |
|
|
d_mark = s.getDim(Dims.d_mark_id); |
|
|
*/ |
|
|
/* |
|
|
if(s instanceof CompoundSpace) |
|
|
space = (CompoundSpace)s; |
|
|
*/ |
|
64 |
} |
} |
65 |
|
|
66 |
Cell center; |
Cell center; |
68 |
if(center == this.center || center.equals(this.center)) return; |
if(center == this.center || center.equals(this.center)) return; |
69 |
this.center = center; |
this.center = center; |
70 |
setSpace(center.space); |
setSpace(center.space); |
|
sliceId = getSliceId(center); |
|
71 |
} |
} |
72 |
|
|
73 |
public void getSize(Cell c, float scale, float[] into) { |
public void getSize(Cell c, float scale, ViewContext context, |
74 |
into[0] = style.getWidth("XXXXXXXXXX", scale)/scale+10; |
float[] into) { |
75 |
into[1] = style.getHeight(scale)/scale + 10; |
context.getCellContentView().getSize(c, scale, context, into); |
76 |
|
into[0] += 10; |
77 |
|
into[1] += 10; |
78 |
} |
} |
79 |
|
|
|
static Object UNCLIP = new Object(); |
|
|
|
|
|
/** Get an Id for the slice this Cell is in. |
|
|
* Iff getSliceId(c).equals(getSliceId(d)), c and d are in the same slice. |
|
|
*/ |
|
|
public Object getSliceId(Cell c) { |
|
|
return null; |
|
|
/* |
|
|
if(space == null) return null; |
|
|
return space.getSpace(c); |
|
|
*/ |
|
|
} |
|
|
|
|
|
static Rectangle rect = new Rectangle(); |
|
|
|
|
|
float[] boxwh = new float[2]; |
|
|
|
|
80 |
public void place(final Cell c, final VobScene vs, |
public void place(final Cell c, final VobScene vs, |
81 |
final int box, |
final int box, |
82 |
final ViewContext context) { |
final ViewContext context) { |
84 |
if(d_clone == null) |
if(d_clone == null) |
85 |
throw new NullPointerException("clone dim not set in BoxCellView"); |
throw new NullPointerException("clone dim not set in BoxCellView"); |
86 |
|
|
87 |
final CellInBox ccv = |
final CellInBox ccv = context.getCellContentView(); |
|
cellContentView != null ? cellContentView : context.getCellContentView(); |
|
88 |
|
|
89 |
final RectBgVob bg = new RectBgVob(); |
final RectBgVob bg = new RectBgVob(); |
90 |
|
|
101 |
if (context.isMarked(c)) // if marked |
if (context.isMarked(c)) // if marked |
102 |
bg.addColor(new Color(0xff0000)); |
bg.addColor(new Color(0xff0000)); |
103 |
|
|
|
Object sliceId2 = getSliceId(c); |
|
|
if((sliceId==null && sliceId2!=null) |
|
|
|| (sliceId != null && !sliceId.equals(sliceId2)) |
|
|
) { // if different slice |
|
|
bg.setBg(bg.getBg().darker().darker()); |
|
|
} |
|
|
|
|
104 |
float pad = 5; |
float pad = 5; |
105 |
|
|
106 |
vs.coords.getSqSize(box, boxwh); |
vs.coords.getSqSize(box, boxwh); |