//------------------------------------------ public void AddEntry(String asName) { if (mpCurrentCat != null) { mpCurrentCat.AddEntry(asName); UpdateEntryData(); } }
//------------------------------------------ public void AddEntry(String asName) { if (mpCurrentCat != null) { mpCurrentCat.AddEntry(asName); SetChanged(); } }
//------------------------------------------ /** * Fills up a translation with categories and entries taken from a source one * If the invoking translation has stuff, it will add the ones which are not already in */ public void CopyStructureFromTrans(HplTrans apSrcTrans, bool abClear) { bool bTransHasNonPresentEntries = false; if (abClear) { Clear(); } ArrayList vAddedCategoryNames = new ArrayList(); ArrayList vAddedCategoryCount = new ArrayList(); ArrayList vAddedEntries = new ArrayList(); ArrayList vAddedEntryTexts = new ArrayList(); for (int i = 0; i < apSrcTrans.mvDirectories.Count; ++i) { String sDir = (String)apSrcTrans.mvDirectories[i]; if (mvDirectories.IndexOf(sDir) == -1) { mvDirectories.Add(sDir); } } for (int i = 0; i < apSrcTrans.mvCategories.Count; ++i) { cTransCategory srcCat = (cTransCategory)apSrcTrans.mvCategories[i]; cTransCategory cat = GetCategory(srcCat.msName); if (cat == null) { cat = AddCategory(srcCat.msName); } for (int j = 0; j < srcCat.mvEntries.Count; ++j) { cTransEntry srcEntry = (cTransEntry)srcCat.mvEntries[j]; cTransEntry entry = cat.GetEntry(srcEntry.msName); if (entry == null) { bTransHasNonPresentEntries = true; entry = cat.AddEntry(srcEntry.msName); vAddedEntries.Add(entry); vAddedEntryTexts.Add(srcEntry.msText); int lCatIndex = vAddedCategoryNames.IndexOf(cat.msName); if (lCatIndex == -1) { lCatIndex = vAddedCategoryNames.Add(cat.msName); vAddedCategoryCount.Add(0); } vAddedCategoryCount[lCatIndex] = (int)vAddedCategoryCount[lCatIndex] + 1; } } } if (abClear == false && bTransHasNonPresentEntries) { String sCategoryNames = ""; for (int i = 0; i < vAddedCategoryNames.Count; ++i) { sCategoryNames += (String)vAddedCategoryNames[i] + ": " + vAddedCategoryCount[i] + " entries, "; } sCategoryNames = sCategoryNames.Substring(0, sCategoryNames.Length - 2); DialogResult lRes = MessageBox.Show(mpMainForm, "There are entries in Base Language that are not present in loaded file, in categories:\n " + sCategoryNames + "\nWant to add base text for them?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (lRes == DialogResult.Yes) { mbChanged = true; for (int i = 0; i < vAddedEntries.Count; ++i) { cTransEntry entry = (cTransEntry)vAddedEntries[i]; entry.msText = (String)vAddedEntryTexts[i]; } } } }