From 59b0e457fef9ea3344b7af5930905b9fe016a047 Mon Sep 17 00:00:00 2001 From: Msystech Date: Thu, 13 Aug 2026 12:38:37 +0900 Subject: [PATCH] =?UTF-8?q?2=EB=8B=A8=EA=B3=84=20=E2=80=94=20=EC=8B=A0?= =?UTF-8?q?=EA=B7=9C=20=EC=84=9C=EC=8B=9D=EC=97=90=20=EB=9F=B0=ED=83=80?= =?UTF-8?q?=EC=9E=84=20=EC=84=A4=EC=A0=95=EC=9D=84=20=EA=B1=B8=20=EC=88=98?= =?UTF-8?q?=20=EC=9E=88=EA=B2=8C=20(=EC=84=A0=203=EC=A2=85=C2=B7=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=20=EC=86=8D=EC=84=B1=C2=B7=ED=82=A4=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=99=84=EC=84=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 레거시로는 되는데 SheetMe 로는 못 만들던 것들을 메웠다. 어떤 속성을 올릴지는 취향으로 정하지 않고 --db-props 로 운영 디자인 1,271건 / 컨트롤 164,091개를 세고, 각 컨트롤 .vb 의 필드 선언을 읽어 정했다. ■ 선(Line) — 새로 그은 세로선이 EMR 에서 사라지던 문제 MLine 은 방향을 크기가 아니라 Orientation 으로 정한다(MLine.vb:181-190). 키가 없으면 Horizontal 이라 (0,0)→(Width,0) 을 그리므로, 폭 1·높이 210 으로 세로처럼 만든 선은 디자이너에만 보이고 기록지에서는 1px 점이 된다. 운영 선 32,599개 중 Orientation 보유 12,811개이고 그 중 Vertical 이 12,721개 — 세로선은 예외가 아니라 주류다. Orientation·BorderWidth·DashStyle 을 인스펙터에 올렸다. 그리고 값만 올리지 않고 레거시 컨트롤이 스스로 지키는 불변식을 함께 옮겼다(LineGeometry): · 두께 축은 항상 BorderWidth 다 — MLine.OnResize 가 매번 되돌린다. 그래서 선을 끌어 두껍게 만들 수 없다. 이걸 허용하면 '세로처럼 보이지만 EMR 에선 점'인 선을 다시 만들 수 있다. · 방향 전환은 길이를 보존한 채 축을 바꾼다(레거시 Orientation 세터: Width = Height 후 OnResize). · 가로로 되돌리면 Orientation 키를 지운다 — 라 레거시 직렬화기도 생략한다. --db-lines 를 새로 만들어 확인한 결과 운영 선 32,599개에서 경계 모양과 Orientation 불일치는 0건이다. 레거시가 구조적으로 막아 왔다는 뜻이고, 그래서 캔버스 렌더는 건드리지 않았다(P062 바이트 동일). ■ 공통 런타임 속성 — 서명란·인쇄 제외·필수입력·자동높이·재조회 신규 컨트롤은 Props 가 사실상 비어 있어 '전체 속성(0개)'이었고, 고급 편집도 이미 있는 키만 나열한다. 결과적으로 서명이 필요한 동의서나 점수를 합산하는 평가지를 SheetMe 만으로 새로 만들 수 없었다. 타입별 기술자에 다음을 추가했다(기본값은 각 컨트롤 .vb 필드 선언에서 확인한 값이다): PrintOutPut(기본 True) · PreventEditing · IsRequiredValue(No/Yes) · Visible · AutoHeight · ReLoadData 3종 · MPictureBox 의 IsSignature/SignatureIndex. PrintOutPut 을 True 로 표시하는 것이 중요하다 — 키가 없는 컨트롤이 '인쇄 안 함'으로 보이면 사용자가 껐다 켜는 순간 명시 False 가 기록돼 실제로 인쇄에서 빠진다 (런타임 필터: If Me.Visible = False OrElse mbPrintOutPut = False Then Return False). ■ 감사 권고와 다르게 한 것 3가지 — 근거가 반대였다 1. Score 를 5개 타입에 추가하라는 권고는 따르지 않았다. 실제로 저장값을 읽는 것은 CheckBox·RadioButton 뿐이다(게터가 mdScore 반환). TextBox·MaskedTextBox 의 Score 게터는 저장값을 무시하고 Me.Text 를 숫자로 읽으며, CalcBox 는 세터가 오히려 Text 를 덮어쓴다. 편집기를 붙였으면 사용자는 배점을 걸었다고 믿고 런타임은 무시하는 상태가 된다. ComboBox 는 Score 가 아니라 ItemScore("/" 구분, 항목 순서와 1:1)를 노출했다. 실측이 먼저 신호를 줬다: ComboBox 의 Score 값 분포가 Text 와 정확히 같았다(-×625, ++×22). 2. Button 에는 PrintOutPut 을 붙이지 않았다 — MButton.vb 에 그 속성 자체가 없다. 3. 라벨의 표시 여부는 소문자 visible 이다. Label.vb:209-217 이 Shadows 로 Control.Visible 을 가리고 직렬화기가 그 그림자를 쓴다. 운영에서도 소문자 58,864건(99.7%) 대 대문자 196건. 대문자로 쓰면 라벨은 그대로 보인다. ■ '속성 추가' 자동완성 큐레이션 밖의 값을 걸려면 키를 손으로 쳐야 했는데, 철자가 틀려도 경고가 없고 그 서식은 배포된 뒤에야 이상하게 동작한다. 타입별 실사용 키 목록(LegacyPropertyCatalog, --db-props 집계 기반)을 제안 칩으로 깔았다. 이미 있는 키와 인스펙터가 이미 다루는 키는 빼고, 부분 일치로 좁히며 접두 일치를 앞에 둔다. 자유 입력은 그대로 열어 뒀다 — 제안이지 검증이 아니고 사이트가 추가한 키도 있다. ■ 1단계 잔여분: 선택 밖 컨트롤을 Ctrl+드래그하면 엉뚱한 것이 끌리던 문제 Ctrl/Shift 클릭은 선택을 바꾸지 않고 업에서 토글하므로, 그 상태로 드래그가 시작되면 잡은 컨트롤이 아니라 기존 선택분이 끌려갔다(선택이 비어 있으면 아무것도 안 끌렸다). 드래그가 실제로 시작되는 지점에서 잡은 것을 선택에 넣는다 — 기존 다중선택은 유지한다(업 토글과 같은 규칙). 편집 스모크 14건 추가(선 기하 6 · Ctrl+드래그 2 · 자동완성 5 · 라벨 소문자 함정 1). 회귀: 테스트 124/124, 편집 스모크 183건 실패 0, DB 왕복 1,271건 diff 0/예외 0, 종이 렌더 P062 바이트 동일. Co-Authored-By: Claude Opus 5 --- src/SheetMe.Core/Catalog/ControlRegistry.cs | 146 ++++++++++++++- .../Catalog/LegacyPropertyCatalog.cs | 172 ++++++++++++++++++ src/SheetMe.Core/Catalog/LineGeometry.cs | 107 +++++++++++ src/SheetMe.Designer/Diagnostics/EditSmoke.cs | 81 +++++++++ .../Services/InteractionController.cs | 14 ++ .../Themes/DesignerTheme.xaml | 29 +++ .../Inspector/InspectorTabCatalog.cs | 19 ++ .../Inspector/InspectorViewModel.cs | 40 +++- .../ViewModels/Inspector/PropertyRows.cs | 70 ++++++- src/SheetMe.Designer/Views/InspectorView.xaml | 38 +++- 10 files changed, 699 insertions(+), 17 deletions(-) create mode 100644 src/SheetMe.Core/Catalog/LegacyPropertyCatalog.cs create mode 100644 src/SheetMe.Core/Catalog/LineGeometry.cs diff --git a/src/SheetMe.Core/Catalog/ControlRegistry.cs b/src/SheetMe.Core/Catalog/ControlRegistry.cs index a3f50ec..b388b94 100644 --- a/src/SheetMe.Core/Catalog/ControlRegistry.cs +++ b/src/SheetMe.Core/Catalog/ControlRegistry.cs @@ -7,6 +7,59 @@ namespace SheetMe.Core.Catalog; public static class ControlRegistry { #region Member Fields + /// + /// 여러 타입이 공유하는 런타임 속성 — 레거시 컨트롤 필드 초기값을 그대로 옮긴 것. + /// + /// 기본값(Default)은 지어내지 않았다. 각 컨트롤 .vb 의 필드 선언을 읽어 확인한 값이다. + /// 예: Private mbPrintOutPut As Boolean = True (Label.vb:21, TextBox.vb:31, CheckBox.vb:31, + /// Panel.vb:20, MLine.vb:15, MPictureBox.vb:35 — 전부 동일). 기본값을 알려주지 않으면 + /// 키가 없는 컨트롤이 '인쇄 안 함'으로 보이고, 사용자가 껐다 켜는 순간 명시 False 가 기록돼 + /// 실제로 인쇄에서 빠진다(런타임 필터: If Me.Visible = False OrElse mbPrintOutPut = False Then Return False). + /// + /// 이 목록에 없는 타입에는 붙이지 않는다 — 레거시가 노출하지 않는 속성을 우리가 만들어 주면 + /// 사용자는 설정했다고 믿지만 런타임은 그 값을 읽지 않는다. + /// + private static class Runtime + { + /// 인쇄 출력 여부 — 기본 True + public static PropertyDef PrintOutPut => new() + { + Key = "PrintOutPut", Label = "인쇄 출력", Editor = PropEditorKind.Toggle, Default = "True", + }; + + /// 읽기 전용 — TextBox 는 ReadOnly 와 같은 것(TextBox.vb PreventEditing → Me.ReadOnly) + public static PropertyDef PreventEditing => new() + { + Key = "PreventEditing", Label = "읽기 전용", Editor = PropEditorKind.Toggle, Default = "False", + }; + + /// 필수 입력 — 값은 True/False 가 아니라 No/Yes(EN_NoYes, 기본 No=0) + public static PropertyDef IsRequiredValue => new() + { + Key = "IsRequiredValue", Label = "필수 입력", Editor = PropEditorKind.Choice, + Default = "No", Choices = new[] { "No", "Yes" }, + }; + + // 아래 3종의 라벨은 짧게 잡았다 — 인스펙터 라벨 열은 92px 이라 8자를 넘기면 두 줄로 접힌다. + /// 저장된 기록을 다시 열 때 최신 데이터를 다시 조회 — 기본 False + public static PropertyDef ReLoadDataOnSavedSheet => new() + { + Key = "ReLoadDataOnSavedSheet", Label = "저장본 재조회", Editor = PropEditorKind.Toggle, Default = "False", + }; + + /// 열람 모드에서도 재조회 — 기본 False + public static PropertyDef ReLoadDataOnViewMode => new() + { + Key = "ReLoadDataOnViewMode", Label = "열람 시 재조회", Editor = PropEditorKind.Toggle, Default = "False", + }; + + /// 재조회 시 확인 팝업 생략 — 기본 False + public static PropertyDef ReLoadDataMsgNoCheck => new() + { + Key = "ReLoadDataMsgNoCheck", Label = "재조회 무확인", Editor = PropEditorKind.Toggle, Default = "False", + }; + } + private static readonly List all = new() { new() @@ -20,6 +73,11 @@ public static class ControlRegistry Choices = new[] { "TopLeft", "TopCenter", "TopRight", "MiddleLeft", "MiddleCenter", "MiddleRight", "BottomLeft", "BottomCenter", "BottomRight" } }, new() { Key = "ForeColor", Label = "글자색", Editor = PropEditorKind.Color }, new() { Key = "BackColor", Label = "배경색", Editor = PropEditorKind.Color }, + // 라벨만 소문자 visible 이다 — Label.vb:209-217 이 Shadows Property visible 로 + // Control.Visible 을 가리고, 직렬화기는 이 그림자 속성을 쓴다. 운영에서도 소문자 58,864건(99.7%) + // 대 대문자 196건이다. 대문자로 쓰면 라벨은 그대로 보인다. + new() { Key = "visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.PrintOutPut, }, }, new() @@ -29,8 +87,10 @@ public static class ControlRegistry { new() { Key = "Text", Label = "텍스트", Editor = PropEditorKind.Text }, new() { Key = "Multiline", Label = "여러 줄", Editor = PropEditorKind.Toggle }, + // 입력이 높이를 넘으면 내용에 맞춰 늘어난다(TextBox.vb:311 자동 속성 — 기본 False) + new() { Key = "AutoHeight", Label = "자동 높이", Editor = PropEditorKind.Toggle, Default = "False" }, new() { Key = "TextAlign", Label = "정렬", Editor = PropEditorKind.Choice, Default = "Left", Choices = new[] { "Left", "Center", "Right" } }, - new() { Key = "IsRequiredValue", Label = "필수 입력", Editor = PropEditorKind.Choice, Choices = new[] { "No", "Yes" } }, + Runtime.IsRequiredValue, new() { Key = "InitialValue", Label = "초기값", Editor = PropEditorKind.Text }, new() { Key = "DataInterfaceTag", Label = "데이터 태그", Editor = PropEditorKind.DataInterfaceTag }, new() { Key = "DataActionTag", Label = "액션 태그", Editor = PropEditorKind.DataActionTag }, @@ -41,6 +101,12 @@ public static class ControlRegistry new() { Key = "RwdOrderAutYon", Label = "처방연동 상용구", Editor = PropEditorKind.Toggle }, new() { Key = "BackColor", Label = "배경색", Editor = PropEditorKind.Color }, new() { Key = "BorderStyle", Label = "테두리", Editor = PropEditorKind.Choice, Default = "Fixed3D", Choices = new[] { "None", "FixedSingle", "Fixed3D" } }, + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.PrintOutPut, + Runtime.PreventEditing, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataOnViewMode, + Runtime.ReLoadDataMsgNoCheck, }, }, new() @@ -49,8 +115,14 @@ public static class ControlRegistry Properties = new PropertyDef[] { new() { Key = "Mask", Label = "마스크", Editor = PropEditorKind.Mask }, - new() { Key = "IsRequiredValue", Label = "필수 입력", Editor = PropEditorKind.Choice, Choices = new[] { "No", "Yes" } }, + Runtime.IsRequiredValue, new() { Key = "DataInterfaceTag", Label = "데이터 태그", Editor = PropEditorKind.DataInterfaceTag }, + new() { Key = "AutoHeight", Label = "자동 높이", Editor = PropEditorKind.Toggle, Default = "False" }, + Runtime.PrintOutPut, + Runtime.PreventEditing, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataOnViewMode, + Runtime.ReLoadDataMsgNoCheck, }, }, new() @@ -60,8 +132,12 @@ public static class ControlRegistry { new() { Key = "Text", Label = "텍스트", Editor = PropEditorKind.Text }, new() { Key = "Checked", Label = "기본 체크", Editor = PropEditorKind.Toggle }, - new() { Key = "Score", Label = "점수", Editor = PropEditorKind.Number }, - new() { Key = "IsRequiredValue", Label = "필수 입력", Editor = PropEditorKind.Choice, Choices = new[] { "No", "Yes" } }, + // 진짜 배점이다 — CheckBox.vb:352-367 게터가 저장값(mdScore)을 그대로 돌려준다(체크됐을 때). + new() { Key = "Score", Label = "점수", Editor = PropEditorKind.Number, Default = "0" }, + Runtime.IsRequiredValue, + Runtime.PrintOutPut, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataMsgNoCheck, }, }, new() @@ -71,6 +147,12 @@ public static class ControlRegistry { new() { Key = "Text", Label = "텍스트", Editor = PropEditorKind.Text }, new() { Key = "Checked", Label = "기본 선택", Editor = PropEditorKind.Toggle }, + // CheckBox 와 같은 구조(RadioButton.vb Score 게터가 mdScore 반환) — 낙상·욕창 평가지의 배점원 + new() { Key = "Score", Label = "점수", Editor = PropEditorKind.Number, Default = "0" }, + Runtime.IsRequiredValue, + Runtime.PrintOutPut, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataMsgNoCheck, }, }, new() @@ -79,8 +161,13 @@ public static class ControlRegistry Properties = new PropertyDef[] { new() { Key = "Items", Label = "선택지(줄바꿈 구분)", Editor = PropEditorKind.StringList }, - new() { Key = "IsRequiredValue", Label = "필수 입력", Editor = PropEditorKind.Choice, Choices = new[] { "No", "Yes" } }, + Runtime.IsRequiredValue, new() { Key = "DataTableField", Label = "데이터 필드", Editor = PropEditorKind.Text }, + // 콤보의 배점은 Score 가 아니라 ItemScore 다 — ComboBox.vb Score 게터는 저장값을 읽지 않고 + // ItemScore 를 "/" 로 쪼개 SelectedIndex 번째를 돌려준다. 항목 순서와 1:1 로 맞춰야 한다. + new() { Key = "ItemScore", Label = "항목 배점", Editor = PropEditorKind.Text }, + Runtime.PrintOutPut, + Runtime.PreventEditing, }, }, new() @@ -106,6 +193,13 @@ public static class ControlRegistry { new() { Key = "Format", Label = "형식", Editor = PropEditorKind.Choice, Default = "Long", Choices = new[] { "Long", "Short", "Time", "Custom" } }, new() { Key = "CustomFormat", Label = "사용자 형식", Editor = PropEditorKind.Text }, + Runtime.IsRequiredValue, + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.PrintOutPut, + Runtime.PreventEditing, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataOnViewMode, + Runtime.ReLoadDataMsgNoCheck, }, }, new() @@ -115,6 +209,9 @@ public static class ControlRegistry { new() { Key = "BackColor", Label = "배경색", Editor = PropEditorKind.Color }, new() { Key = "BorderStyle", Label = "테두리", Editor = PropEditorKind.Choice, Default = "None", Choices = new[] { "None", "FixedSingle", "Fixed3D" } }, + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.IsRequiredValue, + Runtime.PrintOutPut, }, }, new() @@ -123,14 +220,30 @@ public static class ControlRegistry Properties = new PropertyDef[] { new() { Key = "Text", Label = "제목", Editor = PropEditorKind.Text }, + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.IsRequiredValue, + Runtime.PrintOutPut, }, }, new() { + // 방향은 크기가 아니라 Orientation 이 정한다 — MLine.vb:181-190 + // Horizontal → DrawLine(0,0,Width,0) / Vertical → DrawLine(0,0,0,Height), 인쇄 경로도 동일. + // Orientation 이 없으면 런타임은 Horizontal 로 보고 (0,0)→(Width,0) 을 그린다. + // 그래서 폭 1·높이 210 으로 '세로처럼' 만든 선은 EMR 에서 1px 점이 된다 — 디자이너에만 보인다. + // 운영 선 32,599개 중 Orientation 보유 12,811개이고 그 중 Vertical 이 12,721개다(--db-lines). Type = "Line", DisplayName = "선", DefaultW = 200, DefaultH = 1, Properties = new PropertyDef[] { new() { Key = "LineColor", Label = "선 색", Editor = PropEditorKind.Color }, + new() { Key = "Orientation", Label = "방향", Editor = PropEditorKind.Choice, + Default = "Horizontal", Choices = new[] { "Horizontal", "Vertical" } }, + new() { Key = "BorderWidth", Label = "굵기", Editor = PropEditorKind.Number, Default = "1" }, + // System.Drawing.Drawing2D.DashStyle. Custom 은 뺐다 — DashPattern 없이 Custom 을 고르면 + // 런타임이 예외를 내거나 실선으로 떨어진다(운영에도 Custom 은 0건). + new() { Key = "DashStyle", Label = "선 모양", Editor = PropEditorKind.Choice, + Default = "Solid", Choices = new[] { "Solid", "Dash", "Dot", "DashDot", "DashDotDot" } }, + Runtime.PrintOutPut, }, }, new() @@ -140,6 +253,17 @@ public static class ControlRegistry { new() { Key = "DataInterfaceTag", Label = "데이터 태그", Editor = PropEditorKind.DataInterfaceTag }, new() { Key = "SizeMode", Label = "크기 모드", Editor = PropEditorKind.Choice, Default = "Normal", Choices = new[] { "Normal", "StretchImage", "AutoSize", "CenterImage", "Zoom" } }, + // 서명란 — 이 값이 True 여야 런타임이 서명 수집 대상으로 잡는다(MPictureBox.vb:1480, 사용처 :992/:1075/:1212…). + // 이걸 못 걸면 서명이 필요한 동의서를 SheetMe 만으로 새로 만들 수 없다. + new() { Key = "IsSignature", Label = "서명란", Editor = PropEditorKind.Toggle, Default = "False" }, + // 서명이 여러 개인 서식에서 몇 번째 칸인지(MPictureBox.vb:28 miSignatureIndex) + new() { Key = "SignatureIndex", Label = "서명 순번", Editor = PropEditorKind.Number, Default = "0" }, + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.PrintOutPut, + Runtime.PreventEditing, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataOnViewMode, + Runtime.ReLoadDataMsgNoCheck, }, }, new() @@ -149,10 +273,20 @@ public static class ControlRegistry { new() { Key = "Formula", Label = "수식", Editor = PropEditorKind.MultilineText }, new() { Key = "Text", Label = "텍스트", Editor = PropEditorKind.Text }, + // 계산박스에는 Score 를 노출하지 않는다 — MCalcBox.vb Score 게터는 저장값이 아니라 + // Me.Text 를 숫자로 읽어 돌려주고, 세터는 반대로 Text 를 덮어쓴다. 배점은 이 칸이 아니라 + // 합산 대상인 CheckBox/RadioButton 쪽에 준다. + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.IsRequiredValue, + Runtime.PrintOutPut, + Runtime.PreventEditing, + Runtime.ReLoadDataOnSavedSheet, + Runtime.ReLoadDataMsgNoCheck, }, }, new() { + // MButton 에는 PrintOutPut 이 없다(MButton.vb 에 해당 속성 자체가 없음) — 붙이지 않는다 Type = "Button", DisplayName = "버튼", DefaultW = 90, DefaultH = 26, Properties = new PropertyDef[] { @@ -162,6 +296,8 @@ public static class ControlRegistry new() { Key = "GetDataActionTagControl", Label = "입력 파라미터 컨트롤", Editor = PropEditorKind.Text }, new() { Key = "KeyboardShortcut", Label = "단축키", Editor = PropEditorKind.Text }, new() { Key = "BackColor", Label = "배경색", Editor = PropEditorKind.Color }, + new() { Key = "Visible", Label = "표시", Editor = PropEditorKind.Toggle, Default = "True" }, + Runtime.PreventEditing, }, }, new() diff --git a/src/SheetMe.Core/Catalog/LegacyPropertyCatalog.cs b/src/SheetMe.Core/Catalog/LegacyPropertyCatalog.cs new file mode 100644 index 0000000..bb97acf --- /dev/null +++ b/src/SheetMe.Core/Catalog/LegacyPropertyCatalog.cs @@ -0,0 +1,172 @@ +namespace SheetMe.Core.Catalog; + +/// +/// 타입별로 레거시가 실제로 저장하는 속성 키 목록 — '속성 추가' 자동완성의 원천. +/// +/// 왜 필요한가. 인스펙터가 큐레이션한 속성 밖의 값을 걸려면 '속성 추가'로 키를 손수 쳐야 하는데, +/// 키 이름을 외워서 정확히 맞혀야 한다. 철자가 틀리면 아무 경고 없이 무의미한 속성이 하나 생기고, +/// 그 서식은 배포된 뒤 임상 화면에서야 기대한 동작을 안 한다는 형태로 드러난다. +/// 함정이 실재한다 — 라벨은 소문자 visible, 나머지는 Visible, +/// 체크박스·라디오는 또 ControlVisible 을 쓴다. PrintOutPut 의 대문자 P 도 마찬가지다. +/// +/// 출처. 운영 DB 디자인 1,271건·컨트롤 164,091개를 훑어 실제로 저장돼 있는 키를 집계했다 +/// (진단 --db-props). 레거시 소스의 Public Property 목록이 아니라 실제 저장 결과를 쓴 이유는, +/// 노출은 되지만 아무도 안 쓰는 키까지 제안하면 목록이 길어져 고르기 어려워지고, +/// 반대로 사이트가 추가한 키는 소스에 없어도 실데이터에는 있기 때문이다. +/// +/// 여기 없는 키도 여전히 손으로 입력할 수 있다 — 이 목록은 제안이지 검증이 아니다. +/// 레이아웃 계열(Location/Size/Name/TabIndex 등)은 인스펙터가 따로 다루므로 제안에서 뺐다. +/// +public static class LegacyPropertyCatalog +{ + #region Member Fields + // 모든 타입에 공통으로 붙는 뼈대 속성 — 인스펙터의 위치·크기·이름 행이 이미 담당한다. + // 제안 목록에 넣으면 '속성 추가'로 Location 을 만들어 Bounds 와 어긋나게 만들 수 있다. + private static readonly HashSet Skeleton = new(StringComparer.Ordinal) + { + "Location", "LocationOnBase", "Size", "Name", "TabIndex", "DataBindings", + "Margin", "DrawingLocation", "Font", "LinkToNewDesign", + }; + + private static readonly Dictionary byType = new(StringComparer.Ordinal) + { + ["Label"] = new[] + { + "visible", "PrintOutPut", "PreventEditing", "IsRequiredValue", "DisplaySequence", + "UseCompatibleTextRendering", "PrintBackColor", "IsColorLabel", "ControlContextMenu", + "SMSWebControlName", "RightToLeft", "AutoSize", "FlatStyle", "BackgroundImageLayout", + // 문서 일련번호(MSequence 계열) — 라벨에 붙어 서식 번호를 찍는다 + "SequenceCode", "SequenceType", "SequenceNumber", "CheckSequenceAtSaving", + "AssociatedControl", "Format_SequenceNumber", "Format_PrefixSequenceType", "Format_DelimeterChar", + }, + ["Line"] = new[] + { + "Orientation", "BorderWidth", "DashStyle", "PrintOutPut", "PreventEditing", + "IsRequiredValue", "DisplaySequence", "InitialValue", "SetXPoint", "SetYPoint", + "TabStop", "ControlContextMenu", "SMSWebControlName", "Anchor", "Dock", + }, + ["TextBox"] = new[] + { + "PrintOutPut", "PreventEditing", "IsRequiredValue", "AutoHeight", "TogetherAutoHeight", + "ReLoadDataOnSavedSheet", "ReLoadDataOnViewMode", "ReLoadDataMsgNoCheck", + "DisplaySequence", "PrintTextFITOption", "CalendarMode", "DeleteYon", "TextChang", + "EnterTabYon", "UpperWrite", "AdpDteLink", "LineCount", "LineCountExplanation", + "ScrollBars", "Enabled", "MaxLength", "PrintBackColor", "ControlContextMenu", + "SMSWebControlName", "OnValue", "OffValue", "LinkedLabelControlName", + "AfterChangeInvokeMDataTable", "CheckDataTablePrintOut", "DataTableField", + "Same_UseMode", "Same_TextValue", "Same_SetFont", "Same_SetTextColor", "Same_SetBackColor", + }, + ["CheckBox"] = new[] + { + "Score", "PrintOutPut", "PreventEditing", "IsRequiredValue", "ControlVisible", + "ReLoadDataOnSavedSheet", "ReLoadDataMsgNoCheck", "DisplaySequence", + "CheckColor", "CheckForeColor", "CheckAlign", "CheckState", "TextAlign", + "UseVisualStyleBackColor", "UseCompatibleTextRendering", "PrintBackColor", + "FocusedControl_AfterClick", "ToolTipText", "Enabled", "TabStop", "AutoSize", + "FlatStyle", "ControlContextMenu", "SMSWebControlName", "DataTableField", + }, + ["RadioButton"] = new[] + { + "Score", "PrintOutPut", "PreventEditing", "IsRequiredValue", "ControlVisible", + "ReLoadDataOnSavedSheet", "ReLoadDataMsgNoCheck", "DisplaySequence", + "CheckColor", "CheckForeColor", "CheckAlign", "TextAlign", "TabStop", + "UseVisualStyleBackColor", "UseCompatibleTextRendering", + "FocusedControl_AfterClick", "LinkedExpandablePanel_ToExpand", "LinkedExpandablePanel_ToClose", + "Enabled", "AutoSize", "FlatStyle", "ControlContextMenu", "SMSWebControlName", "DataTableField", + }, + ["ComboBox"] = new[] + { + "ItemScore", "PrintOutPut", "PreventEditing", "IsRequiredValue", "DisplaySequence", + "InitialValueDataTable", "DataTableItms", "DataTableField", "EventHandlerMappingTag", + "FormattingEnabled", "DropDownStyle", "FlatStyle", "AutoCompleteCustomSource", + "ControlContextMenu", "SMSWebControlName", + }, + ["CalcBox"] = new[] + { + "PrintOutPut", "PreventEditing", "IsRequiredValue", "Visible", "DisplaySequence", + "ReLoadDataOnSavedSheet", "ReLoadDataMsgNoCheck", "TimeMode", "QueryMode", + "ZeroScore_Blank", "FormulaResultCheck", "CalendarMode", "EnterTabYon", + "Multiline", "MaxLength", "ReadOnly", "DataTableField", + "ControlContextMenu", "SMSWebControlName", + }, + ["PictureBox"] = new[] + { + "IsSignature", "SignatureIndex", "PrintOutPut", "PreventEditing", "IsRequiredValue", + "ReLoadDataOnSavedSheet", "ReLoadDataOnViewMode", "ReLoadDataMsgNoCheck", + "DisplaySequence", "CoordinateYon", "NoImageSave", "IsTemplate", + "VisibleText", "TextFont", "DataTableField", "Enabled", "TabStop", "Cursor", + "ControlContextMenu", "SMSWebControlName", + }, + ["DateTimePicker"] = new[] + { + "PrintOutPut", "PreventEditing", "IsRequiredValue", "DisplaySequence", + "ReLoadDataOnSavedSheet", "ReLoadDataOnViewMode", "ReLoadDataMsgNoCheck", + "TimePrint", "DayPrint", "BringEmdTime", "ShowUpDown", "AdpDteLink", + "DataTableField", "TabStop", "CalendarFont", "CalendarMonthBackground", + "CalendarTitleBackColor", "CalendarTitleForeColor", "CalendarForeColor", + "CalendarTrailingForeColor", "ControlContextMenu", "SMSWebControlName", + }, + ["MaskedTextBox"] = new[] + { + "PrintOutPut", "PreventEditing", "IsRequiredValue", "AutoHeight", "DisplaySequence", + "ReLoadDataOnSavedSheet", "ReLoadDataOnViewMode", "ReLoadDataMsgNoCheck", + "CalendarMode", "TimePadMode", "ValidatingType", "PrintTextFITOption", + "DeleteYon", "TextChang", "AdpDteLink", "AfterChangeInvokeMDataTable", + "DataTableField", "PrintBackColor", "Enabled", "ControlContextMenu", "SMSWebControlName", + }, + ["Panel"] = new[] + { + "PrintOutPut", "PreventEditing", "IsRequiredValue", "Visible", "DisplaySequence", + "PrintBackColor", "BackgroundImageLayout", "Dock", "TabStop", "AutoHeight", + // 접이식 패널(MExpandablePanel) 계열 + "HeaderText", "TitleHeight", "ExpandHeight", "IsExpanded", "ExpandButtonPosition", "InitiallyClose", + "ControlContextMenu", "SMSWebControlName", + }, + ["GroupBox"] = new[] + { + "PrintOutPut", "PreventEditing", "IsRequiredValue", "Visible", "DisplaySequence", + "UseCompatibleTextRendering", "TabStop", "ControlContextMenu", "SMSWebControlName", + }, + ["Button"] = new[] + { + "PreventEditing", "IsRequiredValue", "Visible", "DisplaySequence", "InitialValue", + "EventHandlerMappingTag", "GetDataActionTagControlChange", "CalendarMode", + "UseVisualStyleBackColor", "UseCompatibleTextRendering", "TextAlign", "ImageAlign", + "BackgroundImage", "BackgroundImageLayout", "FlatStyle", "Cursor", + "ControlContextMenu", "SMSWebControlName", + }, + ["DataTable"] = new[] + { + "PreventEditing", "IsRequiredValue", "Visible", "DisplaySequence", "InitialValue", + "BackgroundImage", "BackgroundImageLayout", "ControlContextMenu", "SMSWebControlName", + }, + }; + #endregion + + #region Methods + /// + /// 해당 타입에서 쓰이는 속성 키 제안 — 이미 있는 키와 인스펙터가 이미 다루는 키는 뺀다. + /// 알 수 없는 타입이면 빈 목록(제안 없이 자유 입력). + /// + public static IReadOnlyList SuggestFor(string type, IEnumerable existingKeys) + { + if (!byType.TryGetValue(type, out var keys)) + { + return Array.Empty(); + } + var taken = new HashSet(existingKeys, StringComparer.Ordinal); + var curated = ControlRegistry.Find(type)?.Properties.Select(p => p.Key) ?? Enumerable.Empty(); + foreach (var key in curated) + { + taken.Add(key); + } + return keys + .Where(k => !taken.Contains(k) && !Skeleton.Contains(k)) + .OrderBy(k => k, StringComparer.OrdinalIgnoreCase) + .ToList(); + } + + /// 타입이 제안 목록을 갖고 있는지(진단용) + public static bool Knows(string type) => byType.ContainsKey(type); + #endregion +} diff --git a/src/SheetMe.Core/Catalog/LineGeometry.cs b/src/SheetMe.Core/Catalog/LineGeometry.cs new file mode 100644 index 0000000..fbb7df6 --- /dev/null +++ b/src/SheetMe.Core/Catalog/LineGeometry.cs @@ -0,0 +1,107 @@ +using System.Globalization; +using SheetMe.Core.Models; + +namespace SheetMe.Core.Catalog; + +/// +/// 선(MLine)의 모양 규칙 — 레거시 컨트롤이 스스로 강제하는 불변식을 그대로 옮긴 것. +/// +/// 레거시 MLine 은 크기를 자유롭게 두지 않는다. OnResize 가 매번 두께 축을 BorderWidth 로 되돌리고 +/// (MLine.vb: Horizontal 이면 Me.Height = miBorderWidth, Vertical 이면 Me.Width = miBorderWidth), +/// Orientation 세터는 길이를 보존한 채 축을 바꾼다(Horizontal → Me.Width = Me.Height, 반대도 대칭). +/// 그래서 레거시 디자이너에서는 가로선을 세로로 '늘려서' 만들 수 없다 — 늘리면 즉시 되돌아온다. +/// +/// 이 규칙을 옮기지 않으면 디자이너와 EMR 이 서로 다른 그림을 보여 준다. 폭 1·높이 210 으로 +/// 세로처럼 만든 선은 우리 캔버스에선 세로선이지만, 저장 XML 에 Orientation 이 없으므로 +/// 런타임은 Horizontal 로 보고 (0,0)→(1,0) 즉 1px 점을 그린다 — 기록지에서 선이 사라진다. +/// +/// 운영 데이터 32,599개 선에서 경계 모양과 Orientation 이 어긋나는 건 0건이다(--db-lines). +/// 레거시가 구조적으로 막아 왔다는 뜻이고, 우리도 같은 방식으로 막는다. +/// +public static class LineGeometry +{ + #region Methods + /// 대상이 선인지 + public static bool IsLine(ControlElement element) + => string.Equals(element.Type, "Line", StringComparison.Ordinal); + + /// Orientation 이 Vertical 인지 — 키가 없으면 Horizontal(MLine.vb 필드 초기값) + public static bool IsVertical(ControlElement element) + => string.Equals(element.Props.GetText("Orientation"), "Vertical", StringComparison.OrdinalIgnoreCase); + + /// 선 두께 — BorderWidth, 키가 없으면 1(MLine.vb 생성자 miBorderWidth = 1) + public static double ThicknessOf(ControlElement element) + { + var text = element.Props.GetText("BorderWidth"); + if (text is not null + && double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var value) + && value >= 1) + { + return value; + } + return 1; + } + + /// + /// 두께 축을 BorderWidth 로 맞춘다(레거시 OnResize 이식) — 바뀌었으면 true. + /// + /// 길이 축은 건드리지 않는다. 사용자가 끄는 것은 길이이고, 두께는 속성이 정한다. + /// + public static bool NormalizeThickness(ControlElement element) + { + if (!IsLine(element)) + { + return false; + } + var thickness = ThicknessOf(element); + if (IsVertical(element)) + { + if (Math.Abs(element.Bounds.W - thickness) < 0.001) + { + return false; + } + element.Bounds.W = thickness; + } + else + { + if (Math.Abs(element.Bounds.H - thickness) < 0.001) + { + return false; + } + element.Bounds.H = thickness; + } + return true; + } + + /// + /// 방향 전환 — 길이를 보존한 채 축을 바꾼다(레거시 Orientation 세터 이식). + /// + /// 레거시는 Me.Width = Me.Height (또는 반대)로 길이를 옮긴 뒤 OnResize 가 두께를 되돌린다. + /// 두 단계를 합치면 '가로 200×1 ↔ 세로 1×200' 이 된다. + /// + public static void ApplyOrientation(ControlElement element, bool vertical) + { + if (!IsLine(element)) + { + return; + } + var thickness = ThicknessOf(element); + // 전환 전 길이 = 지금 방향의 긴 축 + var length = IsVertical(element) ? element.Bounds.H : element.Bounds.W; + if (vertical) + { + element.Props.SetText("Orientation", "Vertical"); + element.Bounds.W = thickness; + element.Bounds.H = length; + } + else + { + // Horizontal 은 MLine 의 기본값이라 레거시 직렬화기도 키를 생략한다 + // () — 우리도 지워서 원문 모양을 맞춘다. + element.Props.Remove("Orientation"); + element.Bounds.W = length; + element.Bounds.H = thickness; + } + } + #endregion +} diff --git a/src/SheetMe.Designer/Diagnostics/EditSmoke.cs b/src/SheetMe.Designer/Diagnostics/EditSmoke.cs index 3b83531..e98a14d 100644 --- a/src/SheetMe.Designer/Diagnostics/EditSmoke.cs +++ b/src/SheetMe.Designer/Diagnostics/EditSmoke.cs @@ -755,6 +755,71 @@ public static class EditSmoke designer.Selection.Clear(); } + // 20-5e) 선 기하 — 레거시 MLine 은 두께 축을 BorderWidth 로 강제하고, + // 방향 전환은 길이를 보존한 채 축을 바꾼다. 이걸 안 지키면 디자이너와 EMR 이 다른 그림을 그린다. + { + var beforeLine = designer.Pages[0].Controls.ToList(); + designer.AddControlAt("Line", new Point(60, 300)); + var line = designer.Pages[0].Controls.Except(beforeLine).Single(); + Check("선: 기본은 가로 200×1", Math.Abs(line.Width - 200) < 0.5 && Math.Abs(line.Height - 1) < 0.5, + $"{line.Width}×{line.Height}"); + Check("선: 기본에는 Orientation 키가 없다(레거시 DefaultValue 와 동일)", + line.Model.Props.GetText("Orientation") is null); + + // 세로로 끌어 늘려도 두께는 되돌아온다 — '세로처럼 보이지만 EMR 에선 점' 상태를 만들 수 없다 + line.Height = 210; + SheetMe.Core.Catalog.LineGeometry.NormalizeThickness(line.Model); + Check("선: 두께는 끌어서 못 바꾼다", Math.Abs(line.Height - 1) < 0.5, $"높이 {line.Height}"); + + // 방향 전환 — 길이 보존 + SheetMe.Core.Catalog.LineGeometry.ApplyOrientation(line.Model, vertical: true); + Check("선: 세로 전환은 길이를 보존", Math.Abs(line.Model.Bounds.W - 1) < 0.5 + && Math.Abs(line.Model.Bounds.H - 200) < 0.5, + $"{line.Model.Bounds.W}×{line.Model.Bounds.H}"); + Check("선: 세로면 Orientation=Vertical 이 기록된다", + line.Model.Props.GetText("Orientation") == "Vertical"); + + // 굵기를 키우면 두께 축만 따라간다 + line.Model.Props.SetText("BorderWidth", "3"); + SheetMe.Core.Catalog.LineGeometry.NormalizeThickness(line.Model); + Check("선: 굵기는 두께 축만 바꾼다", Math.Abs(line.Model.Bounds.W - 3) < 0.5 + && Math.Abs(line.Model.Bounds.H - 200) < 0.5, + $"{line.Model.Bounds.W}×{line.Model.Bounds.H}"); + + // 가로로 되돌리면 Orientation 키가 지워진다(레거시 직렬화기가 기본값을 생략하는 것과 같다) + SheetMe.Core.Catalog.LineGeometry.ApplyOrientation(line.Model, vertical: false); + Check("선: 가로로 되돌리면 Orientation 키가 지워진다", + line.Model.Props.GetText("Orientation") is null + && Math.Abs(line.Model.Bounds.W - 200) < 0.5 + && Math.Abs(line.Model.Bounds.H - 3) < 0.5, + $"{line.Model.Bounds.W}×{line.Model.Bounds.H}"); + + designer.Selection.SetSingle(line); + designer.DeleteSelection(); + } + + // 20-5f) 선택 밖 컨트롤을 Ctrl+드래그하면 그것이 끌려야 한다(기존 선택은 유지) + { + var anchor = Find("CheckBox"); + var grabbed = Find("Label"); + designer.Selection.SetSingle(anchor); + var anchorAt = new Point(anchor.X, anchor.Y); + var box = designer.WorldBoundsOf(grabbed); + var from = new Point(box.X + box.Width / 2, box.Y + box.Height / 2); + var grabbedX = grabbed.X; + // Alt 로 정렬 스냅을 끈다 — 스냅이 걸리면 이동량이 가이드에 붙어 델타 단언이 흔들린다 + var ctrlAlt = new PointerContext(true, false, true, 1); + designer.Interaction.PointerDown(from, ctrlAlt); + designer.Interaction.PointerMove(new Point(from.X + 30, from.Y), ctrlAlt); + designer.Interaction.PointerUp(new Point(from.X + 30, from.Y), ctrlAlt); + Check("Ctrl+드래그: 잡은 컨트롤이 움직인다", Math.Abs(grabbed.X - (grabbedX + 30)) < 2, + $"{grabbedX} → {grabbed.X}"); + Check("Ctrl+드래그: 기존 선택도 함께 움직인다(합집합)", Math.Abs(anchor.X - (anchorAt.X + 30)) < 2, + $"{anchorAt.X} → {anchor.X}"); + designer.Undo.Undo(); + designer.Selection.Clear(); + } + // 20-5d) 태그 카탈로그 — 레거시에서 주석 처리된 태그를 고를 수 있으면 안 된다 Check("태그 카탈로그: 미구현 3종 제외", !SheetMe.Core.Catalog.LegacyTagCatalog.DataInterfaceTags.Contains("PAT_BMI") @@ -779,6 +844,22 @@ public static class EditSmoke var addRow = designer.Inspector.Rows .OfType().FirstOrDefault(); Check("고급: 속성 추가 행 존재", addRow is not null); + // 자동완성 — 타입별 유효 키를 제안한다(철자를 외워 맞히지 않도록) + Check("고급: 제안 목록 존재", addRow!.Suggestions.Count > 0, $"{addRow.Suggestions.Count}개"); + Check("고급: 이미 있는 키와 큐레이션된 키는 제안에서 빠진다", + !addRow.Suggestions.Contains("AutoHeight") && !addRow.Suggestions.Contains("Text"), + "AutoHeight/Text 는 TextBox 인스펙터가 이미 다룬다"); + addRow.KeyText = "Print"; + Check("고급: 부분 일치로 좁혀진다", addRow.Matches.Count > 0 + && addRow.Matches.All(m => m.Contains("Print", StringComparison.OrdinalIgnoreCase)), + string.Join(",", addRow.Matches)); + Check("고급: 접두 일치가 앞에 온다", + addRow.Matches[0].StartsWith("Print", StringComparison.OrdinalIgnoreCase), addRow.Matches[0]); + addRow.KeyText = string.Empty; + // 라벨의 소문자 visible — 대문자로 쓰면 라벨이 그대로 보인다. 제안이 이 함정을 덮어야 한다. + var labelSuggest = SheetMe.Core.Catalog.LegacyPropertyCatalog.SuggestFor("Label", Array.Empty()); + Check("고급: 라벨 제안에는 대문자 Visible 이 없다", + !labelSuggest.Contains("Visible"), string.Join(",", labelSuggest.Where(s => s.Contains("isible")))); addRow!.KeyText = "EnterTabYon"; addRow.AddCommand!.Execute(null, EventArgs.Empty); Check("고급: 속성 추가됨", advTarget.Model.Props.Contains("EnterTabYon")); diff --git a/src/SheetMe.Designer/Services/InteractionController.cs b/src/SheetMe.Designer/Services/InteractionController.cs index 0dd7e25..de7ba12 100644 --- a/src/SheetMe.Designer/Services/InteractionController.cs +++ b/src/SheetMe.Designer/Services/InteractionController.cs @@ -134,6 +134,14 @@ public sealed class InteractionController mode = Mode.Move; toggleOnUp = false; collapseOnUp = false; + // Ctrl/Shift 클릭은 선택을 바꾸지 않고 업에서 토글한다(:97). 그 상태로 드래그가 시작되면 + // 잡은 컨트롤이 아니라 기존 선택분이 끌려간다 — 선택이 비어 있으면 아무것도 안 끌린다. + // 드래그가 실제로 시작되는 이 지점에서 잡은 것을 선택에 넣는다(기존 다중선택은 유지 — 업 토글과 같은 규칙). + if (!downControl.IsSelected) + { + var mates = designer.GroupMatesOf(downControl); + designer.Selection.Set(designer.Selection.Items.Union(mates).ToList(), downControl); + } BeginMove(); DoMove(world, ctx); // 전환 프레임부터 즉시 추종 } @@ -358,6 +366,12 @@ public sealed class InteractionController vm.Y = Math.Round(newRect.Y + (orig.Y - groupBounds0.Y) * sy - offset.Y); vm.Width = Math.Max(1, Math.Round(orig.Width * sx)); vm.Height = Math.Max(1, Math.Round(orig.Height * sy)); + // 선은 두께를 끌어서 바꿀 수 없다 — 레거시 MLine.OnResize 가 매번 BorderWidth 로 되돌린다. + // 이걸 허용하면 세로로 늘린 가로선이 디자이너에만 보이고 EMR 에서는 1px 점이 된다. + if (SheetMe.Core.Catalog.LineGeometry.NormalizeThickness(vm.Model)) + { + vm.NotifyAllChanged(); + } } designer.Selection.NotifyBoundsChanged(); diff --git a/src/SheetMe.Designer/Themes/DesignerTheme.xaml b/src/SheetMe.Designer/Themes/DesignerTheme.xaml index 19e94b1..675085c 100644 --- a/src/SheetMe.Designer/Themes/DesignerTheme.xaml +++ b/src/SheetMe.Designer/Themes/DesignerTheme.xaml @@ -131,6 +131,35 @@ + + +