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
|
#ifndef VIEW_MAPVIEW_H
#define VIEW_MAPVIEW_H
#define WIN32_LEAN_AND_MEAN
#define OEMRESOURCE //OCR_NORMAL
#include <windows.h>
const char MapClass[] = "AOKTSMapView";
/**
* Creates a mapview window with specified owner and at specified position. The
* window will be left hidden; it is the caller's responsibility to call
* ShowWindow().
*/
HWND CreateMapView(HWND owner, int x, int y, class Scenario * scenario);
enum Map_Msgs
{
// In
MAP_Close = WM_APP + 0x150,
MAP_HighlightPoint, //x, y
MAP_UnhighlightPoint, //x, y (see MAP_UNHIGHLIGHT_ALL below)
MAP_Reset,
/* wParam: non-zero if the mapview should resize to fit the current scen
* lParam: unused.
*/
// Out
MAP_Click = WM_APP + 0x200,
/* wParam: unused
lParam: MAKELPARAM(x, y) //map coordinates
*/
MAP_SELECT_START, // Ctrl+left mouse button click initiated mouse drag
MAP_SELECT_END // mouse button has been released, the area coordinates will be saved
};
#define MAP_UNHIGHLIGHT_ALL 0xFFFFFFFF
inline void MapView_Reset(HWND mapview, bool resize = false)
{
SendMessageW(mapview, MAP_Reset, resize, 0);
}
////////////////////////////////////////////////////////////////////////////////
// Map selection structure definition //
////////////////////////////////////////////////////////////////////////////////
#define MAP_SELECTION_MAX_COUNT 256
#define MAX_GROUP 10
/*
type:
-1 - exclude RECT
-2 - exclude COORD
0 - not defined
1 - include RECT
2 - include COORD
groupID:
0 - common (default)
max. value 9, the value should be defined by user pressing num key
groupDefined:
(indexed from 0)
0 - not defined
1 - defined (group exists)
groups:
groups keeps lists of selIDs for every group
every group can have sizeof(int)*MAP_SELECTION_MAX_COUNT bytes
if the value is smaller than 0 then it is not defined (end of selID list)
if the value is 0 or greater then it is id of the selection
*/
typedef struct {
int selID;
char groupID;
RECT coord;
} MAPSEL_GENERAL;
typedef struct {
int selID;
char groupID;
} MAPSEL_GROUPS;
// Use of data in this struct is not ideal
// There will be at least 3/4 of the buffer not used!
typedef struct {
int sels_count; // count of selections user did in map viewer
char groupDefined [MAX_GROUP];
MAPSEL_GROUPS groups [MAX_GROUP][MAP_SELECTION_MAX_COUNT];
// the type specifies which type is defined for the particular selID
char type[MAP_SELECTION_MAX_COUNT]; // previous selection type
MAPSEL_GENERAL include_rect[MAP_SELECTION_MAX_COUNT];
MAPSEL_GENERAL exclude_rect[MAP_SELECTION_MAX_COUNT];
MAPSEL_GENERAL include_coord[MAP_SELECTION_MAX_COUNT];
MAPSEL_GENERAL exclude_coord[MAP_SELECTION_MAX_COUNT];
} MAPSEL_STRUCT;
#endif // VIEW_MAPVIEW_H
|