Esempio n. 1
0
///NotifyObserver전에 CInventory에있는 tagITEM을 Empty로 만들어야 한다.
bool CItemSlot::DelItem( int iInvenIdx )
{
	assert( iInvenIdx >= 0 && iInvenIdx < INVENTORY_TOTAL_SIZE );
	CItem* pItem = m_listItems[ iInvenIdx ];
	
	assert( pItem );
	if( pItem )
	{
		pItem->Clear();

		m_pEvent->SetID( CTEventItem::EID_DEL_ITEM );
		m_pEvent->SetIndex( iInvenIdx );
		m_pEvent->SetItem( pItem );

		SetChanged();
		NotifyObservers( m_pEvent );

		delete pItem;
		m_listItems[ iInvenIdx ] = NULL;
	}
	return true;
}
void CPrivateStore::UpdateBuyList( tagPS_SLOT_ITEM& SlotITEM )
{
	std::list< CItemFragment* >::iterator iter;
	CItemFragment* pFragmentItem;
	for( iter = m_BuyItems.begin(); iter != m_BuyItems.end(); ++iter )
	{
		pFragmentItem = *iter;
		if( pFragmentItem->GetIndex() == SlotITEM.m_btSLOT )
		{
			if( SlotITEM.m_SlotITEM.IsEmpty() )///다 팔렸다.
			{
				CTEventPrivateStore Event;

				Event.SetID( CTEventPrivateStore::EID_REMOVE_BUYLIST );
				Event.SetIndex( SlotITEM.m_btSLOT );
				Event.SetItem( m_WishItems[SlotITEM.m_btSLOT] );

				SetChanged();
				NotifyObservers( &Event );

				m_BuyItems.erase( iter );
				delete pFragmentItem;
			}
			else
			{
				if( SlotITEM.m_SlotITEM.IsEnableDupCNT() )
				{
					pFragmentItem->SetQuantity( SlotITEM.m_SlotITEM.GetQuantity() );
				}
				else
				{
					assert( 0 && "수량이 없는 아이템을 업데이트 하려고한다" );
				}
			
			}
			break;
		}
	}		
}
//*---------------------------------------------------------------------------//
/// @brief 판매하고자 하는 물품을 등록한다.인벤토리로부터 
//*---------------------------------------------------------------------------//
void CPrivateStore::AddItemSellList( CItem* pItem, int iQuantity, int iPrice )
{
	if( IsOpened() ) return;

	tagITEM& Item = pItem->GetItem();
	if( !Item.IsEnableExchange() )
	{
		g_itMGR.AppendChatMsg(STR_DONT_EXCHANGE_ITEM, IT_MGR::CHAT_TYPE_SYSTEM );	
		return;
	}

	if( !Item.IsEnableSELL() )
	{
		g_itMGR.AppendChatMsg(STR_DONT_SELL_ITEM, IT_MGR::CHAT_TYPE_SYSTEM );	
		return;
	}

	std::vector< CItemFragment* >::iterator iter;
	int iSlot = 0;
	for( iter = m_SellItems.begin(); iter != m_SellItems.end(); ++iter, ++iSlot )
	{
		if( *iter == NULL )
		{
			CItemFragment* pFragmentItem = new CItemFragment( pItem );
			pFragmentItem->SetQuantity( iQuantity );
			pFragmentItem->SetUnitPrice( iPrice );
			m_SellItems[iSlot] = pFragmentItem;
			
			CTEventPrivateStore Event;
			Event.SetID( CTEventPrivateStore::EID_ADD_SELLLIST );
			Event.SetIndex( iSlot );
			Event.SetItem( pFragmentItem );
			SetChanged();
			NotifyObservers( &Event );
			return;
		}
	}
}
//*---------------------------------------------------------------------------//
/// @brief 개인상점을 중단한다(UI가 아닌다)
//*---------------------------------------------------------------------------//
void CPrivateStore::Update( CObservable* pObservable, CTObject* pObj )
{
	assert( pObservable );
	assert( pObj );
	if( pObj == NULL || strcmp( pObj->toString(), "CTEventItem" ) )
	{
		assert( 0 && "pObj is NULL or Invalid Type " );
		return;
	}
	
	CTEventItem* pEvent = (CTEventItem*)pObj;
	if( pEvent->GetID() == CTEventItem::EID_DEL_ITEM )///아이템이 삭제되었을경우
	{
		std::vector< CItemFragment* >::iterator iter;
		CItemFragment* pFragmentItem;
		int iSlot = 0;
		for( iter = m_SellItems.begin(); iter != m_SellItems.end(); ++iter, ++iSlot )
		{
			pFragmentItem = *iter;
			if( pFragmentItem && pFragmentItem->GetIndex() == pEvent->GetIndex() )
			{
				CTEventPrivateStore Event;

				Event.SetID( CTEventPrivateStore::EID_REMOVE_SELLLIST );
				Event.SetIndex( iSlot );

				SetChanged();
				NotifyObservers( &Event );

				delete pFragmentItem;
				m_SellItems[iSlot] = NULL;

				break;
			}
		}

	}
}
Esempio n. 5
0
void CItemSlot::Clear()
{
	std::vector< CItem*	>::iterator iter;
	CItem* pItem = NULL;
	for( iter =	m_listItems.begin(); iter != m_listItems.end(); ++iter )
	{
		pItem = *iter;
		if( pItem )
		{
			pItem->Clear();

			m_pEvent->SetID( CTEventItem::EID_DEL_ITEM );
			m_pEvent->SetIndex( pItem->GetIndex() );
			m_pEvent->SetItem( pItem );

			SetChanged();
			NotifyObservers( m_pEvent );

			delete pItem;
			*iter = NULL;
		}
	}
}
Esempio n. 6
0
void CSkillSlot::SetSkillSlot(short nSlotIndex, short nSkillIndex, short nSkillLevel )
{
	if( m_SkillSlot[ nSlotIndex ] != NULL )
	{
		return;
	}

	CSkill* pSkill = g_SkillManager.CreateNewSkill( SKILL_SLOT_MAIN, nSkillIndex );
	if( pSkill == NULL )
	{
		//assert( 0 && "SetSkillSlot[ pSkill == NULL ]" );
		return;
	}
	
	pSkill->SetSkillSlot( nSlotIndex );
	m_SkillSlot[ nSlotIndex ] = pSkill;

	m_Event.SetID( CTEventSkill::EID_ADD_SKILL );	
	m_Event.SetIndex( nSlotIndex );

	SetChanged();
	NotifyObservers( &m_Event );
}
Esempio n. 7
0
EXPORT_C void CHuiLayout::SetInnerPadding(const TPoint& aInnerPadding)
    {
    iHuiLayoutPrivateData->iInnerPadding.iX = THuiMetric(aInnerPadding.iX, EHuiUnitPixel);
    iHuiLayoutPrivateData->iInnerPadding.iY = THuiMetric(aInnerPadding.iY, EHuiUnitPixel);
    SetChanged();
    }
