private GuiWidget ShowGridOptions(ThemeConfig theme)
        {
            var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);

            var siblingList = new List <GuiWidget>();

            popupMenu.CreateBoolMenuItem(
                "Off".Localize(),
                () => interactionLayer.SnapGridDistance == 0,
                (isChecked) =>
            {
                interactionLayer.SnapGridDistance = 0;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

            var snapSettings = new List <double>()
            {
                .1, .25, .5, 1, 2, 5
            };

            foreach (var snap in snapSettings)
            {
                popupMenu.CreateBoolMenuItem(
                    snap.ToString(),
                    () => interactionLayer.SnapGridDistance == snap,
                    (isChecked) =>
                {
                    interactionLayer.SnapGridDistance = snap;
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
            }

            // Override menu left padding to improve radio circle -> icon spacing
            foreach (var menuItem in popupMenu.Children)
            {
                //menuItem.Padding = menuItem.Padding.Clone(left: 25);
            }

            return(popupMenu);
        }
        private GuiWidget ShowGridOptions(ThemeConfig theme)
        {
            popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme)
            {
                HAnchor = HAnchor.Absolute,
                Width   = 80 * GuiWidget.DeviceScale
            };

            var siblingList = new List <GuiWidget>();

            popupMenu.CreateBoolMenuItem(
                "Off".Localize(),
                () => object3DControlLayer.SnapGridDistance == 0,
                (isChecked) =>
            {
                object3DControlLayer.SnapGridDistance = 0;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

            var snapSettings = new List <double>()
            {
                .1, .25, .5, 1, 2, 5
            };

            foreach (var snap in snapSettings)
            {
                popupMenu.CreateBoolMenuItem(
                    snap.ToString(),
                    () => object3DControlLayer.SnapGridDistance == snap,
                    (isChecked) =>
                {
                    object3DControlLayer.SnapGridDistance = snap;
                },
                    useRadioStyle: true,
                    siblingRadioButtonList: siblingList);
            }

            return(popupMenu);
        }
Example #3
0
        private GuiWidget ShowViewOptions()
        {
            var popupMenu = new PopupMenu(ApplicationController.Instance.MenuTheme);

            var siblingList = new List <GuiWidget>();

            popupMenu.CreateBoolMenuItem(
                "Shaded".Localize(),
                viewIcons[RenderTypes.Shaded],
                () => sceneContext.ViewState.RenderType == RenderTypes.Shaded,
                (isChecked) =>
            {
                sceneContext.ViewState.RenderType = RenderTypes.Shaded;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

            popupMenu.CreateBoolMenuItem(
                "Outlines".Localize(),
                viewIcons[RenderTypes.Outlines],
                () => sceneContext.ViewState.RenderType == RenderTypes.Outlines,
                (isChecked) =>
            {
                sceneContext.ViewState.RenderType = RenderTypes.Outlines;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

#if DEBUG
            popupMenu.CreateBoolMenuItem(
                "Non-Manifold".Localize(),
                viewIcons[RenderTypes.Polygons],
                () => sceneContext.ViewState.RenderType == RenderTypes.NonManifold,
                (isChecked) =>
            {
                sceneContext.ViewState.RenderType = RenderTypes.NonManifold;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);
#endif

            popupMenu.CreateBoolMenuItem(
                "Polygons".Localize(),
                viewIcons[RenderTypes.Polygons],
                () => sceneContext.ViewState.RenderType == RenderTypes.Polygons,
                (isChecked) =>
            {
                sceneContext.ViewState.RenderType = RenderTypes.Polygons;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

            popupMenu.CreateBoolMenuItem(
                "Materials".Localize(),
                viewIcons[RenderTypes.Materials],
                () => sceneContext.ViewState.RenderType == RenderTypes.Materials,
                (isChecked) =>
            {
                sceneContext.ViewState.RenderType = RenderTypes.Materials;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

            popupMenu.CreateBoolMenuItem(
                "Overhang".Localize(),
                viewIcons[RenderTypes.Overhang],
                () => sceneContext.ViewState.RenderType == RenderTypes.Overhang,
                (isChecked) =>
            {
                sceneContext.ViewState.RenderType = RenderTypes.Overhang;
            },
                useRadioStyle: true,
                siblingRadioButtonList: siblingList);

            // Override menu left padding to improve radio circle -> icon spacing
            foreach (var menuItem in popupMenu.Children)
            {
                menuItem.Padding = menuItem.Padding.Clone(left: 25);
            }

            return(popupMenu);
        }