示例#1
0
void __fastcall CShaderTools::OnItemFocused(ListItemsVec& items)
{
	LPCSTR name				= 0;
    Current()->m_CurrentItem= 0;
    
	if (!items.empty()){
    	VERIFY(items.size()==1);
        Current()->m_CurrentItem	= *items.begin();
        name						= Current()->m_CurrentItem->Key();
    }
    Current()->SetCurrentItem(name,false);
    ExecCommand				(COMMAND_UPDATE_PROPERTIES);
}
示例#2
0
void __fastcall TClipMaker::OnClipItemFocused(ListItemsVec& items)
{
	if (!items.empty()){
	    for (ListItemsIt it=items.begin(); it!=items.end(); it++){
            ListItem* prop = *it;
            m_ClipList->LockUpdating();
            SelectClip((CUIClip*)prop->m_Object);
            m_ClipList->UnlockUpdating();
        }
        if (sel_clip)
            sbBase->HorzScrollBar->Position = sbBase->HorzScrollBar->Range*(sel_clip->RunTime()/m_TotalLength);
    }
}
示例#3
0
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);
}
示例#4
0
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);
}
示例#5
0
int __fastcall TItemList::GetSelected(LPCSTR pref, ListItemsVec& items, bool bOnlyObject)
{
    for (TElTreeItem* item = tvItems->GetNextSelected(0); item; item = tvItems->GetNextSelected(item)){
        ListItem* prop 		= (ListItem*)item->Tag;

        if (item->Hidden) continue;

//.        VERIFY				(!item->Hidden);
        if (prop&&(!bOnlyObject||(bOnlyObject&&prop->m_Object))){
        	AnsiString key	= *prop->key;
        	if (pref){
            	if (1==key.Pos(pref))
                	items.push_back	(prop);
            }else
				items.push_back	(prop);
        }
    }
    return items.size();
}
void CParticleTools::OnParticleItemFocused(ListItemsVec& items)
{
	PropItemVec props;
	m_EditMode	= emEffect;

    ButtonValue* B;
	B=PHelper().CreateButton	(props,"Transform\\Edit",	"Reset",	ButtonValue::flFirstOnly);
    B->OnBtnClickEvent.bind		(this,&CParticleTools::OnControlClick);
    PHelper().CreateFlag32		(props,"Transform\\Type",	&m_Flags,	flSetXFORM,"Update","Set");
    
    // reset to default
    ResetCurrent	();
    
	if (!items.empty()){
	    for (ListItemsIt it=items.begin(); it!=items.end(); it++){
            ListItem* item = *it;
            if (item){         
                m_EditMode 			= EEditMode(item->Type());
                switch(m_EditMode){
                case emEffect:{
                    PS::CPEDef* def	= ((PS::CPEDef*)item->m_Object);
                	SetCurrentPE	(def);
                    def->FillProp	(EFFECT_PREFIX,props,item);
                }break;
                case emGroup:{
                    PS::CPGDef* def	= ((PS::CPGDef*)item->m_Object);
                	SetCurrentPG	(def);
                    def->FillProp	(GROUP_PREFIX,props,item);
                }break;
                default: THROW;
                }
            }
        }
    }
	m_ItemProps->AssignItems(props);
    UI->RedrawScene();
}