Skip to content
This repository was archived by the owner on Dec 27, 2025. It is now read-only.

Commit a2f04a9

Browse files
committed
Initial commit
0 parents  commit a2f04a9

61 files changed

Lines changed: 15870 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Delphi compiler-generated binaries
2+
*.exe
3+
*.dll
4+
*.bpl
5+
*.bpi
6+
*.dcp
7+
*.so
8+
*.apk
9+
*.drc
10+
*.map
11+
*.dres
12+
*.rsm
13+
*.tds
14+
*.dcu
15+
*.lib
16+
*.a
17+
*.o
18+
*.ocx
19+
20+
# Delphi autogenerated files
21+
*.cfg
22+
*.hpp
23+
*Resource.rc
24+
25+
# Delphi local files
26+
*.local
27+
*.identcache
28+
*.projdata
29+
*.tvsconfig
30+
*.dsk
31+
32+
# Delphi history and backups
33+
__history/
34+
__recovery/
35+
*.~*
36+
37+
# Castalia statistics file
38+
*.stat

Docs/Globals.md

Lines changed: 409 additions & 0 deletions
Large diffs are not rendered by default.

Docs/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Content
2+
=======
3+
The `SimpleGraph` unit defines the following classes:
4+
5+
- **[TSimpleGraph](Docs/TSimpleGraph.md) = class (TCustomControl)** \
6+
Provides a canvas for drawing simple directional graphs.
7+
8+
- **[TGraphConstraints](Docs/TGraphConstraints.md) = class(TPersistent)** \
9+
Defines the bounding constraints of the graphs on the [TSimpleGraph](SimpleGraph.md) control.
10+
11+
- **[TGraphObjectList](Docs/TGraphObjectList.md) = class(TPersistent)** \
12+
Maintains the collection of objects on a graph.
13+
14+
- **[TGraphObject](Docs/TGraphObject.md) = class(TPersistent)** \
15+
Represents an object on a graph.
16+
17+
- **[TGraphLink](Docs/TGraphLink.md) = class([TGraphObject](Docs/TGraphObject.md))** \
18+
Represents a link/edge on a graph.
19+
20+
- **[TGraphNode](Docs/TGraphNode.md) = class([TGraphObject](Docs/TGraphObject.md))** \
21+
Represents a node on a graph.
22+
23+
- **[TPolygonalNode](Docs/TPolygonalNode.md) = class([TGraphNode](Docs/TGraphNode.md))** \
24+
Represents a polygonal node on a graph.
25+
26+
- **TRoundRectangularNode = class([TGraphNode](Docs/TGraphNode.md))** \
27+
Represents a rounded rectangular node on a graph.
28+
29+
- **TEllipticNode = class([TGraphNode](Docs/TGraphNode.md))** \
30+
Represents an elliptical node on a graph.
31+
32+
- **TTriangularNode = class([TPolygonalNode](Docs/TPolygonalNode.md))** \
33+
Represents a triangular node on a graph.
34+
35+
- **TRectangularNode = class([TPolygonalNode](Docs/TPolygonalNode.md))** \
36+
Represents a rectangular node on a graph.
37+
38+
- **TRhomboidalNode = class([TPolygonalNode](Docs/TPolygonalNode.md))** \
39+
Represents a rhomboidal node on a graph.
40+
41+
- **THexagonalNode = class([TPolygonalNode](Docs/TPolygonalNode.md))** \
42+
Represents a hexagonal node on a graph.
43+
44+
- **[TGraphScrollBar](Docs/TGraphScrollBar.md) = class(TPersistent)** \
45+
Manages a horizontal or vertical scroll bar on the [TSimpleGraph](Docs/TSimpleGraph.md) control.
46+
47+
- **[TMemoryHandleStream](Docs/TMemoryHandleStream.md) = class(TMemoryStream)** \
48+
Creates a stream whose backing store is memory allocated in the Windows global heap.
49+
50+
- **[TCanvasRecall](Docs/TCanvasRecall.md) = class(TObject)** \
51+
Stores the current state of a `Canvas` object, so that it can be restored at a later time.
52+
53+
- **TCompatibleCanvas = class(TCanvas)** \
54+
Provides a `Canvas` object compatible with the screen's device context.
55+
56+
In addition, the code offers various [global procedures and functions](/Docs/Globals.md).

