From 633df1f061c78d30a2327a8cbd61cda8c790cd7a Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 24 May 2026 08:45:37 +0200 Subject: [PATCH] WordCensor: 3 censor modes (Grawlix / Replace / Alternative) and tidier UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine now takes a CensorOptions object with a Mode enum: - Grawlix (existing): mask the first ~50% of each match with random #@!?$%& characters. - Replacement: replace the whole match with a user-supplied string, default '[censored]'. The string is editable in the window. - Alternative: swap the match with another random entry from the bad-word list itself, with rough case-pattern preservation (FUCK → DAMN, Fuck → Damn, fuck → damn). Retries a few times to avoid picking the same word back. UI changes: - New 'How should offensive words be replaced?' card with the 3 modes as radio buttons; the replacement text box sits inline with its radio. - Highlight-in-red checkbox moved into the same card. - Window grew a bit (780x640) to fit the mode picker comfortably; section spacing tidied. Settings now persist mode + replacement + colorRed (was just colorRed). Old settings still load — only the missing fields fall back to defaults. Co-Authored-By: Claude Opus 4.7 (1M context) --- se5/WordCensor/MainWindow.axaml | 82 +++++++++++++++++---- se5/WordCensor/MainWindow.axaml.cs | 107 +++++++++++++++++++++++----- se5/WordCensor/WordCensorEngine.cs | 110 ++++++++++++++++++++++++----- 3 files changed, 251 insertions(+), 48 deletions(-) diff --git a/se5/WordCensor/MainWindow.axaml b/se5/WordCensor/MainWindow.axaml index f3acdbfd..ca93fa31 100644 --- a/se5/WordCensor/MainWindow.axaml +++ b/se5/WordCensor/MainWindow.axaml @@ -6,14 +6,15 @@ x:Class="SubtitleEdit.Plugins.WordCensor.MainWindow" mc:Ignorable="d" Title="Word censor" - Width="720" Height="600" - MinWidth="500" MinHeight="380" + Width="780" Height="640" + MinWidth="560" MinHeight="420" WindowStartupLocation="CenterScreen"> + + Margin="0,16,0,0"> - -