Beispiel #1
0
        //////////////////////////////////////////////////////////////////////////
        private void OnUnignoreItem(object sender, EventArgs e)
        {
            StringItem StrItem = null;

            if (ListIgnored.SelectedItems.Count > 0)
            {
                ListViewItem Item = ListIgnored.SelectedItems[0];
                StrItem = Item.Tag as StringItem;

                if (StrItem != null)
                {
                    StrItem.Ignored = false;
                    Mgr.ProjectStrings.Add(StrItem);
                    Mgr.IgnoredStrings.Remove(StrItem);

                    int OrigSelIndex = Item.Index;
                    ListIgnored.Items.Remove(Item);

                    int SelIndex = Math.Min(ListIgnored.Items.Count - 1, OrigSelIndex);
                    if (SelIndex >= 0)
                    {
                        ListIgnored.Items[SelIndex].Selected = true;
                        ListIgnored.EnsureVisible(SelIndex);
                    }

                    ListViewItem ListItem = AddStringToList(StrItem, true);
                    SelIndex = ListItem.Index;
                    if (SelIndex >= 0)
                    {
                        ListStrings.Items[SelIndex].Selected = true;
                        ListStrings.EnsureVisible(SelIndex);
                    }
                }
            }
        }
Beispiel #2
0
        //////////////////////////////////////////////////////////////////////////
        private void Reload()
        {
            UpdateStatusLocked = true;

            int OrigSelIndex = -1;

            if (ListStrings.SelectedIndices.Count > 0)
            {
                OrigSelIndex = ListStrings.SelectedIndices[0];
            }

            if (Mgr != null)
            {
                if (Mgr.ProjectStrings != null)
                {
                    ListStrings.BeginUpdate();
                    ListStrings.Items.Clear();
                    foreach (StringItem StrItem in Mgr.ProjectStrings)
                    {
                        if (HideStringsWithID && StrItem.ID != string.Empty)
                        {
                            continue;
                        }
                        AddStringToList(StrItem);
                    }
                    ListStrings.EndUpdate();
                }

                if (Mgr.IgnoredStrings != null)
                {
                    ListIgnored.BeginUpdate();
                    ListIgnored.Items.Clear();
                    foreach (StringItem StrItem in Mgr.IgnoredStrings)
                    {
                        if (StrItem.IgnoreReason == IgnoreReason.AlreadyInTable)
                        {
                            continue;
                        }
                        AddStringToIgnoreList(StrItem);
                    }
                    ListIgnored.EndUpdate();
                }
            }

            int SelIndex = Math.Min(ListStrings.Items.Count - 1, OrigSelIndex);

            if (SelIndex >= 0)
            {
                ListStrings.Items[SelIndex].Selected = true;
                ListStrings.EnsureVisible(SelIndex);
            }

            UpdateStatusLocked = false;
            UpdateStringStatus();
        }
Beispiel #3
0
 //////////////////////////////////////////////////////////////////////////
 private void OnSelectInvert(object sender, EventArgs e)
 {
     UpdateStatusLocked = true;
     ListStrings.BeginUpdate();
     foreach (ListViewItem Item in ListStrings.Items)
     {
         Item.Checked = !Item.Checked;
     }
     ListStrings.EndUpdate();
     UpdateStatusLocked = false;
     UpdateStringStatus();
 }
Beispiel #4
0
 //////////////////////////////////////////////////////////////////////////
 private void SelectNone()
 {
     UpdateStatusLocked = true;
     ListStrings.BeginUpdate();
     foreach (ListViewItem Item in ListStrings.Items)
     {
         Item.Checked = false;
     }
     ListStrings.EndUpdate();
     UpdateStatusLocked = false;
     UpdateStringStatus();
 }
Beispiel #5
0
 //////////////////////////////////////////////////////////////////////////
 private void RefreshStringIDs()
 {
     ListStrings.BeginUpdate();
     foreach (ListViewItem Item in ListStrings.Items)
     {
         StringItem StrItem = Item.Tag as StringItem;
         if (StrItem != null)
         {
             Item.Text = StrItem.ID;
         }
     }
     ListStrings.EndUpdate();
 }
Beispiel #6
0
 //////////////////////////////////////////////////////////////////////////
 private void OnSelectWithoutID(object sender, EventArgs e)
 {
     UpdateStatusLocked = true;
     ListStrings.BeginUpdate();
     foreach (ListViewItem Item in ListStrings.Items)
     {
         StringItem StrItem = Item.Tag as StringItem;
         Item.Checked = StrItem != null && StrItem.ID == string.Empty;
     }
     ListStrings.EndUpdate();
     UpdateStatusLocked = false;
     UpdateStringStatus();
 }
Beispiel #7
0
 protected bool Equals(Collection other)
 {
     return(Id == other.Id &&
            ArrayStrings.EquivalentTo(other.ArrayStrings) &&
            SetStrings.EquivalentTo(other.SetStrings) &&
            ListStrings.EquivalentTo(other.ListStrings) &&
            ArrayInts.EquivalentTo(other.ArrayInts) &&
            SetInts.EquivalentTo(other.SetInts) &&
            ListInts.EquivalentTo(other.ListInts) &&
            DictionaryInts.EquivalentTo(other.DictionaryInts) &&
            DictionaryStrings.EquivalentTo(other.DictionaryStrings) &&
            PocoLookup.EquivalentTo(other.PocoLookup, (a, b) => a.EquivalentTo(b)) &&
            PocoLookupMap.EquivalentTo(other.PocoLookupMap, (a, b) => a.EquivalentTo(b, (m1, m2) => m1.EquivalentTo(m2))));
 }
