ListWindow.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "../idlib/precompiled.h"
  21. #pragma hdrstop
  22. #include "../framework/Session_local.h"
  23. #include "DeviceContext.h"
  24. #include "Window.h"
  25. #include "UserInterfaceLocal.h"
  26. #include "SliderWindow.h"
  27. #include "ListWindow.h"
  28. // Number of pixels above the text that the rect starts
  29. static const int pixelOffset = 3;
  30. // number of pixels between columns
  31. static const int tabBorder = 4;
  32. // Time in milliseconds between clicks to register as a double-click
  33. static const int doubleClickSpeed = 300;
  34. void idListWindow::CommonInit() {
  35. typed = "";
  36. typedTime = 0;
  37. clickTime = 0;
  38. currentSel.Clear();
  39. top = 0;
  40. sizeBias = 0;
  41. horizontal = false;
  42. scroller = new idSliderWindow(dc, gui);
  43. multipleSel = false;
  44. }
  45. idListWindow::idListWindow(idDeviceContext *d, idUserInterfaceLocal *g) : idWindow(d, g) {
  46. dc = d;
  47. gui = g;
  48. CommonInit();
  49. }
  50. idListWindow::idListWindow(idUserInterfaceLocal *g) : idWindow(g) {
  51. gui = g;
  52. CommonInit();
  53. }
  54. void idListWindow::SetCurrentSel( int sel ) {
  55. currentSel.Clear();
  56. currentSel.Append( sel );
  57. }
  58. void idListWindow::ClearSelection( int sel ) {
  59. int cur = currentSel.FindIndex( sel );
  60. if ( cur >= 0 ) {
  61. currentSel.RemoveIndex( cur );
  62. }
  63. }
  64. void idListWindow::AddCurrentSel( int sel ) {
  65. currentSel.Append( sel );
  66. }
  67. int idListWindow::GetCurrentSel() {
  68. return ( currentSel.Num() ) ? currentSel[0] : 0;
  69. }
  70. bool idListWindow::IsSelected( int index ) {
  71. return ( currentSel.FindIndex( index ) >= 0 );
  72. }
  73. const char *idListWindow::HandleEvent(const sysEvent_t *event, bool *updateVisuals) {
  74. // need to call this to allow proper focus and capturing on embedded children
  75. const char *ret = idWindow::HandleEvent(event, updateVisuals);
  76. float vert = GetMaxCharHeight();
  77. int numVisibleLines = textRect.h / vert;
  78. int key = event->evValue;
  79. if ( event->evType == SE_KEY ) {
  80. if ( !event->evValue2 ) {
  81. // We only care about key down, not up
  82. return ret;
  83. }
  84. if ( key == K_MOUSE1 || key == K_MOUSE2 ) {
  85. // If the user clicked in the scroller, then ignore it
  86. if ( scroller->Contains(gui->CursorX(), gui->CursorY()) ) {
  87. return ret;
  88. }
  89. }
  90. if ( ( key == K_ENTER || key == K_KP_ENTER ) ) {
  91. RunScript( ON_ENTER );
  92. return cmd;
  93. }
  94. if ( key == K_MWHEELUP ) {
  95. key = K_UPARROW;
  96. } else if ( key == K_MWHEELDOWN ) {
  97. key = K_DOWNARROW;
  98. }
  99. if ( key == K_MOUSE1) {
  100. if (Contains(gui->CursorX(), gui->CursorY())) {
  101. int cur = ( int )( ( gui->CursorY() - actualY - pixelOffset ) / vert ) + top;
  102. if ( cur >= 0 && cur < listItems.Num() ) {
  103. if ( multipleSel && idKeyInput::IsDown( K_CTRL ) ) {
  104. if ( IsSelected( cur ) ) {
  105. ClearSelection( cur );
  106. } else {
  107. AddCurrentSel( cur );
  108. }
  109. } else {
  110. if ( IsSelected( cur ) && ( gui->GetTime() < clickTime + doubleClickSpeed ) ) {
  111. // Double-click causes ON_ENTER to get run
  112. RunScript(ON_ENTER);
  113. return cmd;
  114. }
  115. SetCurrentSel( cur );
  116. clickTime = gui->GetTime();
  117. }
  118. } else {
  119. SetCurrentSel( listItems.Num() - 1 );
  120. }
  121. }
  122. } else if ( key == K_UPARROW || key == K_PGUP || key == K_DOWNARROW || key == K_PGDN ) {
  123. int numLines = 1;
  124. if ( key == K_PGUP || key == K_PGDN ) {
  125. numLines = numVisibleLines / 2;
  126. }
  127. if ( key == K_UPARROW || key == K_PGUP ) {
  128. numLines = -numLines;
  129. }
  130. if ( idKeyInput::IsDown( K_CTRL ) ) {
  131. top += numLines;
  132. } else {
  133. SetCurrentSel( GetCurrentSel() + numLines );
  134. }
  135. } else {
  136. return ret;
  137. }
  138. } else if ( event->evType == SE_CHAR ) {
  139. if ( !idStr::CharIsPrintable(key) ) {
  140. return ret;
  141. }
  142. if ( gui->GetTime() > typedTime + 1000 ) {
  143. typed = "";
  144. }
  145. typedTime = gui->GetTime();
  146. typed.Append( key );
  147. for ( int i=0; i<listItems.Num(); i++ ) {
  148. if ( idStr::Icmpn( typed, listItems[i], typed.Length() ) == 0 ) {
  149. SetCurrentSel( i );
  150. break;
  151. }
  152. }
  153. } else {
  154. return ret;
  155. }
  156. if ( GetCurrentSel() < 0 ) {
  157. SetCurrentSel( 0 );
  158. }
  159. if ( GetCurrentSel() >= listItems.Num() ) {
  160. SetCurrentSel( listItems.Num() - 1 );
  161. }
  162. if ( scroller->GetHigh() > 0.0f ) {
  163. if ( !idKeyInput::IsDown( K_CTRL ) ) {
  164. if ( top > GetCurrentSel() - 1 ) {
  165. top = GetCurrentSel() - 1;
  166. }
  167. if ( top < GetCurrentSel() - numVisibleLines + 2 ) {
  168. top = GetCurrentSel() - numVisibleLines + 2;
  169. }
  170. }
  171. if ( top > listItems.Num() - 2 ) {
  172. top = listItems.Num() - 2;
  173. }
  174. if ( top < 0 ) {
  175. top = 0;
  176. }
  177. scroller->SetValue(top);
  178. } else {
  179. top = 0;
  180. scroller->SetValue(0.0f);
  181. }
  182. if ( key != K_MOUSE1 ) {
  183. // Send a fake mouse click event so onAction gets run in our parents
  184. const sysEvent_t ev = sys->GenerateMouseButtonEvent( 1, true );
  185. idWindow::HandleEvent(&ev, updateVisuals);
  186. }
  187. if ( currentSel.Num() > 0 ) {
  188. for ( int i = 0; i < currentSel.Num(); i++ ) {
  189. gui->SetStateInt( va( "%s_sel_%i", listName.c_str(), i ), currentSel[i] );
  190. }
  191. } else {
  192. gui->SetStateInt( va( "%s_sel_0", listName.c_str() ), 0 );
  193. }
  194. gui->SetStateInt( va( "%s_numsel", listName.c_str() ), currentSel.Num() );
  195. return ret;
  196. }
  197. bool idListWindow::ParseInternalVar(const char *_name, idParser *src) {
  198. if (idStr::Icmp(_name, "horizontal") == 0) {
  199. horizontal = src->ParseBool();
  200. return true;
  201. }
  202. if (idStr::Icmp(_name, "listname") == 0) {
  203. ParseString(src, listName);
  204. return true;
  205. }
  206. if (idStr::Icmp(_name, "tabstops") == 0) {
  207. ParseString(src, tabStopStr);
  208. return true;
  209. }
  210. if (idStr::Icmp(_name, "tabaligns") == 0) {
  211. ParseString(src, tabAlignStr);
  212. return true;
  213. }
  214. if (idStr::Icmp(_name, "multipleSel") == 0) {
  215. multipleSel = src->ParseBool();
  216. return true;
  217. }
  218. if(idStr::Icmp(_name, "tabvaligns") == 0) {
  219. ParseString(src, tabVAlignStr);
  220. return true;
  221. }
  222. if(idStr::Icmp(_name, "tabTypes") == 0) {
  223. ParseString(src, tabTypeStr);
  224. return true;
  225. }
  226. if(idStr::Icmp(_name, "tabIconSizes") == 0) {
  227. ParseString(src, tabIconSizeStr);
  228. return true;
  229. }
  230. if(idStr::Icmp(_name, "tabIconVOffset") == 0) {
  231. ParseString(src, tabIconVOffsetStr);
  232. return true;
  233. }
  234. idStr strName = _name;
  235. if(idStr::Icmp(strName.Left(4), "mtr_") == 0) {
  236. idStr matName;
  237. const idMaterial* mat;
  238. ParseString(src, matName);
  239. mat = declManager->FindMaterial(matName);
  240. mat->SetImageClassifications( 1 ); // just for resource tracking
  241. if ( mat && !mat->TestMaterialFlag( MF_DEFAULTED ) ) {
  242. mat->SetSort(SS_GUI );
  243. }
  244. iconMaterials.Set(_name, mat);
  245. return true;
  246. }
  247. return idWindow::ParseInternalVar(_name, src);
  248. }
  249. idWinVar *idListWindow::GetWinVarByName(const char *_name, bool fixup, drawWin_t** owner) {
  250. return idWindow::GetWinVarByName(_name, fixup, owner);
  251. }
  252. void idListWindow::PostParse() {
  253. idWindow::PostParse();
  254. InitScroller(horizontal);
  255. idList<int> tabStops;
  256. idList<int> tabAligns;
  257. if (tabStopStr.Length()) {
  258. idParser src(tabStopStr, tabStopStr.Length(), "tabstops", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS);
  259. idToken tok;
  260. while (src.ReadToken(&tok)) {
  261. if (tok == ",") {
  262. continue;
  263. }
  264. tabStops.Append(atoi(tok));
  265. }
  266. }
  267. if (tabAlignStr.Length()) {
  268. idParser src(tabAlignStr, tabAlignStr.Length(), "tabaligns", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS);
  269. idToken tok;
  270. while (src.ReadToken(&tok)) {
  271. if (tok == ",") {
  272. continue;
  273. }
  274. tabAligns.Append(atoi(tok));
  275. }
  276. }
  277. idList<int> tabVAligns;
  278. if (tabVAlignStr.Length()) {
  279. idParser src(tabVAlignStr, tabVAlignStr.Length(), "tabvaligns", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS);
  280. idToken tok;
  281. while (src.ReadToken(&tok)) {
  282. if (tok == ",") {
  283. continue;
  284. }
  285. tabVAligns.Append(atoi(tok));
  286. }
  287. }
  288. idList<int> tabTypes;
  289. if (tabTypeStr.Length()) {
  290. idParser src(tabTypeStr, tabTypeStr.Length(), "tabtypes", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS);
  291. idToken tok;
  292. while (src.ReadToken(&tok)) {
  293. if (tok == ",") {
  294. continue;
  295. }
  296. tabTypes.Append(atoi(tok));
  297. }
  298. }
  299. idList<idVec2> tabSizes;
  300. if (tabIconSizeStr.Length()) {
  301. idParser src(tabIconSizeStr, tabIconSizeStr.Length(), "tabiconsizes", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS);
  302. idToken tok;
  303. while (src.ReadToken(&tok)) {
  304. if (tok == ",") {
  305. continue;
  306. }
  307. idVec2 size;
  308. size.x = atoi(tok);
  309. src.ReadToken(&tok); //","
  310. src.ReadToken(&tok);
  311. size.y = atoi(tok);
  312. tabSizes.Append(size);
  313. }
  314. }
  315. idList<float> tabIconVOffsets;
  316. if (tabIconVOffsetStr.Length()) {
  317. idParser src(tabIconVOffsetStr, tabIconVOffsetStr.Length(), "tabiconvoffsets", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS);
  318. idToken tok;
  319. while (src.ReadToken(&tok)) {
  320. if (tok == ",") {
  321. continue;
  322. }
  323. tabIconVOffsets.Append(atof(tok));
  324. }
  325. }
  326. int c = tabStops.Num();
  327. bool doAligns = (tabAligns.Num() == tabStops.Num());
  328. for (int i = 0; i < c; i++) {
  329. idTabRect r;
  330. r.x = tabStops[i];
  331. r.w = (i < c - 1) ? tabStops[i+1] - r.x - tabBorder : -1;
  332. r.align = (doAligns) ? tabAligns[i] : 0;
  333. if(tabVAligns.Num() > 0) {
  334. r.valign = tabVAligns[i];
  335. } else {
  336. r.valign = 0;
  337. }
  338. if(tabTypes.Num() > 0) {
  339. r.type = tabTypes[i];
  340. } else {
  341. r.type = TAB_TYPE_TEXT;
  342. }
  343. if(tabSizes.Num() > 0) {
  344. r.iconSize = tabSizes[i];
  345. } else {
  346. r.iconSize.Zero();
  347. }
  348. if(tabIconVOffsets.Num() > 0 ) {
  349. r.iconVOffset = tabIconVOffsets[i];
  350. } else {
  351. r.iconVOffset = 0;
  352. }
  353. tabInfo.Append(r);
  354. }
  355. flags |= WIN_CANFOCUS;
  356. }
  357. /*
  358. ================
  359. idListWindow::InitScroller
  360. This is the same as in idEditWindow
  361. ================
  362. */
  363. void idListWindow::InitScroller( bool horizontal )
  364. {
  365. const char *thumbImage = "guis/assets/scrollbar_thumb.tga";
  366. const char *barImage = "guis/assets/scrollbarv.tga";
  367. const char *scrollerName = "_scrollerWinV";
  368. if (horizontal) {
  369. barImage = "guis/assets/scrollbarh.tga";
  370. scrollerName = "_scrollerWinH";
  371. }
  372. const idMaterial *mat = declManager->FindMaterial( barImage );
  373. mat->SetSort( SS_GUI );
  374. sizeBias = mat->GetImageWidth();
  375. idRectangle scrollRect;
  376. if (horizontal) {
  377. sizeBias = mat->GetImageHeight();
  378. scrollRect.x = 0;
  379. scrollRect.y = (clientRect.h - sizeBias);
  380. scrollRect.w = clientRect.w;
  381. scrollRect.h = sizeBias;
  382. } else {
  383. scrollRect.x = (clientRect.w - sizeBias);
  384. scrollRect.y = 0;
  385. scrollRect.w = sizeBias;
  386. scrollRect.h = clientRect.h;
  387. }
  388. scroller->InitWithDefaults(scrollerName, scrollRect, foreColor, matColor, mat->GetName(), thumbImage, !horizontal, true);
  389. InsertChild(scroller, NULL);
  390. scroller->SetBuddy(this);
  391. }
  392. void idListWindow::Draw(int time, float x, float y) {
  393. idVec4 color;
  394. idStr work;
  395. int count = listItems.Num();
  396. idRectangle rect = textRect;
  397. float scale = textScale;
  398. float lineHeight = GetMaxCharHeight();
  399. float bottom = textRect.Bottom();
  400. float width = textRect.w;
  401. if ( scroller->GetHigh() > 0.0f ) {
  402. if ( horizontal ) {
  403. bottom -= sizeBias;
  404. } else {
  405. width -= sizeBias;
  406. rect.w = width;
  407. }
  408. }
  409. if ( noEvents || !Contains(gui->CursorX(), gui->CursorY()) ) {
  410. hover = false;
  411. }
  412. for (int i = top; i < count; i++) {
  413. if ( IsSelected( i ) ) {
  414. rect.h = lineHeight;
  415. dc->DrawFilledRect(rect.x, rect.y + pixelOffset, rect.w, rect.h, borderColor);
  416. if ( flags & WIN_FOCUS ) {
  417. idVec4 color = borderColor;
  418. color.w = 1.0f;
  419. dc->DrawRect(rect.x, rect.y + pixelOffset, rect.w, rect.h, 1.0f, color );
  420. }
  421. }
  422. rect.y ++;
  423. rect.h = lineHeight - 1;
  424. if ( hover && !noEvents && Contains(rect, gui->CursorX(), gui->CursorY()) ) {
  425. color = hoverColor;
  426. } else {
  427. color = foreColor;
  428. }
  429. rect.h = lineHeight + pixelOffset;
  430. rect.y --;
  431. if ( tabInfo.Num() > 0 ) {
  432. int start = 0;
  433. int tab = 0;
  434. int stop = listItems[i].Find('\t', 0);
  435. while ( start < listItems[i].Length() ) {
  436. if ( tab >= tabInfo.Num() ) {
  437. common->Warning( "idListWindow::Draw: gui '%s' window '%s' tabInfo.Num() exceeded", gui->GetSourceFile(), name.c_str() );
  438. break;
  439. }
  440. listItems[i].Mid(start, stop - start, work);
  441. rect.x = textRect.x + tabInfo[tab].x;
  442. rect.w = (tabInfo[tab].w == -1) ? width - tabInfo[tab].x : tabInfo[tab].w;
  443. dc->PushClipRect( rect );
  444. if ( tabInfo[tab].type == TAB_TYPE_TEXT ) {
  445. dc->DrawText(work, scale, tabInfo[tab].align, color, rect, false, -1);
  446. } else if (tabInfo[tab].type == TAB_TYPE_ICON) {
  447. const idMaterial **hashMat;
  448. const idMaterial *iconMat;
  449. // leaving the icon name empty doesn't draw anything
  450. if ( work[0] != '\0' ) {
  451. if ( iconMaterials.Get(work, &hashMat) == false ) {
  452. iconMat = declManager->FindMaterial("_default");
  453. } else {
  454. iconMat = *hashMat;
  455. }
  456. idRectangle iconRect;
  457. iconRect.w = tabInfo[tab].iconSize.x;
  458. iconRect.h = tabInfo[tab].iconSize.y;
  459. if(tabInfo[tab].align == idDeviceContext::ALIGN_LEFT) {
  460. iconRect.x = rect.x;
  461. } else if (tabInfo[tab].align == idDeviceContext::ALIGN_CENTER) {
  462. iconRect.x = rect.x + rect.w/2.0f - iconRect.w/2.0f;
  463. } else if (tabInfo[tab].align == idDeviceContext::ALIGN_RIGHT) {
  464. iconRect.x = rect.x + rect.w - iconRect.w;
  465. }
  466. if(tabInfo[tab].valign == 0) { //Top
  467. iconRect.y = rect.y + tabInfo[tab].iconVOffset;
  468. } else if(tabInfo[tab].valign == 1) { //Center
  469. iconRect.y = rect.y + rect.h/2.0f - iconRect.h/2.0f + tabInfo[tab].iconVOffset;
  470. } else if(tabInfo[tab].valign == 2) { //Bottom
  471. iconRect.y = rect.y + rect.h - iconRect.h + tabInfo[tab].iconVOffset;
  472. }
  473. dc->DrawMaterial(iconRect.x, iconRect.y, iconRect.w, iconRect.h, iconMat, idVec4(1.0f,1.0f,1.0f,1.0f), 1.0f, 1.0f);
  474. }
  475. }
  476. dc->PopClipRect();
  477. start = stop + 1;
  478. stop = listItems[i].Find('\t', start);
  479. if ( stop < 0 ) {
  480. stop = listItems[i].Length();
  481. }
  482. tab++;
  483. }
  484. rect.x = textRect.x;
  485. rect.w = width;
  486. } else {
  487. dc->DrawText(listItems[i], scale, 0, color, rect, false, -1);
  488. }
  489. rect.y += lineHeight;
  490. if ( rect.y > bottom ) {
  491. break;
  492. }
  493. }
  494. }
  495. void idListWindow::Activate(bool activate, idStr &act) {
  496. idWindow::Activate(activate, act);
  497. if ( activate ) {
  498. UpdateList();
  499. }
  500. }
  501. void idListWindow::HandleBuddyUpdate(idWindow *buddy) {
  502. top = scroller->GetValue();
  503. }
  504. void idListWindow::UpdateList() {
  505. idStr str, strName;
  506. listItems.Clear();
  507. for (int i = 0; i < MAX_LIST_ITEMS; i++) {
  508. if (gui->State().GetString( va("%s_item_%i", listName.c_str(), i), "", str) ) {
  509. if ( str.Length() ) {
  510. listItems.Append(str);
  511. }
  512. } else {
  513. break;
  514. }
  515. }
  516. float vert = GetMaxCharHeight();
  517. int fit = textRect.h / vert;
  518. if ( listItems.Num() < fit ) {
  519. scroller->SetRange(0.0f, 0.0f, 1.0f);
  520. } else {
  521. scroller->SetRange(0.0f, (listItems.Num() - fit) + 1.0f, 1.0f);
  522. }
  523. SetCurrentSel( gui->State().GetInt( va( "%s_sel_0", listName.c_str() ) ) );
  524. float value = scroller->GetValue();
  525. if ( value > listItems.Num() - 1 ) {
  526. value = listItems.Num() - 1;
  527. }
  528. if ( value < 0.0f ) {
  529. value = 0.0f;
  530. }
  531. scroller->SetValue(value);
  532. top = value;
  533. typedTime = 0;
  534. clickTime = 0;
  535. typed = "";
  536. }
  537. void idListWindow::StateChanged( bool redraw ) {
  538. UpdateList();
  539. }