프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / MarkupToPDF / Controls / Text / TextControl.cs @ 1af0f150

이력 | 보기 | 이력해설 | 다운로드 (46.3 KB)

1
using MarkupToPDF.Common;
2
using MarkupToPDF.Controls.Common;
3
using MarkupToPDF.Serialize.Core;
4
using MarkupToPDF.Serialize.S_Control;
5
using System;
6
using System.Collections.Generic;
7
using System.ComponentModel;
8
using System.Linq;
9
using System.Text;
10
using System.Threading.Tasks;
11
using System.Windows;
12
using System.Windows.Controls;
13
using System.Windows.Media;
14
using System.Windows.Shapes;
15
using Markus.Fonts;
16
using System.Windows.Markup;
17

    
18
namespace MarkupToPDF.Controls.Text
19
{    
20
    public class TextControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, ITextControl, IMarkupControlData
21
    {
22
        public event PropertyChangedEventHandler PropertyChanged;
23

    
24
        private const string PART_Grid = "PART_Grid";
25
        private const string PART_Border = "PART_Border";
26
        private const string PART_TextBox = "PART_TextBox";
27
        private const string PART_TextPath = "PART_TextPath";
28
        private const string PART_TextBlock = "PART_TextBlock";
29
        private const string PART_Canvas = "PART_TextControlCanvas";
30
        private const string PART_BaseTextbox_Caret = "Caret";
31
        
32
        //private const string PART_TextPrefix = "PART_TextPrefix";
33
      
34
        public Path Base_TextPath = null;
35
        public Grid Base_Grid = null;
36
        public Border Base_Border = null;
37
        public Canvas Base_Canvas = null;
38
        //public TextBlock Base_TextPrefixBlock = null;
39
        public TextBlock Base_TextBlock = null;
40
        public TextBox Base_TextBox = null;
41
        public Border BaseTextbox_Caret = null;
42

    
43
        public RotateTransform _rotation = null;
44
        public TranslateTransform _translation = null;
45
        public ScaleTransform _scale = null;
46

    
47
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
48

    
49
        public override bool IsSelected
50
        {
51
            get
52
            {
53
                return (bool)GetValue(IsSelectedProperty);
54
            }
55
            set
56
            {
57
                SetValue(IsSelectedProperty, value);
58
                OnPropertyChanged("IsSelected");
59
            }
60
        }
61

    
62
        #region Internal Method
63

    
64
        public TextControl()
65
        {
66
            //this.DefaultStyleKey = typeof(TextControl);
67
        }
68

    
69
        static TextControl()
70
        {
71
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TextControl), new FrameworkPropertyMetadata(typeof(TextControl)));
72
            //ResourceDictionary dictionary = new ResourceDictionary();
73
            //dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute);
74
            //if (!Application.Current.Resources.MergedDictionaries.Any(x => x.Source == dictionary.Source))
75
            //    Application.Current.Resources.MergedDictionaries.Add(dictionary);
76

    
77
        }
78

    
79
        public override void Copy(CommentUserInfo lhs)
80
        {
81
            if(lhs is TextControl item)
82
            {
83
                Text = item.Text;
84
                StartPoint = new Point(item.StartPoint.X, item.StartPoint.Y);
85
                EndPoint = new Point(item.EndPoint.X, item.EndPoint.Y);
86
                CanvasX = item.CanvasX;
87
                CanvasY = item.CanvasY;
88
                BoxWidth = item.BoxWidth;
89
                BoxHeight = item.BoxHeight;
90
                ControlType_No = item.ControlType_No;
91
                LineSize = item.LineSize;
92
                TextSize = item.TextSize;
93
                StrokeColor = item.StrokeColor;
94
                ArcLength = item.ArcLength;
95
                FontSize = item.FontSize;
96
                UserID = item.UserID;
97
                IsHighLight = item.IsHighLight;
98
                CommentAngle = item.CommentAngle;
99
                PointSet = item.PointSet.ConvertAll(x => new Point(x.X, x.Y));
100
                Opacity = item.Opacity;
101
                TextFamily = item.FontFamily;
102
                TextStyle = item.TextStyle;
103
                TextWeight = item.TextWeight;
104
                UnderLine = item.UnderLine;
105
            }
106
        }
107

    
108
        public override CommentUserInfo Clone()
109
        {
110
            var clone = new TextControl();
111
            clone.Copy(this);
112
            return clone;
113
        }
114

    
115
        public override void OnApplyTemplate()
116
        {
117
            base.OnApplyTemplate();
118

    
119
            Base_TextPath = GetTemplateChild(PART_TextPath) as Path;
120
            Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
121
            Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock;
122
            Base_Grid = GetTemplateChild(PART_Grid) as Grid;
123
            Base_Border = GetTemplateChild(PART_Border) as Border;
124
            Base_Canvas = GetTemplateChild(PART_Canvas) as Canvas;
125
            BaseTextbox_Caret = GetTemplateChild(PART_BaseTextbox_Caret) as Border;
126
            //BaseTextbox_Caret.Height = this.Base_TextBox.FontSize;
127
            this.Base_TextBox.Text = this.Text;
128
            this.Base_TextBox.CaretIndex = this.Base_TextBox.Text.Length;
129
            this.Base_TextBox.CaretBrush = new SolidColorBrush(Colors.Transparent);
130
            this.Base_TextBox.ApplyTemplate();
131
            MoveCustomCaret();
132
            if(this.Base_TextBox.FontSize > this.BaseTextbox_Caret.Height)
133
            {
134
                BaseTextbox_Caret.Height = this.Base_TextBox.FontSize;
135
            }
136
            //BaseTextbox_Caret.Height = Base_TextBox.ActualHeight - 5;
137

    
138
            this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
139
            this.Base_TextBox.TextChanged += new TextChangedEventHandler(Base_TextBox_TextChanged);
140
            this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged);
