private void FlagCheckBox_CheckedChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } CheckBox control = (CheckBox)sender; BoolTransaction transaction = new BoolTransaction("Door flag", clip, (string)control.Tag, wclipID, 3, control.Checked); transactionManager.ApplyTransaction(transaction); }
//--------------------------------------------------------------------- // WEAPON UPDATORS //--------------------------------------------------------------------- private void WeaponProperty_TextChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } TextBox textBox = (TextBox)sender; int value = int.MinValue; if (int.TryParse(textBox.Text, out value)) { IntegerTransaction transaction = new IntegerTransaction("Weapon property", weapon, (string)textBox.Tag, weaponID, tabPage, value); transactionManager.ApplyTransaction(transaction); } }
private void btnImportModel_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string traceto = ""; if (bool.Parse(StandardUI.options.GetOption("TraceModels", bool.FalseString))) { string bareFilename = Path.GetFileName(openFileDialog1.FileName); traceto = StandardUI.options.GetOption("TraceDir", ".") + Path.DirectorySeparatorChar + Path.ChangeExtension(bareFilename, "txt"); } Stream stream = File.OpenRead(openFileDialog1.FileName); Polymodel newmodel = POFReader.ReadPOFFile(stream); stream.Close(); stream.Dispose(); newmodel.ExpandSubmodels(); //datafile.ReplaceModel(ElementNumber, model); ModelReplaceTransaction transaction = new ModelReplaceTransaction("Load model", (object)model, newmodel, modelID, tabPage); transactionManager.ApplyTransaction(transaction); Update(model, modelID); } }
private void EClipFixedProperty_TextChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } TextBox textBox = (TextBox)sender; double value; if (double.TryParse(textBox.Text, out value)) { FixTransaction transaction = new FixTransaction("EClip property", clip, (string)textBox.Tag, eclipID, 2, value); transactionManager.ApplyTransaction(transaction); } }
private void TextureFlagCheckbox_CheckedChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } TMAPInfo tmapinfo = datafile.TMapInfo[textureID]; CheckBox control = (CheckBox)sender; BoolTransaction transaction = new BoolTransaction("TMapInfo property", tmapinfo, (string)control.Tag, textureID, 0, control.Checked); transactionManager.ApplyTransaction(transaction); }
private void InsertMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string name = openFileDialog1.SafeFileName; int id = datafile.Sounds.Count; //BinaryReader br = new BinaryReader(File.OpenRead(openFileDialog1.FileName)); //byte[] data = br.ReadBytes((int)br.BaseStream.Length); Stream stream = File.OpenRead(openFileDialog1.FileName); BasicSoundFile file = BasicSoundFile.ReadFromStream(stream); stream.Close(); AddSoundTransaction transaction = new AddSoundTransaction(datafile, cache, id, name, file.Data); transactionManager.ApplyTransaction(transaction); SoundData sound = datafile.Sounds[id]; ListViewItem lvi = new ListViewItem(sound.Name); lvi.SubItems.Add(sound.Length.ToString()); lvi.SubItems.Add(sound.Offset.ToString()); lvi.SubItems.Add(id.ToString()); listView1.Items.Add(lvi); } }
private void InsertButton_Click(object sender, EventArgs e) { int newelem = ElementNumber + 1; switch (EditorTabs.SelectedIndex) { case 0: { ListAddTransaction transaction = new ListAddTransaction("New robot", datafile, "ReplacedRobots", newelem, new Robot(), ElementNumber, 0); transactionManager.ApplyTransaction(transaction); } break; case 1: { ListAddTransaction transaction = new ListAddTransaction("New model", datafile, "ReplacedModels", newelem, new Polymodel(10), ElementNumber, 1); transactionManager.ApplyTransaction(transaction); } break; } ResetMaxes(); ElementSpinner.Value = newelem; }
private void VClipFixedProperty_TextChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } TextBox textBox = (TextBox)sender; double value; if (double.TryParse(textBox.Text, out value)) { VClipTimeTransaction transaction = new VClipTimeTransaction("VClip property", clip, (string)textBox.Tag, vclipID, 1, (Fix)value); transactionManager.ApplyTransaction(transaction); //The transaction may have changed frame time, so update it. FrameTimeTextBox.Text = clip.FrameTime.ToString(); } }
private void SoundIDComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } ComboBox control = (ComboBox)sender; int value = control.SelectedIndex - 1; if (value < 0) { value = 255; } ByteArrayReplaceTransaction transaction = new ByteArrayReplaceTransaction("Sound id", datafile, (string)control.Tag, soundID, (byte)value, soundID, tabPage); transactionManager.ApplyTransaction(transaction); }
private void VClipFixedProperty_TextChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } TextBox textBox = (TextBox)sender; double value; if (double.TryParse(textBox.Text, out value)) { FixTransaction transaction = new FixTransaction("VClip property", clip, (string)textBox.Tag, vclipID, 1, value); transactionManager.ApplyTransaction(transaction); //hack clip.FrameTime = clip.PlayTime / clip.NumFrames; FrameTimeTextBox.Text = clip.FrameTime.ToString(); } }
private void InsertElem_Click(object sender, EventArgs e) { HAMType type = typeTable[EditorTabs.SelectedIndex]; /*int newID = datafile.AddElement(type); * if (newID != -1) * { * //Update the maximum of the numeric up/down control and ensure that any comboboxes that need to be regenerated for the current element are * ElementListInit(); * ElementSpinner.Value = newID; * }*/ int newNum = 0; Transaction transaction = null; switch (type) { case HAMType.TMAPInfo: newNum = datafile.Textures.Count; transaction = new AddTextureTransaction("Add Texture", datafile, "Textures", "TMapInfo", datafile.Textures.Count, 0, new TMAPInfo(), ElementNumber, PageNumber); break; case HAMType.VClip: newNum = datafile.VClips.Count; transaction = new ListAddTransaction("Add VClip", datafile, "VClips", datafile.VClips.Count, new VClip(), ElementNumber, PageNumber); break; case HAMType.EClip: newNum = datafile.EClips.Count; transaction = new ListAddTransaction("Add EClip", datafile, "EClips", datafile.EClips.Count, new EClip(), ElementNumber, PageNumber); break; case HAMType.WClip: newNum = datafile.WClips.Count; transaction = new ListAddTransaction("Add WClip", datafile, "WClips", datafile.WClips.Count, new WClip(), ElementNumber, PageNumber); break; case HAMType.Robot: newNum = datafile.Robots.Count; transaction = new ListAddTransaction("Add Robot", datafile, "Robots", datafile.Robots.Count, new Robot(), ElementNumber, PageNumber); break; case HAMType.Weapon: newNum = datafile.Weapons.Count; transaction = new ListAddTransaction("Add Weapon", datafile, "Weapons", datafile.Weapons.Count, new Weapon(), ElementNumber, PageNumber); break; case HAMType.Model: newNum = datafile.Models.Count; transaction = new ListAddTransaction("Add Polymodel", datafile, "Models", datafile.Models.Count, new Polymodel(10), ElementNumber, PageNumber); break; case HAMType.Powerup: newNum = datafile.Powerups.Count; transaction = new ListAddTransaction("Add Powerup", datafile, "Powerups", datafile.Powerups.Count, new Powerup(), ElementNumber, PageNumber); break; case HAMType.Reactor: newNum = datafile.Reactors.Count; transaction = new ListAddTransaction("Add Reactor", datafile, "Reactors", datafile.Reactors.Count, new Reactor(), ElementNumber, PageNumber); break; case HAMType.Cockpit: newNum = datafile.Cockpits.Count; transaction = new ListAddTransaction("Add Cockpit bitmap", datafile, "Cockpits", datafile.Cockpits.Count, (ushort)0, ElementNumber, PageNumber); break; } if (transaction != null) { transactionManager.ApplyTransaction(transaction); ElementListInit(); //Ensure all local lists are updated, and update the spinner. ElementSpinner.Value = newNum; } }
//Updators private void RobotComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } ComboBox sendingControl = (ComboBox)sender; string tagstr = (string)sendingControl.Tag; int value = sendingControl.SelectedIndex; IntegerTransaction transaction = new IntegerTransaction("Robot property", robot, (string)sendingControl.Tag, robotid, tabPage, value); transactionManager.ApplyTransaction(transaction); //[ISB] ugly hack, show new value of joints and animation checkbox if (hxmFile != null) { isLocked = true; UpdateRobotAnimation(); isLocked = false; } }