void MemCheckOutputView::OnMarkedErrorsToClip(wxCommandEvent& event)
{
    wxDataViewEvent* menuEvent = dynamic_cast<wxDataViewEvent*>(event.GetEventUserData());
    if(!menuEvent) return;

    wxString text;
    wxVariant variant;
    wxDataViewItemArray items;
    m_dataViewCtrlErrorsModel->GetChildren(wxDataViewItem(0), items);
    int supColumn = GetColumnByName(_("Suppress"));
    if(supColumn == wxNOT_FOUND) {
        return;
    }
    MemCheckErrorReferrer* errorRef;
    for(wxDataViewItemArray::iterator it = items.begin(); it != items.end(); ++it) {
        m_dataViewCtrlErrorsModel->GetValue(variant, *it, supColumn);
        if(variant.GetBool()) {
            errorRef = dynamic_cast<MemCheckErrorReferrer*>(m_dataViewCtrlErrorsModel->GetClientObject(*it));
            text.Append(errorRef->Get().toString());
            text.Append(wxT("\n\n"));
        }
    }
    text.Trim();

    if(wxTheClipboard->Open()) {
        wxTheClipboard->SetData(new wxTextDataObject(text));
        wxTheClipboard->Close();
    }
}
void MemCheckOutputView::OnSuppressError(wxCommandEvent& event)
{
    wxDataViewEvent* menuEvent = dynamic_cast<wxDataViewEvent*>(event.GetEventUserData());
    if(!menuEvent) return;

    wxDataViewItem clickedItem = GetTopParent(menuEvent->GetItem());
    SuppressErrors(SUPPRESS_CLICKED, &clickedItem);
}
void MemCheckOutputView::OnJumpToLocation(wxCommandEvent& event)
{
    wxDataViewEvent* menuEvent = dynamic_cast<wxDataViewEvent*>(event.GetEventUserData());
    if(!menuEvent) return;

    wxDataViewItem item = GetLeaf(menuEvent->GetItem());
    SetCurrentItem(item);
    JumpToLocation(item);
}
void PostProcessingConfigDiag::Event_CheckBox(wxCommandEvent &ev)
{
	UserEventData* config_option = (UserEventData*)ev.GetEventUserData();
	ConfigGrouping* config = m_config_map[config_option->GetData()];

	m_post_processor->SetOptionb(config->GetOption(), ev.IsChecked());

	config->EnableDependentChildren(ev.IsChecked());

	ev.Skip();
}
void MemCheckOutputView::OnErrorToClip(wxCommandEvent& event)
{
    wxDataViewEvent* menuEvent = dynamic_cast<wxDataViewEvent*>(event.GetEventUserData());
    if(!menuEvent) return;

    MemCheckErrorReferrer* errorRef = dynamic_cast<MemCheckErrorReferrer*>(
        m_dataViewCtrlErrorsModel->GetClientObject(GetTopParent(menuEvent->GetItem())));
    if(!errorRef) return;

    if(wxTheClipboard->Open()) {
        wxTheClipboard->SetData(new wxTextDataObject(errorRef->Get().toString()));
        wxTheClipboard->Close();
    }
}
Пример #6
0
void GitConsole::OnDropDownMenuEvent(wxCommandEvent& event)
{
    int id = event.GetId();
    GitCommandData* userdata = static_cast<GitCommandData*>(event.GetEventUserData());
    wxCHECK_RET((int)userdata->arr.GetCount() > event.GetId(), "Out-of-range ID");
    event.SetString(userdata->arr.Item(id));
    event.SetId(userdata->id);

    wxPostEvent(m_git, event); // We've now populated the event object with useful data, so get GitPlugin to process it

    clConfig conf("git.conf");
    GitEntry data;
    conf.ReadItem(&data);
    GitCommandsEntries& ce = data.GetGitCommandsEntries(userdata->name);
    ce.SetLastUsedCommandIndex(id);
    conf.WriteItem(&data);
    conf.Save();
}
Пример #7
0
void PostProcessingConfigDiag::Event_Slider(wxCommandEvent& ev)
{
  UserEventData* config_option = (UserEventData*)ev.GetEventUserData();
  ConfigGrouping* config = m_config_map[config_option->GetData()];

  const auto& option_data = m_post_processor->GetOption(config->GetOption());

  size_t vector_size = 0;
  if (option_data.m_type ==
      PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_INTEGER)
    vector_size = option_data.m_integer_values.size();
  else
    vector_size = option_data.m_float_values.size();

  for (size_t i = 0; i < vector_size; ++i)
  {
    // Got to do this garbage again.
    // Convert current step in to the real range value
    int current_step = config->GetSliderValue(i);
    std::string string_value;
    if (option_data.m_type ==
        PostProcessingShaderConfiguration::ConfigurationOption::OptionType::OPTION_INTEGER)
    {
      s32 value =
          option_data.m_integer_step_values[i] * current_step + option_data.m_integer_min_values[i];
      m_post_processor->SetOptioni(config->GetOption(), i, value);
      string_value = std::to_string(value);
    }
    else
    {
      float value =
          option_data.m_float_step_values[i] * current_step + option_data.m_float_min_values[i];
      m_post_processor->SetOptionf(config->GetOption(), i, value);
      string_value = std::to_string(value);
    }
    // Update the text box to include the new value
    config->SetSliderText(i, string_value);
  }
  ev.Skip();
}
void FileTypeAssociationsPreferencesPage::onAssociationChanged(wxCommandEvent& evt)
{
    CustomEventHandlerData* data = dynamic_cast<CustomEventHandlerData*>(evt.GetEventUserData());
    if (data)
    {
        std::shared_ptr<FileTypeAssociation> association = std::make_shared<FileTypeAssociation>(data->documentTypeName());
        association->setAssociation(data->association());
        association->setAction(data->actionType(), data->projectName());
        if (data->association() == FileTypeAssociation::eDisabled)
        {
            association->setShellNewExtension("");
        }
        else
        {
            association->setShellNewExtension(data->shellNewExtension());
        }
        m_updatedFileTypeAssociations.set(association);

        if (data->association() == FileTypeAssociation::eDisabled)
        {
            data->newChoice()->SetSelection(0);
            data->newChoice()->Disable();
        }
        else
        {
            data->newChoice()->Enable();
        }
    }
    if (m_updatedFileTypeAssociations.size() != 0)
    {
        m_applyButton->Enable();
    }
    else
    {
        m_applyButton->Disable();
    }
}