示例#1
0
        public void DeleteRule(RulePanel rulePanel)
        {
            if (!(EditObject is MarkupRegularLine regularLine))
            {
                return;
            }

            if (Settings.DeleteWarnings && Settings.DeleteWarningsType == 0)
            {
                var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>();
                messageBox.CaprionText    = NodeMarkup.Localize.LineEditor_DeleteRuleCaption;
                messageBox.MessageText    = $"{NodeMarkup.Localize.LineEditor_DeleteRuleMessage}\n{MessageBoxBase.CantUndone}";
                messageBox.OnButton1Click = Delete;
            }
            else
            {
                Delete();
            }

            bool Delete()
            {
                regularLine.RemoveRule(rulePanel.Rule as MarkupLineRawRule <RegularLineStyle>);
                RemoveRulePanel(rulePanel);
                Refresh();
                DeleteAddButton();
                AddAddButton();
                return(true);
            }
        }
示例#2
0
        private bool SetStyle(RulePanel rulePanel)
        {
            var style = NodeMarkupTool.GetStyle(RegularLineStyle.RegularLineType.Dashed);

            rulePanel.Style.SelectedObject = style != Style.StyleType.EmptyLine ? style : (Style.StyleType)(int) RegularLineStyle.RegularLineType.Dashed;
            ContentPanel.ScrollToBottom();
            return(true);
        }
示例#3
0
        private void RemoveRulePanel(RulePanel rulePanel)
        {
            if (HoverRulePanel == rulePanel)
            {
                HoverRulePanel = null;
            }

            ComponentPool.Free(rulePanel);
        }
示例#4
0
        private bool SetStyle(RulePanel rulePanel)
        {
            var style = Tool.GetStyleByModifier <RegularLineStyle, RegularLineStyle.RegularLineType>(RegularLineStyle.RegularLineType.Dashed);

            rulePanel.ApplyStyle(style);
            ContentPanel.Content.ScrollToBottom();
            ContentPanel.Content.ScrollIntoViewRecursive(rulePanel);
            return(true);
        }
示例#5
0
        private void RuleMouseLeave(RulePanel rulePanel, UIMouseEventParameter eventParam)
        {
            var uiView       = rulePanel.GetUIView();
            var mouse        = uiView.ScreenPointToGUI((eventParam.position + eventParam.moveDelta) / uiView.inputScale);
            var ruleRect     = new Rect(ContentPanel.absolutePosition + rulePanel.relativePosition, rulePanel.size);
            var settingsRect = new Rect(ContentPanel.absolutePosition, ContentPanel.size);

            if (eventParam.source == rulePanel || !ruleRect.Contains(mouse) || !settingsRect.Contains(mouse))
            {
                HoverRulePanel = null;
            }
        }
示例#6
0
 private void RuleMouseHover(RulePanel rulePanel, UIMouseEventParameter eventParam) => HoverRulePanel = rulePanel;
示例#7
0
 private void SetupRule(RulePanel rulePanel) => SelectRuleEdge(rulePanel.From, (_) => SelectRuleEdge(rulePanel.To, (_) => SetStyle(rulePanel)));