// Texture Sets private void LoadImageSets() { // Get sets IDictionary dic = cfg.ReadSetting("imagesets", new Hashtable()); foreach (DictionaryEntry de in dic) { DefinedImageSet s = new DefinedImageSet(cfg, "imagesets." + de.Key); imagesets.Add(s); } }
// Remove texture set private void removetextureset_Click(object sender, EventArgs e) { // Texture Set selected? while (listtextures.SelectedItems.Count > 0) { // Remove from config info and list DefinedImageSet s = (listtextures.SelectedItems[0].Tag as DefinedImageSet); configinfo.TextureSets.Remove(s); listtextures.SelectedItems[0].Remove(); reloadresources = true; } }
// Copy selected texture sets private void copytexturesets_Click(object sender, EventArgs e) { // Make copies copiedsets = new List <DefinedImageSet>(); foreach (ListViewItem item in listtextures.SelectedItems) { DefinedImageSet s = (item.Tag as DefinedImageSet); copiedsets.Add(s.Copy()); } // Enable button pastetexturesets.Enabled = true; }
// This initializes the set public void Setup(DefinedImageSet set) { // Keep reference textureset = set; // Set name name.Text = set.Name; // Fill filters list foreach (int i in set.Filters) { filters.Items.Add(i.ToString()); } }
// Edit texture set private void edittextureset_Click(object sender, EventArgs e) { // Texture Set selected? if (listtextures.SelectedItems.Count > 0) { DefinedImageSet s = (listtextures.SelectedItems[0].Tag as DefinedImageSet); ImageSetForm form = new ImageSetForm(); form.Setup(s); form.ShowDialog(this); listtextures.SelectedItems[0].Text = s.Name; listtextures.Sort(); reloadresources = true; } }
// Paste copied texture sets private void pastetexturesets_Click(object sender, EventArgs e) { if (copiedsets != null) { // Add copies foreach (DefinedImageSet ts in copiedsets) { DefinedImageSet s = ts.Copy(); ListViewItem item = listtextures.Items.Add(s.Name); item.Tag = s; item.ImageIndex = 0; configinfo.TextureSets.Add(s); } listtextures.Sort(); reloadresources = true; } }
// Make new texture set private void addtextureset_Click(object sender, EventArgs e) { DefinedImageSet s = new DefinedImageSet("New Image Set"); ImageSetForm form = new ImageSetForm(); form.Setup(s); if (form.ShowDialog(this) == DialogResult.OK) { // Add to texture sets configinfo.TextureSets.Add(s); ListViewItem item = listtextures.Items.Add(s.Name); item.Tag = s; item.ImageIndex = 0; listtextures.Sort(); reloadresources = true; } }
// This will add the default sets from game configuration private void restoretexturesets_Click(object sender, EventArgs e) { // Ask nicely first if (MessageBox.Show(this, "This will add the default Image Sets from the Game Configuration. Do you want to continue?", "Add Default Sets", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // Add copies foreach (DefinedImageSet ts in gameconfig.ImageSets) { DefinedImageSet s = ts.Copy(); ListViewItem item = listtextures.Items.Add(s.Name); item.Tag = s; item.ImageIndex = 0; configinfo.TextureSets.Add(s); } listtextures.Sort(); reloadresources = true; } }