Beispiel #1
0
        public void AddAlias(string a, string ao)
        {
            _frameItem fi = GetFrameItemOf(ao);

            if (fi != null)
            {
                fi.AddName(a, FrameSource.Alias, ao);
                LookupFrameItems.Add(a, fi);
                if (aliases == null)
                {
                    aliases = new Dictionary <string, string>();
                }
                aliases.Add(a, ao);
            }
        }
Beispiel #2
0
        public void SetFrameGridName(string d, string n)
        {
            if (frameGrid == null)
            {
                return;
            }

            string on = frameGrid.SetNameFor(d, n);

            if (on == null)
            {
                return;
            }
            else
            {
                _frameItem fi = GetFrameItemOf(d);
                if (on == "")
                {
                    fi.AddName(n, FrameSource.Name);
                }
                else
                {
                    foreach (_frameName fn in fi.names)
                    {
                        if (fn.name == on)
                        {
                            fn.name = n;
                            break;
                        }
                    }

                    LookupFrameItems.Remove(on);
                }

                LookupFrameItems.Add(n, fi);
            }
        }
Beispiel #3
0
        public void RecalcFrameItems()
        {
            LookupFrameItems.Clear();
            ListFrameItems.Clear();
            _frameItem item = null;

            if (frameGrid != null)
            {
                string name;
                for (int j = 0; j < frameGrid.dimensions[1]; j++)
                {
                    for (int i = 0; i < frameGrid.dimensions[0]; i++)
                    {
                        name = (i + j * frameGrid.dimensions[0]).ToString();
                        item = new _frameItem(i * frameGrid.size[0], j * frameGrid.size[1], frameGrid.size[0], frameGrid.size[1]);
                        item.AddName(name, FrameSource.Grid);
                        LookupFrameItems.Add(name, item);
                        ListFrameItems.Add(item);
                    }
                }

                if (frameGrid.names != null)
                {
                    for (int j = 0; j < frameGrid.names.Count; j++)
                    {
                        for (int i = 0; i < frameGrid.names[j].Count; i++)
                        {
                            if (string.IsNullOrEmpty(frameGrid.names[j][i]))
                            {
                                continue;
                            }
                            if (LookupFrameItems.ContainsKey(frameGrid.names[j][i]))
                            {
                                continue;
                            }

                            name = frameGrid.names[j][i];
                            if ((i < frameGrid.dimensions[0]) && (j < frameGrid.dimensions[1]))
                            {
                                item = LookupFrameItems[(i + j * frameGrid.dimensions[0]).ToString()];
                            }
                            else
                            {
                                item = new _frameItem(i * frameGrid.size[0], j * frameGrid.size[1], frameGrid.size[0], frameGrid.size[1]);
                                ListFrameItems.Add(item);
                            }
                            LookupFrameItems.Add(name, item);
                            item.AddName(name, FrameSource.Name);
                        }
                    }
                }
            }

            if (frameList != null)
            {
                foreach (KeyValuePair <string, int[]> entry in frameList)
                {
                    item = GetFrameItemOfSize(entry.Value[0], entry.Value[1], entry.Value[2] - entry.Value[0] + 1, entry.Value[3] - entry.Value[1] + 1);
                    if (item == null)
                    {
                        item = new _frameItem(entry.Value[0], entry.Value[1], entry.Value[2] - entry.Value[0] + 1, entry.Value[3] - entry.Value[1] + 1);
                        ListFrameItems.Add(item);
                    }
                    LookupFrameItems.Add(entry.Key, item);
                    item.AddName(entry.Key, FrameSource.List);
                }
            }

            if (aliases != null)
            {
                foreach (KeyValuePair <string, string> entry in aliases)
                {
                    if (LookupFrameItems.ContainsKey(entry.Key))
                    {
                        continue;
                    }
                    if (!LookupFrameItems.ContainsKey(entry.Value))
                    {
                        continue;
                    }

                    item = LookupFrameItems[entry.Value];
                    item.AddName(entry.Key, FrameSource.Alias, entry.Value);
                    LookupFrameItems.Add(entry.Key, item);
                }
            }
        }