Пример #1
0
//============================================================================
//    IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES
//============================================================================
//============================================================================
//    IMPLEMENTATION PRIVATE FUNCTIONS
//============================================================================
//============================================================================
//    INTERFACE FUNCTIONS
//============================================================================
//============================================================================
//    INTERFACE CLASS BODIES
//============================================================================
// --- Archive Class ---
// Parse the Archive.
VFS_BOOL CArchive::Parse()
{
	// Read in the Archive Header.
	ARCHIVE_HEADER RawHeader;
	if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawHeader, sizeof( ARCHIVE_HEADER ) ) )
		return VFS_FALSE;

	m_Header.dwDataOffset = sizeof( ARCHIVE_HEADER ) +
							RawHeader.dwNumFilters * sizeof( ARCHIVE_FILTER ) +
							RawHeader.dwNumDirs * sizeof( ARCHIVE_DIR ) +
							RawHeader.dwNumFiles * sizeof( ARCHIVE_FILE );
	m_Header.dwFileDataOffset = m_Header.dwDataOffset;

	// Read in the Filters.
	VFS_DWORD dwIndex;
	for( dwIndex = 0; dwIndex < RawHeader.dwNumFilters; dwIndex++ )
	{
		ARCHIVE_FILTER RawFilter;
		if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawFilter, sizeof( ARCHIVE_FILTER ) ) )
			return VFS_FALSE;

		// Get the Filter for the Name.
		VFS_Filter* pFilter = ( VFS_Filter* ) VFS_GetFilter( RawFilter.szName );
		if( pFilter == NULL )
			return VFS_FALSE;

        // Increase the File Data Offset.
		m_Header.dwFileDataOffset += pFilter->GetConfigDataSize();

		m_Header.Filters.push_back( pFilter );
	}

	// Read in the Dirs.
	for( dwIndex = 0; dwIndex < RawHeader.dwNumDirs; dwIndex++ )
	{
		ARCHIVE_DIR RawDir;
		if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawDir, sizeof( ARCHIVE_DIR ) ) )
			return VFS_FALSE;

		ArchiveDir Dir;
		Dir.dwParentDirIndex = RawDir.dwParentIndex;
		Dir.strName = RawDir.szName;

		m_Header.Dirs.push_back( Dir );
	}

	// Calculate the Full Name.
	for( dwIndex = 0; dwIndex < RawHeader.dwNumDirs; dwIndex++ )
	{
		ArchiveDir* pBase = &m_Header.Dirs[ dwIndex ];
		ArchiveDir* pDir = pBase;
		while( pDir->dwParentDirIndex != DIR_INDEX_ROOT )
		{
			pDir = &m_Header.Dirs[ pDir->dwParentDirIndex ];
			pBase->strName = pDir->strName + VFS_PATH_SEPARATOR + pBase->strName;
		}

		m_Header.DirHash[ m_Header.Dirs[ dwIndex ].strName ] = dwIndex;
	}

	// Read in the Filter Data.
	VFS_DWORD dwPos = VFS_File_Tell( m_hFile );
	if( !Activate() )
		return VFS_FALSE;
	VFS_File_Seek( m_hFile, dwPos, VFS_SET );

	// Read in the Files.
	VFS_DWORD dwDataOffset = m_Header.dwFileDataOffset;
	for( dwIndex = 0; dwIndex < RawHeader.dwNumFiles; dwIndex++ )
	{
		ARCHIVE_FILE RawFile;
		if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawFile, sizeof( ARCHIVE_FILE ) ) )
			return VFS_FALSE;

		ArchiveFile File;
		File.strName = RawFile.szName;
		File.dwDirIndex = RawFile.dwDirIndex;
		if( File.dwDirIndex != DIR_INDEX_ROOT )
			File.strName = m_Header.Dirs[ File.dwDirIndex ].strName + VFS_PATH_SEPARATOR + File.strName;
		File.dwCompressedSize = RawFile.dwCompressedSize;
		File.dwUncompressedSize = RawFile.dwUncompressedSize;
		File.dwDataOffset = dwDataOffset;
		dwDataOffset += File.dwCompressedSize;
		m_Header.Files.push_back( File );

		m_Header.FileHash[ m_Header.Files[ dwIndex ].strName ] = dwIndex;
	}

	return VFS_TRUE;
}
Пример #2
0
void CTabBarClass::Update(BOOL abPosted/*=FALSE*/)
{
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif

	MCHKHEAP
	/*if (!_active)
	{
	    return;
	}*/ // Теперь - ВСЕГДА! т.к. сами управляем мультиконсолью

	if (mb_DisableRedraw)
	{
		_ASSERTE(FALSE && "mb_DisableRedraw?"); // Надо?
		return;
	}

	if (!isMainThread())
	{
		RequestPostUpdate();
		return;
	}

	gpConEmu->mp_Status->UpdateStatusBar();

	mb_PostUpdateCalled = FALSE;

	#ifdef _DEBUG
	_ASSERTE(mn_InUpdate >= 0);
	if (mn_InUpdate > 0)
	{
		_ASSERTE(mn_InUpdate == 0);
	}
	#endif

	mn_InUpdate ++;

	MCHKHEAP
	int V, I, tabIdx = 0, nCurTab = -1;
	BOOL bShowFarWindows = gpSet->bShowFarWindows;

	// Выполняться должно только в основной нити, так что CriticalSection не нужна

	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif

	TODO("Обработка gpSet->bHideInactiveConsoleTabs для новых табов");
	MCHKHEAP


	// Check if we need to AutoSHOW or AutoHIDE tab bar
	if (!IsTabsActive() && gpSet->isTabs)
	{
		int nTabs = CountActiveTabs(2);
		if (nTabs > 1)
		{
			Activate();
		}
	}
	else if (IsTabsActive() && gpSet->isTabs==2)
	{
		int nTabs = CountActiveTabs(2);
		if (nTabs <= 1)
		{
			Deactivate();
		}
	}


	// Validation?
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif



	MCHKHEAP
	HANDLE hUpdate = m_Tabs.UpdateBegin();
	_ASSERTE(hUpdate!=NULL);

	bool bStackChanged = false;

	/* ********************* */
	/*          Go           */
	/* ********************* */
	{
		MMap<CVConGroup*,CVirtualConsole*> Groups; Groups.Init(MAX_CONSOLE_COUNT, true);

		for (V = 0; V < MAX_CONSOLE_COUNT; V++)
		{
			//if (!(pVCon = gpConEmu->GetVCon(V))) continue;
			CVConGuard guard;
			if (!CVConGroup::GetVCon(V, &guard))
				continue;
			CVirtualConsole* pVCon = guard.VCon();

			BOOL lbActive = pVCon->isActive(false);

			if (gpSet->bHideInactiveConsoleTabs && !lbActive)
				continue;

			if (gpSet->isOneTabPerGroup)
			{
				CVConGroup *pGr;
				CVConGuard VGrActive;
				if (CVConGroup::isGroup(pVCon, &pGr, &VGrActive))
				{
					CVirtualConsole* pGrVCon;

					if (Groups.Get(pGr, &pGrVCon))
						continue; // эта группа уже есть

					pGrVCon = VGrActive.VCon();
					Groups.Set(pGr, pGrVCon);

					// И показывать таб нужно от "активной" консоли, а не от первой в группе
					if (pVCon != pGrVCon)
					{
						guard = pGrVCon;
						pVCon = pGrVCon;
					}

					if (!lbActive)
					{
						lbActive = pVCon->isActive(true);
					}

					// Показывать редакторы из всех групп?
					if (gpSet->bShowFarWindows)
					{
						MArray<CVConGuard*> Panes;
						int nPanes = pGr->GetGroupPanes(&Panes);

						// Только если в группе более одного таба - тогда нужно дополниетльная логика населения...
						if (nPanes > 1)
						{
							// Первым табом - показать текущую панель, либо МОДАЛЬНЫЙ редактор/вьювер
							// Редакторы из "far /e ..." здесь НЕ добавлять!
							if (!pVCon->RCon()->isFarPanelAllowed()
								|| !UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged, pVCon, uat_PanelsOrModalsOnly))
							{
								// Если есть - добавить ОДНУ панель, чтобы табы сплита не прыгали туда-сюда
								for (int K = 0; K < nPanes; K++)
								{
									if (Panes[K]->VCon()->RCon()->isFarPanelAllowed())
									{
										if (UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged,
												Panes[K]->VCon(), uat_PanelsOnly) > 0)
											break;
									}
								}
							}

							// Потом - все оставшиеся редакторы/вьюверы (в том числе и "far /e ...")
							for (int K = 0; K < nPanes; K++)
							{
								UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged,
									Panes[K]->VCon(), uat_NonModals|uat_NonPanels);
							}

							// Release
							CVConGroup::FreePanesArray(Panes);

							// Already processed, next VCon
							continue;
						}
					}
				}
			}

			UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged, pVCon, uat_AnyTab);
		}

		Groups.Release();
	}

	MCHKHEAP

	// Must be at least one tab ("ConEmu -Detached" for example)
	if (tabIdx == 0)
	{
		m_Tabs.UpdateAppend(hUpdate, mp_DummyTab, FALSE);

		// Физически (WinAPI) добавляет закладку, или меняет (при необходимости) заголовок существующей
		mp_Rebar->AddTabInt(gpConEmu->GetDefaultTabLabel(), tabIdx, gpConEmu->mb_IsUacAdmin, -1);

		nCurTab = tabIdx;
		tabIdx++;
	}

	m_Tabs.UpdateEnd(hUpdate, 0);

	// Проверим стек последних выбранных
	if (CheckStack())
		bStackChanged = true;

	#ifdef PRINT_RECENT_STACK
	PrintRecentStack();
	#endif

	#ifdef _DEBUG
	static int nPrevVisible, nPrevStacked;
	{
		wchar_t szDbg[100];
		int nNewVisible = m_Tabs.GetCount();
		int nNewStacked = m_TabStack.size();
		_wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"*** Tab list updated. Visible:%u, Stacked:%u, StackChanged:%s\n",
			nNewVisible, nNewStacked, bStackChanged ? L"Yes" : L"No");
		DEBUGSTRCOUNT(szDbg);
		nPrevVisible = nNewVisible;
		nPrevStacked = nNewStacked;
	}
	#endif

	// удалить лишние закладки (визуально)
	int nCurCount = GetItemCount();

	#ifdef _DEBUG
	wchar_t szDbg[128];
	_wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"CTabBarClass::Update.  ItemCount=%i, PrevItemCount=%i\n", tabIdx, nCurCount);
	DEBUGSTRTABS(szDbg);
	#endif

	if (mp_Rebar->IsTabbarCreated())
	{
		for (I = tabIdx; I < nCurCount; I++)
		{
			#ifdef _DEBUG
			_wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"   Deleting tab=%i\n", I+1);
			DEBUGSTRTABS(szDbg);
			#endif

			DeleteItem(tabIdx);
		}
	}

	MCHKHEAP

	if (mb_InKeySwitching)
	{
		if (mn_CurSelTab >= nCurCount)  // Если выбранный таб вылез за границы
			mb_InKeySwitching = false;
	}

	if (!mb_InKeySwitching && nCurTab != -1)
	{
		SelectTab(nCurTab);
	}

	UpdateToolConsoles();

	//if (gpSet->isTabsInCaption)
	//{
	//	SendMessage(ghWnd, WM_NCPAINT, 0, 0);
	//}

	mn_InUpdate --;

	if (mb_PostUpdateRequested)
	{
		mb_PostUpdateCalled = FALSE;
		mb_PostUpdateRequested = FALSE;
		RequestPostUpdate();
	}

	MCHKHEAP
	return; // Just for clearness
}
Пример #3
0
long PlugInShell_SetPluginState(const unsigned long inNewState)
{
    long macError = eDSNoErr;
    bool isAcquired = false;

    LOG_ENTER("inNewState = 0x%08x (%s)", inNewState, StateToString(inNewState));

    if (FlagOn(inNewState, ~(kActive | kInactive)))
    {
        LOG("Ignoring unexpected state flags: 0x%08x", FlagOn(inNewState, ~(kActive | kInactive)));
    }

    if (!FlagOn(inNewState, kActive | kInactive))
    {
        // Nothing to do.
        LOG("Nothing to do because inactive/active flags are not specified.");
        macError = eDSNoErr;
        GOTO_CLEANUP();
    }

    if (FlagOn(inNewState, kActive) && FlagOn(inNewState, kInactive))
    {
        LOG_ERROR("Cannot set active and inactive at the same time.");
        macError = ePlugInError;
        GOTO_CLEANUP();
    }

    GS_ACQUIRE_EXCLUSIVE();
    isAcquired = true;

    GS_VERIFY_INITIALIZED(macError);

    LOG("Current State = 0x%08x", GlobalState.PluginState);

    if ( (FlagOn(inNewState, kActive | kInactive) == FlagOn(GlobalState.PluginState, kActive | kInactive)) )
    {
        // Nothing to do.
        LOG("Nothing to do because the state matches");
        macError = eDSNoErr;
        GOTO_CLEANUP();
    }

    if ( FlagOn(inNewState, kActive) )
    {
        LOG("Activating");
        macError = Activate();
        GOTO_CLEANUP_ON_MACERROR(macError);

        SetFlag(GlobalState.PluginState, kActive);
        ClearFlag(GlobalState.PluginState, kInactive);
    }
    else if ( FlagOn(inNewState, kInactive) )
    {
        LOG("De-activating");
        macError = Deactivate();
        GOTO_CLEANUP_ON_MACERROR(macError);

        ClearFlag(GlobalState.PluginState, kActive);
        SetFlag(GlobalState.PluginState, kInactive);
    }
    else
    {
        // This should never happen.
        LOG_ERROR("Benign unexpected code path.");
        macError = eDSNoErr;
    }

cleanup:

    if (isAcquired)
    {
        LOG("Final State = 0x%08x", GlobalState.PluginState);
        GS_RELEASE();
    }

    LOG_LEAVE("--> %d", macError);
    return macError;
}
Пример #4
0
/*
================
idPhysics_Parametric::SetAngularInterpolation
================
*/
void idPhysics_Parametric::SetAngularInterpolation( int time, int accelTime, int decelTime, int duration, const idAngles &startAng, const idAngles &endAng ) {
	current.time = gameLocal.time;
	current.angularInterpolation.Init( time, accelTime, decelTime, duration, startAng, endAng );
	current.localAngles = startAng;
	Activate();
}
Пример #5
0
int filter(const SDL_Event *tEvent){
    // recursion avoidance
    static bool recursion = false;
    if ( !recursion )
    {
        class RecursionGuard
        {
        public:
            RecursionGuard( bool& recursion )
                    :recursion_( recursion )
            {
                recursion = true;
            }

            ~RecursionGuard()
            {
                recursion_ = false;
            }

        private:
            bool& recursion_;
        };

        RecursionGuard guard( recursion );

        // boss key or OS X quit command
        if ((tEvent->type==SDL_KEYDOWN && tEvent->key.keysym.sym==27 &&
                tEvent->key.keysym.mod & KMOD_SHIFT) ||
                (tEvent->type==SDL_KEYDOWN && tEvent->key.keysym.sym==113 &&
                 tEvent->key.keysym.mod & KMOD_META) ||
                (tEvent->type==SDL_QUIT)){
            // sn_SetNetState(nSTANDALONE);
            // sn_Receive();

            // register end of recording
            tRecorder::Record("END");

            st_SaveConfig();
            uMenu::quickexit=true;
            return false;
        }

        if(tEvent->type==SDL_MOUSEMOTION)
            if(tEvent->motion.x==sr_screenWidth/2 && tEvent->motion.y==sr_screenHeight/2)
                return 0;
        if (su_mouseGrab &&
                tEvent->type!=SDL_MOUSEBUTTONDOWN &&
                tEvent->type!=SDL_MOUSEBUTTONUP &&
                ((tEvent->motion.x>=sr_screenWidth-10  || tEvent->motion.x<=10) ||
                 (tEvent->motion.y>=sr_screenHeight-10 || tEvent->motion.y<=10)))
            SDL_WarpMouse(sr_screenWidth/2,sr_screenHeight/2);

        // fetch alt-tab

        if (tEvent->type==SDL_ACTIVEEVENT)
        {
            // Jonathans fullscreen bugfix.
#ifdef MACOSX
            if(currentScreensetting.fullscreen ^ lastSuccess.fullscreen) return false;
#endif
            int flags = SDL_APPINPUTFOCUS;
            if ( tEvent->active.gain && tEvent->active.state & flags )
                Activate(true);
            if ( !tEvent->active.gain && tEvent->active.state & flags )
                Activate(false);

            // reload GL stuff if application gets reactivated
            if ( tEvent->active.gain && tEvent->active.state & SDL_APPACTIVE )
            {
                // just treat it like a screen mode change, gets the job done
                rCallbackBeforeScreenModeChange::Exec();
                rCallbackAfterScreenModeChange::Exec();
            }
            return false;
        }

        if (su_prefetchInput){
            return su_StoreSDLEvent(*tEvent);
        }

    }

    return 1;
}
void CMultiStateMover::Event_Activate( idEntity *activator ) {
	Activate( activator );
}
Пример #7
0
/*
================
idPhysics_Parametric::SetAngularExtrapolation
================
*/
void idPhysics_Parametric::SetAngularExtrapolation( extrapolation_t type, int time, int duration, const idAngles &base, const idAngles &speed, const idAngles &baseSpeed ) {
	current.time = gameLocal.time;
	current.angularExtrapolation.Init( time, duration, base, baseSpeed, speed, type );
	current.localAngles = base;
	Activate();
}
Пример #8
0
		void AndroidEventLoop::ProcessAppEvent(int32_t pCommand)
		{
			switch (pCommand)
			{
				case APP_CMD_CONFIG_CHANGED:
					LOGD("APP_CMD_CONFIG_CHANGED");
					Activate();
					m_pActivityHandler->onConfigurationChanged();
					break;
				case APP_CMD_INIT_WINDOW:
					LOGD("APP_CMD_INIT_WINDOW");
					Activate();
					break;
				case APP_CMD_DESTROY:
					LOGD("APP_CMD_DESTROY");
					m_pActivityHandler->onDestroy();
					m_window.InvalidateSurface();
					m_window.InvalidateContext();
					m_enabled = false;
					break;
				case APP_CMD_GAINED_FOCUS:
					LOGD("APP_CMD_GAINED_FOCUS");
					m_pActivityHandler->onGainFocus();
					break;
				case APP_CMD_LOST_FOCUS:
					LOGD("APP_CMD_LOST_FOCUS");
					m_pActivityHandler->onLostFocus();
					break;
				case APP_CMD_LOW_MEMORY:
					LOGD("APP_CMD_LOW_MEMORY");
					m_pActivityHandler->onLowMemory();
					break;
				case APP_CMD_PAUSE:
					LOGD("APP_CMD_PAUSE");
					m_pActivityHandler->onPause();
					m_enabled = false;
					//m_window.InvalidateSurface();
					break;
				case APP_CMD_RESUME:
					LOGD("APP_CMD_RESUME");
					Activate();
					m_pActivityHandler->onResume();
					break;
				case APP_CMD_SAVE_STATE:
					LOGD("APP_CMD_SAVE_STATE");
					m_pActivityHandler->onSaveState(&Global::pAndroidApp->savedState,
						&Global::pAndroidApp->savedStateSize);
					break;
				case APP_CMD_START:
					LOGD("APP_CMD_START");
					Activate();
					m_pActivityHandler->onStart();
					break;
				case APP_CMD_STOP:
					LOGD("APP_CMD_STOP");
					m_pActivityHandler->onStop();
					m_window.InvalidateSurface();
					m_enabled = false;
					break;
				case APP_CMD_TERM_WINDOW:
					LOGD("APP_CMD_TERM_WINDOW");
					m_window.InvalidateSurface();
					m_enabled = false;
					break;
				default:
					break;
			}

			LOGD("m_enabled = %d",m_enabled);
			LOGD("is context bound? = %d",m_window.IsContextBound());
		}
