private void okButton_Click(object sender, EventArgs e)
{
string newGlyphID = "";
if (comboButton.Checked)
{
if (comboBox.SelectedItem != null)
{
newGlyphID = (comboBox.SelectedItem as Glyph).ID;
}
else
{
MessageBox.Show("Please choose a new character for reclassification.");
}
}
else
{
if (boxBox.Text != "")
{
for (int x = 0; x < myFont.Glyphs.Count; x++)
{
if (myFont.Glyphs[x].Unicode == boxBox.Text)
{
newGlyphID = myFont.Glyphs[x].ID;
break;
}
}
if (newGlyphID == "")
{
newGlyphID = myFont.AddEmptyGlyph(boxBox.Text.Trim());
}
}
else
{
MessageBox.Show("Please enter a new character for reclassification.");
}
}
if (newGlyphID != "")
{
if (modeReclassButton.Checked)
{
db.ExecuteCommand("update images set img_glyph_id = " + newGlyphID + " where img_glyph_id = " + glyphToReclassifyID);
db.ExecuteCommand("delete from glyphs where glyph_id = " + glyphToReclassifyID);
}
else
{
if (db.GetRows("select * from images where img_glyph_id = " + glyphToReclassifyID))
{
DataTable Gs = db.Bucket.Copy();
foreach (DataRow G in Gs.Rows)
{
string gID = db.GetNewID("images");
db.ExecuteCommand("INSERT INTO images " +
"(img_id, img_glyph_id, img_path, img_status) " +
"VALUES (" + gID + ", " + newGlyphID + ", '" + db.FixString(G["img_path"].ToString()) + "', '" + db.FixString(G["img_status"].ToString()) + "')");
}
}
}
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
}