JBoolean
JXComposeRuleList::MatchesRule
	(
	const KeySym	keySym,
	JCharacter*		buffer
	)
{
	itsInputSeq->AppendElement(keySym);

	Rule target(itsInputSeq, XK_space);
	JBoolean found;
	const JIndex index =
		itsRuleList->SearchSorted1(target, JOrderedSetT::kAnyMatch, &found);
	if (found)
		{
		const Rule r = itsRuleList->GetElement(index);
		buffer[0]    = r.GetOutputCharacter();
		ClearState();
		return kJTrue;			// process it (rule fired)
		}
	else if (itsRuleList->IndexValid(index))
		{
		const Rule r = itsRuleList->GetElement(index);

		JBoolean isPrefix;
		CompareRulesWithPrefix(target, r, &isPrefix);
		if (isPrefix)
			{
			return kJFalse;		// don't process it yet (expecting rule to fire)
			}
		}

	ClearState();
	return kJTrue;				// process it (not an input sequence)
}
Exemplo n.º 2
0
/// <summary>
/// Activates this button.
/// </summary>
void TaskButton::Activate() {
  ActivateState(State::Active);
  ClearState(State::Minimized);

  if (mIsFlashing) {
    ClearState(State::Flashing);
    mWindow->ClearCallbackTimer(mFlashTimer);
    mIsFlashing = false;
  }
}
Exemplo n.º 3
0
void TaskButton::ActivateState(State state) {
  mPane->ActivateState(state);
  if (state == State::Active) {
    if (mFlashInterval) {
      nCore::ClearInterval(mFlashInterval);
      mFlashInterval = 0;
      ClearState(State::Flashing);
    }
    ClearState(State::Minimized);
  }
}
Exemplo n.º 4
0
    void PerconaFTIterator::JumpToLast()
    {
        ClearState();
        if (NULL == m_cursor)
        {
            return;
        }
        int ret = 0;
        if (m_iterate_upper_bound_key.GetType() > 0)
        {
            DoJump(m_iterate_upper_bound_key);
            if (!m_valid)
            {
                CHECK_EXPR((ret = m_cursor->c_getf_last(m_cursor, 0, nil_callback, NULL)));
            }
            if (0 == ret)
            {
                Prev();
            }
        }
        else
        {
            CHECK_EXPR((ret = m_cursor->c_getf_last(m_cursor, 0, nil_callback, NULL)));
            if (ret != 0)
            {
                m_valid = false;
                return;
            }
        }

    }