141
            this.Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
142
            this.Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);            
143
            this.Base_TextBox.SelectionChanged += (sender, e) => MoveCustomCaret();
144
            
145
            SetText();
146
            DrawingCloud();
147
        }
148

    
149
        public void SetFontFamily(FontFamily fontFamily)
150
        {
151
            
152
            if (this.Base_TextBlock != null) {
153
                this.Base_TextBlock.FontFamily = fontFamily;
154
            }
155

    
156
            if (this.Base_TextBox != null) {
157
                this.Base_TextBox.FontFamily = fontFamily;
158
            }
159
            this.FontFamily = fontFamily;
160
            this.TextFamily = fontFamily;
161
        }
162

    
163

    
164
        /// <summary>
165
        /// Moves the custom caret on the canvas.
166
        /// </summary>
167
        public void MoveCustomCaret()
168
        {
169

    
170
            var caretLocation = this.Base_TextBox.GetRectFromCharacterIndex(this.Base_TextBox.CaretIndex).Location;
171

    
172
            if (!double.IsInfinity(caretLocation.X)) {
173
                Canvas.SetLeft(this.BaseTextbox_Caret, caretLocation.X);
174
            }
175

    
176
            if (!double.IsInfinity(caretLocation.Y)) {
177
                Canvas.SetTop(this.BaseTextbox_Caret, caretLocation.Y);
178
                //Canvas.SetTop(this.BaseTextbox_Caret, (LineSize.Top - caretLocation.Y));
179
            }
180
        }
181

    
182
        
183

    
184
        public override void ApplyOverViewData()
185
        {
186
            this.OverViewPathData = this.PathData;
187
            if (Text == "")
188
                this.Text = this.OverViewText;
189
            else
190
                this.OverViewText = this.Text;
191
            
192
            this.OverViewPaint = this.Paint;
193

    
194
        }        
195

    
196
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
197
        {
198
            BoxWidth = e.NewSize.Width;
199
            BoxHeight = e.NewSize.Height;
200

    
201
            DrawingCloud();
202
        }
203
        private void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
204
        {
205
            BoxWidth = e.NewSize.Width;
206
            BoxHeight = e.NewSize.Height;
207

    
208
            DrawingCloud();
209
        }
210
        private void Base_TextBox_TextChanged(object sender, TextChangedEventArgs e)
211
        {
212
            if (IsEditingMode)
213
            {
214
                if (Base_TextBox.Text.Contains("|OR||DZ|"))
215
                {
216
                    Base_TextBox.Text = this.Text;
217
                }
218

    
219
                this.Text = Base_TextBox.Text;
220

    
221
            }            
222
            DrawingCloud();
223
        }
224
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
225
        {
226
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
227
            MoveCustomCaret();
228
            Base_TextBox.Focus();
229
            this.IsEditingMode = true;
230
        }
231

    
232
        void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
233
        {
234
            this.Text = Base_TextBox.Text;
235
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
236
            this.IsEditingMode = false;
237
            ApplyOverViewData();
238
        }
239

    
240
        //void TextControl_GotFocus(object sender, RoutedEventArgs e)
241
        //{
242
        //    Base_TextBox.Visibility = Visibility.Visible;
243
        //    Base_TextBlock.Visibility = Visibility.Collapsed;
244
        //    this.Base_TextBox.BorderThickness = new Thickness(1);
245
        //    if (UnderLine != null)
246
        //    {
247
        //        Base_TextBlock.TextDecorations = UnderLine;
248
        //    }
249
        //    if (this.Text != null)
250
        //    {
251
        //        Base_TextBox.Text = this.Text;
252
        //    }
253
        //    IsEditing = true;
254
        //}
255
        //void TextControl_LostFocus(object sender, RoutedEventArgs e)
256
        //{
257
        //    Base_TextBox.Visibility = Visibility.Collapsed;
258
        //    Base_TextBlock.Visibility = Visibility.Visible;
259
        //    this.Text = Base_TextBox.Text;
260
        //    if (UnderLine != null)
261
        //    {
262
        //        Base_TextBlock.TextDecorations = UnderLine;
263
        //    }
264
        //    Base_TextBlock.Margin =
265
        //       new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4, Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
266
        //    IsEditing = false;
267
        //}
268
        public void EditingMode()
269
        {            
270
            TextBoxVisibility = Visibility.Visible;
271
            TextBlockVisibility = Visibility.Collapsed;
272
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
273

    
274
            if (UnderLine != null)
275
                Base_TextBlock.TextDecorations = UnderLine;
276

    
277
        }
278

    
279
        public void UnEditingMode()
280
        {            
281
            TextBoxVisibility = Visibility.Collapsed;         
282
            TextBlockVisibility = Visibility.Visible; 
283
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
284

    
285
            if (UnderLine != null)
286
                Base_TextBlock.TextDecorations = UnderLine;
287

    
288
            
289
        }
