|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.chat.ChatOverlay
com.threerings.chat.SubtitleChatOverlay
com.threerings.chat.ComicChatOverlay
public class ComicChatOverlay
Implements comic chat in the yohoho client.
| Nested Class Summary | |
|---|---|
protected static class |
ComicChatOverlay.BubbleGlyph
A glyph of a particlar chat bubble |
| Nested classes/interfaces inherited from class com.threerings.chat.ChatOverlay |
|---|
ChatOverlay.InfoProvider |
| Field Summary | |
|---|---|
protected List<ComicChatOverlay.BubbleGlyph> |
_bubbles
The currently displayed bubble areas. |
protected int |
_newPlacePoint
The place in our history at which we last entered a new place. |
protected static Color[] |
BACKGROUNDS
The background colors to use when drawing bubbles. |
protected static int |
BUBBLE_SPACING
The space we force between adjacent bubbles. |
protected static double |
GOLDEN
The golden ratio. |
protected static int |
MAX_BUBBLES
The maximum number of bubbles to show. |
protected static int |
MAX_BUBBLES_PER_USER
The maximum number of bubbles to show per user. |
protected static int |
MINIMUM_SPLIT_WIDTH
The minimum width of a bubble's label before we consider splitting lines. |
protected static int |
SPEAKER_DISTANCE
The distance to stay from the speaker. |
protected static int |
TAIL_WIDTH
The width of the end of the tail. |
| Fields inherited from class com.threerings.chat.SubtitleChatOverlay |
|---|
_histOffset, _histOffsetFinal, _history, _historyExtent, _historyModel, _laidout, _lastExpire, _overrideHistory, _scrollbar, _showingHistory, _subtitleHeight, _subtitles, _subtitlesFill, _subtitleXSpacing, _subtitleYSpacing, ICON_PADDING, PAD, SUBTITLE_HEIGHT_GUESS |
| Fields inherited from class com.threerings.chat.ChatOverlay |
|---|
_ctx, _dimmed, _logic, _provider, _target |
| Constructor Summary | |
|---|---|
ComicChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar historyBar,
int subtitleHeight)
Construct a comic chat overlay. |
|
| Method Summary | |
|---|---|
protected Point |
adjustLabel(int type,
Point labelpos)
Position the label based on the type. |
void |
clear()
|
protected void |
clearBubbles(boolean all)
Clear chat bubbles, either all of them or just the place-oriented ones. |
protected boolean |
createBubble(Graphics2D gfx,
int type,
long timestamp,
String text,
Name speaker,
Point speakerloc)
Create a chat bubble with the specified type and text. |
protected void |
displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
int type,
Graphics2D layoutGfx)
Display the message after we've decided which type it is. |
protected List<ComicChatOverlay.BubbleGlyph> |
getAndExpireBubbles(Name speaker)
Expire a bubble, if necessary, and return the old bubbles for the specified speaker. |
protected List<Shape> |
getAvoidList(Name speaker)
Return a list of rectangular areas that we should avoid while laying out a bubble for the specified speaker. |
protected Shape |
getBubbleShape(int type,
Rectangle r)
Get the appropriate shape for the specified type of chat. |
protected Rectangle |
getBubbleSize(int type,
Dimension d)
Calculate the size of the chat bubble based on the dimensions of the label and the type of chat. |
protected int |
getDisplayDurationOffset()
A hack to allow subtitle chat to display longer and comic chat to display for a normal duration. |
protected int |
getGoldenLabelHeight(Dimension d)
Given the specified label dimensions, attempt to find the height that will give us the width/height ratio that is closest to the golden ratio. |
protected Rectangle |
getRectWithOlds(Rectangle r,
List<ComicChatOverlay.BubbleGlyph> oldbubs)
Get a rectangle based on the old bubbles, but with room for the new one. |
protected Shape |
getTail(int type,
Rectangle r,
Point speaker)
Create a tail to the specified rectangular area from the speaker point. |
protected void |
glyphExpired(ChatGlyph glyph)
Called by a chat glyph when it has determined that it is expired. |
void |
historyUpdated(int adjustment)
|
protected boolean |
isApprovedLocalType(String localtype)
Check to see if we want to display the specified localtype. |
protected boolean |
isPlaceOrientedType(int type)
Is the type of chat place-oriented. |
void |
layout()
Layout the chat overlay inside the previously configured target component. |
protected Label |
layoutText(Graphics2D gfx,
Font font,
String text)
Get a label formatted as close to the golden ratio as possible for the specified text and given the standard padding we use on all bubbles. |
void |
newPlaceEntered(ChatOverlay.InfoProvider provider)
Callback from the target that the place has changed and we are to now talk to the new info provider. |
protected void |
positionRectIdeally(Rectangle r,
int type,
Point speaker)
Position the rectangle in its ideal location given the type and speaker positon (which may be null). |
void |
removed()
Indicates that the target component was removed from the widget hier. |
void |
setDimmed(boolean dimmed)
Set the dimmed mode of the currently displaying glyphs. |
protected boolean |
shouldShowFromHistory(com.threerings.crowd.chat.data.ChatMessage msg,
int index)
We're looking through history to figure out what messages we should be showing, should we show the following? |
void |
speakerDeparted(Name speaker)
Should be called when a speaker departs the chat area to allow the overlay to clean up. |
protected String |
splitNear(String text,
int pos)
Split the text at the space nearest the specified location. |
void |
viewDidScroll(int dx,
int dy)
Called if our containing media panel scrolled its view. |
| Methods inherited from class com.threerings.chat.SubtitleChatOverlay |
|---|
added, addSubtitle, clearGlyphs, createHistorySubtitle, createSubtitle, createSubtitle, displayMessage, displayMessage, figureCurrentHistory, figureHistoryOffset, getChatExpire, getHistorySubtitle, getHistorySubtitleSpacing, getTargetGraphics, getType, isHistoryMode, isLaidOut, resetHistoryOffset, scrollUpSubtitles, setHistoryEnabled, stateChanged, updateDimmed, updateHistBar, viewDidScroll |
| Methods inherited from class com.threerings.chat.ChatOverlay |
|---|
getTarget, isShowing, placeExited, setVisible, xlate, xlate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int _newPlacePoint
protected List<ComicChatOverlay.BubbleGlyph> _bubbles
protected static final int MINIMUM_SPLIT_WIDTH
protected static final double GOLDEN
protected static final int BUBBLE_SPACING
protected static final int SPEAKER_DISTANCE
protected static final int TAIL_WIDTH
protected static final int MAX_BUBBLES
protected static final int MAX_BUBBLES_PER_USER
protected static final Color[] BACKGROUNDS
| Constructor Detail |
|---|
public ComicChatOverlay(com.threerings.crowd.util.CrowdContext ctx,
ChatLogic logic,
JScrollBar historyBar,
int subtitleHeight)
subtitleHeight - the amount of vertical space to use for subtitles.| Method Detail |
|---|
public void newPlaceEntered(ChatOverlay.InfoProvider provider)
ChatOverlay
newPlaceEntered in class ChatOverlaypublic void layout()
ChatOverlay
layout in class SubtitleChatOverlaypublic void removed()
ChatOverlay
removed in class SubtitleChatOverlaypublic void clear()
clear in interface com.threerings.crowd.chat.client.ChatDisplayclear in class SubtitleChatOverlay
public void viewDidScroll(int dx,
int dy)
ChatOverlay
viewDidScroll in class SubtitleChatOverlaypublic void setDimmed(boolean dimmed)
ChatOverlay
setDimmed in class SubtitleChatOverlaypublic void speakerDeparted(Name speaker)
ChatOverlay
speakerDeparted in class ChatOverlaypublic void historyUpdated(int adjustment)
historyUpdated in interface com.threerings.crowd.chat.client.HistoryList.ObserverhistoryUpdated in class SubtitleChatOverlayprotected void clearBubbles(boolean all)
protected boolean shouldShowFromHistory(com.threerings.crowd.chat.data.ChatMessage msg,
int index)
SubtitleChatOverlay
shouldShowFromHistory in class SubtitleChatOverlayprotected boolean isApprovedLocalType(String localtype)
SubtitleChatOverlay
isApprovedLocalType in class SubtitleChatOverlayprotected boolean isPlaceOrientedType(int type)
protected void displayMessage(com.threerings.crowd.chat.data.ChatMessage message,
int type,
Graphics2D layoutGfx)
SubtitleChatOverlay
displayMessage in class SubtitleChatOverlay
protected String splitNear(String text,
int pos)
protected boolean createBubble(Graphics2D gfx,
int type,
long timestamp,
String text,
Name speaker,
Point speakerloc)
speakerloc - if non-null, specifies that a tail should be added which points to that
location.
protected Rectangle getBubbleSize(int type,
Dimension d)
protected Point adjustLabel(int type,
Point labelpos)
protected void positionRectIdeally(Rectangle r,
int type,
Point speaker)
protected Rectangle getRectWithOlds(Rectangle r,
List<ComicChatOverlay.BubbleGlyph> oldbubs)
protected Shape getBubbleShape(int type,
Rectangle r)
protected Shape getTail(int type,
Rectangle r,
Point speaker)
protected List<ComicChatOverlay.BubbleGlyph> getAndExpireBubbles(Name speaker)
protected void glyphExpired(ChatGlyph glyph)
SubtitleChatOverlay
glyphExpired in class SubtitleChatOverlay
protected Label layoutText(Graphics2D gfx,
Font font,
String text)
protected int getGoldenLabelHeight(Dimension d)
protected List<Shape> getAvoidList(Name speaker)
protected int getDisplayDurationOffset()
SubtitleChatOverlay
getDisplayDurationOffset in class SubtitleChatOverlay
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||