Ejemplo n.º 1
0
void CSceneManager::RenderScene(CCamera *camera, CViewPort *view)
{
	if(!camera || !view)
		return;

	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneManagerListener * lis = 
			dynamic_cast<CSceneManagerListener *>(GetListener(i));
		lis->SceneRenderBeginListener(this);
	}

	mRenderedFaces = 0;
	mRenderedBatches = 0;
	mCurCamera = camera;
	mCurView = view;

	RenderSceneImpl();
	RenderСompoundObjects();

	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneManagerListener * lis = 
			dynamic_cast<CSceneManagerListener *>(GetListener(i));
		lis->SceneRenderEndListener(this);
	}
}
Ejemplo n.º 2
0
bool ZMapListBox::OnCommand(MWidget* pWidget, const char* szMessage)
{
	if(pWidget==m_pListBox && strcmp(szMessage, MLB_ITEM_SEL)==0){
		SetSelIndex(-1);
		return true;
	}
	else if(pWidget==m_pListBox && strcmp(szMessage, MLB_ITEM_DBLCLK)==0){
		if(GetListener()!=NULL)return GetListener()->OnCommand(pWidget, szMessage);
	}
	return false;
}
nsresult
LegacyMDNSDeviceProvider::UpdateDevice(const uint32_t aIndex,
                                       const nsACString& aServiceName,
                                       const nsACString& aServiceType,
                                       const nsACString& aAddress,
                                       const uint16_t aPort)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mPresentationService);

  if (NS_WARN_IF(aIndex >= mDevices.Length())) {
    return NS_ERROR_INVALID_ARG;
  }

  RefPtr<Device> device = mDevices[aIndex];
  device->Update(aServiceName, aServiceType, aAddress, aPort);
  device->ChangeState(DeviceState::eActive);

  nsCOMPtr<nsIPresentationDeviceListener> listener;
  if (NS_SUCCEEDED(GetListener(getter_AddRefs(listener))) && listener) {
    Unused << listener->UpdateDevice(device);
  }

  return NS_OK;
}
nsresult
LegacyMDNSDeviceProvider::AddDevice(const nsACString& aId,
                                    const nsACString& aServiceName,
                                    const nsACString& aServiceType,
                                    const nsACString& aAddress,
                                    const uint16_t aPort)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mPresentationService);

  RefPtr<Device> device = new Device(aId, /* ID */
                                     aServiceName,
                                     aServiceType,
                                     aAddress,
                                     aPort,
                                     DeviceState::eActive,
                                     this);

  nsCOMPtr<nsIPresentationDeviceListener> listener;
  if (NS_SUCCEEDED(GetListener(getter_AddRefs(listener))) && listener) {
    Unused << listener->AddDevice(device);
  }

  mDevices.AppendElement(device);

  return NS_OK;
}
Ejemplo n.º 5
0
void CFreeFont::BuildFont()
{
	// Загрузим шрифт из файла. Если файла шрифта не существует или шрифт битый,
	// то программа может умереть.
	if (FT_New_Face(library, ttffile.c_str(), 0, &face))
		throw NOVA_EXP("CFreeFont::BuildFont - Loading free font failed \
			(there is probably a problem with your font file)", BAD_OPERATION);
	// По некоторым причинам FreeType измеряет размер шрифта в терминах 1/64 пикселя.
	// Таким образом, для того чтобы сделать шрифт выстой h пикселей, мы запрашиваем размер h*64.
	// (h << 6 тоже самое что и h*64)
	FT_Set_Char_Size(face, height << 6, height << 6, 96, 96);
	slot = face->glyph;

	letters_map.clear();

	for(nUInt16 ch = base_plane_begin; ch <= base_plane_end; ++ch)
		MakeLetter(ch);
	for(nUInt16 ch = rus_begin; ch <= rus_end; ++ch)
		MakeLetter(ch);

	// Уничтожим шрифт.
	FT_Done_Face(face);
	isReady = true;

	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CFontListener * lis =
			dynamic_cast<CFontListener *>(GetListener(i));
		lis->BuildFontListener(this);
	}
}
Ejemplo n.º 6
0
NS_IMETHODIMP
DisplayDeviceProvider::OnSessionRequest(nsITCPDeviceInfo* aDeviceInfo,
                                      const nsAString& aUrl,
                                      const nsAString& aPresentationId,
                                      nsIPresentationControlChannel* aControlChannel)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aDeviceInfo);
  MOZ_ASSERT(aControlChannel);

  nsresult rv;

  nsCOMPtr<nsIPresentationDeviceListener> listener;
  rv = GetListener(getter_AddRefs(listener));
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return rv;
  }

  MOZ_ASSERT(!listener);

  rv = listener->OnSessionRequest(mDevice,
                                  aUrl,
                                  aPresentationId,
                                  aControlChannel);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return rv;
  }

  return NS_OK;
}
nsresult
MulticastDNSDeviceProvider::AddDevice(const nsACString& aServiceName,
                                      const nsACString& aServiceType,
                                      const nsACString& aHost,
                                      const uint16_t aPort)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mPresentationServer);

  nsresult rv;

  nsCOMPtr<nsIPresentationDevice> device;
  if (NS_WARN_IF(NS_FAILED(rv =
      mPresentationServer->CreateTCPDevice(aHost, /* ID */
                                           aServiceName,
                                           aServiceType,
                                           aHost,
                                           aPort,
                                           getter_AddRefs(device))))) {
    return rv;
  }

  nsCOMPtr<nsIPresentationDeviceListener> listener;
  if (NS_SUCCEEDED(GetListener(getter_AddRefs(listener))) && listener) {
    unused << listener->AddDevice(device);
  }

  mDevices.AppendElement(Device(aHost, DeviceState::eActive));

  return NS_OK;
}
Ejemplo n.º 8
0
void CTexture::ApplyTexture()
{
	if(!isReady)
		return;

	glMatrixMode(GL_TEXTURE);

	glLoadIdentity();
	glTranslatef(mSOffset, mTOffset, 0.0f);
	glScalef(mSTiling, mTTiling, 1.0f);
	glRotatef(mAngle, 0, 0, 1);

	glEnable(CHardwarePixelBuffer::TextureTarget(mType));
	glBindTexture(CHardwarePixelBuffer::TextureTarget(mType), mTexture);

	//glTexParameteri(CHardwarePixelBuffer::TextureTarget(mType), GL_TEXTURE_MIN_FILTER, mMinFilter);
	//glTexParameteri(CHardwarePixelBuffer::TextureTarget(mType), GL_TEXTURE_MAG_FILTER, mMagFilter);
	glTexParameteri(CHardwarePixelBuffer::TextureTarget(mType), GL_TEXTURE_WRAP_S, mWrapTypeS);
	glTexParameteri(CHardwarePixelBuffer::TextureTarget(mType), GL_TEXTURE_WRAP_T, mWrapTypeT);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mEnvType);

	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CTextureListener * lis =
			dynamic_cast<CTextureListener *>(GetListener(i));
		lis->ApplyTextureListener(this);
	}

}
nsresult
MulticastDNSDeviceProvider::RemoveDevice(const uint32_t aIndex)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mPresentationServer);

  if (NS_WARN_IF(aIndex >= mDevices.Length())) {
    return NS_ERROR_INVALID_ARG;
  }

  nsCString deviceId = mDevices[aIndex].id;
  LOG_I("RemoveDevice: %s", deviceId.get());

  nsCOMPtr<nsIPresentationDevice> device;
  if (NS_FAILED(mPresentationServer->GetTCPDevice(deviceId,
                                                  getter_AddRefs(device)))) {
    LOG_I("ignore non-existing device: %s", deviceId.get());
    return NS_OK;
  }

  nsresult rv;
  if (NS_WARN_IF(NS_FAILED(rv = mPresentationServer->RemoveTCPDevice(deviceId)))) {
    return rv;
  }

  nsCOMPtr<nsIPresentationDeviceListener> listener;
  if (NS_SUCCEEDED(GetListener(getter_AddRefs(listener))) && listener) {
    unused << listener->RemoveDevice(device);
  }

  mDevices.RemoveElementAt(aIndex);
  return NS_OK;
}
Ejemplo n.º 10
0
bool MatchMaker_IsIdentityKnown( NetSocketListener *_listener )
{
    MatchMakerListener *listener = GetListener(_listener);

    if( !listener ) return false;

    return( listener->m_identified );    
}
Ejemplo n.º 11
0
bool MatchMaker_IsRequestingIdentity( NetSocketListener *_listener )
{
    MatchMakerListener *listener = GetListener(_listener);
    if( !listener ) return false;
    if( listener->m_shutDown ) return false;

    return true;
}
Ejemplo n.º 12
0
bool MPopupMenu::OnCommand(MWidget* pWindow, const char* szMessage)
{
	if(GetType()==MPMT_VERTICAL) Show(false);
	else Select((MMenuItem*)NULL);
	MListener* pListener = GetListener();
	if(pListener!=NULL) pListener->OnCommand(this, szMessage);
	return true;
}
Ejemplo n.º 13
0
void CRenderTarget::PostUpdateAction()
{
    for(nova::uint i = 0; i < GetListenersCount(); i++)
    {
        CRenderTargetListener * lis =
            dynamic_cast<CRenderTargetListener *>(GetListener(i));
        lis->PostRenderActionEvent(this);
    }
}
Ejemplo n.º 14
0
void CRenderableObject::PostRenderAction()
{
	for(nova::uint i = 0; i < GetListenersCount(); i++)
	{
		CRenderableObjectListener * lis = 
			dynamic_cast<CRenderableObjectListener *>(GetListener(i));
		lis->PostRenderActionListener(this);
	}
}
Ejemplo n.º 15
0
CRenderTarget::~CRenderTarget()
{
    //ResetStats();
    for(nova::uint i = 0; i < GetListenersCount(); i++)
    {
        CRenderTargetListener * lis =
            dynamic_cast<CRenderTargetListener *>(GetListener(i));
        lis->DestroyActionListener(this);
    }
}
void CBBListenerImpl::GetOrWaitL()
{
	if (iGetState==EWaitForNotify) {
		WaitForNotify();
	} else if (iGetState==EGettingListener) {
		GetListener();
	} else if (iGetState==EIdle || iGetState==EGettingLoca) {
		GetLoca();
	}
}
Ejemplo n.º 17
0
void MatchMaker_StopRequestingIdentity( NetSocketListener *_listener )
{
    MatchMakerListener *listener = GetListener(_listener);

    if( listener )
    {
        AppDebugOut( "Stopped requesting public IP:port for socket %d\n", _listener->GetBoundSocketHandle() );

        listener->m_shutDown = true;
    }
}
Ejemplo n.º 18
0
void CTexture::SetImageList(const TImageList & list)
{
	mList = list;

	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CTextureListener * lis =
			dynamic_cast<CTextureListener *>(GetListener(i));
		lis->CreateTextureListener(this);
	}
}
Ejemplo n.º 19
0
void OpTabGroupButton::Click(BOOL plus_action)
{
	OpWidgetListener* listener = NULL;

	// Kill the toolbar listener
	if (GetListener())
	{
		listener = GetListener();
		SetListener(NULL, TRUE);
	}

	OpButton::Click(plus_action);

	// Toggle the group
	if (m_group)
		m_group->SetCollapsed(GetValue() == 0);

	// Restore the toolbar listener
	SetListener(listener, TRUE);
}
Ejemplo n.º 20
0
void CSceneNode::ReleaseNode(void)
{
	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneNodeListener * lis = 
			dynamic_cast<CSceneNodeListener *>(GetListener(i));
		lis->ReleaseNodeListener(this);
	}

	InValidateNode();
}
Ejemplo n.º 21
0
void CSceneNode::PrepareNode(void)
{
	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneNodeListener * lis = 
			dynamic_cast<CSceneNodeListener *>(GetListener(i));
		lis->PrepareNodeListener(this);
	}

	PrepareNodeImpl();
}
Ejemplo n.º 22
0
void CSceneManager::BuildScene(void)
{
	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneManagerListener * lis = 
			dynamic_cast<CSceneManagerListener *>(GetListener(i));
		lis->BuildSceneListener(this);
	}

	BuildSceneImpl();
}
Ejemplo n.º 23
0
void CSceneManager::PrepareSceneFrame(void)
{
	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneManagerListener * lis = 
			dynamic_cast<CSceneManagerListener *>(GetListener(i));
		lis->PrepareSceneFrameListener(this);
	}

	PrepareSceneFrameImpl();
}
Ejemplo n.º 24
0
void CSceneNode::InValidateNode(void)
{
	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneNodeListener * lis = 
			dynamic_cast<CSceneNodeListener *>(GetListener(i));
		lis->InValidateNodeListener(this);
	}

	InValidateNodeImpl();
	isValidated = false;
}
Ejemplo n.º 25
0
bool MatchMaker_GetIdentity( NetSocketListener *_listener, char *_ip, int *_port )
{
    MatchMakerListener *listener = GetListener(_listener);

    if( !listener ) return false;

    if( !listener->m_identified ) return false;

    strcpy( _ip, listener->m_ip );
    *_port = listener->m_port;

    return true;
}
Ejemplo n.º 26
0
void CSceneManager::DestroyScene(void)
{
	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CSceneManagerListener * lis = 
			dynamic_cast<CSceneManagerListener *>(GetListener(i));
		lis->DestroySceneListener(this);
	}

	
	DestroySceneNode(GetRootElement());
	mSceneTree.FreeAll();
}
Ejemplo n.º 27
0
void CMeshBox::CalculateNormals(void/* Simple method */)
{
	if(mMeshDef.nMeshInfoList.size() == 0)
		return ;

	typedef stl< stl<nInt32>::vector >::vector t_expl;
	t_expl expl;
	TNormal3d normal;
	mMeshDef.nNormalList.clear();

	expl.resize(mMeshDef.nVertexList.size());
	for(nova::nUInt32 i = 0; i < mMeshDef.nMeshInfoList.size(); ++i)
	{
		expl[mMeshDef.nIndexList[i].a].push_back(i);
		expl[mMeshDef.nIndexList[i].b].push_back(i);
		expl[mMeshDef.nIndexList[i].c].push_back(i);
	}

    for (nova::nUInt32 i = 0; i < mMeshDef.nVertexList.size(); ++i)
    {
		memset(&normal, 0, sizeof(TNormal3d));
		nova::nUInt32 t = expl[i].size();

        for (nova::nUInt32 k = 0; k < t; ++k)
        {
			normal.x += mMeshDef.nMeshInfoList[expl[i][k]].nFaceNormal.x;
			normal.y += mMeshDef.nMeshInfoList[expl[i][k]].nFaceNormal.y;
			normal.z += mMeshDef.nMeshInfoList[expl[i][k]].nFaceNormal.z;
        }

		Vector3f vec(&(normal.x));
		vec.Normalize();

		normal.x = vec.X();
		normal.y = vec.Y();
		normal.z = vec.Z();
		mMeshDef.nNormalList.push_back(normal);
    }

	for(nova::nUInt32 i = 0; i < expl.size(); ++i)
		expl[i].clear();
	expl.clear();

	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CMeshBoxListener * lis =
			dynamic_cast<CMeshBoxListener *>(GetListener(i));
		lis->CalculateNormalsListener(this);
	}
}
Ejemplo n.º 28
0
void CMaterial::ApplyMaterial(void)
{
	//glPushAttrib(GL_LIGHTING_BIT);
	glEnable(GL_COLOR_MATERIAL);

	if(mTransparency > 0.0f)
	{
		CRenderSystem::GetSingelton().SetBlend(true);

		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
		glColor4f(1.0f, 1.0f, 1.0f, mTransparency);
	}
	else
	{
		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
		glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	}


	if(!mTexMapPtr.IsNull())
	{
		if(mTexMapPtr->GetPixelFormat() == CImageFormats::NF_ALPHA ||
			mTexMapPtr->GetPixelFormat() == CImageFormats::NF_BGRA ||
			mTexMapPtr->GetPixelFormat() == CImageFormats::NF_LUMINANCE_ALPHA ||
			mTexMapPtr->GetPixelFormat() == CImageFormats::NF_RGBA)
			CRenderSystem::GetSingelton().SetBlend(true);

		mTexMapPtr->ApplyTexture();
	}
	else
	{
		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
		glColor4f(mDiffuseColor.R(), mDiffuseColor.G(), mDiffuseColor.B(), mTransparency);
	}

	glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
	glColor3fv(mAmbientColor);
	glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
	glColor3fv(mSpecularColor);


	for(nova::uint i = 0; i < GetListenersCount(); i++)
	{
		CMaterialListener * lis =
			dynamic_cast<CMaterialListener *>(GetListener(i));
		lis->ApplyMaterialListener(this);
	}
}
Ejemplo n.º 29
0
void
EmbedPrivate::ContentStateChange(void)
{

  // we don't attach listeners to chrome
  if (mListenersAttached && !mIsChrome)
    return;

  GetListener();

  if (!mEventTarget)
    return;

  AttachListeners();

}
Ejemplo n.º 30
0
bool MMsgBox::OnCommand(MWidget* pWindow, const char* szMessage)
{
	MListener* pListener = GetListener();
	if(pListener==NULL) return false;

	if(pWindow==m_pOK && strcmp(szMessage, MBTN_CLK_MSG)==0){
		if(m_nType==MT_YESNO) pListener->OnCommand(this, MMSGBOX_YES);
		else pListener->OnCommand(this, MMSGBOX_OK);
		return true;
	}
	else if(pWindow==m_pCancel && strcmp(szMessage, MBTN_CLK_MSG)==0){
		if(m_nType==MT_YESNO) pListener->OnCommand(this, MMSGBOX_NO);
		else pListener->OnCommand(this, MMSGBOX_CANCEL);
		return true;
	}

	return false;
}