Esempio n. 1
0
void
Menu::Draw(MenuItem* item)
{
	if (!IsHidden())
		platform_update_menu_item(this, item);
}
Esempio n. 2
0
 void hide()
 {
     if (!IsHidden())
         Hide();
 }
Esempio n. 3
0
/*
================
idItem::WriteFromSnapshot
================
*/
void idItem::WriteToSnapshot( idBitMsgDelta &msg ) const {
	msg.WriteBits( IsHidden(), 1 );
}
Esempio n. 4
0
// ----------------------------------------------------------------- RHTML_Preferences_Win - MessageReceived -
void RHTMLPreferencesWin::MessageReceived(BMessage *msg)
{
 switch (msg->what)
  {
   case 'LANG':
   {
    int32 lang;
    msg->FindInt32("Lang",&lang);
    fOptions->CurrentLocale=lang;
    BAlert *fAlert= new BAlert("Alert",fOptions->GetLocaleString("Preferences_Window_Alert","To take effect your changes you must restart Globe!"),"OK");
    LSetAuthor();
    fAlert->Go();
    fOptions->Save();
   }
   break;
   case 'FTFT':
   {
    int32 filetype;
    msg->FindInt32("FileType",&filetype);
    FTCreateKitList(filetype);
   }
   break;
   case 'FTHF':
   {
    int32 filetype;
    msg->FindInt32("FileType",&filetype);
    fFTHFileTypes= (uint) filetype;
    FTHSetFT(filetype);
   }
   break;
   case 'FTHT':
   {
    int32 fontcolor;
    msg->FindInt32("FontColor",&fontcolor);
    fFTHFontColor= (uint) fontcolor;    
    FTHSetFSize(fontcolor);
   }
   break;
   case R_FTH_Family_MSG:
   {
    const char *family;
    msg->FindString("font_family",&family);
    fOptions->FileTypes[fFTHFileTypes]->Font[fFTHFontColor]->Family.SetTo(family);
    if (fOptions->FileTypes[fFTHFileTypes]->Font[fFTHFontColor]->Style.ICompare("Default style")!=0)
    {
     font_family fFamily;
     font_style fStyle;
     if (strcmp(family,"Default font")==0)
     {
      fOptions->DefaultFont->GetFamilyAndStyle(&fFamily,&fStyle);     
     } else strcpy(fFamily,family);
     get_font_style(fFamily, 0, &fStyle);
     fOptions->FileTypes[fFTHFileTypes]->Font[fFTHFontColor]->Style.SetTo(fStyle);
     FTHSetFSize(fFTHFontColor);
    }
    fOptions->Save();
   }
   break;
   case R_FTH_Style_MSG:
   {
    const char *style;
    msg->FindString("font_style",&style);
    fOptions->FileTypes[fFTHFileTypes]->Font[fFTHFontColor]->Style.SetTo(style);
    fOptions->Save();
   }
   break;
   case R_FTH_Size_MSG:
   {
    int32 size;
    msg->FindInt32("font_size",&size);
    fOptions->FileTypes[fFTHFileTypes]->Font[fFTHFontColor]->Size=size;
    fOptions->Save();
   }
   break;
   case R_FTH_Color_MSG:
   {
    fOptions->FileTypes[fFTHFileTypes]->Color[fFTHFontColor]->alpha=fFTHCC->ValueAsColor().alpha;
    fOptions->FileTypes[fFTHFileTypes]->Color[fFTHFontColor]->red=fFTHCC->ValueAsColor().red;
    fOptions->FileTypes[fFTHFileTypes]->Color[fFTHFontColor]->green=fFTHCC->ValueAsColor().green;
    fOptions->FileTypes[fFTHFileTypes]->Color[fFTHFontColor]->blue=fFTHCC->ValueAsColor().blue;
    fOptions->Save();
   }
   break;
   case 'FTSL':
   {
    if (fFTKit->CurrentSelection()>=0)
     fFTStrView->SetText(fOptions->FileTypes[fFT]->Kit[fFTKit->CurrentSelection()]->String());
   }
   break;
   case 'FTAD':
   {
    uint num=fOptions->AddFTKit(fFT,fFTStrView->Text());
    FTCreateKitList(fFT);
    fFTKit->Select(num);
    fOptions->Save();
   }
   break;
   case 'FTRM':
   {
    if (fFTKit->CurrentSelection()>=0)
    {
     fOptions->RemoveFTKit(fFT,fFTKit->CurrentSelection());
     FTCreateKitList(fFT);
     fOptions->Save();     
    }
   }
   break;
   case 'FTED':
   {
    if (fFTKit->CurrentSelection()>=0)
    {
     fOptions->EditFTKit(fFT,fFTKit->CurrentSelection(),fFTStrView->Text());
     FTCreateKitList(fFT);
     fOptions->Save();     
    }
   }
   break;
   case 'FTDF':
   {
    const char *family;
    msg->FindString("font_family",&family);
    FTSetFont(family);
    font_style fStyle;
    get_font_style((font_family) family, 0, &fStyle);
    fOptions->DefaultFont->SetFamilyAndStyle(family,fStyle);
    fOptions->Save();
   }
   break;
   case 'FTFS':
   {
    const char *style;
    msg->FindString("font_style",&style);
    font_family family;
    font_style fstyle;
    fOptions->DefaultFont->GetFamilyAndStyle(&family,&fstyle);
    fOptions->DefaultFont->SetFamilyAndStyle(family, style);
    fOptions->Save();
   }
   break;
   case 'FTSZ':
   {
    int32 size;
    msg->FindInt32("font_size",&size);
    fOptions->DefaultFont->SetSize((float) size);
    fOptions->Save();
   }
   break;
   case 'LIST':
   {
    for (uint i=0;i<JViewDb;i++)fJView[i]->ResizeTo(0,0);
    if (fList->CurrentSelection()>=0)
    {
     fJView[fList->CurrentSelection()]->ResizeTo(fView->Bounds().right,fView->Bounds().bottom);
     FTHSetFSize(0);
    }
   }
   break;
   case 'DFBB':
   {
    if (!IsHidden())
     Hide();
    fDFFilePanel->Show();
   }
   break;
   case 'DFFP':
   {
    entry_ref ref;
    status_t err;
    int32 ref_num;
    BPath path;
    BEntry entry;
    ref_num = 0;
    do
    {
     if ((err = msg->FindRef("refs", ref_num, &ref)) != B_OK) { return; }
     if ((err=entry.SetTo(&ref)) == B_OK)
     {
      entry.GetPath(&path);
      fDFDefaultFolder->SetText(path.Path());
      fOptions->DefaultFolder.SetTo(path.Path());
      fOptions->Save();
     } 
     ref_num++;
    } while (1);
   }
   break;
   case 'DFFN':
   {
    fOptions->DefaultFolder.SetTo(fDFDefaultFolder->Text());
    fOptions->Save();
   }
   break;
   case 'DFCK':
   {
    fOptions->DFOnlyStart=fDFCheckBox->Value();
    fOptions->Save();
   }
   break;
   case 'APRT':
   {
    fOptions->ReakcioIdo = (uint32) (fAPSlider->Position() * 1000);
    fOptions->Save();
   }
   break;
   case 'APTM':
   {
    fOptions->ReakcioIdoTM = (uint32) (fAPTMSlider->Position() * 1000);
    fOptions->Save();
   }
   break;
   case B_CANCEL:
   {
    if (IsHidden())
     Show();
   }
   break;
   default:
   {
    BWindow::MessageReceived(msg);
   }
   break;
  }
}
Esempio n. 5
0
/*
================
idMoveable::WriteToSnapshot
================
*/
void idExplodingBarrel::WriteToSnapshot( idBitMsgDelta &msg ) const {
	idMoveable::WriteToSnapshot( msg );
	msg.WriteBits( IsHidden(), 1 );
}
/** Draws this sub-view */
void D2DContentDownloadDialog::Draw(const D2D1_RECT_F& clientRectAbs, float deltaTime)
{
	std::string message;

	if(!Downloader)
		return;

	// FIXME: This should be in an update-function
	// Start the next job if we are done unzipping or the download failed
	if(UnzipFile == UnzipNumFiles - 1 || Downloader->GetProgress().hasFailed)
	{
		UnzipFile = 0;
		UnzipNumFiles = 0;

		// Done!
		// Check for other jobs
		RunNextJob();
	}

	// Need to check again if the download failed and "RunNextJob()" has deleted the downloader
	if(!Downloader || IsHidden() || 
		(Downloader->GetProgress().LastInfo.ulProgressMax == 0 && UnzipNumFiles == 0)) // Also don't draw if we are currently not doing anything
		return;

	// Size in mbyte
	float dlCurrent = Downloader->GetProgress().LastInfo.ulProgress / (1024.0f * 1024.0f);
	float dlMax = Downloader->GetProgress().LastInfo.ulProgressMax / (1024.0f * 1024.0f);

	if(dlCurrent != dlMax &&
		Downloader->GetProgress().LastInfo.ulProgressMax != 0)
	{
		switch(Downloader->GetProgress().LastInfo.ulStatusCode)
		{
		case BINDSTATUS_FINDINGRESOURCE:
			message = "Finding resource...";
			break;
		case BINDSTATUS_CONNECTING:
			message = "Connecting...";
			break;
		case BINDSTATUS_SENDINGREQUEST:
			message = "Sending request...";
			break;
		case BINDSTATUS_MIMETYPEAVAILABLE:
			message = "Mime type available";
			break;
		case BINDSTATUS_CACHEFILENAMEAVAILABLE:
			message = "Cache filename available";
			break;
		case BINDSTATUS_BEGINDOWNLOADDATA:
			message = "Begin download";
			break;

		default:
			{
				char txt[256];
				sprintf_s(txt, "Downloading %s ... (%.2f/%.2f MBytes)", Job.DownloadPackage.c_str(), dlCurrent, dlMax);
				message = txt;
			}
		}
	}
	
	if(UnzipNumFiles > 0) // Unzip-Phase
	{
		char txt[256];
		sprintf_s(txt, "Unpacking... (%d/%d files)", UnzipFile, UnzipNumFiles);
		message = txt;

		if(UnzipFile == UnzipNumFiles - 1)
		{
			SetHidden(true);
			MainView->AddMessageBox("Success!", "Successfully downloaded and unpacked data. Please restart the game to apply the changes!");
		}
	}

	Header->SetCaption(message);

	D2DDialog::Draw(clientRectAbs, deltaTime);
	
}
Esempio n. 7
0
void Ve1ObjectChar::Update()
{
  // Not safe to do anything if the Terrain has not been created yet
  if (!TerrainReady())
  {
    return;
  }

  // TODO Not if underwater ?
  // TODO Put in base class, so we can drop things ?
  static const float GRAVITY = ROConfig()->GetFloat("gravity", -50.0f); 
  m_acc.y = GRAVITY;

  Ve1Object::Update();

  if (IsHidden())
  {
    return;
  }

  // Handle wall collisions with terrain and any building
  if (HandleWalls(GetTerrain()->GetCollisionMesh(), m_oldPos, m_pos))
  {
    m_recalcHeading = true;
  }

  HasCollisionMesh* h = dynamic_cast<HasCollisionMesh*>(m_collidingObject);
  if (h)
  {
    if (HandleWalls(h->GetCollisionMesh(), m_oldPos, m_pos))
    {
      m_recalcHeading = true;
    }
  }

  HandleFloor(GetTerrain()->GetCollisionMesh());
  if (h)
  {  
    HandleFloor(h->GetCollisionMesh());
  }

  // Recalc heading if we are not colliding
  if (m_collidingObject)
  {
    m_recalcHeading = true;
  }


  if (true) //m_recalcHeading)
  {
    m_recalcHeading = false;
    if (m_isMoving)
    {
      MoveTo(m_newPos);
    }
  }
  m_collidingObject = 0;

/*
  // Stop moving if we are close enough to the destination
  // TODO This ends up happening every frame, only do it if we are moving
  if (m_isMoving)
  {
    Vec3f dir = GetPos() - m_newPos;
    dir.y = 0; // ignore y coord for now
    if (dir.SqLen() < 1.0f) // TODO CONFIG
    {
      SetVel(Vec3f(0, 0, 0));
      m_newPos = GetPos();
      SetArrowVis(false);
      m_isMoving = false;
    }
  }
  else
  {
    Assert(GetVel().SqLen() == 0);
  }
*/

  if (m_sceneNode)
  {
    Matrix m;
    m.Translate(m_pos);
    m_sceneNode->SetLocalTransform(m);
    //m_sceneNode->Update(); // done for whole scene graph elsewhere

    if (m_shadow)
    {
      // Set shadow AABB to same as Scene Node so we don't cull it by mistake
      m_shadow->SetAABB(*m_sceneNode->GetAABB());
    }

    if (m_effect)
    {
      m_effect->SetAABB(*m_sceneNode->GetAABB());
    }

    static const float XSIZE = ROConfig()->GetFloat("player-aabb-x", 30.0f);
    static const float YSIZE = ROConfig()->GetFloat("player-aabb-y", 100.0f);

    GetAABB()->Set(
      m_pos.x - XSIZE, m_pos.x + XSIZE,
      m_pos.y, m_pos.y + YSIZE,
      m_pos.z - XSIZE, m_pos.z + XSIZE);

    /*
    NOT FOR 2D
    TurnToFaceDir();
    */

    Ve1Character* vc = dynamic_cast<Ve1Character*>(m_sceneNode.GetPtr());
    if (vc) //// && vc->GetMd2())
    {
      Vec3f v = m_vel;
      v.y = 0;
      float speed = v.SqLen();

      // TODO Simplify -- either moving or idle.
      // NB Speeds should be an avatar variable and level up

      static const float MAX_SPEED = 100.0f; // TODO CONFIG
      static const float RUN_SPEED = MAX_SPEED * 0.5f;
      static const float WALK_SPEED = RUN_SPEED * 0.5f;

      if (speed > RUN_SPEED)
      {
        vc->SetAnim(Ve1Character::ANIM_RUN);
      }
      else if (speed > WALK_SPEED)
      {
        vc->SetAnim(Ve1Character::ANIM_WALK);
      }
      else
      {
        vc->SetAnim(Ve1Character::ANIM_IDLE);
      }
    }
  }
}
Esempio n. 8
0
void
BasicThebesLayer::PaintThebes(gfxContext* aContext,
                              Layer* aMaskLayer,
                              LayerManager::DrawThebesLayerCallback aCallback,
                              void* aCallbackData,
                              ReadbackProcessor* aReadback)
{
  PROFILER_LABEL("BasicThebesLayer", "PaintThebes");
  NS_ASSERTION(BasicManager()->InDrawing(),
               "Can only draw in drawing phase");

  nsTArray<ReadbackProcessor::Update> readbackUpdates;
  if (aReadback && UsedForReadback()) {
    aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
  }

  float opacity = GetEffectiveOpacity();
  CompositionOp effectiveOperator = GetEffectiveOperator(this);

  if (!BasicManager()->IsRetained()) {
    NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer");

    mValidRegion.SetEmpty();
    mContentClient->Clear();

    nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext);

    RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds());

    if (!toDraw.IsEmpty() && !IsHidden()) {
      if (!aCallback) {
        BasicManager()->SetTransactionIncomplete();
        return;
      }

      aContext->Save();

      bool needsClipToVisibleRegion = GetClipToVisibleRegion();
      bool needsGroup = opacity != 1.0 ||
                        effectiveOperator != CompositionOp::OP_OVER ||
                        aMaskLayer;
      nsRefPtr<gfxContext> groupContext;
      if (needsGroup) {
        groupContext =
          BasicManager()->PushGroupForLayer(aContext, this, toDraw,
                                            &needsClipToVisibleRegion);
        if (effectiveOperator != CompositionOp::OP_OVER) {
          needsClipToVisibleRegion = true;
        }
      } else {
        groupContext = aContext;
      }
      SetAntialiasingFlags(this, groupContext);
      aCallback(this, groupContext, toDraw, DrawRegionClip::CLIP_NONE, nsIntRegion(), aCallbackData);
      if (needsGroup) {
        BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext);
        if (needsClipToVisibleRegion) {
          gfxUtils::ClipToRegion(aContext, toDraw);
        }
        AutoSetOperator setOptimizedOperator(aContext, ThebesOp(effectiveOperator));
        PaintWithMask(aContext, opacity, aMaskLayer);
      }

      aContext->Restore();
    }

    RenderTraceInvalidateEnd(this, "FFFF00");
    return;
  }

  if (BasicManager()->IsTransactionIncomplete())
    return;

  gfxRect clipExtents;
  clipExtents = aContext->GetClipExtents();

  // Pull out the mask surface and transform here, because the mask
  // is internal to basic layers
  AutoMoz2DMaskData mask;
  SourceSurface* maskSurface = nullptr;
  Matrix maskTransform;
  if (GetMaskData(aMaskLayer, &mask)) {
    maskSurface = mask.GetSurface();
    maskTransform = mask.GetTransform();
  }

  if (!IsHidden() && !clipExtents.IsEmpty()) {
    mContentClient->DrawTo(this, aContext->GetDrawTarget(), opacity,
                           GetOperator(),
                           maskSurface, &maskTransform);
  }

  for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) {
    ReadbackProcessor::Update& update = readbackUpdates[i];
    nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset();
    nsRefPtr<gfxContext> ctx =
      update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset,
                                            update.mSequenceCounter);
    if (ctx) {
      NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers");
      ctx->Translate(gfxPoint(offset.x, offset.y));
      mContentClient->DrawTo(this, ctx->GetDrawTarget(), 1.0,
                             CompositionOpForOp(ctx->CurrentOperator()),
                             maskSurface, &maskTransform);
      update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset);
    }
  }
}
Esempio n. 9
0
AUI_ERRCODE C3Slider::DrawThis( aui_Surface *surface, sint32 x, sint32 y )
{




	if ( IsHidden() ) return AUI_ERRCODE_OK;

	if ( !surface ) surface = m_window->TheSurface();

	RECT rect = { 0, 0, m_width, m_height };
	OffsetRect( &rect, m_x + x, m_y + y );
	ToWindow( &rect );

	RECT dirtyRect = rect;

	if ( m_orientation == AUI_RANGER_ORIENTATION_VERTICAL )
		InflateRect( &rect, -m_width / 2 + 8, 0 );
	else
		InflateRect( &rect, 0, -m_height / 2 + 8 );

	if ( m_pattern ) {
		if ( m_srcWidthPix || m_srcHeightPix ) {
			RECT srcRect = { m_srcX, m_srcY, m_srcX + m_srcWidthPix, m_srcY + m_srcHeightPix };
			m_pattern->Draw( surface, &dirtyRect , &srcRect );
		}
		else {
			m_pattern->Draw( surface, &dirtyRect  );
		}
	}


	if ( m_ticks && m_quantized )
	{
		if ( m_orientation == AUI_RANGER_ORIENTATION_VERTICAL )
		{
			sint32 spacing = m_height / ( m_maxY - m_minY ) - 1;
			RECT tickRect;
			for ( sint32 i = m_maxY - m_minY; i >= 0; i -= m_ticks )
			{
				tickRect.top =
					i * spacing + dirtyRect.top + m_minThumbSize / 2;
				tickRect.left = dirtyRect.left + 6;
				tickRect.bottom = tickRect.top + 3;
				tickRect.right = tickRect.left + 6;
				primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 );
				tickRect.left = dirtyRect.right - 12;
				tickRect.right = dirtyRect.right - 6;
				primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 );
			}
		}
		else
		{
			sint32 spacing = m_width / ( m_maxX - m_minX ) - 1;
			RECT tickRect;
			for ( sint32 i = m_maxX - m_minX; i >= 0; i -= m_ticks )
			{
				tickRect.left =
					i * spacing + dirtyRect.left + m_minThumbSize / 2;
				tickRect.top = dirtyRect.top + 6;
				tickRect.right = tickRect.left + 3;
				tickRect.bottom = tickRect.top + 6;
				primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 );
				tickRect.top = dirtyRect.bottom - 12;
				tickRect.bottom = dirtyRect.bottom - 6;
				primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 );
			}
		}
	}

	RECT origRect = rect;
	primitives_BevelRect16( surface, &origRect, 2, 0, 16, 16 );
	InflateRect( &rect, -4, -4 );
	primitives_BevelRect16( surface, &rect, 1, 1, 16, 16 );
	if ( IsActive() )
	{

		primitives_BevelRect16( surface, &rect, 1, 1, 16, 16 );
	}

	InflateRect( &rect, -1, -1 );
	primitives_PaintRect16( surface, &rect, 0x0000 );

	if ( surface == m_window->TheSurface() )
		m_window->AddDirtyRect( &dirtyRect );

	return AUI_ERRCODE_OK;
}
Esempio n. 10
0
bool Game_Battler::Exists() const {
	return !IsHidden() && !IsDead();
}
Esempio n. 11
0
std::list<ADAPTER_INFO>
KLOP_GetAdapterList()
{
	std::list<ADAPTER_INFO> RetList;
	ADAPTER_INFO	AI;	
	HKEY			hKey = NULL;
	FILETIME		ftLastWriteTime;      // last write time 
	CHAR			achKey[MAX_PATH]; 
	wchar_t			wchKey[MAX_PATH];
	ULONG			KeyLength;
	int				i;
	DWORD			retCode;

	if ( KLOP_isWinNT() )
	{
		/*
		if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, NT_ADAPTERS_KEY, &hKey ) )
		{
			for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++ )
			{ 
				KeyLength = MAX_PATH;

				retCode = RegEnumKeyExW(hKey, i, wchKey, &KeyLength, NULL, NULL, NULL, &ftLastWriteTime );

				if ( ERROR_SUCCESS == retCode )
				{
					memset ( &AI , 0, sizeof ( AI ) );
					wcscpy ( (wchar_t*)AI.AdapterBuffer, L"\\Device\\");
					wcscat ( (wchar_t*)AI.AdapterBuffer, wchKey );
					AI.AdapterNameSize = ( wcslen ( (wchar_t*)AI.AdapterBuffer ) + 1 ) << 1;
					AI.LocalIp = 0;

					RetList.push_back( AI );
				}
			} 
		}
		else
		*/
		{
			// Winnt4.0
			if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards", &hKey ) )
			{
				for ( i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++ )
				{
					HKEY hSubKey = NULL;
					KeyLength = MAX_PATH;
					retCode = RegEnumKeyExW(hKey, i, wchKey, &KeyLength, NULL, NULL, NULL, &ftLastWriteTime );
					
					if ( retCode == ERROR_SUCCESS )
					{
						retCode = RegOpenKeyW(hKey, wchKey, &hSubKey );
					}

					if ( retCode == ERROR_SUCCESS )
					{			
						KeyLength = MAX_PATH;
						DWORD	type = REG_SZ;

						if ( ERROR_SUCCESS == RegQueryValueExW( 
							hSubKey, 
							L"ServiceName", 
							NULL,
							&type,
							(LPBYTE)wchKey, 
							(ULONG*)&KeyLength ) )
						{
							memset ( &AI , 0, sizeof ( AI ) );
							wcscpy ( (wchar_t*)AI.AdapterBuffer, L"\\Device\\");
							wcscat ( (wchar_t*)AI.AdapterBuffer, wchKey );
							AI.AdapterNameSize = ( wcslen ( (wchar_t*)AI.AdapterBuffer ) + 1 ) << 1;
							AI.LocalIp = 0;
							
							// Если открывается и не Hidden, тогда добавляем для проверки.
							if ( scan( (wchar_t*)wchKey ) && !IsHidden(hSubKey) )
								RetList.push_back( AI );
						}
					}

					if ( hSubKey )
						RegCloseKey( hSubKey );
				}
			}			
		}
	}
	else
	{
		if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, W9X_ADAPTER_KEY, &hKey ) )
		{			
			for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++ )
			{ 
				KeyLength = MAX_PATH;

				retCode = RegEnumKeyExA(hKey, i, achKey, &KeyLength, NULL, NULL, NULL, &ftLastWriteTime);
				
				if ( ERROR_SUCCESS == retCode )
				{
					memset ( &AI , 0, sizeof ( AI ) );					
					strcpy ( AI.AdapterBuffer, achKey );
					AI.AdapterNameSize = strlen ( achKey ) + 1;
					AI.LocalIp = 0;

					RetList.push_back( AI );
				}				
			} 
		}
	}

	if ( hKey )
	{
		RegCloseKey( hKey );
	}

	return RetList;
}
void
BasicThebesLayer::PaintThebes(gfxContext* aContext,
                              Layer* aMaskLayer,
                              LayerManager::DrawThebesLayerCallback aCallback,
                              void* aCallbackData,
                              ReadbackProcessor* aReadback)
{
  PROFILER_LABEL("BasicThebesLayer", "PaintThebes");
  NS_ASSERTION(BasicManager()->InDrawing(),
               "Can only draw in drawing phase");
  nsRefPtr<gfxASurface> targetSurface = aContext->CurrentSurface();

  if (!mContentClient) {
    MOZ_ASSERT(!AsShadowableLayer() ||
                 !static_cast<BasicShadowableThebesLayer*>(AsShadowableLayer())->HasShadow(),
               "OMTC layers must have a content client by now");
    // we pass a null pointer for the Forwarder argument, which means
    // this will not have a ContentHost on the other side.
    mContentClient = new ContentClientBasic(nullptr, BasicManager());
  }

  nsTArray<ReadbackProcessor::Update> readbackUpdates;
  if (aReadback && UsedForReadback()) {
    aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
  }
  //TODO: This is going to copy back pixels that we might end up
  // drawing over anyway. It would be nice if we could avoid
  // this duplication.
  mContentClient->SyncFrontBufferToBackBuffer();

  bool canUseOpaqueSurface = CanUseOpaqueSurface();
  ContentType contentType =
    canUseOpaqueSurface ? gfxASurface::CONTENT_COLOR :
                          gfxASurface::CONTENT_COLOR_ALPHA;
  float opacity = GetEffectiveOpacity();
  
  if (!BasicManager()->IsRetained()) {
    NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer");

    mValidRegion.SetEmpty();
    mContentClient->Clear();

    nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext);

    RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds());

    if (!toDraw.IsEmpty() && !IsHidden()) {
      if (!aCallback) {
        BasicManager()->SetTransactionIncomplete();
        return;
      }

      aContext->Save();

      bool needsClipToVisibleRegion = GetClipToVisibleRegion();
      bool needsGroup =
          opacity != 1.0 || GetOperator() != gfxContext::OPERATOR_OVER || aMaskLayer;
      nsRefPtr<gfxContext> groupContext;
      if (needsGroup) {
        groupContext =
          BasicManager()->PushGroupForLayer(aContext, this, toDraw,
                                            &needsClipToVisibleRegion);
        if (GetOperator() != gfxContext::OPERATOR_OVER) {
          needsClipToVisibleRegion = true;
        }
      } else {
        groupContext = aContext;
      }
      SetAntialiasingFlags(this, groupContext);
      aCallback(this, groupContext, toDraw, nsIntRegion(), aCallbackData);
      if (needsGroup) {
        BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext);
        if (needsClipToVisibleRegion) {
          gfxUtils::ClipToRegion(aContext, toDraw);
        }
        AutoSetOperator setOperator(aContext, GetOperator());
        PaintWithMask(aContext, opacity, aMaskLayer);
      }

      aContext->Restore();
    }

    RenderTraceInvalidateEnd(this, "FFFF00");
    return;
  }

  {
    uint32_t flags = 0;
#ifndef MOZ_WIDGET_ANDROID
    if (BasicManager()->CompositorMightResample()) {
      flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
    }
    if (!(flags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE)) {
      if (MayResample()) {
        flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
      }
    }
#endif
    if (mDrawAtomically) {
      flags |= ThebesLayerBuffer::PAINT_NO_ROTATION;
    }
    PaintState state =
      mContentClient->BeginPaintBuffer(this, contentType, flags);
    mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);

    if (state.mContext) {
      // The area that became invalid and is visible needs to be repainted
      // (this could be the whole visible area if our buffer switched
      // from RGB to RGBA, because we might need to repaint with
      // subpixel AA)
      state.mRegionToInvalidate.And(state.mRegionToInvalidate,
                                    GetEffectiveVisibleRegion());
      nsIntRegion extendedDrawRegion = state.mRegionToDraw;
      SetAntialiasingFlags(this, state.mContext);

      RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds());

      PaintBuffer(state.mContext,
                  state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate,
                  state.mDidSelfCopy,
                  aCallback, aCallbackData);
      MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this));
      Mutated();

      RenderTraceInvalidateEnd(this, "FFFF00");
    } else {
      // It's possible that state.mRegionToInvalidate is nonempty here,
      // if we are shrinking the valid region to nothing. So use mRegionToDraw
      // instead.
      NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(),
                       "No context when we have something to draw, resource exhaustion?");
    }
  }

  if (BasicManager()->IsTransactionIncomplete())
    return;

  gfxRect clipExtents;
  clipExtents = aContext->GetClipExtents();

  // Pull out the mask surface and transform here, because the mask
  // is internal to basic layers
  AutoMaskData mask;
  gfxASurface* maskSurface = nullptr;
  const gfxMatrix* maskTransform = nullptr;
  if (GetMaskData(aMaskLayer, &mask)) {
    maskSurface = mask.GetSurface();
    maskTransform = &mask.GetTransform();
  }

  if (!IsHidden() && !clipExtents.IsEmpty()) {
    AutoSetOperator setOperator(aContext, GetOperator());
    mContentClient->DrawTo(this, aContext, opacity, maskSurface, maskTransform);
  }

  for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) {
    ReadbackProcessor::Update& update = readbackUpdates[i];
    nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset();
    nsRefPtr<gfxContext> ctx =
      update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset,
                                            update.mSequenceCounter);
    if (ctx) {
      NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers");
      ctx->Translate(gfxPoint(offset.x, offset.y));
      mContentClient->DrawTo(this, ctx, 1.0, maskSurface, maskTransform);
      update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset);
    }
  }
}
Esempio n. 13
0
bool ETHRenderEntity::DrawProjShadow(const float maxHeight, const float minHeight, const ETHSceneProperties& sceneProps, const ETHLight& light, ETHSpriteEntity *pParent,
									 const bool maxOpacity, const bool drawToTarget, const float targetAngle, const Vector3& v3TargetPos)
{
	if (!m_pSprite || IsHidden())
		return false;

	VideoPtr video = m_provider->GetVideo();
	ETHShaderManagerPtr shaderManager = m_provider->GetShaderManager();
	SpritePtr pShadow = shaderManager->GetProjShadow();

	Vector3 v3LightPos;
	Vector3 v3ParentPos(0,0,0);

	const Vector3 v3EntityPos = GetPosition();

	if (pParent)
	{
		v3ParentPos = pParent->GetPosition();
		v3LightPos = Vector3(v3ParentPos.x, v3ParentPos.y, 0) + light.pos;
	}
	else
	{
		v3LightPos = light.pos;
	}

	// if the object is higher than the light, then the shadow shouldn't be cast on the floor
	if (v3LightPos.z < v3EntityPos.z)
	{
		return true;
	}

	const float scale = (m_properties.shadowScale <= 0.0f) ? 1.0f : m_properties.shadowScale;
	const float opacity = (m_properties.shadowOpacity <= 0.0f) ? 1.0f : m_properties.shadowOpacity;
	const Vector2 v2Size = GetCurrentSize();
	Vector2 v2ShadowSize(v2Size.x, v2Size.y);
	Vector2 v2ShadowPos(v3EntityPos.x, v3EntityPos.y);

	// if we are drawing to a target of a rotated entity
	if (drawToTarget && targetAngle != 0)
	{
		// rotate the shadow position according to entity angle
		Matrix4x4 matRot = RotateZ(-DegreeToRadian(targetAngle));
		Vector3 newShadowPos(v2ShadowPos, 0);
		newShadowPos = newShadowPos - v3TargetPos;
		newShadowPos = Multiply(newShadowPos, matRot);
		newShadowPos = newShadowPos + v3TargetPos;
		v2ShadowPos.x = newShadowPos.x;
		v2ShadowPos.y = newShadowPos.y;

		// rotate the light source to cast it correctly
		Vector3 newPos = v3LightPos - v3TargetPos;
		newPos = Multiply(newPos, matRot);
		v3LightPos = newPos + v3TargetPos;
	}

	Vector3 diff = v3EntityPos - v3LightPos;
	const float squaredDist = DP3(diff, diff);
	float squaredRange = light.range * light.range;

	if (squaredDist > squaredRange)
	{
		return true;
	}

	v2ShadowSize.x *= _ETH_SHADOW_SCALEX * scale;

	// calculate the correct shadow lenght according to the light height
	if ((GetPosition().z+v2Size.y) < light.pos.z) // if the light is over the entity
	{
		const float planarDist = Distance(GetPositionXY(), ETHGlobal::ToVector2(v3LightPos));
		const float verticalDist = Abs((v3EntityPos.z+v2Size.y)-v3LightPos.z);
		const float totalDist = (planarDist/verticalDist)*Abs(v3LightPos.z);
		v2ShadowSize.y = totalDist-planarDist;

		// clamp shadow lenght to the object's height. This is not realistic
		// but it looks better for the real-time shadows.
		v2ShadowSize.y = Min(v2Size.y*_ETH_SHADOW_FAKE_STRETCH, v2ShadowSize.y);
	}
	else
	{
		v2ShadowSize.y *= ((drawToTarget) ? _ETH_SHADOW_SCALEY : _ETH_SHADOW_SCALEY/4);
	}

	// specify a minimum length for the shadow
	v2ShadowSize.y = Max(v2ShadowSize.y, v2Size.y);

	ShaderPtr pVS = video->GetVertexShader();
	pVS->SetConstant(GS_L("shadowLength"), v2ShadowSize.y * m_properties.shadowLengthScale);
	pVS->SetConstant(GS_L("entityZ"), Max(m_shadowZ, v3EntityPos.z));
	pVS->SetConstant(GS_L("shadowZ"), m_shadowZ);
	pVS->SetConstant(GS_L("lightPos"), v3LightPos);
	video->SetSpriteDepth(
		(GetType() == ETH_VERTICAL) ?
		ETHGlobal::ComputeDepth(m_shadowZ, maxHeight, minHeight)
		: Max(0.0f, ComputeDepth(maxHeight, minHeight) - m_layrableMinimumDepth));

	v2ShadowSize.y = 1.0f;

	Vector2 lightPos2(v3LightPos.x, v3LightPos.y);
	const float shadowAngle = ::GetAngle((lightPos2 - Vector2(v3EntityPos.x, v3EntityPos.y))) + DegreeToRadian(targetAngle);

	squaredRange = Max(squaredDist, squaredRange);
	float attenBias = 1;

	// adjust brightness according to ambient light
	if (!maxOpacity)
	{
		attenBias = (1-(squaredDist/squaredRange));
		//fade the color according to the light brightness
		const float colorLen = Max(Max(light.color.x, light.color.y), light.color.z);
		attenBias *= Min(colorLen, 1.0f);

		//fade the color according to the ambient light brightness
		const Vector3 &ambientColor = sceneProps.ambient;
		const float ambientColorLen = 1.0f-((ambientColor.x + ambientColor.y + ambientColor.z)/3.0f);
		attenBias = Min(attenBias*ambientColorLen, 1.0f);
		attenBias *= Max(Min((1-(GetPosition().z/Max(GetCurrentSize().y, 1.0f))), 1.0f), 0.0f);
	}

	GS_BYTE alpha = static_cast<GS_BYTE>(attenBias*255.0f*opacity);

	if (alpha < 8)
		return true;

	GS_COLOR dwShadowColor(alpha,255,255,255);

	pShadow->SetOrigin(Vector2(0.5f, 0.79f));
	pShadow->SetRectMode(GSRM_THREE_TRIANGLES);
	pShadow->DrawShaped(v2ShadowPos, v2ShadowSize,
		dwShadowColor, dwShadowColor, dwShadowColor, dwShadowColor,
		RadianToDegree(shadowAngle));

	return true;
}
Esempio n. 14
0
/*! \brief BMASK command handler
 *
 * \param source_p Pointer to allocated Client struct from which the message
 *                 originally comes from.  This can be a local or remote client.
 * \param parc     Integer holding the number of supplied arguments.
 * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
 *                 pointers.
 * \note Valid arguments for this command are:
 *      - parv[0] = command
 *      - parv[1] = timestamp
 *      - parv[2] = channel name
 *      - parv[3] = type of ban to add ('b' 'I' or 'e')
 *      - parv[4] = space delimited list of masks to add
 */
