Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Setup 'Decorator' and 'Ornament' class. | 5678eb6257bcf88502078d08395a394a1c24568b | Jan Allersma | 2018-10-09 09:29:50 |
Make ornament interface compatible with Entities. | 21383d5f200a338f8255d7d33b6989937c19fed6 | Jan Allersma | 2018-10-08 20:36:23 |
Build interface for ornament creation. | adcf22a4e878edc45ac0775a5e15ebf0bb1a937d | Jan Allersma | 2018-10-08 13:53:52 |
Use different strats instead of seperate Shapes. | a56e1e665a0292d15139eddfd8ebdeb8c95251b4 | Jan Allersma | 2018-10-01 11:37:45 |
Fix bug in Rect from commit 6c91140 in other Shapes as well. | 4165a5da98dd9a548a222c6160390e4e54026d48 | Jan Allersma | 2018-09-28 14:53:40 |
Fully implement File I/O. | 45cbb48489a24857cfc76144b38b12ccebfd9e61 | Jan Allersma | 2018-09-27 16:03:40 |
Fix GroupMenu bug. | be41e51819be1a23e7761ea0662eb188ac641aca | Jan Allersma | 2018-09-27 14:55:20 |
Fix TODO's from previous commit. | 89d8172b77336a6c18f30521147eb81287961f11 | Jan Allersma | 2018-09-27 14:06:30 |
Add groups as preparation for step 3. | a91368128e7444f69b3a30ee4d17f9063c8846b8 | Jan Allersma | 2018-09-26 18:31:49 |
Fix minor bug. Small cleanup 'ellipse' code. | 6c911405eb8e48ffe2d63aaff5255adbd4aec889 | Jan Allersma | 2018-09-21 18:10:01 |
Implement file I/O. | 6219eca932d454a7dab5fe8679f07865ce3cf49d | Jan Allersma | 2018-09-21 15:52:45 |
Add shape 'ellipse'. | 99d8b029c769bc291af73df3fd445da3cbf5bef4 | Jan Allersma | 2018-09-21 10:44:36 |
Add shape 'circle'. | 092cb3c3f788b461192a6e164955c53acaf58720 | Jan Allersma | 2018-09-21 09:35:27 |
Add resize option (again). | 08c95e97268cf9d74bcb963503eec512e528edfe | Jan Allersma | 2018-09-20 18:09:03 |
Fix undo bug. | 6ab126be633075923cdcce53044e2468f967db41 | Jan Allersma | 2018-09-20 10:46:50 |
Implement 'delete shape' feature. | 16d42472d44a9dae988c4745c90c791a8770541b | Jan Allersma | 2018-09-19 09:04:40 |
Fix undo/redo for 'MoveCmd'. | be51bea021bfe5ff79e16a92d350677aed736ddd | Jan Allersma | 2018-09-19 08:49:55 |
Implement shapeOptions without undo/redo. | bbe699f41e5dacbfdadfaa879452ac2f4501f5a1 | Jan Allersma | 2018-09-18 19:44:44 |
WIP: Restore 'shapeOptions.d'. | 888b8ea647c0f25cfbeefcd97ee7ebb59e7f0751 | Jan Allersma | 2018-09-18 15:46:05 |
Rebuild project from scratch. | df0f2f82a86581ba9fa3a169d63a950229341a9f | Jan Allersma | 2018-09-18 15:04:32 |
File | Lines added | Lines deleted |
---|---|---|
README.md | 17 | 0 |
source/decorator.d | 71 | 0 |
source/entities/group.d | 0 | 7 |
source/entities/ornament.d | 57 | 0 |
File README.md changed (mode: 100644) (index cda57e6..35148fc) | |||
... | ... | use 'dub' to compile and run the code. | |
23 | 23 | ||
24 | 24 | - `newPath()`: Clear path from context. | - `newPath()`: Clear path from context. |
25 | 25 | ||
26 | - `showText()`: Write text with Cairo. | ||
27 | |||
28 | # Entities | ||
29 | |||
30 | `Shapes` are stored in a `Command`. Each `Command` is saved in `History`. | ||
31 | |||
32 | `Groups` are stored in `Global.groups`. | ||
33 | |||
34 | The rendering of `Entities` is done through `History`. First are | ||
35 | all `Commands` rendered with a `foreach`-loop. Then all `Groups` | ||
36 | in `Global.groups` are rendered with a `foreach`-loop. | ||
37 | |||
38 | If a `Shape` is added to a `Group`, The `Shape` is unable to save itself | ||
39 | anymore. From that point, `Group` has the task to save itself, including | ||
40 | all it's members. The ability to save is determined by the `saveable` | ||
41 | variable. | ||
42 | |||
26 | 43 | # Roadmap | # Roadmap |
27 | 44 | ||
28 | 45 | - Delete group? Hoe? | - Delete group? Hoe? |
File source/decorator.d added (mode: 100644) (index 0000000..9cca0ea) | |||
1 | module dp.decorator; | ||
2 | |||
3 | import dp.ent.shape; | ||
4 | import dp.ent.ornament; | ||
5 | |||
6 | class Decorator : Shape { | ||
7 | Shape s; | ||
8 | Ornament o; | ||
9 | |||
10 | this(int x, int y, Context context, Strategy strategy, double size = 0) { | ||
11 | s = new Shape(x,y,context,strategy,size); | ||
12 | o = null; | ||
13 | } | ||
14 | |||
15 | @property | ||
16 | public override string type() { | ||
17 | string result = s.type; | ||
18 | |||
19 | if(o !is null) | ||
20 | result ~= "\n" ~ o.type; | ||
21 | |||
22 | return result; | ||
23 | } | ||
24 | |||
25 | @property | ||
26 | public override string to_string() { | ||
27 | string result = s.to_string; | ||
28 | |||
29 | if(o !is null) | ||
30 | result ~= "\n" ~ o.to_string; | ||
31 | |||
32 | return result; | ||
33 | } | ||
34 | |||
35 | @property | ||
36 | public override int[2] position() { | ||
37 | return s.position; | ||
38 | } | ||
39 | |||
40 | @property | ||
41 | public override double[2][2] getBounds() { | ||
42 | return s.getBounds; | ||
43 | } | ||
44 | |||
45 | @property | ||
46 | public override double getSize() { | ||
47 | return s.getSize; | ||
48 | } | ||
49 | |||
50 | public override void checkBounds(int x, int y) { | ||
51 | s.checkBounds(x,y); | ||
52 | } | ||
53 | |||
54 | public override void render() { | ||
55 | s.render(); | ||
56 | if(o !is null) | ||
57 | o.render(); | ||
58 | } | ||
59 | |||
60 | public override void move(int x, int y) { | ||
61 | s.move(x,y); | ||
62 | } | ||
63 | |||
64 | public override void resize(int amount) { | ||
65 | s.resize(amount); | ||
66 | } | ||
67 | |||
68 | public void setOrnament(Ornament ornament) { | ||
69 | o = ornament; | ||
70 | } | ||
71 | } |
File source/entities/group.d changed (mode: 100644) (index c8c43b7..d22e024) | |||
... | ... | class Group : Entity { | |
84 | 84 | return index; | return index; |
85 | 85 | } | } |
86 | 86 | ||
87 | public void remove(size_t index) { | ||
88 | for(size_t i = index; i < entities.length; i++) | ||
89 | entities[i] = entities[i+1]; | ||
90 | |||
91 | entities.length--; | ||
92 | } | ||
93 | |||
94 | 87 | public Entity get(size_t index) { | public Entity get(size_t index) { |
95 | 88 | return entities[index]; | return entities[index]; |
96 | 89 | } | } |
File source/entities/ornament.d added (mode: 100644) (index 0000000..9cdab84) | |||
1 | module dp.ent.ornament; | ||
2 | |||
3 | import dp.ent.shape; | ||
4 | import dp.ent.ent; | ||
5 | |||
6 | class Ornament : Entity { | ||
7 | Shape shape; | ||
8 | string position; | ||
9 | string value; | ||
10 | double[2][2] bounds; | ||
11 | |||
12 | this(Shape shape, string position, string value) { | ||
13 | this.shape = shape; | ||
14 | this.position = position; | ||
15 | this.value = value; | ||
16 | this.bounds = calcBounds(); | ||
17 | } | ||
18 | |||
19 | @property | ||
20 | public override string type() { | ||
21 | return "ornament"; | ||
22 | } | ||
23 | |||
24 | @property | ||
25 | public override string to_string() { | ||
26 | return type ~ " " ~ position ~ " " ~ value; | ||
27 | } | ||
28 | |||
29 | public override void checkBounds(int x, int y) {} | ||
30 | |||
31 | public override void render() { | ||
32 | // render text. | ||
33 | } | ||
34 | |||
35 | private void calcBounds() { | ||
36 | bounds = s.getBounds; | ||
37 | |||
38 | final switch(position) { | ||
39 | case "Top": | ||
40 | bounds[0][1] -= 30 + s.getSize; | ||
41 | bounds[1][1] -= 30 + s.getSize; | ||
42 | break; | ||
43 | case "Bottom": | ||
44 | bounds[0][1] += 30 + s.getSize; | ||
45 | bounds[1][1] += 30 + s.getSize; | ||
46 | break; | ||
47 | case "Left": | ||
48 | bounds[0][0] -= 30 + s.getSize; | ||
49 | bounds[0][1] -= 30 + s.getSize; | ||
50 | break; | ||
51 | case "Right": | ||
52 | bounds[0][0] += 30 + s.getSize; | ||
53 | bounds[0][1] += 30 + s.getSize; | ||
54 | break; | ||
55 | } | ||
56 | } | ||
57 | } |