Example #1
0
  /// Called from Message() for MSG_EDIT (when a user double-clicks
  /// the object icon). Toggles the protection state of the container.
  void ToggleProtect(BaseObject* op)
  {
    BaseDocument* doc = op->GetDocument();
    if (doc)
    {
      doc->StartUndo();
      doc->AddUndo(UNDOTYPE_CHANGE_SMALL, op);
      doc->EndUndo();
    }

    BaseContainer const* bc = op->GetDataInstance();
    if (!bc) return;

    if (!m_protected)
    {
      String password;
      if (!PasswordDialog(&password, false, true)) return;
      String hashed = HashString(password);
      m_protected = true;
      m_protectionHash = hashed;

      HideNodes(op, doc, true);
    }
    else
    {
      String password;
      Bool unlock = false;
      String emptyPassHash = HashString("");
      if (m_protectionHash == emptyPassHash)
      {
        unlock = true;
      }
      else if (PasswordDialog(&password, true, true))
      {
        unlock = (m_protectionHash == HashString(password));
        if (!unlock)
          MessageDialog(GeLoadString(IDS_PASSWORD_INVALID));
      }
      if (unlock)
      {
        m_protected = false;
        HideNodes(op, doc, false);
      }
    }

    op->Message(MSG_CHANGE);
    op->SetDirty(DIRTYFLAGS_DESCRIPTION);
    EventAdd();
  }
Example #2
0
//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAINodeMgr::UpdateDebugRendering()
//              
//	PURPOSE:	Draw or hide nodes.
//              
//----------------------------------------------------------------------------
void CAINodeMgr::UpdateDebugRendering(LTFLOAT fVarTrack)
{
	if( m_fDrawingNodes != fVarTrack )
	{
		EnumAINodeType eNodeType = (EnumAINodeType)( (uint32)m_fDrawingNodes );
		HideNodes( eNodeType );
		eNodeType = (EnumAINodeType)( (uint32)fVarTrack );
		DrawNodes( eNodeType );
		m_fDrawingNodes = fVarTrack;
	}
}