Example #1
0
    // ******************************************************************
    void MainViewModel::StartSpider()
    {
        CanStart(false);
        CanStop(true);

        _httpSpider->Start(_startUrl, _urlsCount, _threadsCount, _text);
    }
		void TapeRecorder::OnMenuExtTape(const Window::Menu::PopupHandler::Param& param)
		{
			param.menu[ IDM_MACHINE_EXT_TAPE_FILE   ].Enable( !param.show || CanSetFile() );
			param.menu[ IDM_MACHINE_EXT_TAPE_STOP   ].Enable( !param.show || CanStop()    );
			param.menu[ IDM_MACHINE_EXT_TAPE_PLAY   ].Enable( !param.show || CanPlay()    );
			param.menu[ IDM_MACHINE_EXT_TAPE_RECORD ].Enable( !param.show || CanRecord()  );
		}
		void TapeRecorder::OnCmdStop(uint)
		{
			if (CanStop())
			{
				Nes::TapeRecorder(emulator).Stop();
				Resume();
			}
		}
		void Sound::Recorder::OnCmdStop(uint)
		{
			if (CanStop())
			{
				Io::Screen() << Resource::String(IDS_SCREEN_SOUND_RECORDER_STOP);

				recording = false;
				Resume();
			}
		}
//---------------------------------------------
//
// Check if particles move outside of window
//
//---------------------------------------------
void ParticleGroups::BoundaryControl_Window()
{
	if(!Is_Foreground)
	{
		Particle* indexPar = &particle[head_par];
		int iter = 0;
		while(iter < numpt)	// start from the first particle
		{
			int indexID = indexPar->id;
			indexPar = indexPar->next;
			//particle[indexID].visibility_timer++;
			// if this par moves out of boundary, do not kill, instead make them move in backstage
			// delete it from grids
			if(particle[indexID].OutOfBoudaryKill())	
			{
				//particle[indexID].visibility_timer = 0;
				particle[indexID].Was_released = particle[indexID].Is_released;
				particle[indexID].Is_released = false;	// if false, don't draw it, just deactive the birth and death
				particle[indexID].Was_visible = particle[indexID].Is_visible;
				particle[indexID].Is_visible = false;
				if(FillGrids && particle[indexID].Was_released &&!particle[indexID].Is_released)
					grid.deletePar(&particle[indexID]);// delete it from the quadtree
			}
			// if the particle moves back to screen
			// set it as released again and insert it back to grid again
			else
			{
				if(!particle[indexID].Is_released)		// keep checking all particles, if one moved out of boudary and move back, activate it again
				{
				//	particle[indexID].visibility_timer = VISIBILITY_TIMER_LIMIT;
					particle[indexID].Was_released = particle[indexID].Is_released;
					particle[indexID].Is_released = true;
					if(FillGrids&& !particle[indexID].Was_released && particle[indexID].Is_released)
						grid.insertPar(&particle[indexID]);
				}
				//if(particle[indexID].visibility_timer>=VISIBILITY_TIMER_LIMIT)
				//{
					//particle[indexID].visibility_timer = 0;
					particle[indexID].Was_visible = particle[indexID].Is_visible;
					particle[indexID].Is_visible = true;
					
				//}
			}
			iter++;
		}
	}
	CanStop();
}
Example #6
0
    void MainViewModel::InitView()
    {
        CanStart(true);
        CanStop(false);
        ThreadsCount(_threadsCount);
        UrlsCount(_urlsCount);
        StartUrl(_startUrl.c_str());
        Text(_text.c_str());

        PropertyChanged(PropertyChangedEventArgs("CanStart"));
        PropertyChanged(PropertyChangedEventArgs("CanStop"));
        PropertyChanged(PropertyChangedEventArgs("ThreadsCount"));
        PropertyChanged(PropertyChangedEventArgs("UrlsCount"));
        PropertyChanged(PropertyChangedEventArgs("StartUrl"));
        PropertyChanged(PropertyChangedEventArgs("Text"));
    }
