프로젝트

일반

사용자정보

개정판 d62c0439

IDd62c0439bafb70567987eb36faf5072dce67e0ea
상위 064efb98
하위 d0b39faa

백흠경이(가) 5년 이상 전에 추가함

issue #923: remove undo after selecting item, fixed multi selection logic

Change-Id: Id2a6e63336747aeaf3337218f5e2e3b35fba5dfa

차이점 보기:

KCOM/Views/MainMenu.xaml.cs
316 316
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
317 317
            });
318 318

  
319
            ViewerDataModel.Instance.MarkupList_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
319
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
320 320
            {
321 321
                ComingNewBieEnd = false;
322
                ViewerDataModel.Instance.MarkupList_USER.Remove(a);
322
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
323 323
                //임시파일에서도 삭제
324 324
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
325 325
            });
......
422 422
            ////GC.Collect();
423 423
        }
424 424
        
425
        public List<CommentUserInfo> AddAdorner()
426
        {
427
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
428

  
429
            if (SelectLayer.Children.Count > 0)
430
            {
431
                foreach (var item in SelectLayer.Children)
432
                {
433
                    if (item.GetType().Name == "AdornerFinal")
434
                    {
435
                        (item as AdornerFinal).unRegister();
436

  
437
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
438
                        {
439
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
440
                            {
441
                                adornerSet.Add(InnerItem.DrawingData as CommentUserInfo);
442
                            }
443

  
444
                            Control_Style(InnerItem.DrawingData as CommentUserInfo);
445

  
446
                            UndoData.Markup_List.Add(multi_Undo_Data);
447
                            multi_Undo_Data = new Multi_Undo_data();
448
                        }
449
                    }
450
                }
451
                SelectLayer.Children.Clear();
452
            }
453
            return adornerSet;
454
        }
455

  
456
        public void ChangeCommentReact()
425
        /// <summary>
426
        /// update my markuplist
427
        ///  - update existing markup data if already exist
428
        ///  - add new markup data if control is new
429
        /// </summary>
430
        public void UpdateMyMarkupList()
457 431
        {
458 432
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
459 433
            bool isComingNewBie = false;
460 434

  
461
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
435
            /// add or update markup list
436
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
462 437
            {
463
                foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
464
                {
465
                    var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
438
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
466 439

  
467
                    var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault();
468
                    if (existItem != null) //신규 추가 된 코멘트
440
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
441
                if (exist != null) //신규 추가 된 코멘트
442
                {
443
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
469 444
                    {
470
                        if (existItem.Data != root.ConvertData) //코멘트가 같은지
471
                        {
472
                            existItem.Data = root.ConvertData;
473
                            existItem.IsUpdate = true;
474
                            ComingNewBieEnd = false;
475
                        }
445
                        exist.Data = root.ConvertData;
446
                        exist.IsUpdate = true;
447
                        ComingNewBieEnd = false;
476 448
                    }
477
                    else
449
                }
450
                else if (root.CommentID != null)
451
                {
452
                    isComingNewBie = true;
453
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
478 454
                    {
479
                        if (root.CommentID != null)
480
                        {
481
                            isComingNewBie = true;
482
                            var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
483
                            if (currentCommentCheck != null)
484
                            {
485
                                currentCommentCheck.Data = root.ConvertData;
486
                            }
487
                            else
488
                            {
489
                                ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx
490
                                {
491
                                    ID = control.CommentID,
492
                                    Data = root.ConvertData,
493
                                    Data_Type = root.DATA_TYPE,
494
                                    MarkupInfoID = App.Custom_ViewInfoId,
495
                                    PageNumber = this.pageNavigator.CurrentPage.PageNumber,
496
                                    Symbol_ID = control.SymbolID,
497
                                    Group_ID = control.GroupID,
498
                                });
499
                                ComingNewBieEnd = false;
500
                            }
501
                        }
502
                    }
455
                        ID = control.CommentID,
456
                        Data = root.ConvertData,
457
                        Data_Type = root.DATA_TYPE,
458
                        MarkupInfoID = App.Custom_ViewInfoId,
459
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
460
                        Symbol_ID = control.SymbolID,
461
                        Group_ID = control.GroupID,
462
                    });
463
                    ComingNewBieEnd = false;
503 464
                }
