Esempio n. 1
0
        public KeyPictureBox(int scanCode, int extended, BlankButton button, float scale, int horizontalStretch, int verticalStretch)
        {
            this.scanCode          = scanCode;
            this.extended          = extended;
            this.button            = button;
            this.scale             = scale;
            this.horizontalStretch = horizontalStretch;
            this.verticalStretch   = verticalStretch;
            dragIconScale          = 0.75F;
            dragbox = Rectangle.Empty;

            Map = MappingsManager.GetKeyMapping(scanCode, extended);

            mapped = (Map.To.ScanCode != -1);

            AllowDrop = true;

            // Box controls itself.
            DragOver          += KeyPictureBoxDragOver;
            DragDrop          += KeyPictureBoxDragDrop;
            DragLeave         += KeyPictureBoxDragLeave;
            GiveFeedback      += KeyPictureBoxGiveFeedback;
            MouseDown         += KeyPictureBoxMouseDown;
            MouseMove         += KeyPictureBoxMouseMove;
            MouseUp           += KeyPictureBoxMouseUp;
            QueryContinueDrag += KeyPictureBoxQueryContinueDrag;

            DrawKey();
            Width  = Image.Width;
            Height = Image.Height;
        }
Esempio n. 2
0
        void DrawKey(int scancode, int extended, ref int left, int top, BlankButton button, int horizontalStretch, int verticalStretch)
        {
            KeyPictureBox box = new KeyPictureBox(scancode, extended, button, this._buttonScale, horizontalStretch, verticalStretch);

            box.Left = left;
            box.Top  = top;

            this.KeyboardPanel.Controls.Add(box);

            // Set the event handler unless filter is boot mappings and user can't write to boot mappings and this isn't Vista
            if (((MappingsManager.Filter == MappingFilter.Boot &&
                  !AppController.UserCanWriteBootMappings &&
                  !operatingSystemCapability.ImplementsUAC)) == false)
            {
                box.DoubleClick += KeyDoubleClick;
            }

            string toolTipText = box.Map.MappingDescription;

            if (String.IsNullOrEmpty(toolTipText) == false)
            {
                FormToolTip.SetToolTip(box, toolTipText);
            }

            // left is a ref parameter.
            left += box.Image.Width + _paddingWidth; // Width varies eg for double-width blanks
        }
Esempio n. 3
0
	    public KeyPictureBox(int scancode, int extended, BlankButton button, float scale, int horizontalStretch, int verticalStretch)
		{
			_scancode = scancode;
			_extended = extended;
			_button = button;
			_scale = scale;
			_horizontalStretch = horizontalStretch;
			_verticalStretch = verticalStretch;
			_dragIconScale = 0.75F;
			_dragbox = Rectangle.Empty;
			
			Map = MappingsManager.GetKeyMapping(_scancode, _extended);

			_mapped = (Map.To.Scancode != -1);

			this.AllowDrop = true;

			// Box controls itself.
			this.DragOver += KeyPictureBoxDragOver;
			this.DragDrop += KeyPictureBoxDragDrop;
			this.DragLeave += KeyPictureBoxDragLeave;
			this.GiveFeedback += KeyPictureBoxGiveFeedback;
			this.MouseDown += KeyPictureBoxMouseDown;
			this.MouseMove += KeyPictureBoxMouseMove;
			this.MouseUp += KeyPictureBoxMouseUp;
			this.QueryContinueDrag += KeyPictureBoxQueryContinueDrag;

			DrawKey();
			this.Width = this.Image.Width;
			this.Height = this.Image.Height;
        }
Esempio n. 4
0
        private static Bitmap GetBitmap(BlankButton button, int horizontalStretch, int verticalStretch, float scale, ButtonEffect effect, bool transform)
        {
            if (Math.Abs(scale - lastScale) > Single.Epsilon)
            {
                FontSize.SetFontSizes(scale);
            }

            Bitmap bmp;

            // Cache bitmap until scale or button changes (as long as no stretch is applied)

            if (horizontalStretch != 0 || verticalStretch != 0)
            {
                // IF this image needs to be stretched, force the height and width to even numbers
                // (This only seems to affect height?)
                bool forceEvenNumber = (verticalStretch != 0);
                bmp = ResizeBitmap(GetBitmap(button), scale, forceEvenNumber);
                bmp = StretchBitmap(bmp, horizontalStretch, verticalStretch);
                // _lastButton = BlankButton.None;
            }
            else
            {
                bmp = ResizeBitmap(GetBitmap(button), scale, false);
            }

            // Now all decisions have been made..
            lastScale = scale;

            if (transform)
            {
                bmp = ApplyEffect(bmp, effect);
            }

            return(bmp);
        }
