
//**************************************************************************/
// Copyright (c) 2008 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.
//
//**************************************************************************/
// DESCRIPTION:
// CREATED: December 2008
//**************************************************************************/

#include "MenuMessenger.h"

// This macro provides some information about the plugin to Mudbox. It also
// specifies a function that will be called after all the plug-ins are loaded
MB_PLUGIN( "MenuMessenger", "Sample plugin adds menu items", "Autodesk", "http://www.mudbox3d.com", MenuMessenger::Initializer );


void MenuMessenger::Initializer()
// This is called after the plug-ins are all loaded.
//
// Add a series of menu items, sub-menus, and menus to the Mudbox interface.
// Each item should show a different message.
{
	// Add two menu items and a sub-menu with three items to the Edit menu
	Kernel()->AddCallbackMenuItem("Edit","","Menu Messenger #1",MenuMessenger::ShowMessage1);
	Kernel()->AddCallbackMenuItem("Edit","Messenger Sub-Menu","Menu Messenger #2",MenuMessenger::ShowMessage2);
	Kernel()->AddCallbackMenuItem("Edit","Messenger Sub-Menu","Menu Messenger #3",MenuMessenger::ShowMessage3);
	Kernel()->AddCallbackMenuItem("Edit","Messenger Sub-Menu","Menu Messenger #4",MenuMessenger::ShowMessage4);
	Kernel()->AddCallbackMenuItem("Edit","","Menu Messenger #5",MenuMessenger::ShowMessage5);

	// Create a new menu named Plug-ins and add menu items to it.
	Kernel()->AddCallbackMenuItem("Plug-ins","","Menu Messenger #6",MenuMessenger::ShowMessage6);
	Kernel()->AddCallbackMenuItem("Plug-ins","","Show Message that Stays Up",MenuMessenger::ShowMessage7);
	Kernel()->AddCallbackMenuItem("Plug-ins","","Clear Messages",MenuMessenger::ShowMessage8);
}

void MenuMessenger::ShowMessage1(){
	// Display a basic message on the HUD
	Kernel()->HUDMessageShow("Menu Message #1", Kernel::HUDmsgFade );
}

void MenuMessenger::ShowMessage2(){
	// Display some useful information
	QString message(QString("You are running Mudbox from this folder:<p>%1").arg( Kernel()->ApplicationDirectory()));
	Kernel()->HUDMessageShow( message, Kernel::HUDmsgFade );
}

void MenuMessenger::ShowMessage3(){
	Kernel()->HUDMessageShow("Menu Message #3", Kernel::HUDmsgFade );
}

void MenuMessenger::ShowMessage4(){
	Kernel()->HUDMessageShow("Menu Message #4 demonstrates <b>bold</b> text", Kernel::HUDmsgFade );
}

void MenuMessenger::ShowMessage5(){
	Kernel()->HUDMessageShow("Menu Message #5 demonstrates <i>italic</i>text", Kernel::HUDmsgFade );
}

void MenuMessenger::ShowMessage6(){
	Kernel()->HUDMessageShow("Menu Message #6", Kernel::HUDmsgFade );
}

void MenuMessenger::ShowMessage7(){
	// using "HUDmsgPin" leaves the message on the screen until it is cleared or overwritten
	// by another message
	Kernel()->HUDMessageShow("This message stays up", Kernel::HUDmsgPin );
}

void MenuMessenger::ShowMessage8(){
	// This call clears a pinned message
	Kernel()->HUDMessageHide();
}