static int
ms_bmask(struct Client *source_p, int parc, char *parv[])
{
  char modebuf[IRCD_BUFSIZE] = "";
  char parabuf[IRCD_BUFSIZE] = "";
  char banbuf[IRCD_BUFSIZE] = "";
  struct Channel *chptr = NULL;
  char *s, *t, *mbuf, *pbuf;
  unsigned int mode_type = 0;
  int mlen = 0, tlen = 0;
  int modecount = 0;

  if ((chptr = hash_find_channel(parv[2])) == NULL)
    return 0;

  /* TS is higher, drop it. */
  if (atol(parv[1]) > chptr->creationtime)
    return 0;

  switch (*parv[3])
  {
    case 'b':
      mode_type = CHFL_BAN;
      break;
    case 'e':
      mode_type = CHFL_EXCEPTION;
      break;
    case 'I':
      mode_type = CHFL_INVEX;
      break;
    default:
      return 0;
  }

  strlcpy(banbuf, parv[4], sizeof(banbuf));
  s = banbuf;

  mlen = snprintf(modebuf, sizeof(modebuf), ":%s MODE %s +",
                  (IsHidden(source_p) || ConfigServerHide.hide_servers) ? me.name : source_p->name,
                  chptr->name);
  mbuf = modebuf + mlen;
  pbuf = parabuf;

  do
  {
    if ((t = strchr(s, ' ')))
      *t++ = '\0';
    tlen = strlen(s);

    /* I don't even want to begin parsing this.. */
    if (tlen > MODEBUFLEN)
      break;

    if (tlen && *s != ':' && add_id(source_p, chptr, s, mode_type))
    {
      /* this new one wont fit.. */
      if (mbuf - modebuf + 2 + pbuf - parabuf + tlen > IRCD_BUFSIZE - 2 ||
          modecount >= MAXMODEPARAMS)
      {
        *mbuf = *(pbuf - 1) = '\0';

        sendto_channel_local(0, chptr, "%s %s", modebuf, parabuf);
        mbuf = modebuf + mlen;
        pbuf = parabuf;
        modecount = 0;
      }

      *mbuf++ = *parv[3];
      pbuf += sprintf(pbuf, "%s ", s);
      ++modecount;
    }

    s = t;
  } while (s);

  if (modecount)
  {
    *mbuf = *(pbuf - 1) = '\0';
    sendto_channel_local(0, chptr, "%s %s", modebuf, parabuf);
  }

  sendto_server(source_p, NOCAPS, NOCAPS, ":%s BMASK %lu %s %s :%s",
                source_p->id, (unsigned long)chptr->creationtime, chptr->name,
                parv[3], parv[4]);
  return 0;
}
Esempio n. 15
0
bool wxDirData::Read(
  wxString*                         psFilename
)
{
    bool                            bFirst = false;

    FILEFINDBUF3                    vFinddata;
    #define PTR_TO_FINDDATA (&vFinddata)

    if (!IsFindDataOk(m_vFinddata))
    {
        //
        // Open first
        //
        wxString                    sFilespec = m_sDirname;

        if ( !wxEndsWithPathSeparator(sFilespec) )
        {
            sFilespec += wxT('\\');
        }
        sFilespec += (!m_sFilespec ? wxT("*.*") : m_sFilespec.c_str());

        m_vFinddata = FindFirst( sFilespec
                                ,PTR_TO_FINDDATA
                               );
        bFirst = true;
    }

    if ( !IsFindDataOk(m_vFinddata) )
    {
        return false;
    }

    const wxChar*                   zName;
    FIND_ATTR                       vAttr;

    for ( ;; )
    {
        if (bFirst)
        {
            bFirst = false;
        }
        else
        {
            if (!FindNext( m_vFinddata
                          ,PTR_TO_FINDDATA
                         ))
            {
                return false;
            }
        }

        zName = GetNameFromFindData(PTR_TO_FINDDATA);
        vAttr = GetAttrFromFindData(PTR_TO_FINDDATA);

        //
        // Don't return "." and ".." unless asked for
        //
        if ( zName[0] == wxT('.') &&
             ((zName[1] == wxT('.') && zName[2] == wxT('\0')) ||
              (zName[1] == wxT('\0'))) )
        {
            if (!(m_nFlags & wxDIR_DOTDOT))
                continue;
        }

        //
        // Check the type now
        //
        if (!(m_nFlags & wxDIR_FILES) && !IsDir(vAttr))
        {
            //
            // It's a file, but we don't want them
            //
            continue;
        }
        else if (!(m_nFlags & wxDIR_DIRS) && IsDir(vAttr) )
        {
            //
            // It's a dir, and we don't want it
            //
            continue;
        }

        //
        // Finally, check whether it's a hidden file
        //
        if (!(m_nFlags & wxDIR_HIDDEN))
        {
            if (IsHidden(vAttr))
            {
                //
                // It's a hidden file, skip it
                //
                continue;
            }
        }
        *psFilename = zName;
        break;
    }
    return true;
} // end of wxDirData::Read
Esempio n. 16
0
AUI_ERRCODE c3_Icon::DrawThis(
	aui_Surface *surface,
	sint32 x,
	sint32 y )
{
	
	if ( IsHidden() ) return AUI_ERRCODE_OK;

	if ( !surface ) surface = m_window->TheSurface();

	RECT rect = { 0, 0, m_width, m_height };
	OffsetRect( &rect, m_x + x, m_y + y );
	ToWindow( &rect );

	
	if ( m_pattern ) 
		m_pattern->Draw( surface, &rect );

	
	DrawThisStateImage(
		0,
		surface,
		&rect );

	
	if (m_mapIcon != MAPICON_MAX) {
		if (m_color != COLOR_MAX) {
			POINT where;
			TileSet		*tileSet = g_tiledMap->GetTileSet();
			POINT iconDim = tileSet->GetMapIconDimensions( m_mapIcon );

			
			where.x = ( m_width - iconDim.x ) / 2;
			if (where.x < 0) where.x = 0;
			where.y = ( m_height - iconDim.y ) / 2;
			if (where.y < 0) where.y = 0;

			where.x += rect.left;
			where.y += rect.top;
			
			
			Pixel16 *icon;

			icon = tileSet->GetMapIconData( m_mapIcon );
			Assert(icon); 
			if (!icon) return AUI_ERRCODE_OK;

			g_tiledMap->DrawColorizedOverlay( icon, surface, where.x, where.y, g_colorSet->GetColor(m_color) );
		}
	}

	
	if (m_bevelWidth > 0) {
		primitives_BevelRect16( surface, &rect, m_bevelWidth, m_bevelType, 16, 16 );
	}

	
	DrawThisText(
		surface,
		&rect );

	if ( surface == m_window->TheSurface() )
		m_window->AddDirtyRect( &rect );

	return AUI_ERRCODE_OK;
}
Esempio n. 17
0
void ToolTipWindow::Bye(){
   Lock();
   while(!IsHidden()){ Hide(); }
   Unlock();
}
Esempio n. 18
0
void
MainWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kSearchContact:
		{
			void* control = NULL;
			if (message->FindPointer("source", &control) != B_OK)
				return;

			SearchBarTextControl* searchBox 
				= static_cast<SearchBarTextControl*>(control);
			if (searchBox == NULL)
				return;

			RosterMap map = fServer->RosterItems();
			for (uint32 i = 0; i < map.CountItems(); i++) {
				ContactLinker* linker = map.ValueAt(i);
				RosterItem* item = linker->GetRosterItem();

				// If the search filter has been deleted show all the items,
				// otherwise remove the item in order to show only items
				// that matches the search criteria
				if (strcmp(searchBox->Text(), "") == 0)
					AddItem(item);
				else if (linker->GetName().IFindFirst(searchBox->Text()) == B_ERROR)
					RemoveItem(item);
				else
					AddItem(item);
				UpdateListItem(item);
			}
			break;
		}
		case CAYA_SHOW_SETTINGS:
		{
			PreferencesDialog* dialog = new PreferencesDialog();
			dialog->Show();
			break;
		}
		case CAYA_OPEN_CHAT_WINDOW:
		{
			int index = message->FindInt32("index");
			RosterItem* ritem = ItemAt(index);
			if (ritem != NULL)
				ritem->GetContactLinker()->ShowWindow(false, true);
			break;
		}

		case CAYA_REPLICANT_STATUS_SET:
		{
			int32 status;
			message->FindInt32("status", &status);
			AccountManager* accountManager = AccountManager::Get();
			accountManager->SetStatus((CayaStatus)status);
			break;
		}

		case CAYA_REPLICANT_SHOW_WINDOW:
		{
			if (LockLooper()) {
				SetWorkspaces(B_CURRENT_WORKSPACE);
				
				if ((IsMinimized() || IsHidden()) 
					|| fWorkspaceChanged) {
					Minimize(false);
					Show();
					fWorkspaceChanged = false;
				} else if ((!IsMinimized() || !IsHidden())
					|| (!fWorkspaceChanged)) {
					Minimize(true);
				}
				UnlockLooper();
			}
			break;
		}

		case IM_MESSAGE:
			ImMessage(message);
			break;
		case IM_ERROR:
			ImError(message);
			break;
		case B_ABOUT_REQUESTED:
			be_app->PostMessage(message);
			break;

		default:
			BWindow::MessageReceived(message);
	}
}
Esempio n. 19
0
bool FileUtils::IsHidden(const wxString& filename)
{
    return IsHidden(filename);
}
Esempio n. 20
0
/*! \brief TBURST command handler
 *
 * \param source_p Pointer to allocated Client struct from which the message
 *                 originally comes from.  This can be a local or remote client.
 * \param parc     Integer holding the number of supplied arguments.
 * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
 *                 pointers.
 * \note Valid arguments for this command are:
 *      - parv[0] = command
 *      - parv[1] = channel timestamp
 *      - parv[2] = channel name
 *      - parv[3] = topic timestamp
 *      - parv[4] = topic setter
 *      - parv[5] = topic
 */