290
        public void SetText()
291
        {
292
            if (IsHighLight)
293
            {
294
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
295
                    Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
296
                this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
297
                    Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
298
            }
299
            else
300
            {
301
                //this.BackInnerColor = new SolidColorBrush(Color.FromArgb(0x003, 0xFF, 0xFF, 0xFF));
302
                //this.BackColor = new SolidColorBrush(Color.FromArgb(0x003, 0xFF, 0xFF, 0xFF));
303

    
304
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
305
                    Colors.White.R, Colors.White.G, Colors.White.B));
306

    
307
                this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
308
                    Colors.White.R, Colors.White.G, Colors.White.B));
309
            }
310
            if (Base_TextPath != null)
311
            {
312
                Base_TextPath.StrokeThickness = LineSize.Left;
313
            }
314
            
315
        }
316

    
317
        public void DrawingCloud()
318
        {
319
            List<Point> pCloud = new List<Point>
320
            {
321
                new Point(-LineSize.Left * 0.5, -LineSize.Left * 0.5),
322
                new Point(-LineSize.Left * 0.5, BoxHeight + LineSize.Left * 0.5),
323
                new Point(BoxWidth + LineSize.Left * 0.5, BoxHeight + LineSize.Left * 0.5),
324
                new Point(BoxWidth + LineSize.Left * 0.5 ,-LineSize.Left * 0.5)
325
            };
326
            //this.Base_TextBox.Select(Base_TextBox.Text.Length, 0);
327
            if (Base_TextPath != null)
328
            {
329
                switch (ControlType_No)
330
                {
331
                    case 0:
332
                        {
333
                            PathData = new PathGeometry();
334
                            PathDataInner = (GenerateInner(pCloud));
335
                        }
336
                        break;
337
                    case 1:
338
                        {
339
                            PathData = (Generate_Rect(pCloud));                         
340
                            PathDataInner = (GenerateInner(pCloud));
341
                        }
342
                        break;
343
                    case 2:
344
                        {
345
                            PathData = (Generate(pCloud, this.ArcLength, this.LineSize.Left));
346
                            PathDataInner = (GenerateInner(pCloud));
347
                        }
348
                        break;
349
                }
350
            }
351
        }
352
        #endregion Internal Method
353

    
354
        public void Dispose()
355
        {
356
            //GC.Collect();
357
            ////GC.SuppressFinalize(this);
358
            this.Base_Border = null;
359
            this.Base_Canvas = null;
360
            this.Base_Grid = null;
361
            this.Base_TextBlock = null;
362
            this.Base_TextBox = null;
363
        }
364

    
365
        public override void UpdateControl()
366
        {
367
            if (this.PointSet.Count > 1)
368
            {
369
                this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
370
                this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
371
            }
372
        }
373

    
374
        #region Drawing Cloud Method
375
        public static PathGeometry Generate_Rect(List<Point> pData)
376
        {
377
            PathFigure pathFigure = new PathFigure();
378
            pathFigure.StartPoint = pData[0];
379

    
380
            PolyLineSegment polyline = new PolyLineSegment(pData, true);
381
            pathFigure.Segments.Add(polyline);
382

    
383
            PathGeometry rectPathGeometry = new PathGeometry();
384
            rectPathGeometry.Figures = new PathFigureCollection();
385
            pathFigure.IsClosed = true;
386
            pathFigure.IsFilled = false;
387
            rectPathGeometry.Figures.Add(pathFigure);
388

    
389

    
390
            return rectPathGeometry;
391
        }
392

    
393
        public static PathGeometry Generate(List<Point> pData, double _ArcLength = 20, double _LineSize = 20)
394
        {
395
            var _pathGeometry = new PathGeometry();
396
            double area = MathSet.AreaOf(pData);
397
            bool reverse = (area > 0);
398
            int count = pData.Count;
399
            for (int i = 0; i < count; i++)
400
            {
401
                PathFigure pathFigure = Polygon.CloudControl.GenerateLineWithCloud(pData[i % count], pData[(i + 1) % count], _ArcLength, reverse, _LineSize);
402
                pathFigure.IsClosed = false;
403
                pathFigure.IsFilled = true;
404
                
405
                _pathGeometry.Figures.Add(pathFigure);
406
            }
407

    
408
            return _pathGeometry;
409
        }
410

    
411

    
412
        public static PathGeometry GenerateInner(List<Point> pData)
413
        {
414
            var _pathGeometry = new PathGeometry();
415
            double area = MathSet.AreaOf(pData);
416
            bool reverse = (area > 0);
417
            int count = pData.Count;
418

    
419
            PathFigure pathFigur2 = new PathFigure();
420
            pathFigur2.StartPoint = pData[0];
421

    
422
            PolyLineSegment polyline = new PolyLineSegment(pData, true);
423
            pathFigur2.Segments.Add(polyline);
424

    
425
            pathFigur2.IsClosed = true;
426
            pathFigur2.IsFilled = true;
427
            _pathGeometry.Figures.Add(pathFigur2);
428

    
429
            return _pathGeometry;
430
        }
431
        #endregion
432

    
433
        #region Dependency Properties
434
        public static readonly DependencyProperty ControlTypeProperty =
