diff --git a/Source/Pablo/Drawing/ColourBox.cs b/Source/Pablo/Drawing/ColourBox.cs new file mode 100644 index 0000000..cad5150 --- /dev/null +++ b/Source/Pablo/Drawing/ColourBox.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Eto.Drawing; +using Eto.Forms; + +namespace Pablo.Drawing +{ + public abstract class ColourBox : Drawable + { + public abstract Color Color { get; set; } + + protected override void OnPaint(PaintEventArgs pe) + { + base.OnPaint(pe); + var rect = new Rectangle(Size); + pe.Graphics.FillRectangle(Color, rect); + pe.Graphics.DrawButtonOutline(rect); + } + } +} \ No newline at end of file diff --git a/Source/Pablo/Formats/Character/Controls/ColourEditor.cs b/Source/Pablo/Formats/Character/Controls/ColourEditor.cs index 4e0a1dc..3b22dd8 100644 --- a/Source/Pablo/Formats/Character/Controls/ColourEditor.cs +++ b/Source/Pablo/Formats/Character/Controls/ColourEditor.cs @@ -2,6 +2,7 @@ using Eto.Forms; using Eto.Drawing; using Pablo.Controls; +using Pablo.Drawing; namespace Pablo.Formats.Character.Controls { @@ -16,7 +17,7 @@ public class ColourEditor : Dialog int SelectedIndex { get; set; } - class SelectColourBox : ColourPad.ColourBox + class SelectColourBox : ColourBox { public int Index { get; set; } diff --git a/Source/Pablo/Formats/Character/Controls/ColourPad.cs b/Source/Pablo/Formats/Character/Controls/ColourPad.cs index 779c347..d1ad61a 100644 --- a/Source/Pablo/Formats/Character/Controls/ColourPad.cs +++ b/Source/Pablo/Formats/Character/Controls/ColourPad.cs @@ -26,19 +26,6 @@ public Palette Palette { #region ColourBox - public abstract class ColourBox : Drawable - { - public abstract Color Color { get; set; } - - protected override void OnPaint(PaintEventArgs pe) - { - base.OnPaint(pe); - var rect = new Rectangle(Size); - pe.Graphics.FillRectangle(Color, rect); - pe.Graphics.DrawButtonOutline(rect); - } - } - class FBColourBox : ColourBox { public ColourPad Pad { get; set; } diff --git a/Source/Pablo/Formats/Character/Icons/ApplyColour.ans b/Source/Pablo/Formats/Character/Icons/ApplyColour.ans new file mode 100644 index 0000000..5f0e7de Binary files /dev/null and b/Source/Pablo/Formats/Character/Icons/ApplyColour.ans differ diff --git a/Source/Pablo/Formats/Character/Icons/ApplyColour.png b/Source/Pablo/Formats/Character/Icons/ApplyColour.png deleted file mode 100644 index 1cdf8b2..0000000 Binary files a/Source/Pablo/Formats/Character/Icons/ApplyColour.png and /dev/null differ diff --git a/Source/Pablo/Formats/Character/Icons/ColourBrush.ans b/Source/Pablo/Formats/Character/Icons/ColourBrush.ans new file mode 100644 index 0000000..2c9fec1 Binary files /dev/null and b/Source/Pablo/Formats/Character/Icons/ColourBrush.ans differ diff --git a/Source/Pablo/Formats/Character/Icons/ColourBrush.png b/Source/Pablo/Formats/Character/Icons/ColourBrush.png deleted file mode 100644 index 11a1504..0000000 Binary files a/Source/Pablo/Formats/Character/Icons/ColourBrush.png and /dev/null differ diff --git a/Source/Pablo/Formats/Character/Icons/DrawBackground.ans b/Source/Pablo/Formats/Character/Icons/DrawBackground.ans new file mode 100644 index 0000000..2091e58 Binary files /dev/null and b/Source/Pablo/Formats/Character/Icons/DrawBackground.ans differ diff --git a/Source/Pablo/Formats/Character/Icons/DrawBackground.png b/Source/Pablo/Formats/Character/Icons/DrawBackground.png deleted file mode 100644 index 0c74a07..0000000 Binary files a/Source/Pablo/Formats/Character/Icons/DrawBackground.png and /dev/null differ diff --git a/Source/Pablo/Formats/Character/Icons/DrawForeground.ans b/Source/Pablo/Formats/Character/Icons/DrawForeground.ans new file mode 100644 index 0000000..168edeb Binary files /dev/null and b/Source/Pablo/Formats/Character/Icons/DrawForeground.ans differ diff --git a/Source/Pablo/Formats/Character/Icons/DrawForeground.png b/Source/Pablo/Formats/Character/Icons/DrawForeground.png deleted file mode 100644 index 040cf45..0000000 Binary files a/Source/Pablo/Formats/Character/Icons/DrawForeground.png and /dev/null differ diff --git a/Source/Pablo/Formats/Character/Icons/Erase.ans b/Source/Pablo/Formats/Character/Icons/Erase.ans new file mode 100644 index 0000000..de69018 Binary files /dev/null and b/Source/Pablo/Formats/Character/Icons/Erase.ans differ diff --git a/Source/Pablo/Formats/Character/Icons/Erase.png b/Source/Pablo/Formats/Character/Icons/Erase.png deleted file mode 100644 index 691fdfb..0000000 Binary files a/Source/Pablo/Formats/Character/Icons/Erase.png and /dev/null differ diff --git a/Source/Pablo/Formats/Character/Icons/Selection.ans b/Source/Pablo/Formats/Character/Icons/Selection.ans new file mode 100644 index 0000000..6802b21 Binary files /dev/null and b/Source/Pablo/Formats/Character/Icons/Selection.ans differ diff --git a/Source/Pablo/Formats/Character/Tools/BrushTool.cs b/Source/Pablo/Formats/Character/Tools/BrushTool.cs index 773105d..3a19c2a 100644 --- a/Source/Pablo/Formats/Character/Tools/BrushTool.cs +++ b/Source/Pablo/Formats/Character/Tools/BrushTool.cs @@ -87,9 +87,9 @@ protected override void Draw(Point location, MouseEventArgs e) Control InvertButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.Erase.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.Erase.ans", false), Toggle = true, Pressed = Inverted, ToolTip = "Erase mode (shift)" @@ -104,9 +104,9 @@ Control InvertButton() Control ColourButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.ApplyColour.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.ApplyColour.ans", false), Toggle = true, Pressed = ApplyColour, ToolTip = "Draw with color (alt)" diff --git a/Source/Pablo/Formats/Character/Tools/ColourBrush.cs b/Source/Pablo/Formats/Character/Tools/ColourBrush.cs index 70d808a..53eb0a1 100644 --- a/Source/Pablo/Formats/Character/Tools/ColourBrush.cs +++ b/Source/Pablo/Formats/Character/Tools/ColourBrush.cs @@ -26,28 +26,13 @@ public override CharacterHandler Handler } } - public override Cursor MouseCursor - { - get { return new Cursor(CursorType.Crosshair); } - } + public override Cursor MouseCursor => new Cursor(CursorType.Crosshair); - public override Eto.Drawing.Image Image - { - get { return ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.ColourBrush.png"); } - } + public override CharacterDocument DocumentImage => ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.ColourBrush.ans", false); - public override string Description - { - get { return "Color Brush - paint only foreground and/or background colour"; } - } + public override string Description => "Color Brush - paint only foreground and/or background colour"; - public override Keys Accelerator - { - get - { - return Keys.B | Keys.Shift | (Handler.Generator.IsMac ? Keys.Control : Keys.Alt); - } - } + public override Keys Accelerator => Keys.B | Keys.Shift | (Handler.Generator.IsMac ? Keys.Control : Keys.Alt); public ColourBrush() @@ -86,14 +71,12 @@ protected override void Draw(Point location, Eto.Forms.MouseEventArgs e) Control FGButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.DrawForeground.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.DrawForeground.ans"), Toggle = true, Pressed = PaintForeground, -#if DESKTOP ToolTip = "Paint foreground (shift)" -#endif }; control.Click += delegate @@ -105,14 +88,12 @@ Control FGButton() Control BGButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.DrawBackground.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.DrawBackground.ans"), Toggle = true, Pressed = PaintBackground, -#if DESKTOP ToolTip = "Paint background (alt)" -#endif }; control.Click += delegate diff --git a/Source/Pablo/Formats/Character/Tools/EllipseTool.cs b/Source/Pablo/Formats/Character/Tools/EllipseTool.cs index f30f58e..128ed4a 100644 --- a/Source/Pablo/Formats/Character/Tools/EllipseTool.cs +++ b/Source/Pablo/Formats/Character/Tools/EllipseTool.cs @@ -147,14 +147,12 @@ protected override void UpdateWithLocation(Rectangle rect, Keys modifiers, Point Control ApplyColourButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.ApplyColour.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.ApplyColour.ans", false), Toggle = true, Pressed = ApplyColour, -#if DESKTOP ToolTip = "Draw with color" -#endif }; control.Click += delegate diff --git a/Source/Pablo/Formats/Character/Tools/LineTool.cs b/Source/Pablo/Formats/Character/Tools/LineTool.cs index 5aa200f..1d8227b 100644 --- a/Source/Pablo/Formats/Character/Tools/LineTool.cs +++ b/Source/Pablo/Formats/Character/Tools/LineTool.cs @@ -155,14 +155,12 @@ protected override void UpdateWithLocation(Rectangle rect, Keys modifiers, Point Control ApplyColourButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.ApplyColour.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.ApplyColour.ans", false), Toggle = true, Pressed = ApplyColour, -#if DESKTOP ToolTip = "Draw with color" -#endif }; control.Click += delegate diff --git a/Source/Pablo/Formats/Character/Tools/PencilTool.cs b/Source/Pablo/Formats/Character/Tools/PencilTool.cs index 76c0003..2041fa5 100644 --- a/Source/Pablo/Formats/Character/Tools/PencilTool.cs +++ b/Source/Pablo/Formats/Character/Tools/PencilTool.cs @@ -98,14 +98,12 @@ protected override void Draw(Point location, Eto.Forms.MouseEventArgs e) Control InvertButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.Erase.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.Erase.ans", false), Toggle = true, Pressed = Inverted, -#if DESKTOP ToolTip = "Erase mode (shift)" -#endif }; control.Click += delegate @@ -117,14 +115,12 @@ Control InvertButton() Control ColourButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.ApplyColour.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.ApplyColour.ans", false), Toggle = true, Pressed = ApplyColour, -#if DESKTOP ToolTip = "Draw with color (alt)" -#endif }; control.Click += delegate diff --git a/Source/Pablo/Formats/Character/Tools/RectangleTool.cs b/Source/Pablo/Formats/Character/Tools/RectangleTool.cs index f5c578f..e80a6ee 100644 --- a/Source/Pablo/Formats/Character/Tools/RectangleTool.cs +++ b/Source/Pablo/Formats/Character/Tools/RectangleTool.cs @@ -140,9 +140,9 @@ public override void Cancel() Control ApplyColourButton() { - var control = new ImageButton + var control = new AnsiButton { - Image = ImageCache.BitmapFromResource("Pablo.Formats.Character.Icons.ApplyColour.png"), + Document = ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.ApplyColour.ans", false), Toggle = true, Pressed = ApplyColour, ToolTip = "Draw with color" diff --git a/Source/Pablo/Formats/Character/Tools/Selection.cs b/Source/Pablo/Formats/Character/Tools/Selection.cs index 70b0a71..7b835a2 100644 --- a/Source/Pablo/Formats/Character/Tools/Selection.cs +++ b/Source/Pablo/Formats/Character/Tools/Selection.cs @@ -21,33 +21,15 @@ public class Selection : CenterAspectTool Rectangle? selectedRegion; Canvas pasteCanvas; - public override Eto.Drawing.Image Image - { - get { return ImageCache.BitmapFromResource("Pablo.Formats.Rip.Icons.Copy.png"); } - } + public override CharacterDocument DocumentImage => ImageCache.CharacterFromResource("Pablo.Formats.Character.Icons.Selection.ans"); - public override string Description - { - get { return "Selection - Select text and position the cursor with the mouse"; } - } + public override string Description => "Selection - Select text and position the cursor with the mouse"; - public override Keys Accelerator - { - get - { - return Keys.E | (Handler.Generator.IsMac ? Keys.Control : Keys.Alt); - } - } + public override Keys Accelerator => Keys.E | (Handler.Generator.IsMac ? Keys.Control : Keys.Alt); - public override Cursor MouseCursor - { - get { return new Cursor(CursorType.IBeam); } - } + public override Cursor MouseCursor => new Cursor(CursorType.IBeam); - public override bool AllowKeyboard - { - get { return drawMode == DrawMode.Normal; } - } + public override bool AllowKeyboard => drawMode == DrawMode.Normal; public override void Unselected() { diff --git a/Source/Pablo/Formats/Rip/Controls/ColourPad.cs b/Source/Pablo/Formats/Rip/Controls/ColourPad.cs index 39c88d5..b749d8a 100644 --- a/Source/Pablo/Formats/Rip/Controls/ColourPad.cs +++ b/Source/Pablo/Formats/Rip/Controls/ColourPad.cs @@ -4,6 +4,7 @@ using Eto; using System.Collections.Generic; using Pablo.Controls; +using Pablo.Drawing; namespace Pablo.Formats.Rip.Controls { @@ -23,20 +24,6 @@ public Palette Palette { #region ColourBox - public abstract class ColourBox : Drawable - { - public abstract Color Color { get; set; } - - protected override void OnPaint (PaintEventArgs pe) - { - base.OnPaint (pe); - var rect = new Rectangle (Point.Empty, this.Size); - pe.Graphics.DrawInsetRectangle (Colors.Gray, Colors.White, rect); - rect.Inflate (-1, -1); - pe.Graphics.FillRectangle (Color, rect); - } - } - class FBColourBox : ColourBox { public ColourPad Pad { get; set; }