示例#1
0
static void OnActiveButton(WndButton* pWnd){

  if (HoldOff ==0)
  {
    int res = dlgWayPointSelect(0, 90.0, 1, 3);
    if(res > RESWP_END )
    if(ValidWayPoint(res))
    {
      double  Frequency = StrToDouble(WayPointList[res].Freq,NULL);
      if(!ValidFrequency(Frequency))
      {
   // 	DoStatusMessage(_T("No valid Frequency!") );
	return;
      }
      devPutFreqActive(Frequency, WayPointList[res].Name);
      _stprintf(RadioPara.ActiveName,_T("%s"), WayPointList[res].Name);
      RadioPara.ActiveFrequency = Frequency;

      ActiveRadioIndex = res;
    }
    OnUpdate();
    HoldOff = HOLDOFF_TIME;
  }
}
示例#2
0
//------------------------------------------------------------------------------
// OnBrowse
//
void WsdlFileView::OnBrowse()
{
  QString seedFile = QSettings().value(WsInfo().WsdlFileNameKey(m_host), QVariant()).toString();

  // Load file
  QString fileName = QFileDialog::getOpenFileName(this, QString("Select %1 WSDL File").arg(m_host), seedFile, "WSDL (*.wsdl);; All (*.*)");

  if (fileName.isEmpty())
    return;

  ui.WsdlFileNameLabel->setText(QFileInfo(fileName).fileName());
  ui.WsdlFileNameLabel->setToolTip(QDir::toNativeSeparators(fileName));

  if (HeaderContainerWidget* w = qobject_cast<HeaderContainerWidget*>(parent()->parent()))
  {
    w->Header()->SetTitle(QFileInfo(fileName).fileName());
    w->Header()->setToolTip(QDir::toNativeSeparators(fileName));
  }

  QSettings().setValue(WsInfo().WsdlFileNameKey(m_host), fileName);
  WsInfo().SetWsdlFile(m_host, fileName);
  m_wsdlFile = WsInfo().Wsdl(m_host);
  OnUpdate();
}
void CToolManagerHardDisk::InitDlgInfo(SDK_SystemFunction *pSysFunc, H264_DVR_DEVICEINFO *pDeviceInfo)
{
	memcpy(&m_systemFunction,pSysFunc,sizeof(SDK_SystemFunction));

	if (m_systemFunction.vEncodeFunction[SDK_ENCODE_FUNCTION_TYPE_SNAP_STREAM])
	{
	 GetDlgItem(IDC_BTN_SS)->ShowWindow(SW_SHOW);
	}
	else
	{
	 GetDlgItem(IDC_BTN_SS)->ShowWindow(SW_HIDE);
	}

	if (strcmp(pDeviceInfo->sSoftWareVersion, "V2.40.R06") >= 0)
	{
		EnableItems(TRUE);
	}
	else
	{
		EnableItems(FALSE);
	}

	OnUpdate();
}
示例#4
0
//------------------------------------------------------------------------------
// WsdlFileView
//
WsdlFileView::WsdlFileView(const QString& host, QWidget* parent)
  : QWidget(parent),
  m_host(host),
  m_wsdlFile(WsInfo().Wsdl(host))
{
  ui.setupUi(this);

  ui.TableView->setModel(&m_model);
  ui.TableView->horizontalHeader()->hide();
  ui.TableView->verticalHeader()->hide();
  ui.TableView->horizontalHeader()->setStretchLastSection(true);
  ui.TableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
  connect(ui.TableView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(OnMethodDoubleClicked(const QModelIndex&)));

  ui.WsdlFileNameLabel->setText(QFileInfo(m_wsdlFile->FileName()).fileName());
  ui.WsdlFileNameLabel->setToolTip(QDir::toNativeSeparators(m_wsdlFile->FileName()));

  connect(ui.BrowseBtn, SIGNAL(clicked()), this, SLOT(OnBrowse()));
  connect(&m_model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(OnModelChanged(QStandardItem*)));
  connect(m_wsdlFile, SIGNAL(WsdlMethodUpdated()), this, SLOT(OnWsdlMethodUpdated()));

  // force update after the m_wsdlFile has been parsed and instantiated in its constructor
  QTimer::singleShot(0, this, SLOT(OnUpdate()));
}
示例#5
0
void CModuleWnd::OnLibOpen() 
{
	ASSERT(m_pCurrentDocument == NULL);	//当前应处于库目录显示状态中
	AfxGetApp()->DoWaitCursor(1);

	//打开库文档
	POSITION pos = GetListCtrl()->GetFirstSelectedItemPosition();
	int index = GetListCtrl()->GetNextSelectedItem(pos);
	if (index < 0)
		return;
	TCHAR buffer[40];
	GetListCtrl()->GetItemText(index, 0, buffer, 40);
	CString strName = buffer;

	CModuleDoc* pDoc = new CModuleDoc();
	if (pDoc == NULL)
		AfxThrowMemoryException();
	pDoc->OpenLib(strName);
	
	//设置新图标大小
//	GetListCtrl()->SetImageList(&m_ImageContentSmall, LVSIL_SMALL);
//	GetListCtrl()->SetImageList(&m_ImageContentLarge, LVSIL_NORMAL);

	//更新显示
	m_pCurrentDocument = pDoc;

	//改变图标
	GetListCtrl()->SetImageList(&m_pCurrentDocument->m_listImage, LVSIL_SMALL);
	GetListCtrl()->SetImageList(&m_pCurrentDocument->m_listImageLarge, LVSIL_NORMAL);

	OnUpdate();
	DoCommand(-1);

	AfxGetApp()->DoWaitCursor(-1);

}
示例#6
0
void Window::Update(float elapsed)
{
    if (IsDone())
    {
        return;
    }

    OnUpdate(elapsed);

    WindowList doneChildren;
    for (WindowList::iterator iter = m_children.begin(); iter != m_children.end(); ++iter)
    {
        const boost::shared_ptr<Window> child(*iter);
        if (child->IsDone())
        {
            doneChildren.push_back(child);
        }
    }

    for (WindowList::iterator iter = doneChildren.begin(); iter != doneChildren.end(); ++iter)
    {
        m_children.erase(find(m_children.begin(), m_children.end(), *iter));
    }
}
示例#7
0
    void SDLWrapper::OnExecute( )
    {
        // Frame starts
        //
        double startTime = m_timer->GetElapsedTime( );

        // Input
        //
        OnInput( );

        // Update
        //
        OnUpdate( );

        // Draw
        //
        OnRender( );


        // Time Management
        //
        double endTime = m_timer->GetElapsedTime( );
        double nextTimeFrame = startTime + DESIRED_FRAME_TIME;

        while( endTime < nextTimeFrame )
        {
            // Spin lock
            //
            endTime = m_timer->GetElapsedTime( );
        }

        // Frame ends
        //
        ++m_nUpdates;
        m_deltaTime = m_nUpdates / static_cast< double >( DESIRED_FRAME_RATE );
    }