435
        DependencyProperty.Register("ControlType", typeof(ControlType), typeof(TextControl), new FrameworkPropertyMetadata(ControlType.TextControl));
436

    
437
        public static readonly DependencyProperty ControlType_NoProperty =
438
        DependencyProperty.Register("ControlType_No", typeof(int), typeof(TextControl), new FrameworkPropertyMetadata(0));
439

    
440
        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
441
            "IsSelected", typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
442

    
443
        public static readonly DependencyProperty PathGeometryProperty = DependencyProperty.Register(
444
            "PathGeometry", typeof(PathGeometry), typeof(TextControl), new PropertyMetadata(null, SetPathGeometryChanged));
445

    
446
        public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
447
            "Text", typeof(string), typeof(TextControl), new PropertyMetadata(null));
448

    
449
        public static readonly DependencyProperty OverViewTextProperty = DependencyProperty.Register(
450
            "OverViewText", typeof(string), typeof(TextControl), new PropertyMetadata(null, new PropertyChangedCallback(TextChanged)));
451

    
452
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
453
            "UserID", typeof(string), typeof(TextControl), new PropertyMetadata(null));
454

    
455
        /*public static readonly DependencyProperty FontColorProperty = DependencyProperty.Register(
456
            "FontColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));*/
457

    
458
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
459
            "StrokeColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
460

    
461
        public static readonly DependencyProperty ArcLengthProperty = DependencyProperty.Register(
462
            "ArcLength", typeof(double), typeof(TextControl), new PropertyMetadata((Double)10, PointValueChanged));
463

    
464
        //강인구 추가
465
        public static readonly DependencyProperty IsHighlightProperty = DependencyProperty.Register(
466
            "IsHighLight", typeof(bool), typeof(TextControl), new PropertyMetadata(false, PointValueChanged));
467

    
468
        public static readonly DependencyProperty BackColorProperty = DependencyProperty.Register(
469
            "BackColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
470

    
471
        public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
472
            "BackInnerColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
473

    
474
        public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
475
            "UnderLine", typeof(TextDecorationCollection), typeof(TextControl), new PropertyMetadata(null));
476

    
477
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
478
            "LineSize", typeof(Thickness), typeof(TextControl), new PropertyMetadata(new Thickness(4), PointValueChanged)); //여기만 4인지 모르겠지만 4 그대로 두겠음
479

    
480
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
481
            "PointSet", typeof(List<Point>), typeof(TextControl), new PropertyMetadata(new List<Point>()));
482

    
483
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
484
            "PathData", typeof(Geometry), typeof(TextControl), null);
485

    
486
        public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
487
            "PathDataInner", typeof(Geometry), typeof(TextControl), null);
488

    
489
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
490
            "OverViewPathDataProperty", typeof(Geometry), typeof(TextControl), null);
491

    
492
        public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
493
            "TextStyle", typeof(FontStyle), typeof(TextControl), new PropertyMetadata(FontStyles.Normal));
494

    
495
        public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
496
            "TextFamily", typeof(FontFamily), typeof(TextControl), 
497
                        new PropertyMetadata(new PropertyChangedCallback(TextFamilyPropertyChanged)));
498

    
499
        public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
500
            "TextWeight", typeof(FontWeight), typeof(TextControl), new PropertyMetadata(FontWeights.Normal));
501

    
502
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
503
            "CenterX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
504

    
505
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
506
            "CenterY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
507

    
508
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
509
           "CanvasX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
510

    
511
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
512
            "CanvasY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
513

    
514
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
515
            "StartPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
516

    
517
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
518
            "EndPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
519

    
520
        public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
521
            "TextSize", typeof(Double), typeof(TextControl), new PropertyMetadata((Double)30, PointValueChanged));
522

    
523
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
524
            "Paint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
