Ejemplo n.º 1
0
        internal ResourceListState ConfigureColumns(ResourceListState state, IResourceList resList,
                                                    IResource ownerResource)
        {
            RestoreSettings();
            _displayColumnManager = Core.DisplayColumnManager as DisplayColumnManager;
            _resourceList         = resList;
            _allTypes             = _resourceList.GetAllTypes();
            _allNoFileTypes       = _displayColumnManager.CollapseFileTypes(_allTypes);
            _availableColumns     = _displayColumnManager.GetAvailableColumns(_resourceList);
            _state = state;
            FillPropertyList();

            SetViewRadioButtons(_state, ownerResource);

            if (ShowDialog(Core.MainWindow) == DialogResult.OK)
            {
                if (_state.KeyTypes != null && radThisView.Checked)
                {
                    _state = new ResourceListState(new ColumnDescriptor[] {}, _state.SortSettings, state.GroupItems);
                    _state.SetOwner(ownerResource, Core.TabManager.CurrentTabId);
                }
                else if (_state.OwnerResource != null && radAllViews.Checked)
                {
                    _state.Delete();
                    _state = _displayColumnManager.StateFromList(_resourceList,
                                                                 _displayColumnManager.GetDefaultColumns(_resourceList), true);
                }
                SaveColumnsToState(_state);
            }
            return(_state);
        }
Ejemplo n.º 2
0
 public ResourceColumnSchemeProvider(DisplayColumnManager displayColumnManager,
                                     ResourceListView2 resourceListView)
 {
     _displayColumnManager = displayColumnManager;
     _resourceListView     = resourceListView;
 }
Ejemplo n.º 3
0
        private static void LoadMultiLineColumn(string resourceType, string[] propNames, XmlNode node)
        {
            int row    = XmlTools.GetRequiredIntAttribute(node, "row");
            int endRow = XmlTools.GetIntAttribute(node, "endRow", -1);

            if (endRow == -1)
            {
                endRow = row;
            }
            int startX = XmlTools.GetRequiredIntAttribute(node, "startX");
            int width  = XmlTools.GetRequiredIntAttribute(node, "width");

            MultiLineColumnFlags flags = 0;

            string anchor = XmlTools.GetRequiredAttribute(node, "anchor");

            switch (anchor)
            {
            case "left":  flags |= MultiLineColumnFlags.AnchorLeft; break;

            case "right": flags |= MultiLineColumnFlags.AnchorRight; break;

            case "both":  flags |= MultiLineColumnFlags.AnchorLeft | MultiLineColumnFlags.AnchorRight; break;

            default:
                throw new Exception("Invalid column anchor '" + anchor + "'");
            }

            if (XmlTools.GetIntAttribute(node, "hideIfNoProp", 0) == 1)
            {
                flags |= MultiLineColumnFlags.HideIfNoProp;
            }

            Color color = SystemColors.ControlText;
            int   r     = XmlTools.GetIntAttribute(node, "r", -1);

            if (r != -1)
            {
                int g = XmlTools.GetRequiredIntAttribute(node, "g");
                int b = XmlTools.GetRequiredIntAttribute(node, "b");
                color = Color.FromArgb(r, g, b);
            }

            HorizontalAlignment textAlign = HorizontalAlignment.Left;

            if (node.Attributes ["align"] != null)
            {
                switch (node.Attributes ["align"].Value)
                {
                case "left":   textAlign = HorizontalAlignment.Left; break;

                case "center": textAlign = HorizontalAlignment.Center; break;

                case "right":  textAlign = HorizontalAlignment.Right; break;

                default:
                    throw new Exception("Invalid column alignment '" + anchor + "'");
                }
            }

            DisplayColumnManager colManager = Core.DisplayColumnManager as DisplayColumnManager;

            Core.DisplayColumnManager.RegisterMultiLineColumn(resourceType,
                                                              colManager.PropNamesToIDs(propNames, true), row, endRow, startX, width, flags, color, textAlign);
        }