SeqId AnimationGroup::GetNext() { AnimationGroup::AnimationGroupItem* pkItem = PickAnim(); if( !pkItem ) return INVALID_SEQ_ID; m_lastAnim = pkItem; return pkItem->m_id; }
void AppDataTest::PutAppData() { Animatable *anim = PickAnim(); if (!anim) return; // XRef stuff 020416 --prs. if (s_through_xref) { RefTargetHandle rth = (RefTargetHandle)anim; IXRefItem* xi = NULL; while (rth != NULL && (xi = IXRefItem::GetInterface(*rth)) != NULL) rth = xi->GetSrcItem(); if (rth != NULL) anim = rth; } // Load the text out of the edit field into a buffer int text_len = GetWindowTextLength(GetDlgItem(hPanel,IDC_APPDATA_EDIT))+1; TSTR theText; theText.Resize(text_len); GetWindowText( GetDlgItem(hPanel,IDC_APPDATA_EDIT), theText.dataForWrite(), text_len); MaxSDK::Util::MaxString m_string; theText.ToMaxString(m_string); const char* a_string = m_string.ToUTF8(); size_t len = strlen(a_string)+4; // 3 for UTF8 BOM, one for null char* buf = (char*)MAX_malloc(len); strcpy(buf, "\xef\xbb\xbf"); // UTF8 BOM strcat(buf, a_string); // Remove the chunk if it exists anim->RemoveAppDataChunk( APPDATA_TEST_CLASS_ID, UTILITY_CLASS_ID, spin->GetIVal()); // Add a chunk anim->AddAppDataChunk( APPDATA_TEST_CLASS_ID, UTILITY_CLASS_ID, spin->GetIVal(), (DWORD)len, buf); }
void AppDataTest::GetAppData() { Animatable *anim = PickAnim(); if (!anim) return; // XRef stuff 020416 --prs. if (s_through_xref) { RefTargetHandle rth = (RefTargetHandle)anim; IXRefItem* xi = NULL; while (rth != NULL && (xi = IXRefItem::GetInterface(*rth)) != NULL) rth = xi->GetSrcItem(); if (rth != NULL) anim = rth; } // Grab the app data chunk from the anim AppDataChunk *ad = anim->GetAppDataChunk( APPDATA_TEST_CLASS_ID, UTILITY_CLASS_ID, spin->GetIVal()); if (ad && ad->data) { // Fill the edit field with the text. TSTR data; const char* raw_string = (const char*)ad->data; if (strncmp(raw_string, "\xef\xbb\xbf", 3) == 0) data = TSTR::FromUTF8(raw_string+3); else { DbgAssert(!_T("Should always convert appdata in UpdateAppDataLoadProc")); Interface14 *iface = GetCOREInterface14(); LANGID langID = iface->LanguageToUseForFileIO(); UINT codePage = iface->CodePageForLanguage(langID); data = TSTR::FromCP(codePage, raw_string); } SetDlgItemText(hPanel,IDC_APPDATA_EDIT,data.data()); } else { // Not found! MessageBox(hPanel,_T("No app data found"),_T("App Data Tester"),MB_OK); } }