Docs/TCanvasRecall.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
TCanvasRecall = class(TObject)
2+
==============================
3+
This class holds a reference to a `Canvas` object and saves its current state. Later, the saved state of the `Canvas` object can be retrieved by calling the `Retrieve` method or automatically when the `TCanvasRecall` instance is destroyed.
4+
5+
Properties
6+
----------
7+
In addition to the properties of the `TObject` class, the `TCanvasRecall` class has the following property:
8+
9+
- **`public Reference: TCanvas`** \
10+
The reference to a `Canvas` object that is managed by this instance. This property can be `nil`.
11+
12+
By changing this property, the `TCanvasRecall` instance restores the state of the previous `Canvas` object and saves the state of the new one.
13+
14+
Methods
15+
-------
16+
In addition to the methods of the `TObject` class, the `TCanvasRecall` class defines or overrides the following public methods:
17+
18+
- **`constructor Create(AReference: TCanvas);`** \
19+
Creates an instance of the class and saves the state of the `Canvas` object specified by the parameter.
20+
21+
| Parameter | Description |
22+
|------------|----------------------------------------------------------------------------|
23+
| AReference | The `Canvas` object that should be managed by this instance (can be `nil`) |
24+
25+
- **`destructor Destroy; override;`** \
26+
Restores the saved state of the `Canvas` object and destroys the instance.
27+
28+
- **`procedure Store;`** \
29+
Saves the current state of the `Canvas` object.
30+
31+
- **`procedure Retrieve;`** \
32+
Restores the saved state of the `Canvas` object.
33+

Docs/TGraphConstraints.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
TGraphConstraints = class(TPersistent)
2+
======================================
3+
This class has the bounding box of the graph objects on a [TSimpleGraph](TSimpleGraph.md) control.
4+
5+
Properties
6+
----------
7+
In addition to the properties of the `TPersistent` class, the `TGraphConstraints` class provides the following properties:
8+
9+
- **`public BoundsRect: TRect`** \
10+
Specifies the bounding box of the graph objects on canvas as a `TRect` value.
11+
12+
- **`published MinLeft: Integer default 0`** \
13+
Specifies the minimum horizontal placement of a graph object on canvas.
14+
15+
- **`published MinTop: Integer default 0`** \
16+
Specifies the minimum vertical placement of a graph object on canvas.
17+
18+
- **`published MaxRight: Integer default 65535`** \
19+
Specifies the maximum horizontal placement of a graph object on canvas.
20+
21+
- **`published MaxBottom: Integer default 65535`** \
22+
Specifies the maximum vertical placement of a graph object on canvas.
23+
24+
- **`public Owner: TSimpleGraph`** (read-only) \
25+
Gets the [TSimpleGraph](TSimpleGraph.md) control that owns this instance.
26+
27+
Methods
28+
-------
29+
In addition to the methods of the `TPersistent` class, the `TGraphConstraints` class has the following public methods:
30+
31+
- **`procedure SetBounds(aLeft, aTop, aWidth, aHeight: Integer);`** \
32+
Sets the bounding box of the graph objects on canvas.
33+
34+
| Parameter | Description |
35+
|-----------|---------------------------------------------------|
36+
| aLeft | The minimum horizontal position |
37+
| aTop | The minimum vertical position |
38+
| aWidth | The maximum horizontal size |
39+
| aHeight | The minimum vertical size |
40+
41+
- **`function WithinBounds(const Pts: array of TPoint): Boolean;`** \
42+
Determines whether all the given coordinates satisfy the constraints.
43+
44+
| Parameter | Description |
45+
|-----------|---------------------------------------------------|
46+
| Pts | The array of coordinates to be examined |
47+
48+
Returns `true` if all the coordinates satisfy the constraints; otherwise, return `false`.
49+
50+
- **`function ConfinePt(var Pt: TPoint): Boolean;`** \
51+
Moves a given coordinate inside the bounding box if it is outside of the box.
52+
53+
| Parameter | Description |
54+
|-----------|---------------------------------------------------|
55+
| Pt | The coordinates to be confined |
56+
57+
Returns `true` if the coordinate already satisfies the constraints; otherwise, return `false`.
58+
59+
- **`function ConfineRect(var Rect: TRect): Boolean;`** \
60+
Shrinks a given rectangle to fit inside the bounding box if any side of it is outside of the box.
61+
62+
| Parameter | Description |
63+
|-----------|---------------------------------------------------|
64+
| Rect | The rectangle to be confined |
65+
66+
Returns `true` if the rectangle already satisfies the constraints; otherwise, return `false`.
67+
68+
- **`function ConfineMoveResize(const Rect: TRect; Mobility: TObjectSides; var dX, dY: Integer): Boolean;`** \
69+
Adjusts changes in position and/or size of a rectangle, so that the rectangle stays inside the bounding box.
70+
71+
| Parameter | Description |
72+
|-----------|---------------------------------------------------|
73+
| Rect | The rectangle |
74+
| Mobility | The sides of the rectangle that can be displaced |
75+
| dX | The amount of horizontal changes |
76+
| dY | The amount of vertical changes |
77+
78+
Returns `true` if after applying the changes, the rectangle already satisfies the constraints; otherwise, return `false`.
79+
80+
Events
81+
------
82+
The `TGraphConstraints` class has the following event:
83+
84+
- **`OnChange: TNotifyEvent`** \
85+
Occurs when the value of a property has been changed.

0 commit comments

Comments
 (0)