⟩ How to to write a diagram editor. How to start?
Consider using a framework like
http://www.jhotdraw.org/
for a start. You also might want to familiarize yourself with many of the design patterns in
Gamma, E.; Helm, R.; Johnson, R.; Vlissides, J.: Design
Patterns: Elements of reusable object-oriented Software.
Addison-Wesley professional computing series. Brian W.
Kernighan, Consulting Editor. Reading, MA: Addison-Wesley,
1994.
And (if you manage to find documentation), the early work on UniDraw and IDraw by Vlissides is also interesting (in C++).