//////////////////////////////////////////////////////////////////////////////
//
//  Copyright 2025 Autodesk, Inc.  All rights reserved.
//
//  Use of this software is subject to the terms of the Autodesk license 
//  agreement provided at the time of installation or download, or which 
//  otherwise accompanies this software in either electronic or hard copy form.   
//
//////////////////////////////////////////////////////////////////////////////
//*-*REV 06.08.99 Lippold: extended AmdtWatcher::printId printout
#include "stdafx.h"
#include "acm.h"
#include "acmdef.h"
#include "bommgr.h"
#include "bomReactor.h"
#include "watcher.h"

void AmdtWatcher::printId( LPCTSTR label, const AcDbObjectId& id) const
{
  acutPrintf(_T("%s"),label);
  acutPrintf(_T("0x%X"),id.asOldId());
  if (id.isNull())
     return;
    // printout handle - more useful than id...
  AcDbHandle handle = id.handle();
  TCHAR buf[64];
  handle.getIntoAsciiBuffer(buf);
  acutPrintf(_T("(%s)"),buf);
    // the class name wouldn't be bad also...
  AcDbObject* pObj;
  if (Acad::eOk == acdbOpenObject(pObj,id,AcDb::kForRead)) {
    acutPrintf(_T(":%s"),pObj->isA()->dxfName());
    pObj->close();
  }
}

void AmdtWatcher::onNewBOMTable(const AcDbObjectId &newTableId, const AcDbObjectId &compId) 
{
  printId(_T("\nNew BOM table "),newTableId);
  printId(_T(" of component "),compId);
}

void AmdtWatcher::onRenameBOMTable(const AcDbObjectId &tableId, const LPCTSTR newName) 
{
  printId(_T("\nRename BOM table "),tableId);
  acutPrintf(_T(" to '%s'"),newName);
}

void AmdtWatcher::onEraseBOMTable(const AcDbObjectId &tableId, const AcDbObjectId &compId) 
{
  printId(_T("\nErase BOM table "),tableId);
  printId(_T(" of component "),compId);
}

void AmdtWatcher::onNewPartList(const AcDbObjectId &partList, const AcDbObjectId &bomId) 
{
  printId(_T("\nNew partlist "),partList);
  printId(_T(" of BOm table "),bomId);
}

void AmdtWatcher::onRenamePartList(const AcDbObjectId &partListId,const LPCTSTR &newname) 
{
  printId(_T("\nRename parts list "),partListId);
  acutPrintf(_T(" to '%s'"),newname);
}

void AmdtWatcher::onErasePartList(const AcDbObjectId &partListId, const AcDbObjectId &bomId) 
{
  printId(_T("\nErase partslist "),partListId);
  printId(_T(" of BOM Table "),bomId);
}

void AmdtWatcher::aboutToUpdatePartList(const AcDbObjectId& partListId) 
{
  printId(_T("\nAbout to update partslist "),partListId);
}

void AmdtWatcher::entryCreated(const AcDbObjectId& entryId) 
{
  printId(_T("\nEntry created "),entryId);
}

void AmdtWatcher::entryModified(const AcDbObjectId& entryid) 
{
  printId(_T("\nEntry modified "),entryid);
}

void AmdtWatcher::aboutToModifyEntry(const AcDbObjectId& entryId,LPCTSTR tag,LPCTSTR value) 
{
  printId(_T("\nAbout to modify entry "),entryId);
  acutPrintf(_T(", set '%s' to new value '%s'"),tag,value);
}

void AmdtWatcher::entryEdit(const AcDbObjectId& entryId,CMapStringToString& dataMapList) 
{
  printId(_T("\nEdit entry "),entryId);
}


void AmdtWatcher::itemCreated(const AcDbObjectId& itemId) 
{
  printId(_T("\nItem created "),itemId);
}

void AmdtWatcher::itemModified(const AcDbObjectId& itemId) 
{
  printId(_T("\nItem modified "),itemId);
}

void AmdtWatcher::aboutToModifyItem(const AcDbObjectId& itemId,LPCTSTR tag,LPCTSTR value) 
{  
  printId(_T("\nAbout to modify item "),itemId);
  acutPrintf(_T(", set '%s' to new value '%s'"),tag,value);
}

void AmdtWatcher::onPartDlgStarted(const AcDbObjectId& entryId) 
{
  printId(_T("\nAMPARTREFEDIT dialog started for entry "),entryId);
}

void AmdtWatcher::onPartDlgCanceled(const AcDbObjectId& entryId) 
{  
  printId(_T("\nAMPARTREFEDIT dialog canceled for entry "),entryId);
}

void AmdtWatcher::onPartDlgFinished(const AcDbObjectId& entryId) 
{
  printId(_T("\nAMPARTREFEDIT dialog finished for entry "),entryId);
}

void AmdtWatcher::onBomDlgStarted(const AcDbObjectId& bomId) 
{  
  printId(_T("\nAMBOM dialog started for BOM table "),bomId);
}

void AmdtWatcher::onBomDlgCanceled(const AcDbObjectId& bomId) 
{  
  printId(_T("\nAMBOM dialog canceled for BOM table "),bomId);
}

void AmdtWatcher::onBomDlgFinished(const AcDbObjectId& bomId) 
{  
  printId(_T("\nAMBOM dialog finished for BOM table "),bomId);
}

void AmdtWatcher::onBomDlgBomIdChanged(const AcDbObjectId& newBomId) 
{
  printId(_T("\nAMBOM dialog chnaged to another BOM table "),newBomId);
}

void AmdtWatcher::onPartListDlgStarted(const AcDbObjectId& partListId) 
{
  printId(_T("\nAMEDIT dialog started for partlist "),partListId);
}

void AmdtWatcher::onPartListDlgCanceled(const AcDbObjectId& partListId) 
{ 
  printId(_T("\nAMEDIT dialog canceled for partlist "),partListId);
}

void AmdtWatcher::onPartListDlgFinished(const AcDbObjectId& partListId) 
{
  printId(_T("\nAMEDIT dialog finished for partlist "),partListId);
}

void AmdtWatcher::onBalloonDlgStarted(const AcDbObjectId& balloonId) 
{
  printId(_T("\nAMEDIT dialog started for balloon "),balloonId);
}

void AmdtWatcher::onBalloonDlgCanceled(const AcDbObjectId& balloonId) 
{
  printId(_T("\nAMEDIT dialog canceled for balloon "),balloonId);
}

void AmdtWatcher::onBalloonDlgFinished(const AcDbObjectId& balloonId) 
{
  printId(_T("\nAMEDIT dialog finished for balloon "),balloonId);
}

