36 |
/** A cell content view showing a cell's text. |
/** A cell content view showing a cell's text. |
37 |
*/ |
*/ |
38 |
|
|
39 |
public class TextCellContentView implements CellContentView { |
public class TextCellContentView extends CellContentView { |
40 |
public static final String rcsid = "$Id$"; |
public static final String rcsid = "$Id$"; |
41 |
public static boolean dbg = false; |
public static boolean dbg = false; |
42 |
private static void p(String s) { if(dbg) pa(s); } |
private static void p(String s) { if(dbg) pa(s); } |
52 |
} |
} |
53 |
|
|
54 |
public void place(Cell c, VobScene v, Box box, |
public void place(Cell c, VobScene v, Box box, |
55 |
ViewContext context, float scale) { |
ViewContext context) { |
56 |
String s = c.t(); |
String s = c.t(); |
57 |
if (s == null) s = ""; |
if (s == null) s = ""; |
58 |
int offs = context.getCursorOffset(c); |
int offs = context.getCursorOffset(c); |
73 |
offs -= brBefore; |
offs -= brBefore; |
74 |
center -= brBefore; |
center -= brBefore; |
75 |
|
|
76 |
|
float scale = 1; // XXX use getFontSize |
77 |
|
|
78 |
float width = style.getWidth(s, scale); |
float width = style.getWidth(s, scale); |
79 |
float left = style.getWidth(s.substring(0, center), scale); |
float left = style.getWidth(s.substring(0, center), scale); |
80 |
float right = width - left; |
float right = width - left; |