示例#8
0
void CPlayerView::OnTimer(UINT nIDEvent) 
{
	OnUpdate( this,0 , NULL );

	if ( IDLE == m_nStatus )
	{
		m_nCurrentTime = 0;
		m_Position.SetPos( m_nCurrentTime );
	}

	if ( PLAYING == m_nStatus )
	{
		if ( m_pPlayStream )
		{
			m_nCurrentTime = (	m_pPlayStream->GetCurrentTime() + 
								m_dwSeekOffset );
		}

		m_Position.SetRange( 0, m_nTotalTime );
		m_Position.SetPos( m_nCurrentTime );
	}

	SetControls();
}
示例#9
0
void
FieldView::SetReferencePoint(unsigned which)
{
	mCurrentReferencePoint = which;
	OnUpdate(this);
}
int Luxko::Application::BaseApp::Run(HINSTANCE hInstance, int nCmdShow)
{
	//**********************************************************************
	// @Luxko: 1stly, register the window class.
	//			This job is delegates to the virtual function RegisterWindowClass.
	auto windowClass = RegisterWindowClass(hInstance);
	if (windowClass == NULL) {
		throw "Window class Registration failed!";
	}
	//**********************************************************************


	//**********************************************************************
	// @Luxko: 2ndly, create a window instance with the help of a WindowDescriptor,
	//			which encapsulates essential details for D3D window creation.
	WindowDescriptor wd(WindowStyle::OverlappedWindow, ExtendedWindowStyle::OverlappedWindow,
		0, 0,_width,_height);
	_hWindow = wd.GenerateWindowByATOM(hInstance, windowClass, _title);
	if (_hWindow == NULL) {
		throw "Window Creation F*****g failed!";
	}
	//**********************************************************************
	// @Luxko: Do the initialization necessary for the application.

	OnInit();
	//**********************************************************************
	// @Luxko: Now we're ready to show the window.
	ShowWindow(_hWindow, nCmdShow);
	//UpdateWindow(_hWindow);
	//**********************************************************************

	//**********************************************************************
	// @Luxko: Do the initialization necessary for the application.
	//OnInit();

	//**********************************************************************

	//**********************************************************************
	// @Luxko: go to the main loop.
	MSG msg = { 0 };
	while (true) {
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);

			if (msg.message == WM_QUIT) {
				break;
			}

			OnEvent(msg);
		}

		else {
			OnUpdate();
			OnRender();
		}
	}

	OnDestroy();
	//**********************************************************************

	//**********************************************************************
	// @Luxko: the returned value is the wParam of the last received
	//			WM_QUIT message.
	return static_cast<char>(msg.wParam);
	//**********************************************************************
}
示例#11
0
void ClimatologyConfigDialog::OnEnabled( wxCommandEvent& event )
{
    OnUpdate();
    pParent->PopulateTrackingControls();
}
示例#12
0
void CUIBase::Update(float fDeltaTime, ULONG ElapsedTime)
{
    OnUpdate(fDeltaTime, ElapsedTime);
    UpdateChild(fDeltaTime, ElapsedTime);
}
示例#13
0
int KRepresentMissileProcessor::Update(double fTime, double fTimeLast)
{
	return OnUpdate(fTime, fTimeLast);
}
示例#14
0
void IScrollMathModel::SetDirection(ScrollDirection val)
{
	RETURN_IF_EQUAL(mDirection, val);
	mDirection = val;
	OnUpdate();
}
示例#15
0
void CPhotoPubView::OnTimer(UINT_PTR nIDEvent)
{
	KillTimer(1);
	CPhotoPubDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: Add your message handler code here and/or call default
	int nFiles=m_CurFiles.size();
	set<CString> CurFiles1;
	const int nFiles1=GetAllFolderFile(m_WatchingPath, "*.jpg", CurFiles1);
	if (nFiles==nFiles1) {
		SetTimer(1,500,NULL);
		return;
	}else if (nFiles>nFiles1){
		AfxMessageBox("同步发生错误,无法恢复,请重新运行!\n");
		exit(1);
	}
	
	//Here Comes a new Photo
	//wait transfering
	Sleep(1000);
	//process
	set<CString>::iterator it1;
	for (it1=CurFiles1.begin();it1!=CurFiles1.end();++it1)
	{
		if ( m_CurFiles.find(*it1)==m_CurFiles.end() ) //not exist before
		{
			((CMainFrame*)GetParent())->ShowWindow(SW_SHOWMAXIMIZED);

			CClientDC cdc(this);
			CRect clrct;
			GetClientRect(&clrct);
			int width=clrct.Width();
			int height=clrct.Height();

			if (pDoc->m_pOpenedImage) ReleaseFImage(&pDoc->m_pOpenedImage);
			IplImage *pImg=pDoc->m_pOpenedImage=LoadFImage(m_WatchingPath+"\\"+*it1+".jpg");
			m_ratio=min(double(width)/pImg->width,double(height)/pImg->height);
			((CMainFrame*)GetParent())->SetRatio(int(m_ratio*100));
			OnUpdate(NULL,NULL,NULL);
			DrawImage(&cdc,pImg);

			CString newname;
			int res;
			do {
				GetNewName(m_InitStr,newname);
				res=rename(m_WatchingPath+"\\"+*it1+".jpg",m_WatchingPath+"\\"+newname+".jpg");
			}while( 
				(res==0) ? false : (true,
					(errno==EEXIST) ? AfxMessageBox("文件名重复!请重试"): (
						(errno==EINVAL) ? AfxMessageBox("文件名含非法字符!请重试"):AfxMessageBox("未知错误!请重试")
				) ) );
			m_CurFiles.insert(newname);
			m_InitStr=newname;
			CStringNumber snum(m_InitStr);
			snum.Increase();
			snum.ToString(m_InitStr);
			//break;
		}
	}
	
	CScrollView::OnTimer(nIDEvent);

	SetTimer(1,500,NULL);
}
示例#16
0
void CActivityView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();

	OnUpdate(NULL,0,NULL);
}
示例#17
0
EMenuAction CMenuBase::Update (void)
{
    // Increase time elapsed in this menu mode
    m_MenuModeTime += m_pTimer->GetDeltaTime ();

    // If we don't have to exit this menu mode yet
    if (!m_HaveToExit)
    {
        // If NEXT control is pressed
        if (m_pInput->GetMainInput().TestNext())
        {
            // Don't play menu next sound because the choices of the user
            // could not be correct and we may have to play an error sound instead.
            
            OnNext ();
        }
        // If PREVIOUS control is pressed
        else if (m_pInput->GetMainInput().TestPrevious())
        {
            // Play the menu previous sound
            m_pSound->PlaySample (SAMPLE_MENU_PREVIOUS);

            OnPrevious ();
        }
        // If UP control is pressed
        else if (m_pInput->GetMainInput().TestUp())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnUp ();
        }
        // If DOWN control is pressed
        else if (m_pInput->GetMainInput().TestDown())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnDown ();
        }
        // If LEFT control is pressed
        else if (m_pInput->GetMainInput().TestLeft())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnLeft ();
        }
        // If RIGHT control is pressed
        else if (m_pInput->GetMainInput().TestRight())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnRight ();
        }

        // Update the menu screen
        OnUpdate ();
    }
    // If the transition has been entirely done (enough time has elapsed)
    else if (m_MenuModeTime >= m_ExitMenuModeTime + TRANSITION_DURATION)
    {
        // It's OK to exit now!
        // Ask for the menu action we saved
        return m_ExitMenuAction;
    }

    // Don't have to change menu mode nor game mode
    return MENUACTION_NONE;
}
float UAISense_Blueprint::Update()
{
	const float TimeUntilUpdate = OnUpdate(UnprocessedEvents);
	UnprocessedEvents.Reset();
	return TimeUntilUpdate;
}
示例#19
0
void OUGUIObject::UpdateSelf(float fDeltaTime, float fMX, float fMY)
{
    /** 如果鼠标不在HGE窗口内 */
    //if(!m_pHGE->Input_IsMouseOver()) return;

    bool bLButton = m_pHGE->Input_GetKeyState(HGEK_LBUTTON);
    bool bRButton = m_pHGE->Input_GetKeyState(HGEK_RBUTTON);
    bool bMButton = m_pHGE->Input_GetKeyState(HGEK_MBUTTON);
    int nWheel = m_pHGE->Input_GetMouseWheel();

    OnUpdate(fDeltaTime, fMX, fMY);

    /** 若控件不可用 */
    if(!GetEnableMode()) return;
    if(!GetShowMode()) return;

    /** 若有鼠标捕获的控件 */
    if(OUGUIObject::m_pMouseCaptureControl &&
        OUGUIObject::m_pMouseCaptureControl != this &&
        !IsParent(OUGUIObject::m_pMouseCaptureControl))
    {
        return;
    }

    /** 若有模式窗口 */
    if(OUGUIObject::m_pModalControl &&
        OUGUIObject::m_pModalControl != this &&
        !IsParent(OUGUIObject::m_pModalControl))
    {
        return;
    }

    /** 若有控件在激活状态下 */
    if(OUGUIObject::m_pActiveControl &&
        OUGUIObject::m_pActiveControl != this)
    {
        return;
    }
    
    /** 如果鼠标没有被按下,则检测是不是OnEnter */
    if(!bLButton && OnCheckCollision(fMX, fMY))
    {
        //SetMouseEnter(OnCheckCollision(fMX, fMY));
        SetMouseEnter(true);
    }
    /** 如果鼠标抬起,则检测是不是OnLeave */
    else
    if(!bLButton && !OnCheckCollision(fMX, fMY) && GetMouseEnter())
    {
        SetMouseEnter(false);

        this->m_bMouseLButton = false;
        this->m_bMouseMButton = false;
        this->m_bMouseRButton = false;
        this->m_nMouseWheel = 0;
       
        if(OUGUIObject::GetActiveControl() == this)
        {
            OUGUIObject::SetActiveControl(NULL);
        }

        return;
    }

    if(GetMouseEnter() || OUGUIObject::GetMouseCaptureControl() == this)
    {
        SetMousePos(fMX, fMY);
        SetMouseLButton(bLButton);
        SetMouseRButton(bRButton);
        SetMouseMButton(bMButton);
        SetMouseWheel(nWheel);

        /** 键盘响应 */
        for(int i = 0; i < 256; i++)
        {
            if(i == HGEK_LBUTTON) continue;
            if(i == HGEK_RBUTTON) continue;
            if(i == HGEK_MBUTTON) continue;

            if(m_pHGE->Input_KeyDown(i)) OnKeyDown(i);
            else
            if(m_pHGE->Input_KeyUp(i)) OnKeyUp(i);
        }

        OnIdle();
    }
    else
    {
        /** 清空状态 */
        SetMouseLButton(false);
        SetMouseRButton(false);
        SetMouseMButton(false);
        SetMouseWheel(nWheel);
    }
}
示例#20
0
//=================================================================================================
void Quest_Orcs2::SetProgress(int prog2)
{
	bool apply = true;

	switch(prog2)
	{
	case Progress::TalkedOrc:
		// zapisz gorusha
		{
			orc = DialogContext::current->talker;
			orc->RevealName(true);
		}
		break;
	case Progress::NotJoined:
		break;
	case Progress::Joined:
		// dodaj questa
		{
			OnStart(game->txQuest[214]);
			msgs.push_back(Format(game->txQuest[170], W.GetDate()));
			msgs.push_back(game->txQuest[197]);
			// ustaw stan
			if(orcs_state == Quest_Orcs2::State::Accepted)
				orcs_state = Quest_Orcs2::State::OrcJoined;
			else
			{
				orcs_state = Quest_Orcs2::State::CompletedJoined;
				days = Random(30, 60);
				QM.quest_orcs->GetTargetLocation().active_quest = nullptr;
				QM.quest_orcs->target_loc = -1;
			}
			// do³¹cz do dru¿yny
			DialogContext::current->talker->dont_attack = false;
			Team.AddTeamMember(DialogContext::current->talker, true);
			if(Team.free_recruits > 0)
				--Team.free_recruits;
		}
		break;
	case Progress::TalkedAboutCamp:
		// powiedzia³ o obozie
		{
			target_loc = W.CreateCamp(W.GetWorldPos(), SG_ORCS, 256.f, false);
			Location& target = GetTargetLocation();
			target.state = LS_HIDDEN;
			target.st = 11;
			target.active_quest = this;
			near_loc = W.GetNearestSettlement(target.pos);
			OnUpdate(game->txQuest[198]);
			orcs_state = Quest_Orcs2::State::ToldAboutCamp;
		}
		break;
	case Progress::TalkedWhereIsCamp:
		// powiedzia³ gdzie obóz
		{
			if(prog == Progress::TalkedWhereIsCamp)
				break;
			Location& target = GetTargetLocation();
			Location& nearl = *W.GetLocation(near_loc);
			target.SetKnown();
			done = false;
			location_event_handler = this;
			OnUpdate(Format(game->txQuest[199], GetLocationDirName(nearl.pos, target.pos), nearl.name.c_str()));
		}
		break;
	case Progress::ClearedCamp:
		// oczyszczono obóz orków
		{
			orc->StartAutoTalk();
			W.AddNews(game->txQuest[200]);
			Team.AddExp(14000);
		}
		break;
	case Progress::TalkedAfterClearingCamp:
		// pogada³ po oczyszczeniu
		{
			orcs_state = Quest_Orcs2::State::CampCleared;
			days = Random(25, 50);
			GetTargetLocation().active_quest = nullptr;
			target_loc = -1;
			OnUpdate(game->txQuest[201]);
		}
		break;
	case Progress::SelectWarrior:
		// zostañ wojownikiem
		apply = false;
		ChangeClass(OrcClass::Warrior);
		break;
	case Progress::SelectHunter:
		// zostañ ³owc¹
		apply = false;
		ChangeClass(OrcClass::Hunter);
		break;
	case Progress::SelectShaman:
		// zostañ szamanem
		apply = false;
		ChangeClass(OrcClass::Shaman);
		break;
	case Progress::SelectRandom:
		// losowo
		{
			OrcClass clas;
			if(DialogContext::current->pc->unit->GetClass() == Class::WARRIOR)
			{
				if(Rand() % 2 == 0)
					clas = OrcClass::Hunter;
				else
					clas = OrcClass::Shaman;
			}
			else if(DialogContext::current->pc->unit->GetClass() == Class::HUNTER)
			{
				if(Rand() % 2 == 0)
					clas = OrcClass::Warrior;
				else
					clas = OrcClass::Shaman;
			}
			else
			{
				int co = Rand() % 3;
				if(co == 0)
					clas = OrcClass::Warrior;
				else if(co == 1)
					clas = OrcClass::Hunter;
				else
					clas = OrcClass::Shaman;
			}

			apply = false;
			ChangeClass(clas);
		}
		break;
	case Progress::TalkedAboutBase:
		// pogada³ o bazie
		{
			done = false;
			Location& target = *W.CreateLocation(L_DUNGEON, W.GetWorldPos(), 256.f, THRONE_FORT, SG_ORCS, false);
			target.st = 15;
			target.active_quest = this;
			target.state = LS_HIDDEN;
			target_loc = target.index;
			OnUpdate(game->txQuest[202]);
			orcs_state = State::ToldAboutBase;
		}
		break;
	case Progress::TalkedWhereIsBase:
		// powiedzia³ gdzie baza
		{
			Location& target = GetTargetLocation();
			target.SetKnown();
			unit_to_spawn = UnitData::Get("q_orkowie_boss");
			spawn_unit_room = RoomTarget::Throne;
			callback = WarpToThroneOrcBoss;
			at_level = target.GetLastLevel();
			location_event_handler = nullptr;
			unit_event_handler = this;
			near_loc = W.GetNearestSettlement(target.pos);
			Location& nearl = *W.GetLocation(near_loc);
			OnUpdate(Format(game->txQuest[203], GetLocationDirName(nearl.pos, target.pos), nearl.name.c_str(), target.name.c_str()));
			done = false;
			orcs_state = State::GenerateOrcs;
		}
		break;
	case Progress::KilledBoss:
		// zabito bossa
		{
			orc->StartAutoTalk();
			OnUpdate(game->txQuest[204]);
			W.AddNews(game->txQuest[205]);
			Team.AddLearningPoint();
		}
		break;
	case Progress::Finished:
		// pogadano z gorushem
		{
			state = Quest::Completed;
			Team.AddReward(Random(9000, 11000), 25000);
			OnUpdate(game->txQuest[206]);
			QM.EndUniqueQuest();
			// gorush
			Team.RemoveTeamMember(orc);
			Usable* tron = L.local_ctx.FindUsable("throne");
			assert(tron);
			if(tron)
			{
				orc->ai->idle_action = AIController::Idle_WalkUse;
				orc->ai->idle_data.usable = tron;
				orc->ai->timer = 9999.f;
			}
			orc = nullptr;
			// orki
			UnitData* ud[12] = {
				UnitData::Get("orc"), UnitData::Get("q_orkowie_orc"),
				UnitData::Get("orc_fighter"), UnitData::Get("q_orkowie_orc_fighter"),
				UnitData::Get("orc_warius"), UnitData::Get("q_orkowie_orc_warius"),
				UnitData::Get("orc_hunter"), UnitData::Get("q_orkowie_orc_hunter"),
				UnitData::Get("orc_shaman"), UnitData::Get("q_orkowie_orc_shaman"),
				UnitData::Get("orc_chief"), UnitData::Get("q_orkowie_orc_chief")
			};
			UnitData* ud_slaby = UnitData::Get("q_orkowie_slaby");

			for(vector<Unit*>::iterator it = L.local_ctx.units->begin(), end = L.local_ctx.units->end(); it != end; ++it)
			{
				Unit& u = **it;
				if(u.IsAlive())
				{
					if(u.data == ud_slaby)
					{
						// usuñ dont_attack, od tak :3
						u.dont_attack = false;
						u.ai->change_ai_mode = true;
					}
					else
					{
						for(int i = 0; i < 6; ++i)
						{
							if(u.data == ud[i * 2])
							{
								u.data = ud[i * 2 + 1];
								u.ai->target = nullptr;
								u.ai->alert_target = nullptr;
								u.ai->state = AIController::Idle;
								u.ai->change_ai_mode = true;
								if(Net::IsOnline())
								{
									NetChange& c = Add1(Net::changes);
									c.type = NetChange::CHANGE_UNIT_BASE;
									c.unit = &u;
								}
								break;
							}
						}
					}
				}
			}
			// zak³ada ¿e gadamy na ostatnim levelu, mam nadzieje ¿e gracz z tamt¹d nie spierdoli przed pogadaniem :3
			MultiInsideLocation* multi = (MultiInsideLocation*)W.GetCurrentLocation();
			for(vector<InsideLocationLevel>::iterator it = multi->levels.begin(), end = multi->levels.end() - 1; it != end; ++it)
			{
				for(vector<Unit*>::iterator it2 = it->units.begin(), end2 = it->units.end(); it2 != end2; ++it2)
				{
					Unit& u = **it2;
					if(u.IsAlive())
					{
						for(int i = 0; i < 5; ++i)
						{
							if(u.data == ud[i * 2])
							{
								u.data = ud[i * 2 + 1];
								break;
							}
						}
					}
				}
			}
			// usuñ zw³oki po opuszczeniu lokacji
			orcs_state = State::ClearDungeon;
		}
		break;
	}

	if(apply)
		prog = prog2;
}
LRESULT ScriptEditorDialog::ScriptEditorDialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam) {
    switch(uMsg) {
        case WM_WINDOWPOSCHANGED: {
            RECT rcParent;
            ::GetClientRect(m_hWndWindowItems[WINDOW_HANDLE], &rcParent);

            ::SetWindowPos(m_hWndWindowItems[BTN_SAVE_SCRIPT], nullptr, (rcParent.right / 3) * 2, rcParent.bottom - GuiSettingManager::m_iEditHeight - 2,
                rcParent.right - ((rcParent.right / 3) * 2) - 2, GuiSettingManager::m_iEditHeight, SWP_NOZORDER);
            ::SetWindowPos(m_hWndWindowItems[BTN_CHECK_SYNTAX], nullptr, (rcParent.right / 3) + 1, rcParent.bottom - GuiSettingManager::m_iEditHeight - 2,
                (rcParent.right / 3) - 2, GuiSettingManager::m_iEditHeight, SWP_NOZORDER);
            ::SetWindowPos(m_hWndWindowItems[BTN_LOAD_SCRIPT], nullptr, 2, rcParent.bottom - GuiSettingManager::m_iEditHeight - 2, (rcParent.right / 3) - 2, GuiSettingManager::m_iEditHeight, SWP_NOZORDER);
            ::SetWindowPos(m_hWndWindowItems[REDT_SCRIPT], nullptr, 0, 0, rcParent.right - ScaleGui(40), rcParent.bottom - GuiSettingManager::m_iEditHeight - 4, SWP_NOMOVE | SWP_NOZORDER);

            return 0;
        }
        case WM_COMMAND:
            switch(LOWORD(wParam)) {
                case (REDT_SCRIPT+100):
                    if(HIWORD(wParam) == EN_UPDATE) {
                        OnUpdate();
                    }
                    break;
                case (BTN_LOAD_SCRIPT+100):
                    OnLoadScript();
                    return 0;
                case BTN_CHECK_SYNTAX:
                    OnCheckSyntax();
                    return 0;
                case BTN_SAVE_SCRIPT:
                    OnSaveScript();
                    return 0;
                case IDOK:
                case IDCANCEL:
                    ::PostMessage(m_hWndWindowItems[WINDOW_HANDLE], WM_CLOSE, 0, 0);
					return 0;
            }

            if(RichEditCheckMenuCommands(m_hWndWindowItems[REDT_SCRIPT], LOWORD(wParam)) == true) {
                return 0;
            }

            break;
        case WM_CONTEXTMENU:
            OnContextMenu((HWND)wParam, lParam);
            break;
        case WM_NOTIFY:
            if(((LPNMHDR)lParam)->hwndFrom == m_hWndWindowItems[REDT_SCRIPT] && ((LPNMHDR)lParam)->code == EN_LINK) {
                if(((ENLINK *)lParam)->msg == WM_LBUTTONUP) {
                    RichEditOpenLink(m_hWndWindowItems[REDT_SCRIPT], (ENLINK *)lParam);
                }
            }

            break;
        case WM_GETMINMAXINFO: {
            MINMAXINFO *mminfo = (MINMAXINFO*)lParam;
            mminfo->ptMinTrackSize.x = ScaleGui(443);
            mminfo->ptMinTrackSize.y = ScaleGui(454);

            return 0;
        }
        case WM_CLOSE:
            ::EnableWindow(::GetParent(m_hWndWindowItems[WINDOW_HANDLE]), TRUE);
            ServerManager::m_hWndActiveDialog = nullptr;
            break;
        case WM_NCDESTROY: {
            HWND hWnd = m_hWndWindowItems[WINDOW_HANDLE];
            delete this;
            return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
        }
        case WM_SETFOCUS: {
            CHARRANGE cr = { 0, 0 };
            ::SendMessage(m_hWndWindowItems[REDT_SCRIPT], EM_EXSETSEL, 0, (LPARAM)&cr);
            ::SetFocus(m_hWndWindowItems[REDT_SCRIPT]);
            return 0;
        }
    }

	return ::DefWindowProc(m_hWndWindowItems[WINDOW_HANDLE], uMsg, wParam, lParam);
}
示例#22
0
//=================================================================================================
void Quest_Orcs::SetProgress(int prog2)
{
	switch(prog2)
	{
	case Progress::TalkedWithGuard:
		{
			if(prog != Progress::None)
				return;
			if(QM.RemoveQuestRumor(R_ORCS))
				game->gui->journal->AddRumor(Format(game->txQuest[189], GetStartLocationName()));
			QM.quest_orcs2->orcs_state = Quest_Orcs2::State::GuardTalked;
		}
		break;
	case Progress::NotAccepted:
		{
			if(QM.RemoveQuestRumor(R_ORCS))
				game->gui->journal->AddRumor(Format(game->txQuest[190], GetStartLocationName()));
			// mark guard to remove
			Unit*& u = QM.quest_orcs2->guard;
			if(u)
			{
				u->auto_talk = AutoTalkMode::No;
				u->temporary = true;
				u = nullptr;
			}
			QM.quest_orcs2->orcs_state = Quest_Orcs2::State::GuardTalked;
		}
		break;
	case Progress::Started:
		{
			OnStart(game->txQuest[191]);
			// remove rumor from pool
			QM.RemoveQuestRumor(R_ORCS);
			// mark guard to remove
			Unit*& u = QM.quest_orcs2->guard;
			if(u)
			{
				u->auto_talk = AutoTalkMode::No;
				u->temporary = true;
				u = nullptr;
			}
			// generate location
			Location& tl = *W.CreateLocation(L_DUNGEON, GetStartLocation().pos, 64.f, HUMAN_FORT, SG_ORCS, false);
			tl.SetKnown();
			tl.st = 8;
			tl.active_quest = this;
			target_loc = tl.index;
			location_event_handler = this;
			at_level = tl.GetLastLevel();
			dungeon_levels = at_level + 1;
			levels_cleared = 0;
			whole_location_event_handler = true;
			item_to_give[0] = Item::Get("q_orkowie_klucz");
			spawn_item = Quest_Event::Item_GiveSpawned2;
			unit_to_spawn = UnitData::Get("q_orkowie_gorush");
			spawn_unit_room = RoomTarget::Prison;
			unit_dont_attack = true;
			unit_to_spawn2 = g_spawn_groups[SG_ORCS].GetSpawnLeader(10);
			unit_spawn_level2 = -3;
			QM.quest_orcs2->orcs_state = Quest_Orcs2::State::Accepted;
			// questowe rzeczy
			msgs.push_back(Format(game->txQuest[192], GetStartLocationName(), W.GetDate()));
			msgs.push_back(Format(game->txQuest[193], GetStartLocationName(), GetTargetLocationName(), GetTargetLocationDir()));
		}
		break;
	case Progress::ClearedLocation:
		// oczyszczono lokacjê
		{
			OnUpdate(Format(game->txQuest[194], GetTargetLocationName(), GetStartLocationName()));
		}
		break;
	case Progress::Finished:
		// ukoñczono - nagroda
		{
			state = Quest::Completed;

			Team.AddReward(4000, 12000);
			OnUpdate(game->txQuest[195]);
			W.AddNews(Format(game->txQuest[196], GetTargetLocationName(), GetStartLocationName()));

			if(QM.quest_orcs2->orcs_state == Quest_Orcs2::State::OrcJoined)
			{
				QM.quest_orcs2->orcs_state = Quest_Orcs2::State::CompletedJoined;
				QM.quest_orcs2->days = Random(30, 60);
				GetTargetLocation().active_quest = nullptr;
				target_loc = -1;
			}
			else
				QM.quest_orcs2->orcs_state = Quest_Orcs2::State::Completed;
		}
		break;
	}

	prog = prog2;
}
示例#23
0
void ClimatologyConfigDialog::OnUpdateCyclones()
{
    pParent->pPlugIn->GetOverlayFactory()->BuildCycloneCache();
    OnUpdate();
}
示例#24
0
void SelectionBar::UpdateDisplay()
{
   wxCommandEvent e;
   e.SetInt(mLeftTime->GetFormatIndex());
   OnUpdate(e);
}
示例#25
0
void CView::OnInitialUpdate()
{
	OnUpdate(NULL, 0, NULL);        // initial update
}
示例#26
0
void CWizardView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

	EnableToolTips(TRUE);

	// TODO: Add extra initialization here
	m_listRecent.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP
						| LVS_EX_FLATSB | LVS_EX_REGIONAL | LVS_EX_INFOTIP | LVS_EX_UNDERLINEHOT );
	m_listRecent.EnableToolTips( );

	// set image lists
	m_LargeImageList.Create(IDB_STRATEGYLARGE, 32, 1, RGB(0, 255, 0));
	m_SmallImageList.Create(IDB_STRATEGY, 16, 1, RGB(0, 255, 0));

	m_listRecent.SetImageList(&m_LargeImageList, LVSIL_NORMAL);
	m_listRecent.SetImageList(&m_SmallImageList, LVSIL_SMALL);

	// list buttons
	//m_btnListType.m_menu.LoadMenu( IDR_POPUP_WIZARDVIEWLISTTYPE );

	// insert columns
	CString	strName, strPathName, strModTime, strStatus;
	strName.LoadString( IDS_STRATEGYNAME );
	strPathName.LoadString( IDS_STRATEGYPATH );
	strModTime.LoadString( IDS_STRATEGYMODTIME );
	strStatus.LoadString( IDS_STRATEGYOPENSTATUS );
	m_listRecent.InsertColumn( 0, strName, LVCFMT_CENTER, 122 );
	m_listRecent.InsertColumn( 1, strPathName, LVCFMT_CENTER, 152 );
	m_listRecent.InsertColumn( 2, strModTime, LVCFMT_CENTER, 82 );
	m_listRecent.InsertColumn( 3, strStatus, LVCFMT_CENTER, 62 );

	// Show Large Icons
	OnWizardviewLargeicons( );

	// link go purchase
	if( AfxGetSView().IsEva() )
	{
		CString strSoftNO	=	AfxGetSView().GetS();
		if( !strSoftNO.IsEmpty() )
			m_editSoftNO.SetWindowText( strSoftNO );
		m_linkGoPurchase.SetURL( (LPCTSTR)AfxGetProfile().GetPurchaseURL() );
		m_linkHowtoReg.SetModeHelp( 0, "StockAna.chm::/htm/purchase.htm" );
	}
	else
	{
		m_staticSoftNOTitle.SetWindowPos( NULL, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE );
		m_editSoftNO.SetWindowPos( NULL, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE );
		m_linkGoPurchase.SetWindowPos( NULL, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE );
		m_linkHowtoReg.SetWindowPos( NULL, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE );
	}

	m_cmbStock.InitStocks( FALSE, FALSE, FALSE );
	m_cmbStock.SetAutoHide( FALSE );
	m_cmbStock.SelectString( 0, STKLIB_CODE_MAIN );

	m_linkRealTime.SetModeRun( RunLinkRealTime );
	m_linkGraph.SetModeRun( RunLinkGraph );
	m_linkBase.SetModeRun( RunLinkBase );
	m_linkInfo.SetModeRun( RunLinkInfo );

	OnUpdate( NULL, UPDATE_HINT_WIZARDVIEW, NULL );
}
示例#27
0
	void Layer2D::OnUpdateInternal(const Timestep& ts)
	{
		OnUpdate(ts);
	}