/*
================
idPhysics_Player::SetAxis
================
*/
void idPhysics_Monster::SetAxis(const idMat3 &newAxis, int id)
{
	clipModel->Link(gameLocal.clip, self, 0, clipModel->GetOrigin(), newAxis);
	Activate();
}
int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
    MODULE* module = NULL;
    KIGFX::VIEW* view = getView();
    KIGFX::VIEW_CONTROLS* controls = getViewControls();
    BOARD* board = getModel<BOARD>();

    // Add a VIEW_GROUP that serves as a preview for the new item
    KIGFX::VIEW_GROUP preview( view );
    view->Add( &preview );

    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    controls->ShowCursor( true );
    controls->SetSnapping( true );

    Activate();
    m_frame->SetToolID( ID_PCB_MODULE_BUTT, wxCURSOR_HAND, _( "Add footprint" ) );

    // Main loop: keep receiving events
    while( OPT_TOOL_EVENT evt = Wait() )
    {
        VECTOR2I cursorPos = controls->GetCursorPosition();

        if( evt->IsCancel() || evt->IsActivate() )
        {
            if( module )
            {
                board->Delete( module );  // it was added by LoadModuleFromLibrary()
                module = NULL;

                preview.Clear();
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
                controls->ShowCursor( true );
            }
            else
                break;

            if( evt->IsActivate() )  // now finish unconditionally
                break;
        }

        else if( module && evt->Category() == TC_COMMAND )
        {
            if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
            {
                module->Rotate( module->GetPosition(), m_frame->GetRotationAngle() );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
            else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
            {
                module->Flip( module->GetPosition() );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
        }

        else if( evt->IsClick( BUT_LEFT ) )
        {
            if( !module )
            {
                // Pick the module to be placed
                module = m_frame->LoadModuleFromLibrary( wxEmptyString,
                                                         m_frame->Prj().PcbFootprintLibs(),
                                                         true, NULL );
                if( module == NULL )
                    continue;

                module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );

                // Add all the drawable parts to preview
                preview.Add( module );
                module->RunOnChildren( boost::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );

                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
            else
            {
                // Place the selected module
                module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
                view->Add( module );
                module->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

                m_frame->OnModify();
                m_frame->SaveCopyInUndoList( module, UR_NEW );

                // Remove from preview
                preview.Remove( module );
                module->RunOnChildren( boost::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
                module = NULL;  // to indicate that there is no module that we currently modify
            }

            bool placing = ( module != NULL );

            controls->SetAutoPan( placing );
            controls->CaptureCursor( placing );
            controls->ShowCursor( !placing );
        }

        else if( module && evt->IsMotion() )
        {
            module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }
    }

    controls->ShowCursor( false );
    controls->SetSnapping( false );
    controls->SetAutoPan( false );
    controls->CaptureCursor( false );
    view->Remove( &preview );

    m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );

    return 0;
}
int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
{
    KIGFX::VIEW* view = getView();
    KIGFX::VIEW_CONTROLS* controls = getViewControls();
    BOARD* board = getModel<BOARD>();
    PCB_TARGET* target = new PCB_TARGET( board );

    // Init the new item attributes
    target->SetLayer( Edge_Cuts );
    target->SetWidth( board->GetDesignSettings().m_EdgeSegmentWidth );
    target->SetSize( Millimeter2iu( 5 ) );
    VECTOR2I cursorPos = controls->GetCursorPosition();
    target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );

    // Add a VIEW_GROUP that serves as a preview for the new item
    KIGFX::VIEW_GROUP preview( view );
    preview.Add( target );
    view->Add( &preview );
    preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    controls->SetSnapping( true );

    Activate();
    m_frame->SetToolID( ID_PCB_MIRE_BUTT, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );

    // Main loop: keep receiving events
    while( OPT_TOOL_EVENT evt = Wait() )
    {
        cursorPos = controls->GetCursorPosition();

        if( evt->IsCancel() || evt->IsActivate() )
            break;

        else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
        {
            target->SetWidth( target->GetWidth() + WIDTH_STEP );
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }

        else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
        {
            int width = target->GetWidth();

            if( width > WIDTH_STEP )
            {
                target->SetWidth( width - WIDTH_STEP );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
        }

        else if( evt->IsClick( BUT_LEFT ) )
        {
            assert( target->GetSize() > 0 );
            assert( target->GetWidth() > 0 );

            view->Add( target );
            board->Add( target );
            target->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

            m_frame->OnModify();
            m_frame->SaveCopyInUndoList( target, UR_NEW );

            preview.Remove( target );

            // Create next PCB_TARGET
            target = new PCB_TARGET( *target );
            preview.Add( target );
        }

        else if( evt->IsMotion() )
        {
            target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
            preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }
    }

    delete target;

    controls->SetSnapping( false );
    view->Remove( &preview );

    m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );

    return 0;
}
Пример #12
0
void UAITask_MoveTo::Resume()
{
	Activate();
	Super::Resume();
}
Пример #13
0
	void CButtonUI::DoEvent(TEventUI& event)
	{
		if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
			if( m_pParent != NULL ) m_pParent->DoEvent(event);
			else CLabelUI::DoEvent(event);
			return;
		}

		if( event.Type == UIEVENT_SETFOCUS ) 
		{
			Invalidate();
		}
		if( event.Type == UIEVENT_KILLFOCUS ) 
		{
			Invalidate();
		}
		if( event.Type == UIEVENT_KEYDOWN )
		{
			if (IsKeyboardEnabled()) {
				if( event.chKey == VK_SPACE || event.chKey == VK_RETURN ) {
					Activate();
					return;
				}
			}
		}
		if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
		{
			if( ::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled() ) {
				m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED;
				Invalidate();
			}
			return;
		}
		if( event.Type == UIEVENT_MOUSEMOVE )
		{
			if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
				if( ::PtInRect(&m_rcItem, event.ptMouse) ) m_uButtonState |= UISTATE_PUSHED;
				else m_uButtonState &= ~UISTATE_PUSHED;
				Invalidate();
			}
			return;
		}
		if( event.Type == UIEVENT_BUTTONUP )
		{
			if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
				if( ::PtInRect(&m_rcItem, event.ptMouse) ) Activate();
				m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED);
				Invalidate();
			}
			return;
		}
		if( event.Type == UIEVENT_CONTEXTMENU )
		{
			if( IsContextMenuUsed() ) {
				m_pManager->SendNotify(this, _T("menu"), event.wParam, event.lParam);
			}
			return;
		}
		if( event.Type == UIEVENT_MOUSEENTER )
		{
			if( IsEnabled() ) {
				m_uButtonState |= UISTATE_HOT;
				Invalidate();
			}
			// return;
		}
		if( event.Type == UIEVENT_MOUSELEAVE )
		{
			if( IsEnabled() ) {
				m_uButtonState &= ~UISTATE_HOT;
				Invalidate();
			}
			// return;
		}
		if( event.Type == UIEVENT_SETCURSOR ) {
			::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
			return;
		}
		CLabelUI::DoEvent(event);
	}
