Allow target to work with sheetName and a quiet option
HG : Enter commit message. Lines beginning with 'HG:' are removed. --HG-- branch : target_sheet
This commit is contained in:
parent
fe0210690d
commit
6bfb1fb588
4 changed files with 38 additions and 4 deletions
|
@ -63,9 +63,15 @@
|
||||||
<command name="target" action="target" params="entity=$" />
|
<command name="target" action="target" params="entity=$" />
|
||||||
<command name="tar" action="target" params="entity=$" />
|
<command name="tar" action="target" params="entity=$" />
|
||||||
|
|
||||||
|
<command name="target_quiet" action="target" params="entity=$|quiet=true" />
|
||||||
|
<command name="tarq" action="target" params="entity=$|quiet=true" />
|
||||||
|
|
||||||
<command name="target" action="target" params="entity=$|prefer_complete_match=$" />
|
<command name="target" action="target" params="entity=$|prefer_complete_match=$" />
|
||||||
<command name="tar" action="target" params="entity=$|prefer_complete_match=$" />
|
<command name="tar" action="target" params="entity=$|prefer_complete_match=$" />
|
||||||
|
|
||||||
|
<command name="target_quiet" action="target" params="entity=$|prefer_complete_match=$|quiet=true" />
|
||||||
|
<command name="tarq" action="target" params="entity=$|prefer_complete_match=$|quiet=true" />
|
||||||
|
|
||||||
<command name="target" action="no_target" params="" />
|
<command name="target" action="no_target" params="" />
|
||||||
<command name="tar" action="no_target" params="" />
|
<command name="tar" action="no_target" params="" />
|
||||||
|
|
||||||
|
|
|
@ -1949,7 +1949,26 @@ CEntityCL *CEntityManager::getEntityByCompressedIndex(TDataSetIndex compressedIn
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
//-----------------------------------------------
|
||||||
|
// getEntityBySheetName :
|
||||||
|
// Return an entity based on its sheet name
|
||||||
|
//-----------------------------------------------
|
||||||
|
CEntityCL *CEntityManager::getEntityBySheetName (const ucstring &sheet) const
|
||||||
|
{
|
||||||
|
if (!sheet.empty())
|
||||||
|
{
|
||||||
|
uint i;
|
||||||
|
const CSheetId& sheetRef = NLMISC::CSheetId(sheet.toUtf8());
|
||||||
|
const uint count = (uint)_Entities.size();
|
||||||
|
for (i=0; i<count; i++)
|
||||||
|
{
|
||||||
|
if(_Entities[i])
|
||||||
|
if(_Entities[i]->sheetId() == sheetRef)
|
||||||
|
return _Entities[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
// managePACSTriggers :
|
// managePACSTriggers :
|
||||||
// Manage PACS Triggers.
|
// Manage PACS Triggers.
|
||||||
|
|
|
@ -277,7 +277,7 @@ public:
|
||||||
* \param complete : if true, the name must match the full name of the entity.
|
* \param complete : if true, the name must match the full name of the entity.
|
||||||
*/
|
*/
|
||||||
CEntityCL *getEntityByName (const ucstring &name, bool caseSensitive, bool complete) const;
|
CEntityCL *getEntityByName (const ucstring &name, bool caseSensitive, bool complete) const;
|
||||||
|
CEntityCL *getEntityBySheetName (const ucstring &sheet) const;
|
||||||
/// Get an entity by dataset index. Returns NULL if the entity is not found.
|
/// Get an entity by dataset index. Returns NULL if the entity is not found.
|
||||||
CEntityCL *getEntityByCompressedIndex(TDataSetIndex compressedIndex) const;
|
CEntityCL *getEntityByCompressedIndex(TDataSetIndex compressedIndex) const;
|
||||||
|
|
||||||
|
|
|
@ -2418,6 +2418,7 @@ class CAHTarget : public IActionHandler
|
||||||
ucstring entityName;
|
ucstring entityName;
|
||||||
entityName.fromUtf8 (getParam (Params, "entity"));
|
entityName.fromUtf8 (getParam (Params, "entity"));
|
||||||
bool preferCompleteMatch = (getParam (Params, "prefer_complete_match") != "0");
|
bool preferCompleteMatch = (getParam (Params, "prefer_complete_match") != "0");
|
||||||
|
bool quiet = (getParam (Params, "quiet") == "true");
|
||||||
|
|
||||||
if (!entityName.empty())
|
if (!entityName.empty())
|
||||||
{
|
{
|
||||||
|
@ -2434,6 +2435,12 @@ class CAHTarget : public IActionHandler
|
||||||
entity = EntitiesMngr.getEntityByName (entityName, false, false);
|
entity = EntitiesMngr.getEntityByName (entityName, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entity == NULL)
|
||||||
|
{
|
||||||
|
//Get the entity with a sheetName
|
||||||
|
entity = EntitiesMngr.getEntityBySheetName(entityName);
|
||||||
|
}
|
||||||
|
|
||||||
if (entity)
|
if (entity)
|
||||||
{
|
{
|
||||||
CCharacterCL *character = dynamic_cast<CCharacterCL*>(entity);
|
CCharacterCL *character = dynamic_cast<CCharacterCL*>(entity);
|
||||||
|
@ -2457,7 +2464,8 @@ class CAHTarget : public IActionHandler
|
||||||
// to avoid campfire selection exploit #316
|
// to avoid campfire selection exploit #316
|
||||||
nldebug("is not prop selectable");
|
nldebug("is not prop selectable");
|
||||||
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
||||||
pIM->displaySystemInfo(CI18N::get("uiTargetErrorCmd"));
|
if(!quiet)
|
||||||
|
pIM->displaySystemInfo(CI18N::get("uiTargetErrorCmd"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2467,7 +2475,8 @@ class CAHTarget : public IActionHandler
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
||||||
pIM->displaySystemInfo(CI18N::get("uiTargetErrorCmd"));
|
if(!quiet)
|
||||||
|
pIM->displaySystemInfo(CI18N::get("uiTargetErrorCmd"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue