Exemplo n.º 1
0
void Gui::OnClick(QModelIndex index)
{
    model->click(index.column(), index.row());
    UpdateLabels();

    if(model->board.isWon())
        QMessageBox::information(this, "Victory", "You win !");
}
Exemplo n.º 2
0
void ApplicationStatics::EnableDebugInfo(ApplicationDebugInfoFlags val)
{
	RETURN_IF_EQUAL(mDebugInfoFlag, val);
	mDebugInfoFlag = val;
	mUpdateWatch.Enable(IsShowPerformance());

	UpdateLabels();
}
Exemplo n.º 3
0
void ModelDialog::SetFromXml(wxXmlNode* e, const wxString& NameSuffix)
{
    long n;
    wxString name, direction, startSide, tempStr;
    name=e->GetAttribute(wxT("name")) + NameSuffix;
    TextCtrl_Name->SetValue(name);
    Choice_DisplayAs->SetStringSelection(e->GetAttribute(wxT("DisplayAs")));
    SpinCtrl_parm1->SetValue(e->GetAttribute(wxT("parm1")));
    SpinCtrl_parm2->SetValue(e->GetAttribute(wxT("parm2")));
    SpinCtrl_parm3->SetValue(e->GetAttribute(wxT("parm3")));
    SpinCtrl_StartChannel->SetValue(e->GetAttribute(wxT("StartChannel")));
    Choice_Order->SetStringSelection(e->GetAttribute(wxT("Order")));
    tempStr=e->GetAttribute(wxT("Antialias"),wxT("0"));
    tempStr.ToLong(&n);
    Choice_Antialias->SetSelection(n);
    direction=e->GetAttribute(wxT("Dir"));
    if(e->HasAttribute(wxT("StartSide")))
    {
        startSide=e->GetAttribute(wxT("StartSide"));
    }
    else
    {
        startSide = wxT("B");
    }
    if(e->HasAttribute(wxT("Advanced")))
    {
        cbIndividualStartNumbers->SetValue(true);
        tempStr = e->GetAttribute(wxT("parm1"));
        tempStr.ToLong(&n);  // number of strings
        for(int ii=0; ii < n; ii++)
        {
            gridStartChannels->AppendRows();
            gridStartChannels->SetCellValue(ii,0,e->GetAttribute(StartChanAttrName(ii)));
        }
    }

    if (direction == wxT("R") )
    {
        if(startSide == wxT("B"))
            RadioButton_BotRight->SetValue(true);
        else
            RadioButton_TopRight->SetValue(true);
    }
    else
    {
        if(startSide == wxT("B"))
            RadioButton_BotLeft->SetValue(true);
        else
            RadioButton_TopLeft->SetValue(true);
    }
    if (e->HasAttribute(wxT("CustomModel")))
    {
        e->GetAttribute(wxT("CustomModel"),&tempStr);
        SetCustomGridData(tempStr);
    }
    CheckBox_MyDisplay->SetValue(ModelClass::IsMyDisplay(e));
    UpdateLabels();
}
Exemplo n.º 4
0
void MainWindow::on_installButton_clicked()
{
    ManageWindow * window = new ManageWindow(this, *_games);
#ifdef Q_WS_MAEMO_5
    window->setAttribute(Qt::WA_Maemo5StackedWindow);
    window->setWindowFlags(Qt::Window);
#endif
    window->show();
    connect(window, SIGNAL(destroyed()), this, SLOT(UpdateLabels()));
}
Exemplo n.º 5
0
void CreateGameForm::OnControlNotify(word idc, int nNotify) {
    if (idc == kidcCategories) {
        RadioButtonBarControl *prbbc =
        (RadioButtonBarControl *)GetControlPtr(kidcCategories);
        int iButtonSelected = prbbc->GetSelectionIndex();
        if (iButtonSelected < 0) {
            iButtonSelected = 0;
        }
        MissionType mtNew = MissionTypeFromIndex(iButtonSelected);
        if (mtNew == m_mt) {
            return;
        }
        SwitchToMissionType(mtNew);
        
        // If in Add-On category, and there is nothing there, show this
        // label, otherwise hide it
        
        bool fShowLabel = false;
        ListControl *plstc =
        m_aplstc[IndexFromMissionType(kmtMultiplayerAddOn)];
        if (m_mt == kmtMultiplayerAddOn) {
            if (plstc->GetCount() == 0) {
                fShowLabel = true;
            }
        }
        
        LabelControl *plbl =
        (LabelControl *)GetControlPtr(kidcAddOnMessage);
        if (fShowLabel) {
            plbl->Show(true);
            if (m_mt == kmtMultiplayerAddOn) {
                plstc->Show(false);
            }
        } else {
            plbl->Show(false);
            if (m_mt == kmtMultiplayerAddOn) {
                plstc->Show(true);
            }
        }
    }
    
    if (idc == kidcChallengeList || idc == kidcAddOnList) {
        UpdateLabels();
    }
    
    // Handle button hiding
    
    bool fShow = true;
    ListControl *plstc = m_aplstc[IndexFromMissionType(m_mt)];
    if (plstc->GetSelectedItemIndex() == -1) {
        fShow = false;
    }
    GetControlPtr(kidcOk)->Show(fShow);
}
Exemplo n.º 6
0
//Method called when the DecInfectButtonP1 is pressed
void DecInfectP1(GtkWidget *widget, gpointer data)
{
	if(EDHGame::edh == 0 /*not edh*/)
	{
		StandardGame::Player1.ChangeInfect(-1);
	}
	else if(EDHGame::edh == 1 /*2player edh*/||EDHGame::edh == 2 /*3player edh*/)
	{
		EDHGame::EDHPlayer1.ChangeInfect(-1);
	}
	StandardGame::RecentPlays.append("Player 1 lost 1 infect \n");
	UpdateLabels();
} 
Exemplo n.º 7
0
//Method called when the IncLifeButtonP2 is pressed
void IncLifeP2(GtkWidget *widget, gpointer data)
{
	if(EDHGame::edh == 0 /*not edh*/)
	{
		StandardGame::Player2.ChangeLife(1);
	}
	else if (EDHGame::edh == 1 /*2player edh*/||EDHGame::edh == 2 /*3player edh*/)
	{
		EDHGame::EDHPlayer2.ChangeLife(1);
	}
	StandardGame::RecentPlays.append("Player 2 gained 1 life \n");
	UpdateLabels();
} 
Exemplo n.º 8
0
void StationShipRepairForm::RepairHull(float percent)
{
	float hullDamage = 100.0f - Pi::player->GetPercentHull();
	if (percent > hullDamage) percent = hullDamage;
	int cost = GetRepairCost(percent);
	if (Pi::player->GetMoney() < cost) {
		Pi::cpan->MsgLog()->Message("", Lang::YOU_NOT_ENOUGH_MONEY);
	} else {
		Pi::player->SetMoney(Pi::player->GetMoney() - cost);
		Pi::player->SetPercentHull(Pi::player->GetPercentHull() + percent);
		UpdateLabels();
	}
}
Exemplo n.º 9
0
void CreateGameForm::SwitchToMissionType(MissionType mt) {
    m_mt = mt;
    RadioButtonBarControl *prbbc =
    (RadioButtonBarControl *)GetControlPtr(kidcCategories);
    prbbc->SetSelectionIndex(IndexFromMissionType(mt));
    for (int i = 0; i < ARRAYSIZE(m_aplstc); i++) {
        bool fShow = false;
        if (i == IndexFromMissionType(mt)) {
            fShow = true;
        }
        m_aplstc[i]->Show(fShow);
    }
    UpdateLabels();
}
Exemplo n.º 10
0
void wxCurlUploadDialog::OnUpload(wxCurlUploadEvent &ev)
{
    static wxDateTime lastLabelUpdate(0, 0, 0, 0);      // zero is to force always at least an update
    if ((wxDateTime::Now() - lastLabelUpdate).GetMilliseconds() > 200)   // avoid flickering
    {
        UpdateLabels(&ev);

        lastLabelUpdate = wxDateTime::Now();
    }

    // see OnEndPerform for more info.
    if (m_pLastEvent)
        delete m_pLastEvent;
    m_pLastEvent = wx_static_cast(wxCurlProgressBaseEvent*, ev.Clone());
}
Exemplo n.º 11
0
void QmitkDicomInspectorView::RenderTable()
{
  assert(m_renderWindowPart != NULL);

  // configure fit information
  unsigned int rowIndex = 0;
  for (const auto& element : m_Tags)
  {
    QTableWidgetItem* newItem = new QTableWidgetItem(QString::fromStdString(element.second.prop->GetValue(m_currentSelectedTimeStep, m_currentSelectedZSlice, true, true)));
    m_Controls.tableTags->setItem(rowIndex, 3, newItem);
    ++rowIndex;
  }

  UpdateLabels();
}
Exemplo n.º 12
0
void QmitkDicomInspectorView::UpdateData()
{
  QStringList headers;

  m_Controls.tableTags->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);

  m_Tags.clear();

  if (m_currentSelectedData.IsNotNull())
  {
    for (const auto& element : *(m_currentSelectedData->GetPropertyList()->GetMap()))
    {
      if (element.first.find("DICOM") == 0)
      {
        std::istringstream stream(element.first);
        std::string token;
        std::getline(stream, token, '.'); //drop the DICOM suffix
        std::getline(stream, token, '.'); //group id
        unsigned long dcmgroup = std::stoul(token, nullptr, 16);
        std::getline(stream, token, '.'); //element id
        unsigned long dcmelement = std::stoul(token, nullptr, 16);

        TagInfo info(mitk::DICOMTag(dcmgroup, dcmelement), dynamic_cast<const mitk::DICOMProperty*>(element.second.GetPointer()));

        m_Tags.insert(std::make_pair(element.first, info));
      }
    }
  }

  m_Controls.tableTags->setRowCount(m_Tags.size());

  unsigned int rowIndex = 0;
  for (const auto& element : m_Tags)
  {
    QTableWidgetItem* newItem = new QTableWidgetItem(QString::number(element.second.tag.GetGroup(), 16));
    m_Controls.tableTags->setItem(rowIndex, 0, newItem);
    newItem = new QTableWidgetItem(QString::number(element.second.tag.GetElement(), 16));
    m_Controls.tableTags->setItem(rowIndex, 1, newItem);
    newItem = new QTableWidgetItem(QString::fromStdString(element.second.tag.GetName()));
    m_Controls.tableTags->setItem(rowIndex, 2, newItem);
    newItem = new QTableWidgetItem(QString::fromStdString(element.second.prop->GetValue()));
    m_Controls.tableTags->setItem(rowIndex, 3, newItem);
    ++rowIndex;
  }
  UpdateLabels();
}
Exemplo n.º 13
0
void Dialog::slotButtonClicked()
{

    Button* temp = qobject_cast<Button* >(QObject::sender());
    GuessLetter(temp);
    temp->setDisabled(true);
    UpdateLabels();
    if(guessesLeft==0)
    {
        gameOver->exec();
    }
    else if(isGameWon())
    {
        gameWon->exec();
    }

}
Exemplo n.º 14
0
Gui::Gui(QWidget *parent)
    : QMainWindow(parent),
      ui(new Ui::Gui)
{
	density = 0;
	side = 2;

    model = new BoardModel(parent);
    model->generate(side, density);

    ui->setupUi(this);

    ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableView->setModel(model);

    connect(model, SIGNAL(UpdateCounters()), this, SLOT(UpdateLabels()));
}
Exemplo n.º 15
0
StationShipRepairForm::StationShipRepairForm(FormController *controller) : FaceForm(controller)
{
	m_station = Pi::player->GetDockedWith();

	SetTitle(stringf(Lang::SOMEWHERE_SHIP_REPAIRS, formatarg("station", m_station->GetLabel())));

	m_working = new Gui::Label(Lang::SHIP_IS_ALREADY_FULLY_REPAIRED);
	Add(m_working, 0, 0);

	m_tableBox = new Gui::HBox();
	m_tableBox->SetSpacing(15.0f);
	Add(m_tableBox, 0, 0);

	Gui::VBox *columnBox = new Gui::VBox();
	m_tableBox->PackEnd(columnBox);

	Gui::HBox *buttonBox = new Gui::HBox();
	buttonBox->SetSpacing(5.0f);
	Gui::Button *b = new Gui::SolidButton();
	b->onClick.connect(sigc::bind(sigc::mem_fun(this, &StationShipRepairForm::RepairHull), 1.0f));
	buttonBox->PackEnd(b);
	buttonBox->PackEnd(new Gui::Label(Lang::REPAIR_1_PERCENT_HULL));
	columnBox->PackEnd(buttonBox);

	buttonBox = new Gui::HBox();
	buttonBox->SetSpacing(5.0f);
	b = new Gui::SolidButton();
	b->onClick.connect(sigc::bind(sigc::mem_fun(this, &StationShipRepairForm::RepairHull), 100.0f));
	buttonBox->PackEnd(b);
	m_repairAllDesc = new Gui::Label("");
	buttonBox->PackEnd(m_repairAllDesc);
	columnBox->PackEnd(buttonBox);

	columnBox = new Gui::VBox();
	m_tableBox->PackEnd(columnBox);

	m_repairOneCost = new Gui::Label("");
	columnBox->PackEnd(m_repairOneCost);
	m_repairAllCost = new Gui::Label("");
	columnBox->PackEnd(m_repairAllCost);

	UpdateLabels();
}
Exemplo n.º 16
0
void EventsScene::Update(float deltaTime, float alphaMul)
{
    if (!m_IsActive)
        return;
    
    Scene::Update(deltaTime, alphaMul);
	if (xmlEventsDownload->GetStatus() == 4 && !hasFeed) {
		eventFeed = new CIwRSS(this);
		TiXmlDocument doc("events.xml");
		eventFeed->CalendarParseRSS("<feed>", doc, 2);
		hasFeed = true;
		delete eventFeed;
	}
	else if (hasFeed) {
		UpdateLabels();
	}

	
}
Exemplo n.º 17
0
void wxCurlTransferDialog::OnEndPerform(wxCurlEndPerformEvent &ev)
{
    wxLogDebug(wxS("wxCurlTransferDialog::OnEndPerform"));

    // in case the very last transfer update event was skipped because
    // of our anti-flickering label update policy, force the update with
    // that event now (otherwise the dialog may remain open showing data
    // related not to the end of the download!)
    if (m_pLastEvent)
        UpdateLabels(m_pLastEvent);
    //else: we may have transferred a file of zero size and thus have never received any progress event...

    // now we're sure the transfer has completed: make the gauge
    // completely "filled"
    m_pGauge->SetValue(101);

    // this flag is used for updating labels etc:
    m_bTransferComplete = true;

    // transfer has completed...
    wxCurlDialogReturnFlag retCode = ev.IsSuccessful() ? wxCDRF_SUCCESS : wxCDRF_FAILED;
#if 0 // below is bugged because m_pThread->GetCurlSession() is NULL at this point...
    if (retCode == wxCDRF_FAILED)
    {
        // show the user a message...
        wxLogError(wxS("The transfer failed: %s (%s)"),
                   m_pThread->GetCurlSession()->GetErrorString().c_str(),
                   m_pThread->GetCurlSession()->GetDetailedErrorString().c_str());
    }
#endif

    // do we need to close this window?
    if (HasFlag(wxCTDS_AUTO_CLOSE))
        EndModal(retCode);
    else
    {
        SetReturnCode(retCode);     // will exit later in OnAbort()

        if (m_pSpeed)
            m_pSpeed->SetLabel(wxS("0 (transfer completed)"));
    }
}
Exemplo n.º 18
0
void dialogEditor_dataitem::OnNext()
{
	CString sError;

	if(listDataItem.GetCount() == 0) return;

	SaveChanges();
	iIndex++;
	if(iIndex >= listDataItem.GetCount())
	{
		iIndex = listDataItem.GetCount();
		pos = listDataItem.GetTailPosition();
	}
	else
		listDataItem.GetNext(pos);
	GetData();
	UpdateLabels(FALSE);

	sError.Format("Editor - Data Item Data File (%i of %i)",iIndex,listDataItem.GetCount());
	SetWindowText(sError);
}
Exemplo n.º 19
0
//Method called when the IncInfectButtonP1 is pressed
void IncInfectP1(GtkWidget *widget, gpointer data)
{
	if(EDHGame::edh == 0 /*not edh*/)
	{
		StandardGame::Player1.ChangeInfect(1);
		if(StandardGame::Player1.Lost()&&!StandardGame::Continue)
		{
			EndGame(widget, data);	
		}
	}
	else if(EDHGame::edh == 1 /*2player edh*/||EDHGame::edh == 2 /*3player edh*/)
	{
		EDHGame::EDHPlayer1.ChangeInfect(1);
		if(EDHGame::EDHPlayer1.Lost()&&!StandardGame::Continue)
		{
			EndGame(widget, data);
		}
	}
	StandardGame::RecentPlays.append("Player 1 gained 1 infect \n");
	UpdateLabels();
} 
Exemplo n.º 20
0
//Method called when the DecLifeButtonP2 is pressed
void DecLifeP2(GtkWidget *widget, gpointer data)
{
	if(EDHGame::edh == 0 /*not edh*/)
	{
		StandardGame::Player2.ChangeLife(-1);
		if(StandardGame::Player2.Lost()&&!StandardGame::Continue)
		{
			EndGame(widget, data);	
		}
	}
	else if(EDHGame::edh == 1 /*2player edh*/||EDHGame::edh == 2 /*3player edh*/)
	{
		EDHGame::EDHPlayer2.ChangeLife(-1);
		if(EDHGame::EDHPlayer2.Lost()&&!StandardGame::Continue)
		{
			EndGame(widget, data);
		}
	}
	
	StandardGame::RecentPlays.append("Player 1 lost 1 life \n");
	UpdateLabels();
} 
Exemplo n.º 21
0
void ResetGame(GtkWidget *widget, gpointer data)
{
	if(EDHGame::edh == 0 /*not edh*/)
	{
		StandardGame::Player1.ResetValues();
		StandardGame::Player2.ResetValues();
	}
	else if(EDHGame::edh == 1 /*2player edh*/)
	{
		EDHGame::EDHPlayer1.ResetValues();
		EDHGame::EDHPlayer2.ResetValues();
	}
	else if(EDHGame::edh == 2/*3player edh*/)
	{
		EDHGame::EDHPlayer1.ResetValues();
		EDHGame::EDHPlayer2.ResetValues();
		MultiPlayerEDHGame::EDHPlayer3.ResetValues();
	}

	StandardGame::Continue = false;
	StandardGame::RecentPlays = "";
	UpdateLabels();
}
Exemplo n.º 22
0
SettingsState::SettingsState(StateMachine & states, Context context)
	: State(states, context)
	, GUIcontainer_()
{
	background_.setTexture(context.textures_->get(Textures::Title));

	AddButtonLabel(Player::MoveLeft, 130.0f, "Move Left", context);
	AddButtonLabel(Player::MoveRight, 190.0f, "Move Right", context);
	AddButtonLabel(Player::MoveUp, 250.0f, "Move Up", context);
	AddButtonLabel(Player::MoveDown, 310.0f, "Move Down", context);

	UpdateLabels();

	auto backButton = std::make_shared<GUI::Button>(*context.fonts_, *context.textures_);
	backButton->setPosition(550.0f, 80.0f);
	backButton->setText("BACK");
	backButton->setTextColor(sf::Color::Black);
	backButton->setCallback([this]()
	{
		RequestPop();
	});

	GUIcontainer_.Pack(backButton);
}
Exemplo n.º 23
0
//************************************************************************
// sets the screen's chat contact
//************************************************************************
bool CChatScreen::SetContact(MCONTACT hContact)
{
	if(hContact == NULL)
	{
		m_hContact = NULL;
		return true;
	}
	
	// Check if the contact is valid
	char *szProto = GetContactProto(hContact);
	m_strProto = toTstring(szProto);

	CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(m_strProto);
	if(pIRCCon)
		m_bIRCProtocol = true;
	else
		m_bIRCProtocol = false;
			
			
	if(!szProto)
		return false;

	if(m_eReplyState != REPLY_STATE_NONE)
		DeactivateMessageMode();
	else if(IsMaximized())
		Minimize();

	m_bContactTyping = false;
	m_hContact = hContact;
	m_TextLog.ClearLog();
	UpdateLabels();

	LoadHistory();

	return true;
}
VOID MakePrime(MakePrimeParams *_pParams)
{
 BOOL Success;
 UINT Bits;
 //UINT i;
// MSG Msg;

 uint32_t MaxSmallPrimeSqr;
 clock_t clock1=clock();
 clock_t clock2;

 _pParams->Cnt[0]=0;
 _pParams->Cnt[1]=0;
 _pParams->Cnt[2]=0;
  UpdateLabels(_pParams);

  Bits=mpz_sizeinbase(_pParams->mpzP, 2);
 
   if(Bits>MAX_BITS)
   { 
    return;      
   }

 CTrialDivisionPrimeTest*   pTrialDivisionTest =new CTrialDivisionPrimeTest();
 MaxSmallPrimeSqr=pTrialDivisionTest->GetMaxSmallPrime();
 MaxSmallPrimeSqr*=MaxSmallPrimeSqr;

 CMillerRabinTest*          pMillerRabinTest   =new CMillerRabinTest(Bits);
 CStrongLucasSelfridgeTest* pStrongLucasSelfridgeTest;

 mpz_setbit(_pParams->mpzP, 0);     //Чётное

 do
 {
  if(Busy==FALSE)break;
   if(_pParams->Blum)
    mpz_setbit(_pParams->mpzP, 1); 

  Success=pTrialDivisionTest->Test(_pParams->mpzP);
  _pParams->Cnt[0]++;

   if(!Success){mpz_add_ui(_pParams->mpzP, _pParams->mpzP, 2); continue;}

   //Для маленьких чисел остальные тесты не нужны
   if(mpz_cmp_ui(_pParams->mpzP, MaxSmallPrimeSqr)<=0)break;
       
  Success=pMillerRabinTest->Test(_pParams->mpzP, 14);
  _pParams->Cnt[1]++;

  //
    clock2=clock();
   _pParams->mSecs=(int)( (((float)(clock2)-(float)clock1)/CLOCKS_PER_SEC)*1000);
    UpdateLabels(_pParams);
    ProcessMessages(NULL);
  //

   if(!Success){mpz_add_ui(_pParams->mpzP, _pParams->mpzP, 2); continue;}

  pStrongLucasSelfridgeTest=new CStrongLucasSelfridgeTest(Bits);
  Success=pStrongLucasSelfridgeTest->Test(_pParams->mpzP);
  _pParams->Cnt[2]++;

   if(!Success){delete pStrongLucasSelfridgeTest; mpz_add_ui(_pParams->mpzP, _pParams->mpzP, 2); continue;}
  delete pStrongLucasSelfridgeTest;
  break;

 }while(1);

 delete  pMillerRabinTest;
 delete  pTrialDivisionTest;
 }//--//