//--------------------------------------------------
//
// Check if particles move outside of the open area
//
//--------------------------------------------------
void ParticleGroups::BoundaryControl_Foreground()
{
	if(Is_Foreground)
	{
		Particle* indexPar = &particle[head_par];
		int iter = 0;
		while(iter<numpt)
		{
			int indexID = indexPar->id;
			indexPar = indexPar->next;
			//particle[indexID].visibility_timer++;
			// if this par moves out of window, do not kill, mark them as not released
			// delete it from grids
			if(particle[indexID].OutOfBoudaryKill())
			{
				//particle[indexID].visibility_timer = 0;// if particles move out of window, do not accumulate the timer
				if(particle[indexID].Is_released)
				{
					particle[indexID].Was_released = particle[indexID].Is_released;
					particle[indexID].Is_released = false;	// if false, don't draw it, just deactive the birth and death
					particle[indexID].Was_visible = particle[indexID].Is_visible;
					particle[indexID].Is_visible = false;

					// if it is dying with a neighbor who is still inside the window, stop dying
					if(particle[indexID].Is_dying)
					{
						if(particle[indexID].prev->beacon_id == particle[indexID].dyingwith && particle[indexID].prev->Is_released)
						{
							particle[indexID].prev->Is_dying = false;
							particle[indexID].prev->dyingwith = -1;
							particle[indexID].Is_dying = false;
							particle[indexID].dyingwith = -1;
						}
						else if(particle[indexID].next->beacon_id == particle[indexID].dyingwith && particle[indexID].next->Is_released)
						{
							particle[indexID].next->Is_dying = false;
							particle[indexID].next->dyingwith = -1;
							particle[indexID].Is_dying = false;
							particle[indexID].dyingwith = -1;
						}
					}
				}
				if(FillGrids && particle[indexID].Was_released &&!particle[indexID].Is_released)// if the par just moves out of the open area
					grid.deletePar(&particle[indexID]);// delete it from grids
			}
			// if the particle is inside the window
			else 
			{	// if the particle moves back to window
				// set it as released again and insert it back to grid again
				if(!particle[indexID].Is_released)
				{ 
					// keep checking all particles, if one moved out of open area and moved back, activate it again
					//particle[indexID].visibility_timer = VISIBILITY_TIMER_LIMIT; // set the timer as the limit, so it can change its boolean Is_visible
					particle[indexID].Was_released = particle[indexID].Is_released;
					particle[indexID].Is_released = true;
					if(FillGrids&& !particle[indexID].Was_released && particle[indexID].Is_released) // wasn't released and now is
						grid.insertPar(&particle[indexID]);
				}
				if(OutOfFeatureMap(&particle[indexID]) && particle[indexID].Is_visible)
				{
					//if(particle[indexID].visibility_timer >= VISIBILITY_TIMER_LIMIT)
					//{
						//particle[indexID].visibility_timer = 0;
						particle[indexID].Was_visible = particle[indexID].Is_visible;
						particle[indexID].Is_visible = false;
					//}
				}
				else if(!OutOfFeatureMap(&particle[indexID]) && !particle[indexID].Is_visible)
				{
					//if(particle[indexID].visibility_timer >= VISIBILITY_TIMER_LIMIT)
					//{
					// if the particle moves back to the foreground area
					// set it as visible again
						//particle[indexID].visibility_timer = 0;	 // set back to zero
						particle[indexID].Was_visible = particle[indexID].Is_visible;
						particle[indexID].Is_visible = true;
					//}
				}
			}
			iter++;
		}
	}
	CanStop();
}
Example #8
0
 void MainViewModel::StopSpider()
 {
     CanStop(false);
     _httpSpider->Stop();
     CanStart(true);
 }
dword LoadedTAPPage::TAPListItem::OnKey( dword key, dword extKey )
{
	switch ( key )
	{
	case RKEY_Ok:
	{
		if ( IsThisTAP( m_index ) )
		{
			m_theList->Replace(new ConfigPage());
		}
		else
		{
			// Check whether this is a TSR Commander TAP with a config option
			TYPE_TSRCommander* tapBlock = IsTSRCommanderTAP( m_index );
			if ( tapBlock && tapBlock->HasConfigDialog )
			{
				m_theList->Close();
				tapBlock->ShowConfigDialog = TRUE;
			}
		}
		return 1;
	}
	case RKEY_NewF1:
		// we don't want to disable ourselves
		EnableTAP( !IsEnabled( m_index ) );
		return 1;

	case RKEY_F2:
	{
		bool enable = !IsEnabled( m_index );
		// Toggle all
		for ( int i = 0; i < TAP_MAX; ++i )
		{
			if ( CanDisable( i ) )
				::EnableTAP( i, enable );
		}

		// Page redraws when returning 0
		return 0;
	}

	case RKEY_Stop:
	case RKEY_Ab:
	{
		// special case for this TAP so we don't need to add the TSRCommander stuff
		if ( IsThisTAP( m_index ) )
		{
			Tapplication::GetTheApplication()->Close();
			return 0;
		}
		TYPE_TSRCommander* tapBlock = IsTSRCommanderTAP( m_index );
		if ( tapBlock )
		{
			tapBlock->ExitTAP = TRUE;
			if ( closeOnClose )
				m_theList->Close();
			else
			{
				m_closing = true;
				m_theList->RedrawItem(this);
			}
		}
		return 1;
	}
	case RKEY_Sat:
		if ( MessageBox::Show("Stop all TAPs?", "", "Yes\nNo" ) == 1 )
		{
			for ( int i = 0; i < TAP_MAX; ++i )
			{
				if ( !IsThisTAP( i ) && CanStop( i ) )
				{
					TYPE_TSRCommander* tapBlock = IsTSRCommanderTAP( i );
					if ( tapBlock )
						tapBlock->ExitTAP = TRUE;
				}
			}
		}
		return 1;
	}

	return key;
}
		void Sound::Recorder::OnMenu(const Window::Menu::PopupHandler::Param& param)
		{
			menu[ IDM_FILE_SOUND_RECORDER_START  ].Enable( !param.show || CanRecord() );
			menu[ IDM_FILE_SOUND_RECORDER_STOP   ].Enable( !param.show || CanStop()   );
			menu[ IDM_FILE_SOUND_RECORDER_REWIND ].Enable( !param.show || CanRewind() );
		}