1 | // |
---|
2 | // labelinfo.h |
---|
3 | // |
---|
4 | // Main frame handling for Aven. |
---|
5 | // |
---|
6 | // Copyright (C) 2000-2003,2005 Mark R. Shinwell |
---|
7 | // Copyright (C) 2001-2003,2004,2005,2006,2010,2011,2012,2013,2014 Olly Betts |
---|
8 | // |
---|
9 | // This program is free software; you can redistribute it and/or modify |
---|
10 | // it under the terms of the GNU General Public License as published by |
---|
11 | // the Free Software Foundation; either version 2 of the License, or |
---|
12 | // (at your option) any later version. |
---|
13 | // |
---|
14 | // This program is distributed in the hope that it will be useful, |
---|
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | // GNU General Public License for more details. |
---|
18 | // |
---|
19 | // You should have received a copy of the GNU General Public License |
---|
20 | // along with this program; if not, write to the Free Software |
---|
21 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
22 | // |
---|
23 | |
---|
24 | #ifndef labelinfo_h |
---|
25 | #define labelinfo_h |
---|
26 | |
---|
27 | #include "aven.h" |
---|
28 | #include "message.h" |
---|
29 | #include "vector3.h" |
---|
30 | #include "wx.h" |
---|
31 | |
---|
32 | // Mac OS X headers pollute the global namespace with generic names like |
---|
33 | // "class Point", which clashes with our "class Point". So for __WXMAC__ |
---|
34 | // put our class in a namespace and define Point as a macro. |
---|
35 | #ifdef __WXMAC__ |
---|
36 | namespace svx { |
---|
37 | #endif |
---|
38 | |
---|
39 | class Point : public Vector3 { |
---|
40 | public: |
---|
41 | Point() {} |
---|
42 | Point(const Vector3 & v) : Vector3(v) { } |
---|
43 | Point(const img_point & pt) : Vector3(pt.x, pt.y, pt.z) { } |
---|
44 | double GetX() const { return x; } |
---|
45 | double GetY() const { return y; } |
---|
46 | double GetZ() const { return z; } |
---|
47 | }; |
---|
48 | |
---|
49 | #ifdef __WXMAC__ |
---|
50 | } |
---|
51 | #define Point svx::Point |
---|
52 | #endif |
---|
53 | |
---|
54 | #define LFLAG_NOT_ANON 0x01 |
---|
55 | #define LFLAG_NOT_WALL 0x02 |
---|
56 | #define LFLAG_SURFACE 0x04 |
---|
57 | #define LFLAG_UNDERGROUND 0x08 |
---|
58 | #define LFLAG_EXPORTED 0x10 |
---|
59 | #define LFLAG_FIXED 0x20 |
---|
60 | #define LFLAG_ENTRANCE 0x40 |
---|
61 | #define LFLAG_HIGHLIGHTED 0x80 |
---|
62 | |
---|
63 | class LabelInfo : public Point { |
---|
64 | wxString text; |
---|
65 | unsigned width; |
---|
66 | int flags; |
---|
67 | |
---|
68 | public: |
---|
69 | wxTreeItemId tree_id; |
---|
70 | |
---|
71 | LabelInfo() : Point(), text(), flags(0) { } |
---|
72 | LabelInfo(const img_point &pt, const wxString &text_, int flags_) |
---|
73 | : Point(pt), text(text_), flags(flags_) { |
---|
74 | if (text.empty()) |
---|
75 | flags &= ~LFLAG_NOT_ANON; |
---|
76 | } |
---|
77 | const wxString & GetText() const { return text; } |
---|
78 | wxString name_or_anon() const { |
---|
79 | if (!text.empty()) return text; |
---|
80 | /* TRANSLATORS: Used in place of the station name when talking about an |
---|
81 | * anonymous station. */ |
---|
82 | return wmsg(/*anonymous station*/56); |
---|
83 | } |
---|
84 | int get_flags() const { return flags; } |
---|
85 | void set_flags(int mask) { flags |= mask; } |
---|
86 | void clear_flags(int mask) { flags &= ~mask; } |
---|
87 | unsigned get_width() const { return width; } |
---|
88 | void set_width(unsigned width_) { width = width_; } |
---|
89 | |
---|
90 | bool IsEntrance() const { return (flags & LFLAG_ENTRANCE) != 0; } |
---|
91 | bool IsFixedPt() const { return (flags & LFLAG_FIXED) != 0; } |
---|
92 | bool IsExportedPt() const { return (flags & LFLAG_EXPORTED) != 0; } |
---|
93 | bool IsUnderground() const { return (flags & LFLAG_UNDERGROUND) != 0; } |
---|
94 | bool IsSurface() const { return (flags & LFLAG_SURFACE) != 0; } |
---|
95 | bool IsHighLighted() const { return (flags & LFLAG_HIGHLIGHTED) != 0; } |
---|
96 | bool IsAnon() const { return (flags & LFLAG_NOT_ANON) == 0; } |
---|
97 | bool IsWall() const { return (flags & LFLAG_NOT_WALL) == 0; } |
---|
98 | }; |
---|
99 | |
---|
100 | #endif |
---|