コード例 #1
0
ファイル: TextEditor.cpp プロジェクト: Gaerzi/SLADE
/* TextEditor::onJumpToCalculateComplete
 * Called when the 'Jump To' calculation thread completes
 *******************************************************************/
void TextEditor::onJumpToCalculateComplete(wxThreadEvent& e)
{
	if (!choice_jump_to)
	{
		jump_to_calculator = nullptr;
		return;
	}

	choice_jump_to->Clear();
	jump_to_lines.clear();

	string jump_points = e.GetString();
	wxArrayString split = wxSplit(jump_points, ',');

	wxArrayString items;
	for (unsigned a = 0; a < split.size(); a += 2)
	{
		if (a == split.size() - 1)
			break;

		long line;
		if (!split[a].ToLong(&line))
			line = 0;
		string name = split[a + 1];

		items.push_back(name);
		jump_to_lines.push_back(line);
	}

	choice_jump_to->Append(items);
	choice_jump_to->Enable(true);

	jump_to_calculator = nullptr;
}
コード例 #2
0
ファイル: MainFrame.cpp プロジェクト: pinetum/Ann545
void MainFrame::OnRBFComplete(wxThreadEvent& evt)
{
    //stopTimer("RBF Stop");
    m_RBF = NULL;
    m_bRBFrunning = false;
    showMessage(evt.GetString());
}
コード例 #3
0
ファイル: NetWindow.cpp プロジェクト: CarlKenner/dolphin
// update gui
void NetPlayDialog::OnThread(wxThreadEvent& event)
{
    if (m_is_hosting && m_host_label && g_TraversalClient)
    {
        UpdateHostLabel();
    }

    // player list
    m_playerids.clear();
    std::string tmps;
    netplay_client->GetPlayerList(tmps, m_playerids);

    wxString selection;
    if (m_player_lbox->GetSelection() != wxNOT_FOUND)
        selection = m_player_lbox->GetString(m_player_lbox->GetSelection());

    m_player_lbox->Clear();
    std::istringstream ss(tmps);
    while (std::getline(ss, tmps))
        m_player_lbox->Append(StrToWxStr(tmps));

    // remove ping from selection string, in case it has changed
    selection.erase(selection.rfind('|') + 1);

    if (!selection.empty())
    {
        for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i)
        {
            if (selection == m_player_lbox->GetString(i).substr(0, selection.length()))
            {
                m_player_lbox->SetSelection(i);
                break;
            }
        }
    }

    // flash window in taskbar when someone joins if window isn't active
    static u8 numPlayers = 1;
    if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus())
    {
        RequestUserAttention();
    }
    numPlayers = m_playerids.size();

    switch (event.GetId())
    {
    case NP_GUI_EVT_CHANGE_GAME:
        // update selected game :/
    {
        m_selected_game = WxStrToStr(event.GetString());

        wxString button_label = event.GetString();
        m_game_btn->SetLabel(button_label.Prepend(_(" Game : ")));
    }
    break;
    case NP_GUI_EVT_START_GAME:
        // client start game :/
    {
        netplay_client->StartGame(FindGame());
    }
    break;
    case NP_GUI_EVT_STOP_GAME:
        // client stop game
    {
        netplay_client->StopGame();
    }
    break;
    }

    // chat messages
    while (chat_msgs.Size())
    {
        std::string s;
        chat_msgs.Pop(s);
        // PanicAlert("message: %s", s.c_str());
        m_chat_text->AppendText(StrToWxStr(s).Append('\n'));
    }
}
コード例 #4
0
ファイル: MainFrame.cpp プロジェクト: pinetum/Ann545
void MainFrame::OnRBFUpdate(wxThreadEvent& evt)
{
    showMessage(evt.GetString());
}
コード例 #5
0
ファイル: NetWindow.cpp プロジェクト: Tinob/Ishiiruka
// update gui
void NetPlayDialog::OnThread(wxThreadEvent& event)
{
  if (m_is_hosting && m_host_label && g_TraversalClient)
  {
    UpdateHostLabel();
  }

  // player list
  m_playerids.clear();
  std::string tmps;
  netplay_client->GetPlayerList(tmps, m_playerids);

  wxString selection;
  if (m_player_lbox->GetSelection() != wxNOT_FOUND)
    selection = m_player_lbox->GetString(m_player_lbox->GetSelection());

  m_player_lbox->Clear();
  std::istringstream ss(tmps);
  while (std::getline(ss, tmps))
    m_player_lbox->Append(StrToWxStr(tmps));

  // remove ping from selection string, in case it has changed
  selection.erase(selection.rfind('|') + 1);

  if (!selection.empty())
  {
    for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i)
    {
      if (selection == m_player_lbox->GetString(i).substr(0, selection.length()))
      {
        m_player_lbox->SetSelection(i);
        break;
      }
    }
  }

  // flash window in taskbar when someone joins if window isn't active
  static u8 numPlayers = 1;
  if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus())
  {
    RequestUserAttention();
  }
  numPlayers = m_playerids.size();

  switch (event.GetId())
  {
  case NP_GUI_EVT_CHANGE_GAME:
    // update selected game :/
  {
    m_selected_game = WxStrToStr(event.GetString());

    wxString button_label = event.GetString();
    m_game_btn->SetLabel(button_label.Prepend(_(" Game : ")));
  }
  break;
  case NP_GUI_EVT_START_GAME:
    // client start game :/
  {
    netplay_client->StartGame(FindCurrentGame());
    std::string msg = "Starting game";
    AddChatMessage(ChatMessageType::Info, msg);
  }
  break;
  case NP_GUI_EVT_STOP_GAME:
    // client stop game
  {
    std::string msg = "Stopping game";
    AddChatMessage(ChatMessageType::Info, msg);
  }
  break;
  case NP_GUI_EVT_DISPLAY_MD5_DIALOG:
  {
    m_MD5_dialog = new MD5Dialog(this, netplay_server, netplay_client->GetPlayers(),
      event.GetString().ToStdString());
    m_MD5_dialog->Show();
  }
  break;
  case NP_GUI_EVT_MD5_PROGRESS:
  {
    if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted())
      break;

    std::pair<int, int> payload = event.GetPayload<std::pair<int, int>>();
    m_MD5_dialog->SetProgress(payload.first, payload.second);
  }
  break;
  case NP_GUI_EVT_MD5_RESULT:
  {
    if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted())
      break;

    std::pair<int, std::string> payload = event.GetPayload<std::pair<int, std::string>>();
    m_MD5_dialog->SetResult(payload.first, payload.second);
  }
  break;
  case NP_GUI_EVT_PAD_BUFFER_CHANGE:
  {
    std::string msg = StringFromFormat("Buffer size: %d", m_pad_buffer);

    if (g_ActiveConfig.bShowNetPlayMessages)
    {
      OSD::AddTypedMessage(OSD::MessageType::NetPlayBuffer, msg, OSD::Duration::NORMAL);
    }

    AddChatMessage(ChatMessageType::Info, msg);
  }
  break;
  case NP_GUI_EVT_DESYNC:
  {
    std::string msg = "Possible desync detected from player " + m_desync_player + " on frame " +
      std::to_string(m_desync_frame);

    AddChatMessage(ChatMessageType::Error, msg);

    if (g_ActiveConfig.bShowNetPlayMessages)
    {
      OSD::AddMessage(msg, OSD::Duration::VERY_LONG, OSD::Color::RED);
    }
  }
  break;
  case NP_GUI_EVT_CONNECTION_LOST:
  {
    std::string msg = "Lost connection to server";
    AddChatMessage(ChatMessageType::Error, msg);
  }
  break;
  case NP_GUI_EVT_TRAVERSAL_CONNECTION_ERROR:
  {
    std::string msg = "Traversal server connection error";
    AddChatMessage(ChatMessageType::Error, msg);
  }
  }

  // chat messages
  while (m_chat_msgs.Size())
  {
    std::string s;
    m_chat_msgs.Pop(s);
    AddChatMessage(ChatMessageType::UserIn, s);

    if (g_ActiveConfig.bShowNetPlayMessages)
    {
      OSD::AddMessage(s, OSD::Duration::NORMAL, OSD::Color::GREEN);
    }
  }
}
コード例 #6
0
ファイル: my_dll.cpp プロジェクト: vdm113/wxWidgets-ICC-patch
void MyDllApp::OnShowWindow(wxThreadEvent& event)
{
    wxFrame *f = new MyDllFrame(NULL, event.GetString());
    f->Show(true);
}
コード例 #7
0
ファイル: MainApp.cpp プロジェクト: STJrInuyasha/SLADE
/* MainApp::onVersionCheckCompleted
 * Called when the VersionCheck thread completes
 *******************************************************************/
