示例#1
0
        public XmlFormattingSettings Clone()
        {
            XmlFormattingSettings clone = (XmlFormattingSettings)MemberwiseClone();

            clone.scope = new List <string> (scope);
            return(clone);
        }
        string GetName(XmlFormattingSettings format)
        {
            if (format == policy.DefaultFormat)
            {
                return(GettextCatalog.GetString("Default"));
            }

            string name = "";

            foreach (string s in format.ScopeXPath)
            {
                if (name.Length != 0)
                {
                    name += ", ";
                }
                name += s;
            }
            if (name.Length != 0)
            {
                return(name);
            }
            else
            {
                int i = policy.Formats.IndexOf(format) + 1;
                return(string.Format(GettextCatalog.GetString("Format #{0}"), i));
            }
        }
示例#3
0
        public bool Equals(XmlFormattingSettings other)
        {
            if (scope.Count != other.scope.Count)
            {
                return(false);
            }
            List <string> list = new List <string> (other.scope.Count);

            foreach (string s in scope)
            {
                int n = list.IndexOf(s);
                if (n == -1)
                {
                    return(false);
                }
                list.RemoveAt(n);
            }

            return(OmitXmlDeclaration == other.OmitXmlDeclaration &&
                   IndentContent == other.IndentContent &&
                   AttributesInNewLine == other.AttributesInNewLine &&
                   MaxAttributesPerLine == other.MaxAttributesPerLine &&
                   AlignAttributes == other.AlignAttributes &&
                   WrapAttributes == other.WrapAttributes &&
                   AlignAttributeValues == other.AlignAttributeValues &&
                   SpacesBeforeAssignment == other.SpacesBeforeAssignment &&
                   SpacesAfterAssignment == other.SpacesAfterAssignment &&
                   QuoteChar == other.QuoteChar &&
                   EmptyLinesBeforeStart == other.EmptyLinesBeforeStart &&
                   EmptyLinesAfterStart == other.EmptyLinesAfterStart &&
                   EmptyLinesBeforeEnd == other.EmptyLinesBeforeEnd &&
                   EmptyLinesAfterEnd == other.EmptyLinesAfterEnd);
        }
        protected virtual void OnButtonAddClicked(object sender, System.EventArgs e)
        {
            var format = new XmlFormattingSettings();

            policy.Formats.Add(format);
            TreeIter it = AppendSettings(format);

            listView.Selection.SelectIter(it);
        }
示例#5
0
 void CleanScopes(XmlFormattingSettings format)
 {
     for (int n = format.ScopeXPath.Count - 1; n >= 0; n--)
     {
         if (format.ScopeXPath [n].Length == 0)
         {
             format.ScopeXPath.RemoveAt(n);
         }
     }
 }
 void FillFormat(XmlFormattingSettings format)
 {
     currentFormat = format;
     if (currentFormat != null && currentFormat.ScopeXPath.Count == 0)
     {
         currentFormat.ScopeXPath.Add("");
     }
     propertyGrid.CurrentObject = format;
     UpdateScopes();
     propertyGrid.Sensitive = currentFormat != null;
 }
 TreeIter AppendSettings(XmlFormattingSettings format)
 {
     return(store.AppendValues(GetName(format), format));
 }