mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro.
This commit is contained in:
parent
378a933894
commit
acb192e2a5
133 changed files with 1716 additions and 2087 deletions
|
|
@ -256,11 +256,11 @@ static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap2(
|
|||
|
||||
|
||||
//"Set the bitmap displayed in the control. Note that it is limited in size, to 256x256."
|
||||
ConsoleMethod( GuiBitmapCtrl, setBitmap, void, 3, 4,
|
||||
DefineConsoleMethod( GuiBitmapCtrl, setBitmap, void, ( const char * fileRoot, bool resize), ( false),
|
||||
"( String filename | String filename, bool resize ) Assign an image to the control.\n\n"
|
||||
"@hide" )
|
||||
{
|
||||
char filename[1024];
|
||||
Con::expandScriptFilename(filename, sizeof(filename), argv[2]);
|
||||
object->setBitmap(filename, argc > 3 ? dAtob( argv[3] ) : false );
|
||||
Con::expandScriptFilename(filename, sizeof(filename), fileRoot);
|
||||
object->setBitmap(filename, resize );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "console/console.h"
|
||||
#include "gfx/gfxDevice.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/core/guiCanvas.h"
|
||||
#include "gui/buttons/guiButtonCtrl.h"
|
||||
#include "gui/core/guiDefaultControlRender.h"
|
||||
|
|
@ -526,24 +527,17 @@ void GuiColorPickerCtrl::setScriptValue(const char *value)
|
|||
setValue(newValue);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiColorPickerCtrl, getSelectorPos, const char*, 2, 2, "Gets the current position of the selector")
|
||||
DefineConsoleMethod(GuiColorPickerCtrl, getSelectorPos, Point2I, (), , "Gets the current position of the selector")
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char *temp = Con::getReturnBuffer(bufSize);
|
||||
Point2I pos;
|
||||
pos = object->getSelectorPos();
|
||||
dSprintf(temp,bufSize,"%d %d",pos.x, pos.y);
|
||||
return temp;
|
||||
return object->getSelectorPos();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiColorPickerCtrl, setSelectorPos, void, 3, 3, "Sets the current position of the selector")
|
||||
DefineConsoleMethod(GuiColorPickerCtrl, setSelectorPos, void, (Point2I newPos), , "Sets the current position of the selector")
|
||||
{
|
||||
Point2I newPos;
|
||||
dSscanf(argv[2], "%d %d", &newPos.x, &newPos.y);
|
||||
object->setSelectorPos(newPos);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiColorPickerCtrl, updateColor, void, 2, 2, "Forces update of pick color")
|
||||
DefineConsoleMethod(GuiColorPickerCtrl, updateColor, void, (), , "Forces update of pick color")
|
||||
{
|
||||
object->updateColor();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "gui/buttons/guiButtonBaseCtrl.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gfx/primBuilder.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "core/frameAllocator.h"
|
||||
#include "core/strings/stringUnit.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiFileTreeCtrl);
|
||||
|
|
@ -378,18 +379,19 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )
|
|||
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, 2, 2, "getSelectedPath() - returns the currently selected path in the tree")
|
||||
//ConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, 2, 2, "getSelectedPath() - returns the currently selected path in the tree")
|
||||
DefineConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, (), , "getSelectedPath() - returns the currently selected path in the tree")
|
||||
{
|
||||
const String& path = object->getSelectedPath();
|
||||
return Con::getStringArg( path );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiFileTreeCtrl, setSelectedPath, bool, 3, 3, "setSelectedPath(path) - expands the tree to the specified path")
|
||||
DefineConsoleMethod( GuiFileTreeCtrl, setSelectedPath, bool, (const char * path), , "setSelectedPath(path) - expands the tree to the specified path")
|
||||
{
|
||||
return object->setSelectedPath( argv[ 2 ] );
|
||||
return object->setSelectedPath( path );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiFileTreeCtrl, reload, void, 2, 2, "() - Reread the directory tree hierarchy." )
|
||||
DefineConsoleMethod( GuiFileTreeCtrl, reload, void, (), , "() - Reread the directory tree hierarchy." )
|
||||
{
|
||||
object->updateTree();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ void GuiGradientCtrl::sortColorRange()
|
|||
dQsort( mAlphaRange.address(), mAlphaRange.size(), sizeof(ColorRange), _numIncreasing);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiGradientCtrl, getColorCount, S32, 2, 2, "Get color count")
|
||||
DefineConsoleMethod(GuiGradientCtrl, getColorCount, S32, (), , "Get color count")
|
||||
{
|
||||
if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
|
||||
return object->mColorRange.size();
|
||||
|
|
@ -609,44 +609,25 @@ ConsoleMethod(GuiGradientCtrl, getColorCount, S32, 2, 2, "Get color count")
|
|||
return 0;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiGradientCtrl, getColor, const char*, 3, 3, "Get color value")
|
||||
DefineConsoleMethod(GuiGradientCtrl, getColor, ColorF, (S32 idx), , "Get color value")
|
||||
{
|
||||
S32 idx = dAtoi(argv[2]);
|
||||
|
||||
if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
|
||||
{
|
||||
if ( idx >= 0 && idx < object->mColorRange.size() )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* rColor = Con::getReturnBuffer(bufSize);
|
||||
rColor[0] = 0;
|
||||
|
||||
dSprintf(rColor, bufSize, "%f %f %f %f",
|
||||
object->mColorRange[idx].swatch->getColor().red,
|
||||
object->mColorRange[idx].swatch->getColor().green,
|
||||
object->mColorRange[idx].swatch->getColor().blue,
|
||||
object->mColorRange[idx].swatch->getColor().alpha);
|
||||
|
||||
return rColor;
|
||||
return object->mColorRange[idx].swatch->getColor();
|
||||
}
|
||||
}
|
||||
else if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
|
||||
{
|
||||
if ( idx >= 0 && idx < object->mAlphaRange.size() )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* rColor = Con::getReturnBuffer(bufSize);
|
||||
rColor[0] = 0;
|
||||
|
||||
dSprintf(rColor, bufSize, "%f %f %f %f",
|
||||
object->mAlphaRange[idx].swatch->getColor().red,
|
||||
object->mAlphaRange[idx].swatch->getColor().green,
|
||||
object->mAlphaRange[idx].swatch->getColor().blue,
|
||||
object->mAlphaRange[idx].swatch->getColor().alpha);
|
||||
|
||||
return rColor;
|
||||
return object->mAlphaRange[idx].swatch->getColor();
|
||||
}
|
||||
}
|
||||
|
||||
return "1 1 1 1";
|
||||
return ColorF::ONE;
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "core/util/safeDelete.h"
|
||||
#include "console/console.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gfx/gfxDevice.h"
|
||||
#include "math/util/matrixSet.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
|
|
@ -166,8 +167,8 @@ void GuiMaterialCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
GFX->setTexture( 0, NULL );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMaterialCtrl, setMaterial, bool, 3, 3, "( string materialName )"
|
||||
DefineConsoleMethod( GuiMaterialCtrl, setMaterial, bool, ( const char * materialName ), , "( string materialName )"
|
||||
"Set the material to be displayed in the control." )
|
||||
{
|
||||
return object->setMaterial( (const char*)argv[2] );
|
||||
return object->setMaterial( materialName );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "gui/core/guiCanvas.h"
|
||||
#include "gui/controls/guiPopUpCtrl.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/core/guiDefaultControlRender.h"
|
||||
#include "gfx/primBuilder.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
|
|
@ -299,121 +300,82 @@ void GuiPopUpMenuCtrl::initPersistFields(void)
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, add, void, 3, 5, "(string name, int idNum, int scheme=0)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)")
|
||||
{
|
||||
if ( argc == 4 )
|
||||
object->addEntry(argv[2],dAtoi(argv[3]));
|
||||
if ( argc == 5 )
|
||||
object->addEntry(argv[2],dAtoi(argv[3]),dAtoi(argv[4]));
|
||||
else
|
||||
object->addEntry(argv[2]);
|
||||
object->addEntry(name, idNum, scheme);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, 6, 6, "(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), ,
|
||||
"(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)")
|
||||
{
|
||||
ColorI fontColor, fontColorHL, fontColorSEL;
|
||||
U32 r, g, b;
|
||||
char buf[64];
|
||||
|
||||
dStrcpy( buf, argv[3] );
|
||||
char* temp = dStrtok( buf, " \0" );
|
||||
r = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
g = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
b = temp ? dAtoi( temp ) : 0;
|
||||
fontColor.set( r, g, b );
|
||||
|
||||
dStrcpy( buf, argv[4] );
|
||||
temp = dStrtok( buf, " \0" );
|
||||
r = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
g = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
b = temp ? dAtoi( temp ) : 0;
|
||||
fontColorHL.set( r, g, b );
|
||||
|
||||
dStrcpy( buf, argv[5] );
|
||||
temp = dStrtok( buf, " \0" );
|
||||
r = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
g = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
b = temp ? dAtoi( temp ) : 0;
|
||||
fontColorSEL.set( r, g, b );
|
||||
|
||||
object->addScheme( dAtoi( argv[2] ), fontColor, fontColorHL, fontColorSEL );
|
||||
object->addScheme( id, fontColor, fontColorHL, fontColorSEL );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, getText, const char*, 2, 2, "")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, getText, const char*, (), , "")
|
||||
{
|
||||
return object->getText();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, clear, void, 2, 2, "Clear the popup list.")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, clear, void, (), , "Clear the popup list.")
|
||||
{
|
||||
object->clear();
|
||||
}
|
||||
|
||||
//FIXME: clashes with SimSet.sort
|
||||
ConsoleMethod(GuiPopUpMenuCtrl, sort, void, 2, 2, "Sort the list alphabetically.")
|
||||
DefineConsoleMethod(GuiPopUpMenuCtrl, sort, void, (), , "Sort the list alphabetically.")
|
||||
{
|
||||
object->sort();
|
||||
}
|
||||
|
||||
// Added to sort the entries by ID
|
||||
ConsoleMethod(GuiPopUpMenuCtrl, sortID, void, 2, 2, "Sort the list by ID.")
|
||||
DefineConsoleMethod(GuiPopUpMenuCtrl, sortID, void, (), , "Sort the list by ID.")
|
||||
{
|
||||
object->sortID();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, forceOnAction, void, 2, 2, "")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, forceOnAction, void, (), , "")
|
||||
{
|
||||
object->onAction();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, forceClose, void, 2, 2, "")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, forceClose, void, (), , "")
|
||||
{
|
||||
object->closePopUp();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, getSelected, S32, 2, 2, "")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, getSelected, S32, (), , "")
|
||||
{
|
||||
return object->getSelected();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, setSelected, void, 3, 4, "(int id, [scriptCallback=true])")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])")
|
||||
{
|
||||
if( argc > 3 )
|
||||
object->setSelected( dAtoi( argv[2] ), dAtob( argv[3] ) );
|
||||
else
|
||||
object->setSelected( dAtoi( argv[2] ) );
|
||||
object->setSelected( id, scriptCallback );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, setFirstSelected, void, 2, 3, "([scriptCallback=true])")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])")
|
||||
{
|
||||
if( argc > 2 )
|
||||
object->setFirstSelected( dAtob( argv[2] ) );
|
||||
else
|
||||
object->setFirstSelected();
|
||||
object->setFirstSelected( scriptCallback );
|
||||
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, setNoneSelected, void, 2, 2, "")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, setNoneSelected, void, (), , "")
|
||||
{
|
||||
object->setNoneSelected();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, getTextById, const char*, 3, 3, "(int id)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, getTextById, const char*, (S32 id), , "(int id)")
|
||||
{
|
||||
return(object->getTextById(dAtoi(argv[2])));
|
||||
return(object->getTextById(id));
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, changeTextById, void, 4, 4, "( int id, string text )" )
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, changeTextById, void, ( S32 id, const char * text ), , "( int id, string text )" )
|
||||
{
|
||||
object->setEntryText( dAtoi( argv[ 2 ] ), argv[ 3 ] );
|
||||
object->setEntryText( id, text );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, string enum)"
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, (const char * className, const char * enumName), , "(string class, string enum)"
|
||||
"This fills the popup with a classrep's field enumeration type info.\n\n"
|
||||
"More of a helper function than anything. If console access to the field list is added, "
|
||||
"at least for the enumerated types, then this should go away..")
|
||||
|
|
@ -423,7 +385,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
|||
// walk the class list to get our class
|
||||
while(classRep)
|
||||
{
|
||||
if(!dStricmp(classRep->getClassName(), argv[2]))
|
||||
if(!dStricmp(classRep->getClassName(), className))
|
||||
break;
|
||||
classRep = classRep->getNextClass();
|
||||
}
|
||||
|
|
@ -431,20 +393,20 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
|||
// get it?
|
||||
if(!classRep)
|
||||
{
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", className);
|
||||
return;
|
||||
}
|
||||
|
||||
// walk the fields to check for this one (findField checks StringTableEntry ptrs...)
|
||||
U32 i;
|
||||
for(i = 0; i < classRep->mFieldList.size(); i++)
|
||||
if(!dStricmp(classRep->mFieldList[i].pFieldname, argv[3]))
|
||||
if(!dStricmp(classRep->mFieldList[i].pFieldname, enumName))
|
||||
break;
|
||||
|
||||
// found it?
|
||||
if(i == classRep->mFieldList.size())
|
||||
{
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", enumName, className);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +416,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
|||
// check the type
|
||||
if( !conType->getEnumTable() )
|
||||
{
|
||||
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", enumName, className);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -467,22 +429,22 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, findText, S32, 3, 3, "(string text)"
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, findText, S32, (const char * text), , "(string text)"
|
||||
"Returns the position of the first entry containing the specified text.")
|
||||
{
|
||||
return( object->findText( argv[2] ) );
|
||||
return( object->findText( text ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, size, S32, 2, 2, "Get the size of the menu - the number of entries in it.")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, size, S32, (), , "Get the size of the menu - the number of entries in it.")
|
||||
{
|
||||
return( object->getNumEntries() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, replaceText, void, 3, 3, "(bool doReplaceText)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, replaceText, void, (bool doReplaceText), , "(bool doReplaceText)")
|
||||
{
|
||||
object->replaceText(dAtoi(argv[2]));
|
||||
object->replaceText(S32(doReplaceText));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -570,9 +532,9 @@ void GuiPopUpMenuCtrl::clearEntry( S32 entry )
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrl, clearEntry, void, 3, 3, "(S32 entry)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, clearEntry, void, (S32 entry), , "(S32 entry)")
|
||||
{
|
||||
object->clearEntry(dAtoi(argv[2]));
|
||||
object->clearEntry(entry);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "gui/core/guiCanvas.h"
|
||||
#include "gui/controls/guiPopUpCtrlEx.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/core/guiDefaultControlRender.h"
|
||||
#include "gfx/primBuilder.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
|
|
@ -363,14 +364,9 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExAdd(
|
|||
"void add(string name, S32 idNum, S32 scheme=0);"
|
||||
);
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, add, void, 3, 5, "(string name, int idNum, int scheme=0)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)")
|
||||
{
|
||||
if ( argc == 4 )
|
||||
object->addEntry(argv[2],dAtoi(argv[3]));
|
||||
if ( argc == 5 )
|
||||
object->addEntry(argv[2],dAtoi(argv[3]),dAtoi(argv[4]));
|
||||
else
|
||||
object->addEntry(argv[2]);
|
||||
object->addEntry(name, idNum, scheme);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, addCategory, void, (const char* text),,
|
||||
|
|
@ -529,13 +525,10 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExsetSelected(
|
|||
"setSelected(int id, bool scriptCallback=true);"
|
||||
);
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, 3, 4, "(int id, [scriptCallback=true])"
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])"
|
||||
"@hide")
|
||||
{
|
||||
if( argc > 3 )
|
||||
object->setSelected( dAtoi( argv[2] ), dAtob( argv[3] ) );
|
||||
else
|
||||
object->setSelected( dAtoi( argv[2] ) );
|
||||
object->setSelected( id, scriptCallback );
|
||||
}
|
||||
|
||||
ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected(
|
||||
|
|
@ -546,13 +539,10 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected(
|
|||
);
|
||||
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, 2, 3, "([scriptCallback=true])"
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])"
|
||||
"@hide")
|
||||
{
|
||||
if( argc > 2 )
|
||||
object->setFirstSelected( dAtob( argv[2] ) );
|
||||
else
|
||||
object->setFirstSelected();
|
||||
object->setFirstSelected( scriptCallback );
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, setNoneSelected, void, ( S32 param),,
|
||||
|
|
@ -571,21 +561,18 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, getTextById, const char*, (S32 id),,
|
|||
}
|
||||
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, const char*, 3, 3,
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), ,
|
||||
"@brief Get color of an entry's box\n\n"
|
||||
"@param id ID number of entry to query\n\n"
|
||||
"@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255")
|
||||
{
|
||||
ColorI color;
|
||||
object->getColoredBox(color, dAtoi(argv[2]));
|
||||
object->getColoredBox(color, id);
|
||||
return color;
|
||||
|
||||
static const U32 bufSize = 512;
|
||||
char *strBuffer = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(strBuffer, bufSize, "%d %d %d %d", color.red, color.green, color.blue, color.alpha);
|
||||
return strBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * className, const char * enumName ), ,
|
||||
"@brief This fills the popup with a classrep's field enumeration type info.\n\n"
|
||||
"More of a helper function than anything. If console access to the field list is added, "
|
||||
"at least for the enumerated types, then this should go away.\n\n"
|
||||
|
|
@ -597,7 +584,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
|||
// walk the class list to get our class
|
||||
while(classRep)
|
||||
{
|
||||
if(!dStricmp(classRep->getClassName(), argv[2]))
|
||||
if(!dStricmp(classRep->getClassName(), className))
|
||||
break;
|
||||
classRep = classRep->getNextClass();
|
||||
}
|
||||
|
|
@ -605,20 +592,20 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
|||
// get it?
|
||||
if(!classRep)
|
||||
{
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", className);
|
||||
return;
|
||||
}
|
||||
|
||||
// walk the fields to check for this one (findField checks StringTableEntry ptrs...)
|
||||
U32 i;
|
||||
for(i = 0; i < classRep->mFieldList.size(); i++)
|
||||
if(!dStricmp(classRep->mFieldList[i].pFieldname, argv[3]))
|
||||
if(!dStricmp(classRep->mFieldList[i].pFieldname, enumName))
|
||||
break;
|
||||
|
||||
// found it?
|
||||
if(i == classRep->mFieldList.size())
|
||||
{
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", enumName, className);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -628,7 +615,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
|||
// check the type
|
||||
if( !conType->getEnumTable() )
|
||||
{
|
||||
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", enumName, className);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -641,16 +628,16 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, 3, 3, "(string text)"
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , "(string text)"
|
||||
"Returns the id of the first entry containing the specified text or -1 if not found."
|
||||
"@param text String value used for the query\n\n"
|
||||
"@return Numerical ID of entry containing the text.")
|
||||
{
|
||||
return( object->findText( argv[2] ) );
|
||||
return( object->findText( text ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, 2, 2,
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, (), ,
|
||||
"@brief Get the size of the menu\n\n"
|
||||
"@return Number of entries in the menu\n")
|
||||
{
|
||||
|
|
@ -658,11 +645,11 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, 2, 2,
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, 3, 3,
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), ,
|
||||
"@brief Flag that causes each new text addition to replace the current entry\n\n"
|
||||
"@param True to turn on replacing, false to disable it")
|
||||
{
|
||||
object->replaceText(dAtoi(argv[2]));
|
||||
object->replaceText(boolVal);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -750,9 +737,9 @@ void GuiPopUpMenuCtrlEx::clearEntry( S32 entry )
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( GuiPopUpMenuCtrlEx, clearEntry, void, 3, 3, "(S32 entry)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, clearEntry, void, (S32 entry), , "(S32 entry)")
|
||||
{
|
||||
object->clearEntry(dAtoi(argv[2]));
|
||||
object->clearEntry(entry);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4605,11 +4605,28 @@ void GuiTreeViewCtrl::inspectObject( SimObject* obj, bool okToEdit )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 GuiTreeViewCtrl::insertObject( S32 parent, SimObject* obj, bool okToEdit )
|
||||
{
|
||||
mFlags.set( IsEditable, okToEdit );
|
||||
mFlags.set( IsInspector );
|
||||
|
||||
//onDefineIcons_callback();
|
||||
|
||||
GuiTreeViewCtrl::Item *item = addInspectorDataItem( getItem(parent), obj );
|
||||
return item->getID();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 GuiTreeViewCtrl::findItemByName(const char *name)
|
||||
{
|
||||
for (S32 i = 0; i < mItems.size(); i++)
|
||||
{
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getText(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4619,8 +4636,12 @@ S32 GuiTreeViewCtrl::findItemByName(const char *name)
|
|||
S32 GuiTreeViewCtrl::findItemByValue(const char *name)
|
||||
{
|
||||
for (S32 i = 0; i < mItems.size(); i++)
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
{
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4767,6 +4788,10 @@ DefineEngineMethod( GuiTreeViewCtrl, insertItem, S32, ( S32 parentId, const char
|
|||
return object->insertItem( parentId, text, value, icon, normalImage, expandedImage );
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiTreeViewCtrl, insertObject, S32, ( S32 parentId, SimObject* obj, bool OKToEdit ), (false), "Inserts object as a child to the given parent." )
|
||||
{
|
||||
return object->insertObject(parentId, obj, OKToEdit);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiTreeViewCtrl, lockSelection, void, ( bool lock ), ( true ),
|
||||
|
|
@ -4831,27 +4856,24 @@ DefineEngineMethod( GuiTreeViewCtrl, addSelection, void, ( S32 id, bool isLastSe
|
|||
object->addSelection( id, isLastSelection, isLastSelection );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, addChildSelectionByValue, void, 4, 4, "addChildSelectionByValue(TreeItemId parent, value)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, addChildSelectionByValue, void, (S32 id, const char * tableEntry), , "addChildSelectionByValue(TreeItemId parent, value)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
GuiTreeViewCtrl::Item* parentItem = object->getItem(id);
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(argv[3]);
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(tableEntry);
|
||||
object->addSelection(child->getID());
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeSelection, void, 3, 3, "(deselects an item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeSelection, void, (S32 id), , "(deselects an item)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
object->removeSelection(id);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeChildSelectionByValue, void, 4, 4, "removeChildSelectionByValue(TreeItemId parent, value)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeChildSelectionByValue, void, (S32 id, const char * tableEntry), , "removeChildSelectionByValue(TreeItemId parent, value)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
GuiTreeViewCtrl::Item* parentItem = object->getItem(id);
|
||||
if(parentItem)
|
||||
{
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(argv[3]);
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(tableEntry);
|
||||
if(child)
|
||||
{
|
||||
object->removeSelection(child->getID());
|
||||
|
|
@ -4859,55 +4881,38 @@ ConsoleMethod(GuiTreeViewCtrl, removeChildSelectionByValue, void, 4, 4, "removeC
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, selectItem, bool, 3, 4, "(TreeItemId item, bool select=true)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, selectItem, bool, (S32 id, bool select), (true), "(TreeItemId item, bool select=true)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
bool select = true;
|
||||
if(argc == 4)
|
||||
select = dAtob(argv[3]);
|
||||
|
||||
return(object->setItemSelected(id, select));
|
||||
return object->setItemSelected(id, select);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, expandItem, bool, 3, 4, "(TreeItemId item, bool expand=true)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, expandItem, bool, (S32 id, bool expand), (true), "(TreeItemId item, bool expand=true)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
bool expand = true;
|
||||
if(argc == 4)
|
||||
expand = dAtob(argv[3]);
|
||||
return(object->setItemExpanded(id, expand));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, markItem, bool, 3, 4, "(TreeItemId item, bool mark=true)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, markItem, bool, (S32 id, bool mark), (true), "(TreeItemId item, bool mark=true)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
bool mark = true;
|
||||
if(argc == 4)
|
||||
mark = dAtob(argv[3]);
|
||||
return object->markItem(id, mark);
|
||||
}
|
||||
|
||||
// Make the given item visible.
|
||||
ConsoleMethod(GuiTreeViewCtrl, scrollVisible, void, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, scrollVisible, void, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
object->scrollVisible(dAtoi(argv[2]));
|
||||
object->scrollVisible(itemId);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, buildIconTable, bool, 3,3, "(builds an icon table)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, buildIconTable, bool, (const char * icons), , "(builds an icon table)")
|
||||
{
|
||||
const char * icons = argv[2];
|
||||
return object->buildIconTable(icons);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, open, void, 3, 4, "(SimSet obj, bool okToEdit=true) Set the root of the tree view to the specified object, or to the root set.")
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, open, void, (const char * objName, bool okToEdit), (true), "(SimSet obj, bool okToEdit=true) Set the root of the tree view to the specified object, or to the root set.")
|
||||
{
|
||||
SimSet *treeRoot = NULL;
|
||||
SimObject* target = Sim::findObject(argv[2]);
|
||||
SimObject* target = Sim::findObject(objName);
|
||||
|
||||
bool okToEdit = true;
|
||||
|
||||
if (argc == 4)
|
||||
okToEdit = dAtob(argv[3]);
|
||||
|
||||
if (target)
|
||||
treeRoot = dynamic_cast<SimSet*>(target);
|
||||
|
|
@ -4918,9 +4923,8 @@ ConsoleMethod( GuiTreeViewCtrl, open, void, 3, 4, "(SimSet obj, bool okToEdit=tr
|
|||
object->inspectObject(treeRoot,okToEdit);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string text ) - Set the tooltip to show for the given item." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, ( S32 id, const char * text ), , "( int id, string text ) - Set the tooltip to show for the given item." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( id );
|
||||
if( !item )
|
||||
|
|
@ -4929,12 +4933,11 @@ ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string te
|
|||
return;
|
||||
}
|
||||
|
||||
item->mTooltip = (const char*)argv[ 3 ];
|
||||
item->mTooltip = text;
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, setItemImages, void, ( S32 id, S8 normalImage, S8 expandedImage ), , "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( id );
|
||||
if( !item )
|
||||
|
|
@ -4943,13 +4946,12 @@ ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normal
|
|||
return;
|
||||
}
|
||||
|
||||
item->setNormalImage((S8)dAtoi(argv[3]));
|
||||
item->setExpandedImage((S8)dAtoi(argv[4]));
|
||||
item->setNormalImage(normalImage);
|
||||
item->setExpandedImage(expandedImage);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, isParentItem, bool, 3, 3, "( int id ) - Returns true if the given item contains child items." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, isParentItem, bool, ( S32 id ), , "( int id ) - Returns true if the given item contains child items." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
if( !id && object->getItemCount() )
|
||||
return true;
|
||||
|
||||
|
|
@ -4963,90 +4965,81 @@ ConsoleMethod( GuiTreeViewCtrl, isParentItem, bool, 3, 3, "( int id ) - Returns
|
|||
return item->isParent();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getItemText, const char *, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getItemText, const char *, (S32 index), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getItemText(dAtoi(argv[2])));
|
||||
return object->getItemText(index);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getItemValue, const char *, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getItemValue, const char *, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getItemValue(dAtoi(argv[2])));
|
||||
return object->getItemValue(itemId);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, editItem, bool, 5, 5, "(TreeItemId item, string newText, string newValue)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, editItem, bool, (S32 item, const char * newText, const char * newValue), , "(TreeItemId item, string newText, string newValue)")
|
||||
{
|
||||
return(object->editItem(dAtoi(argv[2]), argv[3], argv[4]));
|
||||
return(object->editItem(item, newText, newValue));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeItem, bool, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeItem, bool, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->removeItem(dAtoi(argv[2])));
|
||||
return(object->removeItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeAllChildren, void, 3, 3, "removeAllChildren(TreeItemId parent)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeAllChildren, void, (S32 itemId), , "removeAllChildren(TreeItemId parent)")
|
||||
{
|
||||
object->removeAllChildren(dAtoi(argv[2]));
|
||||
object->removeAllChildren(itemId);
|
||||
}
|
||||
ConsoleMethod(GuiTreeViewCtrl, clear, void, 2, 2, "() - empty tree")
|
||||
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, clear, void, (), , "() - empty tree")
|
||||
{
|
||||
object->removeItem(0);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getFirstRootItem, S32, 2, 2, "Get id for root item.")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getFirstRootItem, S32, (), , "Get id for root item.")
|
||||
{
|
||||
return(object->getFirstRootItem());
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getChild, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getChild, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getChildItem(dAtoi(argv[2])));
|
||||
return(object->getChildItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, buildVisibleTree, void, 2, 3, "Build the visible tree")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, buildVisibleTree, void, (bool forceFullUpdate), (false), "Build the visible tree")
|
||||
{
|
||||
bool forceFullUpdate = false;
|
||||
if( argc > 2 )
|
||||
forceFullUpdate = dAtob( argv[ 2 ] );
|
||||
|
||||
object->buildVisibleTree( forceFullUpdate );
|
||||
}
|
||||
|
||||
//FIXME: [rene 11/09/09 - This clashes with GuiControl.getParent(); bad thing; should be getParentItem]
|
||||
ConsoleMethod(GuiTreeViewCtrl, getParent, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getParentItem, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getParentItem(dAtoi(argv[2])));
|
||||
return(object->getParentItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getNextSibling, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getNextSibling, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getNextSiblingItem(dAtoi(argv[2])));
|
||||
return(object->getNextSiblingItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getPrevSibling, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getPrevSibling, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getPrevSiblingItem(dAtoi(argv[2])));
|
||||
return(object->getPrevSiblingItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getItemCount, S32, 2, 2, "")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getItemCount, S32, (), , "")
|
||||
{
|
||||
return(object->getItemCount());
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedItem, S32, 2, 3, "( int index=0 ) - Return the selected item at the given index.")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItem, S32, ( S32 index ), (0), "( int index=0 ) - Return the selected item at the given index.")
|
||||
{
|
||||
S32 index = 0;
|
||||
if( argc > 2 )
|
||||
index = dAtoi( argv[ 2 ] );
|
||||
|
||||
return ( object->getSelectedItem( index ) );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, 2, 3, "( int index=0 ) - Return the currently selected SimObject at the given index in inspector mode or -1")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, ( S32 index ), (0), "( int index=0 ) - Return the currently selected SimObject at the given index in inspector mode or -1")
|
||||
{
|
||||
S32 index = 0;
|
||||
if( argc > 2 )
|
||||
index = dAtoi( argv[ 2 ] );
|
||||
|
||||
GuiTreeViewCtrl::Item *item = object->getItem( object->getSelectedItem( index ) );
|
||||
if( item != NULL && item->isInspectorData() )
|
||||
{
|
||||
|
|
@ -5058,15 +5051,13 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, 2, 3, "( int index=0 ) -
|
|||
return -1;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
|
||||
"Returns a space sperated list of all selected object ids.")
|
||||
const char* GuiTreeViewCtrl::getSelectedObjectList()
|
||||
{
|
||||
static const U32 bufSize = 1024;
|
||||
char* buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff,bufSize,"");
|
||||
char* buff = Con::getReturnBuffer(1024);
|
||||
dSprintf(buff,1024,"");
|
||||
|
||||
const Vector< GuiTreeViewCtrl::Item* > selectedItems = object->getSelectedItems();
|
||||
for(S32 i = 0; i < selectedItems.size(); i++)
|
||||
const Vector< GuiTreeViewCtrl::Item* > selectedItems = this->getSelectedItems();
|
||||
for(int i = 0; i < selectedItems.size(); i++)
|
||||
{
|
||||
GuiTreeViewCtrl::Item *item = selectedItems[i];
|
||||
|
||||
|
|
@ -5078,7 +5069,7 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
|
|||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
S32 size = 1024-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
|
|
@ -5093,46 +5084,77 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
|
|||
return buff;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, moveItemUp, void, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, (), ,
|
||||
"Returns a space sperated list of all selected object ids.")
|
||||
{
|
||||
object->moveItemUp( dAtoi( argv[2] ) );
|
||||
char* buff = Con::getReturnBuffer(1024);
|
||||
dSprintf(buff,1024,"");
|
||||
|
||||
const Vector< GuiTreeViewCtrl::Item* > selectedItems = object->getSelectedItems();
|
||||
for(int i = 0; i < selectedItems.size(); i++)
|
||||
{
|
||||
GuiTreeViewCtrl::Item *item = selectedItems[i];
|
||||
|
||||
if ( item->isInspectorData() && item->getObject() )
|
||||
{
|
||||
S32 id = item->getObject()->getId();
|
||||
//get the current length of the buffer
|
||||
U32 len = dStrlen(buff);
|
||||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = 1024-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
Con::errorf("GuiTreeViewCtrl::getSelectedItemList - Not enough room to return our object list");
|
||||
return buff;
|
||||
}
|
||||
|
||||
dSprintf(buffPart,size,"%d ", id);
|
||||
}
|
||||
}
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedItemsCount, S32, 2, 2, "")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, moveItemUp, void, (S32 index), , "(TreeItemId item)")
|
||||
{
|
||||
object->moveItemUp( index );
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItemsCount, S32, (), , "")
|
||||
{
|
||||
return ( object->getSelectedItemsCount() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, moveItemDown, void, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, moveItemDown, void, (S32 index), , "(TreeItemId item)")
|
||||
{
|
||||
object->moveItemDown( dAtoi( argv[2] ) );
|
||||
object->moveItemDown( index );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getTextToRoot, const char*,4,4,"(TreeItemId item,Delimiter=none) gets the text from the current node to the root, concatenating at each branch upward, with a specified delimiter optionally")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getTextToRoot, const char*, (S32 itemId, const char * delimiter), ,
|
||||
"(TreeItemId item,Delimiter=none) gets the text from the current node to the root, concatenating at each branch upward, with a specified delimiter optionally")
|
||||
{
|
||||
if ( argc < 4 )
|
||||
if ( delimiter == "" )
|
||||
{
|
||||
Con::warnf("GuiTreeViewCtrl::getTextToRoot - Invalid number of arguments!");
|
||||
return ("");
|
||||
}
|
||||
S32 itemId = dAtoi( argv[2] );
|
||||
StringTableEntry delimiter = argv[3];
|
||||
|
||||
return object->getTextToRoot( itemId, delimiter );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, 2,2,"returns a space seperated list of mulitple item ids")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, (), ,"returns a space seperated list of mulitple item ids")
|
||||
{
|
||||
static const U32 bufSize = 1024;
|
||||
char* buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff,bufSize,"");
|
||||
char* buff = Con::getReturnBuffer(1024);
|
||||
dSprintf(buff,1024,"");
|
||||
|
||||
const Vector< S32 >& selected = object->getSelected();
|
||||
for(S32 i = 0; i < selected.size(); i++)
|
||||
for(int i = 0; i < selected.size(); i++)
|
||||
{
|
||||
S32 id = selected[i];
|
||||
//get the current length of the buffer
|
||||
|
|
@ -5140,7 +5162,7 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, 2,2,"returns a s
|
|||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
S32 size = 1024-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
|
|
@ -5167,13 +5189,13 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId)
|
|||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod(GuiTreeViewCtrl, findItemByObjectId, S32, 3, 3, "(find item by object id and returns the mId)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, findItemByObjectId, S32, ( S32 itemId ), , "(find item by object id and returns the mId)")
|
||||
{
|
||||
return(object->findItemByObjectId(dAtoi(argv[2])));
|
||||
return(object->findItemByObjectId(itemId));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -5216,30 +5238,17 @@ bool GuiTreeViewCtrl::scrollVisibleByObjectId(S32 objID)
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod(GuiTreeViewCtrl, scrollVisibleByObjectId, S32, 3, 3, "(show item by object id. returns true if sucessful.)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, scrollVisibleByObjectId, S32, ( S32 itemId ), , "(show item by object id. returns true if sucessful.)")
|
||||
{
|
||||
return(object->scrollVisibleByObjectId(dAtoi(argv[2])));
|
||||
return(object->scrollVisibleByObjectId(itemId));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//FIXME: this clashes with SimSet.sort()
|
||||
ConsoleMethod( GuiTreeViewCtrl, sort, void, 2, 6, "( int parent, bool traverseHierarchy=false, bool parentsFirst=false, bool caseSensitive=true ) - Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, sort, void, ( S32 parent, bool traverseHierarchy, bool parentsFirst, bool caseSensitive ), ( 0, false, false, true ),
|
||||
"( int parent, bool traverseHierarchy=false, bool parentsFirst=false, bool caseSensitive=true ) - Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy." )
|
||||
{
|
||||
S32 parent = 0;
|
||||
if( argc >= 3 )
|
||||
parent = dAtoi( argv[ 2 ] );
|
||||
|
||||
bool traverseHierarchy = false;
|
||||
bool parentsFirst = false;
|
||||
bool caseSensitive = true;
|
||||
|
||||
if( argc >= 4 )
|
||||
traverseHierarchy = dAtob( argv[ 3 ] );
|
||||
if( argc >= 5 )
|
||||
parentsFirst = dAtob( argv[ 4 ] );
|
||||
if( argc >= 6 )
|
||||
caseSensitive = dAtob( argv[ 5 ] );
|
||||
|
||||
if( !parent )
|
||||
object->sortTree( caseSensitive, traverseHierarchy, parentsFirst );
|
||||
|
|
@ -5326,19 +5335,18 @@ void GuiTreeViewCtrl::showItemRenameCtrl( Item* item )
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, cancelRename, void, 2, 2, "For internal use." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, cancelRename, void, (), , "For internal use." )
|
||||
{
|
||||
object->cancelRename();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, onRenameValidate, void, 2, 2, "For internal use." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, onRenameValidate, void, (), , "For internal use." )
|
||||
{
|
||||
object->onRenameValidate();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, showItemRenameCtrl, void, 3, 3, "( TreeItemId id ) - Show the rename text field for the given item (only one at a time)." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, showItemRenameCtrl, void, ( S32 id ), , "( TreeItemId id ) - Show the rename text field for the given item (only one at a time)." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( id );
|
||||
if( !item )
|
||||
{
|
||||
|
|
@ -5349,11 +5357,8 @@ ConsoleMethod( GuiTreeViewCtrl, showItemRenameCtrl, void, 3, 3, "( TreeItemId id
|
|||
object->showItemRenameCtrl( item );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, setDebug, void, 2, 3, "( bool value=true ) - Enable/disable debug output." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, setDebug, void, ( bool value ), (true), "( bool value=true ) - Enable/disable debug output." )
|
||||
{
|
||||
bool value = true;
|
||||
if( argc > 2 )
|
||||
value = dAtob( argv[ 2 ] );
|
||||
|
||||
object->setDebug( value );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,6 +454,9 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
|||
GuiTreeViewCtrl();
|
||||
virtual ~GuiTreeViewCtrl();
|
||||
|
||||
//WLE Vince, Moving this into a function so I don't have to bounce off the console. 12/05/2013
|
||||
const char* getSelectedObjectList();
|
||||
|
||||
/// Used for syncing the mSelected and mSelectedItems lists.
|
||||
void syncSelection();
|
||||
|
||||
|
|
@ -592,6 +595,7 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
|||
static void initPersistFields();
|
||||
|
||||
void inspectObject(SimObject * obj, bool okToEdit);
|
||||
S32 insertObject(S32 parentId, SimObject * obj, bool okToEdit);
|
||||
void buildVisibleTree(bool bForceFullUpdate = false);
|
||||
|
||||
void cancelRename();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue