Exemplo n.º 1
0
        protected override void SetupInterface()
        {
            // Load stored settings
            triangulate             = General.Settings.ReadPluginSetting("drawgridmode.triangulate", false);
            gridlockmode            = (GridLockMode)General.Settings.ReadPluginSetting("drawgridmode.gridlockmode", 0);
            horizontalslices        = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.horizontalslices", 3), 1);
            verticalslices          = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.verticalslices", 3), 1);
            relativeinterpolation   = General.Settings.ReadPluginSetting("drawgridmode.relativeinterpolation", true);
            horizontalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.horizontalinterpolation", 0);
            verticalinterpolation   = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.verticalinterpolation", 0);

            // Create and setup settings panel
            panel = new DrawGridOptionsPanel();
            panel.MaxHorizontalSlices         = (int)General.Map.FormatInterface.MaxCoordinate;
            panel.MaxVerticalSlices           = (int)General.Map.FormatInterface.MaxCoordinate;
            panel.Triangulate                 = triangulate;
            panel.GridLockMode                = gridlockmode;
            panel.HorizontalSlices            = horizontalslices - 1;
            panel.VerticalSlices              = verticalslices - 1;
            panel.HorizontalInterpolationMode = horizontalinterpolation;
            panel.VerticalInterpolationMode   = verticalinterpolation;

            panel.OnValueChanged                 += OptionsPanelOnValueChanged;
            panel.OnGridLockModeChanged          += OptionsPanelOnGridLockChanged;
            panel.OnContinuousDrawingChanged     += OnContinuousDrawingChanged;
            panel.OnShowGuidelinesChanged        += OnShowGuidelinesChanged;
            panel.OnRelativeInterpolationChanged += OnRelativeInterpolationChanged;

            // Needs to be set after adding the OnContinuousDrawingChanged event...
            panel.ContinuousDrawing     = General.Settings.ReadPluginSetting("drawgridmode.continuousdrawing", false);
            panel.ShowGuidelines        = General.Settings.ReadPluginSetting("drawgridmode.showguidelines", false);
            panel.RelativeInterpolation = relativeinterpolation;
        }
Exemplo n.º 2
0
        protected override void RemoveInterface()
        {
            // Store settings
            General.Settings.WritePluginSetting("drawgridmode.triangulate", triangulate);
            General.Settings.WritePluginSetting("drawgridmode.gridlockmode", (int)gridlockmode);
            General.Settings.WritePluginSetting("drawgridmode.horizontalslices", horizontalslices);
            General.Settings.WritePluginSetting("drawgridmode.verticalslices", verticalslices);
            General.Settings.WritePluginSetting("drawgridmode.horizontalinterpolation", (int)horizontalinterpolation);
            General.Settings.WritePluginSetting("drawgridmode.verticalinterpolation", (int)verticalinterpolation);
            General.Settings.WritePluginSetting("drawgridmode.continuousdrawing", panel.ContinuousDrawing);

            // Remove docker
            General.Interface.RemoveDocker(docker);
            panel.Dispose();
            panel = null;
        }