void DialogProperties::OnOK(wxCommandEvent &) { int count = 0; for (auto const& prop : properties) count += SetInfoIfDifferent(prop.first, from_wx(prop.second->GetValue())); count += SetInfoIfDifferent("PlayResX", from_wx(ResX->GetValue())); count += SetInfoIfDifferent("PlayResY", from_wx(ResY->GetValue())); count += SetInfoIfDifferent("WrapStyle", std::to_string(WrapStyle->GetSelection())); count += SetInfoIfDifferent("ScaledBorderAndShadow", ScaleBorder->GetValue() ? "yes" : "no"); if (count) c->ass->Commit(_("property changes"), AssFile::COMMIT_SCRIPTINFO); EndModal(!!count); }
void DialogProperties::OnOK(wxCommandEvent &) { int count = 0; for (auto const& prop : properties) count += SetInfoIfDifferent(prop.first, prop.second->GetValue()); count += SetInfoIfDifferent("PlayResX", ResX->GetValue()); count += SetInfoIfDifferent("PlayResY", ResY->GetValue()); count += SetInfoIfDifferent("WrapStyle", wxString::Format("%d", WrapStyle->GetSelection())); wxString col[2] = { "Normal", "Reverse" }; count += SetInfoIfDifferent("Collisions", col[collision->GetSelection()]); count += SetInfoIfDifferent("ScaledBorderAndShadow", ScaleBorder->GetValue()? "yes" : "no"); if (count) c->ass->Commit(_("property changes"), AssFile::COMMIT_SCRIPTINFO); EndModal(!!count); }
///////////////// // Apply changes void DialogProperties::OnOK(wxCommandEvent &event) { // Update details int count = 0; count += SetInfoIfDifferent(_T("Title"),TitleEdit->GetValue()); count += SetInfoIfDifferent(_T("Original Script"),OrigScriptEdit->GetValue()); count += SetInfoIfDifferent(_T("Original Translation"),TranslationEdit->GetValue()); count += SetInfoIfDifferent(_T("Original Editing"),EditingEdit->GetValue()); count += SetInfoIfDifferent(_T("Original Timing"),TimingEdit->GetValue()); count += SetInfoIfDifferent(_T("Synch Point"),SyncEdit->GetValue()); count += SetInfoIfDifferent(_T("Script Updated By"),UpdatedEdit->GetValue()); count += SetInfoIfDifferent(_T("Update Details"),UpdateDetailsEdit->GetValue()); count += SetInfoIfDifferent(_T("PlayResX"),ResX->GetValue()); count += SetInfoIfDifferent(_T("PlayResY"),ResY->GetValue()); count += SetInfoIfDifferent(_T("WrapStyle"),wxString::Format(_T("%i"),WrapStyle->GetSelection())); if (count) AssFile::top->FlagAsModified(); EndModal(count?1:0); }