diff options
author | Ian C <ianc@noddybox.co.uk> | 2020-07-17 13:06:38 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2020-07-17 13:06:38 +0000 |
commit | 453fd6e66fb70779e8ec803abc207a814ffdb9b0 (patch) | |
tree | 5337423baef0e5aa3d48091f127de038ef7f43fe | |
parent | 539b374d35c8b1fa2ee860c863c83be227ab4937 (diff) |
Made sprite number and palette index editable.
-rw-r--r-- | SpriteEd/Main.storyboard | 10 | ||||
-rw-r--r-- | SpriteEd/ViewController.cs | 22 | ||||
-rw-r--r-- | SpriteEd/ViewController.designer.cs | 16 |
3 files changed, 41 insertions, 7 deletions
diff --git a/SpriteEd/Main.storyboard b/SpriteEd/Main.storyboard index def562e..e058c67 100644 --- a/SpriteEd/Main.storyboard +++ b/SpriteEd/Main.storyboard @@ -492,11 +492,14 @@ Gw <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vru-p3-CZW"> <rect key="frame" x="20" y="559" width="41" height="21"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="8w4-fI-HAj"> + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="8w4-fI-HAj"> <font key="font" usesAppearanceFont="YES"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <action selector="OnSpriteNumber:" target="XfG-lQ-9wD" id="Xt7-iy-9sH"/> + </connections> </textField> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OOh-QE-F3j"> <rect key="frame" x="88" y="561" width="279" height="16"/> @@ -521,11 +524,14 @@ Gw <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iXZ-D0-tCL"> <rect key="frame" x="666" y="559" width="41" height="21"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="uD4-8J-1jJ"> + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="uD4-8J-1jJ"> <font key="font" metaFont="system"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <action selector="OnColourNumber:" target="XfG-lQ-9wD" id="xet-qP-shp"/> + </connections> </textField> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FGJ-Vk-aSZ"> <rect key="frame" x="712" y="555" width="19" height="28"/> diff --git a/SpriteEd/ViewController.cs b/SpriteEd/ViewController.cs index 39f868a..78db84f 100644 --- a/SpriteEd/ViewController.cs +++ b/SpriteEd/ViewController.cs @@ -167,6 +167,17 @@ namespace SpriteEd } /// <summary> + /// Called when the sprite number is edited. + /// </summary> + /// <param name="sender">The event sender.</param> + partial void OnSpriteNumber(NSObject sender) + { + m_SpriteNumber.IntValue = Math.Max(0, Math.Min(255, m_SpriteNumber.IntValue)); + m_SpriteStepper.IntValue = m_SpriteNumber.IntValue; + OnSpriteStepper(m_SpriteStepper); + } + + /// <summary> /// Called when the colour stepper is pressed. /// </summary> /// <param name="sender">The event sender.</param> @@ -187,6 +198,17 @@ namespace SpriteEd } /// <summary> + /// Called when the colour number is edited. + /// </summary> + /// <param name="sender">The event sender.</param> + partial void OnColourNumber(NSObject sender) + { + m_ColourNumber.IntValue = Math.Max(0, Math.Min((int)m_ColourStepper.MaxValue, m_ColourNumber.IntValue)); + m_ColourStepper.IntValue = m_ColourNumber.IntValue; + OnColourStepper(m_ColourStepper); + } + + /// <summary> /// Called when the colour well is interacted with. /// </summary> /// <param name="sender">The event sender.</param> diff --git a/SpriteEd/ViewController.designer.cs b/SpriteEd/ViewController.designer.cs index 9116f3d..451551f 100644 --- a/SpriteEd/ViewController.designer.cs +++ b/SpriteEd/ViewController.designer.cs @@ -33,6 +33,9 @@ namespace SpriteEd [Outlet] AppKit.NSStepper m_SpriteStepper { get; set; } + [Action ("OnColourNumber:")] + partial void OnColourNumber (Foundation.NSObject sender); + [Action ("OnColourStepper:")] partial void OnColourStepper (Foundation.NSObject sender); @@ -42,6 +45,9 @@ namespace SpriteEd [Action ("OnDrawingMode:")] partial void OnDrawingMode (Foundation.NSObject sender); + [Action ("OnSpriteNumber:")] + partial void OnSpriteNumber (Foundation.NSObject sender); + [Action ("OnSpriteStepper:")] partial void OnSpriteStepper (Foundation.NSObject sender); @@ -62,6 +68,11 @@ namespace SpriteEd m_ColourStepper = null; } + if (m_ColourWell != null) { + m_ColourWell.Dispose (); + m_ColourWell = null; + } + if (m_SpriteEdit != null) { m_SpriteEdit.Dispose (); m_SpriteEdit = null; @@ -76,11 +87,6 @@ namespace SpriteEd m_SpriteStepper.Dispose (); m_SpriteStepper = null; } - - if (m_ColourWell != null) { - m_ColourWell.Dispose (); - m_ColourWell = null; - } } } } |