미리보기에 보기 전환을 둔다 — 인쇄될 것만 / 화면 그대로
미리보기 레거시 호환 계획의 P0-3. P0 세 항목이 이걸로 끝난다. 레거시 미리보기와 레거시 인쇄가 서로 다르다 — 미리보기는 PrintOutPut=False 컨트롤을 <b>그대로 보여 주고</b>(그 속성은 PrintMe 안에만 있다, Label.vb:454-457) 인쇄만 뺀다. SheetMe 는 인쇄 쪽을 골라 테스트로 못 박아 뒀었다. 둘 다 확인해야 하므로 미리보기 창이 보기를 가른다. 기본은 인쇄 기준 — 저장 전에 확인하려는 것이 대개 종이 결과다. Hidden(디자이너 임시 숨김)과 MDataTable(런타임 비가시)은 보기와 무관하게 항상 뺀다. 레거시 미리보기에서도 안 보이는 것들이다 — 보기가 가르는 것은 Visible/PrintOutPut 뿐이다. 인쇄 경로는 언제나 필터를 건다. 인쇄는 인쇄다. <b>단정은 "돌아오는가"를 본다.</b> 필터를 켜서 뺀 것이 끄면 다시 나와야 한다 — 안 나오면 전환이 배선만 된 것이다. 컨테이너 안까지 세므로 P0-1 의 투영도 함께 검증된다. <b>XAML 파싱 중에 이벤트가 발생했다.</b> 토글의 IsChecked="True" 가 파스 시점에 Checked 를 쏘는데, 토글이 트리에서 앞에 있어 그때 PagesHost 는 아직 null 이다 → InitializeComponent 안에서 NullReferenceException. 가드를 넣고 이유를 적었다. --edit-smoke 가 잡았다. 없었으면 미리보기를 여는 순간 앱이 죽었을 것이다. 게이트: 테스트 298/298, --edit-smoke 0실패(미리보기 7건), --dialog-shots 글자 2,653개 FAIL 0 대조군 4/4, --modal-check 0실패, --cleartype 11/11, --maxrect 0실패, --scale-budget 5/5, 빌드 경고 0, --db-smoke 1271건 diff 0, --db-render P062 md5 8d683835f5d81e7bb41c79071d6bf954 동일. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
9e3cd088e2
commit
a67b6ee4b8
@@ -49,8 +49,16 @@ public static class PrintService
|
||||
return document;
|
||||
}
|
||||
|
||||
/// <summary>페이지 컨트롤층 비주얼 — 크롬 없는 Canvas(그리기 순서 = 컬렉션 순서, 미리보기/인쇄 공용)</summary>
|
||||
public static UIElement BuildPageVisual(PageViewModel page)
|
||||
/// <summary>
|
||||
/// 페이지 컨트롤층 비주얼 — 크롬 없는 Canvas(그리기 순서 = 컬렉션 순서, 미리보기/인쇄 공용).
|
||||
///
|
||||
/// <paramref name="printFilter"/> 가 false 면 화면에 보이는 것을 그대로 그린다.
|
||||
/// <b>레거시가 그렇게 동작한다</b> — 레거시 미리보기는 <c>PrintOutPut=False</c> 컨트롤을
|
||||
/// 그대로 보여 주고(그 속성은 <c>PrintMe</c> 안에만 있다) 레거시 인쇄만 뺀다.
|
||||
/// 두 눈이 필요해서 미리보기 창이 보기를 전환할 수 있게 열어 둔다.
|
||||
/// 인쇄는 언제나 true 다 — 인쇄는 인쇄다.
|
||||
/// </summary>
|
||||
public static UIElement BuildPageVisual(PageViewModel page, bool printFilter = true)
|
||||
{
|
||||
var canvas = new Canvas
|
||||
{
|
||||
@@ -73,14 +81,16 @@ public static class PrintService
|
||||
// ③ 을 오래 빠뜨려서 '인쇄 출력'을 꺼도 미리보기에 그대로 나왔다 —
|
||||
// 저장 전 검증 수단이 거짓말을 하고 있었다.
|
||||
// 캔버스는 계속 다 보여 준다(편집 중인 것을 못 보면 고칠 수 없다) — 여기만 거른다.
|
||||
// Hidden(디자이너 임시 숨김)과 MDataTable(런타임 비가시)은 보기와 무관하게 항상 뺀다 —
|
||||
// 레거시 미리보기에서도 안 보이는 것들이다. 보기가 가르는 것은 ③ 뿐이다.
|
||||
if (control.Model.Hidden || control is DataTableViewModel
|
||||
|| !SheetMe.Core.Catalog.PrintFilter.IsPrinted(control.Model))
|
||||
|| (printFilter && !SheetMe.Core.Catalog.PrintFilter.IsPrinted(control.Model)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var presenter = new ContentPresenter
|
||||
{
|
||||
Content = PrintProjection(control),
|
||||
Content = PrintProjection(control, printFilter),
|
||||
Width = Math.Max(1, control.Width),
|
||||
Height = Math.Max(1, control.Height),
|
||||
};
|
||||
@@ -109,7 +119,7 @@ public static class PrintService
|
||||
/// 자식 VM 은 새로 만들지 않고 원본을 그대로 담는다 — 해석된 글꼴·색이 유지된다.
|
||||
/// 캔버스가 쓰는 VM 은 <b>한 글자도 건드리지 않는다.</b>
|
||||
/// </summary>
|
||||
private static object PrintProjection(ControlViewModel control)
|
||||
private static object PrintProjection(ControlViewModel control, bool printFilter)
|
||||
{
|
||||
if (control is not ContainerViewModel container)
|
||||
{
|
||||
@@ -129,11 +139,11 @@ public static class PrintService
|
||||
foreach (var child in container.Children)
|
||||
{
|
||||
if (child.Model.Hidden || child is DataTableViewModel
|
||||
|| !SheetMe.Core.Catalog.PrintFilter.IsPrinted(child.Model))
|
||||
|| (printFilter && !SheetMe.Core.Catalog.PrintFilter.IsPrinted(child.Model)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (PrintProjection(child) is ControlViewModel projected)
|
||||
if (PrintProjection(child, printFilter) is ControlViewModel projected)
|
||||
{
|
||||
copy.Children.Add(projected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user