static int
ms_tburst(struct Client *source_p, int parc, char *parv[])
{
    struct Channel *chptr = NULL;
    int accept_remote = 0;
    time_t remote_channel_ts = atol(parv[1]);
    time_t remote_topic_ts = atol(parv[3]);
    const char *topic = parv[5];
    const char *setby = parv[4];

    /*
     * Do NOT test parv[5] for an empty string and return if true!
     * parv[5] CAN be an empty string, i.e. if the other side wants
     * to unset our topic.  Don't forget: an empty topic is also a
     * valid topic.
     */


    if ((chptr = hash_find_channel(parv[2])) == NULL)
        return 0;

    /*
     * The logic for accepting and rejecting channel topics was
     * always a bit hairy, so now we got exactly 3 cases where
     * we would accept a topic
     *
     * Case 1:
     *        A services client/server wants to set a topic
     * Case 2:
     *        The TS of the remote channel is older than ours
     * Case 3:
     *        The TS of the remote channel is equal to ours AND
     *        the TS of the remote topic is newer than ours
     */
    if (HasFlag(source_p, FLAGS_SERVICE))
        accept_remote = 1;
    else if (remote_channel_ts < chptr->creationtime)
        accept_remote = 1;
    else if (remote_channel_ts == chptr->creationtime)
        if (remote_topic_ts > chptr->topic_time)
            accept_remote = 1;

    if (accept_remote)
    {
        int topic_differs = strncmp(chptr->topic, topic, sizeof(chptr->topic) - 1);
        int hidden_server = (ConfigServerHide.hide_servers || IsHidden(source_p));

        channel_set_topic(chptr, topic, setby, remote_topic_ts, 0);

        sendto_server(source_p, CAPAB_TBURST, 0, ":%s TBURST %s %s %s %s :%s",
                      source_p->id, parv[1], parv[2], parv[3], setby, topic);

        if (topic_differs)
        {
            if (!IsClient(source_p))
                sendto_channel_local(0, chptr, ":%s TOPIC %s :%s",
                                     hidden_server ? me.name : source_p->name,
                                     chptr->name, chptr->topic);
            else
                sendto_channel_local(0, chptr, ":%s!%s@%s TOPIC %s :%s",
                                     source_p->name, source_p->username, source_p->host,
                                     chptr->name, chptr->topic);
        }
    }

    return 0;
}
Esempio n. 21
0
void PluginUIWindow::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case JE_LOAD_UI:
		{
			void *view = NULL;
			
			if (msg->FindPointer("view", &view) == B_OK)
			{
				//printf("PluginUIWindow::MessageReceived(JE_LOAD_UI)\n");
				//printf("view = %p\n", view);
				// show the window if we're hidden
				if (IsHidden())
					Show();
				// swap out the view
				//pluginUI->SwapView(reinterpret_cast<BView *>(view));
				SwapView(reinterpret_cast<BView *>(view));
			}
			
			break;
		}
		case JE_UNLOAD_UI:
		{
			//printf("PluginUIWindow::MessageReceived(JE_UNLOAD_UI)\n");
			int32 kill=0;
			
			// just send it a NULL pointer
			//pluginUI->SwapView(NULL);
			SwapView(NULL);
			
			// hide the window (unless it's already hidden)
			if (!IsHidden())
				Hide();
			
			// we only unload the plugin if "kill" is in the msg
			// otherwise we just unload the UI here
			if (msg->FindInt32("kill", &kill) == B_OK)
			{
				BMessage app_msg(*msg); // copy
				// change the 'what' of app_msg
				app_msg.what = JE_UNLOAD_PLUGIN;
				// send
				be_app->PostMessage(&app_msg);
			}
			
			break;
		}
		case JE_APP_IS_QUITTING:
		{
			// we're quitting
			// it's now ok to kill ourself
			okToClose = true;
			PostMessage(B_QUIT_REQUESTED);
		}
		default:
		{
			BWindow::MessageReceived(msg);
			break;
		}
	}
}
Esempio n. 22
0
void KouhoWindow::MessageReceived( BMessage* msg )
{
	float height, width, x, y, w;
	BPoint point;
	BRect screenrect, frame;

	switch( msg->what )
	{
		case KOUHO_WINDOW_HIDE:
#ifdef DEBUG
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n" ));
#endif
			if ( !IsHidden() )
			{
				Hide();
				standalone_mode = false;
			}
			break;

		case KOUHO_WINDOW_SHOW:
#ifdef DEBUG
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOW recieved.\n" ));
#endif
			ShowWindow();
			break;

		case KOUHO_WINDOW_SHOW_ALONE:
			standalone_mode = true;
			frame = Frame();
			screenrect = BScreen().Frame();
			frame.OffsetTo( gSettings.standalone_loc.x, gSettings.standalone_loc.y );

			x = screenrect.right - frame.right;
			y = screenrect.bottom - frame.bottom;

			if ( x < 0 )
				frame.OffsetBy( x, 0 );

			if ( y < 0 )
				frame.OffsetBy( 0, y );

			gSettings.standalone_loc.x = frame.left;
			gSettings.standalone_loc.y = frame.top;
			point = frame.LeftTop();
			MoveTo( point );
			ShowWindow();
			break;

		case KOUHO_WINDOW_SHOWAT:
#ifdef DEBUG
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
#endif
			msg->FindPoint( "position", &point );
			msg->FindFloat( "height", &height );
			ShowAt( point, height );
			break;

		case KOUHO_WINDOW_SETTEXT:
			const char* newtext;
			bool hideindex, limitsize;
			msg->FindString( "text", &newtext );
			kouhoView->SetText( newtext );

			msg->FindBool( "index", &hideindex );
			indexView->HideNumberDisplay( hideindex );

			msg->FindBool( "limit", &limitsize );
			height = kouhoView->TextHeight( 0, kouhoView->TextLength() );
			height += INFOVIEW_HEIGHT;

			msg->FindString( "info", &newtext );
			infoView->SetText( newtext );
			// calculate widest line width
			width = 0;
			for ( int32 line = 0, numlines = kouhoView->CountLines() ;
				line < numlines ; line++ )
			{
				w = kouhoView->LineWidth( line );
				if ( w > width )
					width = w;
			}
			if ( limitsize && width < minimumWidth )
				width = minimumWidth;
			ResizeTo( width + indexWidth + KOUHOVIEW_SIDE_MARGIN, height );

			if ( msg->HasBool( "partial" ) )
			{
				int32 begin, end;
				msg->FindInt32( "revbegin", &begin );
				msg->FindInt32( "revend", &end );
				kouhoView->HighlightPartial( begin, end );
#ifdef DEBUG
SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to %d\n", begin, end ));
#endif
			}
			else
			{
				int32 kouhorevline;
				msg->FindInt32( "kouhorev", &kouhorevline );
				kouhoView->HighlightLine( kouhorevline );
			}

			break;

		case NUM_SELECTED_FROM_KOUHO_WIN:
			cannaLooper->PostMessage( msg );
			break;

		default:
			BWindow::MessageReceived( msg );
	}
}
Esempio n. 23
0
/*
================
idExplodingBarrel::Killed
================
*/
void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ) {

	if ( IsHidden() || state == EXPLODING || state == BURNING ) {
		return;
	}

	float f = spawnArgs.GetFloat( "burn" );
	if ( f > 0.0f && state == NORMAL ) {
		state = BURNING;
		PostEventSec( &EV_Explode, f );
		StartSound( "snd_burn", SND_CHANNEL_ANY, 0, false, NULL );
		AddParticles( spawnArgs.GetString ( "model_burn", "" ), true );
		return;
	} else {
		state = EXPLODING;
		if ( gameLocal.isServer ) {
			idBitMsg	msg;
			byte		msgBuf[MAX_EVENT_PARAM_SIZE];

			msg.Init( msgBuf, sizeof( msgBuf ) );
			msg.WriteLong( gameLocal.time );
			ServerSendEvent( EVENT_EXPLODE, &msg, false, -1 );
		}		
	}

	// do this before applying radius damage so the ent can trace to any damagable ents nearby
	Hide();
	physicsObj.SetContents( 0 );

	const char *splash = spawnArgs.GetString( "def_splash_damage", "damage_explosion" );
	if ( splash && *splash ) {
		gameLocal.RadiusDamage( GetPhysics()->GetOrigin(), this, attacker, this, this, splash );
	}

	ExplodingEffects( );
	
	//FIXME: need to precache all the debris stuff here and in the projectiles
	const idKeyValue *kv = spawnArgs.MatchPrefix( "def_debris" );
	// bool first = true;
	while ( kv ) {
		const idDict *debris_args = gameLocal.FindEntityDefDict( kv->GetValue(), false );
		if ( debris_args ) {
			idEntity *ent;
			idVec3 dir;
			idDebris *debris;
			//if ( first ) {
				dir = physicsObj.GetAxis()[1];
			//	first = false;
			//} else {
				dir.x += gameLocal.random.CRandomFloat() * 4.0f;
				dir.y += gameLocal.random.CRandomFloat() * 4.0f;
				//dir.z = gameLocal.random.RandomFloat() * 8.0f;
			//}
			dir.Normalize();

			gameLocal.SpawnEntityDef( *debris_args, &ent, false );
			if ( !ent || !ent->IsType( idDebris::Type ) ) {
				gameLocal.Error( "'projectile_debris' is not an idDebris" );
			}

			debris = static_cast<idDebris *>(ent);
			debris->Create( this, physicsObj.GetOrigin(), dir.ToMat3() );
			debris->Launch();
			debris->GetRenderEntity()->shaderParms[ SHADERPARM_TIME_OF_DEATH ] = ( gameLocal.time + 1500 ) * 0.001f;
			debris->UpdateVisuals();
			
		}
		kv = spawnArgs.MatchPrefix( "def_debris", kv );
	}

	physicsObj.PutToRest();
	CancelEvents( &EV_Explode );
	CancelEvents( &EV_Activate );

	f = spawnArgs.GetFloat( "respawn" );
	if ( f > 0.0f ) {
		PostEventSec( &EV_Respawn, f );
	} else {
		PostEventMS( &EV_Remove, 5000 );
	}

	if ( spawnArgs.GetBool( "triggerTargets" ) ) {
		ActivateTargets( this );
	}
}
Esempio n. 24
0
/*
** m_whois
**	parv[0] = sender prefix
**	parv[1] = nickname masklist
*/
DLLFUNC int  m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	Membership *lp;
	anUser *user;
	aClient *acptr, *a2cptr;
	aChannel *chptr;
	char *nick, *tmp, *name;
	char *p = NULL;
	int  found, len, mlen, cnt = 0;
	char querybuf[BUFSIZE];

	if (IsServer(sptr))	
		return 0;

	if (parc < 2)
	{
		sendto_one(sptr, err_str(ERR_NONICKNAMEGIVEN),
		    me.name, parv[0]);
		return 0;
	}

	if (parc > 2)
	{
		if (hunt_server(cptr, sptr, ":%s WHOIS %s :%s", 1, parc, parv) != HUNTED_ISME)
			return 0;
		parv[1] = parv[2];
	}

	strcpy(querybuf, parv[1]);

	for (tmp = canonize(parv[1]); (nick = strtok_r(tmp, ",", &p)); tmp = NULL)
	{
		unsigned char invis, showchannel, member, wilds, hideoper; /* <- these are all boolean-alike */

		if (++cnt > MAXTARGETS)
			break;

		found = 0;
		/* We do not support "WHOIS *" */
		wilds = (index(nick, '?') || index(nick, '*'));
		if (wilds)
			continue;

		if ((acptr = find_client(nick, NULL)))
		{
			if (IsServer(acptr))
				continue;
			/*
			 * I'm always last :-) and acptr->next == NULL!!
			 */
			if (IsMe(acptr))
				break;
			/*
			 * 'Rules' established for sending a WHOIS reply:
			 * - only send replies about common or public channels
			 *   the target user(s) are on;
			 */

			if (!IsPerson(acptr))
				continue;

			user = acptr->user;
			name = (!*acptr->name) ? "?" : acptr->name;

			invis = acptr != sptr && IsInvisible(acptr);
			member = (user->channel) ? 1 : 0;

			a2cptr = find_server_quick(user->server);

			hideoper = 0;
			if (IsHideOper(acptr) && (acptr != sptr) && !IsAnOper(sptr))
				hideoper = 1;

			if (IsWhois(acptr) && (sptr != acptr))
			{
				sendnotice(acptr,
				    "*** %s (%s@%s) did a /whois on you.",
				    sptr->name,
				    sptr->user->username, sptr->user->realhost);
			}
			sendto_one(sptr, rpl_str(RPL_WHOISUSER), me.name,
			    parv[0], name,
			    user->username,
			    IsHidden(acptr) ? user->virthost : user->realhost,
			    acptr->info);

			if (IsOper(sptr) || acptr == sptr)
			{
				char sno[512];
				strcpy(sno, get_sno_str(acptr));
				
				/* send the target user's modes */
				sendto_one(sptr, rpl_str(RPL_WHOISMODES),
				    me.name, parv[0], name,
				    get_mode_str(acptr), sno[1] == 0 ? "" : sno);
			}
			if ((acptr == sptr) || IsAnOper(sptr))
			{
				sendto_one(sptr, rpl_str(RPL_WHOISHOST),
				    me.name, parv[0], acptr->name,
					(MyConnect(acptr) && strcmp(acptr->username, "unknown")) ? acptr->username : "******",
					user->realhost, user->ip_str ? user->ip_str : "");
			}

			if (IsARegNick(acptr))
				sendto_one(sptr, rpl_str(RPL_WHOISREGNICK), me.name, parv[0], name);
			
			found = 1;
			mlen = strlen(me.name) + strlen(parv[0]) + 10 + strlen(name);
			for (len = 0, *buf = '\0', lp = user->channel; lp; lp = lp->next)
			{
				chptr = lp->chptr;
				showchannel = 0;
				if (ShowChannel(sptr, chptr))
					showchannel = 1;
				if (OPCanSeeSecret(sptr))
					showchannel = 1;
				if ((acptr->umodes & UMODE_HIDEWHOIS) && !IsMember(sptr, chptr) && !IsAnOper(sptr))
					showchannel = 0;
				if (IsServices(acptr) && !IsNetAdmin(sptr) && !IsSAdmin(sptr))
					showchannel = 0;
				if (acptr == sptr)
					showchannel = 1;
				/* Hey, if you are editting here... don't forget to change the webtv w_whois ;p. */

				if (showchannel)
				{
					long access;
					if (len + strlen(chptr->chname) > (size_t)BUFSIZE - 4 - mlen)
					{
						sendto_one(sptr,
						    ":%s %d %s %s :%s",
						    me.name,
						    RPL_WHOISCHANNELS,
						    parv[0], name, buf);
						*buf = '\0';
						len = 0;
					}
#ifdef SHOW_SECRET
					if (IsAnOper(sptr)
#else
					if (IsNetAdmin(sptr)
#endif
					    && SecretChannel(chptr) && !IsMember(sptr, chptr))
						*(buf + len++) = '?';
					if (acptr->umodes & UMODE_HIDEWHOIS && !IsMember(sptr, chptr)
						&& IsAnOper(sptr))
						*(buf + len++) = '!';
					access = get_access(acptr, chptr);
					if (!SupportNAMESX(sptr))
					{
#ifdef PREFIX_AQ
						if (access & CHFL_CHANOWNER)
							*(buf + len++) = '~';
						else if (access & CHFL_CHANPROT)
							*(buf + len++) = '&';
						else
#endif
						if (access & CHFL_CHANOP)
							*(buf + len++) = '@';
						else if (access & CHFL_HALFOP)
							*(buf + len++) = '%';
						else if (access & CHFL_VOICE)
							*(buf + len++) = '+';
					}
					else
					{
#ifdef PREFIX_AQ
						if (access & CHFL_CHANOWNER)
							*(buf + len++) = '~';
						if (access & CHFL_CHANPROT)
							*(buf + len++) = '&';
#endif
						if (access & CHFL_CHANOP)
							*(buf + len++) = '@';
						if (access & CHFL_HALFOP)
							*(buf + len++) = '%';
						if (access & CHFL_VOICE)
							*(buf + len++) = '+';
					}
					if (len)
						*(buf + len) = '\0';
					(void)strcpy(buf + len, chptr->chname);
					len += strlen(chptr->chname);
					(void)strcat(buf + len, " ");
					len++;
				}
			}

			if (buf[0] != '\0')
				sendto_one(sptr, rpl_str(RPL_WHOISCHANNELS), me.name, parv[0], name, buf); 

                        if (!(IsULine(acptr) && !IsOper(sptr) && HIDE_ULINES))
				sendto_one(sptr, rpl_str(RPL_WHOISSERVER),
				    me.name, parv[0], name, user->server,
				    a2cptr ? a2cptr->info : "*Not On This Net*");

			if (user->away)
				sendto_one(sptr, rpl_str(RPL_AWAY), me.name,
				    parv[0], name, user->away);
			/* makesure they aren't +H (we'll also check
			   before we display a helpop or IRCD Coder msg)
			   -- codemastr */

			if ((IsAnOper(acptr) || IsServices(acptr)) && !hideoper)
			{
				buf[0] = '\0';
				if (IsNetAdmin(acptr))
					strlcat(buf, "a Network Administrator", sizeof buf);
				else if (IsSAdmin(acptr))
					strlcat(buf, "a Services Administrator", sizeof buf);
				else if (IsAdmin(acptr) && !IsCoAdmin(acptr))
					strlcat(buf, "a Server Administrator", sizeof buf);
				else if (IsCoAdmin(acptr))
					strlcat(buf, "a Co Administrator", sizeof buf);
				else if (IsServices(acptr))
					strlcat(buf, "a Network Service", sizeof buf);
				else if (IsOper(acptr))
					strlcat(buf, "an IRC Operator", sizeof buf);

				else
					strlcat(buf, "a Local IRC Operator", sizeof buf);
				if (buf[0])
				{
					if (IsOper(sptr) && MyClient(acptr))
						sendto_one(sptr,
						    ":%s 313 %s %s :is %s (%s)", me.name,
						    parv[0], name, buf, acptr->user->operlogin);
					else
						sendto_one(sptr,
						    rpl_str(RPL_WHOISOPERATOR), me.name,
						    parv[0], name, buf);
				}
			}

			if (IsHelpOp(acptr) && !hideoper && !user->away)
				sendto_one(sptr, rpl_str(RPL_WHOISHELPOP), me.name, parv[0], name);

			if (acptr->umodes & UMODE_BOT)
				sendto_one(sptr, rpl_str(RPL_WHOISBOT), me.name, parv[0], name, ircnetwork);

			if (acptr->umodes & UMODE_SECURE)
				sendto_one(sptr, rpl_str(RPL_WHOISSECURE), me.name, parv[0], name,
					"is using a Secure Connection");

			if (!BadPtr(user->swhois) && !hideoper)
					sendto_one(sptr, ":%s %d %s %s :%s",
					    me.name, RPL_WHOISSPECIAL, parv[0],
					    name, acptr->user->swhois);

			/*
			 * display services account name if it's actually a services account name and
			 * not a legacy timestamp.  --nenolod
			 */
			if (!isdigit(*user->svid))
				sendto_one(sptr, rpl_str(RPL_WHOISLOGGEDIN), me.name, parv[0], name, user->svid);

			/*
			 * Umode +I hides an oper's idle time from regular users.
			 * -Nath.
			 */
			if (MyConnect(acptr) && (IsAnOper(sptr) || !(acptr->umodes & UMODE_HIDLE)))
			{
				sendto_one(sptr, rpl_str(RPL_WHOISIDLE),
				    me.name, parv[0], name,
				    TStime() - acptr->last, acptr->firsttime);
			}
		}
		if (!found)
			sendto_one(sptr, err_str(ERR_NOSUCHNICK),
			    me.name, parv[0], nick);
	}
	sendto_one(sptr, rpl_str(RPL_ENDOFWHOIS), me.name, parv[0], querybuf);

	return 0;
}
Esempio n. 25
0
bool wxDirData::Read(wxString *filename)
{
    bool first = false;

    WIN32_FIND_DATA finddata;
    #define PTR_TO_FINDDATA (&finddata)

    if ( !IsFindDataOk(m_finddata) )
    {
        // open first
        wxString filespec = m_dirname;
        if ( !wxEndsWithPathSeparator(filespec) )
        {
            filespec += wxT('\\');
        }
        if ( !m_filespec )
            filespec += wxT("*.*");
        else
            filespec += m_filespec;

        m_finddata = FindFirst(filespec, PTR_TO_FINDDATA);

        first = true;
    }

    if ( !IsFindDataOk(m_finddata) )
    {
#ifdef __WIN32__
        DWORD err = ::GetLastError();

        if ( err != ERROR_FILE_NOT_FOUND && err != ERROR_NO_MORE_FILES )
        {
            wxLogSysError(err, _("Cannot enumerate files in directory '%s'"),
                          m_dirname.c_str());
        }
#endif // __WIN32__
        //else: not an error, just no (such) files

        return false;
    }

    const wxChar *name;
    FIND_ATTR attr;

    for ( ;; )
    {
        if ( first )
        {
            first = false;
        }
        else
        {
            if ( !FindNext(m_finddata, PTR_TO_FINDDATA) )
            {
#ifdef __WIN32__
                DWORD err = ::GetLastError();

                if ( err != ERROR_NO_MORE_FILES )
                {
                    wxLogLastError(wxT("FindNext"));
                }
#endif // __WIN32__
                //else: not an error, just no more (such) files

                return false;
            }
        }

        name = GetNameFromFindData(PTR_TO_FINDDATA);
        attr = GetAttrFromFindData(PTR_TO_FINDDATA);

        // don't return "." and ".." unless asked for
        if ( name[0] == wxT('.') &&
             ((name[1] == wxT('.') && name[2] == wxT('\0')) ||
              (name[1] == wxT('\0'))) )
        {
            if ( !(m_flags & wxDIR_DOTDOT) )
                continue;
        }

        // check the type now
        if ( !(m_flags & wxDIR_FILES) && !IsDir(attr) )
        {
            // it's a file, but we don't want them
            continue;
        }
        else if ( !(m_flags & wxDIR_DIRS) && IsDir(attr) )
        {
            // it's a dir, and we don't want it
            continue;
        }

        // finally, check whether it's a hidden file
        if ( !(m_flags & wxDIR_HIDDEN) )
        {
            if ( IsHidden(attr) )
            {
                // it's a hidden file, skip it
                continue;
            }
        }

        *filename = name;

        break;
    }

    return true;
}
Esempio n. 26
0
/*
* D3DParticleSystemUpdateBurst: This functions updates any 'burst' updating
*   particle systems, such as fireworks. Particles are built-up and then
*   released all at once.
*/
void D3DParticleSystemUpdateBurst(particle_system *pParticleSystem, d3d_render_pool_new *pPool,
                                  d3d_render_cache_system *pCacheSystem, Draw3DParams *params)
{
   int curParticle;
   list_type list;
   emitter *pEmitter;
   particle *pParticle;
   bool playedSound = false;

   D3DCacheSystemReset(pCacheSystem);
   D3DRenderPoolReset(pPool, &D3DMaterialParticlePool);

   for (list = pParticleSystem->emitterList; list != NULL; list = list->next)
   {
      pEmitter = (emitter *)list->data;
      if (pEmitter->numParticles >= pEmitter->maxParticles && pEmitter->numAlive > 0)
      {
         //debug(("numparticles is %i\n",pEmitter->numParticles));
         for (curParticle = 0; curParticle < pEmitter->numParticles; curParticle++)
         {
            pParticle = &pEmitter->particles[curParticle];

            if (!D3DParticleIsAlive(pEmitter, pParticle))
               continue;

            // TODO: standardize particle sound effects, for now hardcoded fireworks sound.
            if (!playedSound && curParticle == 0
               && pParticle->energy == pEmitter->energy - 1
               && rand() % 2)
            {
               SoundPlayFile("firework.ogg", 0, pParticle->pos.x, pParticle->pos.y);
               playedSound = true;
            }

            D3DParticleVelocityUpdate(pEmitter, pParticle);

            // If this particle is hidden from the player's view, don't let D3D try to draw it.
            if (!IsHidden(params, (long)pParticle->pos.x, (long)pParticle->pos.y,
                     (long)pParticle->pos.x, (long)pParticle->pos.y))
                     D3DParticleAddToRenderer(pPool, params, pParticleSystem, pParticle);

            // 10% chance to dim color.
            if ((int)rand() % 10 == 1)
            {
               --pParticle->bgra.b;
               --pParticle->bgra.g;
               --pParticle->bgra.r;
            }
         }

         // Emitter moves x, y coords for random fireworks positions.
         D3DParticleRandomizeEmitterPosition(pEmitter);
      }

      // Check timer.
      if (--pEmitter->timer <= 0)
      {
         // Only start another batch if none remaining alive in old.
         if (pEmitter->numAlive <= 0)
         {
            pEmitter->numAlive = 0;
            pEmitter->numParticles = 0;

            // Re-randomize the color.
            pEmitter->bgra.b = FIREWORKS_B;
            pEmitter->bgra.g = FIREWORKS_G;
            pEmitter->bgra.r = FIREWORKS_R;

            for (curParticle = 0; curParticle < pEmitter->maxParticles; curParticle++)
            {
               pParticle = &pEmitter->particles[curParticle];

               if (pParticle->energy == 0)
               {
                  D3DParticleInitPosSpeedSphere(pEmitter, pParticle);
                  D3DParticleInitRotation(pEmitter, pParticle);
                  D3DParticleInitColorEnergy(pEmitter, pParticle);
               }
            }
         }
         pEmitter->timer = pEmitter->timerBase;
      }
   }

   D3DCacheFill(pCacheSystem, pPool, 0);
   D3DCacheFlush(pCacheSystem, pPool, 0, D3DPT_LINESTRIP);
}
Esempio n. 27
0
/*
 * m_userip is based on m_userhost
 * m_userhost added by Darren Reed 13/8/91 to aid clients and reduce
 * the need for complicated requests like WHOIS. It returns user/host
 * information only (no spurious AWAY labels or channels).
 * Re-written by Dianora 1999
 */
