kapstok / NHL-DePa2 (public) (License: Unspecified) (since 2018-11-09) (hash sha1)
Design Patterns school project; a GUI using multiple Design Patterns.
List of commits:
Subject Hash Author Date (UTC)
Implement Visitor pattern for Groups. bd30477ce616362d3f58cef072d1ebc78077fa85 Jan Allersma 2018-10-16 13:28:37
Implement Visitor pattern for Shapes. e52412c3059c1ee5fa9abdf4a32db0f47981eee1 Jan Allersma 2018-10-16 12:43:17
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
Add resize option. 961e464090918d83690ff66838f2fc96c6ad213a Jan Allersma 2018-09-13 18:29:44
Commit bd30477ce616362d3f58cef072d1ebc78077fa85 - Implement Visitor pattern for Groups.
Author: Jan Allersma
Author date (UTC): 2018-10-16 13:28
Committer name: Jan Allersma
Committer date (UTC): 2018-10-16 13:53
Parent(s): e52412c3059c1ee5fa9abdf4a32db0f47981eee1
Signing key:
Tree: c620b73bdfa125d774102a3ee36ffc124b44bee2
File Lines added Lines deleted
source/entities/entity.d 4 0
source/entities/group.d 4 0
source/entities/shape.d 4 5
source/vistors/moveVisitor.d 5 0
source/vistors/resizeVisitor.d 5 0
source/vistors/saveVisitor.d 4 0
source/vistors/visitor.d 2 0
File source/entities/entity.d changed (mode: 100644) (index cd94cae..b209800)
1 1 module dp.ent.entity; module dp.ent.entity;
2 2
3 public import dp.visitor.visitor;
4
3 5 class Entity { class Entity {
4 6 public bool active = true; public bool active = true;
5 7 public bool saveable = true; public bool saveable = true;
 
... ... class Entity {
10 12 @property @property
11 13 public abstract string to_string(); public abstract string to_string();
12 14
15 public abstract void accept(Visitor v);
16
13 17 public abstract void checkBounds(int x, int y); public abstract void checkBounds(int x, int y);
14 18
15 19 public abstract void render(); public abstract void render();
File source/entities/group.d changed (mode: 100644) (index c8c43b7..6b06cbd)
... ... class Group : Entity {
51 51 return result; return result;
52 52 } }
53 53
54 public override void accept(Visitor v) {
55 v.visit(this);
56 }
57
54 58 public override void render() { public override void render() {
55 59 double[3] tmp = [ double[3] tmp = [
56 60 Global.Brush.red, Global.Brush.red,
File source/entities/shape.d changed (mode: 100644) (index 9b25d6f..9e80031)
... ... module dp.ent.shape;
2 2
3 3 import dp.ent.entity; import dp.ent.entity;
4 4 import dp.strat.strat; import dp.strat.strat;
5 import dp.visitor.visitor;
6 5 import cairo.Context; import cairo.Context;
7 6 import std.conv; import std.conv;
8 7 import std.stdio; // Debug import std.stdio; // Debug
 
... ... class Shape : Entity {
61 60 return size * strat.sizeYScale; return size * strat.sizeYScale;
62 61 } }
63 62
63 public override void accept(Visitor v) {
64 v.visit(this);
65 }
66
64 67 public override void checkBounds(int x, int y) { public override void checkBounds(int x, int y) {
65 68 double[2] p = [to!double(x), to!double(y)]; double[2] p = [to!double(x), to!double(y)];
66 69
 
... ... class Shape : Entity {
87 90 } }
88 91 } }
89 92
90 public void accept(Visitor v) {
91 v.visit(this);
92 }
93
94 93 public double[2][2] calcBounds(int x, int y) { public double[2][2] calcBounds(int x, int y) {
95 94 double[2][2] result; double[2][2] result;
96 95
File source/vistors/moveVisitor.d changed (mode: 100644) (index 55b7417..38aadc3)
... ... public class MoveVisitor : Visitor {
16 16 public override void visit(Shape s) { public override void visit(Shape s) {
17 17 s.bounds = s.calcBounds(position[0], position[1]); s.bounds = s.calcBounds(position[0], position[1]);
18 18 } }
19
20 public override void visit(Group g) {
21 for(size_t i = 0; i < g.length; i++)
22 g.get(i).accept(new MoveVisitor(position));
23 }
19 24 } }
File source/vistors/resizeVisitor.d changed (mode: 100644) (index 7f7f191..15dfe0c)
... ... public class ResizeVisitor : Visitor {
32 32 s.size += amount; s.size += amount;
33 33 s.bounds = s.calcBounds(newPos[0], newPos[1]); s.bounds = s.calcBounds(newPos[0], newPos[1]);
34 34 } }
35
36 public override void visit(Group g) {
37 for(size_t i = 0; i < g.length; i++)
38 g.get(i).accept(new ResizeVisitor(amount));
39 }
35 40 } }
File source/vistors/saveVisitor.d changed (mode: 100644) (index 007d08a..55cedf2)
... ... public class SaveVisitor : Visitor {
13 13 public override void visit(Shape s) { public override void visit(Shape s) {
14 14 f.toFile(s); f.toFile(s);
15 15 } }
16
17 public override void visit(Group g) {
18 f.toFile(g);
19 }
16 20 } }
File source/vistors/visitor.d changed (mode: 100644) (index f16b472..8c878d4)
1 1 module dp.visitor.visitor; module dp.visitor.visitor;
2 2
3 3 public import dp.ent.shape; public import dp.ent.shape;
4 public import dp.ent.group;
4 5
5 6 abstract class Visitor { abstract class Visitor {
6 7 public abstract void visit(Shape s); public abstract void visit(Shape s);
8 public abstract void visit(Group g);
7 9 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/kapstok/NHL-DePa2

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/kapstok/NHL-DePa2

Clone this repository using git:
git clone git://git.rocketgit.com/user/kapstok/NHL-DePa2

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main