525

    
526
        public static readonly DependencyProperty OverViewPaintProperty = DependencyProperty.Register(
527
            "OverViewPaint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
528

    
529
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
530
            "Angle", typeof(double), typeof(TextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
531

    
532
        public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
533
           "EnableEditing", typeof(bool), typeof(TextControl), new PropertyMetadata((true), new PropertyChangedCallback(OnIsEditingChanged)));
534

    
535
        public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
536
            "TextBoxVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
537

    
538
        public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
539
            "TextBlockVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
540

    
541
        #endregion Dependency Properties
542

    
543
        #region dp Properties
544

    
545

    
546
        public override SolidColorBrush StrokeColor
547
        {
548
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
549
            set
550
            {
551
                if (this.StrokeColor != value)
552
                {
553
                    SetValue(StrokeColorProperty, value);
554
                }
555
            }
556
        }
557

    
558
        public Double ArcLength
559
        {
560
            get { return (Double)GetValue(ArcLengthProperty); }
561
            set
562
            {
563
                if (this.ArcLength != value)
564
                {
565
                    SetValue(ArcLengthProperty, value);
566
                    OnPropertyChanged("ArcLength");
567
                }
568
            }
569
        }
570

    
571
        public bool EnableEditing
572
        {
573
            get { return (bool)GetValue(EnableEditingProperty); }
574
            set
575
            {
576
                if (this.EnableEditing != value)
577
                {
578
                    SetValue(EnableEditingProperty, value);
579
                    OnPropertyChanged("EnableEditing");
580
                }
581
            }
582
        }
583

    
584
        public Thickness LineSize
585
        {
586
            get
587
            {
588
                return (Thickness)GetValue(LineSizeProperty);
589
            }
590
            set
591
            {
592
                if (this.LineSize != value)
593
                {
594
                    SetValue(LineSizeProperty, value);
595
                    OnPropertyChanged("LineSize");
596
                }
597
            }
598
        }
599

    
600
        public override ControlType ControlType
601
        {
602
            get
603
            {
604
                return (ControlType)GetValue(ControlTypeProperty);
605
            }
606
            set
607
            {
608
                SetValue(ControlTypeProperty, value);
609
            }
610
        }
611
        public int ControlType_No
612
        {
613
            get
614
            {
615
                return (int)GetValue(ControlType_NoProperty);
616
            }
617
            set
618
            {
619
                SetValue(ControlType_NoProperty, value);
620
            }
621
        }
622

    
623
        public string UserID
624
        {
625
            get { return (string)GetValue(UserIDProperty); }
626
            set
627
            {
628
                if (this.UserID != value)
629
                {
630
                    SetValue(UserIDProperty, value);
631
                    OnPropertyChanged("UserID");
632
                }
633
            }
634
        }
635

    
636
        public double CenterX
637
        {
638
            get { return (double)GetValue(CenterXProperty); }
639
            set
640
            {
641
                SetValue(CenterXProperty, value);
642
                OnPropertyChanged("CenterX");
643

    
644
            }
645
        }
646

    
647
        public double CenterY
648
        {
649
            get { return (double)GetValue(CenterYProperty); }
650
            set
651
            {
652
                SetValue(CenterYProperty, value);
653
                OnPropertyChanged("CenterY");
654
            }
655
        }
656

    
657
        public string Text
658
        {
659
            get { return (string)GetValue(TextProperty); }
660
            set
661
            {
662
                if (this.Text != value)
663
                {
664
                    SetValue(TextProperty, value);
665
                    OnPropertyChanged("Text");
666
                }
667
            }
668
        }
669

    
670
        public string OverViewText
671
        {
672
            get { return (string)GetValue(OverViewTextProperty); }
673
            set
674
            {
675
                if (this.OverViewText != value)
676
                {
677
                    SetValue(OverViewTextProperty, value);
678
                    OnPropertyChanged("OverViewText");
679
                }
680
            }
681
        }
682

    
683
        public Geometry OverViewPathData
684
        {
685
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
686
            set
687
            {
688
                if (this.OverViewPathData != value)
689
                {
690
                    SetValue(OverViewPathDataProperty, value);
691
                    OnPropertyChanged("OverViewPathData");
692
                }
693
            }
694
        }
695

    
696
        public Visibility TextBoxVisibility
697
        {
698
            get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
699
            set
700
            {
701
                if (this.TextBoxVisibility != value)
702
                {
703
                    SetValue(TextBoxVisibilityProperty, value);
704
                    OnPropertyChanged("TextBoxVisibility");
705
                }
706
            }
707
        }
708

    
709

    
710
        public Visibility TextBlockVisibility
711
        {
712
            get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
713
            set
714
            {
715
                if (this.TextBlockVisibility != value)
716
                {
717
                    SetValue(TextBlockVisibilityProperty, value);
718
                    OnPropertyChanged("TextBlockVisibility");
719
                }
720
            }
721
        }
722

    
723
        public Double TextSize
724
        {
725
            get { return (Double)GetValue(TextSizeProperty); }
726
            set
727
            {
728
                if (this.TextSize != value)
729
                {
730
                    SetValue(TextSizeProperty, value);
731
                    OnPropertyChanged("TextSize");
732
                }
733
            }
734
        }
735
        /*
736
        public SolidColorBrush FontColor
737
        {
738
            get { return (SolidColorBrush)GetValue(FontColorProperty); }
739
            set
740
            {
741
                if (this.FontColor != value)
742
                {
743
                    SetValue(FontColorProperty, value);
744
                    OnPropertyChanged("FontColor");
745
                }
746
            }
747
        }*/
748

    
749
        public SolidColorBrush BackColor
750
        {
751
            get { return (SolidColorBrush)GetValue(BackColorProperty); }
752
            set
753
            {
754
                if (this.BackColor != value)
755
                {
756
                    SetValue(BackColorProperty, value);
757
                    OnPropertyChanged("BackColor");
758
                }
759
            }
760
        }
761

    
762
        public SolidColorBrush BackInnerColor
763
        {
764
            get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
765
            set
766
            {
767
                if (this.BackInnerColor != value)
768
                {
769
                    SetValue(BackInnerColorProperty, value);
770
                    OnPropertyChanged("BackInnerColor");
771
                }
772
            }
773
        }
774

    
775

    
776

    
777
        public TextDecorationCollection UnderLine
778
        {
779
            get
780
            {
781
                return (TextDecorationCollection)GetValue(UnderLineProperty);
782
            }
783
            set
784
            {
785
                if (this.UnderLine != value)
786
                {
787
                    SetValue(UnderLineProperty, value);
788
                    OnPropertyChanged("UnderLine");
789
                }
790
            }
791
        }
792

    
793
        public double CanvasX
794
        {
795
            get { return (double)GetValue(CanvasXProperty); }
796
            set
797
            {
798
                if (this.CanvasX != value)
799
                {
800
                    SetValue(CanvasXProperty, value);
801
                    OnPropertyChanged("CanvasX");
802
                }
803
            }
804
        }
805

    
806
        public double CanvasY
807
        {
808
            get { return (double)GetValue(CanvasYProperty); }
809
            set
810
            {
811
                if (this.CanvasY != value)
812
                {
813
                    SetValue(CanvasYProperty, value);
814
                    OnPropertyChanged("CanvasY");
815
                }
816
            }
817
        }
818

    
819
        public Point EndPoint
820
        {
821
            get { return (Point)GetValue(EndPointProperty); }
822
            set
823
            {
824
                if (this.EndPoint != value)
825
                {
826
                    SetValue(EndPointProperty, value);
827
                    OnPropertyChanged("EndPoint");
828
                }
829
            }
830
        }
831

    
832
        public Point StartPoint
833
        {
834
            get { return (Point)GetValue(StartPointProperty); }
835
            set
836
            {
837
                if (this.StartPoint != value)
838
                {
839
                    SetValue(StartPointProperty, value);
840
                    OnPropertyChanged("StartPoint");
841
                }
842
            }
843
        }
844

    
845
        public FontStyle TextStyle
846
        {
847
            get { return (FontStyle)GetValue(TextStyleProperty); }
848
            set
849
            {
850
                if (this.TextStyle != value)
851
                {
852
                    SetValue(TextStyleProperty, value);
853
                    OnPropertyChanged("TextStyle");
854
                }
855
            }
856
        }
857

    
858
        public FontFamily TextFamily
859
        {
860
            get { return (FontFamily)GetValue(TextFamilyProperty); }
861
            set
862
            {
863
                if (this.TextFamily != value)
864
                {
865
                    SetValue(TextFamilyProperty, value);
866
                    OnPropertyChanged("TextFamily");
867
                }
868
            }
869
        }
870

    
871
        public FontWeight TextWeight
872
        {
873
            get { return (FontWeight)GetValue(TextWeightProperty); }
874
            set
875
            {
876
                if (this.TextWeight != value)
877
                {
878
                    SetValue(TextWeightProperty, value);
879
                    OnPropertyChanged("TextWeight");
880
                }
881
            }
882
        }
883

    
884
        public PaintSet Paint
885
        {
886
            get { return (PaintSet)GetValue(PaintProperty); }
887
            set
888
            {
889
                if (this.Paint != value)
890
                {
891
                    SetValue(PaintProperty, value);
892
                    OnPropertyChanged("Paint");
893
                }
894
            }
895
        }
896

    
897
        public PaintSet OverViewPaint
898
        {
899
            get { return (PaintSet)GetValue(OverViewPaintProperty); }
900
            set
901
            {
902
                if (this.OverViewPaint != value)
903
                {
904
                    SetValue(OverViewPaintProperty, value);
905
                    OnPropertyChanged("OverViewPaint");
906
                }
907
            }
908
        }
909

    
910
        double IPath.LineSize
911
        {
912
            get
913
            {
914
                return this.LineSize.Left;
915
            }
916
            set
917
            {
918
                this.LineSize = new Thickness(value);
919
                OnPropertyChanged("LineSize");
920
            }
921
        }
922

    
923

    
924
        public Geometry PathData
925
        {
926
            get { return (Geometry)GetValue(PathDataProperty); }
927
            set
928
            {
929
                SetValue(PathDataProperty, value);
930
                OnPropertyChanged("PathData");
931
            }
932
        }
933

    
934
        public Geometry PathDataInner
935
        {
936
            get { return (Geometry)GetValue(PathDataInnerProperty); }
937
            set
938
            {
939
                SetValue(PathDataInnerProperty, value);
940
                OnPropertyChanged("PathDataInner");
941
            }
942
        }
943

    
944
        public override double CommentAngle
945
        {
946
            get { return (double)GetValue(AngleProperty); }
947
            set
948
            {
949
                if (this.CommentAngle != value)
950
                {
951
                    SetValue(AngleProperty, value);
952

    
953
                    OnPropertyChanged("Angle");
954
                    UpdateLayout();
955
                }
956
            }
957
        }
958

    
959
        public bool IsHighLight
960
        {
961
            get { return (bool)GetValue(IsHighlightProperty); }
962
            set
963
            {
964
                if (this.IsHighLight != value)
965
                {
966
                    SetValue(IsHighlightProperty, value);
967
                    OnPropertyChanged("IsHighLight");
968
                }
969
            }
970
        }
971

    
972
        public List<Point> PointSet
973
        {
974
            get { return (List<Point>)GetValue(PointSetProperty); }
975
            set
976
            {
977
                SetValue(PointSetProperty, value);
978
                OnPropertyChanged("PointSet");
979
            }
980
        }
981

    
982
        #endregion Properties
983

    
984
        #region Properties
985

    
986
        private bool _IsEditingMode;
987
        public bool IsEditingMode
988
        {
989
            get
990
            {
991
                return _IsEditingMode;
992
            }
993
            set
994
            {
995
                _IsEditingMode = value;
996
                OnPropertyChanged("IsEditingMode");
997
            }
998
        }
999

    
1000
        public PathGeometry PathGeometry
1001
        {
1002
            get { return (PathGeometry)GetValue(PathGeometryProperty); }
1003
            set
1004
            {
1005
                SetValue(PathGeometryProperty, value);
1006
                OnPropertyChanged("PathGeometry");
1007
            }
1008
        }
1009

    
1010
        private double _BoxWidth;
1011
        public double BoxWidth
1012
        {
1013
            get
1014
            {
1015
                return _BoxWidth;
1016
            }
1017
            set
1018
            {
1019
                _BoxWidth = value;
1020
                OnPropertyChanged("BoxWidth");
1021
            }
1022
        }
1023

    
1024
        private double _BoxHeight;
1025
        public double BoxHeight
1026
        {
1027
            get
1028
            {
1029
                return _BoxHeight;
1030
            }
1031
            set
1032
            {
1033
                _BoxHeight = value;
1034
                OnPropertyChanged("BoxHeight");
1035
            }
1036
        }
1037

    
1038
        #endregion
1039

    
1040
        #region CallBack Method
1041

    
1042
        private static void TextFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
1043
        {
1044
            //var instance = (TextControl)d;
1045

    
1046
            //instance.SetFontFamily(e.NewValue as FontFamily);
1047
        }
1048

    
1049
        public static void SetPathGeometryChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1050
        {
1051
            var instance = (TextControl)sender;
1052

    
1053
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1054
            {
1055
                instance.SetValue(e.Property, e.NewValue);
1056
            }
1057
        }
1058

    
1059

    
1060
        public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1061
        {
1062
            var instance = (TextControl)sender;
1063

    
1064
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1065
            {
1066
                instance.SetValue(e.Property, e.NewValue);
1067
            }
1068
        }
1069

    
1070
        public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1071
        {
1072
            var instance = (TextControl)sender;
1073

    
1074
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1075
            {
1076
                instance.SetValue(e.Property, e.NewValue);
1077
            }
1078
        }
1079

    
1080
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1081
        {
1082
            //var instance = (TextControl)sender;
1083

    
1084
            //if (e.OldValue != e.NewValue && instance.Base_Border != null)
1085
            //{
1086
            //    instance.SetValue(e.Property, e.NewValue);
1087

    
1088
            //    if (instance.IsSelected)
1089
            //    {
1090
            //        instance.StrokeColor = new SolidColorBrush(Colors.Blue);
1091
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Blue);
1092
            //    }
1093
            //    else
1094
            //    {
1095
            //        instance.StrokeColor = new SolidColorBrush(Colors.Red);
1096
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Red);
1097
            //        //instance.FontColor = new SolidColorBrush(Colors.Transparent);
