mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
add java version of new crosshairs flags; draw crosshairs 1/3
width/height of cells instead of reusing focus code to color background.
This commit is contained in:
parent
d44b08b609
commit
ac022ea5a5
2 changed files with 22 additions and 3 deletions
|
@ -445,8 +445,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean drawCell( Rect rect, String text, int tile, int owner,
|
public boolean drawCell( final Rect rect, String text, int tile, int owner,
|
||||||
int bonus, int hintAtts, int flags )
|
int bonus, int hintAtts, final int flags )
|
||||||
{
|
{
|
||||||
int backColor;
|
int backColor;
|
||||||
boolean empty = 0 != (flags & (CELL_DRAGSRC|CELL_ISEMPTY));
|
boolean empty = 0 != (flags & (CELL_DRAGSRC|CELL_ISEMPTY));
|
||||||
|
@ -500,6 +500,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
// frame the cell
|
// frame the cell
|
||||||
m_canvas.drawRect( rect, m_strokePaint );
|
m_canvas.drawRect( rect, m_strokePaint );
|
||||||
|
|
||||||
|
drawCrosshairs( rect, flags );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // drawCell
|
} // drawCell
|
||||||
|
@ -779,6 +781,21 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawCrosshairs( final Rect rect, final int flags )
|
||||||
|
{
|
||||||
|
int color = m_otherColors[CommonPrefs.COLOR_FOCUS];
|
||||||
|
if ( 0 != (flags & CELL_CROSSHOR) ) {
|
||||||
|
Rect hairRect = new Rect( rect );
|
||||||
|
hairRect.inset( 0, hairRect.height() / 3 );
|
||||||
|
fillRect( hairRect, color );
|
||||||
|
}
|
||||||
|
if ( 0 != (flags & CELL_CROSSVERT) ) {
|
||||||
|
Rect hairRect = new Rect( rect );
|
||||||
|
hairRect.inset( hairRect.width() / 3, 0 );
|
||||||
|
fillRect( hairRect, color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void fillRect( Rect rect, int color )
|
private void fillRect( Rect rect, int color )
|
||||||
{
|
{
|
||||||
m_fillPaint.setColor( color );
|
m_fillPaint.setColor( color );
|
||||||
|
|
|
@ -31,7 +31,9 @@ public interface DrawCtx {
|
||||||
static final int CELL_VALHIDDEN = 0x20; /* show letter only, not value */
|
static final int CELL_VALHIDDEN = 0x20; /* show letter only, not value */
|
||||||
static final int CELL_DRAGSRC = 0x40; /* where drag originated */
|
static final int CELL_DRAGSRC = 0x40; /* where drag originated */
|
||||||
static final int CELL_DRAGCUR = 0x80; /* where drag is now */
|
static final int CELL_DRAGCUR = 0x80; /* where drag is now */
|
||||||
static final int CELL_ALL = 0xFF;
|
static final int CELL_CROSSVERT = 0x100;
|
||||||
|
static final int CELL_CROSSHOR = 0x200;
|
||||||
|
static final int CELL_ALL = 0x3FF;
|
||||||
|
|
||||||
/* BoardObjectType */
|
/* BoardObjectType */
|
||||||
static final int OBJ_NONE = 0;
|
static final int OBJ_NONE = 0;
|
||||||
|
|
Loading…
Reference in a new issue