////////////////////////////////////////////////////////////////////////////////////////////////////

#ifdef ACTIVE_EDITOR

#include "stdafx.h"
// ALX
#include "ACP_Base.h"
#define HieFriend
#include "incGam.h"
#include "Itf.h"

#include "T3DFRMBs.hpp"
#include "T3DInterf.hpp"

#define M_PosMenuOption     4

/////////////////////////////////////////////////////////////////////////////
// Tool3D_FRMBaseMenu

IMPLEMENT_DYNCREATE(Tool3D_FRMBaseMenu, FRMBaseMenu)

BEGIN_MESSAGE_MAP(Tool3D_FRMBaseMenu, FRMBaseMenu)
//{{AFX_MSG_MAP(Tool3D_FRMBaseMenu)
		ON_WM_INITMENUPOPUP()
    ON_WM_SYSCOMMAND()
    ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Tool3D_FRMBaseMenu construction/destruction

Tool3D_FRMBaseMenu::Tool3D_FRMBaseMenu()
{
    //statement
    m_p_oTool3D = NULL;
}

Tool3D_FRMBaseMenu::~Tool3D_FRMBaseMenu()
{
    //statement
}

/////////////////////////////////////////////////////////////////////////////
// Tool3D_FRMBaseMenu Message

////
void Tool3D_FRMBaseMenu::OnSysCommand( UINT nID, LPARAM lParam )
{
    switch (nID)
    {
        case SC_CLOSE:
        case SC_MINIMIZE:
            M_GetMainWnd()->SendMessage(WM_SYSCOMMAND,(WORD)nID,MAKELPARAM(0,-1));            
            break;
        default:
            FRMBaseMenu::OnSysCommand(nID, lParam);
    }
}

////
void Tool3D_FRMBaseMenu::OnSize( UINT nType, int cx, int cy )
{
    FRMBaseMenu::OnSize(nType,cx,cy);
}

void Tool3D_FRMBaseMenu::fn_vInitGeneralMenuWithContext(void)
{
    FRMBaseMenu::fn_vInitGeneralMenuWithContext();

    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_DISPLAYWORLD, MF_BYCOMMAND|MF_GRAYED);
    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_DISPLAYVISIBLE, MF_BYCOMMAND|MF_GRAYED);
    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_DISPLAYSECTOR, MF_BYCOMMAND|MF_GRAYED);

    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_VIEWBOUND, MF_BYCOMMAND|MF_GRAYED);
    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_WORLDTEXTURED, MF_BYCOMMAND|MF_GRAYED);
    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_WORLDGRID, MF_BYCOMMAND|MF_GRAYED);
    m_oGeneralMenu.GetSubMenu(M_PosMenuOption)->EnableMenuItem(CPA_IDCB_WORLDWIRED, MF_BYCOMMAND|MF_GRAYED);
}

void Tool3D_FRMBaseMenu::mfn_vUpdateDeviceToolBar(void)
{
    //FRMBaseMenu::mfn_vUpdateDeviceToolBar();
    //m_oGeneralDialogBar.m_oDeviceToolbar.ShowWindow( SW_HIDE );
    m_oGeneralDialogBar.m_oDisplayToolbar.ShowWindow( SW_HIDE );
    m_oGeneralDialogBar.GetDlgItem(CPA_IDCB_CURRENTSECTOR) -> EnableWindow( FALSE );
    m_oGeneralDialogBar.GetDlgItem(CPA_IDCB_SELECTMODE) -> EnableWindow( FALSE );
}

void Tool3D_FRMBaseMenu::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
	FRMBaseMenu::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu) ;

	// grayed Reinit the map !!
	if ( nIndex == 0 )
		pPopupMenu->EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED ) ;
	// grayed the other
	m_p_oToolSubMenu->fn_cGrayedItem (pPopupMenu, "Recompute all bounding volumes" ) ;
	m_p_o3DViewSubMenu->fn_cGrayedItem (pPopupMenu, "Display" ) ;
	m_p_o3DViewSubMenu->fn_cGrayedItem (pPopupMenu, "Bounding Volume" ) ;
	m_p_o3DViewSubMenu->fn_cGrayedItem (pPopupMenu, "Axis" ) ;
}

#endif //ACTIVE_EDITOR