]> git.tdb.fi Git - r2c2.git/blob - source/designer/trackwrap.h
Fix a memory leak
[r2c2.git] / source / designer / trackwrap.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef TRACKWRAP_H_
9 #define TRACKWRAP_H_
10
11 #include <msp/gl/mesh.h>
12 #include <msp/gl/renderable.h>
13 #include "libr2c2/track.h"
14
15 class Designer;
16 class Selection;
17
18 class TrackWrap: public Msp::GL::Renderable
19 {
20 private:
21         struct Wrap
22         {
23                 R2C2::Track *track;
24                 Msp::GL::Mesh *mesh;
25         };
26
27         Designer &designer;
28         Selection &selection;
29         std::map<const R2C2::TrackType *, Msp::GL::Mesh *> meshes;
30         std::list<Wrap> wraps;
31
32 public:
33         TrackWrap(Designer &, Selection &);
34         ~TrackWrap();
35
36         virtual void render(const Msp::GL::Tag &) const;
37
38 private:
39         void selection_changed();
40         Msp::GL::Mesh &get_mesh(const R2C2::TrackType &);
41 };
42
43 #endif