Esempio n. 8
0
void SelectDrawWidget::DrawInfoChanged(Draw *draw) {
	if (draw->GetSelected() == false)
		return;

	SetChanged(draw->GetDrawsController());
}
Esempio n. 9
0
void SelectDrawWidget::DrawsSorted(DrawsController *controller) {
	SetChanged(controller);
}
Esempio n. 10
0
void CFX_RGBLed::SetColor(const CFX_Color& color)
{
  m_color = color;
  SetChanged(true);
}
Esempio n. 11
0
void ProjectView::OnLoadProject() {
	ViewEvent ve(VET_QUIT_PROJECT) ;
	SetChanged();
	NotifyObservers(&ve) ;
} ;
Esempio n. 12
0
void AudioDriver::onAudioBufferTick()
{
  SetChanged() ;
  Event event(Event::ADET_DRIVERTICK);
  NotifyObservers(&event) ;
}
Esempio n. 13
0
void Object::OnExpose(void)
{
    SetChanged(1);
}
Esempio n. 14
0
void cceMaterialShaderEditorDialog::on_comboBoxType_currentIndexChanged(int index)
{
  SetChanged(ShaderChanged());
}
Esempio n. 15
0
void __fastcall TObjFrm::ElemChange(TObject *Sender)
{
SetChanged(true);
}
Esempio n. 16
0
void	CSkillSlot::UpdateSkillDlgSlot()
{
	m_Event.SetID( CTEventSkill::EID_CHANGE_SKILL );	
	SetChanged();
	NotifyObservers( &m_Event );
}
Esempio n. 17
0
void cceMaterialShaderEditorDialog::CodeChanged()
{
  _updateBindingTime.start();
  SetChanged(ShaderChanged());
}
Esempio n. 18
0
void cceMaterialShaderEditorDialog::on_lineEditName_textChanged(const QString &text)
{
  SetChanged(ShaderChanged());
}
Esempio n. 19
0
////*---------------------------------------------------------------------------//
///// @param iIndex - Slot Index
///// @brief 구입리스트에서 특정 물품을 리턴한다.
////*---------------------------------------------------------------------------//
//CItem*	CPrivateStore::GetItemBuyList( int iIndex )
//{
//	if( iIndex >= 0 && iIndex < m_BuyItems.size() )
//		return m_BuyItems[iIndex];
//
//	return NULL;
//}
//*---------------------------------------------------------------------------//
/// @param bSendPacket    - 서버에 추가사항을 알려주는가?
/// @brief 찜리스트에 특정 item을 추가한다.
//*---------------------------------------------------------------------------//
void CPrivateStore::AddItemWishList( tagITEM& Item , bool bSendPacket ,int iSlotIndex )
{
	if( IsOpened() ) return;

	if( Item.IsEmpty() )
		return;

	if( !Item.IsEnableExchange() )
	{
		g_itMGR.AppendChatMsg(STR_DONT_EXCHANGE_ITEM, IT_MGR::CHAT_TYPE_SYSTEM);	
		return;
	}

	if( !Item.IsEnableSELL() )
	{
		g_itMGR.AppendChatMsg(STR_DONT_SELL_ITEM, IT_MGR::CHAT_TYPE_SYSTEM );	
		return;
	}

	if( iSlotIndex >= 0 )
	{
		assert( iSlotIndex < MAX_WISH_ITEMS );
		if( iSlotIndex < MAX_WISH_ITEMS )
		{
			CItem* pItem = new CItem;
			pItem->SetIndex( iSlotIndex );
			pItem->SetUnitPrice(0);

			pItem->SetItem( Item );
			m_WishItems[iSlotIndex] = pItem;

			CTEventPrivateStore Event;

			Event.SetID( CTEventPrivateStore::EID_ADD_WISHLIST );
			Event.SetIndex( iSlotIndex );
			Event.SetItem( pItem );

			SetChanged();
			NotifyObservers( &Event );
		}
	}
	else
	{
		int iIndex = 0;
		for( iIndex = 0; iIndex < MAX_WISH_ITEMS; ++iIndex )
		{
			if( m_WishItems[iIndex] == NULL )
			{	
				CItem* pItem = new CItem;
				pItem->SetIndex( iIndex );

				tagITEM TempItem = Item;
				if( TempItem.IsEnableDupCNT() )
					TempItem.m_uiQuantity = 0;

				pItem->SetItem( TempItem );
				m_WishItems[iIndex] = pItem;

				CTEventPrivateStore Event;

				Event.SetID( CTEventPrivateStore::EID_ADD_WISHLIST );
				Event.SetIndex( iIndex );
				Event.SetItem( pItem );

				SetChanged();
				NotifyObservers( &Event );

				if( bSendPacket )
					g_pNet->Send_cli_SET_WISHITEM( iIndex, TempItem );

				return;
			}
		}
		g_itMGR.AppendChatMsg(STR_CANT_ADDITEM2BUYLIST, IT_MGR::CHAT_TYPE_SYSTEM );
	}
}
Esempio n. 20
0
EXPORT_C void CHuiLayout::SetInnerPadding(const THuiXYMetric& aInnerPadding)
    {
    iHuiLayoutPrivateData->iInnerPadding = aInnerPadding;
    SetChanged();
    }
