Beispiel #1
0
        void IPersistable.LoadFrom(IPersistency persistency)
        {
            string instance = DockItem.Id.ToString();

            mColumnPersistence.Clear();
            var columns = persistency.LoadSetting(instance, "Columns", "");
            var sc      = columns.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);

            // NOTe: depending on initialization order (not determined)
            // persistency of column could be loaded before or after column creation
            // that behaviour is new since some last changes in component initialization
            // may this will be refurbished infuture

            foreach (var c in sc)
            {
                var v = c.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (v.Length >= 3)
                {
                    int tag, visible, width;
                    if (int.TryParse(v[0], out tag) && int.TryParse(v[1], out visible) && int.TryParse(v[2], out width))
                    {
                        // store persistency for early persistency loading
                        mColumnPersistence.Add(tag, new ColumnPersistence(visible != 0, width));

                        // perform persistency for late persistency loading
                        mColumnControl.Update(tag, width, visible != 0);
                    }
                }
                mColumnControl.ArangeColumns();
            }

            bool loadedFindVisibility = persistency.LoadSetting(instance, "FindVisible", false);

            ShowFindBox(loadedFindVisibility, true);
        }
        internal void ShowDockPopupMenu(uint time)
        {
            Menu menu = new Menu();

            var columns = mColumnControl.mColumns;

            foreach (var column in columns)
            {
                var widget = column.Key;
                var c      = column.Value;
                TaggedLocalizedCheckedMenuItem item = new TaggedLocalizedCheckedMenuItem(c.Name);
                item.Active     = c.Visible;
                item.Tag        = c;
                item.Activated += (object sender, EventArgs e) =>
                {
                    var itm = sender as TaggedLocalizedCheckedMenuItem;
                    var ct  = itm.Tag as ColumnControl.Column;
                    ct.Visible = !ct.Visible;
                    mColumnControl.ArangeColumns();
                    drawingarea.QueueDraw();
                };
                menu.Add(item);
            }

            menu.ShowAll();
            menu.Popup(null, null, null, 3, time);
        }