| 76 | }; |
| 77 | |
| 78 | std::set<AssDialogue*> process(std::string const& match_text, bool match_case, Mode mode, bool invert, bool comments, bool dialogue, int field_n, AssFile *ass) { |
| 79 | SearchReplaceSettings settings = { |
| 80 | match_text, |
| 81 | std::string(), |
| 82 | static_cast<SearchReplaceSettings::Field>(field_n), |
| 83 | SearchReplaceSettings::Limit::ALL, |
| 84 | match_case, |
| 85 | mode == Mode::REGEXP, |
| 86 | false, |
| 87 | false, |
| 88 | mode == Mode::EXACT |
| 89 | }; |
| 90 | |
| 91 | auto predicate = SearchReplaceEngine::GetMatcher(settings); |
| 92 | |
| 93 | std::set<AssDialogue*> matches; |
| 94 | for (auto& diag : ass->Events) { |
| 95 | if (diag.Comment && !comments) continue; |
| 96 | if (!diag.Comment && !dialogue) continue; |
| 97 | |
| 98 | if (invert != predicate(&diag, 0)) |
| 99 | matches.insert(&diag); |
| 100 | } |
| 101 | |
| 102 | return matches; |
| 103 | } |
| 104 | |
| 105 | DialogSelection::DialogSelection(agi::Context *c) : |
| 106 | wxDialog (c->parent, -1, _("Select"), wxDefaultPosition, wxDefaultSize, wxCAPTION) |