public setTextBox ( |
||
tb | /// The tb. /// | |
col | Color | /// The col. /// |
return | void |
/// <summary> /// Creates a color wheel with associated (A)RGB text boxes /// </summary> /// <param name="meta"></param> /// <param name="iEntName">Control display name</param> /// <param name="map"></param> /// <param name="iOffsetInChunk"></param> /// <param name="hasAlphaChannel">True if ARGB, False for RGB</param> /// <param name="valueType">Float for 0f-1f, Int for 0-255</param> /// <param name="iLineNumber"></param> public argb_color(Meta meta, string iEntName, Map map, int iOffsetInChunk, bool hasAlphaChannel, IFPIO.ObjectEnum valueType,int iLineNumber) { InitializeComponent(); this.meta = meta; this.LineNumber = iLineNumber; this.chunkOffset = iOffsetInChunk; this.map = map; this.EntName = " " + iEntName + " "; this.Dock = DockStyle.Top; this.Controls[0].Text = EntName; this.hasAlpha = hasAlphaChannel; this.ValueType = valueType; switch (valueType) { case IFPIO.ObjectEnum.Byte: this.eachSize = 1; break; case IFPIO.ObjectEnum.Short: case IFPIO.ObjectEnum.UShort: this.eachSize = 2; break; case IFPIO.ObjectEnum.Int: case IFPIO.ObjectEnum.UInt: case IFPIO.ObjectEnum.Float: case IFPIO.ObjectEnum.Unknown: this.eachSize = 4; break; } this.size = (hasAlpha ? eachSize * 4 : eachSize * 3); CW = new ColorWheel(); CW.Location = new Point(180, 5); Red = new DataValues(meta, "Red", map, iOffsetInChunk, valueType, iLineNumber); Red.BackColor = System.Drawing.Color.DarkRed; CW.setTextBox(Red.textBox1, Color.Red); Blue = new DataValues(meta, "Blue", map, iOffsetInChunk + eachSize, valueType, iLineNumber); Blue.BackColor = System.Drawing.Color.DarkBlue; CW.setTextBox(Blue.textBox1, Color.Blue); Green = new DataValues(meta, "Green", map, iOffsetInChunk + eachSize * 2, valueType, iLineNumber); Green.BackColor = System.Drawing.Color.FromArgb(10, 80, 35); CW.setTextBox(Green.textBox1, Color.Green); if (hasAlpha) { Alpha = new DataValues(meta, "Alpha", map, iOffsetInChunk + eachSize * 3, valueType, iLineNumber); Alpha.BackColor = System.Drawing.Color.Gray; CW.setTextBox(Alpha.textBox1, Color.White); gbRGBColor.Controls.Add(Alpha); } gbRGBColor.Controls.Add(CW); CW.BringToFront(); gbRGBColor.Controls.Add(Green); gbRGBColor.Controls.Add(Blue); gbRGBColor.Controls.Add(Red); }
private void LoadENTControls(object[] entArray) { this.selectedTagType = Maps.map[mapIndex].SelectedMeta.type; this.toolStripTagType.Text = "[" + this.selectedTagType.ToString() + "]"; this.toolStripTagName.Text = Maps.map[mapIndex].SelectedMeta.name; //this.Padding = new Padding(10); int colorSpaceCount = 4; // Custom Plugins access ra = new RegistryAccess(Microsoft.Win32.Registry.CurrentUser, RegistryAccess.RegPaths.Halo2CustomPlugins + pluginName + "\\" + this.selectedTagType); if (pluginName == null) ra.CloseReg(); foreach (object o in entArray) { IFPIO.BaseObject tempbase = (IFPIO.BaseObject)o; if (tempbase.visible == false) if (Meta_Editor.MetaEditor.ShowInvisibles == false) continue; // skip hidden custom plugins variables (mark reflexives to be removed if empty) bool skipEmptyReflex = false; if (ra.isOpen && ra.getValue(tempbase.offset.ToString()) == bool.FalseString) if (tempbase.ObjectType == IFPIO.ObjectEnum.Struct) skipEmptyReflex = true; else continue; switch (tempbase.ObjectType) { case IFPIO.ObjectEnum.Struct: { if (Meta_Editor.MetaEditor.ShowReflexives == false) break; // tempLabel is a blank space located above reflexives Label tempLabel = new Label(); tempLabel.AutoSize = true; tempLabel.Location = new System.Drawing.Point(0, 0); tempLabel.Name = "label1"; tempLabel.Dock = DockStyle.Top; tempLabel.Size = new System.Drawing.Size(35, 13); tempLabel.TabIndex = tabIndex; // tempReflexive is the reflexive and all data (incl other reflexives) within it ReflexiveControl tempReflexive = new ReflexiveControl(mapIndex, Maps.map[mapIndex].SelectedMeta.offset, ((IFPIO.Reflexive)tempbase).HasCount, tempbase.lineNumber, this); //tempReflexive.Location = new System.Drawing.Point(10, 0); tempReflexive.Name = "reflexive"; tempReflexive.TabIndex = tabIndex; tempReflexive.LoadENTControls( (IFPIO.Reflexive)tempbase, ((IFPIO.Reflexive)tempbase).items, true, 0, ref tabIndex, tempbase.offset.ToString()); // Label, Combobox & Button are always added ( = 3) if (!(tempReflexive.Controls.Count <= 2 && skipEmptyReflex)) { this.Controls[0].Controls.Add(tempLabel); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); this.Controls[0].Controls.Add(tempReflexive); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Ident: { if (Meta_Editor.MetaEditor.ShowIdents == false) break; Ident tempident = new Ident(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Ident)tempbase).hasTagType, tempbase.lineNumber); tempident.Name = "ident"; tempident.TabIndex = tabIndex; tempident.Populate(Maps.map[mapIndex].SelectedMeta.offset); tempident.Tag = "[" + tempident.Controls[2].Text + "] " + tempident.Controls[1].Text; tempident.Controls[1].ContextMenuStrip = identContext; this.Controls[0].Controls.Add(tempident); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.StringID: { if (Meta_Editor.MetaEditor.ShowSIDs == false) break; SID tempSID = new SID(tempbase.name, mapIndex, tempbase.offset, tempbase.lineNumber); tempSID.Name = "sid"; tempSID.TabIndex = tabIndex; tempSID.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempSID); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Float: { if (Meta_Editor.MetaEditor.ShowFloats == false) break; DataValues tempFloat = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Float, tempbase.lineNumber); tempFloat.TabIndex = tabIndex; tempFloat.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempFloat); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.String32: { if (Meta_Editor.MetaEditor.ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32) break; EntStrings tempstring = new EntStrings(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber); tempstring.Name = "string"; tempstring.TabIndex = tabIndex; tempstring.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempstring); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.UnicodeString256: { if (Meta_Editor.MetaEditor.ShowUnicodeString256s == false) break; goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.String256: { if (Meta_Editor.MetaEditor.ShowString256s == false) break; goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.UnicodeString64: { if (Meta_Editor.MetaEditor.ShowUnicodeString64s == false) break; goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.String: { if (Meta_Editor.MetaEditor.ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32) break; EntStrings tempstring = new EntStrings(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber); tempstring.Name = "string"; tempstring.TabIndex = tabIndex; tempstring.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempstring); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Int: { if (((IFPIO.IFPInt)tempbase).entIndex.nulled == true) { if ((Meta_Editor.MetaEditor.ShowInts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Int) || (Meta_Editor.MetaEditor.ShowShorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Short) || (Meta_Editor.MetaEditor.ShowUshorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.UShort) || (Meta_Editor.MetaEditor.ShowUints == false && tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) break; DataValues tempdatavalues = new DataValues(tempbase.name, mapIndex, tempbase.offset, tempbase.ObjectType, tempbase.lineNumber); tempdatavalues.TabIndex = tabIndex; tempdatavalues.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } else { if ((Meta_Editor.MetaEditor.ShowBlockIndex32s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Int | tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) || (Meta_Editor.MetaEditor.ShowBlockIndex16s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Short | tempbase.ObjectType == IFPIO.ObjectEnum.UShort)) || (Meta_Editor.MetaEditor.ShowBlockIndex8s == false && tempbase.ObjectType == IFPIO.ObjectEnum.Byte)) break; Indices tempdatavalues = new Indices(tempbase.name, mapIndex, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPInt)tempbase).entIndex); tempdatavalues.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Short: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.UShort: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.UInt: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.Unknown: { if (Meta_Editor.MetaEditor.ShowUndefineds == false) break; DataValues tempUnknown = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Unknown, tempbase.lineNumber); tempUnknown.TabIndex = tabIndex; tempUnknown.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempUnknown); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Byte_Flags: { if (Meta_Editor.MetaEditor.ShowBitmask8s == false) break; Bitmask tempbitmask = new Bitmask(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Word_Flags: { if (Meta_Editor.MetaEditor.ShowBitmask16s == false) break; Bitmask tempbitmask = new Bitmask(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Long_Flags: { if (Meta_Editor.MetaEditor.ShowBitmask32s == false) break; Bitmask tempbitmask = new Bitmask(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Char_Enum: { if (Meta_Editor.MetaEditor.ShowEnum8s == false) break; Enums tempenum = new Enums(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Enum: { if (Meta_Editor.MetaEditor.ShowEnum16s == false) break; Enums tempenum = new Enums(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Long_Enum: { if (Meta_Editor.MetaEditor.ShowEnum32s == false) break; Enums tempenum = new Enums(tempbase.name, mapIndex, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Byte: { if (((IFPIO.IFPByte)tempbase).entIndex.nulled == true) { if (Meta_Editor.MetaEditor.ShowBytes == false) break; DataValues tempByte = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Byte, tempbase.lineNumber); tempByte.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempByte); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } else { if (Meta_Editor.MetaEditor.ShowBlockIndex8s == false) break; Indices tempdatavalues = new Indices(tempbase.name, mapIndex, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPByte)tempbase).entIndex); tempdatavalues.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Unused: { DataValues tempUnknown = new DataValues(tempbase.name, mapIndex, tempbase.offset, IFPIO.ObjectEnum.Unused, tempbase.lineNumber); tempUnknown.TabIndex = tabIndex; tempUnknown.Populate(Maps.map[mapIndex].SelectedMeta.offset); this.Controls[0].Controls.Add(tempUnknown); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.TagType: continue; break; } if (!(tempbase is IFPIO.Reflexive)) ToolTip1.SetToolTip(this.Controls[0].Controls[0].Controls[0], "offset: " + tempbase.offset.ToString()); if (this.Controls[0].Controls.Count > 0 && this.Controls[0].Controls[0] is DataValues) { //if (((tempbase.name.ToLower().Contains(" a") & tempbase.name[tempbase.name.ToLower().IndexOf(" a")]) || // tempbase.name.ToLower().Contains("alpha"))& alphaControl == null) if (ColorWheel.checkForColor(tempbase.name, alphaControl, " a", "alpha")) { alphaControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } //if (tempbase.name.ToLower().Contains(" r") & redControl == null) else if (ColorWheel.checkForColor(tempbase.name, redControl, " r", "red")) { redControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } //if (tempbase.name.ToLower().Contains(" g") & greenControl == null) else if (ColorWheel.checkForColor(tempbase.name, greenControl, " g", "green")) { greenControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } //if (tempbase.name.ToLower().Contains(" b") & blueControl == null) else if (ColorWheel.checkForColor(tempbase.name, blueControl, " b", "blue")) { blueControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } else { colorSpaceCount++; if (colorSpaceCount == 1) { alphaControl = null; redControl = null; greenControl = null; blueControl = null; } } if (redControl != null & greenControl != null & blueControl != null) { // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. ColorWheel cw = new ColorWheel(); if (alphaControl != null) cw.setTextBox(alphaControl.textBox1, Color.White); cw.setTextBox(redControl.textBox1, Color.Red); cw.setTextBox(greenControl.textBox1, Color.Green); cw.setTextBox(blueControl.textBox1, Color.Blue); //p.I.AddRange(new Rectangle[] { SelectedColorRectangle }); cw.Dock = DockStyle.Top; this.Controls[0].Controls.Add(cw); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); // Reset for next batch colorSpaceCount++; alphaControl = null; redControl = null; greenControl = null; blueControl = null; } } else colorSpaceCount++; tabIndex++; } ra.CloseReg(); }
/// <summary> /// Creates a color wheel with associated (A)RGB text boxes /// </summary> /// <param name="meta"></param> /// <param name="iEntName">Control display name</param> /// <param name="map"></param> /// <param name="iOffsetInChunk"></param> /// <param name="hasAlphaChannel">True if ARGB, False for RGB</param> /// <param name="valueType">Float for 0f-1f, Int for 0-255</param> /// <param name="iLineNumber"></param> public argb_color(Meta meta, string iEntName, Map map, int iOffsetInChunk, bool hasAlphaChannel, IFPIO.ObjectEnum valueType, int iLineNumber) { InitializeComponent(); this.meta = meta; this.LineNumber = iLineNumber; this.chunkOffset = iOffsetInChunk; this.map = map; this.EntName = " " + iEntName + " "; this.Dock = DockStyle.Top; this.Controls[0].Text = EntName; this.hasAlpha = hasAlphaChannel; this.ValueType = valueType; switch (valueType) { case IFPIO.ObjectEnum.Byte: this.eachSize = 1; break; case IFPIO.ObjectEnum.Short: case IFPIO.ObjectEnum.UShort: this.eachSize = 2; break; case IFPIO.ObjectEnum.Int: case IFPIO.ObjectEnum.UInt: case IFPIO.ObjectEnum.Float: case IFPIO.ObjectEnum.Unknown: this.eachSize = 4; break; } this.size = (hasAlpha ? eachSize * 4 : eachSize * 3); CW = new ColorWheel(); CW.Location = new Point(180, 5); Red = new DataValues(meta, "Red", map, iOffsetInChunk, valueType, iLineNumber); Red.BackColor = System.Drawing.Color.DarkRed; CW.setTextBox(Red.textBox1, Color.Red); Blue = new DataValues(meta, "Blue", map, iOffsetInChunk + eachSize, valueType, iLineNumber); Blue.BackColor = System.Drawing.Color.DarkBlue; CW.setTextBox(Blue.textBox1, Color.Blue); Green = new DataValues(meta, "Green", map, iOffsetInChunk + eachSize * 2, valueType, iLineNumber); Green.BackColor = System.Drawing.Color.FromArgb(10, 80, 35); CW.setTextBox(Green.textBox1, Color.Green); if (hasAlpha) { Alpha = new DataValues(meta, "Alpha", map, iOffsetInChunk + eachSize * 3, valueType, iLineNumber); Alpha.BackColor = System.Drawing.Color.Gray; CW.setTextBox(Alpha.textBox1, Color.White); gbRGBColor.Controls.Add(Alpha); } gbRGBColor.Controls.Add(CW); CW.BringToFront(); gbRGBColor.Controls.Add(Green); gbRGBColor.Controls.Add(Blue); gbRGBColor.Controls.Add(Red); }