Exemplo n.º 5
0
nsresult
nsDocShellEnumerator::SetEnumDocShellType(int32_t aEnumerationItemType)
{
  mDocShellType = aEnumerationItemType;
  ClearState();
  return NS_OK;
}
JXComposeRuleList::JXComposeRuleList
	(
	std::istream&	input,
	const JSize	charCount,
	JBoolean*	isCharInWord,
	JCharacter*	diacriticalMap,
	JIndex*		diacriticalMarkType
	)
{
	itsRuleList = jnew JArray<Rule>(100);
	assert( itsRuleList != NULL );
	itsRuleList->SetCompareFunction(CompareRules);

	itsInitialKeySymList = jnew JArray<KeySym>(10);
	assert( itsInitialKeySymList != NULL );

	itsInputSeq = jnew JArray<KeySym>;
	assert( itsInputSeq != NULL );

	ClearState();

	JXComposeScanner scanner;
	scanner.BuildRuleList(input, this, charCount, isCharInWord,
						  diacriticalMap, diacriticalMarkType);
}
Exemplo n.º 7
0
LRESULT TaskButton::HandleMessage(HWND window, UINT msg, WPARAM wParam, LPARAM lParam, NPARAM) {
  switch (msg) {
  case WM_MOUSEMOVE:
    ActivateState(State::Hover);
    return 0;

  case WM_MOUSELEAVE:
    ClearState(State::Hover);
    return 0;

  case WM_TIMER:
    if (wParam == mFlashInterval) {
      mPane->ToggleState(State::Flashing);
    }
    return 0;

  case WM_LBUTTONUP:
    SelectTask();
    return 0;

  case WM_RBUTTONUP:
    ShowContextMenu();
    return 0;

  case WM_MBUTTONUP:
    OpenTaskProcess();
    return 0;
  }
  return mEventHandler->HandleMessage(window, msg, wParam, lParam, this);
};
Exemplo n.º 8
0
nsresult
nsDocShellEnumerator::SetEnumerationRootItem(
    nsIDocShellTreeItem* aEnumerationRootItem)
{
  mRootItem = do_GetWeakReference(aEnumerationRootItem);
  ClearState();
  return NS_OK;
}
Exemplo n.º 9
0
void Creature::AIM_Update(const uint32 &diff)
{
    
    switch( m_deathState )
    {
    case JUST_DIED:
	{
	    SetUInt32Value(UNIT_NPC_FLAGS, 0);
	    m_deathState = CORPSE;

	    
	    i_AI->UpdateAI(diff); 
	    break;
	}
    case DEAD:
	{
	    if( m_respawnTimer <= diff )
	    {
		DEBUG_LOG("Respawning...");		

		
		SetUInt32Value(UNIT_FIELD_HEALTH, GetUInt32Value(UNIT_FIELD_MAXHEALTH));
		m_deathState = ALIVE;
		ClearState(ALL_STATE);
		i_motionMaster.Clear(); 
		MapManager::Instance().GetMap(GetMapId())->Add(this); 
	    }
	    else
		m_respawnTimer -= diff;
	    break;
	}
    case CORPSE:
	{
	    if( m_deathTimer <= diff )
	    {
		DEBUG_LOG("Removing corpse...");
		ObjectAccessor::Instance().RemoveCreatureCorpseFromPlayerView(this);
		setDeathState(DEAD);
		m_respawnTimer = m_respawnDelay;
		GetRespawnCoord(m_positionX, m_positionY, m_positionZ);
	    }
	    else
		m_deathTimer -= diff;
	    break;
	}
    case ALIVE:
	{
	    Unit::Update( diff );	    
	    i_AI->UpdateAI(diff);
	    i_motionMaster.UpdateMotion(diff);
	    break;
	}
    default:
	break;
    }
}
Exemplo n.º 10
0
 void PerconaFTIterator::Prev()
 {
     ClearState();
     int ret = m_cursor->c_getf_prev(m_cursor, 0, nil_callback, NULL);
     if (ret != 0)
     {
         m_valid = false;
         return;
     }
 }
Exemplo n.º 11
0
 void PerconaFTIterator::Next()
 {
     ClearState();
     int ret = m_cursor->c_getf_next(m_cursor, 0, nil_callback, NULL);
     if (ret != 0)
     {
         m_valid = false;
         return;
     }
     CheckBound();
 }
Exemplo n.º 12
0
NS_IMETHODIMP nsAccessibleTreeWalker::PushState()
{
  // Duplicate mState and put right before end; reset mState; make mState the new end of the stack
  WalkState* nextToLastState= new WalkState();
  if (!nextToLastState)
    return NS_ERROR_OUT_OF_MEMORY;
  *nextToLastState = mState;  // Deep copy - copy contents of struct to new state that will be added to end of our stack
  ClearState();
  mState.prevState = nextToLastState;   // Link to previous state
  return NS_OK;
}
Exemplo n.º 13
0
static void GetState(RectArea *root, boolean *state) {
    RectArea *current = root;

    ClearState(state);

    while (current)
    {
        WarnIfNonOptimal(&current->rect);

        WriteGeomToState(&current->rect, state);

        current = current->next;
    }
}
Exemplo n.º 14
0
    void PerconaFTIterator::JumpToFirst()
    {
        ClearState();
        if (NULL == m_cursor)
        {
            return;
        }
        int ret;
        CHECK_EXPR((ret = m_cursor->c_getf_first(m_cursor, 0, nil_callback, NULL)));
        if (ret != 0)
        {
            m_valid = false;
        }

    }