1098
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Transparent);
1099
            //    }
1100

    
1101
            //}
1102
        }
1103

    
1104
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1105
        {
1106
            var instance = (TextControl)sender;
1107

    
1108
            if (e.OldValue != e.NewValue && instance != null)
1109
            {
1110
                instance.SetValue(e.Property, e.NewValue);
1111

    
1112
                Canvas.SetLeft(instance, instance.CanvasX);
1113
                Canvas.SetTop(instance, instance.CanvasY);
1114
            }
1115
        }
1116

    
1117
        public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1118
        {
1119
            var instance = (TextControl)sender;
1120

    
1121
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1122
            {
1123
                instance.SetValue(e.Property, e.NewValue);
1124

    
1125
                if (instance.EnableEditing)
1126
                {
1127
                    instance.EditingMode();
1128
                }
1129
                else
1130
                {
1131
                    instance.UnEditingMode();
1132
                }
1133
            }
1134
        }
1135
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1136
        {
1137
            var instance = (TextControl)sender;
1138

    
1139
            if (e.OldValue != e.NewValue)
1140
            {
1141
                instance.SetValue(e.Property, e.NewValue);
1142
            }
1143
        }
1144

    
1145
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1146
        {
1147
            var instance = (TextControl)sender;
1148

    
1149
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1150
            {
1151
                instance.SetValue(e.Property, e.NewValue);
1152
                //instance.DrawingCloud();
1153
            }
1154
        }
