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); } }
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); }
private void RemoveRulePanel(RulePanel rulePanel) { if (HoverRulePanel == rulePanel) { HoverRulePanel = null; } ComponentPool.Free(rulePanel); }
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); }
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; } }
private void RuleMouseHover(RulePanel rulePanel, UIMouseEventParameter eventParam) => HoverRulePanel = rulePanel;
private void SetupRule(RulePanel rulePanel) => SelectRuleEdge(rulePanel.From, (_) => SelectRuleEdge(rulePanel.To, (_) => SetStyle(rulePanel)));