프로젝트

일반

사용자정보

개정판 d1f35ad3

IDd1f35ad34bf9175f0f2e60099a486708bbc4be27
상위 8118ba81
하위 ce54afaf

임예철이(가) 5달 전에 추가함

ZIndex Context Menu 추가

Change-Id: I732f2b71f4841981551eb5c9c88c470db7155c97

차이점 보기:

KCOM/Views/MainMenu.xaml.cs
523 523
        private static Timer timer;
524 524
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
525 525

  
526
        private ContextMenu m_ContextMenu = null;
527

  
526 528
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
527 529
        {
528 530
            //InitializeComponent();
......
551 553
                    this.drawingRotateCanvas.IsHitTestVisible = false;
552 554
                }
553 555
                thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250"));
556

  
557
                InitContextMenu();
554 558
            }
555 559

  
556 560
            //timer = new Timer(timercallback, null, 0, InitInterval * 60000);
......
1205 1209
            }
1206 1210
        }
1207 1211

  
1212
        private void InitContextMenu()
1213
        {
1214
            MenuItem menuBringForward = new MenuItem();
1215
            menuBringForward.Header = "Bring Forward";
1216
            menuBringForward.Click += MenuBringForward_Click;
1217

  
1218
            MenuItem menuBringToForward = new MenuItem();
1219
            menuBringToForward.Header = "Bring To Forward";
1220
            menuBringToForward.Click += MenuBringToForward_Click;
1221

  
1222
            MenuItem menuSendBackward = new MenuItem();
1223
            menuSendBackward.Header = "Send Backward";
1224
            menuSendBackward.Click += MenuSendBackward_Click;
1225

  
1226
            MenuItem menuSendToBackward = new MenuItem();
1227
            menuSendToBackward.Header = "Send To Backward";
1228
            menuSendToBackward.Click += MenuSendToBackward_Click; ;
1229

  
1230

  
1231
            ContextMenu cm = new ContextMenu();
1232
            cm.Items.Add(menuBringForward);
1233
            cm.Items.Add(menuBringToForward);
1234
            cm.Items.Add(new System.Windows.Controls.Separator());
1235
            cm.Items.Add(menuSendBackward);
1236
            cm.Items.Add(menuSendToBackward);
1237

  
1238
            m_ContextMenu = cm;
1239

  
1240
            if (this.zoomAndPanControl.ContextMenu == null)
1241
                this.zoomAndPanControl.ContextMenu = m_ContextMenu;
1242
        }
1243

  
1244

  
1208 1245
        private async void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
1209 1246
        {
1210 1247
            var instance = ViewerDataModel.Instance;
......
2800 2837
            }
2801 2838
            if (e.RightButton == MouseButtonState.Pressed)
2802 2839
            {
2803
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2804
                cursor = Cursors.SizeAll;
2805
                SetCursor();
2840
                List<AdornerMember> AdonerList = GetAdornerItem();
2841

  
2842
                if (AdonerList.Count > 0)
2843
                {
2844
                    if (this.zoomAndPanControl.ContextMenu == null)
2845
                        this.zoomAndPanControl.ContextMenu = m_ContextMenu;
2846
                }
2847
                else
2848
                {
2849
                    if (this.zoomAndPanControl.ContextMenu != null)
2850
                        this.zoomAndPanControl.ContextMenu = null;
2851

  
2852
                    canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2853
                    cursor = Cursors.SizeAll;
2854
                    SetCursor();
2855
                }
2856

  
2806 2857
            }
2807 2858
            else if (e.XButton1 == MouseButtonState.Pressed)
2808 2859
            {
......
4628 4679

  
4629 4680
        }
4630 4681

  
4682
        
4683

  
4684
        
4685

  
4686
        private void MenuSendBackward_Click(object sender, RoutedEventArgs e)
4687
        {
4688
            foreach (var item in SelectionSet.Instance.SelectedItems)
4689
            {
4690
                if (item.ZIndex > 0)
4691
                {
4692
                    item.ZIndex--;
4693
                    Canvas.SetZIndex(item, item.ZIndex);
4694
                }
4695
            }
4696
            ViewerDataModel.Instance.IsMarkupUpdate = true;
4697
        }
4698

  
4699
        private void MenuSendToBackward_Click(object sender, RoutedEventArgs e)
4700
        {
4701
            foreach (var item in SelectionSet.Instance.SelectedItems)
4702
            {
4703
                item.ZIndex = 0;
4704
                Canvas.SetZIndex(item, item.ZIndex);
4705
            }
4706
            ViewerDataModel.Instance.IsMarkupUpdate = true;
4707
        }
4708

  
4709
        private void MenuBringForward_Click(object sender, RoutedEventArgs e)
4710
        {
4711
            foreach (var item in SelectionSet.Instance.SelectedItems)
4712
            {
4713
                if (item.ZIndex < 100)
4714
                {
4715
                    item.ZIndex++;
4716
                    Canvas.SetZIndex(item, item.ZIndex);
4717
                }
4718
            }
4719
            ViewerDataModel.Instance.IsMarkupUpdate = true;
4720
        }
4721
        private void MenuBringToForward_Click(object sender, RoutedEventArgs e)
4722
        {
4723
            foreach (var item in SelectionSet.Instance.SelectedItems)
4724
            {
4725
                item.ZIndex = 99;
4726
                Canvas.SetZIndex(item, item.ZIndex);
4727
            }
4728
            ViewerDataModel.Instance.IsMarkupUpdate = true;
4729
        }
4730

  
4731
        private List<AdornerMember> GetAdornerItem()
4732
        {
4733
            List<AdornerMember> AdonerList = new List<AdornerMember>();
4734

  
4735
            if (this.ParentOfType<MainWindow>() != null)
4736
            {
4737
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
4738
                {
4739
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
4740
                    {
4741
                        if (item.GetType().Name == "AdornerFinal")
4742
                        {
4743
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
4744
                            {
4745
                                AdonerList.Add(InnerItem);
4746
                            }
4747
                        }
4748
                    }
4749
                }
4750
            }
4751

  
4752
            return AdonerList;
4753
        }
4754

  
4631 4755
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4632 4756
        {
4633 4757
            ///mouseButtonDown = e.ChangedButton;

내보내기 Unified diff

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