private void SplitClick(object sender, RoutedEventArgs e)
        {
            if (m_selectedPanel != NOT_SELECTED)
            {
                PanelSplitSetup setup  = new PanelSplitSetup();
                bool?           result = setup.ShowDialog();

                if (result == true)
                {
                    Panel panel_1, panel_2;
                    PanelSplitSetupValues parameters = (PanelSplitSetupValues)Application.Current.FindResource("SplitSetup");
                    if (parameters == null)
                    {
                        return;
                    }

                    if (Layout.Panels[m_selectedPanel].Split(parameters.Start, parameters.NumTongues, parameters.Depth, out panel_1, out panel_2))
                    {
                        Point origin = Layout.Panels[m_selectedPanel].Origin;
                        panel_1.Origin = origin;
                        origin.X      += parameters.Start;
                        panel_2.Origin = origin;

                        Layout.Panels.RemoveAt(m_selectedPanel);
                        Layout.Panels.Add(panel_1);
                        Layout.Panels.Add(panel_2);
                        m_selectedPanel = NOT_SELECTED;
                        InvalidateVisual();
                    }
                }
            }
        }
示例#2
0
        private void SplitClick(object sender, RoutedEventArgs e)
        {
            if (m_selectedPanel != null)
            {
                PanelSplitSetup setup  = new PanelSplitSetup();
                bool?           result = setup.ShowDialog();

                if (result == true)
                {
                    Panel panel_1, panel_2;
                    PanelSplitSetupValues parameters = (PanelSplitSetupValues)Application.Current.FindResource("SplitSetup");
                    if (parameters == null)
                    {
                        return;
                    }

                    if (m_selectedPanel.Split(parameters.Start, parameters.NumTongues, parameters.Depth, parameters.RoundEnds, out panel_1, out panel_2))
                    {
                        UndoLog.StartSnapshot();
                        Point origin = m_selectedPanel.Origin;
                        panel_1.Origin = origin;
                        origin.X      += parameters.Start;
                        panel_2.Origin = origin;

                        Layout.RemovePanel(m_selectedPanel);
                        Layout.AddPanel(panel_1);
                        Layout.AddPanel(panel_2);
                        m_selectedPanel = null;
                        UndoLog.Snapshot();
                        InvalidateVisual();
                    }
                }
            }
        }