internal void mniDeleteFunction_Click(object senderMenuItem, EventArgs e)
        {
            GreyState();
            if (!mniDeleteFunction.Enabled)
            {
                return;
            }

            //focus the function if the menu was called from a parameter node (of this function)
            TreeListNode functionNode = GetFunctionNode(_mainForm.treeList.FocusedNode);

            _mainForm.treeList.FocusedNode = functionNode;

            //assure that a possible selection of the MultiCellSelector does not refer to something completely different than the function clicked
            if (_mainForm.GetMultiCellSelector().HasSelection())
            {
                bool clearMultiCellSelector = false;
                if (!_mainForm.GetMultiCellSelector().GetSelectedNodes().Contains(functionNode) || //if the selection does not contain the clicked function ...
                    !_mainForm.GetMultiCellSelector().DoesSelectionContainPolicyColumn())          //... or the selection does not contain the policy column (i.e. some parameter values or comments are selected) ...
                {
                    clearMultiCellSelector = true;
                }
                else
                {//... or the selection contains something different from sibiling functions (i.e. other functions within the function's policy) and parameters of the clicked function ...
                    foreach (TreeListNode selectedNode in _mainForm.GetMultiCellSelector().GetSelectedNodes())
                    {
                        if (selectedNode.ParentNode != null && selectedNode.ParentNode == functionNode)
                        {
                            continue; //a parameter of the clicked function, that's fine
                        }
                        if (selectedNode.ParentNode != null && selectedNode.ParentNode == functionNode.ParentNode)
                        {
                            continue;                                                                                                                                         //a sibling function, that's fine too
                        }
                        if (selectedNode.ParentNode != null && selectedNode.ParentNode.ParentNode != null && selectedNode.ParentNode.ParentNode == functionNode.ParentNode && //(i.e. parameter within the same policy)
                            _mainForm.GetMultiCellSelector().GetSelectedNodes().Contains(selectedNode.ParentNode))
                        {
                            continue; //a parameter of a sibling function that's within the selection, that's fine too
                        }
                        clearMultiCellSelector = true;
                        break;
                    }
                }
                if (clearMultiCellSelector)
                {
                    _mainForm.ClearCellSelection(); //... just clear the selection, and thus make the TreeListManager delete the clicked (and therefore focused) function
                }
            }

            _mainForm.GetTreeListManager().HandleDelete(true);
        }
        void MoveToHiddenSystems_SelectedColumn_MenuItemClick(object sender, EventArgs e)
        {
            _mainForm.treeList.BeginUpdate();
            if (_mainForm.treeList.CustomizationForm == null)
            {
                _mainForm.treeList.ColumnsCustomization(); //invoke column chooser if not already available
            }
            _mainForm.ClearCellSelection();                //clear any existing selection of cells (to avoid that actions on selected cell change hidden systems)

            //move selected column to column chooser
            _senderColumn.VisibleIndex = -1;
            _senderColumn.OptionsColumn.ShowInCustomizationForm = true;
            _mainForm.treeList.EndUpdate();
        }
        internal void mniDeletePolicy_Click(object senderMenuItem, EventArgs e)
        {
            GreyState();
            if (!mniDeletePolicy.Enabled)
            {
                return;
            }

            //assure that a possible selection of the MultiCellSelector does not refer to something completely different than the policy clicked
            if (_mainForm.GetMultiCellSelector().HasSelection())
            {
                if (!_mainForm.GetMultiCellSelector().GetSelectedNodes().Contains(_mainForm.treeList.FocusedNode) || //if the selection does not contain the clicked policy ...
                    !_mainForm.GetMultiCellSelector().DoesSelectionContainPolicyColumn())                            //... or the selection does not contain the policy column (i.e. some parameter values or comments are selected) ...
                {
                    _mainForm.ClearCellSelection();                                                                  //... just clear the selection, and thus make the TreeListManager delete the clicked (and therefore focused) policy
                }
            }
            _mainForm.GetTreeListManager().HandleDelete(true);
        }
Ejemplo n.º 4
0
        void mniUnhideRows_Click(object sender, EventArgs e)
        {
            List <KeyValuePair <TreeListNode, TreeListNode> > rangesOfHiddenNodes = new List <KeyValuePair <TreeListNode, TreeListNode> >();

            TreeListManager.GetRangesOfHiddenNodes(_mainForm.treeList.Nodes, ref rangesOfHiddenNodes);

            UnhideRowsForm unhideRowForm = new UnhideRowsForm(rangesOfHiddenNodes, _mainForm.GetTreeListManager());

            if (unhideRowForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            _mainForm.ClearCellSelection();
            _mainForm.treeList.BeginUpdate();
            foreach (KeyValuePair <TreeListNode, TreeListNode> fromNodeToNode in unhideRowForm.GetRangesOfNodesToHide())
            {
                _mainForm.GetTreeListManager().UnhideNodeRange(fromNodeToNode.Key, fromNodeToNode.Value);
            }
            _mainForm.treeList.EndUpdate();
        }