forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT2DMap.h
More file actions
228 lines (203 loc) · 6.98 KB
/
T2DMap.h
File metadata and controls
228 lines (203 loc) · 6.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#ifndef MUDLET_T2DMAP_H
#define MUDLET_T2DMAP_H
/***************************************************************************
* Copyright (C) 2008-2012 by Heiko Koehn - KoehnHeiko@googlemail.com *
* Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com *
* Copyright (C) 2016 by Stephen Lyons - slysven@virginmedia.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "pre_guard.h"
#include <QColor>
#include <QPixmap>
#include <QPointer>
#include <QString>
#include <QTreeWidget>
#include <QWidget>
#include "post_guard.h"
class Host;
class TMap;
class QCheckBox;
class QComboBox;
class QListWidgetItem;
class QPushButton;
class QTreeWidgetItem;
class T2DMap : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(T2DMap)
public:
explicit T2DMap(QWidget* parent = 0);
void paintMap();
void setMapZoom(int zoom);
QColor getColor(int id);
QColor _getColor(int id);
void init();
void exportAreaImage(int);
void paintEvent(QPaintEvent*) override;
void mousePressEvent(QMouseEvent*) override;
void mouseDoubleClickEvent(QMouseEvent* event) override;
bool event(QEvent* event) override;
void wheelEvent(QWheelEvent*) override;
void mouseMoveEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* e) override;
// Was getTopLeft() which returned an index into mMultiSelectionList but that
// has been been changed to mMultiSelectionSet which cannot be accessed via
// an index in the same way - this function now sets
// mMultiSelectionHighlightRoomId and returns a (bool) on success or failure
// to do so.
bool getCenterSelection();
void setRoomSize(double);
void setExitSize(double);
void createLabel(QRectF labelRect);
TMap* mpMap;
QPointer<Host> mpHost;
int xzoom;
int yzoom;
int _rx;
int _ry;
QPoint mPHighlight;
bool mPick;
int mTarget;
bool mStartSpeedWalk;
QMap<int, QPoint> mAreaExitList;
// string list: 0 is event name, 1 is menu it is under if it is
QMap<QString, QStringList> mUserActions;
// unique name, List:parent name ("" if null), display name
QMap<QString, QStringList> mUserMenus;
QPoint mMoveTarget;
bool mRoomBeingMoved;
QPoint mPHighlightMove;
float mTX;
float mTY;
int mChosenRoomColor;
float xspan;
float yspan;
// Flag that the "drag to select rectangle"
// (mMultiRect) is active and is being *resized*
// by dragging
bool mMultiSelection;
QRectF mMultiRect;
bool mPopupMenu;
QSet<int> mMultiSelectionSet; // was mMultiSelectList
QPoint mOldMousePos;
bool mNewMoveAction;
QRectF mMapInfoRect;
int mFontHeight;
bool mShowRoomID;
QMap<int, QPixmap> mPixMap;
int gzoom;
double rSize;
double eSize;
int mRID;
int mAID;
int mOx;
int mOy;
int mOz;
bool mShiftMode;
bool mShowInfo;
QComboBox* arealist_combobox;
QPointer<QDialog> mpCustomLinesDialog;
int mCustomLinesRoomFrom;
int mCustomLinesRoomTo;
QString mCustomLinesRoomExit;
QComboBox* mpCurrentLineStyle;
QString mCurrentLineStyle;
QPushButton* mpCurrentLineColor;
QColor mCurrentLineColor;
QCheckBox* mpCurrentLineArrow;
bool mCurrentLineArrow;
bool mShowGrid;
QPointF mLastMouseClick;
bool mBubbleMode;
bool mMapperUseAntiAlias;
bool mLabelHilite;
bool mMoveLabel;
int mCustomLineSelectedRoom;
QString mCustomLineSelectedExit;
int mCustomLineSelectedPoint;
QTreeWidget mMultiSelectionListWidget;
bool mSizeLabel;
bool gridMapSizeChange;
bool isCenterViewCall;
QString mHelpMsg;
public slots:
void slot_roomSelectionChanged();
void slot_deleteCustomExitLine();
void slot_moveLabel();
void slot_deleteLabel();
void slot_editLabel();
void slot_setPlayerLocation();
void slot_createLabel();
void slot_customLineColor();
void shiftZup();
void shiftZdown();
void slot_switchArea(QString);
void toggleShiftMode();
void shiftUp();
void shiftDown();
void shiftLeft();
void shiftRight();
void slot_setCharacter();
void slot_setImage();
void slot_movePosition();
void slot_defineNewColor();
void slot_selectRoomColor(QListWidgetItem* pI);
void slot_moveRoom();
void slot_deleteRoom();
void slot_changeColor();
void slot_spread();
void slot_shrink();
void slot_setExits();
void slot_setUserData();
void slot_lockRoom();
void slot_unlockRoom();
void slot_setRoomWeight();
void slot_setArea();
void slot_setCustomLine();
void slot_setCustomLine2();
void slot_userAction(QString);
void slot_setCustomLine2B(QTreeWidgetItem*, int);
void slot_undoCustomLineLastPoint();
void slot_doneCustomLine();
void slot_customLineProperties();
void slot_customLineAddPoint();
void slot_customLineRemovePoint();
void slot_cancelCustomLineDialog();
private:
void resizeMultiSelectionWidget();
bool mDialogLock;
// When more than zero rooms are selected this
// is either the first (only) room in the set
// or if getCenterSelectionId() is used the
// room that is selected - this is so that it
// can be painted in yellow rather than orange
// when more than one room is selected to
// indicate the particular room that will be
// modified or be the center of those
// modifications. {for slot_spread(),
// slot_shrink(), slot_setUserData() - if ever
// implimented, slot_setExits(),
// slot_movePosition(), etc.}
int mMultiSelectionHighlightRoomId;
bool mIsSelectionSorting;
bool mIsSelectionSortByNames;
// Used to keep track of if sorting the multiple
// room listing/selection widget, and by what,
// as we now show room names (if present) as well.
bool mIsSelectionUsingNames;
};
#endif // MUDLET_T2DMAP_H