504 465
            }
505 466

  
467
            /// delete markup list
468
            int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
469
            var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
470
                          where (markup.PageNumber == iPageNo) && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
471
                          select markup).ToList();
472
            foreach(var markup in deleted) ViewerDataModel.Instance.MyMarkupList.Remove(markup);
473
            /// up to here
506 474

  
507 475
            if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
508 476
            {
......
534 502
            InkControl_Convert();
535 503

  
536 504
            SelectionSet.Instance.UnSelect(this);
537
            ChangeCommentReact();
505
            UpdateMyMarkupList();
538 506

  
539 507
            Logger.sendCheckLog("pageNavigator_PageChanging_변수생성 및 값 설정", 1);
540 508
            CompareMode.IsChecked = false;
......
703 671
            {
704 672
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
705 673
            }
706
            Logger.sendCheckLog("pageNavigator_PageChanging_ControlData Setting", 1);
707
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
708
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
709 674

  
710
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
675
            Logger.sendCheckLog("-- pageNavigator_PageChanging_ControlData Setting --", 1);
676
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
677
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
711 678

  
712
            foreach (var item in gridSelectionItem)
679
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
680
            foreach (var info in gridSelectionItem)
713 681
            {
714
                if (item.UserID == App.ViewInfo.UserID)
715
                {
716
                    ViewerDataModel.Instance.current_page_commentcnt = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count;
717
                    ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
718
                    {
719
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", 
720
                            item.MarkupInfoID, markupitem.ID);
721
                    });
722

  
723
                }
724
                else
725
                {
726
                    ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
727
                    {
728
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
729
                    });
730
                }
682
                Logger.sendCheckLog(String.Format("==>{0}", info), 1);
731 683
            }
684
            /// fire selection event
685
            this.gridViewMarkup.UnselectAll();
686
            this.gridViewMarkup.Select(gridSelectionItem);
732 687

  
733 688
            if (!testPanel2.IsHidden)
