// // adds an Object to the Manager // bool CManager::AddObject( IObject *Object, IHashString *group) { IDTOOBJECTMAP *objMap; IHashString *objName; MAPGROUPLISTS::iterator mglIter; objName = Object->GetName(); // see if a list exists yet mglIter = m_GroupLists.find(group->GetUniqueID()); if (mglIter == m_GroupLists.end()) { // nope so allocate one objMap = new IDTOOBJECTMAP; m_GroupLists[group->GetUniqueID()] = objMap; m_ToolBox->AddMessagePumpFilter( GetComponentType()->GetUniqueID(), group->GetUniqueID() ); } else { objMap = mglIter->second; } objMap->insert(pair<DWORD, IObject *>(objName->GetUniqueID(), Object)); #if defined(_DEBUG) || defined(_PROFILE) UpdateProfiler(); #endif return true; }
CObjectComponent::CObjectComponent() { REGISTER_EDITOR_MESSAGE regEdParams; m_LastObjectID = 0; m_LastCompTypeID = 0; regEdParams.editorName = GetComponentType(); // since the hashstrings need to be around for the life of the object, we keep // the m_EditableObjects class around. m_EditableObjects.clear(); m_EditableObjects.push_back(new CHashString("CEntity")); regEdParams.objectNames = &m_EditableObjects; m_ToolBox=EngineGetToolBox(); static DWORD msgHash_RegisterEditor = CHashString(_T("RegisterEditor")).GetUniqueID(); m_ToolBox->SendMessage(msgHash_RegisterEditor, sizeof(REGISTER_EDITOR_MESSAGE), ®EdParams ); // create a grid tool render object CHashString szGridToolRenderObjectClass(_T("CObjectGridToolRenderObject")); CHashString szGridToolRenderObjectName(_T("ObjectGridToolRenderObject")); CREATEOBJECTPARAMS cop; cop.name = &szGridToolRenderObjectName; cop.parentName = NULL; cop.typeName = &szGridToolRenderObjectClass; static DWORD msgHash_CreateObject = CHashString(_T("CreateObject")).GetUniqueID(); EngineGetToolBox()->SendMessage(msgHash_CreateObject, sizeof(cop), &cop ); // init grid tool render object INITOBJECTPARAMS iop; iop.name = &szGridToolRenderObjectName; static DWORD msgHash_InitObject = CHashString(_T("InitObject")).GetUniqueID(); m_ToolBox->SendMessage(msgHash_InitObject, sizeof(INITOBJECTPARAMS), &iop); }
void CManager::UpdateProfiler( void ) { MAPGROUPLISTS *pGroupLists = GetGroupList(); if (pGroupLists) { unsigned int iObjectCount = 0; MAPGROUPLISTS::iterator itrMaps = pGroupLists->begin(); while (itrMaps != pGroupLists->end()) { IDTOOBJECTMAP *pObjectMap = itrMaps->second; iObjectCount += (unsigned int)pObjectMap->size(); // IDTOOBJECTMAP::iterator itrObjects = pObjectMap->begin(); // while (itrObjects != pObjectMap->end()) // { // } itrMaps++; } StdString szName = GetComponentType()->GetString(); CHashString hszName(szName); CHashString hszType(_T("Object Counts")); PERFORMANCEPROFILERUPDATE msg; msg.name = &hszName; msg.time = (float)iObjectCount; msg.displayType = NAME_NUMBER; msg.type = &hszType; static DWORD msgHash_UpdatePerformanceProfiler = CHashString(_T("UpdatePerformanceProfiler")).GetUniqueID(); EngineGetToolBox()->SendMessage(msgHash_UpdatePerformanceProfiler, sizeof(msg), &msg ); } }
proCompCamera::proCompCamera() : proIComponent(GetComponentType()) #include "component/inc/proCompUtilInitList.inc" #include "component/inc/proCompCamera.inc" , m_renderMask(0u) { }
bool CGUIInstance::IsKindOf(IHashString *compType) { if(CGUIElement::IsKindOf(compType)) { return true; } return (compType->GetUniqueID() == GetComponentType()->GetUniqueID()); }
bool CCoordinateToolManager::Init() { // Register editor. REGISTER_TOOL_MESSAGE regParams; m_PickableObjects.push_back(&m_pickingObjectType); regParams.toolName = GetComponentType(); regParams.objectNames = &m_PickableObjects; static DWORD msgHash_RegisterTool = CHashString(_T("RegisterTool")).GetUniqueID(); m_ToolBox->SendMessage(msgHash_RegisterTool, sizeof(REGISTER_TOOL_MESSAGE), ®Params); return CManager::Init(); }
/// \brief copy object hierarchies to clipboard /// \param names - list with state machine's object names /// \return true if objects were copied to clipboard bool CStateMachineClipboard::Copy( const list<CString> &names ) const { // we need to create memory stream for accessing XMLArchive content IEEStream *pStream = CreateMemoryStream(); if( pStream == NULL ) { return false; } bool res = false; IXMLArchive *archive = CreateXMLArchiveStream(); if( archive != NULL ) { archive->SetIsWriting( true ); // release all allocated resources archive->DeInit(); // and use our stream archive->Init( pStream ); archive->StartClass( _T("StateMachineClipboard") ); archive->Write( 1.0f, _T("version") ); archive->StartClass( _T("ParentedObjects") ); CStateMachineClipboardVisitor visitor( archive ); VISITHIERARCHYDATA vhd; vhd.visitor = &visitor; list<CString>::const_iterator itName = names.begin(); for( ; itName != names.end(); ++itName ) { CHashString hszName = *itName; static DWORD msgHash_VisitHierarchy = CHashString( _T("VisitHierarchy") ).GetUniqueID(); CHashString hszType = GetComponentType( &hszName ); m_pToolBox->SendMessage( msgHash_VisitHierarchy, sizeof( vhd ), &vhd, &hszName, &hszType ); } archive->EndClass(); archive->EndClass(); res = SetClipboardDataFromStream( pStream ); archive->Close(); } else { pStream->Close(); delete pStream; } return res; }
proCompPrePhys::proCompPrePhys() : proIComponent(GetComponentType()) #include "component/inc/proCompUtilInitList.inc" #include "component/inc/proCompPrePhys.inc" , m_pEntity(NULL) , m_impulse(Vec3fZ()) , m_linVel(Vec3fZ()) , m_rotVel(Vec3fZ()) , m_bFirstFrame(TRUE) , m_bPendingImpulse(FALSE) , m_bPendingLinVel(FALSE) , m_bPendingRotVel(FALSE) , m_bDisabledEffect(FALSE) { }
DWORD CLuaScriptVarList::OnGetSchema(DWORD size, void *in_params) { VERIFY_MESSAGE_SIZE(size, sizeof(GETSCHEMAPARAMS)); GETSCHEMAPARAMS *pParams = (GETSCHEMAPARAMS*)in_params; IXMLArchive *pArchive = pParams->ar; if (!pArchive) return MSG_ERROR; int iSchemaItemCount = 2 + m_Variables.size() * 3; pArchive->StartClass( StdString(GetComponentType()->GetString()) ); pArchive->Write( GetName()->GetString(), "Name" ); pArchive->Write( iSchemaItemCount, "Num" ); // hidden Schema Name pArchive->StartClass(_T("hidden") ); pArchive->Write( _T("string"), _T("Type") ); pArchive->EndClass(); // hidden Variable count pArchive->StartClass(_T("hidden") ); pArchive->Write( _T("int"), _T("Type") ); pArchive->EndClass(); // Variables for( unsigned int i = 0; i < m_Variables.size(); i++ ) { // hidden Variable Name string pArchive->StartClass(_T("hidden") ); pArchive->Write( _T("string"), _T("Type") ); pArchive->EndClass(); // shown Variable Value string pArchive->StartClass(_T("edit") ); pArchive->Write( _T("string"), _T("Type") ); pArchive->Write( m_Variables[i].GetName(), _T("Name") ); pArchive->Write( false, _T("Key") ); pArchive->EndClass(); // hidden Variable Default bool pArchive->StartClass(_T("hidden") ); pArchive->Write( _T("bool"), _T("Type") ); pArchive->EndClass(); } pArchive->EndClass(); return MSG_HANDLED_STOP; }
DWORD CQHStateMachineActionHandler::OnGetSchema( DWORD size, void *params ) { VERIFY_MESSAGE_SIZE(size, sizeof(GETSCHEMAPARAMS)); GETSCHEMAPARAMS *getSchemaParams = (GETSCHEMAPARAMS*)params; IXMLArchive *archive = getSchemaParams->ar; if( archive != NULL ) { archive->StartClass( GetComponentType()->GetString() ); archive->Write( m_Name.GetString(), _T("Name") ); archive->Write( 3 ); archive->StartClass(_T("hidden") ); archive->Write( _T("float"), _T("Type") ); archive->EndClass(); archive->StartClass(_T("hidden") ); archive->Write( _T("string"), _T("Type") ); archive->EndClass(); if( m_bAbstract ) { archive->StartClass( _T("static") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Action Name"), _T("Name") ); archive->EndClass(); } else { archive->StartClass( _T("edit") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Action Name"), _T("Name") ); archive->Write( false, _T("Key") ); archive->EndClass(); } } else { m_ToolBox->Log( LOGERROR, _T("Attempt to get CQHStateMachineEvent schema. No archive specified.\n" ) ); } return MSG_HANDLED_STOP; }
/// report clipboard content availability. This function checks whole clipboard /// content. It may return false if some objects cannot be pasted. i.e. events /// cannot be pasted as children of state machine object /// \param pParentName - name of object to paste /// \return true if whole clipboard content cannot be pasted for passed parent bool CStateMachineClipboard::CanPastePartially( IHashString *pParentName ) const { ASSERT( pParentName != NULL ); if( !CanPaste() ) { return false; } static const DWORD hash_CQHState = CHashString( _T("CQHState") ).GetUniqueID(); if( hash_CQHState != GetComponentType( pParentName ).GetUniqueID() ) { IXMLArchive *pArchive = GetClipboardDataArchive(); ASSERT( pArchive != NULL ); CStateMachineClipboardPreprocessor preprocessor; VERIFY( preprocessor.Prepare( pParentName, pArchive ) ); pArchive->Close(); return preprocessor.HasTopLevelEvents(); } return false; }
CPerformanceProfilerHandler::~CPerformanceProfilerHandler() { EngineGetToolBox()->UnRegisterComponent( GetComponentType() ); }
MkFloat2 MkWindowThemedNode::CalculateWindowSize(void) const { return ConvertClientToWindowSize(GetThemeName(), GetComponentType(), GetCustomForm(), GetClientSize()); }
virtual bool IsKindOf(IHashString *compType) { return (compType->GetUniqueID() == GetComponentType()->GetUniqueID()); }
DWORD CQHState::OnGetSchema( DWORD size, void *params ) { VERIFY_MESSAGE_SIZE(size, sizeof(GETSCHEMAPARAMS)); GETSCHEMAPARAMS *getSchemaParams = (GETSCHEMAPARAMS*)params; IXMLArchive *archive = getSchemaParams->ar; if( archive != NULL ) { archive->StartClass( GetComponentType()->GetString() ); archive->Write( m_Name.GetString(), _T("Name") ); archive->Write( 5 ); archive->StartClass(_T("hidden") ); archive->Write( _T("float"), _T("Type") ); archive->EndClass(); if( m_bAbstract ) { archive->StartClass( _T("static") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("State Name"), _T("Name") ); archive->EndClass(); archive->StartClass( _T("static") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Entry Event"), _T("Name") ); archive->EndClass(); archive->StartClass( _T("static") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Update Event"), _T("Name") ); archive->EndClass(); archive->StartClass( _T("static") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Exit Event"), _T("Name") ); archive->EndClass(); } else { TCHAR szComboNum[] = _T("ComboItem_XXXX"); LPTSTR szNum = szComboNum + sizeof(szComboNum) / sizeof(*szComboNum) - 4; archive->StartClass( _T("edit") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("State Name"), _T("Name") ); archive->Write( false, _T("Key") ); archive->EndClass(); archive->StartClass( _T("combo") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Entry Event"), _T("Name") ); archive->Write( false, _T("Key") ); archive->Write( _T(""), _T("DefSelect") ); OBJECTLIST eventList; GenerateAvailableEventsList( &eventList ); int eventListCount = eventList.size() + 1; OBJECTLIST::iterator eventListIterator = eventList.begin(); archive->Write( eventListCount, _T("Count") ); int comboItemCounter = 0; _ltot( ++comboItemCounter, szNum, 10 ); archive->Write( _T(""), szComboNum ); for(; eventListIterator != eventList.end(); eventListIterator++ ) { _ltot( ++comboItemCounter, szNum, 10 ); CQHStateMachineEvent *iteratedEvent = (CQHStateMachineEvent*)(*eventListIterator); archive->Write( iteratedEvent->GetEventName()->GetString(), szComboNum ); } archive->EndClass(); archive->StartClass( _T("combo") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Update Event"), _T("Name") ); archive->Write( false, _T("Key") ); archive->Write( _T(""), _T("DefSelect") ); eventListIterator = eventList.begin(); archive->Write( eventListCount, _T("Count") ); comboItemCounter = 0; _ltot( ++comboItemCounter, szNum, 10 ); archive->Write( _T(""), szComboNum ); for(; eventListIterator != eventList.end(); eventListIterator++ ) { _ltot( ++comboItemCounter, szNum, 10 ); CQHStateMachineEvent *iteratedEvent = (CQHStateMachineEvent*)(*eventListIterator); archive->Write( iteratedEvent->GetEventName()->GetString(), szComboNum ); } archive->EndClass(); archive->StartClass( _T("combo") ); archive->Write( _T("string"), _T("Type") ); archive->Write( _T("Exit Event"), _T("Name") ); archive->Write( false, _T("Key") ); archive->Write( _T(""), _T("DefSelect") ); eventListIterator = eventList.begin(); archive->Write( eventListCount, _T("Count") ); comboItemCounter = 0; _ltot( ++comboItemCounter, szNum, 10 ); archive->Write( _T(""), szComboNum ); for(; eventListIterator != eventList.end(); eventListIterator++ ) { _ltot( ++comboItemCounter, szNum, 10 ); CQHStateMachineEvent *iteratedEvent = (CQHStateMachineEvent*)(*eventListIterator); archive->Write( iteratedEvent->GetEventName()->GetString(), szComboNum ); } archive->EndClass(); } archive->EndClass(); } else { m_ToolBox->Log( LOGERROR, _T("Attempt to get CQHState schema. No archive specified.\n" ) ); } return MSG_HANDLED_STOP; }
bool CLuaStateHandler::IsKindOf(IHashString *compType) { return ( compType->GetUniqueID() == GetComponentType()->GetUniqueID() ); }
bool CCoordinateToolPhysicsObject::IsKindOf( IHashString *componentType ) { return CPickingPhysicsObject::IsKindOf( componentType ) || ( componentType->GetUniqueID() == GetComponentType()->GetUniqueID() ); }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_CREATE: { RECT rc; GetWindowRect(hWnd, &rc); hwndList = CreateWindow(TEXT("listbox"), NULL, WS_CHILD | WS_VISIBLE, 0, 0, rc.right-rc.left, rc.bottom-rc.top, hWnd, (HMENU)1, hInst, NULL); break; } case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: { //DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); SendMessage(hwndList, LB_RESETCONTENT, 0, 0); int numDevs = mixerGetNumDevs(); if (numDevs == 0) { MessageBox(hWnd, TEXT("No audio mixer devices found."), NULL, MB_OK); break; } #define MSG_LEN 1024 TCHAR msg[MSG_LEN+1]; TCHAR lpszComponent[MSG_LEN]; UINT nDevId = 0, uDest, uConnect, uConnections; MIXERCAPS mxcaps; MMRESULT rc; HMIXER hmx = NULL; for (int i=0; i<numDevs; i++) { mixerGetDevCaps(i, &mxcaps, sizeof(MIXERCAPS)); wsprintf(msg, TEXT("Device name: %s\t#Destinations: %ld"), mxcaps.szPname, mxcaps.cDestinations); SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)msg); rc = mixerOpen(&hmx, i, (DWORD_PTR)hWnd, NULL, CALLBACK_WINDOW | MIXER_OBJECTF_MIXER); if (rc != MMSYSERR_NOERROR) { MessageBox(hWnd, TEXT("Error opening mixer deivce"), NULL, MB_OK); mixerClose(hmx); continue; } lstrcpy(msg, TEXT("Type\tComponent\tName\tLine ID\tFlags\tCtls\tConnections")); SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)msg); MIXERLINE mxl; for (uDest = 0; uDest < mxcaps.cDestinations; uDest++) { mxl.cbStruct = sizeof(mxl); mxl.dwDestination = uDest; rc = mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_DESTINATION); if (rc != MMSYSERR_NOERROR) { wsprintf(msg, TEXT("mixerGetLineInfo(dst=%u) failed. rc=%u!"), uDest, rc); MessageBox(hWnd, msg, NULL, MB_OK); continue; } GetComponentType(&mxl, lpszComponent); wsprintf(msg, TEXT("%s\t%-25s\t%-25s\t%.08lXh\t%.08lXh\t%lu\t%lu"), (MIXERLINE_LINEF_ACTIVE & mxl.fdwLine) ? TEXT("Dest Active") : TEXT("Dest Inactive"), lpszComponent, mxl.szName, mxl.dwLineID, mxl.fdwLine, mxl.cControls, mxl.cConnections); SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)msg); uConnections = mxl.cConnections; for (uConnect = 0; uConnect < uConnections; uConnect++) { mxl.cbStruct = sizeof(mxl); mxl.dwDestination = uDest; mxl.dwSource = uConnect; rc = mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_SOURCE); if (rc != MMSYSERR_NOERROR) { wsprintf(msg, TEXT("mixerGetLineInfo(src=%u) failed. rc=%u!"), uConnect, rc); MessageBox(hWnd, msg, NULL, MB_OK); continue; } GetComponentType(&mxl, lpszComponent); wsprintf(msg, TEXT("%s\t%-25s\t%-25s\t%.08lXh\t%.08lXh\t%lu\t%lu"), (MIXERLINE_LINEF_ACTIVE & mxl.fdwLine) ? TEXT("Src Active") : TEXT("Src Inactive"), lpszComponent, mxl.szName, mxl.dwLineID, mxl.fdwLine, mxl.cControls, mxl.cConnections); SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)msg); } SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)TEXT("")); } } break; } case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
bool CGUIStatusBar::IsKindOf(IHashString *compType) { return (compType->GetUniqueID() == GetComponentType()->GetUniqueID()); }
bool CObjectComponent::IsKindOf(IHashString *compType) { return (compType->GetUniqueID() == GetComponentType()->GetUniqueID()); }
void MkBodyFrameControlNode::_ApplyHangingType(void) { bool pivotIsWindowRect = false; bool targetIsWindowRect = true; eRectAlignmentPosition alignPos = eRAP_NonePosition; if (m_HangingType != eHT_None) { switch (m_HangingType) { case eHT_OverParentWindow: pivotIsWindowRect = true; alignPos = eRAP_LeftOver; break; case eHT_UnderParentWindow: pivotIsWindowRect = true; alignPos = eRAP_LeftUnder; break; case eHT_IncludeParentAtTop: case eHT_IncludeParentAtBottom: { const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(GetThemeName(), GetComponentType(), GetCustomForm()); if (formData != NULL) { switch (m_HangingType) { case eHT_IncludeParentAtTop: pivotIsWindowRect = true; targetIsWindowRect = false; alignPos = eRAP_LeftTop; break; case eHT_IncludeParentAtBottom: pivotIsWindowRect = true; targetIsWindowRect = false; alignPos = eRAP_LeftBottom; break; } } } break; } } SetAlignmentPivotIsWindowRect(pivotIsWindowRect); SetAlignmentTargetIsWindowRect(targetIsWindowRect); SetAlignmentPosition(alignPos); }
void MkBodyFrameControlNode::SetClientSize(const MkFloat2& clientSize) { MkWindowBaseNode::SetClientSize(clientSize); if ((m_ParentNodePtr != NULL) && (m_ParentNodePtr->IsDerivedFrom(ePA_SNT_TitleBarControlNode))) { MkTitleBarControlNode* parentNode = dynamic_cast<MkTitleBarControlNode*>(m_ParentNodePtr); if (parentNode != NULL) { // 부모의 크기(length)를 변경 float sizeOffset = 0.f; if ((m_HangingType == eHT_IncludeParentAtTop) || (m_HangingType == eHT_IncludeParentAtBottom)) { const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(GetThemeName(), GetComponentType(), GetCustomForm()); if (formData != NULL) { sizeOffset += formData->GetLeftMargin(); sizeOffset += formData->GetRightMargin(); } } float frameSize = MK_STATIC_RES.GetWindowThemeSet().GetFrameSize(parentNode->GetThemeName(), parentNode->GetFrameType()); float titleLength = GetMax<float>(m_ClientRect.size.x - sizeOffset, 0.f); parentNode->SetClientSize(MkFloat2(titleLength, frameSize)); } } }
bool CSoundLoader::IsKindOf(IHashString *compType) { return (compType->GetUniqueID() == GetComponentType()->GetUniqueID()); }
/// \brief Checks if this is similar to it's base class's component /// \param compType - the type to compare this against /// \return true if it is simlar, else false bool CEditorManager::IsKindOf(IHashString *compType) { return (compType->GetUniqueID() == GetComponentType()->GetUniqueID()); }