aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/View_cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/View_cpp-source.html')
-rw-r--r--docs/doxygen/nel/View_cpp-source.html1711
1 files changed, 1711 insertions, 0 deletions
diff --git a/docs/doxygen/nel/View_cpp-source.html b/docs/doxygen/nel/View_cpp-source.html
new file mode 100644
index 00000000..00f44d91
--- /dev/null
+++ b/docs/doxygen/nel/View_cpp-source.html
@@ -0,0 +1,1711 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.2 on Thu May 31 22:01:27 2001 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>View.cpp</h1><a href="View_cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// View.cpp : implementation file</font>
+00002 <font class="comment">//</font>
+00003
+00004 <font class="preprocessor">#include "<a class="code" href="tile_edit_stdafx_h.html">stdafx.h</a>"</font>
+00005 <font class="preprocessor">#include "<a class="code" href="tile_edit_resource_h.html">resource.h</a>"</font>
+00006 <font class="preprocessor">#include "<a class="code" href="View_h.html">View.h</a>"</font>
+00007 <font class="preprocessor">#include "<a class="code" href="SelectionTerritoire_h.html">SelectionTerritoire.h</a>"</font>
+00008 <font class="preprocessor">#include "<a class="code" href="select_rotation_h.html">select_rotation.h</a>"</font>
+00009 <font class="preprocessor">#include "<a class="code" href="Browse_h.html">Browse.h</a>"</font>
+00010 <font class="preprocessor">#include "popup.h"</font>
+00011 <font class="preprocessor">#include &lt;direct.h&gt;</font>
+00012 <font class="comment">//#include "ListGroup.h"</font>
+00013 <font class="preprocessor">#include &lt;<a class="code" href="tile_bank_h.html">nel/3d/tile_bank.h</a>&gt;</font>
+00014 <font class="comment">//#include "ViewPopup.h"</font>
+00015 <font class="preprocessor">#include "pic\<a class="code" href="readpic_h.html">readpic.h</a>"</font>
+00016
+00017 <font class="comment">/*#ifdef _DEBUG
+</font>00018 <font class="comment">#define new DEBUG_NEW
+</font>00019 <font class="comment">#undef THIS_FILE
+</font>00020 <font class="comment">static char THIS_FILE[] = __FILE__;
+</font>00021 <font class="comment">#endif*/</font>
+00022
+00023 <font class="keyword">using</font> <font class="keyword">namespace</font> NL3D;
+00024
+00025 <font class="keyword">extern</font> CTileBank tileBank2;
+00026
+00027 <a class="code" href="ViewColumn_cpp.html#a1">BEGIN_MESSAGE_MAP</a>(<a class="code" href="class_CTView.html">CTView</a>, <a class="code" href="class_CStatic.html">CStatic</a>)
+00028 <font class="comment">//{{AFX_MSG_MAP(CTView)</font>
+00029 ON_WM_DROPFILES()
+00030 ON_WM_PAINT()
+00031 ON_WM_LBUTTONDBLCLK()
+00032 ON_WM_LBUTTONDOWN()
+00033 ON_WM_RBUTTONDOWN()
+00034 <font class="comment">//}}AFX_MSG_MAP</font>
+00035 END_MESSAGE_MAP()
+00036
+00037 CFont *normal_font = NULL;
+00038 <font class="comment">//int SortTile = 0; int sortMode = 1; //or, and</font>
+<a name="l00039"></a><a class="code" href="View_cpp.html#a1">00039</a> __int64 flagGroupSort = 0; <font class="keywordtype">int</font> showNULL = 0;
+00040 <font class="comment">//ViewPopup *theViewPopup = 0;</font>
+00041
+<a name="l00042"></a><a class="code" href="View_cpp.html#a3">00042</a> <font class="keywordtype">bool</font> <a class="code" href="View_cpp.html#a3">zouille</a> ()<font class="keyword">
+</font>00043 <font class="keyword"></font>{
+00044 <font class="keywordflow">return</font> (GetAsyncKeyState(VK_F2)&amp;(1&lt;&lt;15)) != 0;
+00045 };
+00046
+00047 <font class="comment">// Rotate a buffer</font>
+<a name="l00048"></a><a class="code" href="View_cpp.html#a4">00048</a> <font class="keywordtype">void</font> <a class="code" href="View_cpp.html#a4">rotateBuffer</a> (uint &amp;Width, uint &amp;Height, std::vector&lt;NLMISC::CBGRA&gt;&amp; Tampon)<font class="keyword">
+</font>00049 <font class="keyword"></font>{
+00050 <font class="comment">// Make a copy</font>
+00051 std::vector&lt;NLMISC::CBGRA&gt; copy=Tampon;
+00052
+00053 <font class="comment">// Rotate</font>
+00054 <font class="keywordflow">for</font> (uint y=0; y&lt;Width; y++)
+00055 {
+00056 <font class="comment">// Line offset</font>
+00057 uint tmp=y*Width;
+00058 <font class="keywordflow">for</font> (uint x=0; x&lt;Width; x++)
+00059 {
+00060 Tampon[y+(Width-x-1)*Height]=copy[x+tmp];
+00061 }
+00062 }
+00063
+00064 <font class="comment">// New size</font>
+00065 uint tmp=Width;
+00066 Width=Height;
+00067 Height=tmp;
+00068 }
+00069
+00071 <font class="comment">// CTView</font>
+00072 <font class="comment">//Attention : windows veut que le buffer image commence du bas vers le haut</font>
+<a name="l00073"></a><a class="code" href="View_cpp.html#a19">00073</a> <font class="keywordtype">int</font> <a class="code" href="TileCtrl_h.html#a19">_LoadBitmap</a>(<font class="keyword">const</font> std::string&amp; path,LPBITMAPINFO BitmapInfo, std::vector&lt;NLMISC::CBGRA&gt;&amp;Tampon, std::vector&lt;NLMISC::CBGRA&gt;* Alpha, <font class="keywordtype">int</font> rot)<font class="keyword">
+</font>00074 <font class="keyword"></font>{
+00075 <font class="comment">//vector&lt;NLMISC::CBGRA&gt; Tampon;</font>
+00076 uint Width;
+00077 uint Height;
+00078 <font class="keywordflow">if</font> (<a class="code" href="readpic_cpp.html#a0">PIC_LoadPic</a>(path, Tampon, Width, Height))
+00079 {
+00080 BitmapInfo-&gt;bmiHeader.biSize=<font class="keyword">sizeof</font>(BITMAPINFOHEADER);
+00081 BitmapInfo-&gt;bmiHeader.biWidth=Width;
+00082 BitmapInfo-&gt;bmiHeader.biHeight=-(<font class="keywordtype">int</font>)Height;
+00083 BitmapInfo-&gt;bmiHeader.biPlanes=1;
+00084 BitmapInfo-&gt;bmiHeader.biBitCount=32;
+00085 BitmapInfo-&gt;bmiHeader.biCompression=BI_RGB;
+00086 BitmapInfo-&gt;bmiHeader.biSizeImage=0;
+00087 BitmapInfo-&gt;bmiHeader.biXPelsPerMeter=1;
+00088 BitmapInfo-&gt;bmiHeader.biYPelsPerMeter=1;
+00089 BitmapInfo-&gt;bmiHeader.biClrUsed=0;
+00090 BitmapInfo-&gt;bmiHeader.biClrImportant=0;
+00091 BitmapInfo-&gt;bmiColors-&gt;rgbBlue=0;
+00092 BitmapInfo-&gt;bmiColors-&gt;rgbRed=0;
+00093 BitmapInfo-&gt;bmiColors-&gt;rgbGreen=0;
+00094
+00095 <font class="keywordflow">while</font> (rot)
+00096 {
+00097 <font class="comment">// Rotate the buffer</font>
+00098 <a class="code" href="View_cpp.html#a4">rotateBuffer</a> (Width, Height, Tampon);
+00099 rot--;
+00100 }
+00101
+00102 <font class="keywordflow">if</font> ((Alpha)&amp;&amp;(Alpha-&gt;size()==Tampon.size()))
+00103 {
+00104 <font class="comment">// Pre mul RGB componates by Alpha one</font>
+00105 <font class="keywordtype">int</font> nPixelCount=(<font class="keywordtype">int</font>)(Width*Height);
+00106 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> p=0; p&lt;nPixelCount; p++)
+00107 {
+00108 <font class="comment">// Invert alpha ?</font>
+00109 <font class="keywordtype">int</font> alpha=(*Alpha)[p].A;
+00110 Tampon[p].R=(uint8)(((<font class="keywordtype">int</font>)Tampon[p].R*alpha)&gt;&gt;8);
+00111 Tampon[p].G=(uint8)(((<font class="keywordtype">int</font>)Tampon[p].G*alpha)&gt;&gt;8);
+00112 Tampon[p].B=(uint8)(((<font class="keywordtype">int</font>)Tampon[p].B*alpha)&gt;&gt;8);
+00113 }
+00114 }
+00115
+00116 <font class="keywordflow">return</font> 1;
+00117 }
+00118 <font class="keywordflow">else</font>
+00119 <font class="keywordflow">return</font> 0;
+00120 }
+00121
+00122
+00123
+00124
+00125
+00126
+00127 <font class="comment">//TileInfo</font>
+00128 <a class="code" href="class_TileInfo.html#a0">TileInfo::TileInfo</a>()<font class="keyword">
+</font>00129 <font class="keyword"></font>{
+00130 nightLoaded = 0;
+00131 alphaLoaded = 0;
+00132 loaded = 0;
+00133 Selected = 0;
+00134 }
+00135
+00136
+00137
+00138 <font class="comment">//TileList</font>
+00139 <a class="code" href="class_TileList.html#a0">TileList::TileList</a>()<font class="keyword">
+</font>00140 <font class="keyword"></font>{
+00141 last_id = 0;
+00142 _tileSet = -1;
+00143
+00144 <font class="comment">// Add 48 transitions</font>
+00145 <font class="keywordtype">int</font> i;
+00146 <font class="keywordflow">for</font> (i=0; i&lt;CTileSet::count; i++)
+00147 {
+00148 <a class="code" href="class_TileInfo.html">TileInfo</a> info;
+00149 info.id = i;
+00150
+00151 theListTransition.push_back (info);
+00152 }
+00153
+00154 <font class="comment">// Add 16 displacements</font>
+00155 <font class="keywordflow">for</font> (i=0; i&lt;CTileSet::CountDisplace; i++)
+00156 {
+00157 <a class="code" href="class_TileInfo.html">TileInfo</a> info;
+00158 info.id = i;
+00159
+00160 theListDisplacement.push_back (info);
+00161 }
+00162 }
+00163
+00164
+<a name="l00165"></a><a class="code" href="class_TileList.html#a9">00165</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a9">TileList::addTile128</a> ()<font class="keyword">
+</font>00166 <font class="keyword"></font>{
+00167
+00168 <font class="keywordtype">int</font> index;
+00169 tileBank2.getTileSet (_tileSet)-&gt;addTile128 (index, tileBank2);
+00170 <a class="code" href="debug_h.html#a6">nlassert</a> (index==(sint)theList128.size());
+00171
+00172 <a class="code" href="class_TileInfo.html">TileInfo</a> info;
+00173 info.id = index;
+00174 theList128.push_back (info);
+00175
+00176 <font class="keywordflow">return</font> index;
+00177 }
+00178
+<a name="l00179"></a><a class="code" href="class_TileList.html#a10">00179</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a10">TileList::addTile256</a> ()<font class="keyword">
+</font>00180 <font class="keyword"></font>{
+00181 <font class="keywordtype">int</font> index;
+00182 tileBank2.getTileSet (_tileSet)-&gt;addTile256 (index, tileBank2);
+00183 <a class="code" href="debug_h.html#a6">nlassert</a> (index==(sint)theList256.size());
+00184
+00185 <a class="code" href="class_TileInfo.html">TileInfo</a> info;
+00186 info.id = index;
+00187 theList256.push_back (info);
+00188
+00189 <font class="keywordflow">return</font> index;
+00190 }
+00191
+00192 <font class="keywordtype">bool</font> <a class="code" href="SelectionTerritoire_cpp.html#a4">RemovePath</a> (std::string&amp; path, <font class="keyword">const</font> <font class="keywordtype">char</font>* absolutePathToRemplace);
+00193
+<a name="l00194"></a><a class="code" href="class_TileList.html#a11">00194</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a11">TileList::setTile128</a> (<font class="keywordtype">int</font> tile, <font class="keyword">const</font> std::string&amp; name, NL3D::CTile::TBitmap type)<font class="keyword">
+</font>00195 <font class="keyword"></font>{
+00196 <font class="comment">// Remove the absolute path from the path name</font>
+00197 std::string troncated=name;
+00198 <font class="keywordflow">if</font> (<a class="code" href="SelectionTerritoire_cpp.html#a4">RemovePath</a> (troncated, tileBank2.getAbsPath ().c_str()))
+00199 {
+00200 vector&lt;NLMISC::CBGRA&gt; tampon;
+00201 uint Width;
+00202 uint Height;
+00203 <font class="keywordflow">if</font> (!<a class="code" href="readpic_cpp.html#a0">PIC_LoadPic</a>(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
+00204 {
+00205 MessageBox (NULL, (tileBank2.getAbsPath ()+troncated).c_str(), <font class="stringliteral">"Can't load bitmap."</font>, MB_OK|MB_ICONEXCLAMATION);
+00206 <font class="keywordflow">return</font> 0;
+00207 }
+00208 <font class="keywordflow">else</font>
+00209 {
+00210 CTileBorder border;
+00211 border.set (Width, Height, tampon);
+00212
+00213 CTileSet::TError error;
+00214 <font class="keywordtype">int</font> pixel=-1;
+00215 <font class="keywordtype">int</font> composante=4;
+00216 error=tileBank2.getTileSet(_tileSet)-&gt;checkTile128 (type, border, pixel, composante);
+00217 <font class="keywordflow">if</font> ((error!=CTileSet::ok)&amp;&amp;(error!=CTileSet::addFirstA128128)&amp;&amp;!<a class="code" href="View_cpp.html#a3">zouille</a> ())
+00218 {
+00219 <font class="keywordtype">char</font> sTmp[512];
+00220 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* comp[]={<font class="stringliteral">"Red"</font>, <font class="stringliteral">"Green"</font>, <font class="stringliteral">"Blue"</font>, <font class="stringliteral">"Alpha"</font>, <font class="stringliteral">""</font>};
+00221 sprintf (sTmp, <font class="stringliteral">"%s\nPixel: %d (%s)"</font>, CTileSet::getErrorMessage (error), pixel, comp[composante]);
+00222 MessageBox (NULL, sTmp, <font class="stringliteral">"Can't add tile"</font>, MB_OK|MB_ICONEXCLAMATION);
+00223 <font class="keywordflow">return</font> 0;
+00224 }
+00225 <font class="keywordflow">else</font>
+00226 {
+00227 <font class="keywordflow">if</font> (error==CTileSet::addFirstA128128)
+00228 tileBank2.getTileSet(_tileSet)-&gt;setBorder (type, border);
+00229
+00230 tileBank2.getTileSet(_tileSet)-&gt;setTile128 (tile, troncated, type, tileBank2);
+00231 <font class="keywordflow">switch</font> (type)
+00232 {
+00233 <font class="keywordflow">case</font> CTile::diffuse:
+00234 theList128[tile].loaded=0;
+00235 <font class="keywordflow">break</font>;
+00236 <font class="keywordflow">case</font> CTile::additive:
+00237 theList128[tile].nightLoaded=0;
+00238 <font class="keywordflow">break</font>;
+00239 <font class="keywordflow">case</font> CTile::alpha:
+00240 theList128[tile].alphaLoaded=0;
+00241 <font class="keywordflow">break</font>;
+00242 }
+00243 theList128[tile].Load (tileBank2.getTileSet(_tileSet)-&gt;getTile128(tile), NULL);
+00244 }
+00245 }
+00246 }
+00247 <font class="keywordflow">else</font>
+00248 {
+00249 <font class="comment">// Error: bitmap not in the absolute path..</font>
+00250 <font class="keywordtype">char</font> msg[512];
+00251 sprintf (msg, <font class="stringliteral">"The bitmap %s is not in the absolute path %s."</font>, name.c_str(), tileBank2.getAbsPath ().c_str());
+00252 MessageBox (NULL, msg, <font class="stringliteral">"Load error"</font>, MB_OK|MB_ICONEXCLAMATION);
+00253 }
+00254
+00255 <font class="keywordflow">return</font> 1;
+00256 }
+00257
+<a name="l00258"></a><a class="code" href="class_TileList.html#a12">00258</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a12">TileList::setTile256</a> (<font class="keywordtype">int</font> tile, <font class="keyword">const</font> std::string&amp; name, NL3D::CTile::TBitmap type)<font class="keyword">
+</font>00259 <font class="keyword"></font>{
+00260 <font class="comment">// Remove the absolute path from the path name</font>
+00261 std::string troncated=name;
+00262 <font class="keywordflow">if</font> (<a class="code" href="SelectionTerritoire_cpp.html#a4">RemovePath</a> (troncated, tileBank2.getAbsPath ().c_str()))
+00263 {
+00264 vector&lt;NLMISC::CBGRA&gt; tampon;
+00265 uint Width;
+00266 uint Height;
+00267 <font class="keywordflow">if</font> (!<a class="code" href="readpic_cpp.html#a0">PIC_LoadPic</a>(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
+00268 {
+00269 MessageBox (NULL, (tileBank2.getAbsPath ()+troncated).c_str(), <font class="stringliteral">"Can't load bitmap."</font>, MB_OK|MB_ICONEXCLAMATION);
+00270 <font class="keywordflow">return</font> 0;
+00271 }
+00272 <font class="keywordflow">else</font>
+00273 {
+00274 CTileBorder border;
+00275 border.set (Width, Height, tampon);
+00276
+00277 CTileSet::TError error;
+00278 <font class="keywordtype">int</font> pixel=-1;
+00279 <font class="keywordtype">int</font> composante=4;
+00280
+00281 <font class="keywordflow">if</font> (((error=tileBank2.getTileSet(_tileSet)-&gt;checkTile256 (type, border, pixel, composante))!=CTileSet::ok)&amp;&amp;!<a class="code" href="View_cpp.html#a3">zouille</a>())
+00282 {
+00283 <font class="keywordtype">char</font> sTmp[512];
+00284 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* comp[]={<font class="stringliteral">"Red"</font>, <font class="stringliteral">"Green"</font>, <font class="stringliteral">"Blue"</font>, <font class="stringliteral">"Alpha"</font>, <font class="stringliteral">""</font>};
+00285 sprintf (sTmp, <font class="stringliteral">"%s\nPixel: %d (%s)"</font>, CTileSet::getErrorMessage (error), pixel, comp[composante]);
+00286 MessageBox (NULL, sTmp, <font class="stringliteral">"Can't add tile"</font>, MB_OK|MB_ICONEXCLAMATION);
+00287 <font class="keywordflow">return</font> 0;
+00288 }
+00289 <font class="keywordflow">else</font>
+00290 {
+00291 tileBank2.getTileSet(_tileSet)-&gt;setTile256 (tile, troncated, type, tileBank2);
+00292 <font class="keywordflow">switch</font> (type)
+00293 {
+00294 <font class="keywordflow">case</font> CTile::diffuse:
+00295 theList256[tile].loaded=0;
+00296 <font class="keywordflow">break</font>;
+00297 <font class="keywordflow">case</font> CTile::additive:
+00298 theList256[tile].nightLoaded=0;
+00299 <font class="keywordflow">break</font>;
+00300 <font class="keywordflow">case</font> CTile::alpha:
+00301 theList256[tile].alphaLoaded=0;
+00302 <font class="keywordflow">break</font>;
+00303 }
+00304 theList256[tile].Load (tileBank2.getTileSet(_tileSet)-&gt;getTile256(tile), NULL);
+00305 }
+00306 }
+00307 }
+00308 <font class="keywordflow">else</font>
+00309 {
+00310 <font class="comment">// Error: bitmap not in the absolute path..</font>
+00311 <font class="keywordtype">char</font> msg[512];
+00312 sprintf (msg, <font class="stringliteral">"The bitmap %s is not in the absolute path %s."</font>, name.c_str(), tileBank2.getAbsPath ().c_str());
+00313 MessageBox (NULL, msg, <font class="stringliteral">"Load error"</font>, MB_OK|MB_ICONEXCLAMATION);
+00314 }
+00315
+00316 <font class="keywordflow">return</font> 1;
+00317 }
+00318
+<a name="l00319"></a><a class="code" href="class_TileList.html#a13">00319</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a13">TileList::setTileTransition</a> (<font class="keywordtype">int</font> tile, <font class="keyword">const</font> std::string&amp; name, NL3D::CTile::TBitmap type)<font class="keyword">
+</font>00320 <font class="keyword"></font>{
+00321 <font class="comment">// Remove the absolute path from the path name</font>
+00322 std::string troncated=name;
+00323 <font class="keywordflow">if</font> (<a class="code" href="SelectionTerritoire_cpp.html#a4">RemovePath</a> (troncated, tileBank2.getAbsPath ().c_str()))
+00324 {
+00325 <font class="comment">// No alpha, use setTileTransitionAlpha</font>
+00326 <a class="code" href="debug_h.html#a6">nlassert</a> (CTile::alpha!=type);
+00327
+00328 vector&lt;NLMISC::CBGRA&gt; tampon;
+00329 uint Width;
+00330 uint Height;
+00331 <font class="keywordflow">if</font> (!<a class="code" href="readpic_cpp.html#a0">PIC_LoadPic</a>(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
+00332 {
+00333 MessageBox (NULL, (tileBank2.getAbsPath ()+troncated).c_str(), <font class="stringliteral">"Can't load bitmap."</font>, MB_OK|MB_ICONEXCLAMATION);
+00334 <font class="keywordflow">return</font> 0;
+00335 }
+00336 <font class="keywordflow">else</font>
+00337 {
+00338 CTileBorder border;
+00339 border.set (Width, Height, tampon);
+00340
+00341 CTileSet::TError error;
+00342 <font class="keywordtype">int</font> pixel=-1;
+00343 <font class="keywordtype">int</font> composante=4;
+00344 error=tileBank2.getTileSet(_tileSet)-&gt;checkTile128 (type, border, pixel, composante);
+00345 <font class="keywordflow">if</font> ((error!=CTileSet::ok)&amp;&amp;(error!=CTileSet::addFirstA128128)&amp;&amp;!<a class="code" href="View_cpp.html#a3">zouille</a> ())
+00346 {
+00347 <font class="keywordtype">char</font> sTmp[512];
+00348 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* comp[]={<font class="stringliteral">"Red"</font>, <font class="stringliteral">"Green"</font>, <font class="stringliteral">"Blue"</font>, <font class="stringliteral">"Alpha"</font>, <font class="stringliteral">""</font>};
+00349 sprintf (sTmp, <font class="stringliteral">"%s\nPixel: %d (%s)"</font>, CTileSet::getErrorMessage (error), pixel, comp[composante]);
+00350 MessageBox (NULL, sTmp, <font class="stringliteral">"Can't add tile"</font>, MB_OK|MB_ICONEXCLAMATION);
+00351 <font class="keywordflow">return</font> 0;
+00352 }
+00353 <font class="keywordflow">else</font>
+00354 {
+00355 <font class="keywordflow">if</font> (error==CTileSet::addFirstA128128)
+00356 tileBank2.getTileSet(_tileSet)-&gt;setBorder (type, border);
+00357 tileBank2.getTileSet(_tileSet)-&gt;setTileTransition ((CTileSet::TTransition)tile, troncated, type, tileBank2, border);
+00358 <font class="keywordflow">switch</font> (type)
+00359 {
+00360 <font class="keywordflow">case</font> CTile::diffuse:
+00361 theListTransition[tile].loaded=0;
+00362 <font class="keywordflow">break</font>;
+00363 <font class="keywordflow">case</font> CTile::additive:
+00364 theListTransition[tile].nightLoaded=0;
+00365 <font class="keywordflow">break</font>;
+00366 <font class="keywordflow">case</font> CTile::alpha:
+00367 theListTransition[tile].alphaLoaded=0;
+00368 <font class="keywordflow">break</font>;
+00369 }
+00370 theListTransition[tile].Load (tileBank2.getTileSet(_tileSet)-&gt;getTransition(tile)-&gt;getTile(),
+00371 &amp;theListTransition[tile].alphaBits);
+00372 }
+00373 }
+00374 }
+00375 <font class="keywordflow">else</font>
+00376 {
+00377 <font class="comment">// Error: bitmap not in the absolute path..</font>
+00378 <font class="keywordtype">char</font> msg[512];
+00379 sprintf (msg, <font class="stringliteral">"The bitmap %s is not in the absolute path %s."</font>, name.c_str(), tileBank2.getAbsPath ().c_str());
+00380 MessageBox (NULL, msg, <font class="stringliteral">"Load error"</font>, MB_OK|MB_ICONEXCLAMATION);
+00381 }
+00382
+00383 <font class="keywordflow">return</font> 1;
+00384 }
+00385
+<a name="l00386"></a><a class="code" href="class_TileList.html#a15">00386</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a15">TileList::setDisplacement</a> (<font class="keywordtype">int</font> tile, <font class="keyword">const</font> std::string&amp; name)<font class="keyword">
+</font>00387 <font class="keyword"></font>{
+00388 <font class="comment">// Remove the absolute path from the path name</font>
+00389 std::string troncated=name;
+00390 <font class="keywordflow">if</font> (<a class="code" href="SelectionTerritoire_cpp.html#a4">RemovePath</a> (troncated, tileBank2.getAbsPath ().c_str()))
+00391 {
+00392 <font class="comment">// change the file name of the displacement map</font>
+00393 tileBank2.getTileSet(_tileSet)-&gt;setDisplacement ((CTileSet::TDisplacement)tile, troncated);
+00394
+00395 <font class="comment">// not loaded</font>
+00396 theListDisplacement[tile].loaded=0;
+00397
+00398 <font class="comment">// load it</font>
+00399 <font class="keywordflow">if</font> (name!=<font class="stringliteral">""</font>)
+00400 {
+00401 <font class="keywordflow">if</font> (!<a class="code" href="TileCtrl_h.html#a19">_LoadBitmap</a>(tileBank2.getAbsPath() + name, &amp;theListDisplacement[tile].BmpInfo, theListDisplacement[tile].Bits, NULL, 0))
+00402 MessageBox (NULL, (tileBank2.getAbsPath() + name).c_str(), <font class="stringliteral">"Can't load file"</font>, MB_OK|MB_ICONEXCLAMATION);
+00403 <font class="keywordflow">else</font>
+00404 theListDisplacement[tile].loaded=1;
+00405 }
+00406 }
+00407 <font class="keywordflow">else</font>
+00408 {
+00409 <font class="comment">// Error: bitmap not in the absolute path..</font>
+00410 <font class="keywordtype">char</font> msg[512];
+00411 sprintf (msg, <font class="stringliteral">"The bitmap %s is not in the absolute path %s."</font>, name.c_str(), tileBank2.getAbsPath ().c_str());
+00412 MessageBox (NULL, msg, <font class="stringliteral">"Load error"</font>, MB_OK|MB_ICONEXCLAMATION);
+00413 }
+00414
+00415 <font class="keywordflow">return</font> 1;
+00416 }
+00417
+<a name="l00418"></a><a class="code" href="class_TileList.html#a14">00418</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a14">TileList::setTileTransitionAlpha</a> (<font class="keywordtype">int</font> tile, <font class="keyword">const</font> std::string&amp; name, <font class="keywordtype">int</font> rot)<font class="keyword">
+</font>00419 <font class="keyword"></font>{
+00420 <font class="comment">// Remove the absolute path from the path name</font>
+00421 std::string troncated=name;
+00422 <font class="keywordflow">if</font> (<a class="code" href="SelectionTerritoire_cpp.html#a4">RemovePath</a> (troncated, tileBank2.getAbsPath ().c_str()))
+00423 {
+00424 vector&lt;NLMISC::CBGRA&gt; tampon;
+00425 uint Width;
+00426 uint Height;
+00427 <font class="keywordflow">if</font> (!<a class="code" href="readpic_cpp.html#a0">PIC_LoadPic</a>(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
+00428 {
+00429 MessageBox (NULL, (tileBank2.getAbsPath ()+troncated).c_str(), <font class="stringliteral">"Can't load bitmap."</font>, MB_OK|MB_ICONEXCLAMATION);
+00430 <font class="keywordflow">return</font> 0;
+00431 }
+00432 <font class="keywordflow">else</font>
+00433 {
+00434 CTileBorder border;
+00435 border.set (Width, Height, tampon);
+00436
+00437 <font class="comment">// rotate the border</font>
+00438 <font class="keywordtype">int</font> rotBis=rot;
+00439 <font class="keywordflow">while</font> (rotBis)
+00440 {
+00441 border.rotate ();
+00442 rotBis--;
+00443 }
+00444
+00445 CTileSet::TError error;
+00446 <font class="keywordtype">int</font> indexError;
+00447 <font class="keywordtype">int</font> pixel=-1;
+00448 <font class="keywordtype">int</font> composante=4;
+00449 <font class="keywordflow">if</font> (((error=tileBank2.getTileSet(_tileSet)-&gt;checkTileTransition ((CTileSet::TTransition)tile, CTile::alpha, border, indexError,
+00450 pixel, composante))!=CTileSet::ok)&amp;&amp;!<a class="code" href="View_cpp.html#a3">zouille</a> ())
+00451 {
+00452 <font class="keywordtype">char</font> sMsg[512];
+00453 <font class="keywordflow">if</font> ((error==CTileSet::topInterfaceProblem)||(error==CTileSet::bottomInterfaceProblem)||(error==CTileSet::leftInterfaceProblem)
+00454 ||(error==CTileSet::rightInterfaceProblem)||(error==CTileSet::topBottomNotTheSame)||(error==CTileSet::rightLeftNotTheSame)
+00455 ||(error==CTileSet::topInterfaceProblem))
+00456 {
+00457 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">char</font>* comp[]={<font class="stringliteral">"Red"</font>, <font class="stringliteral">"Green"</font>, <font class="stringliteral">"Blue"</font>, <font class="stringliteral">"Alpha"</font>, <font class="stringliteral">""</font>};
+00458 <font class="keywordflow">if</font> (indexError!=-1)
+00459 sprintf (sMsg, <font class="stringliteral">"%s\nIncompatible with tile n°%d\nPixel: %d (%s)"</font>, CTileSet::getErrorMessage (error), indexError,
+00460 pixel, comp[composante]);
+00461 <font class="keywordflow">else</font>
+00462 sprintf (sMsg, <font class="stringliteral">"%s\nIncompatible with the 128x128 tile\nPixel: %d (%s)"</font>, CTileSet::getErrorMessage (error),
+00463 pixel, comp[composante]);
+00464 }
+00465 <font class="keywordflow">else</font>
+00466 sprintf (sMsg, <font class="stringliteral">"%s\nIncompatible filled tile"</font>, CTileSet::getErrorMessage (error));
+00467 MessageBox (NULL, sMsg, <font class="stringliteral">"Can't add tile"</font>, MB_OK|MB_ICONEXCLAMATION);
+00468 <font class="keywordflow">return</font> 0;
+00469 }
+00470 <font class="keywordflow">else</font>
+00471 {
+00472 tileBank2.getTileSet(_tileSet)-&gt;setTileTransitionAlpha ((CTileSet::TTransition)tile, troncated, tileBank2, border, rot);
+00473 theListTransition[tile].alphaLoaded=0;
+00474 theListTransition[tile].Load (tileBank2.getTileSet(_tileSet)-&gt;getTransition(tile)-&gt;getTile(), NULL);
+00475 }
+00476 }
+00477 }
+00478 <font class="keywordflow">else</font>
+00479 {
+00480 <font class="comment">// Error: bitmap not in the absolute path..</font>
+00481 <font class="keywordtype">char</font> msg[512];
+00482 sprintf (msg, <font class="stringliteral">"The bitmap %s is not in the absolute path %s."</font>, name.c_str(), tileBank2.getAbsPath ().c_str());
+00483 MessageBox (NULL, msg, <font class="stringliteral">"Load error"</font>, MB_OK|MB_ICONEXCLAMATION);
+00484 }
+00485
+00486 <font class="keywordflow">return</font> 1;
+00487 }
+00488
+<a name="l00489"></a><a class="code" href="class_TileList.html#a16">00489</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a16">TileList::removeTile128</a> (<font class="keywordtype">int</font> index)<font class="keyword">
+</font>00490 <font class="keyword"></font>{
+00491 tileBank2.getTileSet (_tileSet)-&gt;removeTile128 (index, tileBank2);
+00492 theList[0].erase (theList[0].begin()+index);
+00493 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;(sint)theList[0].size(); i++)
+00494 {
+00495 theList[0][i].id=i;
+00496 }
+00497 }
+00498
+<a name="l00499"></a><a class="code" href="class_TileList.html#a17">00499</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a17">TileList::removeTile256</a> (<font class="keywordtype">int</font> index)<font class="keyword">
+</font>00500 <font class="keyword"></font>{
+00501 tileBank2.getTileSet (_tileSet)-&gt;removeTile256 (index, tileBank2);
+00502 theList[1].erase (theList[1].begin()+index);
+00503 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;(sint)theList[1].size(); i++)
+00504 {
+00505 theList[1][i].id=i;
+00506 }
+00507 }
+00508
+<a name="l00509"></a><a class="code" href="class_TileList.html#a18">00509</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a18">TileList::clearTile128</a> (<font class="keywordtype">int</font> index, CTile::TBitmap bitmap)<font class="keyword">
+</font>00510 <font class="keyword"></font>{
+00511 <font class="keywordflow">switch</font> (bitmap)
+00512 {
+00513 <font class="keywordflow">case</font> CTile::diffuse:
+00514 theList128[index].loaded=0;
+00515 theList128[index].Bits.resize(0);
+00516 <font class="keywordflow">break</font>;
+00517 <font class="keywordflow">case</font> CTile::additive:
+00518 theList128[index].nightLoaded=0;
+00519 theList128[index].nightBits.resize(0);
+00520 <font class="keywordflow">break</font>;
+00521 <font class="keywordflow">case</font> CTile::alpha:
+00522 theList128[index].alphaLoaded=0;
+00523 theList128[index].alphaBits.resize(0);
+00524 <font class="keywordflow">break</font>;
+00525 }
+00526 tileBank2.getTileSet (_tileSet)-&gt;clearTile128 (index, bitmap, tileBank2);
+00527 }
+00528
+<a name="l00529"></a><a class="code" href="class_TileList.html#a19">00529</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a19">TileList::clearTile256</a> (<font class="keywordtype">int</font> index, CTile::TBitmap bitmap)<font class="keyword">
+</font>00530 <font class="keyword"></font>{
+00531 <font class="keywordflow">switch</font> (bitmap)
+00532 {
+00533 <font class="keywordflow">case</font> CTile::diffuse:
+00534 theList256[index].loaded=0;
+00535 theList256[index].Bits.resize(0);
+00536 <font class="keywordflow">break</font>;
+00537 <font class="keywordflow">case</font> CTile::additive:
+00538 theList256[index].nightLoaded=0;
+00539 theList256[index].nightBits.resize(0);
+00540 <font class="keywordflow">break</font>;
+00541 <font class="keywordflow">case</font> CTile::alpha:
+00542 theList256[index].alphaLoaded=0;
+00543 theList256[index].alphaBits.resize(0);
+00544 <font class="keywordflow">break</font>;
+00545 }
+00546 tileBank2.getTileSet (_tileSet)-&gt;clearTile256 (index, bitmap, tileBank2);
+00547 }
+00548
+<a name="l00549"></a><a class="code" href="class_TileList.html#a20">00549</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a20">TileList::clearTransition</a> (<font class="keywordtype">int</font> index, CTile::TBitmap bitmap)<font class="keyword">
+</font>00550 <font class="keyword"></font>{
+00551 <font class="keywordflow">switch</font> (bitmap)
+00552 {
+00553 <font class="keywordflow">case</font> CTile::diffuse:
+00554 theListTransition[index].loaded=0;
+00555 theListTransition[index].Bits.resize(0);
+00556 <font class="keywordflow">break</font>;
+00557 <font class="keywordflow">case</font> CTile::additive:
+00558 theListTransition[index].nightLoaded=0;
+00559 theListTransition[index].nightBits.resize(0);
+00560 <font class="keywordflow">break</font>;
+00561 <font class="keywordflow">case</font> CTile::alpha:
+00562 theListTransition[index].alphaLoaded=0;
+00563 theListTransition[index].alphaBits.resize(0);
+00564 <font class="keywordflow">break</font>;
+00565 }
+00566 tileBank2.getTileSet (_tileSet)-&gt;clearTransition ((CTileSet::TTransition)index, bitmap, tileBank2);
+00567 }
+00568
+<a name="l00569"></a><a class="code" href="class_TileList.html#a21">00569</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a21">TileList::clearDisplacement</a> (<font class="keywordtype">int</font> index)<font class="keyword">
+</font>00570 <font class="keyword"></font>{
+00571 <font class="comment">// Clear the displacement map filename</font>
+00572 tileBank2.getTileSet (_tileSet)-&gt;clearDisplacement ((CTileSet::TDisplacement)index);
+00573 }
+00574
+<a name="l00575"></a><a class="code" href="class_TileList.html#a24">00575</a> tilelist::iterator <a class="code" href="class_TileList.html#a24">TileList::GetFirst</a>(<font class="keywordtype">int</font> n)<font class="keyword">
+</font>00576 <font class="keyword"></font>{
+00577 <font class="comment">//UpdateLF();</font>
+00578 <font class="keywordflow">return</font> theList[n].begin();
+00579 }
+00580
+<a name="l00581"></a><a class="code" href="class_TileList.html#a25">00581</a> tilelist::iterator <a class="code" href="class_TileList.html#a25">TileList::GetLast</a>(<font class="keywordtype">int</font> n)<font class="keyword">
+</font>00582 <font class="keyword"></font>{
+00583 <font class="comment">//UpdateLF();</font>
+00584 <font class="keywordflow">return</font> theList[n].end();
+00585 }
+00586
+<a name="l00587"></a><a class="code" href="class_TileList.html#a23">00587</a> <font class="keywordtype">int</font> <a class="code" href="class_TileList.html#a23">TileList::GetSize</a>(<font class="keywordtype">int</font> n)<font class="keyword">
+</font>00588 <font class="keyword"></font>{
+00589 <font class="comment">//UpdateLF();</font>
+00590 <font class="keywordflow">return</font> theList[n].size();
+00591 }
+00592
+<a name="l00593"></a><a class="code" href="class_TileInfo.html#a3">00593</a> <font class="keywordtype">void</font> <a class="code" href="class_TileInfo.html#a3">TileInfo::Delete</a> ()<font class="keyword">
+</font>00594 <font class="keyword"></font>{
+00595 loaded=0;
+00596 nightLoaded=0;
+00597 alphaLoaded=0;
+00598 }
+00599
+00600
+<a name="l00601"></a><a class="code" href="class_TileList.html#a26">00601</a> tilelist::iterator <a class="code" href="class_TileList.html#a26">TileList::Get</a>(<font class="keywordtype">int</font> i, <font class="keywordtype">int</font> n)<font class="keyword">
+</font>00602 <font class="keyword"></font>{
+00603 <font class="keywordflow">return</font> theList[n].begin()+i;
+00604 }
+00605
+<a name="l00606"></a><a class="code" href="class_TileInfo.html#a4">00606</a> <font class="keyword">const</font> std::string&amp; <a class="code" href="class_TileInfo.html#a4">TileInfo::getRelativeFileName</a> (CTile::TBitmap type, <font class="keywordtype">int</font> index)<font class="keyword">
+</font>00607 <font class="keyword"></font>{
+00608 <font class="keywordflow">return</font> tileBank2.getTile (index)-&gt;getRelativeFileName (type);
+00609 }
+00610
+<a name="l00611"></a><a class="code" href="class_TileInfo.html#a2">00611</a> <font class="keywordtype">bool</font> <a class="code" href="class_TileInfo.html#a2">TileInfo::Load</a> (<font class="keywordtype">int</font> index, std::vector&lt;NLMISC::CBGRA&gt;* Alpha)<font class="keyword">
+</font>00612 <font class="keyword"></font>{
+00613 <font class="keywordtype">bool</font> bRes=<font class="keyword">true</font>;
+00614 <font class="keywordflow">if</font> (!loaded &amp;&amp; <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::diffuse, index)!=<font class="stringliteral">""</font>)
+00615 {
+00616 <font class="keywordflow">if</font> (!<a class="code" href="TileCtrl_h.html#a19">_LoadBitmap</a>(tileBank2.getAbsPath() + <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::diffuse, index), &amp;BmpInfo, Bits, Alpha, 0))
+00617 {
+00618 bRes=<font class="keyword">false</font>;
+00619 MessageBox (NULL, (tileBank2.getAbsPath() + <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::diffuse, index)).c_str(), <font class="stringliteral">"Can't load file"</font>, MB_OK|MB_ICONEXCLAMATION);
+00620 }
+00621 <font class="keywordflow">else</font>
+00622 loaded=1;
+00623 }
+00624 <font class="keywordflow">if</font> (!nightLoaded &amp;&amp; <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::additive, index)!=<font class="stringliteral">""</font>)
+00625 {
+00626 <font class="keywordflow">if</font> (!<a class="code" href="TileCtrl_h.html#a19">_LoadBitmap</a>(tileBank2.getAbsPath() + <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::additive, index), &amp;nightBmpInfo, nightBits, Alpha, 0))
+00627 {
+00628 bRes=<font class="keyword">false</font>;
+00629 MessageBox (NULL, (tileBank2.getAbsPath() + <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::additive, index)).c_str(), <font class="stringliteral">"Can't load file"</font>, MB_OK|MB_ICONEXCLAMATION);
+00630 }
+00631 <font class="keywordflow">else</font>
+00632 nightLoaded=1;
+00633 }
+00634 <font class="keywordflow">if</font> (!alphaLoaded &amp;&amp; <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::alpha, index)!=<font class="stringliteral">""</font>)
+00635 {
+00636 <font class="keywordflow">if</font> (!<a class="code" href="TileCtrl_h.html#a19">_LoadBitmap</a>(tileBank2.getAbsPath() + <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::alpha, index), &amp;alphaBmpInfo, alphaBits, NULL,
+00637 tileBank2.getTile (index)-&gt;getRotAlpha ()))
+00638 {
+00639 bRes=<font class="keyword">false</font>;
+00640 MessageBox (NULL, (tileBank2.getAbsPath() + <a class="code" href="class_TileInfo.html#a4">getRelativeFileName</a> (CTile::alpha, index)).c_str(), <font class="stringliteral">"Can't load file"</font>, MB_OK|MB_ICONEXCLAMATION);
+00641 }
+00642 <font class="keywordflow">else</font>
+00643 alphaLoaded=1;
+00644 }
+00645 <font class="keywordflow">return</font> bRes;
+00646 }
+00647
+<a name="l00648"></a><a class="code" href="class_TileList.html#a22">00648</a> <font class="keywordtype">void</font> <a class="code" href="class_TileList.html#a4">TileList::Reload</a>(<font class="keywordtype">int</font> first, <font class="keywordtype">int</font> count, <font class="keywordtype">int</font> n) <font class="comment">//recharge en memoire une tranche de tiles</font>
+00649 {
+00650 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=first; i&lt;count; i++)
+00651 {
+00652 <font class="keywordflow">switch</font> (n)
+00653 {
+00654 <font class="keywordflow">case</font> 0:
+00655 theList[n][i].Load (tileBank2.getTileSet(_tileSet)-&gt;getTile128 (i), NULL);
+00656 <font class="keywordflow">break</font>;
+00657 <font class="keywordflow">case</font> 1:
+00658 theList[n][i].Load (tileBank2.getTileSet(_tileSet)-&gt;getTile256 (i), NULL);
+00659 <font class="keywordflow">break</font>;
+00660 <font class="keywordflow">case</font> 2:
+00661 {
+00662 <font class="keywordtype">int</font> index=tileBank2.getTileSet(_tileSet)-&gt;getTransition (i)-&gt;getTile();
+00663 <font class="keywordflow">if</font> (index!=-1)
+00664 theList[n][i].Load (index, &amp;theListTransition[i].alphaBits);
+00665 }
+00666 <font class="keywordflow">break</font>;
+00667 }
+00668 }
+00669 }
+00670
+00671 <font class="comment">//CTView</font>
+<a name="l00672"></a><a class="code" href="class_CTView.html#a0">00672</a> <a class="code" href="class_CTView.html#a0">CTView::CTView</a>()<font class="keyword">
+</font>00673 <font class="keyword"></font>{
+00674 sizetile_x = SIZE_SMALL; sizetile_y = SIZE_SMALL;
+00675 sizetext_y = 14;
+00676 spacing_x = SPACING_SMALL_X; spacing_y = SPACING_SMALL_Y;
+00677 Zoom=3; Texture = 1; Sort = 1; InfoTexte = 1;
+00678 count_ = 0; ViewTileMode = 0;
+00679 scrollpos = 0; lastVBarPos = 0;
+00680 smEdgeList = 0; bPopup = 0;
+00681 <font class="comment">//theViewPopup = 0;</font>
+00682 }
+00683
+<a name="l00684"></a><a class="code" href="class_CTView.html#a21">00684</a> <a class="code" href="class_CTView.html#a21">CTView::~CTView</a>()<font class="keyword">
+</font>00685 <font class="keyword"></font>{
+00686 }
+00687
+<a name="l00688"></a><a class="code" href="class_CTView.html#a2">00688</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a2">CTView::Init</a>(<font class="keywordtype">int</font> _land, <font class="keywordtype">int</font> n)<font class="keyword">
+</font>00689 <font class="keyword"></font>{
+00690 InfoList._tileSet=_land;
+00691 <a class="code" href="class_CTView.html#a19">UpdateSize</a>(n);
+00692 pipo_buffer = (<font class="keywordtype">void</font> *)<font class="keyword">new</font> <font class="keywordtype">char</font>[sizetile_x * sizetile_y * 3];
+00693 bmp = <font class="keyword">new</font> CBitmap;
+00694 bmp-&gt;CreateBitmap(sizetile_x,sizetile_y,1,24,pipo_buffer);
+00695 pImList = <font class="keyword">new</font> CImageList;
+00696 pImList-&gt;Create(sizetile_x,sizetile_y,ILC_COLOR24,0,1);
+00697 pImList-&gt;Add(bmp,(CBitmap*)NULL);
+00698 <font class="keywordtype">char</font> *defautpath = ((<a class="code" href="class_SelectionTerritoire.html">SelectionTerritoire</a>*)GetParent()-&gt;GetParent())-&gt;DefautPath.GetBuffer(256);
+00699 count_=1;
+00700 }
+00701
+<a name="l00702"></a><a class="code" href="class_CTView.html#a3">00702</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a3">CTView::Delete</a>()<font class="keyword">
+</font>00703 <font class="keyword"></font>{
+00704 count_=0; pImList = 0;
+00705 }
+00706
+<a name="l00707"></a><a class="code" href="class_CTView.html#a12">00707</a> <font class="keywordtype">int</font> <a class="code" href="class_CTView.html#a12">CTView::GetNbTileLine</a>(<font class="keywordtype">void</font>)<font class="keyword">
+</font>00708 <font class="keyword"></font>{
+00709 RECT rect; GetClientRect(&amp;rect);
+00710 <font class="keywordflow">return</font> (<a class="code" href="nel_patch_mesh_cpp.html#a0">max</a> (1, (rect.right - rect.left - spacing_x)/(sizeicon_x + spacing_x)));
+00711 }
+00712
+<a name="l00713"></a><a class="code" href="class_CTView.html#a13">00713</a> <font class="keywordtype">int</font> <a class="code" href="class_CTView.html#a13">CTView::GetNbTileColumn</a>(<font class="keywordtype">void</font>)<font class="keyword">
+</font>00714 <font class="keyword"></font>{
+00715 RECT rect; GetClientRect(&amp;rect);
+00716 <font class="keywordtype">int</font> deb;
+00717 <font class="keywordflow">if</font> (scrollpos&lt;spacing_y) deb = -scrollpos;
+00718 <font class="keywordflow">else</font> deb = (scrollpos - spacing_y)%(sizeicon_y + spacing_y);
+00719 <font class="keywordflow">if</font> (deb&gt;sizeicon_y) deb -=sizeicon_y + spacing_y;
+00720 <font class="keywordtype">int</font> ret= ((rect.bottom - rect.top <font class="comment">/*- spacing_y*/</font> + deb)/(sizeicon_y + spacing_y)) +1 ;
+00721 <font class="keywordflow">return</font> <a class="code" href="nel_patch_mesh_cpp.html#a0">max</a> (1, ret);
+00722 }
+00723
+<a name="l00724"></a><a class="code" href="class_CTView.html#a11">00724</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a11">CTView::GetVisibility</a>(<font class="keywordtype">int</font> &amp;First,<font class="keywordtype">int</font> &amp;Last, <font class="keywordtype">int</font> n) <font class="comment">//retourne l'indice du premier et du dernier item visible dans la fenetre</font>
+00725 {
+00726 <font class="keywordtype">int</font> y;
+00727 <font class="keywordtype">int</font> i = GetNbTileLine(); <font class="keywordtype">int</font> j = GetNbTileColumn();
+00728 <font class="keywordflow">if</font> (scrollpos&lt;spacing_y) y = 0;
+00729 <font class="keywordflow">else</font> y = (scrollpos - spacing_y)%(sizeicon_y + spacing_y);
+00730 First = ((scrollpos - spacing_y)/(sizeicon_y + spacing_y));
+00731 <font class="keywordflow">if</font> (y&gt;sizeicon_y) First++;
+00732 First *= i;
+00733 Last = First + i*j -1;
+00734 <font class="keywordflow">if</font> (InfoList.GetSize(n)&gt;0 &amp;&amp; Last&gt;=InfoList.GetSize(n)) Last = InfoList.GetSize(n)-1;
+00735 <font class="keywordflow">if</font> (First&gt;Last) First = Last;
+00736 }
+00737
+<a name="l00738"></a><a class="code" href="class_CTView.html#a14">00738</a> <font class="keywordtype">int</font> <a class="code" href="class_CTView.html#a14">CTView::GetIndex</a>(LPPOINT pt, <font class="keywordtype">int</font> n) <font class="comment">//retourne l'index d'un incone a partir de sa position dans le fenetre</font>
+00739 <font class="comment">//si le curseur n'est pas sur un icon, retourne -1</font>
+00740 {
+00741 POINT pts = *pt;
+00742 pts.y += scrollpos;
+00743 RECT rect; GetClientRect(&amp;rect);
+00744 <font class="keywordtype">int</font> i = GetNbTileLine();
+00745 <font class="keywordtype">int</font> lf = (rect.right - rect.left) - (GetNbTileLine()*(spacing_x+sizeicon_x) + spacing_x);
+00746 <font class="keywordflow">if</font> (pts.x &gt; (rect.right - rect.left - lf)) <font class="keywordflow">return</font> -1;
+00747 <font class="keywordflow">if</font> (pts.x&lt;0) <font class="keywordflow">return</font> -1;
+00748 <font class="keywordflow">if</font> (pts.y&lt;spacing_y) <font class="keywordflow">return</font> -1;
+00749 <font class="keywordtype">int</font> y = (pts.y - spacing_y)%(spacing_y + sizeicon_y);
+00750 <font class="keywordflow">if</font> (y&gt;sizeicon_y) <font class="keywordflow">return</font> -1;
+00751 <font class="keywordtype">int</font> il = (pts.y - spacing_y)/(spacing_y + sizeicon_y);
+00752 <font class="keywordtype">int</font> x = (pts.x - spacing_x)%(spacing_x + sizeicon_x);
+00753 <font class="keywordflow">if</font> (x&gt;sizeicon_x) <font class="keywordflow">return</font> -1;
+00754 <font class="keywordtype">int</font> ic = (pts.x - spacing_x)/(spacing_x + sizeicon_x);
+00755 <font class="keywordtype">int</font> ret = ic + il*i;
+00756 <font class="keywordflow">if</font> (ret&lt;InfoList.GetSize(n) &amp;&amp; ret&gt;=0) <font class="keywordflow">return</font> ret;
+00757 <font class="keywordflow">else</font> <font class="keywordflow">return</font> -1;
+00758 }
+00759
+<a name="l00760"></a><a class="code" href="class_CTView.html#a16">00760</a> POINT <a class="code" href="class_CTView.html#a16">CTView::GetPos</a>(<font class="keywordtype">int</font> i) <font class="comment">//fonction inverse de GetIndex</font>
+00761 {
+00762 POINT ret;
+00763 <font class="keywordtype">int</font> nl = <a class="code" href="nel_patch_mesh_cpp.html#a0">max</a> (1, GetNbTileLine());
+00764 ret.x = (i%nl)*(spacing_x + sizeicon_x) + spacing_x;
+00765 ret.y = (i/nl)*(spacing_y + sizeicon_y) + spacing_y - scrollpos;
+00766 <font class="keywordflow">return</font> ret;
+00767 }
+00768
+<a name="l00769"></a><a class="code" href="class_CTView.html#a17">00769</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a17">CTView::UpdateSelection</a>(LPRECT rect_,<font class="keywordtype">int</font> mode, <font class="keywordtype">int</font> n) <font class="comment">//rect : coordonnees du rectangle de selection dans la fenetre parent</font>
+00770 {
+00771 RECT client,*rect; GetWindowRect(&amp;client);
+00772 rect = <font class="keyword">new</font> RECT; memcpy(rect,rect_,<font class="keyword">sizeof</font>(RECT));
+00773 <font class="comment">//on se met dans le repere de CTView</font>
+00774 POINT pt; pt.x = rect-&gt;left; pt.y = rect-&gt;top;
+00775 GetParent()-&gt;ClientToScreen(&amp;pt);
+00776 ScreenToClient(&amp;pt);
+00777 rect-&gt;left = pt.x;
+00778 rect-&gt;top = pt.y;
+00779 pt.x = rect-&gt;right; pt.y = rect-&gt;bottom;
+00780 GetParent()-&gt;ClientToScreen(&amp;pt);
+00781 ScreenToClient(&amp;pt);
+00782 rect-&gt;right = pt.x;
+00783 rect-&gt;bottom = pt.y;
+00784 rect-&gt;top += scrollpos; rect-&gt;bottom += scrollpos;
+00785
+00786 <font class="keywordflow">if</font> (rect-&gt;left&lt;300)
+00787 {
+00788 <font class="keywordtype">int</font> toto = 0;
+00789 }
+00790
+00791 <font class="comment">//on clip</font>
+00792 <font class="keywordflow">if</font> (rect-&gt;left&lt;0) rect-&gt;left = 0;
+00793 <font class="keywordflow">if</font> (rect-&gt;top&lt;scrollpos) rect-&gt;top = scrollpos;
+00794 <font class="keywordtype">int</font> lf = (client.right - client.left) - (GetNbTileLine()*(spacing_x+sizeicon_x) + spacing_x);
+00795 <font class="keywordflow">if</font> (rect-&gt;right&gt;(client.right-client.left-spacing_x-lf))
+00796 {
+00797 rect-&gt;right = client.right - client.left - spacing_x - lf;
+00798 }
+00799 <font class="keywordflow">if</font> ((rect-&gt;bottom-scrollpos)&gt;(client.bottom-client.top)) rect-&gt;bottom=client.bottom-client.top+scrollpos;
+00800
+00801 <font class="keywordflow">if</font> (rect-&gt;left&lt;spacing_x) rect-&gt;left = spacing_x;
+00802 <font class="keywordflow">if</font> ((rect-&gt;top-scrollpos)&lt;spacing_y) rect-&gt;top = spacing_y + scrollpos;
+00803 <font class="keywordtype">int</font> rx = (rect-&gt;left - spacing_x)%(spacing_x + sizeicon_x);
+00804 rect-&gt;left -= rx;
+00805 <font class="keywordflow">if</font> (rx&gt;=sizeicon_x)
+00806 {
+00807 rect-&gt;left += sizeicon_x + spacing_x;
+00808 <font class="keywordflow">if</font> (rect-&gt;left&gt;=(client.right - client.left)) rect-&gt;left = (client.right - client.left) - spacing_x;
+00809 }
+00810 <font class="keywordtype">int</font> ry = (rect-&gt;top - spacing_y)%(spacing_y + sizeicon_y);
+00811 rect-&gt;top -= ry;
+00812 <font class="keywordflow">if</font> (ry&gt;=sizeicon_y)
+00813 {
+00814 rect-&gt;top += sizeicon_y + spacing_y;
+00815 <font class="keywordflow">if</font> ((rect-&gt;top-scrollpos)&gt;=(client.bottom - client.top)) rect-&gt;top = (client.bottom - client.top) - spacing_y + scrollpos;
+00816 }
+00817
+00818
+00819 <font class="keywordflow">if</font> (rect-&gt;right&lt;spacing_x || (rect-&gt;bottom-scrollpos)&lt;spacing_y) <font class="keywordflow">return</font>;
+00820 rx = (rect-&gt;right - spacing_x)%(spacing_x + sizeicon_x);
+00821 rect-&gt;right += (sizeicon_x - rx -1 );
+00822 ry = (rect-&gt;bottom - spacing_y)%(spacing_y + sizeicon_y);
+00823 rect-&gt;bottom += (sizeicon_y - ry -1 );
+00824
+00825 <font class="keywordflow">if</font> (rect-&gt;bottom&lt;rect-&gt;top || rect-&gt;left&gt;rect-&gt;right) <font class="keywordflow">return</font>;
+00826 pt; pt.x = rect-&gt;left; pt.y = rect-&gt;top; pt.y -=scrollpos;
+00827 <font class="keywordtype">int</font> index = GetIndex(&amp;pt, n);
+00828 tilelist::iterator p = InfoList.GetFirst(n);
+00829 CDC *pDC = GetDC();
+00830 <font class="keywordflow">if</font> (index==-1 &amp;&amp; !(mode&amp;MK_SHIFT))
+00831 {
+00832 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0;i&lt;InfoList.GetSize(n); i++)
+00833 {
+00834 <font class="keywordflow">if</font> (p-&gt;Selected==1)
+00835 {
+00836 p-&gt;Selected = 0;
+00837 DrawTile(p,pDC,0,n);
+00838 }
+00839 p++;
+00840 }
+00841 <font class="keywordflow">if</font> (pDC)
+00842 ::ReleaseDC(*<font class="keyword">this</font>,*pDC);
+00843 <font class="keywordflow">return</font>;
+00844 }
+00845 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0;i&lt;index;i++)
+00846 {
+00847 <font class="keywordflow">if</font> (p==InfoList.GetLast(n))
+00848 {
+00849 <font class="keywordflow">if</font> (pDC!=NULL)
+00850 ::ReleaseDC(*<font class="keyword">this</font>,*pDC);
+00851 <font class="keywordflow">return</font>;
+00852 }
+00853 <font class="keywordflow">if</font> (p-&gt;Selected==1)
+00854 {
+00855 p-&gt;Selected = 0;
+00856 DrawTile(p,pDC,0,n);
+00857 }
+00858 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (p-&gt;Selected&amp;4)
+00859 {
+00860 <font class="keywordflow">if</font> (p-&gt;Selected) p-&gt;Selected=2;
+00861 <font class="keywordflow">else</font> p-&gt;Selected = 3;
+00862 DrawTile(p,pDC,0,n);
+00863 }
+00864 p++;
+00865 }
+00866 <font class="keywordtype">int</font> nbline = GetNbTileLine();
+00867 <font class="keywordtype">int</font> incd = index%nbline;
+00868 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> j = rect-&gt;top;j&lt;=rect-&gt;bottom;j+=sizeicon_y + spacing_y)
+00869 {
+00870 <font class="keywordtype">int</font> k = 0;
+00871 <font class="keywordflow">if</font> (j!=rect-&gt;top)
+00872 {
+00873 <font class="keywordflow">for</font> (;k&lt;incd;k++)
+00874 {
+00875 <font class="keywordflow">if</font> (p==InfoList.GetLast(n))
+00876 {
+00877 <font class="keywordflow">if</font> (pDC!=NULL)
+00878 ::ReleaseDC(*<font class="keyword">this</font>,*pDC);
+00879 <font class="keywordflow">return</font>;
+00880 }
+00881 <font class="keywordflow">if</font> (p-&gt;Selected==1)
+00882 {
+00883 p-&gt;Selected = 0;
+00884 DrawTile(p,pDC,0,n);
+00885 }
+00886 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (p-&gt;Selected&amp;4)
+00887 {
+00888 <font class="keywordflow">if</font> (p-&gt;Selected&amp;3) p-&gt;Selected=2;
+00889 <font class="keywordflow">else</font> p-&gt;Selected = 3;
+00890 <font class="keywordtype">int</font> k = !(p-&gt;Selected&amp;1);
+00891 DrawTile(p,pDC,0,n);
+00892 }
+00893 p++;
+00894 }
+00895 }
+00896 <font class="keywordflow">else</font> k = incd;
+00897 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = rect-&gt;left;i&lt;=rect-&gt;right;i+=sizeicon_x + spacing_x)
+00898 {
+00899 <font class="keywordflow">if</font> (p==InfoList.GetLast(n))
+00900 {
+00901 <font class="keywordflow">if</font> (pDC!=NULL)
+00902 ::ReleaseDC(*<font class="keyword">this</font>,*pDC);
+00903 <font class="keywordflow">return</font>;
+00904 }
+00905 <font class="keywordflow">if</font> (!(mode&amp;MK_CONTROL))
+00906 {
+00907 <font class="keywordflow">if</font> (p-&gt;Selected!=1)
+00908 {
+00909 p-&gt;Selected = 1;
+00910 DrawTile(p,pDC,0,n);
+00911 }
+00912 }
+00913 <font class="keywordflow">else</font>
+00914 {
+00915 <font class="keywordflow">if</font> ((p-&gt;Selected&amp;4)==0)
+00916 {
+00917 <font class="keywordtype">int</font> k = p-&gt;Selected;
+00918 p-&gt;Selected = (p-&gt;Selected&amp;3)?4:5;
+00919 k = p-&gt;Selected;
+00920 DrawTile(p,pDC,0,n);
+00921 }
+00922 }
+00923 p++;
+00924 k++;
+00925 }
+00926 <font class="keywordflow">for</font> (;k&lt;nbline;k++)
+00927 {
+00928 <font class="keywordflow">if</font> (p==InfoList.GetLast(n))
+00929 {
+00930 <font class="keywordflow">if</font> (pDC!=NULL)
+00931 ::ReleaseDC(*<font class="keyword">this</font>,*pDC);
+00932 <font class="keywordflow">return</font>;
+00933 }
+00934 <font class="keywordflow">if</font> (p-&gt;Selected==1)
+00935 {
+00936 p-&gt;Selected = 0;
+00937 DrawTile(p,pDC,0,n);
+00938 }
+00939 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (p-&gt;Selected&amp;4)
+00940 {
+00941 <font class="keywordflow">if</font> (p-&gt;Selected&amp;3) p-&gt;Selected=2;
+00942 <font class="keywordflow">else</font> p-&gt;Selected = 3;
+00943 DrawTile(p,pDC,0,n);
+00944 }
+00945 p++;
+00946 }
+00947 }
+00948 <font class="keywordflow">for</font> (;p!=InfoList.GetLast(n);p++)
+00949 {
+00950 <font class="keywordflow">if</font> (p-&gt;Selected==1)
+00951 {
+00952 p-&gt;Selected = 0;
+00953 DrawTile(p,pDC,0,n);
+00954 }
+00955 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (p-&gt;Selected&amp;4)
+00956 {
+00957 <font class="keywordflow">if</font> (p-&gt;Selected&amp;3) p-&gt;Selected=2;
+00958 <font class="keywordflow">else</font> p-&gt;Selected = 3;
+00959 DrawTile(p,pDC,0,n);
+00960 }
+00961 }
+00962 <font class="keywordflow">if</font> (pDC!=NULL)
+00963 ::ReleaseDC(*<font class="keyword">this</font>,*pDC);
+00964 }
+00965
+<a name="l00966"></a><a class="code" href="class_CTView.html#a6">00966</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a6">CTView::DeleteTile</a>(tilelist::iterator p)<font class="keyword">
+</font>00967 <font class="keyword"></font>{
+00968 p-&gt;loaded = 0;
+00969 p-&gt;nightLoaded = 0;
+00970 p-&gt;alphaLoaded = 0;
+00971 }
+00972
+<a name="l00973"></a><a class="code" href="class_CTView.html#a20">00973</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a20">CTView::UpdateBar</a>(<font class="keywordtype">int</font> iFirst,<font class="keywordtype">int</font> iLast, <font class="keywordtype">int</font> n)<font class="keyword">
+</font>00974 <font class="keyword"></font>{
+00975 <font class="keywordtype">int</font> i = <a class="code" href="class_CTView.html#a13">GetNbTileColumn</a>();
+00976 <font class="keywordtype">int</font> j = <a class="code" href="nel_patch_mesh_cpp.html#a0">max</a> (1, <a class="code" href="class_CTView.html#a12">GetNbTileLine</a>());
+00977 <font class="keywordtype">int</font> nbline = InfoList.<a class="code" href="class_TileList.html#a23">GetSize</a>(n)/j+1;
+00978 <font class="keywordtype">int</font> posline = iFirst/j;
+00979 SCROLLINFO scr;
+00980 scr.fMask = SIF_ALL ^ SIF_POS;
+00981 scr.nMin = 0; scr.nMax = SCROLL_MAX;
+00982 <font class="keywordflow">if</font> (nbline==0) {scr.nPage = SCROLL_MAX; scr.nPos = 0;}
+00983 <font class="keywordflow">else</font>
+00984 {
+00985 scr.nPage = (SCROLL_MAX*i)/nbline;
+00986 }
+00987 GetParent()-&gt;SetScrollInfo(SB_VERT,&amp;scr);
+00988 }
+00989
+00990
+00991
+00992
+<a name="l00993"></a><a class="code" href="class_CTView.html#a7">00993</a> <font class="keywordtype">int</font> <a class="code" href="class_CTView.html#a7">CTView::IsSelected</a>(<font class="keywordtype">int</font> i)<font class="keyword">
+</font>00994 <font class="keyword"></font>{
+00995 <font class="keywordflow">return</font> 0;
+00996 }
+00997
+<a name="l00998"></a><a class="code" href="class_CTView.html#a19">00998</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a19">CTView::UpdateSize</a>(<font class="keywordtype">int</font> n)<font class="keyword">
+</font>00999 <font class="keyword"></font>{
+01000 spacing_tile_text = 3;
+01001 <font class="keywordflow">if</font> (Zoom==1) {sizetile_x = sizetile_y = SIZE_SMALL; spacing_x = SPACING_SMALL_X; spacing_y = SPACING_SMALL_Y;}
+01002 <font class="keywordflow">if</font> (Zoom==2) {sizetile_x = sizetile_y = SIZE_NORMAL; spacing_x = SPACING_NORMAL_X; spacing_y = SPACING_NORMAL_Y;}
+01003 <font class="keywordflow">if</font> (Zoom==3) {sizetile_x = sizetile_y = SIZE_BIG; spacing_x = SPACING_BIG_X; spacing_y = SPACING_BIG_Y;}
+01004 <font class="keywordflow">if</font> (n==1)
+01005 {
+01006 sizetile_x *= 2;
+01007 sizetile_y *= 2;
+01008 }
+01009 sizeicon_x = sizetile_x; sizeicon_y = sizetile_y + sizetext_y + spacing_tile_text;
+01010 }
+01011
+<a name="l01012"></a><a class="code" href="View_cpp.html#a2">01012</a> <font class="keywordtype">int</font> debug = 0;
+01013
+<a name="l01014"></a><a class="code" href="class_CTView.html#b2">01014</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#b2">CTView::OnPaint</a>()<font class="keyword">
+</font>01015 <font class="keyword"></font>{
+01016 <a class="code" href="class_Browse.html">Browse</a> *parent = (<a class="code" href="class_Browse.html">Browse</a>*)this-&gt;GetParent();
+01017 CPaintDC dc(<font class="keyword">this</font>); <font class="comment">// device context for painting</font>
+01018 <font class="comment">// TODO: Add your message handler code here</font>
+01019 RECT rect; GetClientRect(&amp;rect);
+01020 CBrush brush (GetSysColor(COLOR_3DFACE));
+01021
+01022
+01023 dc.FillRect(&amp;rect,&amp;brush);
+01024
+01025 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a23">GetSize</a>(parent-&gt;m_128x128)==0) <font class="keywordflow">return</font>;
+01026
+01027 debug=(debug+1)&amp;1;
+01028
+01029 <font class="keywordflow">if</font> (debug==1)
+01030 {
+01031 debug = 1;
+01032 }
+01033
+01034 CRgn clip;
+01035 clip.CreateRectRgn(rect.left,rect.top,rect.right,rect.bottom);
+01036 dc.SelectClipRgn(&amp;clip);
+01037
+01038 CRgn update;
+01039 <font class="keywordflow">if</font> (GetUpdateRgn(&amp;update)==NULLREGION)
+01040 {
+01041 ::ReleaseDC(*<font class="keyword">this</font>,dc);
+01042 <font class="keywordflow">return</font>;
+01043 }
+01044
+01045 <a class="code" href="class_CTView.html#a11">GetVisibility</a>(iFV, iLV, parent-&gt;m_128x128);
+01046 <a class="code" href="class_CTView.html#a20">UpdateBar</a>(iFV, iLV, parent-&gt;m_128x128);
+01047 <font class="keywordflow">if</font> (!normal_font)
+01048 {
+01049 normal_font = <font class="keyword">new</font> CFont;
+01050 normal_font-&gt;CreateFont(-10,0,0,0,FW_THIN,<font class="keyword">false</font>,<font class="keyword">false</font>,<font class="keyword">false</font>,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH,NULL);
+01051 }
+01052
+01053 tilelist::iterator p = InfoList.<a class="code" href="class_TileList.html#a24">GetFirst</a>(parent-&gt;m_128x128);
+01054 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0;i&lt;iFV;i++) p++;
+01055 <font class="keywordflow">for</font> (i=iFV;i&lt;=iLV;i++)
+01056 <a class="code" href="class_CTView.html#a4">DrawTile</a>(p++,&amp;dc,0, parent-&gt;m_128x128);
+01057 ::ReleaseDC (*<font class="keyword">this</font>, dc);
+01058 }
+01059
+<a name="l01060"></a><a class="code" href="class_CTView.html#b1">01060</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#b1">CTView::OnDropFiles</a>(HDROP hDropInfo)<font class="keyword">
+</font>01061 <font class="keyword"></font>{
+01062 <font class="comment">// TODO: Add your message handler code here and/or call default</font>
+01063 <font class="comment">//first : on verifie s'il les tiles doivent etre inseres</font>
+01064 <font class="keywordflow">if</font> (!lockInsertion)
+01065 {
+01066 <a class="code" href="class_Browse.html">Browse</a> *parent = (<a class="code" href="class_Browse.html">Browse</a>*)this-&gt;GetParent();
+01067 <font class="keywordtype">char</font> FileName[256];
+01068 <font class="keywordtype">int</font> count=DragQueryFile(hDropInfo,0xffffffff,FileName,256); <font class="comment">//count = nombre de fichiers dans le drop</font>
+01069
+01070
+01071 POINT pos;
+01072 DragQueryPoint(hDropInfo,&amp;pos); <font class="comment">//retrieve cursor position</font>
+01073 CDC *pDC = GetDC();
+01074 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0;i&lt;count;i++)
+01075 {
+01076 DragQueryFile(hDropInfo,i,FileName,256);
+01077 <font class="keywordflow">switch</font> (parent-&gt;m_128x128)
+01078 {
+01079 <font class="keywordflow">case</font> 0:
+01080 {
+01081 <font class="keywordtype">int</font> index=InfoList.<a class="code" href="class_TileList.html#a9">addTile128</a> ();
+01082 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a11">setTile128</a> (index, FileName, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha)))
+01083 {
+01084 tilelist::iterator it = InfoList.<a class="code" href="class_TileList.html#a25">GetLast</a>(parent-&gt;m_128x128);
+01085 it--;
+01086 }
+01087 <font class="keywordflow">else</font>
+01088 {
+01089 InfoList.<a class="code" href="class_TileList.html#a16">removeTile128</a> (index);
+01090 }
+01091 }
+01092 <font class="keywordflow">break</font>;
+01093 <font class="keywordflow">case</font> 1:
+01094 {
+01095 <font class="keywordtype">int</font> index=InfoList.<a class="code" href="class_TileList.html#a10">addTile256</a> ();
+01096 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a12">setTile256</a> (index, FileName, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha)))
+01097 {
+01098 tilelist::iterator it = InfoList.<a class="code" href="class_TileList.html#a25">GetLast</a>(parent-&gt;m_128x128);
+01099 it--;
+01100 }
+01101 <font class="keywordflow">else</font>
+01102 InfoList.<a class="code" href="class_TileList.html#a17">removeTile256</a> (index);
+01103 }
+01104 <font class="keywordflow">break</font>;
+01105 <font class="keywordflow">case</font> 2:
+01106 {
+01107 }
+01108 <font class="keywordflow">break</font>;
+01109 }
+01110 }
+01111
+01112 <font class="keywordtype">int</font> iFV,iLV;
+01113 <a class="code" href="class_CTView.html#a11">GetVisibility</a>(iFV, iLV, parent-&gt;m_128x128);
+01114 <a class="code" href="class_CTView.html#a20">UpdateBar</a>(iFV, iLV, parent-&gt;m_128x128);
+01115 Invalidate ();
+01116 }
+01117 CStatic::OnDropFiles(hDropInfo);
+01118 }
+01119
+<a name="l01120"></a><a class="code" href="class_CTView.html#a4">01120</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a4">CTView::DrawTile</a>(tilelist::iterator i,CDC *pDC,<font class="keywordtype">int</font> clear, <font class="keywordtype">int</font> n)<font class="keyword">
+</font>01121 <font class="keyword"></font>{
+01122 RECT rect; GetClientRect(&amp;rect);
+01123 CBrush brush (GetSysColor(COLOR_3DFACE));
+01124 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a23">GetSize</a>(n)==0)
+01125 {
+01126 <font class="keywordflow">return</font>;
+01127 }
+01128
+01129 LPBITMAPINFO bmpinf;
+01130 std::string pth;
+01131 std::vector&lt;NLMISC::CBGRA&gt; *bits;
+01132 <font class="keywordtype">int</font> loaded;
+01133
+01134 <font class="keywordflow">switch</font> (n)
+01135 {
+01136 <font class="keywordflow">case</font> 0:
+01137 pth = i-&gt;getRelativeFileName ((CTile::TBitmap)(Texture-1), tileBank2.getTileSet (InfoList._tileSet)-&gt;getTile128 (i-&gt;id));
+01138 <font class="keywordflow">break</font>;
+01139 <font class="keywordflow">case</font> 1:
+01140 pth = i-&gt;getRelativeFileName ((CTile::TBitmap)(Texture-1), tileBank2.getTileSet (InfoList._tileSet)-&gt;getTile256 (i-&gt;id));
+01141 <font class="keywordflow">break</font>;
+01142 <font class="keywordflow">case</font> 2:
+01143 {
+01144 <font class="keywordtype">int</font> index=tileBank2.getTileSet (InfoList._tileSet)-&gt;getTransition (i-&gt;id)-&gt;getTile();
+01145 <font class="keywordflow">if</font> (index!=-1)
+01146 pth = i-&gt;getRelativeFileName ((CTile::TBitmap)(Texture-1), index);
+01147 <font class="keywordflow">else</font>
+01148 pth = <font class="stringliteral">""</font>;
+01149 }
+01150 <font class="keywordflow">break</font>;
+01151 <font class="keywordflow">case</font> 3:
+01152 pth = tileBank2.getTileSet (InfoList._tileSet)-&gt;getDisplacementFileName ((CTileSet::TDisplacement)i-&gt;id);
+01153 <font class="keywordflow">break</font>;
+01154 }
+01155
+01156 <font class="keywordflow">switch</font>(Texture)
+01157 {
+01158 <font class="keywordflow">case</font> 1:
+01159 bmpinf = &amp;(i-&gt;BmpInfo);
+01160 bits = &amp;i-&gt;Bits;
+01161 loaded = i-&gt;loaded;
+01162 <font class="keywordflow">break</font>;
+01163 <font class="keywordflow">case</font> 2:
+01164 bmpinf = &amp;(i-&gt;nightBmpInfo);
+01165 bits = &amp;i-&gt;nightBits;
+01166 loaded = i-&gt;nightLoaded;
+01167 <font class="keywordflow">break</font>;
+01168 <font class="keywordflow">case</font> 3:
+01169 bmpinf = &amp;(i-&gt;alphaBmpInfo);
+01170 bits = &amp;i-&gt;alphaBits;
+01171 loaded = i-&gt;alphaLoaded;
+01172 <font class="keywordflow">break</font>;
+01173 }
+01174
+01175 CRgn clip;
+01176 clip.CreateRectRgn(rect.left,rect.top,rect.right,rect.bottom);
+01177 pDC-&gt;SelectClipRgn(&amp;clip);
+01178
+01179 <font class="comment">// Select a font</font>
+01180 CFont *pOldFont=pDC-&gt;SelectObject(normal_font);
+01181
+01182 POINT pt;
+01183 pt = <a class="code" href="class_CTView.html#a16">GetPos</a>(i-&gt;id);
+01184 RECT rect_txt;
+01185 rect_txt.top = pt.y;
+01186 rect_txt.bottom = pt.y + sizeicon_y + spacing_y;
+01187 rect_txt.left = pt.x; rect_txt.right = pt.x + sizeicon_x + spacing_x;
+01188
+01189 <font class="comment">// Turn every other pixel to black</font>
+01190 COLORREF clrBk = pDC-&gt;SetBkColor( GetSysColor(COLOR_3DFACE) );
+01191 COLORREF clrText = pDC-&gt;SetTextColor( RGB(0,0,0) );
+01192
+01193 <font class="keywordflow">if</font> (clear) pDC-&gt;FillRect(&amp;rect_txt,&amp;brush);
+01194
+01195 <font class="keywordflow">if</font> (!loaded)
+01196 {
+01197 pDC-&gt;FillSolidRect( pt.x, pt.y, sizetile_x, sizetile_y, GetSysColor(COLOR_3DFACE) );
+01198 pDC-&gt;MoveTo (pt.x,pt.y);
+01199 pDC-&gt;LineTo (pt.x+sizetile_x,pt.y+sizetile_y);
+01200 pDC-&gt;MoveTo (pt.x+sizetile_x,pt.y);
+01201 pDC-&gt;LineTo (pt.x,pt.y+sizetile_y);
+01202 pDC-&gt;MoveTo (pt.x,pt.y);
+01203 pDC-&gt;LineTo (pt.x+sizetile_x,pt.y);
+01204 pDC-&gt;LineTo (pt.x+sizetile_x,pt.y+sizetile_y);
+01205 pDC-&gt;LineTo (pt.x,pt.y+sizetile_y);
+01206 pDC-&gt;LineTo (pt.x,pt.y);
+01207
+01208 pDC-&gt;MoveTo (pt.x+1,pt.y);
+01209 pDC-&gt;LineTo (pt.x+sizetile_x,pt.y+sizetile_y-1);
+01210 pDC-&gt;MoveTo (pt.x,pt.y+1);
+01211 pDC-&gt;LineTo (pt.x+sizetile_x-1,pt.y+sizetile_y);
+01212
+01213 pDC-&gt;MoveTo (pt.x+sizetile_x-1,pt.y);
+01214 pDC-&gt;LineTo (pt.x,pt.y+sizetile_y-1);
+01215 pDC-&gt;MoveTo (pt.x+sizetile_x,pt.y+1);
+01216 pDC-&gt;LineTo (pt.x+1,pt.y+sizetile_y);
+01217 }
+01218 <font class="keywordflow">else</font>
+01219 {
+01220 StretchDIBits(pDC-&gt;m_hDC,pt.x,pt.y,
+01221 sizetile_x,sizetile_y,0,0,
+01222 bmpinf-&gt;bmiHeader.biWidth,
+01223 -bmpinf-&gt;bmiHeader.biHeight,
+01224 &amp;*bits-&gt;begin(),bmpinf,DIB_RGB_COLORS,SRCCOPY);
+01225 }
+01226
+01227 <font class="keywordtype">char</font> temp[100];
+01228 <font class="keywordtype">char</font> Name[256]; Name[0] = 0;
+01229 <font class="keywordflow">if</font> (InfoTexte==2)
+01230 {
+01231 _splitpath(pth.c_str(),temp,temp,Name,temp);
+01232 }
+01233 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (InfoTexte==3)
+01234 {
+01235 __int64 mask = 1;
+01236 }
+01237 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (InfoTexte==1)
+01238 {
+01239 sprintf(Name,<font class="stringliteral">"%d"</font>,i-&gt;id);
+01240 }
+01241 rect_txt.top = pt.y + sizetile_y + spacing_tile_text;
+01242 rect_txt.bottom += rect_txt.top + sizetext_y;
+01243 rect_txt.left -= spacing_x;
+01244 pDC-&gt;DrawText(Name,strlen(Name),&amp;rect_txt,DT_CENTER | DT_SINGLELINE);
+01245
+01246 <font class="comment">// Restore the device context</font>
+01247 pDC-&gt;SetBkColor( clrBk );
+01248 pDC-&gt;SetTextColor( clrText );
+01249
+01250 <font class="keywordflow">if</font> (i-&gt;Selected&amp;3)
+01251 {
+01252 CRect rc;
+01253 rc.left = pt.x; rc.top = pt.y; rc.right = rc.left + sizetile_x; rc.bottom = rc.top + sizetile_y;
+01254 <a class="code" href="class_CTView.html#a9">ShadeRect</a>(pDC,rc);
+01255 }
+01256
+01257 <font class="comment">// Invalidate flag button</font>
+01258 <a class="code" href="class_Browse.html">Browse</a> *parent = (<a class="code" href="class_Browse.html">Browse</a>*)this-&gt;GetParent();
+01259 parent-&gt;<a class="code" href="class_Browse.html#a5">UpdateFlags</a> ();
+01260
+01261 <font class="comment">// Release the font</font>
+01262 pDC-&gt;SelectObject(pOldFont);
+01263 }
+01264
+<a name="l01265"></a><a class="code" href="class_CTView.html#a9">01265</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a9">CTView::ShadeRect</a>( CDC *pDC, CRect&amp; rect )<font class="keyword">
+</font>01266 <font class="keyword">
+</font>01267 <font class="keyword"></font>{
+01268 <font class="comment">// Bit pattern for a monochrome brush with every</font>
+01269 <font class="comment">// other pixel turned off</font>
+01270 WORD Bits[8] = { 0x0055, 0x00aa, 0x0055, 0x00aa,
+01271 0x0055, 0x00aa, 0x0055, 0x00aa };
+01272
+01273 CBitmap bmBrush;
+01274 CBrush brush; <font class="comment">// (GetSysColor(COLOR_3DFACE));</font>
+01275
+01276 <font class="comment">// Need a monochrome pattern bitmap</font>
+01277 bmBrush.CreateBitmap( 8, 8, 1, 1, &amp;Bits );
+01278
+01279 <font class="comment">// Create the pattern brush</font>
+01280 brush.CreatePatternBrush( &amp;bmBrush );
+01281
+01282 CBrush *pOldBrush = pDC-&gt;SelectObject( &amp;brush );
+01283
+01284 <font class="comment">// Turn every other pixel to black</font>
+01285 COLORREF clrBk = pDC-&gt;SetBkColor( GetSysColor(COLOR_3DFACE) );
+01286 COLORREF clrText = pDC-&gt;SetTextColor( RGB(0,0,0) );
+01287 <font class="comment">// 0x00A000C9 is the ROP code to AND the brush with the destination</font>
+01288 pDC-&gt;PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
+01289 (DWORD)0x00A000C9); <font class="comment">//DPa - raster code</font>
+01290
+01291 pDC-&gt;SetBkColor( clrBk );
+01292 pDC-&gt;SetTextColor( clrText );
+01293 clrBk = pDC-&gt;SetBkColor( RGB(0,0,0) );
+01294 clrText = pDC-&gt;SetTextColor( GetSysColor(COLOR_HIGHLIGHT) );
+01295 <font class="comment">// 0x00FA0089 is the ROP code to OR the brush with the destination</font>
+01296 pDC-&gt;PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
+01297 (DWORD)0x00FA0089); <font class="comment">//DPo - raster code</font>
+01298
+01299 <font class="comment">// Restore the device context</font>
+01300 pDC-&gt;SelectObject( pOldBrush );
+01301 pDC-&gt;SetBkColor( clrBk );
+01302 pDC-&gt;SetTextColor( clrText );
+01303 }
+01304
+01305
+01306 <font class="comment">//code modifie des sources des MFC =)))</font>
+<a name="l01307"></a><a class="code" href="class_CTView.html#a18">01307</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a18">CTView::DrawDragRect</a>(CDC *pDC,LPCRECT lpRect, SIZE size,
+01308 LPCRECT lpRectLast, SIZE sizeLast, CBrush* pBrush, CBrush* pBrushLast)<font class="keyword">
+</font>01309 <font class="keyword"></font>{
+01310 <font class="comment">// first, determine the update region and select it</font>
+01311 CRgn rgnNew;
+01312 CRgn rgnOutside, rgnInside;
+01313 CRect rect;
+01314 <font class="keywordflow">if</font> (lpRect)
+01315 {
+01316 rgnOutside.CreateRectRgnIndirect(lpRect);
+01317 rect = *lpRect;
+01318 rect.InflateRect(-size.cx, -size.cy);
+01319 rect.IntersectRect(rect, lpRect);
+01320 rgnInside.CreateRectRgnIndirect(rect);
+01321 rgnNew.CreateRectRgn(0, 0, 0, 0);
+01322 rgnNew.CombineRgn(&amp;rgnOutside, &amp;rgnInside, RGN_XOR);
+01323 }
+01324
+01325 CBrush* pBrushOld = NULL;
+01326 <font class="keywordflow">if</font> (pBrush == NULL)
+01327 pBrush = CDC::GetHalftoneBrush();
+01328 <font class="keywordflow">if</font> (pBrushLast == NULL)
+01329 pBrushLast = pBrush;
+01330
+01331 CRgn rgnLast, rgnUpdate;
+01332 <font class="keywordflow">if</font> (lpRectLast != NULL<font class="comment">/* &amp;&amp; lpRect!=NULL*/</font>)
+01333 {
+01334 <font class="comment">// find difference between new region and old region</font>
+01335 rgnLast.CreateRectRgn(0, 0, 0, 0);
+01336 <font class="keywordflow">if</font> (lpRect==NULL) rgnOutside.CreateRectRgnIndirect(lpRectLast);
+01337 <font class="keywordflow">else</font> rgnOutside.SetRectRgn(lpRectLast);
+01338 rect = *lpRectLast;
+01339 rect.InflateRect(-sizeLast.cx, -sizeLast.cy);
+01340 rect.IntersectRect(rect, lpRectLast);
+01341 <font class="keywordflow">if</font> (lpRect==NULL) rgnInside.CreateRectRgnIndirect(rect);
+01342 <font class="keywordflow">else</font> rgnInside.SetRectRgn(rect);
+01343 rgnLast.CombineRgn(&amp;rgnOutside, &amp;rgnInside, RGN_XOR);
+01344
+01345 <font class="comment">// only diff them if brushes are the same</font>
+01346 <font class="keywordflow">if</font> (pBrush-&gt;m_hObject == pBrushLast-&gt;m_hObject)
+01347 {
+01348 rgnUpdate.CreateRectRgn(0, 0, 0, 0);
+01349 rgnUpdate.CombineRgn(&amp;rgnLast, &amp;rgnNew, RGN_XOR);
+01350 }
+01351 }
+01352 <font class="keywordflow">if</font> (!lpRect || (pBrush-&gt;m_hObject != pBrushLast-&gt;m_hObject &amp;&amp; lpRectLast != NULL))
+01353 {
+01354 <font class="comment">// brushes are different -- erase old region first</font>
+01355 pDC-&gt;SelectClipRgn(&amp;rgnLast);
+01356 pDC-&gt;GetClipBox(&amp;rect);
+01357 pBrushOld = pDC-&gt;SelectObject(pBrushLast);
+01358 pDC-&gt;PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
+01359 pDC-&gt;SelectObject(pBrushOld);
+01360 }
+01361 <font class="comment">// draw into the update/new region</font>
+01362 <font class="keywordflow">if</font> (lpRect)
+01363 {
+01364 pDC-&gt;SelectClipRgn(rgnUpdate.m_hObject != NULL ? &amp;rgnUpdate : &amp;rgnNew);
+01365 pDC-&gt;GetClipBox(&amp;rect);
+01366 pBrushOld = pDC-&gt;SelectObject(pBrush);
+01367 pDC-&gt;PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
+01368 pDC-&gt;SelectObject(pBrushOld);
+01369 }
+01370 pDC-&gt;SelectClipRgn(NULL);
+01371 }
+01372
+<a name="l01373"></a><a class="code" href="class_CTView.html#a8">01373</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a8">CTView::RemoveSelection</a>(<font class="keywordtype">int</font> n)<font class="keyword">
+</font>01374 <font class="keyword"></font>{
+01375 <font class="keywordflow">for</font> (tilelist::iterator p = InfoList.theList[n].begin();p!=InfoList.theList[n].end();++p)
+01376 {
+01377 p-&gt;Selected = 0;
+01378 }
+01379 }
+01380
+<a name="l01381"></a><a class="code" href="class_CTView.html#a10">01381</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#a10">CTView::InsertItemInCtrlList</a>(tilelist::iterator iFirst,tilelist::iterator iLast)<font class="keyword">
+</font>01382 <font class="keyword"></font>{
+01383 <font class="comment">/* int iItem = InfoList.GetSize();
+</font>01384 <font class="comment"> for (tilelist::iterator i=iFirst;i!=iLast;++i)
+</font>01385 <font class="comment"> {
+</font>01386 <font class="comment"> char num[10];
+</font>01387 <font class="comment"> sprintf(num,"%d",iItem);
+</font>01388 <font class="comment"> InsertItem(iItem,num,0);
+</font>01389 <font class="comment"> SetItemData(iItem++,(DWORD)(*i));
+</font>01390 <font class="comment"> }*/</font>
+01391 }
+01392
+01393
+01394
+<a name="l01395"></a><a class="code" href="class_CTView.html#b0">01395</a> LRESULT <a class="code" href="class_CTView.html#b0">CTView::WindowProc</a>(UINT message, WPARAM wParam, LPARAM lParam)<font class="keyword">
+</font>01396 <font class="keyword"></font>{
+01397 <font class="comment">// TODO: Add your specialized code here and/or call the base class</font>
+01398 <font class="keywordflow">if</font> (message==WM_MOUSEMOVE)
+01399 {
+01400 MousePos.x = LOWORD(lParam);
+01401 MousePos.y = HIWORD(lParam);
+01402 }
+01403 <font class="keywordflow">if</font> (message==WM_DRAWITEM)
+01404 {
+01405 <font class="keywordtype">int</font> toto=0;
+01406 }
+01407 <font class="keywordflow">if</font> (message==WM_CLOSE) <a class="code" href="class_CTView.html#a3">Delete</a>();
+01408 <font class="keywordflow">if</font> (message==WM_COMMAND) <font class="comment">//The user had selected an item on popup menu</font>
+01409 {
+01410 <a class="code" href="class_Browse.html">Browse</a> *parent = (<a class="code" href="class_Browse.html">Browse</a>*)this-&gt;GetParent();
+01411 <font class="keywordtype">int</font> id=LOWORD(wParam);
+01412 <font class="keywordflow">if</font> (id==ID_MENU_SUPR_TILE)
+01413 {
+01414 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;InfoList.GetSize(parent-&gt;m_128x128); i++)
+01415 {
+01416 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a26">Get</a>(i, parent-&gt;m_128x128)-&gt;Selected)
+01417 {
+01418 <font class="keywordflow">switch</font> (parent-&gt;m_128x128)
+01419 {
+01420 <font class="keywordflow">case</font> 0:
+01421 InfoList.<a class="code" href="class_TileList.html#a16">removeTile128</a> (i);
+01422 <font class="keywordflow">break</font>;
+01423 <font class="keywordflow">case</font> 1:
+01424 InfoList.<a class="code" href="class_TileList.html#a17">removeTile256</a> (i);
+01425 <font class="keywordflow">break</font>;
+01426 <font class="keywordflow">default</font>:
+01427 <a class="code" href="debug_h.html#a6">nlassert</a> (0); <font class="comment">// no!</font>
+01428 }
+01429 }
+01430 }
+01431 bPopup = 0;
+01432 }
+01433 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (id==ID_MENU_SUPR_BITMAP)
+01434 {
+01435 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=0; i&lt;InfoList.GetSize(parent-&gt;m_128x128); i++)
+01436 {
+01437 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a26">Get</a>(i, parent-&gt;m_128x128)-&gt;Selected)
+01438 {
+01439 <font class="keywordflow">switch</font> (parent-&gt;m_128x128)
+01440 {
+01441 <font class="keywordflow">case</font> 0:
+01442 InfoList.<a class="code" href="class_TileList.html#a18">clearTile128</a> (i, (CTile::TBitmap)(Texture-1));
+01443 <font class="keywordflow">break</font>;
+01444 <font class="keywordflow">case</font> 1:
+01445 InfoList.<a class="code" href="class_TileList.html#a19">clearTile256</a> (i, (CTile::TBitmap)(Texture-1));
+01446 <font class="keywordflow">break</font>;
+01447 <font class="keywordflow">case</font> 2:
+01448 InfoList.<a class="code" href="class_TileList.html#a20">clearTransition</a> (i, (CTile::TBitmap)(Texture-1));
+01449 <font class="keywordflow">break</font>;
+01450 <font class="keywordflow">case</font> 3:
+01451 InfoList.<a class="code" href="class_TileList.html#a21">clearDisplacement</a> (i);
+01452 <font class="keywordflow">break</font>;
+01453 <font class="keywordflow">default</font>:
+01454 <a class="code" href="debug_h.html#a6">nlassert</a> (0); <font class="comment">// no!</font>
+01455 }
+01456 }
+01457 }
+01458 bPopup = 0;
+01459 }
+01460 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((id==ID_MENU_ADD)||(id==ID_MENU_REPLACE))
+01461 {
+01462 _chdir (LastPath.c_str());
+01463 CFileDialog load(<font class="keyword">true</font>, NULL, LastPath.c_str(), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT,
+01464 <font class="stringliteral">"Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"</font>,NULL);
+01465 load.m_ofn.lpstrFile = <font class="keyword">new</font> <font class="keywordtype">char</font>[10000]; <font class="comment">//le buffer contient la list de tous les noms de fichier</font>
+01466 load.m_ofn.lpstrFile[0] = 0;
+01467 <font class="comment">//avec 10ko on devrait tranquille ... si l'ensemble des noms des fichiers depassent 10000 cara, l'insertion n'a pas lieu</font>
+01468 load.m_ofn.nMaxFile = 10000-1;
+01469 <font class="keywordflow">if</font> (load.DoModal()==IDOK)
+01470 {
+01471 <font class="comment">//AfxMessageBox ("toto");</font>
+01472 POSITION p = load.GetStartPosition(); <font class="comment">//la doc dit que p=NULL quand il n'y a pas de selection : c'est faux, genial les MFC</font>
+01473 <font class="keywordflow">while</font> (p)
+01474 {
+01475 CString str = load.GetNextPathName(p);
+01476
+01477 <font class="keywordtype">char</font> sDrive[256];
+01478 <font class="keywordtype">char</font> sPath[256];
+01479 _splitpath (str, sDrive, sPath, NULL, NULL);
+01480 LastPath=string (sDrive)+string (sPath);
+01481
+01482 <font class="keywordflow">if</font> (str!=CString(<font class="stringliteral">""</font>))
+01483 {
+01484 <font class="keywordtype">int</font> index=0;
+01485 <font class="keyword">const</font> <font class="keywordtype">char</font> *pathname = (LPCTSTR)str;
+01486
+01487 <font class="comment">// Add mode, to the end of the list</font>
+01488 <font class="keywordflow">if</font> (id==ID_MENU_ADD)
+01489 {
+01490 <font class="comment">// Index of the new tile</font>
+01491 <font class="keywordtype">int</font> index;
+01492
+01493 <font class="comment">// Index in the list</font>
+01494 <font class="keywordflow">switch</font> (parent-&gt;m_128x128)
+01495 {
+01496 <font class="keywordflow">case</font> 0:
+01497 <font class="comment">// Add a 128 tile</font>
+01498 index=InfoList.<a class="code" href="class_TileList.html#a9">addTile128</a> ();
+01499
+01500 <font class="comment">// Set the tile</font>
+01501 <font class="keywordflow">if</font> (!InfoList.<a class="code" href="class_TileList.html#a11">setTile128</a> (index, pathname, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha)))
+01502 <font class="comment">// If prb, remove it</font>
+01503 InfoList.<a class="code" href="class_TileList.html#a16">removeTile128</a> (index);
+01504
+01505 <font class="keywordflow">break</font>;
+01506 <font class="keywordflow">case</font> 1:
+01507 <font class="comment">// Add a 128 tile</font>
+01508 index=InfoList.<a class="code" href="class_TileList.html#a10">addTile256</a> ();
+01509
+01510 <font class="comment">// Set the tile</font>
+01511 <font class="keywordflow">if</font> (!InfoList.<a class="code" href="class_TileList.html#a12">setTile256</a> (index, pathname, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha)))
+01512 <font class="comment">// If prb, remove it</font>
+01513 InfoList.<a class="code" href="class_TileList.html#a17">removeTile256</a> (index);
+01514
+01515 <font class="keywordflow">break</font>;
+01516 <font class="keywordflow">case</font> 2:
+01517 <a class="code" href="debug_h.html#a6">nlassert</a> (0); <font class="comment">// no, can't add transition</font>
+01518 <font class="keywordflow">break</font>;
+01519 }
+01520 }
+01521 <font class="keywordflow">else</font>
+01522 {
+01523 <font class="comment">// Must be a replace mode.</font>
+01524 <a class="code" href="debug_h.html#a6">nlassert</a> (id==ID_MENU_REPLACE);
+01525
+01526 <font class="comment">// For each tile</font>
+01527 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> index=0; index&lt;InfoList.GetSize(parent-&gt;m_128x128); index++)
+01528 {
+01529 <font class="comment">// If selected</font>
+01530 <font class="keywordflow">if</font> (InfoList.<a class="code" href="class_TileList.html#a26">Get</a>(index, parent-&gt;m_128x128)-&gt;Selected)
+01531 {
+01532 <font class="keywordflow">switch</font> (parent-&gt;m_128x128)
+01533 {
+01534 <font class="keywordflow">case</font> 0:
+01535 <font class="comment">// Set the 128 tile</font>
+01536 InfoList.<a class="code" href="class_TileList.html#a11">setTile128</a> (index, pathname, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha));
+01537 <font class="keywordflow">break</font>;
+01538 <font class="keywordflow">case</font> 1:
+01539 <font class="comment">// Set the 256 tile</font>
+01540 InfoList.<a class="code" href="class_TileList.html#a12">setTile256</a> (index, pathname, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha));
+01541 <font class="keywordflow">break</font>;
+01542 <font class="keywordflow">case</font> 2:
+01543 <font class="comment">// Alpha texture ?</font>
+01544 <font class="keywordflow">if</font> (Texture!=3)
+01545 {
+01546 InfoList.<a class="code" href="class_TileList.html#a13">setTileTransition</a> (index, pathname, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha));
+01547 }
+01548 <font class="comment">// Alpha!</font>
+01549 <font class="keywordflow">else</font>
+01550 {
+01551 <font class="comment">// Select rotation</font>
+01552 <a class="code" href="class_SelectRotation.html">SelectRotation</a> selectRotation;
+01553 <font class="keywordflow">if</font> (selectRotation.DoModal()==IDOK)
+01554 {
+01555 <font class="comment">// Set the alpha tile with the good rotation</font>
+01556 InfoList.<a class="code" href="class_TileList.html#a14">setTileTransitionAlpha</a> (index, pathname, selectRotation.RotSelected);
+01557 }
+01558 }
+01559 <font class="keywordflow">break</font>;
+01560 <font class="keywordflow">case</font> 3:
+01561 <font class="comment">// Displacement</font>
+01562 InfoList.<a class="code" href="class_TileList.html#a15">setDisplacement</a> (index, pathname);
+01563 <font class="keywordflow">break</font>;
+01564 <font class="keywordflow">default</font>:
+01565 <a class="code" href="debug_h.html#a6">nlassert</a> (0); <font class="comment">// no!</font>
+01566 }
+01567 }
+01568
+01569 <font class="comment">// Reload last inserted tile</font>
+01570 InfoList.<a class="code" href="class_TileList.html#a4">Reload</a>(index, 1, parent-&gt;m_128x128);
+01571 InfoList.<a class="code" href="class_TileList.html#a26">Get</a>(index, parent-&gt;m_128x128)-&gt;Selected = 0;
+01572 }
+01573 }
+01574 }
+01575 }
+01576 }
+01577 <font class="keyword">delete</font> load.m_ofn.lpstrFile;
+01578 <font class="comment">//InfoList.Sort();</font>
+01579 bPopup = 0;
+01580 }
+01581 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (id==12)
+01582 {
+01583 ViewTileMode = 1;
+01584 <a class="code" href="class_Browse.html">Browse</a> *parent = (<a class="code" href="class_Browse.html">Browse</a>*) this-&gt;GetParent();
+01585 parent-&gt;SendMessage(WM_PAINT,0,0);
+01586 bPopup = 0;
+01587 }
+01588 this-&gt;RedrawWindow();
+01589 }
+01590 <font class="keywordflow">return</font> CStatic::WindowProc(message, wParam, lParam);
+01591 }
+01592
+01593
+<a name="l01594"></a><a class="code" href="class_CTView.html#b5">01594</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#b5">CTView::OnRButtonDown</a>(UINT nFlags, CPoint point)<font class="keyword">
+</font>01595 <font class="keyword"></font>{
+01596 <font class="comment">// TODO: Add your message handler code here and/or call default</font>
+01597 <font class="keywordflow">if</font> (!lockInsertion)
+01598 {
+01599 <a class="code" href="class_Browse.html">Browse</a> *parent = (<a class="code" href="class_Browse.html">Browse</a>*)this-&gt;GetParent();
+01600 RECT wndpos; CMenu popup;
+01601 GetParent()-&gt;GetWindowRect(&amp;wndpos);
+01602 popup.CreatePopupMenu();
+01603
+01604 <font class="keywordtype">int</font> c = 0;
+01605 <font class="keywordflow">for</font> (tilelist::iterator p = InfoList.<a class="code" href="class_TileList.html#a24">GetFirst</a>(parent-&gt;m_128x128);p!=InfoList.<a class="code" href="class_TileList.html#a25">GetLast</a>(parent-&gt;m_128x128);++p)
+01606 {
+01607 <font class="keywordflow">if</font> (p-&gt;Selected) c++;
+01608 }
+01609
+01610 <font class="keywordflow">if</font> (!ViewTileMode)
+01611 {
+01612 popup.AppendMenu(parent-&gt;m_128x128&lt;2 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_ADD,"Add...");
+01613 popup.AppendMenu(c&gt;0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_REPLACE, <font class="stringliteral">"Replace..."</font>);
+01614 popup.AppendMenu(c&gt;0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_BITMAP, <font class="stringliteral">"Del bitmap"</font>);
+01615 popup.AppendMenu((c&gt;0 &amp;&amp; parent-&gt;m_128x128&lt;2) ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_TILE, <font class="stringliteral">"Del tile"</font>);
+01616 }
+01617 <font class="keywordflow">else</font>
+01618 {
+01619 }
+01620 bPopup = 1;
+01621 popup.TrackPopupMenu(TPM_LEFTALIGN,MousePos.x+wndpos.left,MousePos.y+wndpos.top,GetParent(),NULL);
+01622 }
+01623 CStatic::OnRButtonDown(nFlags, point);
+01624 }
+01625
+<a name="l01626"></a><a class="code" href="class_CTView.html#b4">01626</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#b4">CTView::OnLButtonDown</a>(UINT nFlags, CPoint point)<font class="keyword">
+</font>01627 <font class="keyword"></font>{
+01628 <font class="comment">// TODO: Add your message handler code here and/or call default</font>
+01629 SendMessage(WM_PAINT,0,0);
+01630 CStatic::OnLButtonDown(nFlags, point);
+01631 }
+01632
+01633
+<a name="l01634"></a><a class="code" href="class_CTView.html#b3">01634</a> <font class="keywordtype">void</font> <a class="code" href="class_CTView.html#b3">CTView::OnLButtonDblClk</a>(UINT nFlags, CPoint point)<font class="keyword">
+</font>01635 <font class="keyword"></font>{
+01636 <font class="comment">// TODO: Add your message handler code here and/or call default</font>
+01637 }
+01638
+</div></pre>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>