Esempio n. 5
0
        // Custom ColorMatrix and font colour
        public static Bitmap GetButtonImage(BlankButton button, float scale, string caption, ColorMatrix cm, Color fontColour)
        {
            Bitmap bmp = GetBitmap(button, 0, 0, scale, ButtonEffect.None, false);

            bmp = Transform(bmp, cm);
            return(WriteCaption(bmp, caption, false, false, fontColour));
        }
Esempio n. 6
0
        public KeyPictureBox(int scancode, int extended, BlankButton button, float scale, int horizontalStretch, int verticalStretch)
        {
            _scancode          = scancode;
            _extended          = extended;
            _button            = button;
            _scale             = scale;
            _horizontalStretch = horizontalStretch;
            _verticalStretch   = verticalStretch;
            _dragIconScale     = 0.75F;
            _dragbox           = Rectangle.Empty;

            Map = MappingsManager.GetKeyMapping(_scancode, _extended);

            _mapped = (Map.To.Scancode != -1);

            this.AllowDrop = true;

            // Box controls itself.
            this.DragOver          += KeyPictureBoxDragOver;
            this.DragDrop          += KeyPictureBoxDragDrop;
            this.DragLeave         += KeyPictureBoxDragLeave;
            this.GiveFeedback      += KeyPictureBoxGiveFeedback;
            this.MouseDown         += KeyPictureBoxMouseDown;
            this.MouseMove         += KeyPictureBoxMouseMove;
            this.MouseUp           += KeyPictureBoxMouseUp;
            this.QueryContinueDrag += KeyPictureBoxQueryContinueDrag;

            DrawKey();
            this.Width  = this.Image.Width;
            this.Height = this.Image.Height;
        }
Esempio n. 7
0
        protected override string GetDescString(string langid = null)
        {
            var desc = $"";

            if (BlankClearRadius != 0)
            {
                desc = $"<style=cIsUtility>{descText}</style>";
            }
            if (BlankClearRadius == -1)
            {
                desc += $" in the stage.";
            }
            else
            {
                desc += $"within a radius of {BlankClearRadius} meters";
            }
            desc += $" <style=cIsUtility>Pushes enemies back</style>, and <style=cIsDamage>deals {Pct(Blank_DamageDealt)} damage</style>";
            if (BlankRadius == BlankClearRadius)
            {
                desc += $".";
            }
            else
            {
                desc += $" within {BlankRadius}";
            }
            desc += $"\nConsumed on use." +
                    $"\nCooldown: {ConfigBlankCooldown} seconds" +
                    $"\nPress " + BlankButton.ToString() + " to activate";
            return(desc);
        }
Esempio n. 8
0
        public KeyPictureBox(int scancode, int extended, BlankButton button, float scale, int horizontalStretch, int verticalStretch)
        {
            this.scancode = scancode;
            this.extended = extended;
            this.button = button;
            this.scale = scale;
            this.horizontalStretch = horizontalStretch;
            this.verticalStretch = verticalStretch;
            this.dragIconScale = 0.75F;
            this.dragbox = Rectangle.Empty;

            Map = MappingsManager.GetKeyMapping(scancode, extended);

            this.mapped = (Map.To.Scancode != -1);

            AllowDrop = true;

            // Box controls itself.
            DragOver += KeyPictureBoxDragOver;
            DragDrop += KeyPictureBoxDragDrop;
            DragLeave += KeyPictureBoxDragLeave;
            GiveFeedback += KeyPictureBoxGiveFeedback;
            MouseDown += KeyPictureBoxMouseDown;
            MouseMove += KeyPictureBoxMouseMove;
            MouseUp += KeyPictureBoxMouseUp;
            QueryContinueDrag += KeyPictureBoxQueryContinueDrag;

            DrawKey();
            Width = Image.Width;
            Height = Image.Height;
        }
