예제 #1
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();
        }
예제 #2
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();
 }
예제 #3
0
 //////////////////////////////////////////////////////////////////////////
 private void SelectNone()
 {
     UpdateStatusLocked = true;
     ListStrings.BeginUpdate();
     foreach (ListViewItem Item in ListStrings.Items)
     {
         Item.Checked = false;
     }
     ListStrings.EndUpdate();
     UpdateStatusLocked = false;
     UpdateStringStatus();
 }
예제 #4
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();
 }
예제 #5
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();
 }
예제 #6
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];
            }
        }
예제 #7
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();
            }
        }
예제 #8
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();
        }