Example #1
0
        private void drawAutoblanksHover(int squareSize, Point hover, Graphics g)
        {
            if (!Settings.Get.UseAutoBlanker)
            {
                return;
            }

            Color hoverColor = MathHelper.Lerp(this.GetColor(Field.Empty), Color.White, 0.5f);
            bool  xOk        = this.puzzle.IsInRangeX(hover.X);
            bool  yOk        = this.puzzle.IsInRangeY(hover.Y);

            if (xOk && !yOk)
            {
                bool[] autoblanks = AutoBlanker.GetCol(this.puzzle, this.puzzleForNumbers, hover.X);
                for (int y = 0; y < autoblanks.Length; y++)
                {
                    if (autoblanks[y])
                    {
                        this.fillRectangle(g, hoverColor, squareSize, hover.X, y);
                    }
                }
            }

            else if (!xOk && yOk)
            {
                bool[] autoblanks = AutoBlanker.GetRow(this.puzzle, this.puzzleForNumbers, hover.Y);
                for (int x = 0; x < autoblanks.Length; x++)
                {
                    if (autoblanks[x])
                    {
                        this.fillRectangle(g, hoverColor, squareSize, x, hover.Y);
                    }
                }
            }
        }
Example #2
0
        private void doMouseClick(Point p, Field value) {
            // Set the puzzle value at point p
            if (this.Puzzle.IsInRange(p)) {
                if (this.Puzzle[p] == value)
                    this.Puzzle[p] = Field.Unknown;
                else
                    this.Puzzle[p] = value;
            }

            // Or autoblank all columns
            else if (Settings.Get.UseAutoBlanker && !this.EditorMode) {
                if (this.Puzzle.IsInRangeX(p.X)) {
                    bool[] autoblanks = AutoBlanker.GetCol(this.Puzzle, this.BackUpOriginalPuzzle, p.X);
                    for (int y = 0; y < autoblanks.Length; y++)
                        if (autoblanks[y])
                            this.Puzzle[p.X, y] = Field.Empty;
                }
                else if (this.Puzzle.IsInRangeY(p.Y)) {
                    bool[] autoblanks = AutoBlanker.GetRow(this.Puzzle, this.BackUpOriginalPuzzle, p.Y);
                    for (int x = 0; x < autoblanks.Length; x++)
                        if (autoblanks[x])
                            this.Puzzle[x, p.Y] = Field.Empty;
                }
            }
        }