734 689
            {
......
779 734
                instance.SetColor = item.DisplayColor;
780 735
                if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
781 736
                {
782
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList();
737
                    instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
783 738
                }
784 739
                else
785 740
                {
......
2871 2826
        /// </summary>
2872 2827
        private void ApplyDragSelectionRect()
2873 2828
        {
2874
            /*
2875
            multi_Undo_Data = new Multi_Undo_data();
2876

  
2877
            UndoData = new Undo_data()
2878
            {
2879
                IsUndo = false,
2880
                Event = Event_Type.Select,
2881
                EventTime = DateTime.Now,
2882
                Markup_List = new List<Multi_Undo_data>()
2883
            };
2884
            */
2885

  
2886 2829
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2887 2830

  
2888 2831
            double x = Canvas.GetLeft(dragSelectionBorder);
......
2908 2851
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2909 2852

  
2910 2853
                    Control_Style(item);
2911
                    /*
2912
                    UndoData.Markup_List.Add(multi_Undo_Data);
2913
                    multi_Undo_Data = new Multi_Undo_data();
2914
                    if (item.GroupID > 0)
2915
                    {
2916

  
2917
                    }
2918
                    */
2919 2854
                }
2920 2855
            }
2921 2856
            if (adornerSet.Count > 0)
2922 2857
            {
2923
                /*
2924
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2925
                {
2926
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2927
                });
2928
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2929
                */
2930

  
2931 2858
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2932 2859
                SelectLayer.Children.Add(final);
2933 2860
            }
......
3174 3101

  
3175 3102
            InkControl_Convert();
3176 3103

  
3104
            ///TODO:
3177 3105
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
3178 3106
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
3179 3107

  
......
3181 3109
            {
3182 3110
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
3183 3111
            }
3112
            /// up to here
3184 3113

  
3185 3114
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
3186 3115
            {
......
3326 3255
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3327 3256
                if (control != null)
3328 3257
                {
3329
                    //강인구 추가 컨트롤 누르고 멀티 선택(다시확인필요)
3330
                    AdornerFinal final;
3331
                    List<Point> p_set = new List<Point>();
3332
                    List<CommentUserInfo> comment = new List<CommentUserInfo>();
3333
                    ViewerDataModel.Instance.MarkupControls.Remove(control);
3334
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
3335
                    multi_Undo_Data = new Multi_Undo_data();
3336

  
3337
                    //강인구 Undo/Redo 보류
3338
                    UndoData = new Undo_data()
3339
                    {
3340
                        IsUndo = false,
3341
                        Event = Event_Type.Select,
3342
                        EventTime = DateTime.Now,
3343
                        Markup_List = new List<Multi_Undo_data>()
3344
                    };
3258
                    AdornerFinal final = null;
3345 3259

  
3346 3260
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3347 3261
                    {
3262
                        /// 기존 selection 해제
3348 3263
                        SelectionSet.Instance.UnSelect(this);
3264

  
3349 3265
                        final = new AdornerFinal(control);
3350
                        //단일 컨트롤 언두 저장
3351 3266

  
3352 3267
                        Control_Style(control);
3353
                        UndoData.Markup_List.Add(multi_Undo_Data);
3354 3268

  
3355 3269
                        if ((control as IPath) != null)
3356 3270
                        {
......
3464 3378
                        {
3465 3379
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
3466 3380
                        }
3467

  
3468 3381
                    }
3469 3382
                    else
3470 3383
                    {
3471
                        comment = AddAdorner();
3384
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
3385
                        SelectionSet.Instance.UnSelect(this);
3472 3386
                        comment.Add(control);
3473 3387

  
3474 3388
                        Control_Style(control);
3475
                        UndoData.Markup_List.Add(multi_Undo_Data);
3476 3389

  
3477 3390
                        final = new AdornerFinal(comment);
3478
                        //다중 컨트롤 언두 저장
3479 3391
                    }
3480 3392

  
3481
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3482
                    {
3483
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3484
                    });
3485

  
3486
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3487

  
3488
                    SelectLayer.Children.Add(final);
3393
                    if(final != null) this.SelectLayer.Children.Add(final);
3489 3394
                }              
3490 3395
            }
3491 3396
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
......
3557 3462
                                else
3558 3463
                                {
3559 3464
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3560
                                    if (ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3465
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3561 3466
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3562 3467
                                    {
3563 3468
                                        currentControl = null;
......
5122 5027
                multi_Undo_Data = new Multi_Undo_data();
5123 5028

  
5124 5029
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
5125
                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
5126
                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
5030
                var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
5031
                ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
5127 5032
                
5128 5033
                //임시파일에서도 삭제한다.
5129 5034
                TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
......
5175 5080

  
5176 5081
        public void TeamConsolidationMethod()
5177 5082
        {
5178
            ChangeCommentReact();
5083
            UpdateMyMarkupList();
5179 5084
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5180 5085
            {
5181 5086
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
......
5322 5227

  
5323 5228
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
5324 5229
        {
5325
            ChangeCommentReact();
5230
            UpdateMyMarkupList();
5326 5231

  
5327 5232
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5328 5233
            {
......
6731 6636
                }
6732 6637
            }
6733 6638
        }
6734
        public void EmptyControlCheck()
6735
        {
6736
            for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++)
6737
            {
6738
                if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl")
6739
                {
6740
                    if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null
6741
                    || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "")
6742
                    {
6743
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
6744
                    }
6745
                }
6746
                else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl")
6747
                {
6748
                    if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null
6749
                    || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "")
6750
                    {
6751
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
6752
                    }
6753
                }
6754
            }
6755
        }
6639

  
6756 6640
        public void InkControl_Convert()
6757 6641
        {
6758 6642
            Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1);

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)