void _CalculateCounts(LocGroup group) { if (!ShouldDisplayInTree(group)) return; foreach (LocGroup sub in group.Groups) _CalculateCounts(sub); foreach (LocItem item in group.Items) { if (!ShouldDisplayInTree(item)) continue; ++m_cItemsTotal; if (ItemNeedsAttention(item)) ++m_cItemsRemaining; } }
void _PopulateTree(TreeNodeCollection nodes, LocGroup group) { // Determine whether this node is needed if (!ShouldDisplayInTree(group)) return; // Add the node for this group TreeNode node = nodes.Add(group.Title); node.Name = group.ID; node.ToolTipText = group.Title; node.Tag = group; node.ForeColor = (GroupNeedsAttention(group) ? Color.Red : Color.Navy); // Recurse to add any subnodes for the subgroups foreach (LocGroup sub in group.Groups) _PopulateTree(node.Nodes, sub); // Add the items foreach (LocItem item in group.Items) { if (!ShouldDisplayInTree(item)) continue; // Create the node with this text TreeNode nodeItem = node.Nodes.Add(item.English); // The node's name is the item's unique ID nodeItem.Name = item.ID; // The tooltip hels when everything can't fit on the screen nodeItem.ToolTipText = item.English; // We'll use the tag to get back to the correct item nodeItem.Tag = item; // The forecolor highlights which items need work nodeItem.ForeColor = (ItemNeedsAttention(item) ? Color.Red : Color.Navy); } node.Collapse(true); }
bool GroupNeedsAttention(LocGroup group) { foreach (LocItem item in group.Items) { if (ItemNeedsAttention(item)) return true; } foreach (LocGroup sub in group.Groups) { if (GroupNeedsAttention(sub)) return true; } return false; }
bool ShouldDisplayInTree(LocGroup group) { // Filter Option: Show All if (FilterCombo.Text == c_ShowAll) return true; // Filter Option: All Needing Attention if (FilterCombo.Text == c_ThoseNeedingAttention) return GroupNeedsAttention(group); // Filter Option: Translator Items if (FilterCombo.Text == c_TranslatorItems) return group.TranslatorAudience; // Filter Option: Translator Items Needing Attention if (FilterCombo.Text == c_TranslatorItemsNeedingAttention) return group.TranslatorAudience && GroupNeedsAttention(group); // Filter Option: Advisor Items if (FilterCombo.Text == c_AdvisorItems) return !group.TranslatorAudience; // Filter Option: Advisor Items Needing Attention if (FilterCombo.Text == c_AdvisorItemsNeedingAttention) return !group.TranslatorAudience && GroupNeedsAttention(group); // Unknown filter return true; }
static public LocGroup ReadXML(LocDB db, XmlRead xml) { string sID = xml.GetValue(c_sID); string sTitle = xml.GetValue(c_sTitle); string sDescription = xml.GetValue(c_sDescription); string sTranslatorAudience = xml.GetValue(c_sTranslatorAudience); LocGroup group = new LocGroup(sID, sTitle); group.Description = sDescription; group.TranslatorAudience = (sTranslatorAudience == "true") ? true : false; while (xml.ReadNextLineUntilEndTag(c_sTag)) {//yesu - stoped here if (xml.IsTag(LocItem.c_sTag)) { LocItem item = LocItem.ReadXML(xml); group.AppendItem(item); } if (xml.IsTag(LocGroup.c_sTag)) { LocGroup sub = LocGroup.ReadXML(db, xml); group._AppendGroup(sub); } } return group; }
public LocGroup FindOrAddGroup(string sGroupID) { LocGroup group = FindGroup(sGroupID); if (null == group) { group = new LocGroup(sGroupID, sGroupID); _AppendGroup(group); } Debug.Assert(null != group); return group; }
void _AppendGroup(LocGroup group) { if (null == group) return; LocGroup[] v = new LocGroup[Groups.Length + 1]; for (int i = 0; i < Groups.Length; i++) v[i] = Groups[i]; v[Groups.Length] = group; m_vGroups = v; }
LocGroup FindOrAddGroup(string sGroupID) { LocGroup group = FindGroup(sGroupID); if (null == group) { group = new LocGroup(sGroupID, sGroupID); AppendGroup(group); } return group; }
LocGroup ParseAndAddGroup(string sTitle) { // Build the ID from the string, getting rid of digits, whitespace and punctuation string sID = ""; foreach (char c in sTitle) { if (Char.IsDigit(c)) continue; if (Char.IsWhiteSpace(c)) continue; if (Char.IsPunctuation(c)) continue; sID += c; } if (sID.Length == 0) return null; // Don't bother if it is the Language record (the first record in the database, generally) if (sID == c_Languages) return null; // See if we already have this group LocGroup group = FindGroup(sID); if (null != group) return group; // If not, create a new one and add it to the vector group = new LocGroup(sID, sTitle); AppendGroup(group); return group; }