Пример #14
0
mitk::GPGPU::GPGPU()
{

#ifdef _WIN32
               /*
	WNDCLASSEX wcx;

	// Fill in the window class structure with parameters
	// that describe the main window.

	wcx.cbSize = sizeof(wcx);          // size of structure
	wcx.style = CS_HREDRAW |
		CS_VREDRAW;                    // redraw if size changes
	wcx.lpfnWndProc = MainWndProc;     // points to window procedure
	wcx.cbClsExtra = 0;                // no extra class memory
	wcx.cbWndExtra = 0;                // no extra window memory
	wcx.hInstance = GetModuleHandle(NULL);         // handle to inst ance
	wcx.hIcon = LoadIcon(NULL,
		IDI_APPLICATION);              // predefined app. icon
	wcx.hCursor = LoadCursor(NULL,
		IDC_ARROW);                    // predefined arrow
	wcx.hbrBackground = NULL;                  // white background brush
	wcx.lpszMenuName = (LPCSTR) "MainMenu";    // name of menu resource
	wcx.lpszClassName = (LPCSTR) "MainWClass";  // name of window class
	wcx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

	// Register the window class.

	if(!RegisterClassEx(&wcx))
		std::cout << "failed registering window class\n";

	HWND desktopWindow=CreateWindowEx(
		WS_EX_CLIENTEDGE,
		(LPCSTR)"MainWClass",
		(LPCSTR)"Anatomy of a Window",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
		NULL,
		NULL,
		GetModuleHandle(NULL),
		NULL);
	windowHandle = desktopWindow;
  ShowWindow(desktopWindow, SW_RESTORE);

  if(desktopWindow==0)
	  std::cout << "failed creating window\n";
                 */

	HWND desktopWindow=QApplication::topLevelWidgets().at(0)->winId();

  windowsContext = GetDC(desktopWindow);

  if(windowsContext==0)
	  std::cout << "failed getting window device context\n";
                 
	static PIXELFORMATDESCRIPTOR pfd =// pfd Tells Windows How We Want Things To Be
	{
		sizeof(PIXELFORMATDESCRIPTOR),	// Size Of This Pixel Format Descriptor
		1,								              // Version Number
		PFD_DRAW_TO_WINDOW |						// Format Must Support Window
		PFD_SUPPORT_OPENGL |						// Format Must Support OpenGL
		PFD_DOUBLEBUFFER |
		PFD_SWAP_EXCHANGE ,					    // Must Support Double Buffering
		PFD_TYPE_RGBA,							    // Request An RGBA Format
		24,								              // Select Our Color Depth
		0, 0, 0, 0, 0, 0,						    // Color Bits Ignored  if(openGLContext==0)
		0,								              // No Alpha Buffer
		0,								              // Shift Bit Ignored
		0,								              // No Accumulation Buffer
		0, 0, 0, 0,							        // Accumulation Bits Ignored
		0,								              // 16Bit Z-Buffer (Depth Buffer)
		0,								              // No Stencil Buffer
		0,								              // No Auxiliary Buffer
		PFD_MAIN_PLANE,							    // Main Drawing Layer
		0,								              // Reserved
		0, 0, 0								          // Layer Masks Ignored
	};


  // Sonstiges einstellen
  int iFormat = ChoosePixelFormat(windowsContext,&pfd);
  SetPixelFormat(windowsContext,iFormat,&pfd);


  openGLContext = wglCreateContext(windowsContext);

  int errw=GetLastError();

  if(openGLContext==0)
	  std::cout << "failed creating openGL context "<<errw<<"\n";

#else

  X_display = XOpenDisplay(NULL);

  GPGPU_ERROR( !X_display ) << "cant open X display";

  GLX_drawable = QApplication::topLevelWidgets().at(0)->winId();

  GPGPU_ERROR( !GLX_drawable ) << "cant get toplevel widget from QT";

  static int visAttributes[] = {
    GLX_RGBA,
    GLX_RED_SIZE, 1,
    GLX_GREEN_SIZE, 1,
    GLX_BLUE_SIZE, 1,
    GLX_DOUBLEBUFFER,
    None
  };

  XVisualInfo *visinfo = glXChooseVisual(X_display, 0, visAttributes);

  GPGPU_ERROR(!visinfo) << "Unable to choose specified visual!";

  openGLContext = glXCreateContext(X_display, visinfo, 0, true);

  if(visinfo)
     XFree(visinfo);

  GPGPU_ERROR(!openGLContext) << "cant create GLX context";

#endif

  Activate();

  GPGPU_INFO << "initializing glew";

  int err=glewInit();

  GPGPU_CHECKGLERR << "initializing glew";
  GPGPU_ERROR(GLEW_OK != err) << "glewInit() fails with " << err << " as text: " << glewGetErrorString(err);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(0,1,0,1,-1,1);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  GPGPU_CHECKGLERR << "intializing projection&modelview matrix";

  glDisable(GL_CULL_FACE);
	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);				// Black Background
	glClearDepth(1.0f);									// Depth Buffer Setup
  glDisable(GL_DEPTH_TEST);							// Enables Depth Testing
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
  glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
  glDepthMask(false);

  GPGPU_CHECKGLERR << "setting up openGL context";
}
Пример #15
0
	DatabaseLogger::DatabaseLogger (OStream& os)
		: Logger (os)
	{
		Activate (true);
	}