Exemplo n.º 25
0
void StationShipRepairForm::ShowAll()
{
	FaceForm::ShowAll();
	UpdateLabels();
}
Exemplo n.º 26
0
void Gui::OnRetry(void)
{
    model->retry();
    UpdateLabels();
}
Exemplo n.º 27
0
void Gui::OnNewGame(void)
{
    model->generate(side, density);
    UpdateLabels();
}
Exemplo n.º 28
0
void ModelDialog::OnChoice_DisplayAsSelect(wxCommandEvent& event)
{
    UpdateLabels();
}
Exemplo n.º 29
0
//************************************************************************
// Called when an event is received
//************************************************************************
void CChatScreen::OnEventReceived(CEvent *pEvent)
{
	// only let events for this contact pass
	if(pEvent->hContact != m_hContact &&
		// expect for IRC events without a contact -> global notifications
		!((pEvent->eType == EVENT_IRC_SENT || pEvent->eType == EVENT_IRC_RECEIVED) && pEvent->hContact == NULL))
		return;
	
	switch(pEvent->eType)
	{
	case EVENT_MESSAGE_ACK:
		if(pEvent->hValue != m_hMessage)
			return;

		if(pEvent->iValue == ACKRESULT_SUCCESS)
			DeactivateMessageMode();
		else
			InvalidateMessageMode(pEvent->strValue.empty()?CAppletManager::TranslateString(_T("Could not send the message!")):pEvent->strValue);
		break;
	case EVENT_IRC_SENT:
		// Add the message to the log
		AddOutgoingMessage(pEvent->strValue,&pEvent->Time,true);
		break;
	case EVENT_IRC_RECEIVED:
		// Add the message to the log
		AddIncomingMessage(pEvent->strValue,&pEvent->Time,true);
		break;
	case EVENT_MSG_RECEIVED:
		// mark it as read if required
		if(CConfig::GetBoolSetting(SESSION_MARKREAD) && !CAppletManager::IsMessageWindowOpen(m_hContact))
			CAppletManager::MarkMessageAsRead(m_hContact,pEvent->hValue);
		// Add the message to the log
		AddIncomingMessage(pEvent->strValue,&pEvent->Time);
		break;
	case EVENT_MSG_SENT:
		// Add the message to the log
		AddOutgoingMessage(pEvent->strValue,&pEvent->Time);
		break;
	case EVENT_CONTACT_HIDDEN:
		// contact is set to hidden
		if(pEvent->iValue == 1)
		{
			// Close the chat screen if the contact is an irc chatroom
			if(!(m_bIRCProtocol && db_get_b(pEvent->hContact, toNarrowString(m_strProto).c_str(), "ChatRoom", 0) != 0))
				break;
		}
		else
			break;
	case EVENT_CONTACT_DELETED:
		CAppletManager::GetInstance()->ActivateEventScreen();
		break;
	case EVENT_TYPING_NOTIFICATION:
		m_bContactTyping = pEvent->iValue != 0;
		UpdateLabels();
		break;
	case EVENT_STATUS:
	case EVENT_CONTACT_NICK:
	case EVENT_SIGNED_OFF:
	case EVENT_SIGNED_ON:
		UpdateLabels();
		break;
	}
}
VOID MakeSafePrime(MakePrimeParams *_pParams)
{
 // 5, 7, 11, 23, 47, 59, 83, 107, 167, 179, 227, 263, 347, 359, 383, 467, 479,
 // 503, 563, 587, 719, 839, 863, 887, 983, 1019, 1187, 1283, 1307, 1319, 1367,
 // 1439, 1487, 1523, 1619, 1823, 1907...
 const uint32_t StepVal=2;
 BOOL Success;
 UINT Bits;

 uint32_t MaxSmallPrimeSqr;
// uint32_t tmpUI;
 const clock_t clock1=clock();
 clock_t clock2;

 _pParams->Cnt[0]=0;
 _pParams->Cnt[1]=0;
 _pParams->Cnt[2]=0;
 _pParams->mSecs =0;

 UpdateLabels(_pParams);

  Bits=mpz_sizeinbase(_pParams->mpzP, 2);
  
  if(Bits>MAX_BITS_FOR_SAFE)
  { 
   return;
  }

  else if(mpz_cmp_ui(_pParams->mpzP, 5)<=0)
  {
   mpz_set_ui(_pParams->mpzP, 5);
   return;
  }

 CTrialDivisionPrimeTest*   pTrialDivisionTest =new CTrialDivisionPrimeTest();
 MaxSmallPrimeSqr=pTrialDivisionTest->GetMaxSmallPrime();
 MaxSmallPrimeSqr*=MaxSmallPrimeSqr;

 CMillerRabinTest*          pMillerRabinTest   =new CMillerRabinTest(Bits);
 CStrongLucasSelfridgeTest* pStrongLucasSelfridgeTest;

 uint32_t ulMaxBits=2*Bits + mp_bits_per_limb;
 mpz_init2(_pParams->mpzP2, ulMaxBits);

 mpz_init(_pParams->mpzP3);

 do
 {
  if(Busy==FALSE)break;

     mpz_setbit(_pParams->mpzP, 0); //Чётное
   if(_pParams->Blum)
     mpz_setbit(_pParams->mpzP, 1);

     mpz_set(_pParams->mpzP2, _pParams->mpzP);
     mpz_clrbit(_pParams->mpzP2, 0);//-1

  //TrialDivisionTest Не проверяет на 2,
  //поэтому пока не делим _pParams->mpzP2 на 2, сделаем это позже.
    // MessageBox(_pParams->hWnd, TEXT(""), TEXT(""), MB_OK);
  Success=pTrialDivisionTest->Test(_pParams->mpzP, _pParams->mpzP2);
  _pParams->Cnt[0]++;
   if(!Success){ mpz_add_ui(_pParams->mpzP, _pParams->mpzP, StepVal); continue;}
   
   //А сейчас уже надо делить на 2
   mpz_div_ui(_pParams->mpzP2, _pParams->mpzP2, 2);

  Success=pMillerRabinTest->Test(_pParams->mpzP, 14);
   if(Success)
     Success=pMillerRabinTest->Test(_pParams->mpzP2, 14);

   _pParams->Cnt[1]++;

   if(_pParams->Cnt[1]%17==0)
   {
    clock2=clock();
   _pParams->mSecs=(int)( (((float)(clock2)-(float)clock1)/CLOCKS_PER_SEC)*1000);
   }
   else if(_pParams->Cnt[1]%7==0)
   {
    UpdateLabels(_pParams);
    ProcessMessages(NULL);
   }
   

   if(!Success){mpz_add_ui(_pParams->mpzP, _pParams->mpzP, StepVal); continue;}

  pStrongLucasSelfridgeTest=new CStrongLucasSelfridgeTest(Bits);
  Success=pStrongLucasSelfridgeTest->Test(_pParams->mpzP);
  _pParams->Cnt[2]++;

   if(!Success){delete pStrongLucasSelfridgeTest; mpz_add_ui(_pParams->mpzP, _pParams->mpzP, StepVal); continue;}
  delete pStrongLucasSelfridgeTest;
  break;

 }while(1);

  clock2=clock();
  _pParams->mSecs=(int)( (((float)(clock2)-(float)clock1)/CLOCKS_PER_SEC)*1000);
  UpdateLabels(_pParams);
  ProcessMessages(NULL);

  delete  pMillerRabinTest;
  delete  pTrialDivisionTest;
  mpz_clear(_pParams->mpzP2);
  mpz_clear(_pParams->mpzP3);
 }//--//