diff --git a/CHANGELOG.md b/CHANGELOG.md index ac25425..26108ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Changelog -## Unreleased +## 2.2.2 - **Language picker.** Under Settings › General › Appearance › Language, search by name or code and choose Auto, Español, English, Deutsch or 한국어, each marked as complete. +- **More languages, coming soon.** The language picker shows a calm note under the list, in the interface language (Spanish, English, German and Korean), that more interface languages are on the way; it is not a row and does not appear in search. - **English interface.** Stackshot follows the Windows language: English on an English Windows, and English can be chosen under Settings › General › Appearance › Language. Contributed by @altmashnaveed (PR #12). - **Korean interface.** Select 한국어 in the language picker or use Automatic on Korean Windows. Existing language preferences are preserved. Contributed by @Hobeom (PR #30). - **German, complete.** The German interface that arrived with PR #13 (by Aamer Shahzad) now covers the whole app: capture and the area picker, the editor, recording and the video tools, the desktop mascot included, the Home window, history, reports and the Markdown and XML viewers. Notices keep their kind in every language (their kind comes from the text's key, not from the words of one language), a document that is not UTF-8 is rescued the same in all languages, and shown numbers use each language's own thousands and decimal marks. The in-app news come in the interface language (Spanish, English, German and Korean). diff --git a/docs/novedades.de.md b/docs/novedades.de.md index c50efad..10be44e 100644 --- a/docs/novedades.de.md +++ b/docs/novedades.de.md @@ -11,6 +11,7 @@ Format: ein Abschnitt `## X.Y.Z` pro Version und darin eine Zeile pro Neuerung: - **Deutsch, vollständig.** Deutsch deckt jetzt die ganze App ab: Aufnahme, Editor, Aufzeichnung, das Maskottchen, Startseite, Verlauf und Berichte. - **Oberfläche auf Koreanisch.** Wähle 한국어 unter Einstellungen › Allgemein › Erscheinungsbild › Sprache. Danke an @Hobeom für die Übersetzung. - **Neue Sprachauswahl.** Suche Sprachen nach Name oder Code; jede zeigt, dass ihre Übersetzung vollständig ist. +- **Bald mehr Sprachen.** Die Sprachauswahl weist darauf hin, dass weitere Oberflächensprachen in Vorbereitung sind. - **Automatische Sprache und ein einmaliges Angebot.** Automatisch folgt der Windows-Sprache (Spanisch, Englisch, Deutsch oder Koreanisch). Wenn du Stackshot schon auf Spanisch benutzt hast und Windows in einer anderen Sprache läuft, wird dir die passende Sprache einmal angeboten; wenn du nicht zustimmst, ändert sich nichts. - **Sensible Daten in jeder Sprache abgedeckt.** Sensible Daten in einer Aufnahme zu finden und abzudecken funktioniert gleich, egal welche Oberflächensprache eingestellt ist. diff --git a/docs/novedades.en.md b/docs/novedades.en.md index 4b228d9..50d7e77 100644 --- a/docs/novedades.en.md +++ b/docs/novedades.en.md @@ -11,6 +11,7 @@ Format: one `## X.Y.Z` section per version and, in it, one line per item: `- **T - **German, complete.** German now covers the whole app: capture, editor, recording, the mascot, Home, history and reports. - **Korean interface.** Choose 한국어 under Settings › General › Appearance › Language. Thanks to @Hobeom for the translation. - **New language picker.** Search languages by name or code; each one says its translation is complete. +- **More languages, coming soon.** The language picker now says that more interface languages are on the way. - **Automatic language and a one-time offer.** Automatic follows the Windows language (Spanish, English, German or Korean). If you already used Stackshot in Spanish on a Windows in another language, you are offered the matching language once; if you do not accept, nothing changes. - **Sensitive data covered in any language.** Finding and covering the sensitive data in a capture works the same whatever the interface language is. diff --git a/docs/novedades.ko.md b/docs/novedades.ko.md index 0a85ae7..849f7ff 100644 --- a/docs/novedades.ko.md +++ b/docs/novedades.ko.md @@ -6,6 +6,7 @@ - **독일어 번역 완료.** 이제 캡처, 편집기, 녹화, 마스코트, 홈, 기록, 보고서까지 앱 전체를 독일어로 사용할 수 있습니다. - **한국어 인터페이스.** 설정 › 일반 › 화면 모양 › 언어에서 한국어를 선택할 수 있습니다. 번역해 주신 @Hobeom 님께 감사드립니다. - **새 언어 선택기.** 이름이나 코드로 언어를 검색할 수 있고, 각 언어에 번역이 완료되었다고 표시됩니다. +- **더 많은 언어, 곧 만나요.** 언어 선택기에서 앞으로 더 많은 인터페이스 언어가 추가될 예정임을 알려 드립니다. - **자동 언어와 한 번만 나오는 제안.** 자동 모드는 Windows 언어(스페인어, 영어, 독일어, 한국어)를 따릅니다. 이미 스페인어로 Stackshot을 쓰고 있는데 Windows가 다른 언어라면 맞는 언어로 바꿀지 한 번만 묻습니다. 수락하지 않으면 아무것도 바뀌지 않습니다. - **어떤 언어에서도 민감한 정보 가림.** 인터페이스 언어와 관계없이 캡처에서 민감한 정보를 찾아 가리는 방식은 같습니다. diff --git a/docs/novedades.md b/docs/novedades.md index b6077b8..1830016 100644 --- a/docs/novedades.md +++ b/docs/novedades.md @@ -11,6 +11,7 @@ Formato: una sección `## X.Y.Z` por versión y, en ella, una línea por novedad - **Alemán completo.** El alemán cubre ya toda la aplicación: captura, editor, grabación, la mascota, Inicio, el historial y los informes. - **Interfaz en coreano.** Elige 한국어 en Ajustes › General › Apariencia › Idioma. Gracias a @Hobeom por la traducción. - **Selector de idioma nuevo.** Busca el idioma por nombre o por código; cada uno indica que su traducción está completa. +- **Más idiomas, muy pronto.** El selector de idioma avisa de que se están preparando más idiomas para la interfaz. - **Idioma automático y una oferta única.** El modo automático sigue el idioma de Windows (español, inglés, alemán o coreano). Si ya usabas Stackshot en español en un Windows en otro idioma, se te ofrece una sola vez el idioma que corresponde; si no aceptas, no cambia nada. - **Datos sensibles tapados en cualquier idioma.** Detectar y tapar los datos sensibles de una captura funciona igual sea cual sea el idioma de la interfaz. diff --git a/src/Home/LanguagePicker.cs b/src/Home/LanguagePicker.cs index 36a1cdc..2b07fc9 100644 --- a/src/Home/LanguagePicker.cs +++ b/src/Home/LanguagePicker.cs @@ -16,6 +16,7 @@ internal sealed class LanguagePicker : Sheet readonly TextBox search; readonly ListBox list; readonly TextBlock empty; + readonly Border note; readonly MacButton apply; string picked; @@ -87,6 +88,7 @@ double P(double dip) layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); layout.RowDefinitions.Add(new RowDefinition()); layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); + layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); Root.Children.Add(layout); var header = new StackPanel(); @@ -156,6 +158,27 @@ double P(double dip) Grid.SetRow(results, 1); layout.Children.Add(results); + // A calm line, not a toast: the languages still to come, in the picker's own language, aligned with the rows' + // rings. It is no row (nothing to pick, search or focus); a contrast theme drops the tint and keeps the edge. + string soon = I18n.T("Pronto habr\u00E1 m\u00E1s idiomas.", "More languages are coming soon.", "Weitere Sprachen folgen bald."); + var noteRow = new Grid(); + noteRow.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); + noteRow.ColumnDefinitions.Add(new ColumnDefinition()); + noteRow.Children.Add(new GlyphView("globe", 15, pal.Link, 1.5) { Margin = new Thickness(0, 0, 9, 0), VerticalAlignment = VerticalAlignment.Center }); + var noteText = new TextBlock { Text = soon, FontSize = 12.5, TextWrapping = TextWrapping.Wrap, Foreground = Ds.Brush(pal.Label2), VerticalAlignment = VerticalAlignment.Center }; + Grid.SetColumn(noteText, 1); + noteRow.Children.Add(noteText); + note = new Border + { + Margin = new Thickness(P(RowInset), P(6), P(RowInset), 0), Padding = new Thickness(13, 9, 13, 9), + CornerRadius = new CornerRadius(Ds.RPanel), SnapsToDevicePixels = true, Focusable = false, Child = noteRow, + Background = pal.High ? null : Ds.Brush(Ds.Argb(pal.Dark ? 0.12 : 0.07, pal.Accent.R, pal.Accent.G, pal.Accent.B)), + BorderBrush = pal.High ? Ds.Brush(pal.Hairline) : Ds.Brush(Ds.Argb(pal.Dark ? 0.20 : 0.14, pal.Accent.R, pal.Accent.G, pal.Accent.B)), + BorderThickness = new Thickness(1) + }; + Grid.SetRow(note, 2); + layout.Children.Add(note); + var actions = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 12, 0, 0) }; // The custom buttons draw their own text. Keep their drawing coordinates // left-to-right so WPF mirrors their placement without mirroring the glyphs. @@ -166,7 +189,7 @@ double P(double dip) apply.Click += Commit; actions.Children.Add(cancel); actions.Children.Add(apply); - Grid.SetRow(actions, 2); + Grid.SetRow(actions, 3); layout.Children.Add(actions); list.SelectionChanged += delegate { apply.IsEnabled = list.SelectedItem != null; }; diff --git a/src/I18n.Korean.HomeSettings.cs b/src/I18n.Korean.HomeSettings.cs index 35b82fa..0b8885b 100644 --- a/src/I18n.Korean.HomeSettings.cs +++ b/src/I18n.Korean.HomeSettings.cs @@ -655,6 +655,7 @@ static void RegisterKoreanHomeSettings(Dictionary map) map["Search languages"] = "\uC5B8\uC5B4 \uAC80\uC0C9"; map["Languages"] = "\uC5B8\uC5B4 \uBAA9\uB85D"; map["No matching languages."] = "\uC77C\uCE58\uD558\uB294 \uC5B8\uC5B4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."; + map["More languages are coming soon."] = "\uB354 \uB9CE\uC740 \uC5B8\uC5B4\uAC00 \uACE7 \uCD94\uAC00\uB429\uB2C8\uB2E4."; map["Apply language"] = "\uC5B8\uC5B4 \uC801\uC6A9"; map["Follow the Windows language"] = "Windows \uD45C\uC2DC \uC5B8\uC5B4 \uB530\uB974\uAE30"; map["Partial translation"] = "\uC77C\uBD80 \uBC88\uC5ED"; diff --git a/tests/app/AppTestsI18nFinal.cs b/tests/app/AppTestsI18nFinal.cs index 631b42e..d03b7ea 100644 --- a/tests/app/AppTestsI18nFinal.cs +++ b/tests/app/AppTestsI18nFinal.cs @@ -79,6 +79,10 @@ public static void Suite(Action T) T("backdrop-slider-help-follows-the-language", BackdropSliderHelpFollowsTheLanguage); T("korean-names-the-media-keys", KoreanNamesTheMediaKeys); T("last-audit-screens-as-pictures", Pictures); + T("picker-shows-more-languages-note", PickerShowsMoreLanguagesNote); + T("news-mentions-more-languages", NewsMentionsMoreLanguages); + T("fresh-install-is-automatic", FreshInstallIsAutomatic); + T("picker-note-as-pictures", PickerNotePictures); } static string[] AllLanguages { get { return AppTestsI18nLayout.AllLanguages; } } @@ -1465,6 +1469,240 @@ public static void KoreanNamesTheMediaKeys() InLanguage("de", delegate { Same("Stumm", Hotkeys.KeyName(System.Windows.Forms.Keys.VolumeMute), "German mute"); }); } + // ---- T30: the language picker says that more languages are coming, and the news say it too. + + static readonly Dictionary SoonNote = new Dictionary + { + { "es", "Pronto habr\u00E1 m\u00E1s idiomas." }, + { "en", "More languages are coming soon." }, + { "de", "Weitere Sprachen folgen bald." }, + { "ko", "\uB354 \uB9CE\uC740 \uC5B8\uC5B4\uAC00 \uACE7 \uCD94\uAC00\uB429\uB2C8\uB2E4." } + }; + + static object FieldOf(object o, string name) + { + FieldInfo f = o.GetType().GetField(name, BindingFlags.NonPublic | BindingFlags.Instance); + Check(f != null, o.GetType().Name + " has no field " + name); + return f.GetValue(o); + } + + static TextBlock NoteText(LanguagePicker picker) + { + Border note = FieldOf(picker, "note") as Border; + Check(note != null, "the picker keeps its note"); + TextBlock found = null; + AppTestsI18n.Walk(note, new HashSet(), d => { if (d is TextBlock && found == null) found = (TextBlock)d; }); + Check(found != null, "the note has its text"); + return found; + } + + static Rect Where(FrameworkElement e, FrameworkElement root) { return e.TransformToAncestor(root).TransformBounds(new Rect(0, 0, e.ActualWidth, e.ActualHeight)); } + + static void LayPicker(LanguagePicker picker, Size size) + { + FrameworkElement root = (FrameworkElement)picker.Content; + root.Measure(size); + root.Arrange(new Rect(size)); + root.UpdateLayout(); + } + + // Under the list and above Cancel / Apply sits a quiet note (not a toast, not a row): it names no language, it is + // there in every shown language, it is no row and nothing to pick or to find, it stays while the search filters the + // list, it reads as one line (two at the narrowest work area) aligned with the rows, and screen readers get its text. + public static void PickerShowsMoreLanguagesNote() + { + foreach (string lang in new[] { "es", "en", "de", "ko" }) + InLanguage(lang, delegate + { + string want = SoonNote[lang]; + LanguagePicker picker = NewPicker("auto"); + try + { + Check(AppTestsI18n.Strings(picker.Content).Contains(want), lang + ": the picker lacks <" + Show(want) + ">"); + ListBox list = (ListBox)FieldOf(picker, "list"); + TextBox search = (TextBox)FieldOf(picker, "search"); + Same("auto,es,en,de,ko", string.Join(",", list.Items.Cast().Select(i => (string)i.Tag).ToArray()), lang + " rows: the note is no language"); + Check(list.Items.Cast().All(i => !AppTestsI18n.Strings(i).Contains(want)), lang + ": the note sits inside a row"); + Same("auto", (string)((ListBoxItem)list.SelectedItem).Tag, lang + " opens on Automatic"); + + TextBlock text = NoteText(picker); + Border note = (Border)FieldOf(picker, "note"); + Check(!note.Focusable && !text.Focusable, lang + ": the note can be picked"); + Check(System.Windows.Automation.Peers.UIElementAutomationPeer.CreatePeerForElement(text).GetName() == want, lang + ": a screen reader does not get the text"); + + foreach (string q in new[] { want, want.Split(' ')[0], "soon", "bald", "pronto", "\uACE7" }) + { + Check(I18n.FilterLanguages(q).Count == 0, lang + ": searching '" + Show(q) + "' finds a language"); + search.Text = q; + Check(list.Items.Count == 0, lang + ": searching '" + Show(q) + "' lists rows"); + Check(AppTestsI18n.Strings(picker.Content).Contains(want), lang + ": the note left while searching '" + Show(q) + "'"); + } + search.Text = "de"; + Check(list.Items.Count == 1 && AppTestsI18n.Strings(picker.Content).Contains(want), lang + ": the note stays while the search filters"); + search.Text = ""; + + foreach (double width in new[] { 1920.0, 320.0 }) + { + Size size = LanguagePicker.Preferred(width, 1080); + LayPicker(picker, size); + FrameworkElement root = (FrameworkElement)picker.Content; + Rect n = Where(note, root), rows = Where(list, root), apply = Where((FrameworkElement)FieldOf(picker, "apply"), root); + Check(n.Left >= 0 && n.Right <= size.Width && n.Bottom <= size.Height && n.Height > 16, lang + " @" + width + ": the note is cut: " + n); + Check(rows.Bottom <= n.Top + 0.5 && n.Bottom <= apply.Top + 0.5, lang + " @" + width + ": the note overlaps the list or the buttons: " + n + " / " + rows + " / " + apply); + Check(text.ActualHeight <= text.FontSize * 1.8 * (width > 400 ? 1 : 2) && text.ActualWidth > 0, lang + " @" + width + ": the note is too tall (" + text.ActualHeight + ")"); + Rect ring = Where((FrameworkElement)((ListBoxItem)list.Items[0]).Content, root); + Check(Math.Abs(ring.Left - n.Left) < 1.5 && Math.Abs(ring.Right - n.Right) < 1.5, lang + " @" + width + ": the note is not aligned with the rows: " + n + " vs " + ring); + } + } + finally { picker.Close(); } + }); + } + + static string Section(string md, string version) + { + return Regex.Match(md, "^## " + Regex.Escape(version) + @"\s*$(.*?)(?=^## |\z)", RegexOptions.Multiline | RegexOptions.Singleline).Groups[1].Value; + } + + // "More languages are on the way" is one 2.2.2 news line in each of the four news files and in the changelog, as the + // same meaning, and names none of the languages that are not on offer yet. + public static void NewsMentionsMoreLanguages() + { + string root = AppTestsI18nCoverage.RepoRoot(); + Dictionary titles = new Dictionary + { + { "novedades.md", "**M\u00E1s idiomas, muy pronto.**" }, + { "novedades.en.md", "**More languages, coming soon.**" }, + { "novedades.de.md", "**Bald mehr Sprachen.**" }, + { "novedades.ko.md", "**\uB354 \uB9CE\uC740 \uC5B8\uC5B4, \uACE7 \uB9CC\uB098\uC694.**" } + }; + string[] hidden = { "French", "Fran\u00E7ais", "Franc\u00E9s", "Franz\u00F6sisch", "\uD504\uB791\uC2A4\uC5B4", "Portug", "Portugi", "\uD3EC\uB974\uD22C\uAC08", + "Chin", "\u4E2D\u6587", "Mandarin", "\uC911\uAD6D\uC5B4", "Hindi", "\uD78C\uB514", "Arab", "\u0627\u0644\u0639\u0631\u0628\u064A\u0629", "\u00C1rabe", "\uC544\uB78D", "Bengal", "\u09AC\u09BE\u0982\u09B2\u09BE", "\uBCB5\uACE8" }; + foreach (KeyValuePair f in titles) + { + string md = File.ReadAllText(Path.Combine(root, "docs", f.Key), Encoding.UTF8); + string[] lines = Section(md, "2.2.2").Replace("\r", "").Split('\n').Where(l => l.StartsWith("- " + f.Value + " ", StringComparison.Ordinal)).ToArray(); + Check(lines.Length == 1, f.Key + ": 2.2.2 has " + lines.Length + " lines titled " + f.Value); + foreach (string h in hidden) + Check(lines[0].IndexOf(h, StringComparison.OrdinalIgnoreCase) < 0, f.Key + ": the line names " + h); + } + string log = File.ReadAllText(Path.Combine(root, "CHANGELOG.md"), Encoding.UTF8); + string unreleased = Regex.Match(log, @"^## (?:Unreleased|2\.2\.2)\s*$(.*?)(?=^## |\z)", RegexOptions.Multiline | RegexOptions.Singleline).Groups[1].Value; + string[] more = unreleased.Replace("\r", "").Split('\n').Where(l => l.StartsWith("- **More languages", StringComparison.Ordinal)).ToArray(); + Check(more.Length == 1, "CHANGELOG Unreleased/2.2.2 has " + more.Length + " 'More languages' lines"); + foreach (string h in hidden) Check(more[0].IndexOf(h, StringComparison.OrdinalIgnoreCase) < 0, "CHANGELOG names " + h); + } + + // A new install (no settings.ini) is on Automatic: it loads, saves and reloads Language = auto, follows the Windows + // display language, and the picker opens on Automatic. An old file with no Language line keeps the Spanish it had + // (ExistingUsers in AppTestsI18n, and the one-time offer in AppTestsI18n's offer test). + public static void FreshInstallIsAutomatic() + { + string dir = Path.Combine(Path.GetTempPath(), "stackshot-app-tests", "t30-fresh-" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(dir); + System.Globalization.CultureInfo was = System.Threading.Thread.CurrentThread.CurrentUICulture; + try + { + string none = Path.Combine(dir, "settings.ini"); + Settings fresh = Settings.Load(none); + Same("auto", fresh.Language, "a new install's Language"); + Check(!fresh.LanguageOffered, "a new install has not been offered a language"); + typeof(Settings).GetMethod("Write", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Policy.ForFile(fresh), new object[] { none }); + Check(Regex.IsMatch(File.ReadAllText(none, Encoding.UTF8), @"^Language = auto\r?$", RegexOptions.Multiline), "a new install saves Language = auto"); + Same("auto", Settings.Load(none).Language, "the saved file reads back as Automatic"); + string[][] windows = { new[] { "es-ES", "es" }, new[] { "es-MX", "es" }, new[] { "de-DE", "de" }, new[] { "ko-KR", "ko" }, + new[] { "en-US", "en" }, new[] { "en-GB", "en" }, new[] { "fr-FR", "en" }, new[] { "ja-JP", "en" } }; + foreach (string[] w in windows) + { + System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(w[0]); + I18n.Apply(Settings.Load(none).Language); + Same("auto", I18n.Mode, w[0] + " mode"); + Same(w[1], I18n.Language, "Windows in " + w[0]); + LanguagePicker picker = NewPicker(Settings.Load(none).Language); + try + { + ListBox list = (ListBox)FieldOf(picker, "list"); + Same("auto", (string)((ListBoxItem)list.SelectedItem).Tag, w[0] + ": the picker opens on Automatic"); + Check(AutomationName(list.SelectedItem).Contains(I18n.T("Actual", "Current", "Aktuell")), w[0] + ": Automatic is marked as the current one"); + } + finally { picker.Close(); } + } + } + finally + { + System.Threading.Thread.CurrentThread.CurrentUICulture = was; + I18n.Apply("es"); + try { Directory.Delete(dir, true); } catch (Exception) { } + } + } + + static string AutomationName(object item) { return System.Windows.Automation.AutomationProperties.GetName((DependencyObject)item) ?? ""; } + + static HcColors HighContrastBlack() + { + Func c = v => Color.FromRgb((byte)(v >> 16), (byte)(v >> 8), (byte)v); + HcColors h = new HcColors(); + h.Window = c(0x000000); h.WindowText = c(0xFFFFFF); h.ButtonFace = c(0x000000); h.ButtonText = c(0xFFFFFF); + h.Highlight = c(0x1AEBFF); h.HighlightText = c(0x000000); h.HotTrack = c(0xFFFF00); h.GrayText = c(0x3FF23F); + return h; + } + + // The note pictured: es, en, de, ko in light, Korean in dark and in a contrast theme; with STACKSHOT_UI_SHOTS set the + // sheets are saved as PNG, and the note's colours follow the theme either way. + public static void PickerNotePictures() + { + string dir = Environment.GetEnvironmentVariable("STACKSHOT_UI_SHOTS"); + int saved = (int)typeof(Ds).GetField("mode", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); + string[][] shots = { new[] { "es", "1" }, new[] { "en", "1" }, new[] { "de", "1" }, new[] { "ko", "1" }, new[] { "ko", "2" }, new[] { "en", "3" }, new[] { "ko", "3" } }; + try + { + foreach (string[] s in shots) + { + int theme = int.Parse(s[1]); + HighContrast.Fake = theme == 3 ? HighContrastBlack() : null; + HighContrast.Force = theme == 3 ? 1 : -1; + Ds.Apply(theme == 2 ? 2 : 1); + I18n.Apply(s[0]); + LanguagePicker picker = NewPicker("auto"); + try + { + Palette pal = Ds.Brushes; + Check(pal.High == (theme == 3), "the theme is on"); + TextBlock text = NoteText(picker); + Check(((SolidColorBrush)text.Foreground).Color == pal.Label2, s[0] + "/" + s[1] + ": the note's text is the secondary colour"); + Border note = (Border)FieldOf(picker, "note"); + SolidColorBrush fill = note.Background as SolidColorBrush; + if (pal.High) Check(fill == null || fill.Color.A == 0, "a contrast theme has no tint"); + else Check(fill != null && fill.Color.A > 0 && fill.Color.A < 60, s[0] + "/" + s[1] + ": a soft tint, not a block"); + Check(note.BorderBrush is SolidColorBrush && ((SolidColorBrush)note.BorderBrush).Color.A > 0, "the note has an edge"); + if (!string.IsNullOrEmpty(dir)) + { + Directory.CreateDirectory(dir); + FrameworkElement root = (FrameworkElement)picker.Content; + Size size = LanguagePicker.Preferred(1920, 1080); + LayPicker(picker, size); + DrawingVisual dv = new DrawingVisual(); + using (DrawingContext dc = dv.RenderOpen()) + { + dc.DrawRectangle(Ds.Brush(pal.Window), null, new Rect(size)); + dc.DrawRectangle(new VisualBrush(root), null, new Rect(size)); + } + RenderTargetBitmap rtb = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Pbgra32); + rtb.Render(dv); + SavePng(rtb, "t30-picker-" + s[0] + (theme == 2 ? "-dark" : theme == 3 ? "-contrast" : "-light") + ".png"); + } + } + finally { picker.Close(); } + } + } + finally + { + HighContrast.Force = 0; + HighContrast.Fake = null; + Ds.Apply(saved); + I18n.Apply("es"); + } + } + // ---- Pictures: with STACKSHOT_UI_SHOTS set to a folder, the screens this audit touched are saved there as PNG. static void SavePng(BitmapSource b, string name)