Esempio n. 9
0
        public static Bitmap GetBitmap(BlankButton button)
        {
            // Have we already extracted this bmp?
            // Buttons are stored as lower case.
            string buttonname = button.ToString().ToLowerInvariant();

            return(GetImage(buttonname, "png"));
        }
Esempio n. 10
0
        public static Bitmap GetBitmap(BlankButton button)
        {
            // Have we already extracted this bmp?
            // Buttons are stored as lower case.
            string buttonname = button.ToString().ToLowerInvariant();

            return GetImage(buttonname, "png");
        }
 public KeyboardLayoutElement(int scancode, int extended, BlankButton button,
                              int horizontalStretch, int verticalStretch, int rightPadding)
 {
     _scancode          = scancode;
     _extended          = extended;
     _button            = button;
     _horizontalstretch = horizontalStretch;
     _verticalstretch   = verticalStretch;
     _rightpadding      = rightPadding;
 }
Esempio n. 12
0
 public KeyboardLayoutElement(int scancode, int extended, BlankButton button,
                              int horizontalStretch, int verticalStretch, int rightPadding)
 {
     this._scancode = scancode;
     this._extended = extended;
     this._button = button;
     this._horizontalstretch = horizontalStretch;
     this._verticalstretch = verticalStretch;
     this._rightpadding = rightPadding;
 }
Esempio n. 13
0
 public KeyboardLayoutElement(int scanCode, int extended, BlankButton button,
                              int horizontalStretch, int verticalStretch, int rightPadding)
 {
     ScanCode          = scanCode;
     Extended          = extended;
     Button            = button;
     HorizontalStretch = horizontalStretch;
     VerticalStretch   = verticalStretch;
     RightPadding      = rightPadding;
 }
Esempio n. 14
0
		// This (private) method does the work. 
		private static Bitmap GetButtonImage(int scancode, int extended, BlankButton button, int horizontalStretch,
															int verticalStretch, float scale, ButtonEffect effect, string caption)
		{
            Bitmap bmp = GetBitmap(button, horizontalStretch, verticalStretch, scale, effect, true);

			Color fontColour = GetFontColour(effect);

			Bitmap bmpWithCaption;
            if (String.IsNullOrEmpty(caption))
            {
                bmpWithCaption = WriteCaption(bmp, scancode, extended, fontColour);
            }
            else
            {
                bmpWithCaption = WriteCaption(bmp, caption, false, false, fontColour);
            }

		    return bmpWithCaption;
		}
Esempio n. 15
0
        // This (private) method does the work.
        private static Bitmap GetButtonImage(int scancode, int extended, BlankButton button, int horizontalStretch,
                                             int verticalStretch, float scale, ButtonEffect effect, string caption)
        {
            Bitmap bmp = GetBitmap(button, horizontalStretch, verticalStretch, scale, effect, true);

            Color fontColour = GetFontColour(effect);

            Bitmap bmpWithCaption;

            if (String.IsNullOrEmpty(caption))
            {
                bmpWithCaption = WriteCaption(bmp, scancode, extended, fontColour);
            }
            else
            {
                bmpWithCaption = WriteCaption(bmp, caption, false, false, fontColour);
            }

            return(bmpWithCaption);
        }
Esempio n. 16
0
        private void DrawKey(int scanCode, int extended, ref int left, int top, BlankButton button, int horizontalStretch, int verticalStretch)
        {
            var box = new KeyPictureBox(scanCode, extended, button, buttonScale, horizontalStretch, verticalStretch);

            box.Left = left;
            box.Top  = top;

            KeyboardPanel.Controls.Add(box);

            box.DoubleClick += KeyDoubleClick;

            string toolTipText = box.Map.MappingDescription;

            if (string.IsNullOrEmpty(toolTipText) == false)
            {
                FormToolTip.SetToolTip(box, toolTipText);
            }

            // left is a ref parameter.
            left += box.Image.Width + paddingWidth; // Width varies eg for double-width blanks
        }
Esempio n. 17
0
		// Custom ColorMatrix and font colour
		public static Bitmap GetButtonImage(BlankButton button, float scale, string caption, ColorMatrix cm, Color fontColour)
		{
			Bitmap bmp = GetBitmap(button, 0, 0, scale, ButtonEffect.None, false);
			bmp = Transform(bmp, cm);
			return WriteCaption(bmp, caption, false, false, fontColour);
		}
