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 TfrmEditLightAnim::OnItemFocused(TElTreeItem* item) { if (item&&FHelper.IsObject(item)){ ListItem* prop = (ListItem*)item->Tag; VERIFY(prop); AnsiString nm = prop->Key(); CLAItem* I = LALib.FindItem(nm.c_str()); SetCurrentItem (I,prop); }else{ SetCurrentItem (0,0); } }
void __fastcall TClipMaker::ClipDragDrop(TObject *Sender, TObject *Source, int X, int Y) { VERIFY (Sender==paClips); CUIClip* tgt = FindClip(X); VERIFY(tgt); TElTreeDragObject* obj = dynamic_cast<TElTreeDragObject*>(Source); if (obj){ TElTree* tv = dynamic_cast<TElTree*>(obj->Control); if (tv->SelectedCount){ for (TElTreeItem* item = tv->GetNextSelected(0); item; item = tv->GetNextSelected(item)){ ListItem* prop = (ListItem*)item->Tag; VERIFY(prop); u16 bp; BOOL fx; LPCSTR m_name = ATools->ExtractMotionName(prop->Key()); u16 m_slot = ATools->ExtractMotionSlot(prop->Key()); if (m_CurrentObject->m_SMotionRefs.size()){ CMotionDef* SM = ATools->m_RenderObject.FindMotionDef(m_name,m_slot); VERIFY(SM); bp = SM->bone_or_part; fx = SM->flags&esmFX; }else{ CSMotion* SM = ATools->FindMotion(m_name); VERIFY(SM); bp = SM->m_BoneOrPart; fx = SM->m_Flags.is(esmFX); } if (fx){ tgt->SetFX (m_name,m_slot); }else{ tgt->SetCycle (m_name,bp,m_slot); } } } }else{ float rt = float(X)/m_Zoom-tgt->RunTime(); if (rt<tgt->Length()/2.f) sel_clip->run_time = tgt->run_time-EPS_L; else sel_clip->run_time = tgt->run_time+EPS_L; } UpdateClips (); }
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 TItemList::tvItemsItemDraw(TObject *Sender, TElTreeItem *Item, TCanvas *Surface, TRect &R, int SectionIndex) { ListItem* prop = (ListItem*)Item->Tag; if (prop){ Surface->Font->Color= (TColor)prop->prop_color; R.left += 4; DrawText (Surface->Handle, AnsiString(Item->Text).c_str(), -1, &R, DT_LEFT | DT_SINGLELINE); if (miDrawThumbnails->Checked&&prop->m_Flags.is(ListItem::flDrawThumbnail)){ R.top += tvItems->LineHeight-4; R.left = R.Right-(R.bottom-R.top); if (!prop->OnDrawThumbnail.empty()) prop->OnDrawThumbnail(prop->Key(),Surface->Handle,Irect().set(R.left,R.top,R.right,R.bottom)); } }else{ Surface->Font->Color= Item->MainStyle->TextColor; R.left += 4; DrawText (Surface->Handle, AnsiString(Item->Text).c_str(), -1, &R, DT_LEFT | DT_SINGLELINE); } }