예제 #1
0
 /// <summary>
 /// Loads a search form containing the results of a search query.
 /// </summary>
 /// <param name="searchIndexNum">The search index control to update when a search result is selected.</param>
 /// <param name="searchField">The search field control containing the search query text.</param>
 /// <param name="searchButton">The search button control that invokes the search.</param>
 /// <param name="function">The function to execute when a search is invoked.</param>
 /// <param name="type">The type of control that contains the search results.
 /// Options include: treeView, richTextBox</param>
 public Search(ToolStripNumericUpDown searchIndexNum, ToolStripTextBox searchField, ToolStripButton searchButton, Delegate function, string type)
 {
     InitializeComponent();
     this.searchIndexNum = searchIndexNum;
     this.searchField    = searchField;
     this.searchButton   = searchButton;
     InitializeProperties();
     this.function = function;
     this.toolStripSeparator1.Visible = type == "richTextBox";
     this.toolStripLabel1.Visible     = type == "richTextBox";
     this.replaceAllButton.Visible    = type == "richTextBox";
     this.replaceWithText.Visible     = type == "richTextBox";
     if (type == "treeView")
     {
         this.treeView.Enabled = true;
         this.treeView.Show();
         this.treeView.BringToFront();
         this.function.DynamicInvoke(treeView, stringComparison, matchWholeWord.Checked);
     }
     else if (type == "richTextBox")
     {
         this.richTextBox.Enabled = true;
         this.richTextBox.Show();
         this.richTextBox.BringToFront();
         this.function.DynamicInvoke(richTextBox, stringComparison, matchWholeWord.Checked, false, "");
     }
     this.Location = searchFieldLocation;
     InitializeTimer();
 }
예제 #2
0
        private void ValueChanged(object sender, EventArgs e)
        {
            if (!LoggingAccept(sender))
            {
                return;
            }
            string temp = "";
            Type   type = sender.GetType();

            if (type == typeof(NumericUpDown))
            {
                NumericUpDown control = (NumericUpDown)sender;
                temp  = "\"" + control.Name + "\" | ";
                temp += "Value = " + control.Value;
            }
            else if (type == typeof(ToolStripNumericUpDown))
            {
                ToolStripNumericUpDown control = (ToolStripNumericUpDown)sender;
                temp  = "\"" + control.Name + "\" | ";
                temp += "Value = " + control.Value;
            }
            temp += " | Form \"" + form.Name + "\"";
            AddElementIndex(ref temp);
            //
            Do.AddHistory(temp);
            dateTime = DateTime.Now;
        }