void MainApp::onVersionCheckCompleted(wxThreadEvent& e)
{
	// Check failed
	if (e.GetString() == "connect_failed")
	{
		LOG_MESSAGE(1, "Version check failed, unable to connect");
		if (update_check_message_box)
			wxMessageBox("Update check failed: unable to connect to internet. Check your connection and try again.", "Check for Updates");
		return;
	}

	wxArrayString info = wxSplit(e.GetString(), '\n');
	
	// Check for correct info
	if (info.size() != 5)
	{
		LOG_MESSAGE(1, "Version check failed, received invalid version info");
		if (update_check_message_box)
			wxMessageBox("Update check failed: received invalid version info.", "Check for Updates");
		return;
	}

	// Get version numbers
	long version_stable, version_beta, beta_num;
	info[0].ToLong(&version_stable);
	info[2].ToLong(&version_beta);
	info[3].ToLong(&beta_num);

	LOG_MESSAGE(1, "Latest stable release: v%ld \"%s\"", version_stable, info[1].Trim());
	LOG_MESSAGE(1, "Latest beta release: v%ld_b%ld \"%s\"", version_beta, beta_num, info[4].Trim());

	// Check if new stable version
	bool new_stable = false;
	if (Global::version_num < version_stable ||								// New stable version
		(Global::version_num == version_stable && Global::beta_num > 0))	// Stable version of current beta
		new_stable = true;

	// Check if new beta version
	bool new_beta = false;
	if (version_stable < version_beta)
	{
		// Stable -> Beta
		if (Global::version_num < version_beta && Global::beta_num == 0)
			new_beta = true;

		// Beta -> Beta
		else if (Global::version_num < version_beta ||															// New version beta
				(Global::beta_num < beta_num && Global::version_num == version_beta && Global::beta_num > 0))	// Same version, newer beta
			new_beta = true;
	}

	// Ask for new beta
	if (update_check_beta && new_beta)
	{
		if (wxMessageBox(S_FMT("A new beta version of SLADE is available (%s), click OK to visit the SLADE homepage and download the update.", info[4].Trim()), "New Beta Version Available", wxOK|wxCANCEL) == wxOK)
			wxLaunchDefaultBrowser("http://slade.mancubus.net/index.php?page=downloads");

		return;
	}

	// Ask for new stable
	if (new_stable)
	{
		if (wxMessageBox(S_FMT("A new version of SLADE is available (%s), click OK to visit the SLADE homepage and download the update.", info[1].Trim()), "New Version Available", wxOK|wxCANCEL) == wxOK)
			wxLaunchDefaultBrowser("http://slade.mancubus.net/index.php?page=downloads");

		return;
	}

	LOG_MESSAGE(1, "Already up-to-date");
	if (update_check_message_box)
		wxMessageBox("SLADE is already up to date", "Check for Updates");
}
コード例 #8
0
ファイル: ZLauncherFrame.cpp プロジェクト: TheZoc/ZPatcher
void ZLauncherFrame::OnHTMLLoadPage(wxThreadEvent& evt)
{
	m_htmlWin->LoadURL(evt.GetString());
}
コード例 #9
0
ファイル: ZLauncherFrame.cpp プロジェクト: TheZoc/ZPatcher
void ZLauncherFrame::OnHTMLSetContent(wxThreadEvent& evt)
{
	m_htmlWin->SetPage(evt.GetString(), "");
}
コード例 #10
0
ファイル: ZLauncherFrame.cpp プロジェクト: TheZoc/ZPatcher
void ZLauncherFrame::OnProgressTextUpdate(wxThreadEvent& evt)
{
	m_txtProgress->SetValue(evt.GetString());
}
コード例 #11
0
ファイル: CreatePatchFrame.cpp プロジェクト: gOreteQ/ZPatcher
void CreatePatchFrame::OnFileProcessedTextUpdate(wxThreadEvent& evt)
{
	m_txtProcessingFile->SetValue(evt.GetString());
}
コード例 #12
0
ファイル: CreatePatchFrame.cpp プロジェクト: gOreteQ/ZPatcher
void CreatePatchFrame::OnComparisonTextUpdate(wxThreadEvent& evt)
{
	m_txtComparison->SetValue(evt.GetString());
}