Esempio n. 21
0
EXPORT_C void CHuiLayout::SetBaseUnit(const THuiXYMetric& aBaseUnit)
    {
    iHuiLayoutPrivateData->iBaseUnit = aBaseUnit;
    SetChanged();
    }
Esempio n. 22
0
//------------------------------------------------------------------------------
void CUIEdProjectUI::Delete(CIwAttrInstance*& inst,bool deleteLinked)
{
    if (!inst)
        return;

    int i;
    CUIEdAttrShared& shared=CIwTheHost.m_Shared;
    CUIEdAttrLinkData* link=GetLink(inst);
    CUIEdAttrLinkData* link2=NULL;

    CIwAttrInstance* parent=shared.Remove(inst);

    CIwAttrInstance* deadInst = inst;

    if (link!=NULL)
    {
        if (link->m_Element==inst)
        {
            link->m_Element=NULL;
            if (link->m_LayoutItem!=NULL)
            {
                if (deleteLinked)
                    Delete(link->m_LayoutItem,false);
                else
                {
                    link->m_LayoutItem->m_TempClass=NULL;
                    link->m_LayoutItem=NULL;
                }
            }
        }

        if (link->m_LayoutItem==inst)
        {
            link->m_LayoutItem=NULL;
            if (link->m_Element!=NULL)
            {
                if (deleteLinked)
                    Delete(link->m_Element,false);
                else
                {
                    link->m_Element->m_TempClass=NULL;
                    link->m_Element=NULL;
                }
            }
        }

        if (link->m_Element==NULL && link->m_LayoutItem==NULL && deleteLinked)
        {
            if (link->m_Parent)
            {
                for (i=0; i<(int)link->m_Parent->m_Children.size(); i++)
                {
                    if (link->m_Parent->m_Children[i]==link)
                    {
                        link->m_Parent->m_Children.erase(link->m_Parent->m_Children.begin()+i);
                        break;
                    }
                }
            }

            link->m_Children.clear();
            delete link;
        }
    }

    if (inst)
    {
        for (i=0; i<(int)inst->m_Data.size(); i++)
        {
            for (int j=0; i<(int)inst->m_Data.size() && j<(int)inst->m_Data[i]->m_Items.size(); )
            {
                if (inst->m_Data[i]->m_Items[j].m_Inst!=NULL && inst->m_Data[i]->m_Items[j].m_Flags&ATTRITEM_ALLOCED_F)
                    Delete(inst->m_Data[i]->m_Items[j].m_Inst);
                else
                    j++;
            }
        }
    }

    if (shared.m_SelElem==deadInst)
        shared.m_SelElem=parent;

    for (i=0; i<(int)shared.m_SelList.size(); i++)
    {
        if (shared.m_SelList[i]==deadInst)
        {
            shared.m_SelList.erase(shared.m_SelList.begin()+i);
            shared.m_SelList.push_back(parent);
            break;
        }
    }

    if (shared.m_UIEdAttrUIPanel!=NULL && shared.m_UIEdAttrUIPanel->m_Sect==deadInst)
        shared.m_UIEdAttrUIPanel->m_Sect=parent;

    if (shared.m_UIEdAttrStylePanel!=NULL && shared.m_UIEdAttrStylePanel->m_Sect==deadInst)
        shared.m_UIEdAttrStylePanel->m_Sect=parent;

    if (shared.m_UIEdAttrMaterialPanel!=NULL && shared.m_UIEdAttrMaterialPanel->m_Sect==deadInst)
        shared.m_UIEdAttrMaterialPanel->m_Sect=parent;

    if (inst)
    {
        CIwAttrData* name=inst->FindData(L"name",0);
        if (name!=NULL)
        {
            std::map<wxString,CUIEdAttrPropSet>::iterator it=shared.m_PropSetDict.find(name->m_Items[0].m_String);
            if (it!=shared.m_PropSetDict.end())
                shared.m_PropSetDict.erase(it);

            it=shared.m_MaterialDict.find(name->m_Items[0].m_String);
            if (it!=shared.m_MaterialDict.end())
                shared.m_MaterialDict.erase(it);
        }
    }

    SetChanged(true);

    delete inst;

    // Ensure we're not holding onto bad pointers
    inst = NULL;
}
Esempio n. 23
0
void AudioDriver::OnNewBufferNeeded() {
  SetChanged() ;
  Event event(Event::ADET_BUFFERNEEDED);
  NotifyObservers(&event) ;
} ;
Esempio n. 24
0
//------------------------------------------------------------------------------
CIwAttrInstance* CUIEdProjectUI::SetLayout(CIwAttrInstance* inst,CIwAttrInstance* parent)
{
    if (inst==NULL || parent==NULL) return NULL;

    int i;
    CIwAttrInstance* inst2=NULL;
    std::vector<CIwAttrNote> notes;
    std::vector<CIwAttrNote> notes1;
    std::vector<CIwAttrNote> notes2;
    CUIEdAttrLinkData* link2=NULL;
    CUIEdAttrLinkData* link=GetLink(inst);
    if (link==NULL) return NULL;

    link=ResolveAddItem(link);

    CUIEdAttrLinkData* parentLink=GetLink(parent);
    if (parentLink==NULL) return NULL;

    if (parentLink->m_Type!=LAYOUTITEM_ELEMENT)
        parentLink=parentLink->GetParent(LAYOUTITEM_ELEMENT);

    if (link==NULL)
    {
        link2=parentLink->GetLayout();

        if (link2!=NULL)
        {
            inst2=link2->m_Element;
            link2->UnlinkAndRemove();
            CIwTheHost.m_Shared.Remove(inst2);
            delete inst2;
        }

        SetupElements(parentLink->m_Element,parentLink->m_Parent);
        SetChanged(true);
        return parent;
    }

    link->m_Element->FillNotes(notes1,true,0,true);

    if (parentLink->GetLayout()!=NULL)
    {
        link2=parentLink->GetLayout();
        inst2=link2->m_Element;

        for (i=0; i<(int)link2->m_Children.size(); i++)
        {
            delete link2->m_Children[i];
        }
        link2->m_Children.clear();
    }

    for (i=0; i<(int)notes1.size(); i++)
    {
        if (notes1[i].m_Name.IsSameAs(L"class",false))
        {
            if (parentLink->GetLayout()==NULL)
            {
                std::vector<wxString> argv2;
                argv2.push_back(L"{");
                inst2=parentLink->m_Element->AddFromNote(L"C"+notes1[i].m_Data,notes1[i],argv2,parentLink->m_Element);

                link2=new CUIEdAttrLinkData(link->m_Name,link->m_Type,parentLink,inst2);
                parentLink->m_Children.push_back(link2);
            }

            notes1.erase(notes1.begin()+i);
            break;
        }
    }

    if (inst2==NULL) return NULL;

    inst2->FillNotes(notes,false,0,true);

    parentLink->GetLayout()->m_Name=link->m_Name;

    for (i=0; i<(int)inst2->m_Data.size(); i++)
    {
        delete inst2->m_Data[i];
    }
    inst2->m_Data.clear();
    inst2->m_ExtraData.clear();

    inst2->m_Class=link->m_Element->m_Class;
    inst2->AddDefaults(link->m_Element->m_Class);

    int mode=0;
    int info=0;

    for (i=0; i<(int)notes1.size(); i++)
    {
        switch (mode)
        {
        case 0:
            if (notes1[i].m_Name.IsSameAs(L"element"))
            {
                info=notes1[i].m_Info;
                mode=1;
            }
            else
                notes2.push_back(notes1[i]);

            break;
        case 1:
            if (notes1[i].m_Name.IsSameAs(L"}") && notes1[i].m_Info==info)
                mode=0;

            break;
        }
    }
    for (i=0; i<(int)notes.size(); i++)
    {
        switch (mode)
        {
        case 0:
            if (notes[i].m_Name.IsSameAs(L"element"))
            {
                info=notes[i].m_Info;
                notes2.push_back(notes[i]);
                mode=1;
            }

            break;
        case 1:
            notes2.push_back(notes[i]);
            if (notes[i].m_Name.IsSameAs(L"}") && notes[i].m_Info==info)
                mode=0;

            break;
        }
    }
    inst2->GetFromNotes(notes2);
    SetName(link2);
    SetupElements(link2->m_Element,parentLink);

    for (i=0; i<(int)parentLink->m_Children.size(); i++)
    {
        link=parentLink->m_Children[i];
        if (link->m_Type==LAYOUTITEM_ELEMENT)
        {
            AddToLayout(link,link2);
            if (link->m_LayoutItem!=NULL)
            {
                parentLink->m_Children.erase(parentLink->m_Children.begin()+i);
                i--;
                link2->m_Children.push_back(link);
                link->m_Parent=link2;
            }
        }
    }

    SetChanged(true);

    return link2->m_Element;
}
Esempio n. 25
0
void CSeparate::SetItem( CItem* pItem )
{
	assert( pItem );
	tagITEM& Item = pItem->GetItem();
/*
	int a = CSeparateDlg::GetInstance()->m_OutputItemSlots.size();
	// 초기화를 안해줬더니;; 쓰레기값이 4개가 더 들어있어서 나중에 빈 슬롯 계산할때 삑 난다;;
//	CSeparateDlg::GetInstance()->OutputItemSlotClear(); 
	int c = CSeparateDlg::GetInstance()->m_OutputItemSlots.size();	
*/
	m_iType = TYPE_NONE;

	if( !Item.IsEnableSeparate() )
	{
		g_itMGR.OpenMsgBox(STR_ITEM_CANT_SEPARATED);
		return;
	}

	if( Item.HasSocket() && Item.GetGemNO() > 300 )
		return;

#ifdef _NEWBREAK
	else if( ITEM_DECOMPOSITION_NUMBER( Item.GetTYPE(), Item.GetItemNO() ) )
#else
	else if( ITEM_PRODUCT_IDX( Item.GetTYPE(), Item.GetItemNO() ) )
#endif
		m_iType = TYPE_DECOMPOSITION;
	else
	{
		assert( 0 && "Invalid Separate Type" );
		return;
	}

	if( m_pMaterialItem )
		RemoveItem();

	m_pMaterialItem = new CItemFragment( pItem );	
	
	if( Item.IsEnableDupCNT() )
		m_pMaterialItem->SetQuantity( 1 );

	m_Event.SetID( CTEventSeparate::EID_SET_MATERIAL_ITEM );
	m_Event.SetItem( m_pMaterialItem );
	SetChanged();
	NotifyObservers( &m_Event );

	m_iRequireMoney = Item.GetSeparateCost();

	switch( m_iType )
	{
	case TYPE_SEPARATE:
		{
			tagITEM MainMaterialItem;		

			MainMaterialItem.Init(  setItemFullNo( pItem->GetType(), pItem->GetItemNo() ) );

			CItem* pMainMaterialItem = new CItem;
			pMainMaterialItem->SetItem( MainMaterialItem );
			m_pItems.push_back( pMainMaterialItem );

			m_Event.SetID( CTEventSeparate::EID_SET_OUTPUT_ITEM );
			m_Event.SetIndex( 0 );
			m_Event.SetItem( pMainMaterialItem );
			SetChanged(); 
			NotifyObservers( &m_Event );


			tagITEM GemItem;
			GemItem.Init( setItemFullNo( ITEM_TYPE_GEM, Item.GetGemNO() ) );
			CItem* pGemItem	 = new CItem;
			pGemItem->SetItem( GemItem );
			m_pItems.push_back( pGemItem );

			m_Event.SetID( CTEventSeparate::EID_SET_OUTPUT_ITEM );
			m_Event.SetIndex( 1 );
			m_Event.SetItem( pGemItem );
			SetChanged();
			NotifyObservers( &m_Event);

			m_iRequireMp = ITEM_QUALITY( MainMaterialItem.GetTYPE(), MainMaterialItem.GetItemNO() ) / 2 +
				ITEM_QUALITY( GemItem.GetTYPE(), GemItem.GetItemNO() );

			break;
		}
	case TYPE_DECOMPOSITION:
		{
	//05.11.03 - 김주현 : 분해 관련 새로운 시스템.
	#if defined ( _NEWBREAK )

			m_iNumMat = 1;
			tagITEM MaterialItem;
			CItem*  pMaterialItem = NULL;

			int iCompositionIdx = ITEM_DECOMPOSITION_NUMBER( Item.GetTYPE(), Item.GetItemNO() );
			//PY temporary fix for items that point off the end of the break list
			if(iCompositionIdx > 2028) iCompositionIdx = 2028; //There are currently only 2028 entries in LIST_BREAK.STB and some items point to 2300 +
			if( int iRawMaterial = ITEM_BREAK_POTISION( iCompositionIdx ) )
			{

				int iOriQual = ITEM_QUALITY( Item.GetTYPE(), Item.GetItemNO() );

				if( getItemType( iRawMaterial ) )
				{
					MaterialItem.Init( iRawMaterial );
				}
				else
				{
					int iTemp    = ( iOriQual - 20 ) / 12;

					if( iTemp < 1 ) 	iTemp = 1;
					if( iTemp > 10 )	iTemp = 10;

					int iItemNo = ( iRawMaterial - 421 ) * 10 + iTemp;

					assert( iItemNo >= 1 && iItemNo <= g_TblNATUAL.m_nDataCnt );
					if( iItemNo < 0 || iItemNo > g_TblNATUAL.m_nDataCnt )
						return;

					MaterialItem.Init( setItemFullNo( ITEM_TYPE_NATURAL, iItemNo ) );
				}

				if( MaterialItem.IsEnableDupCNT() )
					MaterialItem.m_uiQuantity = ITEM_BREAK_NEED_CNT( iCompositionIdx, 0 );


				pMaterialItem = new CItem;
				pMaterialItem->SetItem( MaterialItem );
	


				m_pItems.push_back( pMaterialItem );
				m_Event.SetID( CTEventSeparate::EID_SET_OUTPUT_ITEM );
				m_Event.SetIndex( 0 );
				m_Event.SetItem( pMaterialItem );
				SetChanged(); 
				NotifyObservers( &m_Event );

				int iMaterialIdx  = 0 ;
				int iClass = 0;
				int iIndex = 0;

				for( int i = 1 ; i < 4; ++i )
				{
					if( iMaterialIdx = ITEM_BREAK_COUNT( iCompositionIdx, i ) )
					{
						MaterialItem.Init( iMaterialIdx );
						if( MaterialItem.IsEnableDupCNT() )
							MaterialItem.m_uiQuantity = ITEM_BREAK_NEED_CNT( iCompositionIdx, i);

						pMaterialItem = new CItem;
						pMaterialItem->SetItem( MaterialItem );
						m_pItems.push_back( pMaterialItem );						
						++iIndex;
						
						m_Event.SetID( CTEventSeparate::EID_SET_OUTPUT_ITEM );
						m_Event.SetIndex( iIndex );
						m_Event.SetItem( pMaterialItem );
						SetChanged(); 
						NotifyObservers( &m_Event );
						++m_iNumMat;

					}
				}

				m_iRequireMp = iOriQual + 30;


#else
		
			tagITEM MaterialItem;
			CItem*  pMaterialItem = NULL;
			int iProductIdx = ITEM_PRODUCT_IDX( Item.GetTYPE(), Item.GetItemNO() );
			if( int iRawMaterial = PRODUCT_RAW_MATERIAL( iProductIdx ) )
			{
				int iOriQual = ITEM_QUALITY( Item.GetTYPE(), Item.GetItemNO() );
	
				if( getItemType( iRawMaterial ) )
				{
					MaterialItem.Init( iRawMaterial );
				}
				else
				{
					int iTemp    = ( iOriQual - 20 ) / 12;

					if( iTemp < 1 ) 	iTemp = 1;
					if( iTemp > 10 )	iTemp = 10;

					int iItemNo = ( iRawMaterial - 421 ) * 10 + iTemp;

					assert( iItemNo >= 1 && iItemNo <= g_TblNATUAL.m_nDataCnt );
					if( iItemNo < 0 || iItemNo > g_TblNATUAL.m_nDataCnt )
						return;

					MaterialItem.Init( setItemFullNo( ITEM_TYPE_NATURAL, iItemNo ) );
				}

				if( MaterialItem.IsEnableDupCNT() )
					MaterialItem.m_uiQuantity = GetQuantity( Item, PRODUCT_NEED_ITEM_CNT( iProductIdx, 0 ) );


				pMaterialItem = new CItem;
				pMaterialItem->SetItem( MaterialItem );	

				m_pItems.push_back( pMaterialItem );
				m_Event.SetID( CTEventSeparate::EID_SET_OUTPUT_ITEM );
				m_Event.SetIndex( 0 );
				m_Event.SetItem( pMaterialItem );
				SetChanged(); 
				NotifyObservers( &m_Event );

				int iMaterialIdx  = 0 ;
				int iClass = 0;
				int iIndex = 0;
				for( int i = 1 ; i < 4; ++i )
				{
					if( iMaterialIdx = PRODUCT_NEED_ITEM_NO( iProductIdx, i ) )
					{
						MaterialItem.Init( iMaterialIdx );
						if( MaterialItem.IsEnableDupCNT() )
							MaterialItem.m_uiQuantity = GetQuantity( Item, PRODUCT_NEED_ITEM_CNT( iProductIdx, i) );

						pMaterialItem = new CItem;
						pMaterialItem->SetItem( MaterialItem );
						m_pItems.push_back( pMaterialItem );						
						++iIndex;
						
						m_Event.SetID( CTEventSeparate::EID_SET_OUTPUT_ITEM );
						m_Event.SetIndex( iIndex );
						m_Event.SetItem( pMaterialItem );
						SetChanged(); 
						NotifyObservers( &m_Event );
					}
				}

				m_iRequireMp = iOriQual + 30;
			///		

#endif
			}
		break;
	}
	default:
		break;
	}
}

void CSeparate::Update( CObservable* pObservable, CTObject* pObj )
{
	assert( pObservable );
	assert( pObj );

	if( m_pMaterialItem && pObj && strcmp( pObj->toString(), "CTEventItem") == 0  )
	{
		CTEventItem* pEvent = (CTEventItem*)pObj;
		int iIndex = pEvent->GetIndex();
		if( pEvent->GetID() == CTEventItem::EID_DEL_ITEM || 
			pEvent->GetID() == CTEventItem::EID_CHANGE_ITEM )
		{

			if( iIndex == m_pMaterialItem->GetIndex() )
			{
				m_bWaitServerReply = false;

				m_Event.SetID( CTEventSeparate::EID_REMOVE_MATERIAL_ITEM );
				SetChanged();
				NotifyObservers( &m_Event );
				delete m_pMaterialItem;
				m_pMaterialItem = NULL;

				std::vector< CItem* >::iterator iter;
				int iIndex = 0;
				for( iter = m_pItems.begin(); iter != m_pItems.end(); ++iIndex )
				{
					m_Event.SetID( CTEventSeparate::EID_REMOVE_OUTPUT_ITEM );
					m_Event.SetIndex( iIndex );
					SetChanged();
					NotifyObservers( &m_Event );

					delete *iter;
					iter = m_pItems.erase( iter );
				}
			}
		}
	}
}
Esempio n. 26
0
//------------------------------------------------------------------------------
CUIEdAttrLinkData* CUIEdProjectUI::Copy(CUIEdAttrLinkData* link,CUIEdAttrLinkData* parent,CUIEdAttrLinkData* sibling,int actionModifer)
{
    int i;
    CIwAttrInstance* inst2=NULL;
    std::vector<CIwAttrNote> notes;

    link->m_Element->FillNotes(notes,true,0,true);

    std::vector<CIwAttrClass*> Classes;
    Classes.push_back(CIwTheFileMetaMgr.GetClass(L"CIwUILayoutItem"));
    Classes.push_back(CIwTheFileMetaMgr.GetClass(L"CIwUIElement"));
    Classes.push_back(CIwTheFileMetaMgr.GetClass(L"CIwPropertySet"));
    Classes.push_back(CIwTheFileMetaMgr.GetClass(L"CIwUIFocusHandler"));
    CIwTheFileMetaMgr.GetDerivedClasses(Classes);

    if ((actionModifer&ACTIONMODIFIER_REMOVEPOSSIZE)==ACTIONMODIFIER_REMOVEPOSSIZE)
    {
        for (i=0; i<(int)notes.size(); )
        {
            if (notes[i].m_Name==L"pos"|| notes[i].m_Name==L"size")
                notes.erase(notes.begin()+i);
            else
                i++;
        }
    }

    int found=-1;
    for (i=0; i<(int)notes.size(); )
    {
        if (found==-1)
        {
            if (notes[i].m_Name==L"CIwUILayout")
            {
                found=atoi(notes[i].m_Data.mb_str()+1);
                notes.erase(notes.begin()+i);
            }
            else i++;
        }
        else
        {
            if (notes[i].m_Name==L"}" && notes[i].m_ID==found)
                found=-1;

            notes.erase(notes.begin()+i);
        }
    }

    inst2=CIwTheFileMetaMgr.GetFromNotes(notes,Classes,true,&m_Group);

    CUIEdAttrLinkData* link2=new CUIEdAttrLinkData(link->m_Name,link->m_Type,parent,inst2);

    if (sibling!=NULL)
    {
        for (i=0; i<(int)parent->m_Children.size(); i++)
        {
            if (parent->m_Children[i]==sibling)
            {
                parent->m_Children.insert(parent->m_Children.begin()+i,link2);
                break;
            }
        }
        if (i==(int)parent->m_Children.size())
            parent->m_Children.push_back(link2);
    }
    else
        parent->m_Children.push_back(link2);

    SetChanged(true);

    return link2;
}
Esempio n. 27
0
void ProjectView::OnQuit() {
	ViewEvent ve(VET_QUIT_APP) ;
	SetChanged();
	NotifyObservers(&ve) ;
} ;
Esempio n. 28
0
//OptionsDialog class functions
BOOL OptionsDialogType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lParam)
{
	BOOL Result = FALSE;

	switch(msg) 
	{
	case WM_INITDIALOG:
		InitDialog();
		Result = TRUE;
		break;

	case WM_DESTROY:
		DestroyDialog();
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) 
		{
		case IDC_FILENAME:
			switch(HIWORD(wParam))
			{
			case EN_KILLFOCUS:
				FilenameChanged();
				break;

			case EN_CHANGE:
				if (GetFocus() == (HWND)lParam) SetChanged();
				break;
			}
			break;

		case IDC_BROWSE:
			if (HIWORD(wParam) == BN_CLICKED)
			{
				if (BrowseForSmileyPacks(GetSelProto()))
				{
					UpdateControls(true); 
					SetChanged();
				}
			}
			break;

		case IDC_SMLOPTBUTTON:
			if (HIWORD(wParam) == BN_CLICKED) ShowSmileyPreview();
			break;

		case IDC_USESTDPACK:
			if (HIWORD(wParam) == BN_CLICKED)
			{
				PopulateSmPackList(); 
				SetChanged();
			}
			break;

		case IDC_PLUGENABLED:
			if (HIWORD(wParam) == BN_CLICKED)
			{
				BOOL en = IsDlgButtonChecked(m_hwndDialog, IDC_PLUGENABLED) == BST_UNCHECKED;
				EnableWindow(GetDlgItem(m_hwndDialog, IDC_SMLBUT), en);
				SetChanged();
			}
			break;

		case IDC_ADDCATEGORY:
			if (HIWORD(wParam) == BN_CLICKED)
			{
				AddCategory();
			}
			break;

		case IDC_DELETECATEGORY:
			if (HIWORD(wParam) == BN_CLICKED)
			{
				if (tmpsmcat.DeleteCustomCategory(GetSelProto()))
				{
					PopulateSmPackList();
					SetChanged();
				}
			}
			break;

		case IDC_SPACES:
		case IDC_SCALETOTEXTHEIGHT:
		case IDC_APPENDSPACES:
		case IDC_SMLBUT:
		case IDC_SCALEALLSMILEYS:
		case IDC_IEVIEWSTYLE:
		case IDC_ANIMATESEL:
		case IDC_ANIMATEDLG:
		case IDC_INPUTSMILEYS:
		case IDC_DCURSORSMILEY:
		case IDC_DISABLECUSTOM:
		case IDC_HQSCALING:
			if (HIWORD(wParam) == BN_CLICKED) SetChanged();
			break;

		case IDC_SELCLR:
			if (HIWORD(wParam) == CPN_COLOURCHANGED) SetChanged();
			break;

		case IDC_MAXCUSTSMSZ:
		case IDC_MINSMSZ:
			if (HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam) SetChanged();
			break;
		}
		break;

	case UM_CHECKSTATECHANGE:
		UserAction((HTREEITEM)lParam);
		break;

	case WM_NOTIFY:
		switch(((LPNMHDR)lParam)->idFrom)
		{
		case 0:
			switch (((LPNMHDR)lParam)->code)
			{
			case PSN_APPLY:
				ApplyChanges();
				break;
			}
			break;

		case IDC_CATEGORYLIST:
			switch (((LPNMHDR)lParam)->code)
			{
			case NM_CLICK:
				{
					TVHITTESTINFO ht = {0};

					DWORD dwpos = GetMessagePos();
					POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos));
					MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1);

					TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht);
					if (TVHT_ONITEM & ht.flags)
						FilenameChanged();
					if (TVHT_ONITEMSTATEICON & ht.flags)
						PostMessage(m_hwndDialog, UM_CHECKSTATECHANGE, 0, (LPARAM)ht.hItem);
				}

			case TVN_KEYDOWN:
				if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE)
					PostMessage(m_hwndDialog, UM_CHECKSTATECHANGE, 0, 
					(LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
				break;

			case TVN_SELCHANGEDA:
			case TVN_SELCHANGEDW:
				{
					LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam;
					if (pnmtv->itemNew.state & TVIS_SELECTED)
						UpdateControls();
				}
				break;
			}
			break;
		}
		break;
	}

	return Result;
}
Esempio n. 29
0
bool Feeder::Feed(Buffer* a_pBuffer)
{
    SetChanged();
    NotifyObservers((long)a_pBuffer, 0);
}
Esempio n. 30
0
void AudioOutDriver::Update(Observable &o,I_ObservableData *d) 
{
  SetChanged() ;
  NotifyObservers(d) ;    
}