/*========================================================================= * * EDTpopm.cpp : popup menu * * * Version 1.1 * Creation date * Revision date 06/03/97 MT * * FBF *=======================================================================*/ #include "stdafx.h" #ifdef ACTIVE_EDITOR #include "ACP_Base.h" #include "geo.h" #include "gli.h" #include "col.h" #define HieFriend #include "spo.h" #include "lst.hpp" #include "IncTUT.h" #include "itf/CPApopm.hpp" #include "itf/CPADLLb.hpp" //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- //-------------------------ENTRY MENU CODE------------------------------------------- //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Description : constructor // ---------------------------------------------------------------------------- EDT_PopUpMenuEntry::EDT_PopUpMenuEntry(CPA_EditorBase *p_oOwner, char *p_cText, UINT uiMsgID, UINT uiIntID, BOOL _bCheck /*=FALSE*/, BOOL _bEnable /*=TRUE*/) :EDT_SubMenuEntry (p_oOwner, p_cText, uiMsgID, uiIntID, _bCheck , _bEnable) { } // ---------------------------------------------------------------------------- // Description : call handle function // ---------------------------------------------------------------------------- UINT EDT_PopUpMenuEntry::SendCommand(EDT_SubMenu *_p_oSubMenu) { if (m_pOwner) m_pOwner->_OnPopUpMenuCommand(m_IDCmdMsg); return NULL; } //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- //-------------------------POPUP MENU CODE------------------------------------------- //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Description : constructor // ---------------------------------------------------------------------------- EDT_PopUpMenu::EDT_PopUpMenu(UINT _uiIDStart /*=C_EDTPopUpMenuIDStart*/) :EDT_SubMenu(C_PopupMenu,_uiIDStart) { } // ---------------------------------------------------------------------------- // Description : construct the PopupMenu // ---------------------------------------------------------------------------- void EDT_PopUpMenu::Build(CMenu *_p_oMenu) { if( !m_bHasFather ) { m_oMenu . CreatePopupMenu(); EDT_SubMenu::Build(&m_oMenu); } else { ASSERT( _p_oMenu ); EDT_SubMenu::Build(_p_oMenu); } } // ---------------------------------------------------------------------------- // Description : display the PopupMenu // ---------------------------------------------------------------------------- void EDT_PopUpMenu::Draw(DEV_ViewPort *_p_oViewPort,tdstMousePos *p_stCoords) { BOOL bWasInSecondScreen = FALSE; // register the popup menu for the tutorial module TUT_M_vGetTutDll (); TUT_M_vRegisterMenu (_p_oViewPort -> m_hWnd , m_oMenu . m_hMenu , p_stCoords->stPos.x , p_stCoords->stPos.y); // Shaitan - For second screen mode if (M_bFullScreenEditor() && _p_oViewPort->GetDevice()->IsFullScreen() && !((DEV_ViewPort3D *)_p_oViewPort)->IsCursorInFirstScreen ()) { bWasInSecondScreen = TRUE; //disable the confine of the cursor SetCursorPos (p_stCoords->stPos.x, p_stCoords->stPos.y); ShowCursor (TRUE); ReleaseCapture (); ClipCursor (NULL); ((DEV_ViewPort3D *)_p_oViewPort)->SetCursorInFirstScreen (); } m_oMenu . TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, p_stCoords->stPos.x, p_stCoords->stPos.y, _p_oViewPort); m_oMenu . DestroyMenu(); if (bWasInSecondScreen) { ShowCursor (FALSE); _p_oViewPort->SetCapture (); SetCursorPos (p_stCoords->stPos.x, p_stCoords->stPos.y); ((DEV_ViewPort3D *)_p_oViewPort)->SetCursorInSecondScreen (); } } // ---------------------------------------------------------------------------- // Description : get a new SubMenu (must uses it as sub menu of 'this') // ---------------------------------------------------------------------------- EDT_SubMenu *EDT_PopUpMenu::fn_p_oGetNewSubMenu(char *_szName, tde_SubMenu _eMenuType /*=C_SubSubMenu*/) { ASSERT( _szName ); EDT_PopUpMenu *p_oResult = new EDT_PopUpMenu( _eMenuType == C_SubSubMenu ? GetSubMenuType() : _eMenuType ); p_oResult -> fn_vSetName( _szName ); p_oResult -> fn_vSetFather( this ); return p_oResult; } // ---------------------------------------------------------------------------- // Description : add an entry from DLL // ---------------------------------------------------------------------------- void EDT_PopUpMenu::AddAnEntry(CPA_EditorBase *p_oOwner, char *p_cText, UINT uiEntryID, BOOL _bCheck /*=FALSE*/, BOOL _bEnable /*=TRUE*/) { AddTail(new EDT_PopUpMenuEntry(p_oOwner, p_cText, uiEntryID, mfn_vGetNextInternalID(), _bCheck, _bEnable)); } #endif