예제 #3
0
        // constructor
        public EditLabel(ToolStripControlHost name, ToolStripNumericUpDown number, string element, bool canEditLabel)
        {
            InitializeComponent();
            ContextMenuStrip labelToolStrip = NewLabelToolStrip(canEditLabel);

            if (name != null)
            {
                try
                {
                    this.name = (ComboBox)name.Control;
                    this.name.ContextMenuStrip      = labelToolStrip;
                    this.name.SelectedIndexChanged += new EventHandler(name_SelectedIndexChanged);
                }
                catch
                {
                    TextBox textbox = (TextBox)name.Control;
                    textbox.ContextMenuStrip = labelToolStrip;
                }
            }
            if (number != null)
            {
                this.number = number;
                this.number.ContextMenuStrip = labelToolStrip;
                this.number.ValueChanged    += new EventHandler(number_ValueChanged);
            }
            SetElement(element);
            RefreshLabel();
            //
            this.Location = editLabelLocation;
            InitializeTimer();
        }
        public void ToolStripNumericUpDownAccessibleObject_ControlType_IsSpinner_IfAccessibleRoleIsDefault()
        {
            using ToolStripNumericUpDown toolStripNumericUpDown = new ToolStripNumericUpDown();
            // AccessibleRole is not set = Default

            Assert.Equal(UiaCore.UIA.SpinnerControlTypeId, toolStripNumericUpDown.Control.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId));
            Assert.Null(toolStripNumericUpDown.Control.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ValueValuePropertyId));
        }
        public void ToolStripNumericUpDownAccessibleObject_Ctor_Default()
        {
            using ToolStripNumericUpDown toolStripNumericUpDown = new ToolStripNumericUpDown();
            ToolStripHostedControlAccessibleObject accessibleObject = (ToolStripHostedControlAccessibleObject)toolStripNumericUpDown.Control.AccessibilityObject;

            ToolStripNumericUpDown actual = accessibleObject.TestAccessor().Dynamic._toolStripControlHost;

            Assert.Equal(toolStripNumericUpDown, actual);
        }
        public void ToolStripNumericUpDownAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role)
        {
            using ToolStripNumericUpDown toolStripNumericUpDown = new ToolStripNumericUpDown();
            toolStripNumericUpDown.AccessibleRole = role;

            object actual = toolStripNumericUpDown.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);

            UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role);

            Assert.Equal(expected, actual);
        }
        public void ToolStripNumericUpDownAccessibleObject_Role_IsExpected_ByDefault(bool createControl, AccessibleRole expectedRole)
        {
            using ToolStripNumericUpDown toolStripNumericUpDown = new ToolStripNumericUpDown();
            // AccessibleRole is not set = Default
            Control control = toolStripNumericUpDown.Control;

            if (createControl)
            {
                control.CreateControl();
            }

            AccessibleRole actual = toolStripNumericUpDown.AccessibilityObject.Role;

            Assert.Equal(expectedRole, actual);
            Assert.Equal(createControl, control.IsHandleCreated);
        }
예제 #8
0
 // constructor
 /// <summary>
 /// Loads a search form containing the results of a search query.
 /// </summary>
 /// <param name="searchIndexNum">The search index control to update when a search result is selected.</param>
 /// <param name="searchField">The search field control containing the search query text.</param>
 /// <param name="searchButton">The search button control that invokes the search.</param>
 /// <param name="names">The data list to search for a specified query in.</param>
 public Search(ToolStripNumericUpDown searchIndexNum, ToolStripTextBox searchField, ToolStripButton searchButton, IList names)
 {
     InitializeComponent();
     this.listBox.Enabled = true;
     this.listBox.Show();
     this.listBox.BringToFront();
     this.names          = names;
     this.searchIndexNum = searchIndexNum;
     this.searchField    = searchField;
     this.searchButton   = searchButton;
     InitializeProperties();
     LoadSearch();
     this.function = new Function(LoadSearch);
     this.function.DynamicInvoke();
     InitializeTimer();
 }
예제 #9
0
        public DefaultPixmapSlicerState()
        {
            this.addRectButton = new ToolStripButton(null, EditorBaseResCache.IconSquareAdd,
                                                     (s, e) => this.SwitchToState(typeof(NewRectPixmapSlicerState)));

            this.deleteSelectedButton = new ToolStripButton(null, EditorBaseResCache.IconSquareDelete,
                                                            (s, e) => this.DeleteSelectedRect());
            this.deleteSelectedButton.Enabled = false;

            this.clearButton = new ToolStripButton(null, EditorBaseResCache.IconSquareDeleteMany,
                                                   (s, e) => this.ClearRects());

            this.orderRectsButton = new ToolStripButton(null, EditorBaseResCache.IconSquareNumbers,
                                                        (s, e) => this.SwitchToState(typeof(AtlasOrderingPixmapSlicerState)));

            this.autoSliceButton = new ToolStripButton(EditorBaseRes.Button_AutoSlice, null,
                                                       (s, e) => this.AutoSlicePixmap());

            this.gridSliceButton = new ToolStripButton(EditorBaseRes.Button_GridSlice, null,
                                                       (s, e) => this.SwitchToState(typeof(GridSlicePixmapSlicerState)));

            this.alphaCutoffEntry = CreateNumericUpDown("Alpha Cutoff:", 0, 254);

            this.addRectButton.ToolTipText        = EditorBaseRes.ToolTip_PixmapSlicerAddRect;
            this.deleteSelectedButton.ToolTipText = EditorBaseRes.ToolTip_PixmapSlicerDelete;
            this.clearButton.ToolTipText          = EditorBaseRes.ToolTip_PixmapSlicerClear;
            this.orderRectsButton.ToolTipText     = EditorBaseRes.ToolTip_PixmapSlicerOrderRects;
            this.autoSliceButton.ToolTipText      = EditorBaseRes.ToolTip_PixmapSlicerAutoSlice;
            this.gridSliceButton.ToolTipText      = EditorBaseRes.ToolTip_PixmapSlicerGridSlice;

            this.StateControls.Add(this.addRectButton);
            this.StateControls.Add(this.deleteSelectedButton);
            this.StateControls.Add(this.clearButton);
            this.StateControls.Add(this.orderRectsButton);
            this.StateControls.Add(new ToolStripSeparator {
                BackColor = Color.FromArgb(212, 212, 212)
            });
            this.StateControls.Add(this.autoSliceButton);
            this.StateControls.Add(this.alphaCutoffEntry);
            this.StateControls.Add(new ToolStripSeparator {
                BackColor = Color.FromArgb(212, 212, 212)
            });
            this.StateControls.Add(this.gridSliceButton);
        }
예제 #10
0
 public History(NewForm form, ToolStripControlHost name, ToolStripNumericUpDown number)
 {
     this.form   = form;
     this.name   = name;
     this.number = number;
     if (form.Name == "Editor")
     {
         Do.AddHistory("LOADED LAZY SHELL APPLICATION");
     }
     else if (form.Name != "SpritePartitions" &&
              form.Name != "PaletteEditor" &&
              form.Name != "GraphicEditor" &&
              form.Name != "TileEditor" &&
              form.Name != "NPCEditor")
     {
         Do.AddHistory("OPENED FORM \"" + form.Name + "\"");
     }
     this.form.FormClosed += new FormClosedEventHandler(FormClosed);
     foreach (Control control in form.Controls)
     {
         SetEventHandler(control);
     }
 }
예제 #11
0
        public GridSlicePixmapSlicerState()
        {
            this.doneButton = new ToolStripButton(null, EditorBaseResCache.IconAcceptCheck,
                                                  (s, e) => this.FinishSlicing());
            this.cancelButton = new ToolStripButton(null, EditorBaseResCache.IconCancel,
                                                    (s, e) => this.CancelSlicing());

            this.doneButton.ToolTipText   = EditorBaseRes.ToolTip_PixmapSlicerDone;
            this.cancelButton.ToolTipText = EditorBaseRes.ToolTip_PixmapSlicerCancel;

            this.rowsInput   = CreateNumericUpDown("Rows:", 1, 100);
            this.colsInput   = CreateNumericUpDown("Cols:", 1, 100);
            this.borderInput = CreateNumericUpDown("Border:", 0, 50);

            this.rowsInput.ValueChanged   += this.OnRowsChanged;
            this.colsInput.ValueChanged   += this.OnColsChanged;
            this.borderInput.ValueChanged += this.OnBorderChanged;

            this.StateControls.Add(this.doneButton);
            this.StateControls.Add(this.cancelButton);
            this.StateControls.Add(this.rowsInput);
            this.StateControls.Add(this.colsInput);
            this.StateControls.Add(this.borderInput);
        }
