|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sub_arctic.text.paragraph
This class the internal representation of a paragraph that is part of a text editor. This paragraph has several important invariants: 1) It contains no (hard) carriage returns. Paragraphs are created when the user hits the enter (c/r) key, so this object does not contain this character. 2) This object can shift itself in x or y without affecting its contents or their state. 3) If the cursor is present in the list of runs (see below) it is always either the first object in the list of runs or its is immediately to the right (the successor) of a text_run. This class retains a linked list of objects which are its "runs". These runs are the raw text data which it is displaying, and possibly markers within that data (such as the current selection start, end point and the cursor). It also maintains a vector of rectangles. This vector of rectangles represents all the pixels in its screen area. When this paragraph gets clicked on, it consults its list of rectangles to find the one which was actually moused on. Once that is discovered, the rectangle is "mapped back" to the run which it represents to determine what text object was clicked on. The runs are what the user edits, not the rectangles. The rectangles are generated from the runs as needed.
Field Summary | |
protected java.util.Vector |
_display_list
This is where we store the current list of rectangles for display. |
protected int |
_height
This is the height of this paragraph. |
protected run |
_run_list_head
This is the head of list of runs in this object. |
protected int |
_width
This is the width of this paragraph, in pixels. |
Constructor Summary | |
paragraph()
Constructor for a paragraph. |
Method Summary | |
linebreak |
break_word(text_run current_run,
int current_position)
This is the function that actually breaks a word out of the list of runs. |
void |
do_layout(int width)
This is the routine that actually performs the layout. |
void |
draw_self_local(drawable d)
Blit the current list of rectangles onto the screen. |
void |
dump_words(java.util.Vector v)
Dump out a list of words in a vector. |
int |
height()
Return the height of this object (in pixels) following a layout. |
int |
last_character(word w)
This function returns the next character from the last run of a word. |
text_run |
last_run(word w)
This function returns the last run from a word. |
int |
next_index(int old,
boolean noinc)
This function returns a new value from an old one. |
text_run |
next_text_run(run r)
This function finds the next text_run successor of a given run. |
java.util.Vector |
place_words(java.util.Vector words,
int width)
This is the process of placing each of the words. |
screen_rect |
rect_covering_point(int x,
int y)
This function takes a screen coordinate and maps it to a screen rect. |
run |
run_list_head()
Return the first object in the list of runs. |
int |
width()
Return the width of this paragraph in pixels. |
void |
xxx_bogus_init()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected run _run_list_head
protected int _height
protected int _width
protected java.util.Vector _display_list
Constructor Detail |
public paragraph()
Method Detail |
public run run_list_head()
public int height()
public int width()
public linebreak break_word(text_run current_run, int current_position)
text_run
- current_run the current run we are working onint
- current_position the current_location within the runpublic text_run next_text_run(run r)
public void do_layout(int width)
int
- width the layout width of this paragraphpublic int next_index(int old, boolean noinc)
int
- old value the previous value of the counterboolean
- noinc true if we should not incrementpublic java.util.Vector place_words(java.util.Vector words, int width)
Vector
- words a vector of all the wordsint
- width how many pixels of space do we have. We actually
use all the pixels in this space.public void dump_words(java.util.Vector v)
public void xxx_bogus_init()
public int last_character(word w)
public text_run last_run(word w)
public void draw_self_local(drawable d)
drawable
- d the drawable surface to draw onpublic screen_rect rect_covering_point(int x, int y)
int
- x the x coord to check (in our coordinate system)int
- y the y coord to check (in our coordinate system)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |