void TfrmImageLib::OnItemsFocused(ListItemsVec& items) { PropItemVec props; RegisterModifiedTHM (); m_THM_Current.clear (); if (!items.empty()) { for (ListItemsIt it=items.begin(); it!=items.end(); it++) { ListItem* prop = *it; if (prop){ ETextureThumbnail* thm=0; if (bImportMode) { thm = FindUsedTHM(prop->Key()); if (!thm) { m_THM_Used.push_back (thm=xr_new<ETextureThumbnail>(prop->Key(),false)); xr_string fn = prop->Key(); ImageLib.UpdateFileName (fn); if (!thm->Load(prop->Key(),_import_)) { bool bLoad = thm->Load(fn.c_str(),_game_textures_); ImageLib.CreateTextureThumbnail (thm, prop->Key(), _import_, !bLoad); } } }else { thm = FindUsedTHM(prop->Key()); if (!thm) m_THM_Used.push_back(thm=xr_new<ETextureThumbnail>(prop->Key())); } m_THM_Current.push_back (thm); prop->tag = thm->_Format().type; // fill prop thm->FillProp (props,PropValue::TOnChange(this,&TfrmImageLib::OnTypeChange)); if (thm->_Format().type==STextureParams::ttCubeMap) { ButtonValue* B = PHelper().CreateButton (props, "CubeMap\\Edit", "Make Small", 0); B->OnBtnClickEvent.bind(this,&TfrmImageLib::OnCubeMapBtnClick); } } } } paImage->Repaint (); m_ItemProps->AssignItems (props); }
void __fastcall TfrmSoundLib::OnItemsFocused(ListItemsVec& items) { PropItemVec props; RegisterModifiedTHM (); m_Snd.destroy (); m_THM_Current.clear (); if (!items.empty()){ for (ListItemsIt it=items.begin(); it!=items.end(); it++){ ListItem* prop = *it; if (prop){ ESoundThumbnail* thm=FindUsedTHM(prop->Key()); if (!thm) m_THM_Used.push_back(thm=xr_new<ESoundThumbnail>(prop->Key())); m_THM_Current.push_back(thm); thm->FillProp (props); } } } ButtonValue* B=0; if (m_THM_Current.size()==1) { ESoundThumbnail* thm=m_THM_Current.back(); u32 size=0; u32 time=0; PlaySound(thm->SrcName(), size, time); CanvasValue* C=0; C=PHelper().CreateCanvas (props,"Attenuation", "", 64); C->tag = (int)this; C->OnDrawCanvasEvent.bind (this,&TfrmSoundLib::OnAttenuationDraw); // C->OnTestEqual.bind (this,&TfrmSoundLib::OnPointDataTestEqual); B=PHelper().CreateButton (props,"Auto Att", "By Min,By Max",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&TfrmSoundLib::OnAttClick); PHelper().CreateCaption (props,"File Length", shared_str().sprintf("%.2f Kb",float(size)/1024.f)); PHelper().CreateCaption (props,"Total Time", shared_str().sprintf("%.2f sec",float(time)/1000.f)); if (!m_Flags.is(flReadOnly)){ B=PHelper().CreateButton(props,"Control", "Play,Stop",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&TfrmSoundLib::OnControlClick); } } if (!m_Flags.is(flReadOnly)){ B=PHelper().CreateButton (props,"Auto Play", bAutoPlay?"on":"off",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&TfrmSoundLib::OnControl2Click); } m_ItemProps->AssignItems (props); }
void __fastcall TfrmSoundLib::UpdateLib() { RegisterModifiedTHM (); SaveUsedTHM (); // save game sounds if (modif_map.size()){ AStringVec modif; LockForm (); SndLib->SynchronizeSounds (true,true,true,&modif_map,0); // SndLib->ChangeFileAgeTo (&modif_map,time(NULL)); UnlockForm (); SndLib->RefreshSounds(false); modif_map.clear (); } }
void __fastcall TfrmImageLib::UpdateLib() { VERIFY (!bReadonlyMode); RegisterModifiedTHM (); SaveUsedTHM (); if (bImportMode && !texture_map.empty()) { AStringVec modif; LockForm(); ImageLib.SafeCopyLocalToServer(texture_map); // rename with folder FS_FileSet files = texture_map; texture_map.clear (); xr_string fn; FS_FileSetIt it = files.begin(); FS_FileSetIt _E = files.end(); for (;it!=_E; it++) { fn = EFS.ChangeFileExt(it->name.c_str(),""); ImageLib.UpdateFileName(fn); FS_File F(*it); F.name = fn; texture_map.insert (F); } // sync ImageLib.SynchronizeTextures(true,true,true,&texture_map,&modif); UnlockForm (); ImageLib.RefreshTextures(&modif); }else { // save game textures if (modif_map.size()) { AStringVec modif; LockForm(); ImageLib.SynchronizeTextures(true,true,true,&modif_map,&modif); UnlockForm(); ImageLib.RefreshTextures(&modif); } } }