guiConsole.cpp
Engine/source/gui/controls/guiConsole.cpp
Public Functions
ConsoleDocClass(GuiConsole , "@brief The on- screen, in-game console. Calls getLog() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get the on-screen console entries, then renders them as <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">needed.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classguiconsole/">GuiConsole</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Properties not specific <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> have been omitted from this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example.\n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" " @ingroup GuiCore" )
DefineEngineMethod(GuiConsole , getErrorFilter , bool , () , "Returns <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the error filter is on or not." )
DefineEngineMethod(GuiConsole , getNormalFilter , bool , () , "Returns <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the normal message filter is on or not." )
DefineEngineMethod(GuiConsole , getWarnFilter , bool , () , "Returns <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the warning filter is on or not." )
DefineEngineMethod(GuiConsole , refresh , void , () , "Refreshes the displayed messages." )
DefineEngineMethod(GuiConsole , setDisplayFilters , void , (bool errors, bool warns, bool normal) , (true, true, true) , "Sets the current display filters <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the console gui. Allows you <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> indicate <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it should display errors, warns and/or normal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">messages.\n\n</a>" " @param errors If true, the console gui will display any error messages that were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">emitted.\n\n</a>" " @param warns If true, the console gui will display any warning messages that were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">emitted.\n\n</a>" " @param normal If true, the console gui will display any regular messages that were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">emitted.\n\n</a>" )
DefineEngineMethod(GuiConsole , toggleErrorFilter , void , () , "Toggles the error filter." )
DefineEngineMethod(GuiConsole , toggleNormalFilter , void , () , "Toggles the normal messages filter." )
DefineEngineMethod(GuiConsole , toggleWarnFilter , void , () , "Toggles the warning filter." )
IMPLEMENT_CALLBACK(GuiConsole , onMessageSelected , void , (ConsoleLogEntry::Level level, const char *message) , (level, message) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> message in the log is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">clicked.\n\n</a>" "@param level Diagnostic level of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message.\n</a>" "@param message <a href="/coding/class/classmessage/">Message</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">text.\n</a>" )
IMPLEMENT_CALLBACK(GuiConsole , onNewMessage , void , (U32 errorCount, U32 warnCount, U32 normalCount) , (errorCount, warnCount, normalCount) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> message is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n\n</a>" "@param errorCount The number of error messages <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n</a>" "@param warnCount The number of warning messages <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n</a>" "@param normalCount The number of normal messages <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n</a>" )
Detailed Description
Public Functions
ConsoleDocClass(GuiConsole , "@brief The on- screen, in-game console. Calls getLog() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get the on-screen console entries, then renders them as <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">needed.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" " <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classguiconsole/">GuiConsole</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//Properties not specific <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> this <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> have been omitted from this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">example.\n</a>" " };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">GuiControl\n\n</a>" " @ingroup GuiCore" )
DefineEngineMethod(GuiConsole , getErrorFilter , bool , () , "Returns <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the error filter is on or not." )
DefineEngineMethod(GuiConsole , getNormalFilter , bool , () , "Returns <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the normal message filter is on or not." )
DefineEngineMethod(GuiConsole , getWarnFilter , bool , () , "Returns <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the warning filter is on or not." )
DefineEngineMethod(GuiConsole , refresh , void , () , "Refreshes the displayed messages." )
DefineEngineMethod(GuiConsole , setDisplayFilters , void , (bool errors, bool warns, bool normal) , (true, true, true) , "Sets the current display filters <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the console gui. Allows you <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> indicate <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it should display errors, warns and/or normal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">messages.\n\n</a>" " @param errors If true, the console gui will display any error messages that were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">emitted.\n\n</a>" " @param warns If true, the console gui will display any warning messages that were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">emitted.\n\n</a>" " @param normal If true, the console gui will display any regular messages that were <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">emitted.\n\n</a>" )
DefineEngineMethod(GuiConsole , toggleErrorFilter , void , () , "Toggles the error filter." )
DefineEngineMethod(GuiConsole , toggleNormalFilter , void , () , "Toggles the normal messages filter." )
DefineEngineMethod(GuiConsole , toggleWarnFilter , void , () , "Toggles the warning filter." )
IMPLEMENT_CALLBACK(GuiConsole , onMessageSelected , void , (ConsoleLogEntry::Level level, const char *message) , (level, message) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> message in the log is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">clicked.\n\n</a>" "@param level Diagnostic level of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">message.\n</a>" "@param message <a href="/coding/class/classmessage/">Message</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">text.\n</a>" )
IMPLEMENT_CALLBACK(GuiConsole , onNewMessage , void , (U32 errorCount, U32 warnCount, U32 normalCount) , (errorCount, warnCount, normalCount) , "Called when <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> message is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n\n</a>" "@param errorCount The number of error messages <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n</a>" "@param warnCount The number of warning messages <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n</a>" "@param normalCount The number of normal messages <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">logged.\n</a>" )
IMPLEMENT_CONOBJECT(GuiConsole )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "console/console.h" 25#include "gfx/gfxDrawUtil.h" 26#include "gui/core/guiTypes.h" 27#include "gui/core/guiControl.h" 28#include "gui/controls/guiConsole.h" 29#include "gui/containers/guiScrollCtrl.h" 30#include "console/engineAPI.h" 31 32IMPLEMENT_CONOBJECT(GuiConsole); 33 34ConsoleDocClass( GuiConsole, 35 "@brief The on-screen, in-game console. Calls getLog() to get the on-screen console entries, then renders them as needed.\n\n" 36 37 "@tsexample\n" 38 " new GuiConsole()\n" 39 " {\n" 40 " //Properties not specific to this control have been omitted from this example.\n" 41 " };\n" 42 "@endtsexample\n\n" 43 44 "@see GuiControl\n\n" 45 46 "@ingroup GuiCore" 47); 48 49IMPLEMENT_CALLBACK( GuiConsole, onMessageSelected, void, ( ConsoleLogEntry::Level level, const char* message ), ( level, message ), 50 "Called when a message in the log is clicked.\n\n" 51 "@param level Diagnostic level of the message.\n" 52 "@param message Message text.\n" ); 53 54IMPLEMENT_CALLBACK(GuiConsole, onNewMessage, void, (U32 errorCount, U32 warnCount, U32 normalCount), (errorCount, warnCount, normalCount), 55 "Called when a new message is logged.\n\n" 56 "@param errorCount The number of error messages logged.\n" 57 "@param warnCount The number of warning messages logged.\n" 58 "@param normalCount The number of normal messages logged.\n"); 59 60 61//----------------------------------------------------------------------------- 62 63GuiConsole::GuiConsole() 64{ 65 setExtent(64, 64); 66 mCellSize.set(1, 1); 67 mSize.set(1, 0); 68 69 mDisplayErrors = true; 70 mDisplayWarnings = true; 71 mDisplayNormalMessages = true; 72 mFiltersDirty = true; 73} 74 75//----------------------------------------------------------------------------- 76 77bool GuiConsole::onWake() 78{ 79 if (! Parent::onWake()) 80 return false; 81 82 //get the font 83 mFont = mProfile->mFont; 84 85 return true; 86} 87 88//----------------------------------------------------------------------------- 89 90S32 GuiConsole::getMaxWidth(S32 startIndex, S32 endIndex) 91{ 92 //sanity check 93 if (startIndex < 0 || (U32)endIndex >= mFilteredLog.size() || startIndex > endIndex) 94 return 0; 95 96 S32 result = 0; 97 for(S32 i = startIndex; i <= endIndex; i++) 98 result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)mFilteredLog[i].mString))); 99 100 return(result + 6); 101} 102 103void GuiConsole::refreshLogText() 104{ 105 U32 size; 106 ConsoleLogEntry *log; 107 108 Con::getLockLog(log, size); 109 110 if (mFilteredLog.size() != size || mFiltersDirty) 111 { 112 mFilteredLog.clear(); 113 114 U32 errorCount = 0; 115 U32 warnCount = 0; 116 U32 normalCount = 0; 117 118 //Filter the log if needed 119 for (U32 i = 0; i < size; ++i) 120 { 121 ConsoleLogEntry &entry = log[i]; 122 123 if (entry.mLevel == ConsoleLogEntry::Error) 124 { 125 errorCount++; 126 if (mDisplayErrors) 127 { 128 mFilteredLog.push_back(entry); 129 } 130 } 131 else if (entry.mLevel == ConsoleLogEntry::Warning) 132 { 133 warnCount++; 134 if (mDisplayWarnings) 135 { 136 mFilteredLog.push_back(entry); 137 } 138 } 139 else if (entry.mLevel == ConsoleLogEntry::Normal) 140 { 141 normalCount++; 142 if (mDisplayNormalMessages) 143 { 144 mFilteredLog.push_back(entry); 145 } 146 } 147 } 148 149 onNewMessage_callback(errorCount, warnCount, normalCount); 150 } 151 152 Con::unlockLog(); 153} 154 155//----------------------------------------------------------------------------- 156 157void GuiConsole::onPreRender() 158{ 159 //see if the size has changed 160 U32 prevSize = getHeight() / mCellSize.y; 161 162 refreshLogText(); 163 164 //first, find out if the console was scrolled up 165 bool scrolled = false; 166 GuiScrollCtrl *parent = dynamic_cast<GuiScrollCtrl*>(getParent()); 167 168 if(parent) 169 scrolled = parent->isScrolledToBottom(); 170 171 //find the max cell width for the new entries 172 S32 newMax = getMaxWidth(prevSize, mFilteredLog.size() - 1); 173 if(newMax > mCellSize.x) 174 mCellSize.set(newMax, mFont->getHeight()); 175 176 //set the array size 177 mSize.set(1, mFilteredLog.size()); 178 179 //resize the control 180 setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); 181 182 //if the console was not scrolled, make the last entry visible 183 if (scrolled) 184 scrollCellVisible(Point2I(0,mSize.y - 1)); 185} 186 187//----------------------------------------------------------------------------- 188 189void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, bool /*mouseOver*/) 190{ 191 ConsoleLogEntry &entry = mFilteredLog[cell.y]; 192 switch (entry.mLevel) 193 { 194 case ConsoleLogEntry::Normal: GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor); break; 195 case ConsoleLogEntry::Warning: GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColorHL); break; 196 case ConsoleLogEntry::Error: GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColorNA); break; 197 default: AssertFatal(false, "GuiConsole::onRenderCell - Unrecognized ConsoleLogEntry type, update this."); 198 } 199 GFX->getDrawUtil()->drawText(mFont, Point2I(offset.x + 3, offset.y), entry.mString, mProfile->mFontColors); 200} 201 202//----------------------------------------------------------------------------- 203 204void GuiConsole::onCellSelected( Point2I cell ) 205{ 206 Parent::onCellSelected( cell ); 207 208 ConsoleLogEntry& entry = mFilteredLog[cell.y]; 209 onMessageSelected_callback( entry.mLevel, entry.mString ); 210} 211 212void GuiConsole::setDisplayFilters(bool errors, bool warns, bool normal) 213{ 214 mDisplayErrors = errors; 215 mDisplayWarnings = warns; 216 mDisplayNormalMessages = normal; 217 mFiltersDirty = true; 218 219 refreshLogText(); 220 221 //find the max cell width for the new entries 222 S32 newMax = getMaxWidth(0, mFilteredLog.size() - 1); 223 mCellSize.set(newMax, mFont->getHeight()); 224 225 //set the array size 226 mSize.set(1, mFilteredLog.size()); 227 228 //resize the control 229 setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); 230 231 scrollCellVisible(Point2I(0, mSize.y - 1)); 232 233 mFiltersDirty = false; 234} 235 236DefineEngineMethod(GuiConsole, setDisplayFilters, void, (bool errors, bool warns, bool normal), (true, true, true), 237 "Sets the current display filters for the console gui. Allows you to indicate if it should display errors, warns and/or normal messages.\n\n" 238 "@param errors If true, the console gui will display any error messages that were emitted.\n\n" 239 "@param warns If true, the console gui will display any warning messages that were emitted.\n\n" 240 "@param normal If true, the console gui will display any regular messages that were emitted.\n\n") 241{ 242 object->setDisplayFilters(errors, warns, normal); 243} 244 245DefineEngineMethod(GuiConsole, getErrorFilter, bool, (), , 246 "Returns if the error filter is on or not.") 247{ 248 return object->getErrorFilter(); 249} 250 251DefineEngineMethod(GuiConsole, getWarnFilter, bool, (), , 252 "Returns if the warning filter is on or not.") 253{ 254 return object->getWarnFilter(); 255} 256 257DefineEngineMethod(GuiConsole, getNormalFilter, bool, (), , 258 "Returns if the normal message filter is on or not.") 259{ 260 return object->getNormalFilter(); 261} 262 263DefineEngineMethod(GuiConsole, toggleErrorFilter, void, (), , 264 "Toggles the error filter.") 265{ 266 object->toggleErrorFilter(); 267} 268 269DefineEngineMethod(GuiConsole, toggleWarnFilter, void, (), , 270 "Toggles the warning filter.") 271{ 272 object->toggleWarnFilter(); 273} 274 275DefineEngineMethod(GuiConsole, toggleNormalFilter, void, (), , 276 "Toggles the normal messages filter.") 277{ 278 object->toggleNormalFilter(); 279} 280 281DefineEngineMethod(GuiConsole, refresh, void, (), , 282 "Refreshes the displayed messages.") 283{ 284 object->refresh(); 285} 286