DLLFUNC CMD_FUNC(m_userip)
{

	char *p;		/* scratch end pointer */
	char *cn;		/* current name */
	char *ip, ipbuf[HOSTLEN+1];
	struct Client *acptr;
	char response[5][NICKLEN * 2 + CHANNELLEN + USERLEN + HOSTLEN + 30];
	int  i;			/* loop counter */

	if (!MyClient(sptr))
		return -1;
		
	if (parc < 2)
	{
		sendto_one(sptr, rpl_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "USERIP");
		return 0;
	}

	/* The idea is to build up the response string out of pieces
	 * none of this strlen() nonsense.
	 * 5 * (NICKLEN*2+CHANNELLEN+USERLEN+HOSTLEN+30) is still << sizeof(buf)
	 * and our ircsprintf() truncates it to fit anyway. There is
	 * no danger of an overflow here. -Dianora
	 */
	response[0][0] = response[1][0] = response[2][0] =
	    response[3][0] = response[4][0] = '\0';

	cn = parv[1];

	for (i = 0; (i < 5) && cn; i++)
	{
		if ((p = strchr(cn, ' ')))
			*p = '\0';

		if ((acptr = find_person(cn, NULL)))
		{
			if (!(ip = GetIP(acptr)))
				ip = "<unknown>";
			if (sptr != acptr && !IsOper(sptr) && IsHidden(acptr))
			{
				make_virthost(acptr, GetIP(acptr), ipbuf, 0);
				ip = ipbuf;
			}

			ircsprintf(response[i], "%s%s=%c%s@%s",
			    acptr->name,
			    (IsAnOper(acptr) && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr)))
				? "*" : "",
			    (acptr->user->away) ? '-' : '+',
			    acptr->user->username, ip);
			/* add extra fakelag (penalty) because of all the work we need to do: 1s per entry: */
			sptr->since += 1;
		}
		if (p)
			p++;
		cn = p;
	}

	sendto_one(sptr, rpl_str(RPL_USERIP), me.name, parv[0],
	    response[0], response[1], response[2], response[3], response[4]);

	return 0;
}
void CXTPDockingPaneTabbedContainer::OnLButtonDown(UINT /*nFlags*/, CPoint point)
{

	CXTPDockingPaneCaptionButton* pButton = HitTestCaptionButton(point);

	if (pButton)
	{
		_RestoreFocus();

		if (m_pSelectedPane && OnCaptionButtonDown(pButton))
			return;

		if (pButton->Click(this, point) && m_pSelectedPane)
		{
			OnCaptionButtonClick(pButton);
		}

		return;
	}

	if (IsTabsVisible() && PerformClick(m_hWnd, point, TRUE))
		return;

	int nHit = HitTest(point);
	if (nHit == DOCKINGPANE_HITCAPTION && !IsHidden())
	{
		ClientToScreen(&point);
		OnCaptionLButtonDown(point);
	}
	else if (nHit >= 0)
	{
		CXTPDockingPane* pPane = GetItemPane(nHit);
		if (GetDockingPaneManager()->NotifyAction(xtpPaneActionDragging, pPane))
		{
			SelectPane(pPane, TRUE, FALSE);
			PerformMouseMove(m_hWnd, point);
			Invalidate(FALSE);
			return;
		}

		m_lstRects.RemoveAll();
		for (int j = 0; j < GetItemCount(); j++)
		{
			CRect rc(GetItem(j)->GetRect());
			m_lstRects.Add(rc);
		}

		m_pTrackingPane = pPane;
		SelectPane(m_pTrackingPane, TRUE, FALSE);

		PerformMouseMove(m_hWnd, point);

		SetCapture();

		Invalidate(FALSE);
	}
	else
	{
		_RestoreFocus();
	}
}
Esempio n. 29
0
AUI_ERRCODE ctp2_HyperTextBox::DrawThis(
	aui_Surface *surface,
	sint32 x,
	sint32 y )
{
	
	if ( IsHidden() ) return AUI_ERRCODE_OK;

	if ( !surface ) surface = m_window->TheSurface();

	RECT rect = { 0, 0, m_width, m_height };
	OffsetRect( &rect, m_x + x, m_y + y );
	ToWindow( &rect );

	
	rect.left -= k_CTP2_HYPERTEXTBOX_INSETWIDTH;
	rect.top -= k_CTP2_HYPERTEXTBOX_INSETWIDTH;
	rect.bottom += k_CTP2_HYPERTEXTBOX_INSETWIDTH;

	if ( m_pattern ) {
		if ( m_srcWidthPix || m_srcHeightPix ) {
			RECT srcRect = { m_srcX, m_srcY, m_srcX + m_srcWidthPix, m_srcY + m_srcHeightPix };
			m_pattern->Draw( surface, &rect, &srcRect );
		}
		else {
			m_pattern->Draw( surface, &rect );
		}
		if(m_bevelWidth > 0) {
			primitives_BevelRect16( surface, &rect, m_bevelWidth, 1, 16, 16);
		}

	}




	DrawThisStateImage(
		0,
		surface,
		&rect );

	
	rect.left += k_CTP2_HYPERTEXTBOX_INSETWIDTH;
	rect.top += k_CTP2_HYPERTEXTBOX_INSETWIDTH;
	rect.bottom -= k_CTP2_HYPERTEXTBOX_INSETWIDTH;

	DrawThisHyperText(
		surface,
		&rect,
		0,
		-m_ranger->GetValueY() );
















	
	rect.left -= k_CTP2_HYPERTEXTBOX_INSETWIDTH;
	rect.top -= k_CTP2_HYPERTEXTBOX_INSETWIDTH;
	rect.bottom += k_CTP2_HYPERTEXTBOX_INSETWIDTH;




	if ( surface == m_window->TheSurface() )
		m_window->AddDirtyRect( &rect );

	return AUI_ERRCODE_OK;
}
Esempio n. 30
0
void
BSCWindow::MessageReceived(BMessage *message)
{
	switch (message->what) {				
		case kSelectArea:
		{
			Hide();
			while (!IsHidden())
				snooze(500);
			snooze(2000);
			BMessenger messenger(fController);
			SelectionWindow *window = new SelectionWindow(messenger, kSelectionWindowClosed);			
			window->Show();
			break;
		}
				
		case kCmdToggleRecording:
			fStartStopButton->Invoke();
			break;
		
		case B_OBSERVER_NOTICE_CHANGE:
		{
			int32 code;
			message->FindInt32("be:observe_change_what", &code);
			switch (code) {		
				case B_UPDATE_STATUS_BAR:
				case B_RESET_STATUS_BAR:
				{
					BMessage newMessage(*message);
					message->what = code;
					PostMessage(message, fStatusBar);
					break;
				}
	
				case kMsgControllerSelectionWindowClosed:
				{
					if (IsHidden())
						Show();
			
					break;
				}
				case kMsgControllerCaptureFailed:
				{
					status_t status;
					message->FindInt32("status", &status);
					char errorString[128];
					snprintf(errorString, 128, "A problem has occurred while starting capture:\n"
						"%s", strerror(status));
					(new BAlert("Capture Failed", errorString, "Ok"))->Go();
					break;
				}
				case kMsgControllerCaptureStarted:
					_CaptureStarted();
					break;
	
				case kMsgControllerCaptureStopped:
					_CaptureFinished();
					break;
	
				case kMsgControllerEncodeStarted:
					fStringView->SetText(kEncodingString);
					fCardLayout->SetVisibleItem(1);
					break;
					
				case kMsgControllerEncodeProgress:
				{
					int32 numFiles = 0;
					message->FindInt32("num_files", &numFiles);
					
					fStatusBar->SetMaxValue(float(numFiles));
					
					break;
				}
		
				case kMsgControllerEncodeFinished:
				{
					fStartStopButton->SetEnabled(true);
					fCardLayout->SetVisibleItem((int32)0);
					status_t status = B_OK;
					if (message->FindInt32("status", (int32*)&status) == B_OK
						&& status != B_OK) {
						char errorString[128];
						snprintf(errorString, 128, "A problem has occurred:\n"
							"%s", strerror(status));
						(new BAlert("yo", errorString, "Ok"))->Go();
					}
					
					break;
				}
				default:
					break;
			}
			break;
		}
		

		default:
			BWindow::MessageReceived(message);
			break;
	}
}