Exemplo n.º 15
0
//-----------------------------------------------------------------------
void CSpectacularKill::End(bool bKillerDied/* = false*/)
{
	CRY_ASSERT_MESSAGE(IsBusy(), "spectacular kill cannot be stopped if it is not in progress");
	if (!IsBusy())
		return;

	ICooperativeAnimationManager* pCooperativeAnimationManager = gEnv->pGame->GetIGameFramework()->GetICooperativeAnimationManager();

	CActor* pTarget = GetTarget();
	CRY_ASSERT(pTarget);
	if(pTarget)
	{
		pCooperativeAnimationManager->StopCooperativeAnimationOnActor(m_pOwner->GetAnimatedCharacter(), pTarget->GetAnimatedCharacter());

		// Enable AI again (for what it's worth - this helps editor)
		if (!pTarget->IsPlayer() && pTarget->GetEntity()->GetAI())
			pTarget->GetEntity()->GetAI()->Event(AIEVENT_ENABLE, 0);

		if (bKillerDied && (m_deathBlowState == eDBS_None) && static_cast<CPlayer*> (pTarget)->CanFall())
		{
			// Enable Fall n Play on target if killer dies before death blowing it
			pTarget->Fall();
		}
		else if (m_deathBlowState != eDBS_Done)
		{
			DeathBlow(*pTarget); // Call this in case the notification from the animation system got skipped or missed for some reason
		}

		SActorStats* pTargetStats = pTarget->GetActorStats();
		pTargetStats->spectacularKillPartner = 0;
	}
	else
	{
		pCooperativeAnimationManager->StopCooperativeAnimationOnActor(m_pOwner->GetAnimatedCharacter());
	}

	// Enable AI again (for what it's worth - this helps editor)
	if (m_pOwner && m_pOwner->GetEntity()->GetAI())
		m_pOwner->GetEntity()->GetAI()->Event(AIEVENT_ENABLE, 0);

	ClearState();

  assert(m_pOwner);
	SActorStats* pStats = m_pOwner->GetActorStats();
	if(pStats)
		pStats->spectacularKillPartner = 0;
}
Exemplo n.º 16
0
NS_IMETHODIMP nsAccessibleTreeWalker::PopState()
{
  nsIFrame *frameParent = mState.frame? mState.frame->GetParent(): nsnull;
  if (mState.prevState) {
    WalkState *toBeDeleted = mState.prevState;
    mState = *mState.prevState; // deep copy
    mState.isHidden = PR_FALSE; // If we were in a child, the parent wasn't hidden
    if (!mState.frame) {
      mState.frame = frameParent;
    }
    delete toBeDeleted;
    return NS_OK;
  }
  ClearState();
  mState.frame = frameParent;
  mState.isHidden = PR_FALSE;
  return NS_ERROR_FAILURE;
}
Exemplo n.º 17
0
    void PerconaFTIterator::DoJump(const KeyObject& next)
    {
        ClearState();
        if (NULL == m_cursor)
        {
            return;
        }
        PerconaFTLocalContext& local_ctx = g_local_ctx.GetValue();
        Slice ks = local_ctx.GetSlice(next);
        DBT key_slice = to_dbt(ks);

        int ret = m_cursor->c_getf_set_range(m_cursor, DB_SET_RANGE, &key_slice, nil_callback, NULL);
        if (ret != 0)
        {
            m_valid = false;
            return;
        }
    }