Beispiel #8
0
        //////////////////////////////////////////////////////////////////////////
        private void OnStringSelected(object sender, EventArgs e)
        {
            ListView List = sender as ListView;

            if (List == null || List.SelectedItems.Count != 1)
            {
                return;
            }

            StringItem Item = List.SelectedItems[0].Tag as StringItem;

            if (Item != null)
            {
                DisplayContext(Item);
            }

            // handle multi selection
            if (List == ListStrings)
            {
                if (PrevSelectedIndex >= 0 && (ModifierKeys & Keys.Shift) == Keys.Shift)
                {
                    int Start, End;
                    if (PrevSelectedIndex < List.SelectedIndices[0])
                    {
                        Start = PrevSelectedIndex;
                        End   = List.SelectedIndices[0];
                    }
                    else
                    {
                        Start = List.SelectedIndices[0];
                        End   = PrevSelectedIndex;
                    }

                    bool Select = (ModifierKeys & Keys.Control) != Keys.Control;

                    UpdateStatusLocked = true;
                    ListStrings.BeginUpdate();
                    for (int i = Start; i <= End; i++)
                    {
                        List.Items[i].Checked = Select;
                    }
                    ListStrings.EndUpdate();
                    UpdateStatusLocked = false;
                    UpdateStringStatus();
                }
                PrevSelectedIndex = List.SelectedIndices[0];
            }
        }
Beispiel #9
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (ArrayStrings != null ? ArrayStrings.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SetStrings != null ? SetStrings.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ListStrings != null ? ListStrings.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ArrayInts != null ? ArrayInts.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SetInts != null ? SetInts.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ListInts != null ? ListInts.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DictionaryInts != null ? DictionaryInts.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DictionaryStrings != null ? DictionaryStrings.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PocoLookup != null ? PocoLookup.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PocoLookupMap != null ? PocoLookupMap.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #10
0
        //////////////////////////////////////////////////////////////////////////
        private void OnHide(object sender, EventArgs e)
        {
            HideStringsWithID = !HideStringsWithID;

            int OrigSelIndex = -1;

            if (ListStrings.SelectedIndices.Count > 0)
            {
                OrigSelIndex = ListStrings.SelectedIndices[0];
            }

            Reload();

            int SelIndex = Math.Min(ListStrings.Items.Count - 1, OrigSelIndex);

            if (SelIndex >= 0)
            {
                ListStrings.Items[SelIndex].Selected = true;
                ListStrings.EnsureVisible(SelIndex);
            }
        }
Beispiel #11
0
        //////////////////////////////////////////////////////////////////////////
        private void OnAssignID(object sender, EventArgs e)
        {
            UpdateStatusLocked = true;
            ListStrings.BeginUpdate();


            string InitVal = "";
            int    Dummy;

            if (ListStrings.SelectedItems.Count > 0)
            {
                InitVal = ListStrings.SelectedItems[0].Text;
                Mgr.GetIDBase(InitVal, out InitVal, out Dummy);
            }

            StringIdForm Form = new StringIdForm();

            Form.Mgr      = Mgr;
            Form.StringID = InitVal;
            if (Form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string Msg = "";

            if (ListStrings.CheckedItems.Count > 0)
            {
                Msg = ListStrings.CheckedItems.Count.ToString() + " selected item(s)";
            }
            else
            {
                Msg = "Selected item";
            }

            Msg += " will be assigned ID '" + Form.StringID + "' starting with number " + (Form.LastNum + 1).ToString("0000") + ".";
            Msg += "\n\nDo you want to continue?";

            if (MessageBox.Show(Msg, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            StringItem[] SelItems = GetSelectedStrings();

            int NumID = Form.LastNum;

            foreach (StringItem StrItem in SelItems)
            {
                NumID++;
                string FinalID = Form.StringID + NumID.ToString("0000");

                StrItem.ID = FinalID;
            }
            RefreshStringIDs();
            SelectNone();

            ListStrings.EndUpdate();
            UpdateStatusLocked = false;

            if (HideStringsWithID)
            {
                Reload();
            }
        }
Beispiel #12
0
        //////////////////////////////////////////////////////////////////////////
        private void IgnoreItems(bool AddToIgnoreList)
        {
            StringItem[] SelectedItems = GetSelectedStrings();
            if (SelectedItems.Length == 0)
            {
                return;
            }

            if (AddToIgnoreList)
            {
                if (MessageBox.Show("Selected item(s) will be ignored and added to the ignore list. Continue?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return;
                }
            }

            ListStrings.BeginUpdate();
            ListIgnored.BeginUpdate();

            int OrigSelIndex = -1;

            if (ListStrings.SelectedIndices.Count > 0)
            {
                OrigSelIndex = ListStrings.SelectedIndices[0];
            }

            if (ListStrings.CheckedItems.Count > 0)
            {
                foreach (ListViewItem Item in ListStrings.CheckedItems)
                {
                    IgnoreSingleItem(Item, AddToIgnoreList);
                }
            }
            else if (ListStrings.SelectedIndices.Count > 0)
            {
                foreach (ListViewItem Item in ListStrings.SelectedItems)
                {
                    IgnoreSingleItem(Item, AddToIgnoreList);
                }
            }

            // select ignored
            int SelIndex;

            SelIndex = ListIgnored.Items.Count - 1;
            if (SelIndex >= 0)
            {
                ListIgnored.Items[SelIndex].Selected = true;
                ListIgnored.EnsureVisible(SelIndex);
            }

            // select string
            SelIndex = Math.Min(ListStrings.Items.Count - 1, OrigSelIndex);
            if (SelIndex >= 0)
            {
                ListStrings.Items[SelIndex].Selected = true;
                ListStrings.EnsureVisible(SelIndex);
            }


            ListStrings.EndUpdate();
            ListIgnored.EndUpdate();

            UpdateStringStatus();
        }