private void btnDesignStencilCommit_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { int designNo = listView1.SelectedIndices[0]; xmlChunkDetails chunk = (xmlChunkDetails)casPartNew.xmlChunk[designNo]; Console.WriteLine("Setting design " + designNo.ToString() + ".StencilEnabled to " + cmbPatternStencil1.SelectedIndex); btnPatternStencil1Preview.Enabled = true; stencilDetails blank = new stencilDetails(); blank.Enabled = "False"; if (cmbPatternStencil1.SelectedIndex == 0) { chunk.stencil.A = blank; } else { chunk.stencil.A = stencilPool[cmbPatternStencil1.SelectedIndex - 1]; chunk.stencil.A.Enabled = "True"; } if (cmbPatternStencil2.SelectedIndex == 0) { chunk.stencil.B = blank; } else { chunk.stencil.B = stencilPool[cmbPatternStencil2.SelectedIndex - 1]; chunk.stencil.B.Enabled = "True"; } if (cmbPatternStencil3.SelectedIndex == 0) { chunk.stencil.C = blank; } else { chunk.stencil.C = stencilPool[cmbPatternStencil3.SelectedIndex - 1]; chunk.stencil.C.Enabled = "True"; } if (cmbPatternStencil4.SelectedIndex == 0) { chunk.stencil.D = blank; } else { chunk.stencil.D = stencilPool[cmbPatternStencil4.SelectedIndex - 1]; chunk.stencil.D.Enabled = "True"; } if (cmbPatternStencil5.SelectedIndex == 0) { chunk.stencil.E = blank; } else { chunk.stencil.E = stencilPool[cmbPatternStencil5.SelectedIndex - 1]; chunk.stencil.E.Enabled = "True"; } if (cmbPatternStencil6.SelectedIndex == 0) { chunk.stencil.F = blank; } else { chunk.stencil.F = stencilPool[cmbPatternStencil6.SelectedIndex - 1]; chunk.stencil.F.Enabled = "True"; } reloadTextures(); } }
private void updateStencilBoxes(int stencilBoxNo, stencilDetails stencil) { addListHeader(lstStencilPool, "Stencil " + stencilBoxNo); addListItem(lstStencilPool, stencil.key, "Texture", "texture"); addListItem(lstStencilPool, stencil.Rotation, "Rotation", ""); addListItem(lstStencilPool, stencil.Tiling, "Tiling", ""); addListBlank(lstStencilPool); //stencil.Enabled = "True"; stencilPool[stencilBoxNo - 1] = stencil; }
private int getStencilFromPool(stencilDetails stencil) { int temp = 0; for (int i = 0; i < stencilPool.Count; i++) { if (stencilPool[i].key == stencil.key && stencilPool[i].Rotation == stencil.Rotation && stencilPool[i].Tiling == stencil.Tiling) { temp = i; break; } } return temp; }
private bool inStencilList(stencilDetails stencil) { bool inList = false; for (int i = 0; i < stencilPool.Count; i++) { if (stencilPool[i].key == stencil.key && stencilPool[i].Rotation == stencil.Rotation && stencilPool[i].Tiling == stencil.Tiling) { inList = true; break; } } return inList; }
private void button13_Click(object sender, EventArgs e) { // Fill up the rest of the stencil pool int numLeft = 20 - stencilPool.Count; for (int i = 0; i < numLeft; i++) { stencilPool.Add(new stencilDetails()); } int curStencilNum = 0; stencilDetails stencil = new stencilDetails(); for (int i = 0; i < lstStencilPool.Items.Count; i++) { ListViewItem item = lstStencilPool.Items[i]; switch (item.SubItems[1].Text) { case " Stencil 1": curStencilNum = 0; break; case "Texture": stencil.key = item.Text; break; case "Rotation": stencil.Rotation = item.Text; break; case "Tiling": stencil.Tiling = item.Text; break; case "": stencilPool[curStencilNum] = stencil; curStencilNum++; stencil = new stencilDetails(); break; } } }