Exemplo n.º 18
0
// Highlights the current line according to the state requested;
// check to see if the node of type "state" is present;
// if it is, the node is formatted
void XHTMLHighlighter::HighlightLine(const QString &text, int state)
{
    QRegularExpression left_bracket_regex  = GetLeftBracketRegEx(state);
    QRegularExpression right_bracket_regex = GetRightBracketRegEx(state);
    int main_index = 0;

    // We loop over the line several times
    // because we could have several nodes on it
    while (main_index < text.length()) {
        int left_bracket_index  = -1;
        int left_bracket_len = 0;
        int right_bracket_index = -1;
        int right_bracket_len = 0;

        if (!left_bracket_regex.pattern().isEmpty()) {
            QRegularExpressionMatch left_bracket_match = left_bracket_regex.match(text, main_index);
            if (left_bracket_match.hasMatch()) {
                left_bracket_index = left_bracket_match.capturedStart();
                left_bracket_len = left_bracket_match.capturedLength();
            }
        }

        if (!right_bracket_regex.pattern().isEmpty()) {
            QRegularExpressionMatch right_bracket_match = right_bracket_regex.match(text, main_index);
            if (right_bracket_match.hasMatch()) {
                right_bracket_index = right_bracket_match.capturedStart();
                right_bracket_len = right_bracket_match.capturedLength();
            }
        }

        // If we are not starting our state and our state is
        // not already set, we don't format; see the four cases explanation below
        if (left_bracket_index == -1 && !StateChecked(state)) {
            return;
        }

        // Every node/state has a left "bracket", a right "bracket" and the inside body.
        // This example uses HTML tags, but the principle is the same for every node/state.
        // There are four possible cases:
        // (1)  <......>    (both brackets on the same line; state starts and stops here)
        // (2)  <.......    (only the left bracket; next line continues state)
        // (3)  .......>    (only the right bracket; current line ends state)
        // (4)  ........    (no brackets; a line between (2) and (3))

        // We also check the state because we don't want to start a new node
        // if the current node of the same type hasn't finished
        if (left_bracket_index != -1 && !StateChecked(state)) {
            main_index = left_bracket_index + left_bracket_len;

            // (1)
            if (right_bracket_index != -1) {
                main_index = right_bracket_index + right_bracket_len;
                int length = right_bracket_index - left_bracket_index + right_bracket_len;
                FormatBody(text, state, left_bracket_index, length);
                // There's no point in setting the state here because the state
                // starts and ends on this line.
            }
            // (2)
            else {
                int length = text.length() - left_bracket_index;
                FormatBody(text, state, left_bracket_index, length);
                main_index += length;
                // Set the current state so the next line can continue
                // with the formatting.
                SetState(state);
            }
        } else {
            // (3)
            if (right_bracket_index != -1) {
                main_index = right_bracket_index + right_bracket_len;
                int length = right_bracket_index + right_bracket_len;
                FormatBody(text, state, 0, length);
                // Clear the current state because our state has just ended.
                ClearState(state);
            }
            // (4)
            else {
                int length = text.length();
                FormatBody(text, state, 0, length);
                main_index += length;
            }
        }
    }
}
Exemplo n.º 19
0
//-----------------------------------------------------------------------
void CSpectacularKill::Reset()
{
	ClearState();
}
Exemplo n.º 20
0
StdStrBuf C4RTFFile::GetPlainText()
	{
	// clear any previous crap
	ClearState();
	// start with a fresh state
	pState = new PropertyState();
	pState->eState = psNormal;
	StdStrBuf sResult;
	// nothing to do for empty RTFs
	if (sRTF.getSize()<=0) return sResult;
	// parse through all chars
	try
		{
		char c; size_t iPos = 0;
		while (iPos < sRTF.getSize())
			{
			c = ((const char *) sRTF.getData())[iPos++];
			// binary parsing?
			if (pState->eState == psBinary)
				{
				if (!--pState->iHexBinCnt) pState->eState = psNormal;
				ParseChar(sResult, c);
				continue;
				}
			// normal parsing: Handle state blocks
			switch (c)
				{
				case '{': PushState(); break;
				case '}': PopState(); break;
				case '\\':
					ParseKeyword(sResult, iPos);
					break;
        case 0x0d: case 0x0a: // ignored chars
          break;
				default:
					// regular char parsing
					if (pState->eState == psNormal)
						// normal mode
						ParseChar(sResult, c);
					else if (pState->eState == psHex)
						ParseHexChar(sResult, c);
					else
						throw new ParserError("Invalid State");
					break;
				}
			// next char
			}
		// all states must be closed in the end
		if (pState->pNext) throw new ParserError("Block not closed");
		}
	catch (ParserError *pe)
		{
		// invalid RTF file: Display error message instead
		sResult = "Invalid RTF file: ";
		sResult.Append(pe->ErrorText);
		delete pe;
		}
	// cleanup
	ClearState();
	// return result
	return sResult;
	}
