Example #1
0
        /// <summary>
        /// The static constructor
        /// </summary>
        /// <returns>A single instance of the stopMulti form</returns>
        public static stopMulti makeStopMulti()
        {
            if (stop == null)
                stop = new stopMulti();

            return stop;
        }
Example #2
0
        /// <summary>
        /// The static constructor
        /// </summary>
        /// <returns>A single instance of the stopMulti form</returns>
        public static stopMulti makeStopMulti()
        {
            if (stop == null)
            {
                stop = new stopMulti();
            }

            return(stop);
        }
Example #3
0
        public void setup()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // Initialize the Terrain
            string a2da = "terrainmaterials";
            string ter  = "Terrain";

            brushTextureList.Initialize(a2da, ter, ter);

            brushTextureList.ChangeSelected += new TextureBrowser.ChangeSelectedEventHandler(previewTexture);
            previewTexture(null);

            // Paints
            setTooltip(numericRounds, "Set the number of paints that you want performed. Remember it will make the " +
                       "squared number of paints");

            // Presure:
            texturePresureChanged(null, null);

            // Presure change handlers
            presureTrack.ValueChanged += new EventHandler(this.texturePresureChanged);
            setTooltip(presureTrack, "Set the presure of the current texture");

            coverageTrack.ValueChanged += new EventHandler(this.UpdateRange);
            setTooltip(coverageTrack, "Set the coverage of the current texture");

            UpdateRange(null, null);

            // GrassValues
            UpdateGrass(null, null);
            grassCoverageTrackbar.ValueChanged += new EventHandler(this.UpdateGrass);
            setTooltip(grassCoverageTrackbar, "Set the coverage of the grass");

            grassDensityTrackbar.ValueChanged += new EventHandler(this.UpdateGrass);
            setTooltip(grassDensityTrackbar, "Set the grass density");

            grassTextures.Initialize("grass", "Texture", "Grass");
            grassTextures.multiple();

            bladeSize.ValueChanged += new EventHandler(this.secondaryBlade);
            setTooltip(bladeSize, "Set the size of the blades");

            bladeSizeVariation.ValueChanged += new EventHandler(this.secondaryBlade);
            setTooltip(bladeSizeVariation, "Set the variation of the blade size");

            secondaryBlade(null, null);

            paintGrass.Checked = false;
            setTooltip(paintGrass, "Set whether or not you want to have grass painted");

            colourButton.BackColor = Color.Black;
            colourButton.Click    += new EventHandler(this.colour);

            colourCoverage.ValueChanged += new EventHandler(this.colourTrackbarValues);
            setTooltip(colourCoverage, "Set the coverage of the colour");

            colourPresure.ValueChanged += new EventHandler(this.colourTrackbarValues);
            setTooltip(colourPresure, "Set the presure of the colour");

            paintColour.Checked = false;
            setTooltip(paintColour, "Set whether you want to have colour painted or not");

            colourTrackbarValues(null, null);

            // export and import
            exportButton.Click += new EventHandler(exportBrush);
            setTooltip(exportButton, "Export the current settings to a XML file");

            importButton.Click += new EventHandler(importBrush);
            setTooltip(importButton, "Import settings from a XML file");

            // eyedrop tool
            eyedropTool.Click += new EventHandler(eyedropMethod);
            setTooltip(eyedropTool, "The eyedrop tool allows you to select a terrain region and import its selected textures into this form");
            eyedropTool.DialogResult = DialogResult.OK;

            Polygon.Click += new EventHandler(polygonMethod);
            setTooltip(Polygon, "The polygon tool allows you to paint a polygon and let the tool fill it out with textures");
            Polygon.DialogResult = DialogResult.OK;

            exit.Click += new EventHandler(exitMethod);
            setTooltip(exit, "Start using the multibrush");
            exit.DialogResult = DialogResult.OK;

            stopUsing.Click += new EventHandler(stopMethod);
            setTooltip(stopUsing, "Stop using the multibrush");
            stopUsing.DialogResult = DialogResult.OK;

            // Textures list
            setTooltip(textureList, "Textures placed heigher will be painted before textures placed lower");

            // Accept button
            acceptBrush.Click += new EventHandler(AcceptBrushClick);
            setTooltip(acceptBrush, "Save the settings for the current brush");

            up.Click += new EventHandler(UpClick);
            setTooltip(up, "Move the selected brush up one level in the hierarchy");

            down.Click += new EventHandler(DownClick);
            setTooltip(down, "Move the selected brush down one level in the hierarchy");

            add.Click += new EventHandler(addBrush);
            setTooltip(add, "Add a new brush");

            remove.Click += new EventHandler(removeBrush);
            setTooltip(remove, "Remove the selected brush");

            numericRounds.Value   = 3;
            numericRounds.Minimum = 3;
            numericRounds.Maximum = 10;

            toPresureVar.ValueChanged    += new EventHandler(this.varianceChanged);
            fromPresureVar.ValueChanged  += new EventHandler(this.varianceChanged);
            toCoverageVar.ValueChanged   += new EventHandler(this.varianceChanged);
            fromCoverageVar.ValueChanged += new EventHandler(this.varianceChanged);
            varianceChanged(toPresureVar, null);
            varianceChanged(fromPresureVar, null);
            varianceChanged(toCoverageVar, null);
            varianceChanged(fromCoverageVar, null);

            LinkedList <System.Windows.Forms.Control> controls = new LinkedList <Control>();

            // Set the tabindex

            #region Textures
            controls.AddLast(brushTextureList);
            controls.AddLast(numericRounds);
            controls.AddLast(randomCheck);

            // List controls
            controls.AddLast(up);
            controls.AddLast(down);
            controls.AddLast(textureList);
            controls.AddLast(add);
            controls.AddLast(remove);

            controls.AddLast(presureTrack);
            controls.AddLast(coverageTrack);

            controls.AddLast(acceptBrush);

            controls.AddLast(fromPresureVar);
            controls.AddLast(toPresureVar);
            controls.AddLast(fromCoverageVar);
            controls.AddLast(toCoverageVar);
            #endregion

            #region Options
            controls.AddLast(exit);

            controls.AddLast(importButton);
            controls.AddLast(exportButton);

            controls.AddLast(numInner);
            controls.AddLast(numOuter);

            controls.AddLast(eyedropTool);

            controls.AddLast(stopUsing);
            #endregion

            #region Colour
            controls.AddLast(colourButton);
            controls.AddLast(paintColour);
            controls.AddLast(colourCoverage);
            controls.AddLast(colourPresure);
            #endregion

            #region Brush size
            controls.AddLast(numInner);
            controls.AddLast(numOuter);
            #endregion

            #region Grass
            controls.AddLast(grassCoverageTrackbar);
            controls.AddLast(grassDensityTrackbar);
            controls.AddLast(bladeSize);
            controls.AddLast(bladeSizeVariation);
            controls.AddLast(paintGrass);
            controls.AddLast(grassTextures);
            #endregion

            int index = 1;
            foreach (System.Windows.Forms.Control control in controls)
            {
                control.TabIndex = index;
                index++;
            }


            if (textureList.Items.Count == 0)
            {
                addBrush(null, null);
            }
            textureList.SelectedIndex = 0;

            // Popup with information on how to close the plug-in
            if (Multibrush.PluginContainer.popup)
            {
                stopMulti stop = stopMulti.makeStopMulti();

                stop.reset();
                stop.ShowDialog();

                Multibrush.PluginContainer.popup = !stop.dontShow;
            }
        }