Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / tile_edit / TileCtrl.h
blobbbb5eca08437419c029f3f69916c91be953e1d1d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #if !defined(AFX_TILECTRL_H__4E768057_293D_4D27_8193_06423D1D7380__INCLUDED_)
18 #define AFX_TILECTRL_H__4E768057_293D_4D27_8193_06423D1D7380__INCLUDED_
20 #if _MSC_VER > 1000
21 #pragma once
22 #endif // _MSC_VER > 1000
23 // TileCtrl.h : header file
25 #include <list>
27 #define TILE_BPP 24
28 #define NB_MAX_TILE 1500
30 #define SIZE_SMALL 32
31 #define SIZE_NORMAL 64
32 #define SIZE_BIG 128
33 #define SPACING_SMALL_X 2
34 #define SPACING_SMALL_Y 2
35 #define SPACING_NORMAL_X 4
36 #define SPACING_NORMAL_Y 4
37 #define SPACING_BIG_X 6
38 #define SPACING_BIG_Y 6
40 #define INS_DEBUT 1
41 #define INS_FIN 2
42 #define INS_CURSEUR 3
44 #define BUFFERSIZE 200 //le buffer ne peut pas contenir plus de 100 items
45 /////////////////////////////////////////////////////////////////////////////
46 // TileCtrl window
47 class TileInfo
49 public:
50 //constructeurs
51 TileInfo();
53 //data
54 HBITMAP DibSection; BITMAPINFO BmpInfo; void *Bits;
55 char *path;
56 int Loaded; //tells if the tile was already loaded or not
57 int Selected; //tells if the tile is selected
58 int id; //numero du tile
59 int h,b,g,d; //index dans la liste des bordures pour le haut, le bas, la gauche et la droite du tile
62 typedef std::list<TileInfo*> tilelist;
64 class TileList
66 public:
67 TileList();
68 tilelist theList;
69 tilelist::iterator i; //pointeur sur le dernier element de la liste
70 int Add(const char *path); //ajoute un tile (bmp) dans la liste sans le charger
71 void Delete(tilelist::iterator i,int n);
72 void DeleteAll(); //efface provisoirement les sections DIB et les *Bits;
73 void Reload(CDC *pDC,tilelist::iterator iFirst,int n); //recharge en memoire une tranche de tiles
74 int last_id;
75 tilelist::iterator iFirst,iLast; // first and last index loaded in memory
79 class _Edge //permet de stocker toutes les bordures des tiles
81 public:
82 _Edge();
83 ~_Edge();
84 _Edge(const _Edge& edge);
86 int size;
87 char *line;
89 void CreateH(TileInfo *tile);
90 void CreateB(TileInfo *tile);
91 void CreateG(TileInfo *tile);
92 void CreateD(TileInfo *tile);
93 int operator==(const _Edge &ed) const;
96 typedef list<_Edge> edgelist;
98 extern int CALLBACK CompareFunc(LPARAM lParam1,LPARAM lParam2,LPARAM lParamSort);
99 extern int _LoadBitmap(const std::string& path,LPBITMAPINFO BitmapInfo, std::vector<NLMISC::CBGRA>&Tampon, std::vector<NLMISC::CBGRA>* Alpha, int rot);
103 class TileCtrl : public CListCtrl
105 // Construction
106 public:
107 //owner functions
108 TileCtrl();
109 void Init();
110 void Delete();
111 void DrawTile(int i,CDC *pDC);
112 void UpdateBuffer(); //permet de charger et d'effacer tous les buffers inutiles des tiles invisible
113 int LoadInListCtrl(tilelist::iterator iFirst,tilelist::iterator iLast);
114 void DeleteTile(int i);
115 int IsSelected(int i);
116 void CheckTile(TileInfo *theTile); //check si le tile est "tilable" avec un autre et initialise h,b,g,d dans TileInfo
117 void ShadeRect( CDC *pDC, CRect& rect ); //permet d'afficher un bitmap selectionne a la "windows style"
118 void InsertItemInCtrlList(tilelist::iterator iFirst,tilelist::iterator iLast);
119 void GetVisibility(int &First,int &Last);
120 int GetNbTileLine(void);
121 int GetNbTileColumn(void);
122 int GetIndex(LPPOINT pt);
123 POINT GetPos(int i);
125 //owner data
126 TileList InfoList;
127 edgelist EdgeList; //liste de toutes les bordures
128 int sizetile_x,sizetile_y;
129 int sizeicon_x,sizeicon_y,spacing_x,spacing_y,spacing_tile_text;
130 int scrollpos;
131 int Sort; //radio button state (1,2,3)
132 int Zoom;
133 int Texture;
134 int InfoTexte;
135 CImageList *pImList;
136 void *pipo_buffer;
137 CBitmap *bmp;
138 int count_;
139 int ViewTileMode;
140 TileInfo TileCroix;
141 CPoint MousePos;
142 int iFirst,iLast; //indexes du premier et du dernier item du buffer
143 int iFV,iLV; //index du premier et du dernier item visible
145 // Attributes
146 public:
149 // Operations
150 public:
152 // Overrides
153 // ClassWizard generated virtual function overrides
154 //{{AFX_VIRTUAL(TileCtrl)
155 protected:
156 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
157 //}}AFX_VIRTUAL
159 // Implementation
160 public:
161 virtual ~TileCtrl();
163 // Generated message map functions
164 protected:
165 //{{AFX_MSG(TileCtrl)
166 afx_msg void OnPaint();
167 afx_msg void OnDropFiles(HDROP hDropInfo);
168 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
169 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
170 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
171 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
172 //}}AFX_MSG
174 DECLARE_MESSAGE_MAP()
177 /////////////////////////////////////////////////////////////////////////////
179 //{{AFX_INSERT_LOCATION}}
180 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
182 #endif // !defined(AFX_TILECTRL_H__4E768057_293D_4D27_8193_06423D1D7380__INCLUDED_)