source: trunk/src/org/expeditee/gio/TextLayoutManager.java@ 1415

Last change on this file since 1415 was 1415, checked in by bln4, 5 years ago

Renamed Frame.getItems() to Frame.getSortedItems() to better represent its functionality.

-> org.apollo.ApolloGestureActions
-> org.apollo.ApolloSystem
-> org.expeditee.actions.Actions
-> org.expeditee.actions.Debug
-> org.expeditee.actions.ExploratorySearchActions
-> org.expeditee.actions.JfxBrowserActions
-> org.expeditee.actions.Misc
-> org.expeditee.actions.Navigation
-> org.expeditee.actions.ScriptBase
-> org.expeditee.actions.Simple
-> org.expeditee.agents.ComputeTree
-> org.expeditee.agents.CopyTree
-> org.expeditee.agents.DisplayComet
-> org.expeditee.agents.DisplayTree
-> org.expeditee.agents.DisplayTreeLeaves
-> org.expeditee.agents.GraphFramesetLinks
-> org.expeditee.agents.TreeProcessor
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.DisplayController
-> org.expeditee.gui.FrameCreator
-> org.expeditee.gui.FrameIO
-> org.expeditee.io.DefaultTreeWriter
-> org.expeditee.io.JavaWriter
-> org.expeditee.io.PDF2Writer
-> org.expeditee.io.TXTWriter
-> org.expeditee.io.WebParser
-> org.expeditee.io.flowlayout.XGroupItem
-> org.expeditee.items.Dot
-> org.expeditee.items.Item
-> org.expeditee.items.ItemUtils
-> org.expeditee.network.FrameShare
-> org.expeditee.stats.TreeStats


Created ItemsList class to wrap ArrayList<Item>. Frames now use this new class to store its body list (used for display) as well as its primaryBody and surrogateBody.

-> org.expeditee.agents.Format
-> org.expeditee.agents.HFormat
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.Frame
-> org.expeditee.gui.FrameUtils


Refactorted Frame.setResort(bool) to Frame.invalidateSorted() to better function how it is intended to with a more accurate name.

-> org.expeditee.agents.Sort


When writing out .exp files and getting attributes to respond to LEFT + RIGHT click, boolean items are by default true. This has always been the case. An ammendment to this is that defaults can now be established.
Also added 'EnterClick' functionality. If cursored over a item with this property and you press enter, it acts as if you have clicked on it instead.

-> org.expeditee.assets.resources-public.framesets.authentication.1.exp to 6.exp
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gio.input.KBMInputEvent
-> org.expeditee.gio.javafx.JavaFXConversions
-> org.expeditee.gio.swing.SwingConversions
-> org.expeditee.gui.AttributeUtils
-> org.expeditee.io.Conversion
-> org.expeditee.io.DefaultFrameWriter
-> org.expeditee.items.Item


Fixed a bug caused by calling Math.abs on Integer.MIN_VALUE returning unexpected result. Due to zero being a thing, you cannot represent Math.abs(Integer.MIN_VALUE) in a Integer object. The solution is to use Integer.MIN_VALUE + 1 instead of Integer.MIN_VALUE.

-> org.expeditee.core.bounds.CombinationBounds
-> org.expeditee.io.flowlayout.DimensionExtent


Recoded the contains function in EllipticalBounds so that intersection tests containing circles work correctly.

-> org.expeditee.core.bounds.EllipticalBounds


Added toString() to PolygonBounds to allow for useful printing during debugging.

-> org.expeditee.core.bounds.PolygonBounds

Implemented Surrogate Mode!

-> org.expeditee.encryption.io.EncryptedExpReader
-> org.expeditee.encryption.io.EncryptedExpWriter
-> org.expeditee.encryption.items.surrogates.EncryptionDetail
-> org.expeditee.encryption.items.surrogates.Label
-> org.expeditee.gui.FrameUtils
-> org.expeditee.gui.ItemsList
-> org.expeditee.items.Item
-> org.expeditee.items.Text


???? Use Integer.MAX_VALUE cast to a float instead of Float.MAX_VALUE. This fixed some bug which I cannot remember.

-> org.expeditee.gio.TextLayoutManager
-> org.expeditee.gio.swing.SwingTextLayoutManager


Improved solution for dealing with the F10 key taking focus away from Expeditee due to it being a assessibility key.

-> org.expeditee.gio.swing.SwingInputManager


Renamed variable visibleItems in FrameGraphics.paintFrame to itemsToPaintCanditates to better represent functional intent.

-> org.expeditee.gui.FrameGraphics


Improved checking for if personal resources exist before recreating them

-> org.expeditee.gui.FrameIO


Repeated messages to message bay now have a visual feedback instead of just a beep. This visual feedback is in the form of a count of the amount of times it has repeated.

