Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Fix File I/O for EntityOrnaments. | e38712e53a13ba2bbb0a0b792688cfff29689826 | Jan Allersma | 2018-11-13 17:46:45 |
Allow multiple Ornaments to be aligned at the same Entity. | b01673996a5b4a589b8e6c6d9dee0dc9b3c1cc60 | Jan Allersma | 2018-11-09 21:46:01 |
Allow multiple Ornaments to be added to an Entity. | db1ce677fbcbba757c18ea645b76bb1688594d04 | Jan Allersma | 2018-11-09 17:23:02 |
Change Entity.group as variable into a property. | bbda7fe1dd4528b9396bff03fcb669e4c6ff2ad5 | Jan Allersma | 2018-11-08 16:37:41 |
Load nested Entities with Ornaments properly. | 8da015e6fd4f43cc873a5ae330caefab73b8f5fc | Jan Allersma | 2018-11-08 13:56:36 |
Save nested Entities with Ornaments properly. | 645cf4ae287fd2511b4c1404d0d9559372e5e10b | Jan Allersma | 2018-11-08 12:04:40 |
Fix bug: activate group after movement with cloning. | 482c53ecab43cdee03590949669c22227d104475 | Jan Allersma | 2018-11-08 10:35:27 |
Include Groups in Commands, removing dp.groups.groups. | 699f767ac316edd481630a943f7a1884c5bc16f2 | Jan Allersma | 2018-11-07 11:27:15 |
Fix ability to nest in Groups. | fd546a42ef54bdf5d2966eb7facbbf21a6b72e1b | Jan Allersma | 2018-11-06 17:49:11 |
Fix file I/O for single entities. | 093b7d31a215067212927b1d92bdbbee306ea345 | Jan Allersma | 2018-11-06 16:49:55 |
Fix file I/O issue. | 25c0b40db223c806eb3ea8bd28238dedc38ca8b5 | Jan Allersma | 2018-11-02 16:22:59 |
Cleanup commenting. | 445aea4a5115c9110a097bfc7ac9f7d5ad48a9e7 | Jan Allersma | 2018-11-02 14:33:08 |
Show Ornaments on Canvas. | d8456f15d69550c4cb0aa615cccb96b45a77f6a6 | Jan Allersma | 2018-11-02 14:08:47 |
Support Entities for Create & Destruct commands. | cc900579eedf9c6288ce1c1883122856794e05a0 | Jan Allersma | 2018-11-02 13:25:43 |
Use entities instead of shapes when constructing ornaments. | 13f08847624489f60a37db55c2aedbba6b021f98 | Jan Allersma | 2018-11-01 17:02:47 |
Remove obsolete 'calcBounds' function. | 475ec330736b5800d12d091415480b163dd244e2 | Jan Allersma | 2018-11-01 14:28:29 |
Setup for decorator pattern. | 762914dec31b1fb1d4cf6bb0cef2e148010652a4 | Jan Allersma | 2018-11-01 14:12:51 |
Revert commit '5678eb6'. | 6225242719b2cfc5ee0de9f8d05edbc7a69007a7 | Jan Allersma | 2018-11-01 14:10:27 |
Make groups movable and resizable. | 1ca7c18ab103a8d1055b27f63192038fd75aef3e | Jan Allersma | 2018-10-17 14:51:32 |
Use translations instead of positions for moving shapes. | 9551c7d2608f01c3950743fd97bd217aab8f5766 | Jan Allersma | 2018-10-16 16:11:03 |
File | Lines added | Lines deleted |
---|---|---|
README.md | 0 | 3 |
source/commands/create.d | 2 | 2 |
source/entities/decorator/decorator.d | 0 | 18 |
source/entities/decorator/entornament.d | 13 | 11 |
source/entities/entity.d | 1 | 2 |
source/entities/group.d | 2 | 0 |
source/entities/ornament.d | 3 | 2 |
source/frontend/ornamentDialog.d | 3 | 6 |
source/vistors/saveVisitor.d | 6 | 9 |
File README.md changed (mode: 100644) (index f54b858..e8544d6) | |||
... | ... | maar subgroepen niet. | |
22 | 22 | ||
23 | 23 | - Kan een `Global.Brush.clone` niet gewoon een Entity zijn? Dan hoef je | - Kan een `Global.Brush.clone` niet gewoon een Entity zijn? Dan hoef je |
24 | 24 | denk ik niet `Global.Brush.cloneGroup` te gebruiken. | denk ik niet `Global.Brush.cloneGroup` te gebruiken. |
25 | |||
26 | - `OrnamentDialog` voegt `Ornaments` aan de `Entity` toe. Dat moet nog aan | ||
27 | `EntityOrnament` gekoppeld worden (zie `clickCallback()`). |
File source/commands/create.d changed (mode: 100644) (index 55a2843..893629f) | |||
... | ... | public class CreateCmd : Command { | |
31 | 31 | } | } |
32 | 32 | ||
33 | 33 | public override void save(Savefile file) { | public override void save(Savefile file) { |
34 | if(e.type() == "ornament") return; | ||
34 | if(e.type == "ornament") return; | ||
35 | 35 | ||
36 | if(e.group is null) | ||
36 | if(e.group is null && !e.partOfEo) | ||
37 | 37 | e.accept(new SaveVisitor(file)); | e.accept(new SaveVisitor(file)); |
38 | 38 | } | } |
39 | 39 | } | } |
File source/entities/decorator/decorator.d changed (mode: 100644) (index 8bb1a04..1358b34) | |||
... | ... | abstract class Decorator : Entity { | |
35 | 35 | return e.bounds; | return e.bounds; |
36 | 36 | } | } |
37 | 37 | ||
38 | @property | ||
39 | public override string type() { | ||
40 | return e.type; | ||
41 | } | ||
42 | |||
43 | @property | ||
44 | public override string to_string() { | ||
45 | return e.to_string(); | ||
46 | } | ||
47 | |||
48 | public override void accept(Visitor v) { | ||
49 | e.accept(v); | ||
50 | } | ||
51 | |||
52 | 38 | public override void checkBounds(int x, int y) { | public override void checkBounds(int x, int y) { |
53 | 39 | e.checkBounds(x,y); | e.checkBounds(x,y); |
54 | 40 | } | } |
55 | |||
56 | public override void render() { | ||
57 | e.render(); | ||
58 | } | ||
59 | 41 | } | } |
File source/entities/decorator/entornament.d changed (mode: 100644) (index eafbc5d..36a64f5) | |||
... | ... | import dp.dec.entity; | |
4 | 4 | import dp.ent.entity; | import dp.ent.entity; |
5 | 5 | import dp.ent.ornament; | import dp.ent.ornament; |
6 | 6 | ||
7 | import std.stdio; // Debug | ||
8 | |||
9 | 7 | class EntityOrnament : Decorator { | class EntityOrnament : Decorator { |
8 | public Ornament[] ornaments; | ||
9 | |||
10 | 10 | this(Entity entity) { | this(Entity entity) { |
11 | 11 | super(entity); | super(entity); |
12 | 12 | ornaments = []; | ornaments = []; |
13 | |||
14 | if(entity.group !is null) | ||
15 | entity.group.add(this); | ||
13 | 16 | } | } |
14 | 17 | ||
15 | 18 | @property | @property |
16 | 19 | public override string type() { | public override string type() { |
17 | string result = e.type; | ||
18 | |||
19 | foreach(o; ornaments) | ||
20 | result ~= "\n" ~ o.type; | ||
21 | |||
22 | return result; | ||
20 | return "EntityOrnament"; | ||
23 | 21 | } | } |
24 | 22 | ||
25 | 23 | @property | @property |
26 | 24 | public override string to_string() { | public override string to_string() { |
27 | 25 | string result = e.to_string; | string result = e.to_string; |
28 | writeln("PRE-RES: " ~ result); | ||
29 | 26 | ||
30 | 27 | foreach(o; ornaments) | foreach(o; ornaments) |
31 | 28 | result ~= "\n" ~ o.to_string; | result ~= "\n" ~ o.to_string; |
32 | 29 | ||
33 | writeln("POST_RES: " ~ result); | ||
34 | |||
35 | 30 | return result; | return result; |
36 | 31 | } | } |
37 | 32 | ||
... | ... | class EntityOrnament : Decorator { | |
40 | 35 | foreach(o; ornaments) | foreach(o; ornaments) |
41 | 36 | o.render(); | o.render(); |
42 | 37 | } | } |
38 | |||
39 | public override void accept(Visitor v) { | ||
40 | foreach(o; ornaments) | ||
41 | o.accept(v); | ||
42 | |||
43 | e.accept(v); | ||
44 | } | ||
43 | 45 | } | } |
File source/entities/entity.d changed (mode: 100644) (index 7200966..27f81a1) | |||
... | ... | module dp.ent.entity; | |
3 | 3 | public import dp.visitor.visitor; | public import dp.visitor.visitor; |
4 | 4 | public import dp.ent.group; | public import dp.ent.group; |
5 | 5 | ||
6 | import dp.ent.ornament; | ||
7 | 6 | import dp.ent.shape; | import dp.ent.shape; |
8 | 7 | ||
9 | 8 | class Entity { | class Entity { |
10 | 9 | public bool active = true; | public bool active = true; |
11 | public Ornament[] ornaments = []; | ||
10 | public bool partOfEo = false; | ||
12 | 11 | ||
13 | 12 | @property | @property |
14 | 13 | public abstract Group group(); | public abstract Group group(); |
File source/entities/group.d changed (mode: 100644) (index 60196d2..a744a24) | |||
... | ... | class Group : Entity { | |
125 | 125 | public void remove(size_t index) { | public void remove(size_t index) { |
126 | 126 | entities[index].group = null; | entities[index].group = null; |
127 | 127 | ||
128 | entities.length++; | ||
129 | |||
128 | 130 | for(size_t i = index; i < entities.length; i++) | for(size_t i = index; i < entities.length; i++) |
129 | 131 | entities[i] = entities[i+1]; | entities[i] = entities[i+1]; |
130 | 132 |
File source/entities/ornament.d changed (mode: 100644) (index 8241ef9..0c21c00) | |||
1 | 1 | module dp.ent.ornament; | module dp.ent.ornament; |
2 | 2 | ||
3 | 3 | import dp.ent.entity; | import dp.ent.entity; |
4 | import dp.dec.entornament; | ||
4 | 5 | import cairo.Context; | import cairo.Context; |
5 | 6 | ||
6 | 7 | class Ornament : Entity { | class Ornament : Entity { |
7 | Entity entity; | ||
8 | EntityOrnament entity; | ||
8 | 9 | Context context; | Context context; |
9 | 10 | string alignment; | string alignment; |
10 | 11 | string value; | string value; |
11 | 12 | double offset; | double offset; |
12 | 13 | ||
13 | this(Entity entity, string alignment, string value, Context context) { | ||
14 | this(EntityOrnament entity, string alignment, string value, Context context) { | ||
14 | 15 | this.entity = entity; | this.entity = entity; |
15 | 16 | this.alignment = alignment; | this.alignment = alignment; |
16 | 17 | this.value = value; | this.value = value; |
File source/frontend/ornamentDialog.d changed (mode: 100644) (index ff3f552..fcfd5af) | |||
... | ... | import dp.ent.ornament; | |
13 | 13 | import dp.dec.entornament; | import dp.dec.entornament; |
14 | 14 | import dp.command.create; | import dp.command.create; |
15 | 15 | ||
16 | import std.stdio; // Debug | ||
17 | |||
18 | 16 | import Global = dp.global; | import Global = dp.global; |
19 | 17 | ||
20 | 18 | class OrnamentDialog : Dialog { | class OrnamentDialog : Dialog { |
... | ... | class OrnamentDialog : Dialog { | |
81 | 79 | this.close(); | this.close(); |
82 | 80 | ||
83 | 81 | EntityOrnament eo = new EntityOrnament(e); | EntityOrnament eo = new EntityOrnament(e); |
84 | write("O: ");write(&eo);write(", ");writeln(eo.ornaments.length); | ||
82 | e.partOfEo = true; | ||
85 | 83 | ||
86 | 84 | if(input != "") { | if(input != "") { |
87 | Ornament o = new Ornament(e, position, input, Global.canvas.newContext); // Should become eo instead of e. | ||
88 | write("O: ");write(&eo);write(", ");writeln(eo.ornaments.length); | ||
89 | Global.History.addCommand(new CreateCmd(o)); | ||
85 | Ornament o = new Ornament(eo, position, input, Global.canvas.newContext); | ||
86 | Global.History.addCommand(new CreateCmd(eo)); | ||
90 | 87 | Global.canvas.repaint(); | Global.canvas.repaint(); |
91 | 88 | this.close(); | this.close(); |
92 | 89 | } | } |
File source/vistors/saveVisitor.d changed (mode: 100644) (index 05fca56..64fbcfa) | |||
1 | 1 | module dp.visitor.save; | module dp.visitor.save; |
2 | 2 | ||
3 | 3 | import dp.visitor.visitor; | import dp.visitor.visitor; |
4 | import dp.ent.entity; | ||
4 | 5 | import dp.file; | import dp.file; |
5 | 6 | ||
6 | 7 | import std.stdio; // Debug | import std.stdio; // Debug |
... | ... | public class SaveVisitor : Visitor { | |
14 | 15 | ||
15 | 16 | public override void visit(EntityOrnament eo) { | public override void visit(EntityOrnament eo) { |
16 | 17 | eo.accept(new SaveVisitor(f)); | eo.accept(new SaveVisitor(f)); |
17 | |||
18 | foreach(ornament; eo.ornaments) | ||
19 | ornament.accept(new SaveVisitor(f)); | ||
20 | 18 | } | } |
21 | 19 | ||
22 | 20 | public override void visit(Shape s) { | public override void visit(Shape s) { |
23 | 21 | writeln("S: shape"); | writeln("S: shape"); |
24 | foreach(ornament; s.ornaments) | ||
25 | ornament.accept(new SaveVisitor(f)); | ||
26 | 22 | ||
27 | 23 | f.toFile(s); | f.toFile(s); |
28 | 24 | } | } |
29 | 25 | ||
30 | 26 | public override void visit(Group g) { | public override void visit(Group g) { |
31 | 27 | writeln("S: group"); | writeln("S: group"); |
32 | foreach(ornament; g.ornaments) | ||
33 | ornament.accept(new SaveVisitor(f)); | ||
34 | 28 | ||
35 | 29 | f.toFile(g); | f.toFile(g); |
36 | 30 | ||
37 | 31 | f.indent++; | f.indent++; |
38 | 32 | ||
39 | for(size_t i = 0; i < g.length; i++) | ||
40 | g.get(i).accept(new SaveVisitor(f)); | ||
33 | for(size_t i = 0; i < g.length; i++) { | ||
34 | Entity e = g.get(i); | ||
35 | if(!e.partOfEo) | ||
36 | e.accept(new SaveVisitor(f)); | ||
37 | } | ||
41 | 38 | ||
42 | 39 | f.indent--; | f.indent--; |
43 | 40 | } | } |