Exemplo n.º 21
0
void FD3D11DynamicRHI::InitD3DDevice()
{
	check( IsInGameThread() );

	// Wait for the rendering thread to go idle.
	SCOPED_SUSPEND_RENDERING_THREAD(false);

	// If the device we were using has been removed, release it and the resources we created for it.
	if(bDeviceRemoved)
	{
		UE_LOG(LogD3D11RHI, Log, TEXT("bDeviceRemoved"));
		check(Direct3DDevice);

		HRESULT hRes = Direct3DDevice->GetDeviceRemovedReason();

		const TCHAR* Reason = TEXT("?");
		switch(hRes)
		{
			case DXGI_ERROR_DEVICE_HUNG:			Reason = TEXT("HUNG"); break;
			case DXGI_ERROR_DEVICE_REMOVED:			Reason = TEXT("REMOVED"); break;
			case DXGI_ERROR_DEVICE_RESET:			Reason = TEXT("RESET"); break;
			case DXGI_ERROR_DRIVER_INTERNAL_ERROR:	Reason = TEXT("INTERNAL_ERROR"); break;
			case DXGI_ERROR_INVALID_CALL:			Reason = TEXT("INVALID_CALL"); break;
		}

		bDeviceRemoved = false;

		// Cleanup the D3D device.
		CleanupD3DDevice();

		// We currently don't support removed devices because FTexture2DResource can't recreate its RHI resources from scratch.
		// We would also need to recreate the viewport swap chains from scratch.
		UE_LOG(LogD3D11RHI, Fatal, TEXT("The Direct3D 11 device that was being used has been removed (Error: %d '%s').  Please restart the game."), hRes, Reason);
	}

	// If we don't have a device yet, either because this is the first viewport, or the old device was removed, create a device.
	if(!Direct3DDevice)
	{
		UE_LOG(LogD3D11RHI, Log, TEXT("!Direct3DDevice"));
		check(!GIsRHIInitialized);

		// Clear shadowed shader resources.
		ClearState();

		// Determine the adapter and device type to use.
		TRefCountPtr<IDXGIAdapter> Adapter;
		
		// In Direct3D 11, if you are trying to create a hardware or a software device, set pAdapter != NULL which constrains the other inputs to be:
		//		DriverType must be D3D_DRIVER_TYPE_UNKNOWN 
		//		Software must be NULL. 
		D3D_DRIVER_TYPE DriverType = D3D_DRIVER_TYPE_UNKNOWN;	

		uint32 DeviceFlags = D3D11RHI_ShouldAllowAsyncResourceCreation() ? 0 : D3D11_CREATE_DEVICE_SINGLETHREADED;

		// Use a debug device if specified on the command line.
		const bool bWithD3DDebug = D3D11RHI_ShouldCreateWithD3DDebug();

		if (bWithD3DDebug)
		{
			DeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;

			UE_LOG(LogD3D11RHI, Log, TEXT("InitD3DDevice: -D3DDebug = %s"), bWithD3DDebug ? TEXT("on") : TEXT("off"));
		}

		GTexturePoolSize = 0;

		TRefCountPtr<IDXGIAdapter> EnumAdapter;

		if(DXGIFactory1->EnumAdapters(ChosenAdapter,EnumAdapter.GetInitReference()) != DXGI_ERROR_NOT_FOUND)
		{
			if (EnumAdapter)// && EnumAdapter->CheckInterfaceSupport(__uuidof(ID3D11Device),NULL) == S_OK)
			{
				DXGI_ADAPTER_DESC AdapterDesc;
				if (SUCCEEDED(EnumAdapter->GetDesc(&AdapterDesc)))
				{
					Adapter = EnumAdapter;

					GRHIAdapterName = AdapterDesc.Description;
					GRHIVendorId = AdapterDesc.VendorId;

					// Issue: 32bit windows doesn't report 64bit value, we take what we get.
					FD3D11GlobalStats::GDedicatedVideoMemory = int64(AdapterDesc.DedicatedVideoMemory);
					FD3D11GlobalStats::GDedicatedSystemMemory = int64(AdapterDesc.DedicatedSystemMemory);
					FD3D11GlobalStats::GSharedSystemMemory = int64(AdapterDesc.SharedSystemMemory);

					// Total amount of system memory, clamped to 8 GB
					int64 TotalPhysicalMemory = FMath::Min(int64(FPlatformMemory::GetConstants().TotalPhysicalGB), 8ll) * (1024ll * 1024ll * 1024ll);

					// Consider 50% of the shared memory but max 25% of total system memory.
					int64 ConsideredSharedSystemMemory = FMath::Min( FD3D11GlobalStats::GSharedSystemMemory / 2ll, TotalPhysicalMemory / 4ll );

					FD3D11GlobalStats::GTotalGraphicsMemory = 0;
					if ( IsRHIDeviceIntel() )
					{
						// It's all system memory.
						FD3D11GlobalStats::GTotalGraphicsMemory = FD3D11GlobalStats::GDedicatedVideoMemory;
						FD3D11GlobalStats::GTotalGraphicsMemory += FD3D11GlobalStats::GDedicatedSystemMemory;
						FD3D11GlobalStats::GTotalGraphicsMemory += ConsideredSharedSystemMemory;
					}
					else if ( FD3D11GlobalStats::GDedicatedVideoMemory >= 200*1024*1024 )
					{
						// Use dedicated video memory, if it's more than 200 MB
						FD3D11GlobalStats::GTotalGraphicsMemory = FD3D11GlobalStats::GDedicatedVideoMemory;
					}
					else if ( FD3D11GlobalStats::GDedicatedSystemMemory >= 200*1024*1024 )
					{
						// Use dedicated system memory, if it's more than 200 MB
						FD3D11GlobalStats::GTotalGraphicsMemory = FD3D11GlobalStats::GDedicatedSystemMemory;
					}
					else if ( FD3D11GlobalStats::GSharedSystemMemory >= 400*1024*1024 )
					{
						// Use some shared system memory, if it's more than 400 MB
						FD3D11GlobalStats::GTotalGraphicsMemory = ConsideredSharedSystemMemory;
					}
					else
					{
						// Otherwise consider 25% of total system memory for graphics.
						FD3D11GlobalStats::GTotalGraphicsMemory = TotalPhysicalMemory / 4ll;
					}

					if ( sizeof(SIZE_T) < 8 )
					{
						// Clamp to 1 GB if we're less than 64-bit
						FD3D11GlobalStats::GTotalGraphicsMemory = FMath::Min( FD3D11GlobalStats::GTotalGraphicsMemory, 1024ll * 1024ll * 1024ll );
					}
					else
					{
						// Clamp to 1.9 GB if we're 64-bit
						FD3D11GlobalStats::GTotalGraphicsMemory = FMath::Min( FD3D11GlobalStats::GTotalGraphicsMemory, 1945ll * 1024ll * 1024ll );
					}

					if ( GPoolSizeVRAMPercentage > 0 )
					{
						float PoolSize = float(GPoolSizeVRAMPercentage) * 0.01f * float(FD3D11GlobalStats::GTotalGraphicsMemory);

						// Truncate GTexturePoolSize to MB (but still counted in bytes)
						GTexturePoolSize = int64(FGenericPlatformMath::TruncToFloat(PoolSize / 1024.0f / 1024.0f)) * 1024 * 1024;

						UE_LOG(LogRHI,Log,TEXT("Texture pool is %llu MB (%d%% of %llu MB)"),
							GTexturePoolSize / 1024 / 1024,
							GPoolSizeVRAMPercentage,
							FD3D11GlobalStats::GTotalGraphicsMemory / 1024 / 1024);
					}

					const bool bIsPerfHUD = !FCString::Stricmp(AdapterDesc.Description,TEXT("NVIDIA PerfHUD"));

					if(bIsPerfHUD)
					{
						DriverType =  D3D_DRIVER_TYPE_REFERENCE;
					}
				}
				else
				{
					check(!"Internal error, GetDesc() failed but before it worked")
				}
			}
		}
		else
		{
Exemplo n.º 22
0
/// <summary>
/// Handles window messages for this button.
/// </summary>
LRESULT WINAPI TaskButton::HandleMessage(HWND window, UINT message, WPARAM wParam, LPARAM lParam, LPVOID) {
  switch (message) {
  case WM_LBUTTONUP:
    {
      if (IsIconic(mWatchedWindow)) {
        BringWindowToTop(mWatchedWindow);
        PostMessage(mWatchedWindow, WM_SYSCOMMAND, SC_RESTORE, 0);
        SetForegroundWindow(mWatchedWindow);
        if (gActiveWindowTracking != FALSE) {
          MoveMouseToWindow();
        }
      } else if (GetForegroundWindow() == mWatchedWindow) {
        PostMessage(mWatchedWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0);
        ActivateState(State::Minimized);
      } else {
        SetForegroundWindow(mWatchedWindow);
        if (gActiveWindowTracking != FALSE) {
          MoveMouseToWindow();
        }
      }
      ((Taskbar*)mParent)->HideThumbnail();
    }
    return 0;

  case WM_RBUTTONUP:
    {
      SetWindowPos(mWatchedWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
      ShowMenu();
    }
    return 0;

  case WM_MOUSEMOVE:
    {
      if (!mMouseIsOver) {
        mMouseIsOver = true;
        ActivateState(State::Hover);

        RECT r;
        mWindow->GetScreenRect(&r);
        ((Taskbar*)mParent)->ShowThumbnail(mWatchedWindow, &r);
      }
    }
    return 0;

  case WM_MOUSELEAVE:
    {
      mMouseIsOver = false;
      ClearState(State::Hover);
      ((Taskbar*)mParent)->HideThumbnail();
    }
    return 0;

  case WM_TIMER:
    {
      if (wParam == mFlashTimer) {
        if (mIsFlashing) {
          ToggleState(State::Flashing);
        } else {
          mWindow->ClearCallbackTimer(mFlashTimer);
        }
      }
    }
    return 0;

  default:
    return DefWindowProc(window, message, wParam, lParam);
  }
}
Exemplo n.º 23
0
CScriptState::~CScriptState()
{
	if(m_pState) {
		ClearState();
	}
}
nsresult nsDocShellEnumerator::SetEnumerationRootItem(nsIDocShellTreeItem * aEnumerationRootItem)
{
  mRootItem = aEnumerationRootItem;
  ClearState();
  return NS_OK;
}
Exemplo n.º 25
0
void Win::Hide()
{
	::ShowWindow(handle, SW_HIDE);
	ClearState(S_VISIBLE); 
};
Exemplo n.º 26
0
C4RTFFile::~C4RTFFile()
	{
	ClearState();
	}
Exemplo n.º 27
0
SOUNDFILTER::SOUNDFILTER() :
	order(0)
{
	ClearState();
}
Exemplo n.º 28
0
void IterativeDeepener::Search(const IDSParams& ids_params, Move* best_move,
                               int* best_move_score,
                               SearchStats* id_search_stats) {
  std::ostream& out = ids_params.thinking_output ? std::cout : nullstream;
  ClearState();

  StopWatch stop_watch;
  stop_watch.Start();

  movegen_->GenerateMoves(&root_move_array_);
  out << "# Number of moves at root: " << root_move_array_.size() << std::endl;

  // No moves to make. Just return by setting invalid move. This can happen if
  // Search() is called after game ends.
  if (root_move_array_.size() == 0) {
    *best_move = Move();
    *best_move_score = INF;
    return;
  }

  // Caller provided move ordering and pruning takes priority over move orderer.
  if (ids_params.pruned_ordered_moves.size()) {
    root_move_array_ = ids_params.pruned_ordered_moves;
  } else if (extensions_->move_orderer) {
    extensions_->move_orderer->Order(&root_move_array_);
  }
  assert(root_move_array_.size() > 0);
  out << "# Number of root moves being searched: " << root_move_array_.size()
      << std::endl;

  // If there is only one move to be made, make it without hesitation as search
  // won't yield anything new.
  if (root_move_array_.size() == 1) {
    *best_move = root_move_array_.get(0);
    *best_move_score = INF;
    return;
  }

  // Iterative deepening starts here.
  for (unsigned depth = 1; depth <= ids_params.search_depth; ++depth) {
    // Do not use transposition table moves at the root if ordered/pruned
    // movelist is passed by the caller as we expect input ordering to be of
    // highest quality. Also, this avoids transposition table moves that are
    // not in the list to be brought to the front.
    if (ids_params.pruned_ordered_moves.size() == 0) {
      TranspositionTableEntry* tentry = transpos_->Get(board_->ZobristKey());
      if (tentry && tentry->best_move.is_valid()) {
        root_move_array_.PushToFront(tentry->best_move);
      }
    } else if (!iteration_stats_.empty()) {
      root_move_array_.PushToFront(iteration_stats_.back().best_move);
    }

    // This will return immediately when timer expires but updates the
    // iteration_stats_ nevertheless. Results from the last iteration are
    // acceptable only if search of at least the first root move subtree was
    // completed. Due to the move-ordering done above, the first root move that
    // is searched is guaranteed to be the best known move before beginning of
    // this iteration. So, if a different best move is found before timer
    // expiry, it is at least better than the previously known best move
    // (though it might not be the overall best move at this depth because all
    // the root moves might not be covered).
    FindBestMove(depth);

    double elapsed_time = stop_watch.ElapsedTime();

    const IterationStat& last_istat = iteration_stats_.back();

    // If FindMove could not complete at least the first root move subtree
    // completely, don't report stats or update best_move as the results are
    // likely to be incorrect.
    if (timer_->Lapsed() && last_istat.root_moves_covered == 0) {
      break;
    }

    // Update best_move and stats.
    *best_move = last_istat.best_move;
    *best_move_score = last_istat.score;
    id_search_stats->nodes_searched += last_istat.search_stats.nodes_searched;
    id_search_stats->nodes_researched +=
        last_istat.search_stats.nodes_researched;
    id_search_stats->nodes_evaluated += last_istat.search_stats.nodes_evaluated;
    id_search_stats->search_depth = last_istat.depth;

    // XBoard style thinking output.
    if (ids_params.thinking_output) {
      char output[256];
      snprintf(output, 256, "%2d\t%5d\t%5d\t%10d\t%s", depth, last_istat.score,
               int(elapsed_time), id_search_stats->nodes_evaluated,
               PV(*best_move).c_str());
      std::cout << output << std::endl;
    }

    // Don't go any deeper if a win is confirmed or timer has lapsed.
    if (last_istat.score == WIN || timer_->Lapsed()) {
      break;
    }
  }
  stop_watch.Stop();
  out << "# Time taken for ID search: " << stop_watch.ElapsedTime() << " centis"
      << std::endl;
}
Exemplo n.º 29
0
bool CScriptState::ResetState()
{
	ClearState();
	return InitState();
}
Exemplo n.º 30
0
/// <summary>
/// Deactivates this button.
/// </summary>
void TaskButton::Deactivate() {
  ClearState(State::Active);
}