1155

    
1156
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1157
        {
1158
            var instance = (TextControl)sender;
1159
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1160
            {
1161
                instance.SetValue(e.Property, e.NewValue);
1162
                //instance.DrawingCloud();
1163
            }
1164
        }
1165

    
1166
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1167
        {
1168
            var instance = (TextControl)sender;
1169
            
1170
            if (e.OldValue != e.NewValue && instance.Base_TextBox != null)
1171
            {                       
1172
                instance.SetText();
1173
                instance.DrawingCloud();
1174
            }
1175

    
1176
        }
1177

    
1178
        #endregion CallBack Method
1179

    
1180
        protected void OnPropertyChanged(string propName)
1181
        {
1182
            if (PropertyChanged != null)
1183
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
1184

    
1185
            if (propName == "UnderLine" && Base_TextBlock != null)
1186
            {
1187
                Base_TextBlock.TextDecorations = UnderLine;
1188
                //(sender as TextControl).Base_TextBlock.TextDecorations = (sender as TextControl).UnderLine;
1189
            }
1190
        }
1191

    
1192
        /// <summary>
1193
        /// return textcontrols' area
1194
        /// </summary>
1195
        public override Rect ItemRect
1196
        {
1197
            get
1198
            {
1199
                Point start = new Point(this.CanvasX, this.CanvasY);
1200

    
1201
                Point length = new Point();
1202
                double angle = this.CommentAngle * Math.PI / 180;
1203
                double sin = Math.Sin(angle);
1204
                double cos = Math.Cos(angle);
1205

    
1206
                length.X = this.BoxWidth * cos - this.BoxHeight * sin;
1207
                length.Y = this.BoxWidth * sin + this.BoxHeight * cos;
1208

    
1209
                Point end = new Point(start.X + length.X, start.Y + length.Y);
1210
                return new Rect(start, end);
1211
            }
1212
        }
