コード例 #1
0
        private static ToolStripMenuItem Convert_OptionBool(OptionBool oBool, OptionBase o, Action <OptionBase> onOptionChanged)
        {
            var m = new ToolStripMenuItem
            {
                Text  = o.Caption,
                Tag   = o,
                Image = GetCheckedBitmap(oBool.Value, true),
            };

            // Add childs
            AddChildOptions(m, o, onOptionChanged);
            SetEnabledToSubmenus(m, oBool.Value);

            m.Click += (eSender, eE) =>
            {
                var em     = (ToolStripMenuItem)eSender;
                var eoBool = (OptionBool)em.Tag;
                eoBool.Value = !eoBool.Value;
                em.Image     = GetCheckedBitmap(eoBool.Value, true);
                SetEnabledToSubmenus(em, eoBool.Value);
                if (onOptionChanged != null)
                {
                    onOptionChanged(eoBool);
                }
            };
            return(m);
        }
コード例 #2
0
 public OptionZoom(string key, bool zoom, OptionZoomStyle style, string caption, Type[] relatedTo)
 {
     Zoom      = new OptionBool(key + "_zoom", zoom, caption, relatedTo, OptionType.Zoom);
     ZoomStyle = new OptionEnum <OptionZoomStyle>(key + "_zoomstyle", "Zoom", relatedTo, OptionType.Zoom)
                 .InitAsEnum(style, new[] { "100%", "50%", "30%", "20%", "10%", "6%", "3%", "2%" });
     Zoom.AddChilds(ZoomStyle);
 }
コード例 #3
0
        public void InitSettings(OptionBool parent)
        {
            foreach (var t in Infos.Keys)
            {
                var tStr = t.ToString();
                if (tStr == "TrimControlPointsNotCorrectInSeam2")
                {
                    var temp = 0;
                }

                var info = this[t];

                // Add issue option
                var o = new OptionBool(typeof(T).Name + "." + t, info.IsCheckedByDefault, info.Caption, IssueOptions.RelatedTo, OptionType.Issue);
                o.IssueID      = t;
                o.OnModifiedT += (option) => Infos[(T)option.IssueID].IsChecked = option.Value;

                // Add Automate child option
                var oAutomate = new OptionBool(o.KeyShort + ".Automated", info.IssueWeight.IsAutomateFixAllowed, "Is automated fix allowed", IssueOptions.RelatedTo, OptionType.IssueAutomated);
                oAutomate.IssueID      = t;
                oAutomate.OnModifiedT += (option) => Infos[(T)option.IssueID].IssueWeight.IsAutomateFixAllowed = option.Value;
                o.AddChilds(oAutomate);

                // Add Complexity child option
                var oComplexity = new OptionEnum <int>(o.KeyShort + ".Complexity", "Complexity", IssueOptions.RelatedTo, OptionType.IssueComplexity)
                                  .InitAsValues(info.IssueWeight.Complexity, new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 40, 50, 60 });
                oComplexity.IssueID      = t;
                oComplexity.OnModifiedT += (option) => Infos[(T)option.IssueID].IssueWeight.Complexity = option.Value;
                o.AddChilds(oComplexity);

                // Add Severity child option
                var oSeverity = new OptionEnum <IssueSeverityType>(o.KeyShort + ".Severity", "Severity", IssueOptions.RelatedTo, OptionType.IssueSeverity)
                                .InitAsEnum(info.IssueWeight.Severity, IssueSeverityTypeManager.GetCaptions());
                oSeverity.IssueID      = t;
                oSeverity.OnModifiedT += (option) => Infos[(T)option.IssueID].IssueWeight.Severity = option.Value;
                o.AddChilds(oSeverity);

                // Add child options
                parent.AddChilds(o);
                foreach (var issueOption in info.Options)
                {
                    issueOption.IssueID = t;
                    o.AddChilds(issueOption);
                }
            }
        }
コード例 #4
0
 public static void InitSettings()
 {
     SmallEdgesLength = new OptionEnum <double>("SmallEdgesLength", "Small edge length", RelatedTo, OptionType.IssueGlobalOption)
                        .InitAsValues(0.1, new[] { 0.001, 0.003, 0.005, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.5, 0.7, 1, 2, 3, 5, 9 });
     DebugShowFailedFixesOption = new OptionBool("DebugShowFailedFixes", false, null, RelatedTo, OptionType.Debug);
 }