예제 #1
0
        public void InsertTag(TagData newTag)
        {
            if (newTag.IsInitialized)
            {
                CategoryData parentCategory = WallpaperData.TaggingInfo.GetTagParentCategory(newTag);

                /*x
                 * foreach (Control control in TaggingTools.GetCategoryTagContainer(parentCategory, ParentTagTabControl).tagContainerFLP.Controls)
                 * {
                 *  Button curTagButton = control as Button;
                 *
                 *  if (TaggingTools.GetButtonTagName(curTagButton) == newTag.Name)
                 *  {
                 *      MessageBox.Show(newTag.Name + " already exists in the " + parentCategory.Name + " category");
                 *      return false;
                 *  }
                 * }
                 */

                if (newTag.GetLinkedImageCount() == 0) // this tag is completely new so there's no need to determine an insertion location
                {
                    orderedTags.Add(newTag);
                }
                else // tags must maintain ordering based on image count
                {
                    if (orderedTags.Count != 0)
                    {
                        for (int i = 0; i < orderedTags.Count; i++)
                        {
                            if (newTag.GetLinkedImageCount() > orderedTags[i].GetLinkedImageCount()) // inserting existing tag
                            {
                                orderedTags.Insert(i, newTag);
                                break;
                            }

                            if (i == orderedTags.Count - 1) // inserting smallest tag in container
                            {
                                orderedTags.Add(newTag);
                                break;
                            }
                        }
                    }
                    else // inserting first tag in container
                    {
                        orderedTags.Add(newTag);
                    }
                }

                LoadPage(currentStartIndex, LoadDirection.None);
                ParentTagTabControl.ParentTagForm.UpdateCategoryControls();
            }
        }
예제 #2
0
        public TagEditorForm(TagData activeTag, Button activeTagButton, FlowLayoutPanel tagContainerFLP)
        {
            InitializeComponent();

            this.activeTag       = activeTag;
            this.activeTagButton = activeTagButton;
            this.tagContainerFLP = tagContainerFLP;

            labelTagName.Text = activeTag.Name;

            if (labelTagName.Bounds.Right >= Size.Width - 25)
            {
                Size = new Size(labelTagName.Bounds.Right + 25, Size.Height);
            }

            labelFoundImages.Text        = "Found in " + activeTag.GetLinkedImageCount() + " images";
            checkBoxEnabled.Checked      = activeTag.Enabled;
            checkBoxUseForNaming.Checked = activeTag.UseForNaming;
        }
예제 #3
0
 private void UpdateTagButton()
 {
     labelFoundImages.Text = "Found in " + activeTag.GetLinkedImageCount() + " images";
     TaggingTools.UpdateTagButton(activeTagButton, activeTag);
 }
예제 #4
0
 public static void UpdateTagButton(Button tagButton, TagData tag)
 {
     tagButton.Text      = tag.Name + " (" + tag.GetLinkedImageCount() + ")";
     tagButton.ForeColor = tag.Enabled ? Color.Black : Color.Red;
 }