示例#28
0
void SQT::refresh() {
	OnUpdate();
	display();
	update();
}
示例#29
0
void dlgRadioSettingsShowModal(void){
  SHOWTHREAD(_T("dlgRadioSettingsShowModal"));

//  WndProperty *wp;
//  int ival;

    wf = dlgLoadFromXML(CallBackTable,                        
		      TEXT("dlgRadioSettings.xml"), 
		           IDR_XML_RADIOSETTINGS );
  if (!wf) return;
  
  VolMode = VOL; // start with volume
  
  if (wf) {
    wpnewActive = (WndButton*)wf->FindByName(TEXT("cmdActive"));
    LKASSERT( wpnewActive !=NULL);
    wpnewActive->SetOnClickNotify(OnActiveButton);

    wpnewActiveFreq = (WndButton*)wf->FindByName(TEXT("cmdActiveFreq"));
    LKASSERT( wpnewActiveFreq !=NULL);    
    wpnewActiveFreq->SetOnClickNotify(OnActiveFreq);

    wpnewPassive  = (WndButton*)wf->FindByName(TEXT("cmdPassive"));
    LKASSERT(   wpnewPassive   !=NULL)  
    wpnewPassive->SetOnClickNotify(OnPassiveButton);

    wpnewPassiveFreq = (WndButton*)wf->FindByName(TEXT("cmdPassiveFreq"));    
    LKASSERT(   wpnewPassiveFreq   !=NULL)  
    wpnewPassiveFreq->SetOnClickNotify(OnPassiveFreq);

   wpnewVol  = (WndButton*)wf->FindByName(TEXT("cmdVol"));
    LKASSERT(   wpnewVol   !=NULL)  
    wpnewVol->SetOnClickNotify(OnMuteButton);
 
   wpnewDual  = (WndButton*)wf->FindByName(TEXT("cmdDual"));
   LKASSERT(   wpnewDual   !=NULL)  
   wpnewDual->SetOnClickNotify(OnDualButton);

   wpnewVolDwn = ((WndButton *)wf->FindByName(TEXT("cmdVolDown")));
   LKASSERT(   wpnewVolDwn   !=NULL)  
   wpnewVolDwn->SetOnClickNotify(OnVolDownButton);
     
   wpnewVolUp =     ((WndButton *)wf->FindByName(TEXT("cmdVolUp")));
   LKASSERT(   wpnewVolUp   !=NULL)  
   wpnewVolUp->SetOnClickNotify(OnVolUpButton);

   wpnewExChg  =        ((WndButton *)wf->FindByName(TEXT("cmdXchange")));
   LKASSERT(   wpnewExChg    !=NULL)  
   wpnewExChg ->SetOnClickNotify(OnExchange);

//    wf->SetTimerNotify(OnTimerNotify);

   wf->SetTimerNotify(300, OnTimerNotify);
   RadioPara.Changed = true;

   OnUpdate();
   OnRemoteUpdate();

   wf->ShowModal();

    delete wf;
  }
  wf = NULL;
  return ;
}
示例#30
0
void
Game::Run (void)
{
    Event event;
    Timer timer;

    bool using_vsync = this->window->IsUsingVSYNC();
    uint32 frame_cap = 1000 / this->settings.target_fps;

    debug::InitializeOverlay();

    m_flags |= RUNNING;
    timer.Start();
    while (m_flags & RUNNING)
    {
        uint32 frame_start = timer.Ticks();
        if (m_sceneStack.empty())
        {
            m_flags &= ~RUNNING;
            break;
        }

        // ref count must be increased b/c scene could be removed from the collection
        // during the loop execution
        auto current_scene = m_sceneStack.back();
        while (PollEvent(&event))
        {
            if (debug::ProcessOnEvent(event))
            {
                // debug UI requesting events - suppress from scene
                continue;
            }

            if (!(this->on_event_hook && this->on_event_hook(event)))
            {
                current_scene->OnEvent(event);
            }
        }

        delta_time dt(timer.TickDelta());
        if (!(this->on_update_hook && this->on_update_hook(dt)))
        {
            current_scene->OnUpdate(dt);
        }

        debug::ProcessOnUpdate(static_cast<SDL_Window*>(*this->window.get()), dt);

        this->window->Clear();
        if (!(this->on_render_hook && this->on_render_hook()))
        {
            current_scene->OnRender();
        }

        debug::ProcessOnRender();
        this->window->Present();

        if (m_flags & PUSH_DEFERRED)
        {
            current_scene->Hibernate();
            m_flags &= ~PUSH_DEFERRED;

            auto& new_current_scene = m_sceneStack.back();
            new_current_scene->Initialize();
        }
        else if (m_flags & POP_DEFERRED)
        {
            current_scene->Terminate();
            m_flags &= ~POP_DEFERRED;

            auto& new_current_scene = m_sceneStack.back();
            new_current_scene->Activate();
        }
        else if (m_flags & SWAP_DEFERRED)
        {
            current_scene->Terminate();
            m_flags &= ~SWAP_DEFERRED;

            auto& new_current_scene = m_sceneStack.back();
            new_current_scene->Initialize();
        }

        if (!using_vsync)
        {
            uint32 frame_length = timer.Ticks() - frame_start;
            if (frame_length < frame_cap)
            {
                SDL_Delay(frame_cap - frame_length);
            }
        }
    }
}