-> org.expeditee.gui.MessageBay


Updated comment on the Vector class to explain what vectors are.

-> org.expeditee.gui.Vector


Added constants to represent all of the property keys in DefaultFrameReader and DefaultFrameWriter.

-> org.expeditee.io.DefaultFrameReader
-> org.expeditee.io.DefaultFrameWriter


Updated the KeyList setting to be more heirarcial with how users will store their Secrets.

-> org.expeditee.settings.identity.secrets.KeyList

File size: 3.5 KB
Line 
1package org.expeditee.gio;
2
3import java.util.List;
4
5import org.expeditee.core.Font;
6import org.expeditee.core.Line;
7import org.expeditee.core.Point;
8import org.expeditee.core.TextHitInfo;
9import org.expeditee.core.TextLayout;
10import org.expeditee.core.bounds.AxisAlignedBoxBounds;
11
12/** TODO: Comment. cts16 */
13public abstract class TextLayoutManager {
14
15 public abstract List<TextLayout> layoutString(String string, Font font, Point start, Line[] lineBreakers, int widthLimit, int lineSpacing, boolean dontBreakWords, boolean fullJustify);
16
17 public List<TextLayout> layoutStringRelative(String string, Font font, int widthLimit, int lineSpacing, boolean dontBreakWords, boolean fullJustify)
18 {
19 return layoutString(string, font, Point.ORIGIN.clone(), null, widthLimit, lineSpacing, dontBreakWords, fullJustify);
20 }
21
22 public TextLayout layoutStringSimple(String string, Font font)
23 {
24 List<TextLayout> layouts = layoutStringRelative(string, font, Integer.MAX_VALUE, 0, true, false);
25 if (layouts == null || layouts.size() == 0) return null;
26 return layouts.get(0);
27 }
28
29 public abstract float getAdvance(TextLayout layout);
30 public abstract int getCharacterCount(TextLayout layout);
31 public abstract TextHitInfo getNextLeftHit(TextLayout layout, int offset);
32 public abstract TextHitInfo getNextLeftHit(TextLayout layout, TextHitInfo hit);
33 public abstract TextHitInfo getNextRightHit(TextLayout layout, int offset);
34 public abstract TextHitInfo getNextRightHit(TextLayout layout, TextHitInfo hit);
35 public abstract float[] getCaretInfo(TextLayout layout, TextHitInfo hit);
36 public abstract AxisAlignedBoxBounds getPixelBounds(TextLayout layout, float x, float y);
37 public abstract AxisAlignedBoxBounds getLogicalHighlightShape(TextLayout layout, int firstEndpoint, int secondEndpoint);
38 public abstract float getAscent(TextLayout layout);
39 public abstract float getDescent(TextLayout layout);
40 public abstract float getLeading(TextLayout layout);
41 public abstract int getStringWidth(Font font, String string);
42 public abstract TextHitInfo hitTestChar(TextLayout layout, float x, float y);
43
44 public abstract void releaseLayout(TextLayout layout);
45
46 public void releaseLayouts(List<TextLayout> layouts)
47 {
48 if (layouts == null) return;
49
50 for (TextLayout layout : layouts) {
51 releaseLayout(layout);
52 }
53 }
54
55 /**
56 * Calculates the maximum possible distance a line can extend to the right from a given point
57 * without crossing any of the lines in the given array.
58 *
59 * @param p
60 * The coordinates of the beginning point.
61 *
62 * @param lines
63 * The lines that should stop the extension.
64 *
65 * @return
66 * The length of the extended line.
67 */
68 public float getLineWidth(Point p, Line[] lines)
69 {
70 float width = (float) Integer.MAX_VALUE;
71 for(Line l : lines) {
72 // check for lines that cross over our y
73 if((l.getFirstEnd().getY() >= p.getY() && l.getSecondEnd().getY() <= p.getY()) || (l.getFirstEnd().getY() <= p.getY() && l.getSecondEnd().getY() >= p.getY())) {
74 float dX = l.getFirstEnd().getX() - l.getSecondEnd().getX();
75 float dY = l.getFirstEnd().getY() - l.getSecondEnd().getY();
76 float newWidth;
77 if(dX == 0) {
78 newWidth = l.getFirstEnd().getX();
79 } else if(dY == 0) {
80 newWidth = Math.min(l.getFirstEnd().getX(), l.getSecondEnd().getX());
81 } else {
82 newWidth = l.getFirstEnd().getX() + (p.getY() - l.getFirstEnd().getY()) * dX / dY;
83 }
84 if(newWidth < p.getX()) {
85 continue;
86 }
87 if(newWidth < width) {
88 width = newWidth;
89 }
90 }
91 }
92 return width - p.getX();
93 }
94
95}
Note: See TracBrowser for help on using the repository browser.