1213

    
1214
        /// <summary>
1215
        /// translate control along given dx,dy
1216
        /// </summary>
1217
        /// <param name="dx"></param>
1218
        /// <param name="dy"></param>
1219
        public override void OnTranslate(double dx, double dy)
1220
        {
1221
            //this.CanvasX = Canvas.GetLeft(this) + dx;
1222
            //this.CanvasY = Canvas.GetTop(this) + dy;
1223
            this.StartPoint = new Point(this.StartPoint.X + dx, this.StartPoint.Y + dy);
1224
            this.EndPoint = new Point(this.EndPoint.X + dx, this.EndPoint.Y + dy);
1225

    
1226
            this.SetValue(TextControl.CanvasXProperty, Canvas.GetLeft(this) + dx);
1227
            this.SetValue(TextControl.CanvasYProperty, Canvas.GetTop(this) + dy);
1228
        }
1229

    
1230
        /// <summary>
1231
        /// Serialize this
1232
        /// </summary>
1233
        /// <param name="sUserId"></param>
1234
        /// <returns></returns>
1235
        public override string Serialize()
1236
        {
1237
            using (S_TextControl STemp = new S_TextControl())
1238
            {
1239
                STemp.TransformPoint = "0|0";
1240
                STemp.SizeSet = String.Format("{0}|{1}", this.LineSize.Left.ToString(), this.TextSize.ToString());
1241
                STemp.Text = this.Text;
1242
                STemp.UserID = this.UserID;
1243
                STemp.FontColor = this.StrokeColor.Color.ToString();
1244
                //STemp.FontColor = "#FFFFFF00";
1245

    
1246
                if (this.StartPoint == new Point())
1247
                    STemp.StartPoint = new Point(this.CanvasX, this.CanvasY);
1248
                else
1249
                    STemp.StartPoint = this.StartPoint;
1250

    
1251
                STemp.EndPoint = this.EndPoint;
1252
                STemp.Opac = this.Opacity;
1253
                STemp.PointSet = this.PointSet;
1254
                STemp.Angle = this.CommentAngle;
1255
                STemp.paintMethod = this.ControlType_No;
1256
                STemp.BoxW = this.BoxWidth;
1257
                STemp.BoxH = this.BoxHeight;
1258
                STemp.isHighLight = this.IsHighLight;
1259
                STemp.Name = this.GetType().Name.ToString();
1260
                STemp.fontConfig = new List<string>()
1261
                            {
1262
                                this.TextFamily.FontName(),
1263
                                this.TextStyle.ToString(),
1264
                                this.TextWeight.ToString(),
1265
                            };
1266

    
1267

    
1268

    
1269
                if (this.UnderLine != null)
1270
                {
1271
                    STemp.fontConfig.Add("true");
1272
                }
1273

    
1274
                ///강인구 추가(2017.11.02)
1275
                ///Memo 추가
1276
                STemp.Memo = this.Memo;
1277

    
1278
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1279
            }
1280
        }
1281

    
1282
        /// <summary>
1283
        /// create a textcontrol from given string
1284
        /// </summary>
1285
        /// <param name="str"></param>
1286
        /// <returns></returns>
1287
        public static TextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1288
        {
1289
            using (S_TextControl s = JsonSerializerHelper.JsonDeserialize<S_TextControl>(str))
1290
            {
1291
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1292
                TextControl instance = new TextControl()
1293
                {
1294
                    Text = s.Text,
1295
                    StartPoint = s.StartPoint,
1296
                    EndPoint = s.EndPoint,
1297
                    CanvasX = s.StartPoint.X,
1298
                    CanvasY = s.StartPoint.Y,
1299
                    BoxWidth = s.BoxW,
1300
                    BoxHeight = s.BoxH,
1301
                    ControlType_No = s.paintMethod,
1302
                    LineSize = new Thickness(Convert.ToDouble(data2.First())),
1303
                    TextSize = Convert.ToDouble(data2[1]),
1304
                    StrokeColor = brush,
1305
                    FontSize = 10,
1306
                    UserID = s.UserID,
1307
                    IsHighLight = s.isHighLight,
1308
                    CommentAngle = s.Angle,
1309
                    PointSet = s.PointSet,
1310
                    Opacity = s.Opac,
1311
                    
1312
                    TextFamily = Markus.Fonts.FontHelper.GetFontFamily(s.fontConfig[0]),
1313
                    //인구 추가(2018.04.17)
1314
                    TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]),
1315
                    TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]),
1316
                };
1317

    
1318
                if (s.fontConfig.Count() == 4)
1319
                {
1320
                    instance.UnderLine = TextDecorations.Underline;
1321
                }
1322

    
1323
                return instance;
1324
            }
1325
        }
1326
    }
1327
}
클립보드 이미지 추가 (최대 크기: 500 MB)