예제 #12
0
        // event handlers
        public void ControlMouseMove(object sender, MouseEventArgs e)
        {
            if (sender == form)
            {
                return;
            }
            Point location = new Point(Cursor.Position.X + 20, Cursor.Position.Y + 10);

            if (location.X == this.location.X && location.Y == this.location.Y)
            {
                return;
            }
            this.location = location;
            // set the conversion label for toolstrip items
            object numericUpDown;

            if (sender.GetType() == typeof(ToolStripNumericUpDown))
            {
                if (baseConvertor == null || !baseConvertor.Checked)
                {
                    formConvertor.Visible = false;
                    return;
                }
                ToolStripNumericUpDown toolStripNumericUpDown = (ToolStripNumericUpDown)sender;
                if (toolStripNumericUpDown.Hexadecimal)
                {
                    labelConvertor.Text = "DEC:  " + ((int)toolStripNumericUpDown.Value).ToString();
                }
                else
                {
                    labelConvertor.Text = "HEX:  0x" + ((int)toolStripNumericUpDown.Value).ToString("X4");
                }
                //
                formConvertor.Width  = labelConvertor.Width;
                formConvertor.Height = labelConvertor.Height;
                if (location.X + formConvertor.Width > Screen.PrimaryScreen.WorkingArea.Width - 10)
                {
                    location.X -= formConvertor.Width + 30;
                }
                if (location.Y + formConvertor.Height > Screen.PrimaryScreen.WorkingArea.Height - 30)
                {
                    location.Y -= formConvertor.Height + 30;
                }
                formConvertor.Location = location;
                Do.ShowInactiveTopmost(formConvertor);
                return;
            }
            // set the tool tip
            object control = sender;

            if (helpTips != null && helpTips.Checked)
            {
                if (mouseOverControl != control)
                {
                    toolTipTitle = GetToolTipText(control, "title");
                    toolTipDesc  = GetToolTipText(control, "description");
                }
                if (toolTipDesc != null)
                {
                    if (mouseOverControl != control)
                    {
                        titleToolTip.Text = toolTipTitle;
                        labelToolTip.Text = toolTipDesc;
                    }
                    //
                    if (location.X + formToolTip.Width > Screen.PrimaryScreen.WorkingArea.Width - 10)
                    {
                        location.X -= formToolTip.Width + 30;
                    }
                    if (location.Y + formToolTip.Height > Screen.PrimaryScreen.WorkingArea.Height - 30)
                    {
                        location.Y -= formToolTip.Height + 30;
                    }
                    formToolTip.Location = location;
                    if (!formToolTip.Visible)
                    {
                        Do.ShowInactiveTopmost(formToolTip);
                    }
                }
                else
                {
                    formToolTip.Hide();
                }
            }
            else
            {
                formToolTip.Visible = false;
            }
            // set the conversion label for controls
            if (baseConvertor != null && baseConvertor.Checked)
            {
                if (control.GetType().Name == "UpDownEdit" ||
                    control.GetType().Name == "NumericUpDown")
                {
                    if (control.GetType().Name == "UpDownEdit")
                    {
                        Control temp = form.GetNextControl((Control)control, false);
                        numericUpDown = (NumericUpDown)form.GetNextControl(temp, false);
                    }
                    else
                    {
                        numericUpDown = (NumericUpDown)control;
                    }
                    if (((NumericUpDown)numericUpDown).Hexadecimal)
                    {
                        labelConvertor.Text = "DEC:  " + ((int)((NumericUpDown)numericUpDown).Value).ToString();
                    }
                    else
                    {
                        labelConvertor.Text = "HEX:  0x" + ((int)((NumericUpDown)numericUpDown).Value).ToString("X4");
                    }
                    //
                    formConvertor.Width  = labelConvertor.Width;
                    formConvertor.Height = labelConvertor.Height;
                    if (location.X + formConvertor.Width > Screen.PrimaryScreen.WorkingArea.Width - 10)
                    {
                        location.X -= formConvertor.Width + 30;
                    }
                    if (location.Y + formConvertor.Height > Screen.PrimaryScreen.WorkingArea.Height - 30)
                    {
                        location.Y -= formConvertor.Height + 30;
                    }
                    formConvertor.Location = location;
                    Do.ShowInactiveTopmost(formConvertor);
                }
                else
                {
                    formConvertor.Hide();
                }
            }
            else
            {
                formConvertor.Hide();
            }
            //
            mouseOverControl = control;
        }
예제 #13
0
 // constructor
 public HackingTools(Delegate update, ToolStripNumericUpDown index)
 {
     this.update = update;
     this.index  = index;
     InitializeComponent();
 }