#include "MAXProxyHeaders.hpp"

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MAXCleanHierarchyProcess::MAXCleanHierarchyProcess(Stuff::NotationFile *data_file, 
												   Interface *i, 
												   int p, 
												   bool bSuppress,
												   LPVOID fcn
												   ):
	CleanHierarchyProcess(data_file,bSuppress,fcn),
	iPointer(i),
	progress(p)
{
	Check_Object(data_file);

	Page *page = data_file->FindPage("CleanHierarchy");
	if (page) {
		page->GetEntry("Verbose", &suppress);
		suppress = !suppress;
	}
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
	MAXCleanHierarchyProcess::CleanHierarchyCallback(Proxies::GenericProxy *proxy)
{
	Check_Object(this);
	Check_Object(proxy);

	//
	//----------------------------
	// Print the name of the proxy
	//----------------------------
	//
	if (!suppress)
	{
		MString name;
		char buffer[200];
		if (proxy->GetName(&name))
			sprintf(buffer, "Cleaning %s...", static_cast<char*>(name));
		else
			sprintf(
				buffer,
				"Cleaning <%s>...",
				static_cast<const char*>(proxy->GetClassString())
			);
		iPointer->ProgressUpdate(++progress,false,_T(buffer));
	}
}