/*
================
idPhysics_Monster::SetLinearVelocity
================
*/
void idPhysics_Monster::SetLinearVelocity(const idVec3 &newLinearVelocity, int id)
{
	current.velocity = newLinearVelocity;
	Activate();
}
Пример #17
0
/*
   The numArg here is the listbox item index while the strArg is used
   differently for the different actions:

   a) for wxACTION_LISTBOX_FIND it has the natural meaning: this is the string
      to find

   b) for wxACTION_LISTBOX_SELECT and wxACTION_LISTBOX_EXTENDSEL it is used
      to decide if the listbox should send the notification event (it is empty)
      or not (it is not): this allows us to reuse the same action for when the
      user is dragging the mouse when it has been released although in the
      first case no notification is sent while in the second it is sent.
 */
bool wxListBox::PerformAction(const wxControlAction& action,
                              long numArg,
                              const wxString& strArg)
{
    int item = (int)numArg;

    if ( action == wxACTION_LISTBOX_SETFOCUS )
    {
        SetCurrentItem(item);
    }
    else if ( action == wxACTION_LISTBOX_ACTIVATE )
    {
        Activate(item);
    }
    else if ( action == wxACTION_LISTBOX_TOGGLE )
    {
        if ( item == -1 )
            item = m_current;

        if ( IsSelected(item) )
            DoUnselect(item);
        else
            SelectAndNotify(item);
    }
    else if ( action == wxACTION_LISTBOX_SELECT )
    {
        DeselectAll(item);

        if ( strArg.empty() )
            SelectAndNotify(item);
        else
            DoSelect(item);
    }
    else if ( action == wxACTION_LISTBOX_SELECTADD )
        DoSelect(item);
    else if ( action == wxACTION_LISTBOX_UNSELECT )
        DoUnselect(item);
    else if ( action == wxACTION_LISTBOX_MOVEDOWN )
        ChangeCurrent(1);
    else if ( action == wxACTION_LISTBOX_MOVEUP )
        ChangeCurrent(-1);
    else if ( action == wxACTION_LISTBOX_PAGEDOWN )
        ChangeCurrent(GetItemsPerPage());
    else if ( action == wxACTION_LISTBOX_PAGEUP )
        ChangeCurrent(-GetItemsPerPage());
    else if ( action == wxACTION_LISTBOX_START )
        SetCurrentItem(0);
    else if ( action == wxACTION_LISTBOX_END )
        SetCurrentItem(GetCount() - 1);
    else if ( action == wxACTION_LISTBOX_UNSELECTALL )
        DeselectAll(item);
    else if ( action == wxACTION_LISTBOX_EXTENDSEL )
        ExtendSelection(item);
    else if ( action == wxACTION_LISTBOX_FIND )
        FindNextItem(strArg);
    else if ( action == wxACTION_LISTBOX_ANCHOR )
        AnchorSelection(item == -1 ? m_current : item);
    else if ( action == wxACTION_LISTBOX_SELECTALL ||
              action == wxACTION_LISTBOX_SELTOGGLE )
        wxFAIL_MSG(_T("unimplemented yet"));
    else
        return wxControl::PerformAction(action, numArg, strArg);

    return true;
}
Пример #18
0
void TBWindow::OnAdded()
{
	// If we was added last, call Activate to update status etc.
	if (GetParent()->GetLastChild() == this)
		Activate();
}
Пример #19
0
/*
================
idPhysics_Parametric::SetLinearExtrapolation
================
*/
void idPhysics_Parametric::SetLinearExtrapolation( extrapolation_t type, int time, int duration, const idVec3 &base, const idVec3 &speed, const idVec3 &baseSpeed ) {
	current.time = gameLocal.time;
	current.linearExtrapolation.Init( time, duration, base, baseSpeed, speed, type );
	current.localOrigin = base;
	Activate();
}
Пример #20
0
void CUISliderctrl::Event(TEventUI& event)
{
	if( event.Type == UIEVENT_SETCURSOR )
	{
		if( ::PtInRect(&m_rcButton, event.ptMouse) && IsEnabled() ) {
			::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
			return;
		}
	}

	int nPosLast = m_nPos;

   if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
   {
      if( ::PtInRect(&m_rcButton, event.ptMouse) && IsEnabled() ) {
         m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED;
         Invalidate();

		 m_ptLast = event.ptMouse;
		 m_nButtonOffset = m_ptLast.x - m_rcButton.left;
      }

	  if (::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled())
	  {
		  if (event.ptMouse.x < m_rcButton.left)
		  {
			  m_nPos -= m_nPageSize;
			  CheckPosValue();
			  Invalidate();
		  }

		  if (event.ptMouse.x > m_rcButton.right)
		  {
			  m_nPos += m_nPageSize;
			  CheckPosValue();
			  Invalidate();
		  }
	  }
   }
   if( event.Type == UIEVENT_MOUSEMOVE )
   {
      if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {

		  int nButtonWidth = (m_rcButton.right - m_rcButton.left);

		  int nOffsetX =  event.ptMouse.x - m_rcItem.left - m_nButtonOffset;

		  TRACE(_T("the pos x is %d\n"), nOffsetX);


		  if (nOffsetX < 0)
		  {
			  nOffsetX = 0;
		  }

		  if (nOffsetX > m_rcItem.right - m_rcItem.left - nButtonWidth)
		  {
			  nOffsetX = m_rcItem.right - m_rcItem.left - nButtonWidth;
		  }

		  double dblOffset = (double)nOffsetX / (double)(m_rcItem.right - m_rcItem.left - nButtonWidth);

		  TRACE(_T("the pos dblOffset is %.2f\n"), dblOffset);

		  m_nPos = m_nPosMin + (m_nPosMax - m_nPosMin) * dblOffset;
		  CheckPosValue();

		  TRACE(_T("the m_nPos  is %d\n"), m_nPos);

		 int nValue1 = m_nPos / m_nPageSize;
		 int nValue2 = m_nPos % m_nPageSize;

		 if (event.ptMouse.x - m_ptLast.x > 0 )
		 {
			 if (nValue2 != 0 && nValue2 > m_nPageSize / 2)
			 {
				 m_nPos = (nValue1 + 1) * m_nPageSize;
				 Invalidate();
			 }
			 else
			 {
				 if (nValue2 != 0)
				 {
					m_nPos = nValue1 * m_nPageSize;
				 }
				 else
				 {
					Invalidate();
				 }
				 
			 }
		 }
		 else
		 {
			 if (nValue2 != 0 && nValue2 < m_nPageSize / 2)
			 {
				 m_nPos = (nValue1 + 0) * m_nPageSize;
				 Invalidate();
			 }
			 else
			 {
				 if (nValue2 != 0)
				 {
					m_nPos = (nValue1 + 1) * m_nPageSize;
				 }
				 else
				 {
					 Invalidate();
				 }
				 
			 }
		 }
      }
	  else
	  {
		  if( ::PtInRect(&m_rcButton, event.ptMouse) )
		  {
		   m_uButtonState |= UISTATE_HOT;
		  }
		  else 
		  {
		   m_uButtonState &= ~UISTATE_HOT;
		  }

		  Invalidate();
	  }

	  m_ptLast = event.ptMouse;
   }

   if( event.Type == UIEVENT_BUTTONUP )
   {
      if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
         if( ::PtInRect(&m_rcButton, event.ptMouse) ) Activate();
         m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED);
		 CheckPosValue();
         Invalidate();
      }
   }

   if (event.Type == UIEVENT_SCROLLWHEEL)
   {

	   if (::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled())
	   {
		   switch( LOWORD(event.wParam) ) {
		  case SB_LINEUP:
			  m_nPos += m_nPageSize;
			  break;
		  case SB_LINEDOWN:
			  m_nPos -= m_nPageSize;
			  break; 
		   }
		   CheckPosValue();
		   Invalidate();
	   }

   }

   if (nPosLast != m_nPos)
   {
	   if (m_pManager)
	   {
		   m_pManager->SendNotify(this, UI_NOTIFY_SLIDER_POS_CHANGED);

		   TRACE(_T("SendNotify\n"));
	   }
   }

   if( event.Type == UIEVENT_MOUSELEAVE)
   {
	   m_uButtonState &= ~UISTATE_HOT;
	   Invalidate();
   }

   CUIControl::Event(event);
}
Пример #21
0
/*
================
idPhysics_Parametric::SetLinearInterpolation
================
*/
void idPhysics_Parametric::SetLinearInterpolation( int time, int accelTime, int decelTime, int duration, const idVec3 &startPos, const idVec3 &endPos ) {
	current.time = gameLocal.time;
	current.linearInterpolation.Init( time, accelTime, decelTime, duration, startPos, endPos );
	current.localOrigin = startPos;
	Activate();
}
void
JXSearchTextDialog::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	JBoolean found = kJFalse;

	JXWindowDirector* director = NULL;
	if (itsTE != NULL)
		{
		director = (itsTE->GetWindow())->GetDirector();
		}

	if (sender == itsFindFwdButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->SearchForward())
			{
			found = kJTrue;
			director->Activate();
			}
		}
	else if (sender == itsFindBackButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->SearchBackward())
			{
			found = kJTrue;
			director->Activate();
			}
		}

	else if (sender == itsReplaceButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->ReplaceSelection())
			{
			found = kJTrue;
			director->Activate();
			}
		}

	else if (sender == itsReplaceFindFwdButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->ReplaceAndSearchForward())
			{
			found = kJTrue;
			director->Activate();
			}
		}
	else if (sender == itsReplaceFindBackButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->ReplaceAndSearchBackward())
			{
			found = kJTrue;
			director->Activate();
			}
		}

	else if (sender == itsReplaceAllFwdButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->ReplaceAllForward())
			{
			found = kJTrue;
			director->Activate();
			}
		}
	else if (sender == itsReplaceAllBackButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->ReplaceAllBackward())
			{
			found = kJTrue;
			director->Activate();
			}
		}
	else if (sender == itsReplaceAllInSelButton && message.Is(JXButton::kPushed))
		{
		if (itsTE != NULL && itsTE->ReplaceAllInSelection())
			{
			found = kJTrue;
			director->Activate();
			}
		}

	else if (sender == itsHelpButton && message.Is(JXButton::kPushed))
		{
		(JXGetHelpManager())->ShowSection(itsSearchTextHelpName);
		}
	else if (sender == itsQRefButton && message.Is(JXButton::kPushed))
		{
		(JXGetHelpManager())->ShowSection(kJXRegexQRefHelpName);
		}

	else if (sender == itsCloseButton && message.Is(JXButton::kPushed))
		{
		Deactivate();
		}

	else if (sender == itsPrevSearchMenu && message.Is(JXMenu::kItemSelected))
		{
		// need local copy since menu is changed
		const JString str       = itsPrevSearchMenu->GetItemText(message);
		const JBoolean wasRegex = itsSearchIsRegexCB->IsChecked();
		SetSearchText(str);
		itsSearchIsRegexCB->SetState(wasRegex);
		}
	else if (sender == itsPrevReplaceMenu && message.Is(JXMenu::kItemSelected))
		{
		// need local copy since menu is changed
		const JString str       = itsPrevReplaceMenu->GetItemText(message);
		const JBoolean wasRegex = itsReplaceIsRegexCB->IsChecked();
		SetReplaceText(str);
		itsReplaceIsRegexCB->SetState(wasRegex);
		}

	else if (sender == GetWindow() && message.Is(JXWindow::kIconified))
		{
		if ((GetWindow())->IsVisible())
			{
			itsUpdateTask->Stop();
			}
		}
	else if (sender == GetWindow() && message.Is(JXWindow::kDeiconified))
		{
		if ((GetWindow())->IsVisible())
			{
			itsUpdateTask->Start();
			}
		}
	else if (sender == itsUpdateTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		UpdateDisplay();
		}

	else if (sender == itsSearchInput || sender == itsReplaceInput)
		{
		UpdateDisplay();

		if (!itsIgnoreXSearchChangeFlag &&
			(message.Is(JTextEditor::kTextSet) ||
			 (message.Is(JXWidget::kLostFocus) && itsNeedXSearchBcastFlag)))
			{
			SetXSearch();
			}
		else if (!itsIgnoreXSearchChangeFlag && message.Is(JTextEditor::kTextChanged))
			{
			itsNeedXSearchBcastFlag = kJTrue;	// wait for them to use it
			}
		}

	else if (sender == itsWrapSearchCB ||
			 sender == itsEntireWordCB ||
			 sender == itsIgnoreCaseCB ||
			 sender == itsSearchIsRegexCB ||
			 sender == itsSingleLineCB ||
			 sender == itsReplaceIsRegexCB ||
			 sender == itsPreserveCaseCB)
		{
		UpdateDisplay();
		if (!itsIgnoreXSearchChangeFlag)
			{
			SetXSearch();
			}
		}

	else if (sender == itsStayOpenCB)
		{
		UpdateDisplay();
		}

	else
		{
		JXWindowDirector::Receive(sender, message);
		}

	if (found && !itsStayOpenCB->IsChecked())
		{
		Deactivate();
		}
	else if (found && itsRetainFocusCB->IsChecked())
		{
		Activate();
		}
}
Пример #23
0
/*
================
idPhysics_Parametric::SetLinearVelocity
================
*/
void idPhysics_Parametric::SetLinearVelocity( const idVec3 &newLinearVelocity, int id ) {
	SetLinearExtrapolation( extrapolation_t(EXTRAPOLATION_LINEAR|EXTRAPOLATION_NOSTOP), gameLocal.time, 0, current.origin, newLinearVelocity, vec3_origin );
	current.linearInterpolation.Init( 0, 0, 0, 0, vec3_zero, vec3_zero );
	Activate();
}
Пример #24
0
void CToolTipCtrlEx::ActivateToolTips(bool i_activate)
{
 m_activated = i_activate;
 Activate(i_activate && m_activated_all);
}
Пример #25
0
void CWndToolTip::Start()
{
	ASSERT(::IsWindow(m_hWnd));
	::SetWindowPos(m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
	Activate( true );
}
void LandsideIntersectLinkGroupInSim::OnActive(CARCportEngine*pEngine)
{
	ElapsedTime nextTime;
	if (!m_bFirstTimeActive)
	{
		switch (m_eState)
		{
		case LS_ACTIVE:
			{
				SetState(LS_BUFFER);
				nextTime=(curTime()+(long)m_ctrlTime.bufferTime);
				break;
			}
		case LS_BUFFER:
			{
				SetState(LS_CLOSE);
				nextTime=(curTime()+(long)m_ctrlTime.closeTime);
				break;
			}
		case LS_CLOSE:
			{
				SetState(LS_ACTIVE);
				nextTime=(curTime()+(long)m_ctrlTime.activeTime);
				break;
			}
		default:
			{
				break;
			}
		}
		
	}else
	{
		if (m_nFirstCloseTime == 0)
		{
			SetState(LS_ACTIVE);
			nextTime=(curTime()+(long)m_ctrlTime.activeTime);

		}else
		{
			SetState(LS_CLOSE);
			nextTime=(curTime()+(long)m_nFirstCloseTime);
		}
		m_bFirstTimeActive=false;
	}

	//LinkStateChangeSignal *linkStateSignal=new LinkStateChangeSignal;
	//SendSignal(linkStateSignal);
	//ClearListener();
	NotifyObservers();



	WriteLog(curTime());
	if (/*m_tEndTime==0L ||*/ nextTime<m_tEndTime)
	{
		Activate(nextTime);
	}
	else
	{
		SetState(LS_ACTIVE);
	}

}
Пример #27
0
void FLiveEditorManager::Tick(float DeltaTime)
{
	//avoid multiple tick DOOM ( FTickableGameObject's get ticked once per UWorld that is active and Ticking )
	float CurTime = GWorld->GetRealTimeSeconds();
	if ( LastUpdateTime == CurTime )
	{
		return;
	}
	LastUpdateTime = CurTime;

	if ( LiveEditorWorld == NULL )
	{
		CreateLiveEditorWorld();
	}

	RealWorld = GWorld;
	check( LiveEditorWorld != NULL );
	GWorld = LiveEditorWorld;

	if ( ActiveBlueprints.Num() > 0 )
		LiveEditorWorld->Tick( ELevelTick::LEVELTICK_All, DeltaTime );

	//
	//update our ActiveBlueprints
	//
	int32 i = 0;
	while ( i < ActiveBlueprints.Num() )
	{
		FActiveBlueprintRecord record = ActiveBlueprints[i];
		ULiveEditorBlueprint *Instance = record.Blueprint.Get();
		if ( Instance == NULL )
		{
			ActiveBlueprints.RemoveAtSwap(i);	//clean out the dead entry
			Activate( record.Name );			//try to ressurect the Blueprint (user has likely just recompiled it)
			continue;
		}
		Instance->Tick( DeltaTime );
		++i;
	}

	//
	// handle the actual MIDI messages
	//
	for( TMap< PmDeviceID, FLiveEditorDeviceInstance >::TIterator It(InputConnections); It; ++It )
	{
		PmDeviceID DeviceID = (*It).Key;
		FLiveEditorDeviceInstance &DeviceInstance = (*It).Value;
		int NumRead = Pm_Read( DeviceInstance.Connection.MIDIStream, MIDIBuffer, DEFAULT_BUFFER_SIZE ); //needs to remain int (instead of int32) since numbers are derived from TPL that uses int
		if ( NumRead < 0 )
		{
			continue; //error occurred, portmidi should handle this silently behind the scenes
		}
		else if ( NumRead > 0 )
		{
			DeviceInstance.Data.LastInputTime = GWorld->GetTimeSeconds();
		}

		//dispatch
		for ( int32 BufferIndex = 0; BufferIndex < NumRead; BufferIndex++ )
		{
			PmMessage Msg = MIDIBuffer[BufferIndex].message;
			int Status = Pm_MessageStatus(Msg);	//needs to remain int (instead of int32) since numbers are derived from TPL that uses int
			int Data1 = Pm_MessageData1(Msg);	//needs to remain int (instead of int32) since numbers are derived from TPL that uses int
			int Data2 = Pm_MessageData2(Msg);	//needs to remain int (instead of int32) since numbers are derived from TPL that uses int

			if ( ActiveWizard != NULL )
			{
				ActiveWizard->ProcessMIDI( Status, Data1, Data2, DeviceID, DeviceInstance.Data );
			}
			else
			{
				switch ( DeviceInstance.Data.ConfigState )
				{
					case FLiveEditorDeviceData::UNCONFIGURED:
						break;
					case FLiveEditorDeviceData::CONFIGURED:
						Dispatch( Status, Data1, Data2, DeviceInstance.Data );
						break;
					default:
						break;
				}
			}
		}
	}

	PieObjectCache.EvaluatePendingCreations();

	GWorld = RealWorld;
	RealWorld = NULL;
}
Пример #28
0
void AAREffectPeriodic::ServerActivate_Implementation()
{
	Activate();
}
Пример #29
0
/**
checks notifications are received and makes sure that they're correct,
times out if notification is not received after timeout period
*/	
void CNotificationStep::CNotificationActive::RunL()
	{
	_LIT(KDatabaseGenerated,"Database Generated");
	_LIT(KExpected,"Expected");
	iStep->iEnd.UniversalTime();

	
	if( iStep->iEnd.MicroSecondsFrom( iStep->iStart ).Int64() > KTimeout ) //test has timed out
		{
		 _LIT(KTimedOut,"CNotificationStep listener has timed out");
		iStep->ERR_PRINTF1(KTimedOut );
		iStep->PrintNotifications(KDatabaseGenerated, *iStep->iDBEvents, *iStep->iDBContacts);
		iStep->PrintNotifications(KExpected, *iStep->iSharedEvents, *iStep->iSharedContacts);
		iStep->TEST1( EFalse, ETrue );//fail test
		iStep->ResetArrays();
		iStep->iMessageCount = KInitialCount;
		iStep->iStart.UniversalTime();
		CActiveScheduler::Stop();
		}
	else if( iStep->iMessageCount > KInitialCount )// if zero or more notifications are expected
		{
		//all expected messages have been received
		if( iStep->iMessageCount == iStep->iSharedEvents->Count() 
			&& iStep->iMessageCount == iStep->iSharedContacts->Count()
			&& iStep->iMessageCount == iStep->iDBEvents->Count() 
			&& iStep->iMessageCount == iStep->iDBContacts->Count() )
			{
			const TBool chk = (iStep->*iCheck)();
			iStep->TEST1( chk  , ETrue );
			//if test fails
			if(!chk)
				{
				iStep->PrintNotifications(KDatabaseGenerated, *iStep->iDBEvents, *iStep->iDBContacts);
				iStep->PrintNotifications(KExpected, *iStep->iSharedEvents, *iStep->iSharedContacts);
				}
			iStep->iMessageCount = KInitialCount;
			iStep->ResetArrays();
			iStep->iStart.UniversalTime();
			CActiveScheduler::Stop();	
			}
		else//wait for rest of db message to be propogated
			{
			Activate();
			}
		}
	else //test hasnt timed out and no notifications are expected
		{
		if( !iClear )//not expecting to receive notifications for contacts added in preamble, fail test.
			{			
			_LIT(KEmptyTestError,"CNotificationStep::CNotificationActive::RunL: Notifications have not been queued up");
			iStep->ERR_PRINTF1(KEmptyTestError );
			iStep->TEST1( EFalse, ETrue );//fail test
			iStep->ResetArrays();
			iStep->iMessageCount = KInitialCount;
			CActiveScheduler::Stop();
			}
		//expecting to receive notifications for contacts added in preamble, have received all expected notifications
		else if( iStep->iDBContacts->Count() >= KNumberOfContacts )
			{
			iStep->ResetArrays();
			iStep->iMessageCount = KInitialCount;
			CActiveScheduler::Stop();
			}
		else//have not received all expected notifications from contacts added in preamble
			{
			Activate();
			}
		}
	}
Пример #30
0
 Buffer& Load(GLenum buffer, GLenum role, E* source, size_t count) {
     Activate(buffer);
     glBufferData(buffer, sizeof(E) * count, source, role);
     return *this;
 }