Esempio n. 18
0
 // Offers full control over the button scale and stretch.
 public static Bitmap GetButtonImage
     (int scancode, int extended, BlankButton button, int horizontalStretch, int verticalStretch, float scale, ButtonEffect effect)
 {
     return(GetButtonImage
                (scancode, extended, button, horizontalStretch, verticalStretch, scale, effect, String.Empty));
 }
Esempio n. 19
0
        void DrawKey(int scancode, int extended, ref int left, int top, BlankButton button, int horizontalStretch, int verticalStretch)
        {

            KeyPictureBox box = new KeyPictureBox(scancode, extended, button, this._buttonScale, horizontalStretch, verticalStretch);

            box.Left = left;
            box.Top = top;

            this.KeyboardPanel.Controls.Add(box);

            // Set the event handler unless filter is boot mappings and user can't write to boot mappings and this isn't Vista
            if (((MappingsManager.Filter == MappingFilter.Boot
                && !AppController.UserCanWriteBootMappings
                && !operatingSystemCapability.ImplementsUAC)) == false)
            {
                box.DoubleClick += KeyDoubleClick;
            }

            string toolTipText = box.Map.MappingDescription;

            if (String.IsNullOrEmpty(toolTipText) == false)
                FormToolTip.SetToolTip(box, toolTipText);

            // left is a ref parameter.
            left += box.Image.Width + _paddingWidth; // Width varies eg for double-width blanks

        }
Esempio n. 20
0
 // Specific scaled button with custom caption
 public static Bitmap GetButtonImage(BlankButton button, float scale, string caption, ButtonEffect effect)
 {
     return(GetButtonImage(-1, -1, button, 0, 0, scale, effect, caption));
 }
Esempio n. 21
0
        private void DrawKey(int scancode, int extended, ref int left, int top, BlankButton button, int horizontalStretch, int verticalStretch)
        {
            KeyPictureBox box = new KeyPictureBox(scancode, extended, button, buttonScale, horizontalStretch, verticalStretch);

            box.Left = left;
            box.Top = top;

            KeyboardPanel.Controls.Add(box);

            box.DoubleClick += KeyDoubleClick;

            string toolTipText = box.Map.MappingDescription;

            if (string.IsNullOrEmpty(toolTipText) == false)
                FormToolTip.SetToolTip(box, toolTipText);

            // left is a ref parameter.
            left += box.Image.Width + paddingWidth; // Width varies eg for double-width blanks
        }
Esempio n. 22
0
        private static Bitmap GetBitmap(BlankButton button, int horizontalStretch, int verticalStretch, float scale, ButtonEffect effect, bool transform)
		{
            if (Math.Abs(scale - lastScale) > Single.Epsilon)
            {
                FontSize.SetFontSizes(scale);
            }

		    Bitmap bmp;

			// Cache bitmap until scale or button changes (as long as no stretch is applied)

			if (horizontalStretch != 0 || verticalStretch != 0)
			{
				// IF this image needs to be stretched, force the height and width to even numbers
				// (This only seems to affect height?)
				bool forceEvenNumber = (verticalStretch != 0);
				bmp = ResizeBitmap(GetBitmap(button), scale, forceEvenNumber);
				bmp = StretchBitmap(bmp, horizontalStretch, verticalStretch);
				// _lastButton = BlankButton.None;

			}
			else
            {
                  bmp = ResizeBitmap(GetBitmap(button), scale, false);
            }

			// Now all decisions have been made..
			lastScale = scale;

			if (transform)
				bmp = ApplyEffect(bmp, effect);

			return bmp;

		}
Esempio n. 23
0
		// Specific scaled button with custom caption
		public static Bitmap GetButtonImage(BlankButton button, float scale, string caption, ButtonEffect effect)
		{
			return GetButtonImage(-1, -1, button, 0, 0, scale, effect, caption);
		}
Esempio n. 24
0
		// Offers full control over the button scale and stretch.
		public static Bitmap GetButtonImage
			(int scancode, int extended, BlankButton button, int horizontalStretch, int verticalStretch, float scale, ButtonEffect effect)
		{
			return GetButtonImage
				(scancode, extended, button, horizontalStretch, verticalStretch, scale, effect, String.Empty);
		}