merge: shared kit follow-ups (disabled lists, chart contrast and keyboard, RTL category charts, error toasts, short names)

Resolved: ArchiveView keeps the shared dialog dictionary from the Library branch
and drops its local focus and list styles, now in the kit; the redundant
left-to-right flag on the Move template box goes from ArchiveDialogs.xaml.
Archive.View.Maintenance also leaves the 23 newly translated catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-06 22:22:46 +00:00
commit 9930959883
72 files changed
+686 -262

No files matched your search

-1
View File
@@ -216,7 +216,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>تحقق</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>شجرة الأرشيف</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>بلا تاريخ</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>الصيانة</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>العرض</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>نظرة عامة</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Проверка</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Дърво на архива</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Без дата</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Поддръжка</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Изглед</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Общ преглед</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Ověřit</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Strom archivu</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Bez data</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Údržba</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Zobrazení</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Přehled</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verificer</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arkivtræ</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Uden dato</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Vedligeholdelse</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Visning</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Oversigt</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Prüfen</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archivbaum</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Ohne Datum</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Wartung</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Ansicht</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Übersicht</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Επαλήθευση</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Δέντρο αρχειοθήκης</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Χωρίς ημερομηνία</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Συντήρηση</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Προβολή</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Επισκόπηση</value></data>
</root>
+2 -1
View File
@@ -235,10 +235,11 @@
<data name="Archive.Trash.Restored.one" xml:space="preserve"><value>{0:N0} sequence restored</value><comment>long</comment></data>
<data name="Archive.Trash.Restored.other" xml:space="preserve"><value>{0:N0} sequences restored</value><comment>long</comment></data>
<data name="Archive.Trash.Restoring" xml:space="preserve"><value>Restoring {0}…</value><comment>long</comment></data>
<data name="Archive.Tree.Collapse" xml:space="preserve"><value>Hide year</value></data>
<data name="Archive.Tree.Expand" xml:space="preserve"><value>Show year</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archive tree</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Undated</value></data>
<data name="Archive.View.Health" xml:space="preserve"><value>Health</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Maintenance</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>View</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Overview</value></data>
</root>
+1
View File
@@ -159,6 +159,7 @@
<data name="Editor.Motion.Smoothing" xml:space="preserve"><value>Path smoothing</value></data>
<data name="Editor.Motion.Stabilize" xml:space="preserve"><value>Stabilise</value></data>
<data name="Editor.Optimise.Change" xml:space="preserve"><value>{0}: {1} → {2}</value><comment>invariant</comment></data>
<data name="Editor.Optimise.ChangeRtl" xml:space="preserve"><value>{0}: {1} ← {2}</value><comment>invariant; right-to-left languages: the arrow points from the old value to the new one</comment></data>
<data name="Editor.Optimise.Done.one" xml:space="preserve"><value>{0} setting changed</value></data>
<data name="Editor.Optimise.Done.other" xml:space="preserve"><value>{0} settings changed</value></data>
<data name="Editor.Optimise.Nothing" xml:space="preserve"><value>Nothing to change</value></data>
+2
View File
@@ -12,6 +12,8 @@
<data name="Shell.JobBar.Ready.other" xml:space="preserve"><value>Ready · {0} jobs queued</value><comment>{0} count</comment></data>
<data name="Shell.Nav.About" xml:space="preserve"><value>About</value></data>
<data name="Shell.Nav.Archive" xml:space="preserve"><value>Archive</value></data>
<data name="Shell.Nav.Collapse" xml:space="preserve"><value>Collapse navigation</value></data>
<data name="Shell.Nav.Expand" xml:space="preserve"><value>Expand navigation</value></data>
<data name="Shell.Nav.Import" xml:space="preserve"><value>Import</value></data>
<data name="Shell.Nav.Jobs" xml:space="preserve"><value>Jobs</value></data>
<data name="Shell.Nav.Library" xml:space="preserve"><value>Library</value></data>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verificar</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Árbol de la fototeca</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Sin fecha</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Mantenimiento</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Vista</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Vista general</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Kontrolli</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arhiivipuu</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Kuupäevata</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Hooldus</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Vaade</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Ülevaade</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Tarkista</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arkistopuu</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Päiväämätön</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Ylläpito</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Näkymä</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Yleiskatsaus</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Vérifier</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arborescence de l'archive</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Sans date</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Maintenance</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Affichage</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Vue d'ensemble</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>אמת</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>עץ הארכיון</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>ללא תאריך</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>תחזוקה</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>תצוגה</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>סקירה כללית</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>सत्यापित करें</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>संग्रह ट्री</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>बिना दिनांक</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>रखरखाव</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>दृश्य</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>अवलोकन</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Provjeri</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Stablo arhive</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Bez datuma</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Održavanje</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Prikaz</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Pregled</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Ellenőrzés</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archívumfa</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Dátum nélkül</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Karbantartás</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Nézet</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Áttekintés</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verifikasi</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Pohon arsip</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Tanpa tanggal</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Pemeliharaan</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Tampilan</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Ikhtisar</value></data>
</root>
+2 -1
View File
@@ -228,10 +228,11 @@
<data name="Archive.Trash.Restored.one" xml:space="preserve"><value>{0:N0} sequenza ripristinata</value></data>
<data name="Archive.Trash.Restored.other" xml:space="preserve"><value>{0:N0} sequenze ripristinate</value></data>
<data name="Archive.Trash.Restoring" xml:space="preserve"><value>Ripristino di {0}…</value></data>
<data name="Archive.Tree.Collapse" xml:space="preserve"><value>Nascondi anno</value></data>
<data name="Archive.Tree.Expand" xml:space="preserve"><value>Mostra anno</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Albero dell'archivio</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Senza data</value></data>
<data name="Archive.View.Health" xml:space="preserve"><value>Stato</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Manutenzione</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Vista</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Panoramica</value></data>
</root>
+2
View File
@@ -11,6 +11,8 @@
<data name="Shell.JobBar.Ready.other" xml:space="preserve"><value>Pronto · {0} attività in coda</value></data>
<data name="Shell.Nav.About" xml:space="preserve"><value>Informazioni</value></data>
<data name="Shell.Nav.Archive" xml:space="preserve"><value>Archivio</value></data>
<data name="Shell.Nav.Collapse" xml:space="preserve"><value>Riduci navigazione</value></data>
<data name="Shell.Nav.Expand" xml:space="preserve"><value>Espandi navigazione</value></data>
<data name="Shell.Nav.Import" xml:space="preserve"><value>Importa</value></data>
<data name="Shell.Nav.Jobs" xml:space="preserve"><value>Attività</value></data>
<data name="Shell.Nav.Library" xml:space="preserve"><value>Libreria</value></data>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>検証</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>アーカイブツリー</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>日付なし</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>メンテナンス</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>表示</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>概要</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>검증</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>아카이브 트리</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>날짜 없음</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>유지 관리</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>보기</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>개요</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Patikrinti</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archyvo medis</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Be datos</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Priežiūra</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Rodinys</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Apžvalga</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verificēt</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arhīva koks</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Bez datuma</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Apkope</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Skats</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Pārskats</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Sahkan</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Pepohon arkib</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Tanpa tarikh</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Penyelenggaraan</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Paparan</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Gambaran keseluruhan</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verifiser</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arkivtre</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Udatert</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Vedlikehold</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Visning</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Oversikt</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verifiëren</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archiefstructuur</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Zonder datum</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Onderhoud</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Weergave</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Overzicht</value></data>
</root>
-1
View File
@@ -216,7 +216,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Weryfikuj</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Drzewo archiwum</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Bez daty</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Konserwacja</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Widok</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Przegląd</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verificar</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Árvore do acervo</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Sem data</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Manutenção</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Exibição</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Visão geral</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verificar</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Árvore do arquivo</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Sem data</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Manutenção</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Vista</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Descrição geral</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verificare</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arbore arhivă</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Fără dată</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Întreținere</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Vizualizare</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Prezentare generală</value></data>
</root>
-1
View File
@@ -216,7 +216,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Проверить</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Дерево архива</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Без даты</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Обслуживание</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Вид</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Обзор</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Overiť</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Strom archívu</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Bez dátumu</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Údržba</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Zobrazenie</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Prehľad</value></data>
</root>
-1
View File
@@ -196,7 +196,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Preveri</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Drevo arhiva</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Brez datuma</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Vzdrževanje</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Pogled</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Povzetek</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Verifiera</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arkivträd</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Odaterade</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Underhåll</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Vy</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Översikt</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>ตรวจสอบ</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>แผนผังคลังภาพ</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>ไม่มีวันที่</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>การบำรุงรักษา</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>มุมมอง</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>ภาพรวม</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Doğrula</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Arşiv ağacı</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Tarihsiz</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Bakım</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Görünüm</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Genel bakış</value></data>
</root>
-1
View File
@@ -216,7 +216,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Перевірити</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Дерево архіву</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Без дати</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Обслуговування</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Вигляд</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Огляд</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>Xác minh</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>Cây kho lưu trữ</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Không có ngày</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Bảo trì</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>Chế độ xem</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>Tổng quan</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>校验</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>档案库目录树</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>无日期</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>维护</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>视图</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>概览</value></data>
</root>
-1
View File
@@ -176,7 +176,6 @@
<data name="Archive.Toolbar.Verify" xml:space="preserve"><value>驗證</value></data>
<data name="Archive.Tree.Name" xml:space="preserve"><value>典藏庫樹狀結構</value></data>
<data name="Archive.Tree.Undated" xml:space="preserve"><value>無日期</value></data>
<data name="Archive.View.Maintenance" xml:space="preserve"><value>維護</value></data>
<data name="Archive.View.Name" xml:space="preserve"><value>檢視</value></data>
<data name="Archive.View.Overview" xml:space="preserve"><value>概觀</value></data>
</root>
+1 -1
View File
@@ -106,7 +106,7 @@
</Grid.ColumnDefinitions>
<TextBlock Text="{l:Loc Archive.Rename.Template}" Style="{StaticResource Text.DialogLabel}" />
<!-- A naming template keeps its tokens and separators in order in every language. -->
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}" FlowDirection="LeftToRight"
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}"
Text="{Binding Template.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Template}"
ToolTip="{Binding Template.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Rename.Template}" />
</Grid>
@@ -24,6 +24,9 @@ public sealed class ArchiveTreeRowViewModel(ArchiveTreeNode node, ArchiveAvailab
public string ToggleToolTip => Loc.L(Node.IsExpanded ? "Tooltips.Archive.Collapse" : "Tooltips.Archive.Expand");
/// <summary>The expander's accessible name: two words, the sentence is its tooltip.</summary>
public string ToggleName => Loc.L(Node.IsExpanded ? "Archive.Tree.Collapse" : "Archive.Tree.Expand");
/// <summary>
/// The full title (the tree trims it) and its figures; a year also says how the keyboard opens and closes it, with
/// the arrow keys swapped in a right-to-left layout.
+8
View File
@@ -196,6 +196,14 @@ public static class EditorText
_ => parameter,
};
/// <summary>
/// "Deflicker window: 21 frames → 41 frames", one line of the Optimise toast. Bidi never mirrors an arrow, so a
/// right-to-left language reads it from its own resource, the arrow pointing from the old value to the new one.
/// </summary>
public static string Change(SettingChange change) =>
Loc.L(Loc.IsRightToLeft ? "Editor.Optimise.ChangeRtl" : "Editor.Optimise.Change", ParameterLabel(change.Parameter), Value(change.Parameter, change.Before),
Value(change.Parameter, change.After));
/// <summary>A value of an advisor parameter as its control shows it (the "what changed" toast of Optimise).</summary>
public static string Value(string parameter, object? value) => (parameter, value) switch
{
+3 -3
View File
@@ -819,6 +819,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
Title = Loc.L("Editor.Save.Failed"),
Message = ex.Message,
IsError = true,
ActionText = Loc.L("Editor.Save.Retry"),
ActionToolTip = Loc.L("Tooltips.Editor.Save.Retry"),
ActionCommand = new RelayCommand(() => _ = Session.FlushAsync()),
@@ -893,9 +894,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Shell.Notify(Loc.L("Editor.Optimise.Nothing"));
return;
}
var lines = changes.Select(c => Loc.L("Editor.Optimise.Change", EditorText.ParameterLabel(c.Parameter), EditorText.Value(c.Parameter, c.Before),
EditorText.Value(c.Parameter, c.After)));
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, lines));
Shell.Notify(Loc.Plural("Editor.Optimise.Done", changes.Count), string.Join(Environment.NewLine, changes.Select(EditorText.Change)));
}
private async Task AnalyseAsync()
@@ -957,6 +956,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
Title = Loc.L("Editor.ServerJob.Ended", JobText.Kind(job.Kind), Loc.L("Jobs.State." + job.State), server),
Message = job.Error ?? job.TargetLabel ?? Title,
IsError = job.State == JobState.Failed,
ActionText = Loc.L("Jobs.Action.Retry"),
ActionToolTip = Loc.L("Tooltips.Editor.ServerJob.Retry", server),
ActionCommand = new AsyncRelayCommand(() => Session.Source.RetryJobAsync(job.Id, CancellationToken.None), () => !_disposed),
@@ -177,7 +177,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException)
{
Log.Warning("import", "Card check failed", ex);
_shell.Notify(Loc.L("Import.Toast.CheckFailed"), ex.Message);
_shell.Notify(Loc.L("Import.Toast.CheckFailed"), ex.Message, isError: true);
}
finally
{
@@ -212,7 +212,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
Log.Warning("import", "Deleting imported photos failed", ex);
_shell.Notify(Loc.L("Import.Toast.DeleteFailed"), ex.Message);
_shell.Notify(Loc.L("Import.Toast.DeleteFailed"), ex.Message, isError: true);
}
finally
{
@@ -263,12 +263,12 @@ public sealed class ImportResultViewModel : LocalizedViewModel
if (!unchanged)
{
Actions = _actions with { Erase = null, Card = null };
_shell.Notify(Loc.L("Import.Toast.CardChanged", name), Loc.L("Import.Blocked.NoDryRun"));
_shell.Notify(Loc.L("Import.Toast.CardChanged", name), Loc.L("Import.Blocked.NoDryRun"), isError: true);
return;
}
var outcome = _shell.Services.Devices.Format(device);
if (outcome == FormatOutcome.Formatted) Actions = _actions with { Erase = null, Card = null };
if (outcome != FormatOutcome.Cancelled) _shell.Notify(Loc.L("Import.Toast.Format." + outcome, name));
if (outcome != FormatOutcome.Cancelled) _shell.Notify(Loc.L("Import.Toast.Format." + outcome, name), isError: outcome == FormatOutcome.Failed);
}
/// <summary>The first files that were never imported, one per line.</summary>
@@ -286,7 +286,7 @@ public sealed class ImportResultViewModel : LocalizedViewModel
try
{
var outcome = await Task.Run(() => _shell.Services.Devices.Eject(device));
_shell.Notify(Loc.L("Import.Toast.Eject." + outcome, _card?.Nickname ?? device.Label));
_shell.Notify(Loc.L("Import.Toast.Eject." + outcome, _card?.Nickname ?? device.Label), isError: outcome != EjectOutcome.Ejected);
if (outcome == EjectOutcome.Ejected) SetDevice(null);
}
finally
@@ -56,7 +56,7 @@ public static class ArchiveActions
or Data.DatabaseException)
{
Log.Error("archive", "Archive action failed", ex);
shell.Notify(Core.Localization.Loc.L("Errors.Archive.Open"), ex.Message);
shell.Notify(Core.Localization.Loc.L("Errors.Archive.Open"), ex.Message, isError: true);
return false;
}
}
+2 -44
View File
@@ -13,36 +13,6 @@
<!-- The dialogs (and their styles) are shared with the Library, which runs Delete… too. -->
<ResourceDictionary Source="pack://application:,,,/Titano;component/Archive/ArchiveDialogs.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Keyboard focus drawn inside the row (DESIGN §4 ring): an outer ring would be clipped by the list's scroll viewer. -->
<Style x:Key="Focus.Inset">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="2" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--
Lists keep their panel's fill while the screen behind a dialog is disabled: the system template would paint them
white. Rows and buttons dim themselves.
-->
<Style TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Padding="1" SnapsToDevicePixels="True">
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="Text.PanelHeading" TargetType="TextBlock" BasedOn="{StaticResource Text.Section}">
<Setter Property="FontSize" Value="13" />
<Setter Property="VerticalAlignment" Value="Center" />
@@ -163,7 +133,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button x:Name="Toggle" Style="{StaticResource Button.IconSubtle}" Width="22" Height="22" MinWidth="22" ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronRight}"
Command="{Binding ToggleCommand}" ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleToolTip}" Visibility="Hidden"
Command="{Binding ToggleCommand}" ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleName}" Visibility="Hidden"
Focusable="False" />
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
<TextBlock x:Name="Detail" Grid.Column="2" Text="{Binding Detail}" Style="{StaticResource Text.Secondary}" VerticalAlignment="Center" Margin="8,0,0,0"
@@ -194,13 +164,6 @@
</Border>
<Grid Grid.Column="2">
<!--
Chart labels in TextMuted as in Archive.html: the kit's charts draw them in TextFaint, too faint for 11 px data
labels (reported to the shared controls; remove this alias once they draw in TextMuted).
-->
<Grid.Resources>
<SolidColorBrush x:Key="Brush.TextFaint" Color="{DynamicResource Color.TextMuted}" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="14" />
@@ -260,12 +223,7 @@
</DockPanel>
<v:HeatmapStrip Rows="{Binding MonthRows}" ColumnLabels="{Binding MonthLabels}" ValueFormatter="{Binding CountFormatter}" MaxCellSize="32" ShowScale="False"
ToolTip="{l:Loc Tooltips.Archive.Months}" AutomationProperties.Name="{l:Loc Archive.Chart.Months}"
AutomationProperties.HelpText="{Binding MonthsDescription}">
<!-- Months still to come in the Stroke tone: the kit fills them with Card, the panel's own colour in the light theme. -->
<v:HeatmapStrip.Resources>
<SolidColorBrush x:Key="Brush.Card" Color="{DynamicResource Color.Stroke}" />
</v:HeatmapStrip.Resources>
</v:HeatmapStrip>
AutomationProperties.HelpText="{Binding MonthsDescription}" />
</DockPanel>
</Border>
<Border Grid.Row="2" Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
+2 -1
View File
@@ -935,5 +935,6 @@ public sealed class ArchiveViewModel : SectionViewModel
/// <summary>An action stopped: what stopped, why in one sentence, and Retry to run it again (BRIEF §0.2 rule 6).</summary>
private void NotifyFailure(string titleKey, Exception ex, ICommand retry) =>
Shell.Notify(Loc.L(titleKey), ArchiveFailures.Cause(ex), Loc.L("Archive.Failed.Retry"), Loc.L("Tooltips.Archive.Retry"), () => retry.Execute(null));
Shell.Notify(Loc.L(titleKey), ArchiveFailures.Cause(ex), Loc.L("Archive.Failed.Retry"), Loc.L("Tooltips.Archive.Retry"), () => retry.Execute(null),
isError: true);
}
+1 -1
View File
@@ -864,7 +864,7 @@ public sealed class ImportViewModel : SectionViewModel
}
/// <summary>
/// Archive manager "Adopt folder › Copy into the layout" (BRIEF §12.5): the folder becomes the source and this PC's
/// Archive manager "Adopt folder › Copy into archive…" (BRIEF §12.5): the folder becomes the source and this PC's
/// archive the destination; the plan shows where every photo goes before anything is copied.
/// </summary>
public async Task ImportFolderAsync(string folder)
+1 -1
View File
@@ -197,7 +197,7 @@ public sealed class SequenceViewModel : SectionViewModel
break;
case JobState.Failed:
Shell.Notify(Loc.L("Editor.Proxies.Failed"), job.Error ?? fetch.Title, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"),
() => Shell.Navigate(SectionKey.Jobs));
() => Shell.Navigate(SectionKey.Jobs), isError: true);
break;
}
}
+2 -2
View File
@@ -661,7 +661,7 @@ public sealed class SettingsViewModel : SectionViewModel
Shell.Services.Thumbnails?.Clear();
if (!CacheStore.IsOwned(folder))
{
Shell.Notify(Loc.L("Settings.Storage.NotOwned"));
Shell.Notify(Loc.L("Settings.Storage.NotOwned"), isError: true);
return;
}
var freed = await Task.Run(() => CacheStore.Clear(folder));
@@ -776,7 +776,7 @@ public sealed class SettingsViewModel : SectionViewModel
}
if (imported is null)
{
Shell.Notify(Loc.L("Errors.Settings.Import"));
Shell.Notify(Loc.L("Errors.Settings.Import"), isError: true);
return;
}
// Everything but the session, the window and the first-run flag.
+1 -1
View File
@@ -204,7 +204,7 @@ public sealed class WelcomeViewModel : LocalizedViewModel
case WelcomeChoice.LocalArchive:
if (ArchiveLocations.Validate(LocalRoot) is { } problem)
{
_shell.Notify(problem);
_shell.Notify(problem, isError: true);
return;
}
if (!await ArchiveActions.TryAsync(_shell, s => s.CreateAsync(LocalRoot))) return;
+2 -2
View File
@@ -317,7 +317,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
case SyncAction.DownloadOriginals:
if ((entry.Local?.ArchiveId ?? (await Host.CurrentArchiveAsync())?.Id) is not { } archive)
{
_shell.Notify(Loc.L("Errors.Sync.NoArchive"));
_shell.Notify(Loc.L("Errors.Sync.NoArchive"), isError: true);
return;
}
await service.EnqueueDownloadAsync(engine, server, entry.Id, entry.Title, SyncDownloadMode.Originals, archive);
@@ -372,7 +372,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
catch (SyncConflictChangedException ex)
{
// One side changed after the choice was shown: the row now shows the fresh content.
_shell.Notify(ex.Message);
_shell.Notify(ex.Message, isError: true);
}
}
-1
View File
@@ -212,7 +212,6 @@
<Style x:Key="TextBox.Number" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Width" Value="72" />
<Setter Property="Padding" Value="8,0" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
</Style>
+1 -1
View File
@@ -36,7 +36,7 @@
<DockPanel Margin="8,8,8,8" LastChildFill="False">
<Button DockPanel.Dock="Top" Style="{StaticResource Button.IconSubtle}" HorizontalAlignment="Left" Margin="0,0,0,6"
ui:ButtonIcon.Glyph="{StaticResource Icon.Menu}" Command="{Binding ToggleRailCommand}"
ToolTip="{Binding RailToggleToolTip}" AutomationProperties.Name="{Binding RailToggleToolTip}" />
ToolTip="{Binding RailToggleToolTip}" AutomationProperties.Name="{Binding RailToggleName}" />
<ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding TopSections}" Focusable="False">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
+10 -2
View File
@@ -121,11 +121,15 @@ public sealed class ShellViewModel : LocalizedViewModel
if (!Set(ref _isRailCollapsed, value)) return;
_settings.RailCollapsed = value;
OnPropertyChanged(nameof(RailToggleToolTip));
OnPropertyChanged(nameof(RailToggleName));
}
}
public string RailToggleToolTip => Loc.L(IsRailCollapsed ? "Tooltips.Shell.ExpandRail" : "Tooltips.Shell.CollapseRail");
/// <summary>The rail button's accessible name: two words, the sentence is its tooltip.</summary>
public string RailToggleName => Loc.L(IsRailCollapsed ? "Shell.Nav.Expand" : "Shell.Nav.Collapse");
/// <summary>The sequence the editor opens (set by the Library and the Jobs screen).</summary>
public Guid? CurrentSequenceId
{
@@ -257,8 +261,11 @@ public sealed class ShellViewModel : LocalizedViewModel
if (e.PropertyName is nameof(SectionViewModel.Title) or "" or null) OnPropertyChanged(nameof(WindowTitle));
}
/// <summary>A one-line notice with one action (job done, update available).</summary>
public void Notify(string title, string? message = null, string? actionText = null, string? actionToolTip = null, Action? action = null) =>
/// <summary>
/// A one-line notice with one action (job done, update available). <paramref name="isError"/> marks something that
/// did not happen or failed: screen readers then say it at once instead of after what they are reading.
/// </summary>
public void Notify(string title, string? message = null, string? actionText = null, string? actionToolTip = null, Action? action = null, bool isError = false) =>
ShowToast(new Toast
{
Title = title,
@@ -266,6 +273,7 @@ public sealed class ShellViewModel : LocalizedViewModel
ActionText = actionText,
ActionToolTip = actionToolTip,
ActionCommand = action is null ? null : new RelayCommand(action),
IsError = isError,
});
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6); the details go to the log.</summary>
+29 -2
View File
@@ -750,7 +750,30 @@
</Style>
<!-- ===================== Lists and tables ===================== -->
<Style TargetType="ListBox">
<!--
The system template paints a disabled list white whatever the theme (a list behind a dialog is disabled): this one
keeps the list's own fill, and its rows and buttons dim themselves. Same frame and scroll viewer as the system's.
-->
<ControlTemplate x:Key="Template.ListBox" TargetType="ListBox">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Padding="1" SnapsToDevicePixels="True">
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="True" />
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- Shared by ListBox and ListView; a ListView keeps the system template, which carries the GridView header row. -->
<Style x:Key="ListBox.Base" TargetType="ListBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
@@ -761,6 +784,10 @@
<Setter Property="VirtualizingPanel.ScrollUnit" Value="Pixel" />
</Style>
<Style TargetType="ListBox" BasedOn="{StaticResource ListBox.Base}">
<Setter Property="Template" Value="{StaticResource Template.ListBox}" />
</Style>
<Style TargetType="ListBoxItem">
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
@@ -820,7 +847,7 @@
</Setter>
</Style>
<Style TargetType="ListView" BasedOn="{StaticResource {x:Type ListBox}}">
<Style TargetType="ListView" BasedOn="{StaticResource ListBox.Base}">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
</Style>
+16 -1
View File
@@ -29,8 +29,10 @@
</Setter>
</Style>
<!-- Virtualized, recycling card grid (BRIEF §12.2). Item template: a v:SequenceCard bound to the item. -->
<!-- Virtualized, recycling card grid (BRIEF §12.2). Item template: a v:SequenceCard bound to the item. Disabled (behind a
dialog), it keeps its fill like every other list (Controls.xaml Template.ListBox). -->
<Style x:Key="ListBox.Cards" TargetType="ListBox">
<Setter Property="Template" Value="{DynamicResource Template.ListBox}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="0" />
@@ -154,6 +156,19 @@
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
</Style>
<!-- Charts that something activates take the keyboard and outline the bar, segment or cell it is on themselves. -->
<Style TargetType="v:BarChart">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
<Style TargetType="v:StackedBar">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
<Style TargetType="v:HeatmapStrip">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
<!-- ===================== Preview viewport (BRIEF §12.3) ===================== -->
<!-- The image surface (a drawn visual, always left to right) and the numeric shot data stay left to right; the tool
row follows the layout direction. -->
+3
View File
@@ -7,4 +7,7 @@
<ItemGroup>
<ProjectReference Include="..\Titano.Core\Titano.Core.csproj" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Titano.App.Tests" />
</ItemGroup>
</Project>
+67 -62
View File
@@ -8,10 +8,11 @@ namespace Titano.Ui.Visuals;
/// <summary>
/// Bars for labelled values (Archive: storage by year, by camera, by format; uploads per day). Horizontal bars put
/// the category labels on the left and the value labels after each bar, as in the Archive mockup; vertical bars
/// put the categories underneath (skipping labels that would collide). Optional value gridlines use nice ticks.
/// A bar's opacity can follow its value (<see cref="MinimumOpacity"/>). Hovering reads out the bar; clicking raises
/// <see cref="ItemActivatedEvent"/>.
/// the category labels on the reading side and the value labels after each bar, as in the Archive mockup, and
/// mirror in a right-to-left language; vertical bars put the categories underneath (skipping labels that would
/// collide) and keep them left to right. Optional value gridlines use nice ticks. A bar's opacity can follow its
/// value (<see cref="MinimumOpacity"/>). Hovering reads out the bar; clicking raises <see cref="ItemActivatedEvent"/>,
/// and a handler attached to the chart also gives it the hand cursor and the keyboard.
/// </summary>
public sealed class BarChart : DrawingElement
{
@@ -52,7 +53,6 @@ public sealed class BarChart : DrawingElement
private Rect _area;
private double _pitch;
private int _hover = -1;
/// <summary>Bars in display order.</summary>
public IReadOnlyList<ChartItem>? Items { get => (IReadOnlyList<ChartItem>?)GetValue(ItemsProperty); set => SetValue(ItemsProperty, value); }
@@ -79,27 +79,32 @@ public sealed class BarChart : DrawingElement
/// <summary>Culture-aware value formatting for value labels, ticks and readouts.</summary>
public Func<double, string>? ValueFormatter { get => (Func<double, string>?)GetValue(ValueFormatterProperty); set => SetValue(ValueFormatterProperty, value); }
/// <summary>Raised when a bar is clicked, or chosen with the keyboard and Enter; attach it to the chart itself to make the bars interactive.</summary>
public event ChartItemEventHandler ItemActivated
{
add => AddHandler(ItemActivatedEvent, value);
remove => RemoveHandler(ItemActivatedEvent, value);
add
{
AddHandler(ItemActivatedEvent, value);
TrackActivation(value, added: true);
}
remove
{
RemoveHandler(ItemActivatedEvent, value);
TrackActivation(value, added: false);
}
}
protected internal override string? AutomationDescription =>
Items is { Count: > 0 } items ? string.Join(Environment.NewLine, items.Select(ReadoutText)) : null;
protected override int ItemCount => Items?.Count ?? 0;
protected override Size MeasureOverride(Size availableSize)
{
var count = Items?.Count ?? 0;
return Orientation == Orientation.Horizontal ? new Size(0, count * (BarThickness + RowGap)) : new Size(0, 120);
}
protected override void OnDataChanged()
{
_hover = -1;
base.OnDataChanged();
}
protected override void OnRender(DrawingContext dc)
{
DrawHitArea(dc);
@@ -108,39 +113,40 @@ public sealed class BarChart : DrawingElement
var max = ScaleMaximum(items);
if (Orientation == Orientation.Horizontal) RenderHorizontal(dc, items, max);
else RenderVertical(dc, items, max);
DrawKeyboardItem(dc);
}
protected override void OnMouseMove(MouseEventArgs e)
protected override int ItemAt(Point point)
{
base.OnMouseMove(e);
var p = e.GetPosition(this);
_hover = HitTest(p);
Readout.Show(_hover >= 0 && Items is { } items ? ReadoutText(items[_hover]) : null, p);
var count = ItemCount;
if (count == 0 || _area.IsEmpty || !(_pitch > 0)) return -1;
var index = Orientation == Orientation.Horizontal
? (int)Math.Floor((point.Y - _area.Top) / _pitch)
: (int)Math.Floor((point.X - _area.Left) / _pitch);
var inside = Orientation == Orientation.Horizontal ? point.X >= 0 && point.X <= ActualWidth : point.Y >= 0 && point.Y <= ActualHeight;
return inside && index >= 0 && index < count ? index : -1;
}
protected override void OnQueryCursor(QueryCursorEventArgs e)
/// <summary>A horizontal bar's whole row (label, bar and value), a vertical bar's whole column.</summary>
protected override Rect ItemBounds(int item)
{
base.OnQueryCursor(e);
if (e.Handled || _hover < 0) return;
e.Cursor = Cursors.Hand;
e.Handled = true;
if (_area.IsEmpty || !(_pitch > 0)) return Rect.Empty;
return Orientation == Orientation.Horizontal
? new Rect(1, _area.Top + _pitch * item + 1, Math.Max(0, ActualWidth - 2), Math.Max(0, _pitch - 2))
: new Rect(_area.Left + _pitch * item + 1, 1, Math.Max(0, _pitch - 2), Math.Max(0, ActualHeight - 2));
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
_hover = -1;
Readout.Hide();
}
protected override string? ItemText(int item) => Items is { } items && item < items.Count ? ReadoutText(items[item]) : null;
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
/// <summary>Up/Down move along horizontal bars, Left/Right along vertical ones (left to right in every language).</summary>
protected override int Navigate(int item, Key key) => (Orientation, key) switch
{
base.OnMouseLeftButtonUp(e);
var index = HitTest(e.GetPosition(this));
if (index < 0) return;
RaiseEvent(new ChartItemEventArgs(ItemActivatedEvent, index, -1));
e.Handled = true;
}
(Orientation.Horizontal, Key.Up) or (Orientation.Vertical, Key.Left) => Math.Max(0, item - 1),
(Orientation.Horizontal, Key.Down) or (Orientation.Vertical, Key.Right) => item + 1,
_ => -1,
};
protected override void Activate(int item) => RaiseEvent(new ChartItemEventArgs(ItemActivatedEvent, item, -1));
private string Format(double value) => (ValueFormatter ?? DefaultFormat)(value);
@@ -160,24 +166,29 @@ public sealed class BarChart : DrawingElement
private double OpacityOf(double value, double max) =>
MinimumOpacity >= 1 ? 1 : MinimumOpacity + (1 - MinimumOpacity) * Math.Clamp(value / max, 0, 1);
/// <summary>
/// Laid out from the left and mirrored in a right-to-left language (<see cref="DrawingElement.FromStart"/>): labels on
/// the reading side, bars growing away from it, each value after its bar's end.
/// </summary>
private void RenderHorizontal(DrawingContext dc, IReadOnlyList<ChartItem> items, double max)
{
var faint = GetBrush("Brush.TextFaint");
var muted = GetBrush("Brush.TextMuted");
var text = GetBrush("Brush.Text");
var labels = new FormattedText[items.Count];
var values = new FormattedText?[items.Count];
double labelWidth = 0, valueWidth = 0;
for (var i = 0; i < items.Count; i++)
{
labels[i] = CreateLabel(items[i].Label, LabelSize, faint);
labels[i] = CreateLabel(items[i].Label, LabelSize, muted);
labelWidth = Math.Max(labelWidth, labels[i].Width);
if (!ShowValues) continue;
values[i] = CreateLabel(items[i].ValueText ?? Format(items[i].Value), LabelSize, text);
valueWidth = Math.Max(valueWidth, values[i]!.Width);
}
var width = ActualWidth;
var gridHeight = ShowGrid ? 16 : 0;
var left = Math.Ceiling(labelWidth) + 8;
var right = ActualWidth - (ShowValues ? valueWidth + 6 : 0);
var right = width - (ShowValues ? valueWidth + 6 : 0);
_area = new Rect(left, 0, Math.Max(0, right - left), Math.Max(0, ActualHeight - gridHeight));
_pitch = Math.Min(_area.Height / items.Count, BarThickness + RowGap);
var thickness = Math.Max(1, Math.Min(BarThickness, _pitch - 2));
@@ -187,28 +198,29 @@ public sealed class BarChart : DrawingElement
{
var item = items[i];
var cy = _area.Top + _pitch * (i + 0.5);
DrawTextAt(dc, labels[i], new Point(left - 8 - labels[i].Width, cy - labels[i].Height / 2));
DrawTextAt(dc, labels[i], new Point(FromStart(left - 8 - labels[i].Width, labels[i].Width, width), cy - labels[i].Height / 2));
var length = _area.Width * Math.Clamp(item.Value / max, 0, 1);
if (length > 0)
{
dc.PushOpacity(OpacityOf(item.Value, max));
dc.DrawRoundedRectangle(GetBrush(item.BrushKey ?? BrushKey), null, new Rect(left, cy - thickness / 2, length, thickness), 2, 2);
dc.DrawRoundedRectangle(GetBrush(item.BrushKey ?? BrushKey), null, new Rect(FromStart(left, length, width), cy - thickness / 2, length, thickness), 2, 2);
dc.Pop();
}
if (values[i] is { } value) DrawTextAt(dc, value, new Point(left + length + 6, cy - value.Height / 2));
if (values[i] is { } value) DrawTextAt(dc, value, new Point(FromStart(left + length + 6, value.Width, width), cy - value.Height / 2));
}
}
/// <summary>Categories run left to right in every language: vertical bars often stand for days or years.</summary>
private void RenderVertical(DrawingContext dc, IReadOnlyList<ChartItem> items, double max)
{
var faint = GetBrush("Brush.TextFaint");
var sample = CreateText("0", LabelSize, faint);
var muted = GetBrush("Brush.TextMuted");
var sample = CreateText("0", LabelSize, muted);
var labelHeight = Math.Ceiling(sample.Height) + 4;
var valueHeight = ShowValues ? labelHeight : 0;
var axisWidth = 0.0;
if (ShowGrid)
{
var top = CreateText(Format(max), LabelSize, faint);
var top = CreateText(Format(max), LabelSize, muted);
axisWidth = Math.Ceiling(top.Width) + 8;
}
_area = new Rect(axisWidth, valueHeight, Math.Max(0, ActualWidth - axisWidth), Math.Max(0, ActualHeight - labelHeight - valueHeight));
@@ -234,7 +246,7 @@ public sealed class BarChart : DrawingElement
var value = CreateLabel(item.ValueText ?? Format(item.Value), LabelSize, text);
if (value.Width <= _pitch) DrawTextAt(dc, value, new Point(cx - value.Width / 2, _area.Bottom - height - value.Height - 2));
}
var label = CreateLabel(item.Label, LabelSize, faint);
var label = CreateLabel(item.Label, LabelSize, muted);
var x = cx - label.Width / 2;
if (x < lastLabelRight + 6) continue;
DrawTextAt(dc, label, new Point(x, _area.Bottom + 4));
@@ -242,21 +254,25 @@ public sealed class BarChart : DrawingElement
}
}
/// <summary>Gridlines at nice ticks along the value axis, with labels below (horizontal bars) or left (vertical bars).</summary>
/// <summary>
/// Gridlines at nice ticks along the value axis, with labels below (horizontal bars, mirrored with them) or left
/// (vertical bars).
/// </summary>
private void DrawValueGrid(DrawingContext dc, double max, bool horizontal)
{
var ticks = NiceScale.Inner(0, max, horizontal ? Math.Max(2, (int)(_area.Width / 80)) : Math.Max(2, (int)(_area.Height / 36)));
var pen = GetHairline("Brush.Stroke");
var faint = GetBrush("Brush.TextFaint");
var muted = GetBrush("Brush.TextMuted");
var scale = PixelScale;
var width = ActualWidth;
for (var i = 0; i < ticks.Count; i++)
{
var label = CreateText(Format(ticks[i]), LabelSize, faint);
var label = CreateText(Format(ticks[i]), LabelSize, muted);
if (horizontal)
{
var x = PixelGrid.SnapLine(_area.Left + _area.Width * ticks[i] / max, pen.Thickness, scale);
var x = PixelGrid.SnapLine(FromStart(_area.Left + _area.Width * ticks[i] / max, 0, width), pen.Thickness, scale);
dc.DrawLine(pen, new Point(x, _area.Top), new Point(x, _area.Bottom));
dc.DrawText(label, new Point(Math.Min(x - label.Width / 2, ActualWidth - label.Width), _area.Bottom + 2));
dc.DrawText(label, new Point(Math.Clamp(x - label.Width / 2, 0, Math.Max(0, width - label.Width)), _area.Bottom + 2));
}
else
{
@@ -266,15 +282,4 @@ public sealed class BarChart : DrawingElement
}
}
}
private int HitTest(Point p)
{
var count = Items?.Count ?? 0;
if (count == 0 || _area.IsEmpty || !(_pitch > 0)) return -1;
var index = Orientation == Orientation.Horizontal
? (int)Math.Floor((p.Y - _area.Top) / _pitch)
: (int)Math.Floor((p.X - _area.Left) / _pitch);
var inside = Orientation == Orientation.Horizontal ? p.X >= 0 && p.X <= ActualWidth : p.Y >= 0 && p.Y <= ActualHeight;
return inside && index >= 0 && index < count ? index : -1;
}
}
+152 -3
View File
@@ -1,7 +1,9 @@
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Titano.Core.Localization;
using Titano.Ui.Controls;
@@ -12,9 +14,17 @@ namespace Titano.Ui.Visuals;
/// Base of the retained-mode visuals. Brushes are looked up by theme resource key and re-resolved when the token
/// dictionary is swapped (frozen pens are cached per theme); text is laid out with the UI font at the element's
/// DPI; an optional overlay layer (playhead, hover) is redrawn without re-rendering the static content drawn in
/// <see cref="UIElement.OnRender"/>. Time axes and images never mirror, so the element is always left-to-right;
/// words (categories, legends, summaries) still read in the UI language's direction (<see cref="CreateLabel"/>) and
/// legends start on its side. Screen readers see a named image (<see cref="DrawingElementAutomationPeer"/>).
/// <see cref="UIElement.OnRender"/>. The element itself is always left-to-right, so time axes and images never
/// mirror; words (categories, legends, summaries) still read in the UI language's direction
/// (<see cref="CreateLabel"/>), legends start on its side, and a category chart places its bars from that side
/// (<see cref="FromStart"/>). Screen readers see a named image (<see cref="DrawingElementAutomationPeer"/>).
/// <para>
/// A chart of discrete items (bars, segments, cells) describes them through <see cref="ItemCount"/>,
/// <see cref="ItemAt"/>, <see cref="ItemBounds"/> and <see cref="ItemText"/>: hovering one reads it out and clicking
/// it calls <see cref="Activate"/>. Only while a handler of its activation event is attached to the chart
/// (<see cref="TrackActivation"/>) does an item show the hand cursor and the chart take the keyboard: the arrows
/// choose an item (<see cref="Navigate"/>), Enter or Space activates it.
/// </para>
/// </summary>
public abstract class DrawingElement : FrameworkElement
{
@@ -28,6 +38,8 @@ public abstract class DrawingElement : FrameworkElement
private HoverReadout? _readout;
private Typeface? _regular;
private Typeface? _semiBold;
private Delegate? _activationHandlers;
private int _keyboardItem = -1;
/// <param name="hasOverlay">Creates the overlay layer drawn by <see cref="OnRenderOverlay"/>.</param>
protected DrawingElement(bool hasOverlay = false)
@@ -101,6 +113,51 @@ public abstract class DrawingElement : FrameworkElement
/// </summary>
protected internal virtual string? AutomationDescription => null;
/// <summary>The item the keyboard is on, read to screen readers as the image's status; null when none.</summary>
internal string? KeyboardItemText => IsActivatable && _keyboardItem >= 0 && _keyboardItem < ItemCount ? ItemText(_keyboardItem) : null;
/// <summary>Whether a handler of the visual's activation event is attached to the visual itself (not to an ancestor).</summary>
protected bool IsActivatable => _activationHandlers is not null;
/// <summary>Number of discrete items (bars, segments, cells); 0 for visuals without items.</summary>
protected virtual int ItemCount => 0;
/// <summary>Item under <paramref name="point"/>, or −1.</summary>
protected virtual int ItemAt(Point point) => -1;
/// <summary>Where <paramref name="item"/> was last drawn: the keyboard outline follows this rectangle.</summary>
protected virtual Rect ItemBounds(int item) => Rect.Empty;
/// <summary>What the readout says for <paramref name="item"/>.</summary>
protected virtual string? ItemText(int item) => null;
/// <summary>The item an arrow key moves to from <paramref name="item"/>; −1 when the key does not move.</summary>
protected virtual int Navigate(int item, Key key) => -1;
/// <summary>Raises the visual's activation event for <paramref name="item"/>.</summary>
protected virtual void Activate(int item)
{
}
/// <summary>Records a handler added to or removed from the activation event; call from the event's accessors.</summary>
protected void TrackActivation(Delegate handler, bool added)
{
_activationHandlers = added ? Delegate.Combine(_activationHandlers, handler) : Delegate.Remove(_activationHandlers, handler);
SetCurrentValue(FocusableProperty, IsActivatable);
InvalidateVisual();
}
/// <summary>The cursor the visual shows at <paramref name="point"/>: the hand over an item something activates, otherwise none of its own.</summary>
internal Cursor? CursorAt(Point point) => IsActivatable && ItemAt(point) >= 0 ? Cursors.Hand : null;
/// <summary>Outlines the keyboard's item while the visual has keyboard focus (DESIGN §4: 2 px Accent); call last in OnRender.</summary>
protected void DrawKeyboardItem(DrawingContext dc)
{
if (!IsKeyboardFocused || !IsActivatable || _keyboardItem < 0 || _keyboardItem >= ItemCount) return;
var bounds = ItemBounds(_keyboardItem);
if (!bounds.IsEmpty) dc.DrawRoundedRectangle(null, GetPen("Brush.Accent", 2), bounds, 4, 4);
}
/// <summary>Single-line left-to-right text in the UI font (numbers, ticks, times), laid out for this element's DPI and text formatting mode.</summary>
protected FormattedText CreateText(string text, double emSize, Brush brush, bool semiBold = false) =>
Format(text, emSize, brush, semiBold, FlowDirection.LeftToRight);
@@ -142,6 +199,7 @@ public abstract class DrawingElement : FrameworkElement
/// <summary>Called when a data property or a watched collection changed; the default re-measures and redraws.</summary>
protected virtual void OnDataChanged()
{
_keyboardItem = Math.Min(_keyboardItem, ItemCount - 1);
InvalidateMeasure();
InvalidateVisual();
}
@@ -163,6 +221,90 @@ public abstract class DrawingElement : FrameworkElement
OnThemeChanged();
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (ItemCount == 0) return;
var p = e.GetPosition(this);
var item = ItemAt(p);
Readout.Show(item >= 0 ? ItemText(item) : null, p);
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (ItemCount > 0) Readout.Hide();
}
protected override void OnQueryCursor(QueryCursorEventArgs e)
{
base.OnQueryCursor(e);
if (e.Handled || CursorAt(e.GetPosition(this)) is not { } cursor) return;
e.Cursor = cursor;
e.Handled = true;
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
if (e.Handled || ItemCount == 0) return;
var item = ItemAt(e.GetPosition(this));
if (item < 0) return;
_keyboardItem = item;
Activate(item);
e.Handled = true;
}
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
var count = ItemCount;
if (e.Handled || !IsActivatable || count == 0) return;
var current = Math.Clamp(_keyboardItem, 0, count - 1);
if (e.Key is Key.Enter or Key.Space)
{
MoveKeyboardTo(current);
Activate(current);
e.Handled = true;
return;
}
var next = e.Key switch
{
Key.Home => 0,
Key.End => count - 1,
_ => Navigate(current, e.Key),
};
if (next < 0) return;
MoveKeyboardTo(Math.Min(next, count - 1));
e.Handled = true;
}
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
{
base.OnGotKeyboardFocus(e);
if (IsActivatable && ItemCount > 0 && ReferenceEquals(e.NewFocus, this)) MoveKeyboardTo(Math.Clamp(_keyboardItem, 0, ItemCount - 1));
}
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
{
base.OnLostKeyboardFocus(e);
if (!IsActivatable) return;
Readout.Hide();
InvalidateVisual();
}
/// <summary>Puts the keyboard on <paramref name="item"/>: outlined, read out next to it and announced as the image's status.</summary>
private void MoveKeyboardTo(int item)
{
var before = KeyboardItemText;
_keyboardItem = item;
InvalidateVisual();
var bounds = ItemBounds(item);
if (!bounds.IsEmpty) Readout.Show(ItemText(item), bounds.BottomLeft);
UIElementAutomationPeer.FromElement(this)?.RaisePropertyChangedEvent(AutomationElementIdentifiers.ItemStatusProperty, before ?? string.Empty,
KeyboardItemText ?? string.Empty);
}
/// <summary>Fills the whole element with a transparent brush so empty areas still receive the mouse.</summary>
protected void DrawHitArea(DrawingContext dc) => dc.DrawRectangle(Brushes.Transparent, null, new Rect(RenderSize));
@@ -281,4 +423,11 @@ public class DrawingElementAutomationPeer(DrawingElement owner) : FrameworkEleme
var name = base.GetNameCore();
return string.IsNullOrEmpty(name) ? ((DrawingElement)Owner).AutomationDescription ?? string.Empty : name;
}
/// <summary>The item the keyboard is on, unless AutomationProperties.ItemStatus says otherwise.</summary>
protected override string GetItemStatusCore()
{
var status = base.GetItemStatusCore();
return string.IsNullOrEmpty(status) ? ((DrawingElement)Owner).KeyboardItemText ?? string.Empty : status;
}
}
+48 -35
View File
@@ -7,9 +7,11 @@ namespace Titano.Ui.Visuals;
/// <summary>
/// Density grid (Archive: photos per month, one row per year × 12 months). Each value is a square cell in the
/// brush colour whose opacity grows with the value; NaN cells ("no data", e.g. future months) use the card fill.
/// Column labels sit above, row labels on the left, an optional min–max scale below. Hovering reads out the cell
/// (its tooltip or "row column · value"); clicking raises <see cref="CellActivatedEvent"/>.
/// brush colour whose opacity grows with the value; NaN cells ("no data", e.g. future months) take the stroke tone,
/// which differs from the card and panel fills in both themes. Column labels sit above, row labels on the left, an
/// optional min–max scale below; months run left to right in every language. Hovering reads out the cell (its
/// tooltip or "row column · value"); clicking raises <see cref="CellActivatedEvent"/>, and a handler attached to the
/// grid also gives it the hand cursor and the keyboard.
/// </summary>
public sealed class HeatmapStrip : DrawingElement
{
@@ -49,7 +51,6 @@ public sealed class HeatmapStrip : DrawingElement
private const double LabelSize = 11;
private CellGridLayout _grid;
private bool _hovering;
/// <summary>One row per year (label + 12 monthly values).</summary>
public IReadOnlyList<ChartRow>? Rows { get => (IReadOnlyList<ChartRow>?)GetValue(RowsProperty); set => SetValue(RowsProperty, value); }
@@ -75,10 +76,19 @@ public sealed class HeatmapStrip : DrawingElement
/// <summary>Culture-aware value formatting (scale ends and readouts).</summary>
public Func<double, string>? ValueFormatter { get => (Func<double, string>?)GetValue(ValueFormatterProperty); set => SetValue(ValueFormatterProperty, value); }
/// <summary>Raised when a cell is clicked, or chosen with the keyboard and Enter; attach it to the grid itself to make the cells interactive.</summary>
public event ChartItemEventHandler CellActivated
{
add => AddHandler(CellActivatedEvent, value);
remove => RemoveHandler(CellActivatedEvent, value);
add
{
AddHandler(CellActivatedEvent, value);
TrackActivation(value, added: true);
}
remove
{
RemoveHandler(CellActivatedEvent, value);
TrackActivation(value, added: false);
}
}
private int RowCount => Rows?.Count ?? 0;
@@ -95,6 +105,9 @@ public sealed class HeatmapStrip : DrawingElement
}
}
/// <summary>Cells in reading order: row by row, <see cref="ColumnCount"/> per row.</summary>
protected override int ItemCount => RowCount * ColumnCount;
protected override Size MeasureOverride(Size availableSize)
{
if (RowCount == 0 || ColumnCount == 0) return new Size(0, 0);
@@ -107,26 +120,26 @@ public sealed class HeatmapStrip : DrawingElement
DrawHitArea(dc);
if (Rows is not { Count: > 0 } rows || ColumnCount == 0) return;
_grid = Layout(ActualWidth, ActualHeight - ScaleHeight());
var faint = GetBrush("Brush.TextFaint");
var muted = GetBrush("Brush.TextMuted");
var max = ScaleMaximum(rows);
if (ColumnLabels is { } columns)
{
for (var c = 0; c < columns.Count; c++)
{
var label = CreateLabel(columns[c], LabelSize, faint);
var label = CreateLabel(columns[c], LabelSize, muted);
var (x, _) = _grid.CellOrigin(0, c);
DrawTextAt(dc, label, new Point(x + (_grid.CellSize - label.Width) / 2, 0));
}
}
var fill = GetBrush(BrushKey);
var empty = GetBrush("Brush.Card");
var empty = GetBrush("Brush.Stroke");
var radius = Math.Min(2, _grid.CellSize / 4);
for (var r = 0; r < rows.Count; r++)
{
var row = rows[r];
var label = CreateLabel(row.Label, LabelSize, faint);
var label = CreateLabel(row.Label, LabelSize, muted);
var (_, y) = _grid.CellOrigin(r, 0);
DrawTextAt(dc, label, new Point(_grid.Left - 8 - label.Width, y + (_grid.CellSize - label.Height) / 2));
for (var c = 0; c < _grid.Columns; c++)
@@ -145,39 +158,39 @@ public sealed class HeatmapStrip : DrawingElement
}
}
if (ShowScale) DrawScale(dc, fill, max);
DrawKeyboardItem(dc);
}
protected override void OnMouseMove(MouseEventArgs e)
protected override int ItemAt(Point point) =>
_grid.TryHit(point.X, point.Y, out var row, out var column) && row < RowCount && column < ColumnCount ? row * ColumnCount + column : -1;
protected override Rect ItemBounds(int item)
{
base.OnMouseMove(e);
var p = e.GetPosition(this);
_hovering = _grid.TryHit(p.X, p.Y, out var row, out var column) && row < RowCount;
Readout.Show(_hovering ? ReadoutText(row, column) : null, p);
if (_grid.CellSize <= 0 || ColumnCount == 0) return Rect.Empty;
var (x, y) = _grid.CellOrigin(item / ColumnCount, item % ColumnCount);
var cell = new Rect(x, y, _grid.CellSize, _grid.CellSize);
cell.Inflate(2, 2);
return cell;
}
protected override void OnMouseLeave(MouseEventArgs e)
protected override string? ItemText(int item) => ColumnCount == 0 ? null : ReadoutText(item / ColumnCount, item % ColumnCount);
/// <summary>Left/Right move along a year (months left to right in every language), Up/Down between years.</summary>
protected override int Navigate(int item, Key key)
{
base.OnMouseLeave(e);
_hovering = false;
Readout.Hide();
var columns = ColumnCount;
var (row, column) = (item / columns, item % columns);
return key switch
{
Key.Left => row * columns + Math.Max(0, column - 1),
Key.Right => row * columns + Math.Min(columns - 1, column + 1),
Key.Up => Math.Max(0, row - 1) * columns + column,
Key.Down => Math.Min(RowCount - 1, row + 1) * columns + column,
_ => -1,
};
}
protected override void OnQueryCursor(QueryCursorEventArgs e)
{
base.OnQueryCursor(e);
if (e.Handled || !_hovering) return;
e.Cursor = Cursors.Hand;
e.Handled = true;
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
var p = e.GetPosition(this);
if (!_grid.TryHit(p.X, p.Y, out var row, out var column) || row >= RowCount) return;
RaiseEvent(new ChartItemEventArgs(CellActivatedEvent, row, column));
e.Handled = true;
}
protected override void Activate(int item) => RaiseEvent(new ChartItemEventArgs(CellActivatedEvent, item / ColumnCount, item % ColumnCount));
private string Format(double value) => (ValueFormatter ?? DefaultFormat)(value);
+2 -2
View File
@@ -158,7 +158,7 @@ public sealed class SeriesChart : DrawingElement
var labelWidth = 0.0;
if (ShowYLabels)
{
var labelBrush = GetBrush("Brush.TextFaint");
var labelBrush = GetBrush("Brush.TextMuted");
for (var i = 0; i < ticks.Count; i++)
{
labels[i] = CreateText(format(ticks[i]), LabelSize, labelBrush);
@@ -328,7 +328,7 @@ public sealed class SeriesChart : DrawingElement
{
if (_count < 2) return;
var ticks = NiceScale.Inner(0, _count - 1, Math.Max(2, (int)(_plot.Width / 90)));
var brush = GetBrush("Brush.TextFaint");
var brush = GetBrush("Brush.TextMuted");
var lastRight = double.NegativeInfinity;
for (var i = 0; i < ticks.Count; i++)
{
+41 -45
View File
@@ -8,8 +8,9 @@ namespace Titano.Ui.Visuals;
/// <summary>
/// One bar split into proportional segments (by camera, by format) with a wrapping legend underneath
/// ("■ label share"). Segments share one theme colour and fade by rank (items may set their own brush), so no new
/// colours are introduced; 2-px gaps separate them. Hovering a segment or legend entry reads it out; clicking
/// raises <see cref="ItemActivatedEvent"/>.
/// colours are introduced; 2-px gaps separate them. The first segment and the legend start on the reading side, so
/// both mirror in a right-to-left language. Hovering a segment or legend entry reads it out; clicking raises
/// <see cref="ItemActivatedEvent"/>, and a handler attached to the bar also gives it the hand cursor and the keyboard.
/// </summary>
public sealed class StackedBar : DrawingElement
{
@@ -42,7 +43,6 @@ public sealed class StackedBar : DrawingElement
private readonly List<Rect> _segments = [];
private readonly List<Rect> _entries = [];
private int _hover = -1;
/// <summary>Parts in display order (largest first reads best).</summary>
public IReadOnlyList<ChartItem>? Items { get => (IReadOnlyList<ChartItem>?)GetValue(ItemsProperty); set => SetValue(ItemsProperty, value); }
@@ -56,15 +56,26 @@ public sealed class StackedBar : DrawingElement
/// <summary>Formats a share 0…1 for the legend (default: culture percent without decimals).</summary>
public Func<double, string>? ShareFormatter { get => (Func<double, string>?)GetValue(ShareFormatterProperty); set => SetValue(ShareFormatterProperty, value); }
/// <summary>Raised when a segment or its legend entry is clicked, or chosen with the keyboard and Enter; attach it to the bar itself to make it interactive.</summary>
public event ChartItemEventHandler ItemActivated
{
add => AddHandler(ItemActivatedEvent, value);
remove => RemoveHandler(ItemActivatedEvent, value);
add
{
AddHandler(ItemActivatedEvent, value);
TrackActivation(value, added: true);
}
remove
{
RemoveHandler(ItemActivatedEvent, value);
TrackActivation(value, added: false);
}
}
protected internal override string? AutomationDescription =>
Items is { Count: > 0 } items ? string.Join(Environment.NewLine, Enumerable.Range(0, items.Count).Select(ReadoutText)) : null;
protected override int ItemCount => Items?.Count ?? 0;
protected override Size MeasureOverride(Size availableSize)
{
if (Items is not { Count: > 0 } items) return new Size(0, 0);
@@ -72,12 +83,6 @@ public sealed class StackedBar : DrawingElement
return new Size(0, BarHeight + (lines > 0 ? LegendGap + lines * LegendLine : 0));
}
protected override void OnDataChanged()
{
_hover = -1;
base.OnDataChanged();
}
protected override void OnRender(DrawingContext dc)
{
DrawHitArea(dc);
@@ -94,48 +99,48 @@ public sealed class StackedBar : DrawingElement
for (var i = 0; i < items.Count; i++)
{
var share = total > 0 ? Math.Max(0, items[i].Value) / total : 0;
var segment = new Rect(x, 0, available * share, BarHeight);
var segmentWidth = available * share;
var segment = new Rect(FromStart(x, segmentWidth, width), 0, segmentWidth, BarHeight);
_segments.Add(segment);
dc.PushOpacity(OpacityOf(i, items));
dc.DrawRectangle(GetBrush(items[i].BrushKey ?? BrushKey), null, segment);
dc.Pop();
x = segment.Right + SegmentGap;
x += segmentWidth + SegmentGap;
}
dc.Pop();
if (ShowLegend) LayoutLegend(items, width, dc);
DrawKeyboardItem(dc);
}
protected override void OnMouseMove(MouseEventArgs e)
/// <summary>A segment, or its legend entry; a click in the gap between two segments counts for the nearer one.</summary>
protected override int ItemAt(Point point)
{
base.OnMouseMove(e);
var p = e.GetPosition(this);
_hover = HitTest(p);
Readout.Show(_hover >= 0 ? ReadoutText(_hover) : null, p);
for (var i = 0; i < _segments.Count; i++)
if (point.Y >= 0 && point.Y <= BarHeight && point.X >= _segments[i].Left - SegmentGap / 2 && point.X <= _segments[i].Right + SegmentGap / 2) return i;
for (var i = 0; i < _entries.Count; i++)
if (_entries[i].Contains(point)) return i;
return -1;
}
protected override void OnMouseLeave(MouseEventArgs e)
protected override Rect ItemBounds(int item)
{
base.OnMouseLeave(e);
_hover = -1;
Readout.Hide();
if (item >= _segments.Count) return Rect.Empty;
var segment = _segments[item];
segment.Inflate(2, 2);
return segment;
}
protected override void OnQueryCursor(QueryCursorEventArgs e)
{
base.OnQueryCursor(e);
if (e.Handled || _hover < 0) return;
e.Cursor = Cursors.Hand;
e.Handled = true;
}
protected override string? ItemText(int item) => Items is { } items && item < items.Count ? ReadoutText(item) : null;
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
/// <summary>Left and Right move to the segment drawn on that side (the bar mirrors in a right-to-left language).</summary>
protected override int Navigate(int item, Key key) => key switch
{
base.OnMouseLeftButtonUp(e);
var index = HitTest(e.GetPosition(this));
if (index < 0) return;
RaiseEvent(new ChartItemEventArgs(ItemActivatedEvent, index, -1));
e.Handled = true;
}
Key.Left => Loc.IsRightToLeft ? item + 1 : Math.Max(0, item - 1),
Key.Right => Loc.IsRightToLeft ? Math.Max(0, item - 1) : item + 1,
_ => -1,
};
protected override void Activate(int item) => RaiseEvent(new ChartItemEventArgs(ItemActivatedEvent, item, -1));
private static double Total(IReadOnlyList<ChartItem> items)
{
@@ -188,15 +193,6 @@ public sealed class StackedBar : DrawingElement
return line + 1;
}
private int HitTest(Point p)
{
for (var i = 0; i < _segments.Count; i++)
if (p.Y >= 0 && p.Y <= BarHeight && p.X >= _segments[i].Left && p.X <= _segments[i].Right + SegmentGap) return i;
for (var i = 0; i < _entries.Count; i++)
if (_entries[i].Contains(p)) return i;
return -1;
}
private string ReadoutText(int index)
{
var items = Items!;
+3 -3
View File
@@ -120,10 +120,10 @@ public sealed class TimelineBands : DrawingElement
if (max <= 0) max = 1;
var text = GetBrush("Brush.Text");
var faint = GetBrush("Brush.TextFaint");
var muted = GetBrush("Brush.TextMuted");
var fill = GetBrush(BrushKey);
var divider = GetHairline("Brush.Stroke");
var captionHeight = Math.Ceiling(CreateText("0", LabelSize, faint).Height);
var captionHeight = Math.Ceiling(CreateText("0", LabelSize, muted).Height);
var barWidth = Math.Max(1, Math.Min(pitch * 0.6, 28));
for (var b = 0; b < bands.Count; b++)
@@ -145,7 +145,7 @@ public sealed class TimelineBands : DrawingElement
}
if (SlotLabels is { } labels && s < labels.Count)
{
var caption = CreateLabel(labels[s], LabelSize, faint);
var caption = CreateLabel(labels[s], LabelSize, muted);
DrawTextAt(dc, caption, new Point(cx - caption.Width / 2, baseline + 4));
}
if (b == CurrentBand && s == CurrentSlot)
+7 -5
View File
@@ -346,7 +346,7 @@ public sealed class MainViewModel : LocalizedViewModel
if (paths.Count == 0) return;
if (_target == UploadTargetMode.Sequence && SelectedSequence is null)
{
ShowToast(Loc.L("Uploader.Toast.ChooseSequence"));
ShowToast(Loc.L("Uploader.Toast.ChooseSequence"), isError: true);
return;
}
var found = await Task.Run(() => PhotoScanner.Scan(paths));
@@ -394,7 +394,7 @@ public sealed class MainViewModel : LocalizedViewModel
public void ReportError(Exception ex)
{
Log.Error("ui", "Operation failed", ex);
ShowToast(Loc.L("Errors.Unexpected"), Loc.L("Common.OpenLogs"), Loc.L("Tooltips.Common.OpenLogs"), new RelayCommand(OpenLogs));
ShowToast(Loc.L("Errors.Unexpected"), Loc.L("Common.OpenLogs"), Loc.L("Tooltips.Common.OpenLogs"), new RelayCommand(OpenLogs), isError: true);
}
public void TogglePause()
@@ -574,7 +574,8 @@ public sealed class MainViewModel : LocalizedViewModel
/// <summary>One sentence plus one action (BRIEF §0.2 rule 6): "Sign in" takes the user to the password box.</summary>
private void OnSessionEnded(object? sender, ServerProblem problem) =>
ShowToast(Loc.L(problem == ServerProblem.CertificateChanged ? "Uploader.Toast.CertificateChanged" : "Uploader.Toast.SignedOut"),
Loc.L("Uploader.Connect.SignIn"), Loc.L("Tooltips.Uploader.SignIn"), new RelayCommand(() => SignInRequested?.Invoke(this, EventArgs.Empty)));
Loc.L("Uploader.Connect.SignIn"), Loc.L("Tooltips.Uploader.SignIn"), new RelayCommand(() => SignInRequested?.Invoke(this, EventArgs.Empty)),
isError: true);
private void OnDrained(object? sender, EventArgs e)
{
@@ -585,8 +586,9 @@ public sealed class MainViewModel : LocalizedViewModel
if (confirmed > 0) UploadsCompleted?.Invoke(confirmed);
}
private void ShowToast(string title, string? actionText = null, string? actionToolTip = null, ICommand? action = null) =>
PendingToasts.Add(new Toast { Title = title, ActionText = actionText, ActionToolTip = actionToolTip, ActionCommand = action });
/// <summary>One sentence and at most one action; <paramref name="isError"/> marks a failure or refusal, which screen readers say at once.</summary>
private void ShowToast(string title, string? actionText = null, string? actionToolTip = null, ICommand? action = null, bool isError = false) =>
PendingToasts.Add(new Toast { Title = title, ActionText = actionText, ActionToolTip = actionToolTip, ActionCommand = action, IsError = isError });
private void OpenLogs()
{
@@ -55,6 +55,8 @@ public sealed class ArchiveScreenSmokeTests
AssertEveryButtonIsNamed(app);
Assert.Contains(archive.SetText, AutomationProperties.GetName(SetButton(app)));
foreach (var row in TreeItems(app)) Assert.NotNull(row.FocusVisualStyle, "a tree row shows keyboard focus");
Assert.Equal(Loc.L("Archive.Tree.Collapse"), AutomationProperties.GetName(ButtonFor(app, archive.TreeRows[1].ToggleCommand)),
"the open year's expander has a short name; the sentence is its tooltip");
var sequence = archive.TreeRows.First(r => r.Node.Kind == TreeNodeKind.Sequence);
Assert.Contains(sequence.Title, sequence.RowToolTip);
@@ -1,3 +1,4 @@
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@@ -9,6 +10,7 @@ using Titano.App.Infrastructure;
using Titano.App.Sections;
using Titano.App.Shell;
using Titano.App.Tests.Windows;
using Titano.Core.Advice;
using Titano.Core.Export;
using Titano.Core.Localization;
using Titano.Core.Model;
@@ -32,6 +34,26 @@ public sealed class EditorSmokeTests
{
private static readonly AppTheme[] Themes = [AppTheme.Dark, AppTheme.Light];
/// <summary>Here rather than with the other texts: it switches the UI language, which only a serial class may do.</summary>
[Test]
public void AnOptimiseLinePointsFromTheOldValueToTheNewOneInEitherReadingDirection()
{
var change = new SettingChange(AdvisorParameters.DeflickerWindow, 21, 41, "reason", []);
try
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
Assert.Equal("Deflicker window: 21 frames → 41 frames", EditorText.Change(change));
Loc.SetCulture(CultureInfo.GetCultureInfo("ar"));
Assert.Equal(Loc.L("Editor.Optimise.ChangeRtl", Loc.L("Editor.Exposure.Window"), Loc.Plural("Editor.Value.Frames", 21), Loc.Plural("Editor.Value.Frames", 41)),
EditorText.Change(change), "Arabic reads the old value first, from the right");
Assert.Contains("←", EditorText.Change(change));
}
finally
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
}
}
[Test]
public Task EverySectionOfTheEditorRendersInBothThemes() => ScreenHost.RunAsync(async () =>
{
@@ -83,6 +83,12 @@ public sealed class UploaderScreenSmokeTests
await screen.SettleAsync();
screen.AssertIconButtonsNamed("settings");
vm.IsSettingsOpen = false;
// A failure interrupts the screen reader (assertive) instead of waiting its turn.
Toast? shown = null;
vm.PendingToasts.CollectionChanged += (_, e) => shown ??= e.NewItems?.OfType<Toast>().FirstOrDefault();
vm.ReportError(new InvalidOperationException("The queue file cannot be read"));
Assert.True(Assert.NotNull(shown).IsError, "an unexpected error is announced at once");
});
[Test]
@@ -1,10 +1,14 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Titano.Core.Localization;
using Titano.Testing;
using Titano.Ui.Controls;
using Titano.Ui.Theming;
@@ -127,6 +131,153 @@ public sealed class VisualsSmokeTests
Assert.Equal(412, strip.CurrentIndex);
});
[Test]
public void ListsKeepTheirFillWhenDisabled() => WpfHost.Run(() =>
{
var surface = ColorOf("Brush.Surface");
foreach (var list in new[] { new ListBox(), new ListBox { Style = (Style)Application.Current.FindResource("ListBox.Cards") } })
{
list.Background = (Brush)Application.Current.FindResource("Brush.Surface");
list.ItemsSource = new[] { "Harbour sunset" };
list.IsEnabled = false;
var bitmap = Render(list, 200, 100);
Assert.NotNull(VisualTreeHelper.GetChild(list, 0) as Border, "the theme's list frame");
Assert.True(Near(PixelAt(bitmap, 100, 95), surface, 1), "a disabled list keeps its fill instead of the system's white");
}
// A list view keeps the system template, which carries the column headers.
var view = new ListView { ItemsSource = new[] { "Harbour sunset" }, View = new GridView { Columns = { new GridViewColumn { Header = "Title" } } } };
Render(view, 200, 100);
Assert.NotNull(FindChild<GridViewHeaderRowPresenter>(view), "the column header row");
});
[Test]
public void ChartLabelsAreMutedAndMonthsWithoutDataTakeTheStrokeTone() => WpfHost.Run(() =>
{
foreach (var theme in new[] { AppTheme.Dark, AppTheme.Light })
{
ThemeManager.Apply(theme);
var (muted, faint, stroke, card) = (ColorOf("Brush.TextMuted"), ColorOf("Brush.TextFaint"), ColorOf("Brush.Stroke"), ColorOf("Brush.Card"));
// Zero values draw no bars: what remains is the labels.
var bars = Covered(Render(new BarChart { Items = [new ChartItem("Canon EOS R6", 0), new ChartItem("Nikon Z 8", 0)], ShowValues = false }, 300, 60));
Assert.NotEmpty(bars);
Assert.True(bars.All(c => Near(c, muted)), $"bar labels are TextMuted in {theme}, not TextFaint ({faint})");
var months = new[] { "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" };
var empty = new ChartRow("2027", Enumerable.Repeat(double.NaN, 12).ToArray());
var heatmap = Covered(Render(new HeatmapStrip { Rows = [empty], ColumnLabels = months, ShowScale = false }, 400, 60));
Assert.Contains(heatmap, c => Near(c, stroke));
Assert.False(heatmap.Any(c => Near(c, card) && !Near(c, stroke)), $"months without data are not the card colour in {theme}");
Assert.True(heatmap.All(c => Near(c, stroke) || Near(c, muted)), $"heatmap labels are TextMuted in {theme}");
}
ThemeManager.Apply(AppTheme.Dark);
});
[Test]
public void ChartsTakeTheHandAndTheKeyboardOnlyWhileSomethingHandlesActivation() => WpfHost.Run(() =>
{
var items = new[] { new ChartItem("2025", 2), new ChartItem("2026", 1) };
var bars = new BarChart { Items = items };
var stacked = new StackedBar { Items = items };
var heatmap = new HeatmapStrip { Rows = [new ChartRow("2026", [1, 2, 3])], ColumnLabels = ["J", "F", "M"] };
ChartItemEventHandler handler = (_, _) => { };
var charts = new (DrawingElement Chart, Action Attach, Action Detach)[]
{
(bars, () => bars.ItemActivated += handler, () => bars.ItemActivated -= handler),
(stacked, () => stacked.ItemActivated += handler, () => stacked.ItemActivated -= handler),
(heatmap, () => heatmap.CellActivated += handler, () => heatmap.CellActivated -= handler),
};
foreach (var (chart, attach, detach) in charts)
{
Render(chart, 300, 80);
var name = chart.GetType().Name;
Assert.False(ShowsHand(chart), $"{name}: no hand cursor while nothing handles a click");
Assert.False(chart.Focusable, $"{name}: no tab stop while nothing handles Enter");
attach();
Assert.True(ShowsHand(chart), $"{name}: the hand over an item once a handler is attached");
Assert.True(chart.Focusable, $"{name}: the keyboard reaches it once a handler is attached");
detach();
Assert.False(ShowsHand(chart), $"{name}: no hand once the handler is gone");
Assert.False(chart.Focusable, $"{name}: no tab stop once the handler is gone");
}
});
[Test]
public void TheKeyboardChoosesAndActivatesABar() => WpfHost.Run(() =>
{
var bars = new BarChart { Items = [new ChartItem("2024", 3), new ChartItem("2025", 2), new ChartItem("2026", 1)] };
var host = new Border { Child = bars };
var window = new Window
{
Content = host,
Width = 320,
Height = 160,
WindowStyle = WindowStyle.None,
WindowStartupLocation = WindowStartupLocation.Manual,
Left = -20000,
Top = -20000,
ShowActivated = false,
ShowInTaskbar = false,
};
window.Show();
try
{
window.UpdateLayout();
var bubbled = new List<int>();
host.AddHandler(BarChart.ItemActivatedEvent, new ChartItemEventHandler((_, e) => bubbled.Add(e.Row)));
Press(bars, Key.Enter);
Assert.Empty(bubbled, "Enter does nothing while no handler is attached to the chart");
var rows = new List<int>();
bars.ItemActivated += (_, e) => rows.Add(e.Row);
Press(bars, Key.Down);
Press(bars, Key.Down);
Press(bars, Key.Down);
Press(bars, Key.Enter);
Press(bars, Key.Home);
Press(bars, Key.Space);
Assert.SequenceEqual([2, 0], rows, "Down stops at the last bar; Home goes back to the first");
Assert.Contains("2024", UIElementAutomationPeer.CreatePeerForElement(bars).GetItemStatus());
}
finally
{
window.Close();
}
});
[Test]
public void CategoryBarsStartOnTheReadingSideWhileMonthsKeepTheirOrder() => WpfHost.Run(() =>
{
var accent = ColorOf("Brush.Accent");
var culture = Loc.Culture;
try
{
foreach (var (language, rightToLeft) in new[] { ("en", false), ("ar", true) })
{
Loc.SetCulture(CultureInfo.GetCultureInfo(language));
// Rows 22 px apart: the short second bar (y 26–40) grows from the labels' side.
var bars = Render(new BarChart { Items = [new ChartItem("A", 4), new ChartItem("B", 1)], ShowValues = false }, 300, 44);
var (left, right) = Extent(bars, accent, 33);
Assert.True(rightToLeft ? left > 150 : right < 150 && right > 0, $"{language}: the short bar spans {left}–{right}");
// The largest segment comes first, on the reading side.
var stacked = Render(new StackedBar { Items = [new ChartItem("A", 3), new ChartItem("B", 1)], ShowLegend = false }, 300, 12);
(left, right) = Extent(stacked, accent, 6);
Assert.True(rightToLeft ? left > 60 && right >= 296 : left is >= 0 and <= 3 && right < 240, $"{language}: the first segment spans {left}–{right}");
// The full month (January) stays on the left: months are a time axis.
var months = Render(new HeatmapStrip { Rows = [new ChartRow("2026", [5, 0, 0, 0])], ColumnLabels = ["1", "2", "3", "4"], ShowScale = false }, 300, 60);
(left, right) = Extent(months, accent, 31);
Assert.True(left > 0 && right < 150, $"{language}: January spans {left}–{right}");
}
}
finally
{
Loc.SetCulture(culture);
}
});
private static IEnumerable<(string Name, FrameworkElement Element, double Width, double Height)> Samples()
{
var n = 120_000;
@@ -235,6 +386,61 @@ public sealed class VisualsSmokeTests
return bitmap;
}
private static Color ColorOf(string key) => ((SolidColorBrush)Application.Current.FindResource(key)).Color;
private static Color PixelAt(BitmapSource bitmap, int x, int y)
{
var pixel = new byte[4];
bitmap.CopyPixels(new Int32Rect(x, y, 1, 1), pixel, 4, 0);
return Color.FromArgb(pixel[3], pixel[2], pixel[1], pixel[0]);
}
/// <summary>The colours drawn at least two-thirds opaque, un-premultiplied: text edges keep the colour of their brush.</summary>
private static List<Color> Covered(BitmapSource bitmap)
{
var stride = bitmap.PixelWidth * 4;
var pixels = new byte[stride * bitmap.PixelHeight];
bitmap.CopyPixels(pixels, stride, 0);
var colours = new List<Color>();
for (var i = 0; i < pixels.Length; i += 4)
{
var a = pixels[i + 3];
if (a < 170) continue;
colours.Add(Color.FromRgb((byte)(pixels[i + 2] * 255 / a), (byte)(pixels[i + 1] * 255 / a), (byte)(pixels[i] * 255 / a)));
}
return colours;
}
private static bool Near(Color a, Color b, int tolerance = 12) =>
Math.Abs(a.R - b.R) <= tolerance && Math.Abs(a.G - b.G) <= tolerance && Math.Abs(a.B - b.B) <= tolerance;
/// <summary>First and last x of row <paramref name="y"/> drawn in <paramref name="colour"/> at full opacity; (−1, −1) when none.</summary>
private static (int Left, int Right) Extent(BitmapSource bitmap, Color colour, int y)
{
var (left, right) = (-1, -1);
for (var x = 0; x < bitmap.PixelWidth; x++)
{
var pixel = PixelAt(bitmap, x, y);
if (pixel.A != 255 || !Near(pixel, colour, 2)) continue;
if (left < 0) left = x;
right = x;
}
return (left, right);
}
private static bool ShowsHand(DrawingElement chart)
{
for (var y = 0.0; y < chart.ActualHeight; y += 2)
{
for (var x = 0.0; x < chart.ActualWidth; x += 2)
if (chart.CursorAt(new Point(x, y)) == Cursors.Hand) return true;
}
return false;
}
private static void Press(UIElement target, Key key) =>
target.RaiseEvent(new KeyEventArgs(Keyboard.PrimaryDevice, PresentationSource.FromVisual(target)!, 0, key) { RoutedEvent = Keyboard.KeyDownEvent });
private static RenderTargetBitmap Render(FrameworkElement element, double width, double height)
{
var host = Host(element);
@@ -1,8 +1,10 @@
using System.IO;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@@ -197,6 +199,12 @@ public sealed class ScreenSmokeTests
await app.ExpectAsync<LibraryView>("library-toast-done");
Assert.True(ran, "the action ran");
Assert.Equal(0, host.Toasts.Count, "the toast closes once its action has run");
// A failure interrupts the screen reader (assertive); a notice waits its turn.
Assert.False(await ArchiveActions.TryAsync(app.Shell, _ => throw new IOException("The archive drive is gone")));
Assert.True(host.Toasts.Single().IsError, "a failed archive action is announced at once");
app.Shell.Notify("Harbour sunset rendered");
Assert.False(host.Toasts[^1].IsError, "a notice is announced in turn");
});
[Test]
@@ -210,6 +218,9 @@ public sealed class ScreenSmokeTests
Assert.Equal(Loc.L("Tooltips.Window.Minimize"), AutomationProperties.GetName(captions.Single(b => b.Command == SystemCommands.MinimizeWindowCommand)));
Assert.Equal(Loc.L("Tooltips.Window.Maximize"), AutomationProperties.GetName(captions.Single(b => b.Command == SystemCommands.MaximizeWindowCommand)));
Assert.Equal(Loc.L("Tooltips.Window.Close"), AutomationProperties.GetName(captions.Single(b => b.Command == SystemCommands.CloseWindowCommand)));
var railToggle = Descendants<Button>(window).Single(b => ReferenceEquals(b.Command, app.Shell.ToggleRailCommand));
Assert.Equal(Loc.L(app.Shell.IsRailCollapsed ? "Shell.Nav.Expand" : "Shell.Nav.Collapse"), AutomationProperties.GetName(railToggle),
"the rail button has a short name; the sentence is its tooltip");
var bar = (JobBar)window.FindName("JobBar");
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(bar));
@@ -311,10 +322,22 @@ public sealed class ScreenSmokeTests
luminance[theme] = MeanLuminance(bitmap);
Assert.Greater(Distinct(bitmap), 8, $"{screen} drew almost nothing in {theme}");
}
AssertIconOnlyControlsNamed(screen);
Assert.Less(luminance[AppTheme.Dark], luminance[AppTheme.Light], $"{screen}: the light theme is not lighter than the dark one");
ThemeManager.Apply(AppTheme.Dark);
}
/// <summary>DESIGN §4: every visible icon-only button or segment has an accessible name and a tooltip.</summary>
public void AssertIconOnlyControlsNamed(string screen)
{
foreach (var control in FindAll<Control>().Where(c => c.IsVisible && IsIconOnly(c)))
{
var name = AutomationProperties.GetName(control);
Assert.False(string.IsNullOrWhiteSpace(name), $"{screen}: an icon-only {control.GetType().Name} bound to {(control as ButtonBase)?.Command} has no name");
Assert.True(control.ToolTip is not null, $"{screen}: '{name}' has no tooltip");
}
}
public List<T> FindAll<T>()
where T : DependencyObject
{
@@ -354,6 +377,13 @@ public sealed class ScreenSmokeTests
return bitmap;
}
private static bool IsIconOnly(Control control) => control switch
{
SegmentedItem segment => segment.Content is null && segment.Glyph is not null,
ButtonBase button => button.Content is null && ButtonIcon.GetGlyph(button) is not null,
_ => false,
};
private static byte[] Pixels(BitmapSource bitmap)
{
var pixels = new byte[bitmap.PixelWidth * bitmap.PixelHeight * 4];