Пример #1
0
        public KeywordListNode(XmlElement el)
        {
            Text  = ResNodeName("KeywordList");
            panel = new KeywordListOptionPanel(this);

            if (el == null)
            {
                return;
            }

            color = new EditorHighlightColor(el);

            XmlNodeList keys = el.GetElementsByTagName("Key");

            foreach (XmlElement node in keys)
            {
                if (node.Attributes["word"] != null)
                {
                    words.Add(node.Attributes["word"].InnerText);
                }
            }

            if (el.Attributes["name"] != null)
            {
                name = el.Attributes["name"].InnerText;
            }
            UpdateNodeText();
        }
Пример #2
0
        protected static void PreviewUpdate(Label label, EditorHighlightColor color)
        {
            if (label == null)
            {
                return;
            }

            if (color == null)
            {
                label.ForeColor = label.BackColor = Color.Transparent;
                return;
            }
            if (color.NoColor)
            {
                label.ForeColor = label.BackColor = Color.Transparent;
                return;
            }

            label.ForeColor = color.GetForeColor();
            label.BackColor = color.GetBackColor();

            FontStyle fs = FontStyle.Regular;

            if (color.Bold)
            {
                fs |= FontStyle.Bold;
            }
            if (color.Italic)
            {
                fs |= FontStyle.Italic;
            }

            label.Font = new Font(label.Font, fs);
        }
Пример #3
0
        public override void LoadSettings()
        {
            DigitsNode node = (DigitsNode)parent;

            sampleLabel.Font = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;
            color            = node.Color;
            PreviewUpdate(sampleLabel, color);
        }
Пример #4
0
        public SpanNode(string Name)
        {
            name  = Name;
            color = new EditorHighlightColor();
            UpdateNodeText();

            panel = new SpanOptionPanel(this);
        }
Пример #5
0
		public KeywordListNode(string Name)
		{
			name = Name;
			color = new EditorHighlightColor();
			UpdateNodeText();

			panel = new KeywordListOptionPanel(this);
		}
Пример #6
0
		public override void LoadSettings()
		{
			DigitsNode node = (DigitsNode)parent;
			
			sampleLabel.Font = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;
			color = node.Color;
			PreviewUpdate(sampleLabel, color);
		}
Пример #7
0
        public KeywordListNode(string Name)
        {
            name  = Name;
            color = new EditorHighlightColor();
            UpdateNodeText();

            panel = new KeywordListOptionPanel(this);
        }
Пример #8
0
		public MarkerNode(string What, bool prev)
		{
			what = What;
			previous = prev;
			color = new EditorHighlightColor();
			UpdateNodeText();
			
			panel = new MarkerOptionPanel(this, prev);
		}
Пример #9
0
        public MarkerNode(string What, bool prev)
        {
            what     = What;
            previous = prev;
            color    = new EditorHighlightColor();
            UpdateNodeText();

            panel = new MarkerOptionPanel(this, prev);
        }
Пример #10
0
 void chgBtnClick(object sender, EventArgs e)
 {
     using (EditHighlightingColorDialog dlg = new EditHighlightingColorDialog(color)) {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             color = dlg.Color;
             PreviewUpdate(sampleLabel, color);
         }
     }
 }
Пример #11
0
 void chgEndClick(object sender, EventArgs e)
 {
     using (EditHighlightingColorDialog dlg = new EditHighlightingColorDialog(endColor)) {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             endColor = dlg.Color;
             PreviewUpdate(samEnd, endColor);
         }
     }
 }
Пример #12
0
        public SpanNode(XmlElement el)
        {
            Text = ResNodeName("Span");

            panel = new SpanOptionPanel(this);

            if (el == null)
            {
                return;
            }

            color = new EditorHighlightColor(el);

            if (el.Attributes["rule"] != null)
            {
                rule = el.Attributes["rule"].InnerText;
            }

            if (el.Attributes["escapecharacter"] != null)
            {
                escapeCharacter = el.Attributes["escapecharacter"].Value[0];
            }

            name = el.Attributes["name"].InnerText;
            if (el.HasAttribute("stopateol"))
            {
                stopEOL = Boolean.Parse(el.Attributes["stopateol"].InnerText);
            }
            else
            {
                stopEOL = true;
            }
            XmlElement beginElement = el["Begin"];

            begin      = beginElement.InnerText;
            beginColor = new EditorHighlightColor(beginElement);
            if (beginElement.HasAttribute("singleword"))
            {
                isBeginSingleWord = Boolean.Parse(beginElement.GetAttribute("singleword"));
            }

            XmlElement endElement = el["End"];

            if (endElement != null)
            {
                end      = endElement.InnerText;
                endColor = new EditorHighlightColor(endElement);
                if (endElement.HasAttribute("singleword"))
                {
                    isEndSingleWord = Boolean.Parse(endElement.GetAttribute("singleword"));
                }
            }

            UpdateNodeText();
        }
Пример #13
0
        public override void LoadSettings()
        {
            MarkerNode node = (MarkerNode)parent;


            sampleLabel.Font = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;

            color            = node.Color;
            nameBox.Text     = node.What;
            checkBox.Checked = node.MarkMarker;
            PreviewUpdate(sampleLabel, color);
        }
Пример #14
0
		public DigitsNode(XmlElement el)
		{
			if (el != null) {
				color = new EditorHighlightColor(el);
			} else {
				color = new EditorHighlightColor();
			}
			
			Text = ResNodeName("DigitsColor");
			
			panel = new DigitsOptionPanel(this);
		}
Пример #15
0
        public override void LoadSettings()
        {
            SpanNode node = (SpanNode)parent;

            try {
                ruleBox.Items.Clear();
                foreach (RuleSetNode rn in node.Parent.Parent.Parent.Nodes)                  // list rule sets
                {
                    if (!rn.IsRoot)
                    {
                        ruleBox.Items.Add(rn.Text);
                    }
                }
            } catch {}

            samBegin.Font = samEnd.Font = samCont.Font = ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;

            nameBox.Text       = node.Name;
            ruleBox.Text       = node.Rule;
            beginBox.Text      = node.Begin;
            endBox.Text        = node.End;
            stopEolBox.Checked = node.StopEOL;
            beginSingleWordCheckBox.Checked = node.IsBeginSingleWord;
            endSingleWordCheckBox.Checked   = node.IsEndSingleWord;
            escCharTextBox.Text             = (node.EscapeCharacter == '\0') ? "" : node.EscapeCharacter.ToString();

            color      = node.Color;
            beginColor = node.BeginColor;
            endColor   = node.EndColor;

            if (beginColor != null)
            {
                if (!beginColor.NoColor)
                {
                    useBegin.Checked = true;
                }
            }
            if (endColor != null)
            {
                if (!endColor.NoColor)
                {
                    useEnd.Checked = true;
                }
            }

            PreviewUpdate(samBegin, beginColor);
            PreviewUpdate(samEnd, endColor);
            PreviewUpdate(samCont, color);
            CheckedChanged(null, null);
            BeginTextChanged(null, null);
            EndTextChanged(null, null);
        }
Пример #16
0
            public EnvironmentItem(int index, string name, EditorHighlightColor color, Font listFont) : base(new string[] { name, "Sample" })
            {
                Name       = name;
                Color      = color;
                arrayIndex = index;

                this.UseItemStyleForSubItems = false;

                basefont = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;
                listfont = listFont;

                ColorUpdate();
            }
Пример #17
0
        public DigitsNode(XmlElement el)
        {
            if (el != null)
            {
                color = new EditorHighlightColor(el);
            }
            else
            {
                color = new EditorHighlightColor();
            }

            Text = ResNodeName("DigitsColor");

            panel = new DigitsOptionPanel(this);
        }
Пример #18
0
		public MarkerNode(XmlElement el, bool prev)
		{
			Text = "Marker";
			previous = prev;
			panel = new MarkerOptionPanel(this, prev);
			
			if (el == null) return;
			
			color = new EditorHighlightColor(el);
			what  = el.InnerText;
			if (el.Attributes["markmarker"] != null) {
				markMarker = Boolean.Parse(el.Attributes["markmarker"].InnerText);
			}
			
			UpdateNodeText();
			
		}
Пример #19
0
        public EnvironmentNode(XmlElement el)
        {
            List <EditorHighlightColor> envColors = new List <EditorHighlightColor>();
            List <string> envColorNames           = new List <string>();
            List <string> envColorDescriptions    = new List <string>();

            if (el != null)
            {
                foreach (XmlNode node in el.ChildNodes)
                {
                    if (node is XmlElement)
                    {
                        if (node.Name == "Custom")
                        {
                            envColorNames.Add(CustomColorPrefix + (node as XmlElement).GetAttribute("name"));
                            envColorDescriptions.Add((node as XmlElement).GetAttribute("name"));
                        }
                        else
                        {
                            envColorNames.Add(node.Name);
                            envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + node.Name + "}");
                        }
                        envColors.Add(new EditorHighlightColor((XmlElement)node));
                    }
                }
            }

            foreach (KeyValuePair <string, HighlightColor> pair in new DefaultHighlightingStrategy().EnvironmentColors)
            {
                if (!envColorNames.Contains(pair.Key))
                {
                    envColorNames.Add(pair.Key);
                    envColorDescriptions.Add("${res:Dialog.HighlightingEditor.EnvColors." + pair.Key + "}");
                    envColors.Add(EditorHighlightColor.FromTextEditor(pair.Value));
                }
            }

            this.ColorNames = envColorNames.ToArray();
            this.ColorDescs = envColorDescriptions.ToArray();
            this.Colors     = envColors.ToArray();
            StringParser.Parse(ColorDescs);

            Text = ResNodeName("EnvironmentColors");

            panel = new EnvironmentOptionPanel(this);
        }
Пример #20
0
        public override void LoadSettings()
        {
            KeywordListNode node = (KeywordListNode)parent;

            listBox.Items.Clear();

            foreach (string word in node.Words)
            {
                listBox.Items.Add(word);
            }

            sampleLabel.Font = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;

            color        = node.Color;
            nameBox.Text = node.Name;
            PreviewUpdate(sampleLabel, color);
        }
Пример #21
0
		public SpanNode(XmlElement el)
		{
			Text = ResNodeName("Span");
			
			panel = new SpanOptionPanel(this);

			if (el == null) return;
			
			color   = new EditorHighlightColor(el);
			
			if (el.Attributes["rule"] != null) {
				rule = el.Attributes["rule"].InnerText;
			}
			
			if (el.Attributes["escapecharacter"] != null) {
				escapeCharacter = el.Attributes["escapecharacter"].Value[0];
			}
			
			name    = el.Attributes["name"].InnerText;
			if (el.HasAttribute("stopateol")) {
				stopEOL = Boolean.Parse(el.Attributes["stopateol"].InnerText);
			} else {
				stopEOL = true;
			}
			XmlElement beginElement = el["Begin"];
			begin = beginElement.InnerText;
			beginColor = new EditorHighlightColor(beginElement);
			if (beginElement.HasAttribute("singleword")) {
				isBeginSingleWord = Boolean.Parse(beginElement.GetAttribute("singleword"));
			}
			
			XmlElement endElement = el["End"];
			if (endElement != null) {
				end  = endElement.InnerText;
				endColor = new EditorHighlightColor(endElement);
				if (endElement.HasAttribute("singleword")) {
					isEndSingleWord = Boolean.Parse(endElement.GetAttribute("singleword"));
				}
			}
			
			UpdateNodeText();
			
		}
Пример #22
0
		public KeywordListNode(XmlElement el)
		{
			Text = ResNodeName("KeywordList");
			panel = new KeywordListOptionPanel(this);
			
			if (el == null) return;

			color = new EditorHighlightColor(el);
			
			XmlNodeList keys = el.GetElementsByTagName("Key");
			foreach (XmlElement node in keys) {
				if (node.Attributes["word"] != null) words.Add(node.Attributes["word"].InnerText);
			}
			
			if (el.Attributes["name"] != null) {
				name = el.Attributes["name"].InnerText;
			}
			UpdateNodeText();
			
		}
Пример #23
0
        public MarkerNode(XmlElement el, bool prev)
        {
            Text     = "Marker";
            previous = prev;
            panel    = new MarkerOptionPanel(this, prev);

            if (el == null)
            {
                return;
            }

            color = new EditorHighlightColor(el);
            what  = el.InnerText;
            if (el.Attributes["markmarker"] != null)
            {
                markMarker = Boolean.Parse(el.Attributes["markmarker"].InnerText);
            }

            UpdateNodeText();
        }
Пример #24
0
		protected static void PreviewUpdate(Label label, EditorHighlightColor color)
		{
			if (label == null) return;
			
			if (color == null) {
				label.ForeColor = label.BackColor = Color.Transparent;
				return;
			}
			if (color.NoColor) {
				label.ForeColor = label.BackColor = Color.Transparent;
				return;
			}
			
			label.ForeColor = color.GetForeColor();
			label.BackColor = color.GetBackColor();
			
			FontStyle fs = FontStyle.Regular;
			if (color.Bold)   fs |= FontStyle.Bold;
			if (color.Italic) fs |= FontStyle.Italic;
			
			label.Font = new Font(label.Font, fs);
		}
Пример #25
0
			public EnvironmentItem(int index, string name, EditorHighlightColor color, Font listFont) : base(new string[] {name, "Sample"})
			{
				Name = name;
				Color = color;
				arrayIndex = index;
				
				this.UseItemStyleForSubItems = false;
				
				basefont = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;
				listfont = listFont;
				
				ColorUpdate();
			}
Пример #26
0
		public SpanNode(string Name)
		{
			name = Name;
			color = new EditorHighlightColor();
			UpdateNodeText();
			
			panel = new SpanOptionPanel(this);
		}
Пример #27
0
		public override void LoadSettings()
		{
			SpanNode node = (SpanNode)parent;
			
			try {
				ruleBox.Items.Clear();
				foreach(RuleSetNode rn in node.Parent.Parent.Parent.Nodes) { // list rule sets
					if (!rn.IsRoot) ruleBox.Items.Add(rn.Text);
				}
			} catch {}
			
			samBegin.Font = samEnd.Font = samCont.Font = ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;

			nameBox.Text = node.Name;
			ruleBox.Text = node.Rule;
			beginBox.Text = node.Begin;
			endBox.Text = node.End;
			stopEolBox.Checked = node.StopEOL;
			beginSingleWordCheckBox.Checked = node.IsBeginSingleWord;
			endSingleWordCheckBox.Checked = node.IsEndSingleWord;			
			escCharTextBox.Text = (node.EscapeCharacter == '\0') ? "" : node.EscapeCharacter.ToString();
			
			color = node.Color;
			beginColor = node.BeginColor;
			endColor = node.EndColor;
			
			if (beginColor != null) {
				if (!beginColor.NoColor) useBegin.Checked = true;
			}
			if (endColor != null) {
				if (!endColor.NoColor) useEnd.Checked = true;
			}
			
			PreviewUpdate(samBegin, beginColor);
			PreviewUpdate(samEnd, endColor);
			PreviewUpdate(samCont, color);
			CheckedChanged(null, null);
			BeginTextChanged(null, null);
			EndTextChanged(null, null);
		}
Пример #28
0
		void chgEndClick(object sender, EventArgs e)
		{
			using (EditHighlightingColorDialog dlg = new EditHighlightingColorDialog(endColor)) {
				if (dlg.ShowDialog(this) == DialogResult.OK) {
					endColor = dlg.Color;
					PreviewUpdate(samEnd, endColor);
				}
			}
		}
Пример #29
0
		public override void LoadSettings()
		{
			KeywordListNode node = (KeywordListNode)parent;
			listBox.Items.Clear();
			
			foreach (string word in node.Words) {
				listBox.Items.Add(word);
			}
			
			sampleLabel.Font = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;

			color = node.Color;
			nameBox.Text = node.Name;
			PreviewUpdate(sampleLabel, color);
		}
Пример #30
0
		void chgBtnClick(object sender, EventArgs e)
		{
			using (EditHighlightingColorDialog dlg = new EditHighlightingColorDialog(color)) {
				if (dlg.ShowDialog(this) == DialogResult.OK) {
					color = dlg.Color;
					PreviewUpdate(sampleLabel, color);
				}
			}
		}
Пример #31
0
		public override void LoadSettings()
		{
			MarkerNode node = (MarkerNode)parent;
			
			
			sampleLabel.Font = SharpDevelopTextEditorProperties.Instance.FontContainer.DefaultFont;

			color = node.Color;
			nameBox.Text = node.What;
			checkBox.Checked = node.MarkMarker;
			PreviewUpdate(sampleLabel, color);
		}
		void AcceptClick(object sender, EventArgs e)
		{
			object foreColor = null;
			object backColor = null;
			
			if (foreUser.Checked) {
				foreColor = (System.Drawing.Color)foreBtn.CenterColor;
			} else if (foreSys.Checked) {
				foreColor = (string)foreList.SelectedItem;
			}
			
			if (backUser.Checked) {
				backColor = (System.Drawing.Color)backBtn.CenterColor;
			} else if (backSys.Checked) {
				backColor = (string)backList.SelectedItem;
			}
			
			Color = new EditorHighlightColor(foreColor, backColor, boldBox.Checked, italicBox.Checked);
			
			DialogResult = DialogResult.OK;
		}
		public EditHighlightingColorDialog(EditorHighlightColor color)
		{
			SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.ColorDialog.xfrm"));
			
			if (color == null) {
				color = new EditorHighlightColor(true);
			}
			Color = color;
			
			boldBox   = (CheckBox)ControlDictionary["boldBox"];
			italicBox = (CheckBox)ControlDictionary["italicBox"];
			
			foreNo   = (RadioButton)ControlDictionary["foreNo"];
			foreUser = (RadioButton)ControlDictionary["foreUser"];
			foreSys  = (RadioButton)ControlDictionary["foreSys"];
			foreList = (ComboBox)ControlDictionary["foreList"];
			
			backNo   = (RadioButton)ControlDictionary["backNo"];
			backUser = (RadioButton)ControlDictionary["backUser"];
			backSys  = (RadioButton)ControlDictionary["backSys"];
			backList = (ComboBox)ControlDictionary["backList"];
			
			acceptBtn = (Button)ControlDictionary["acceptBtn"];
			
			this.foreBtn = new ColorButton();
			this.foreBtn.CenterColor = System.Drawing.Color.Empty;
			this.foreBtn.Enabled = false;
			this.foreBtn.Location = new System.Drawing.Point(30, 78);
			this.foreBtn.Name = "foreBtn";
			this.foreBtn.Size = new System.Drawing.Size(98, 24);
			
			this.ControlDictionary["foreBox"].Controls.Add(foreBtn);
			
			this.backBtn = new ColorButton();
			this.backBtn.CenterColor = System.Drawing.Color.Empty;
			this.backBtn.Enabled = false;
			this.backBtn.Location = new System.Drawing.Point(30, 78);
			this.backBtn.Name = "backBtn";
			this.backBtn.Size = new System.Drawing.Size(98, 24);
			
			this.ControlDictionary["backBox"].Controls.Add(backBtn);

			this.acceptBtn.Click += new EventHandler(AcceptClick);
			this.foreNo.CheckedChanged   += new EventHandler(foreCheck);
			this.foreSys.CheckedChanged  += new EventHandler(foreCheck);
			this.foreUser.CheckedChanged += new EventHandler(foreCheck);
			this.backNo.CheckedChanged   += new EventHandler(backCheck);
			this.backSys.CheckedChanged  += new EventHandler(backCheck);
			this.backUser.CheckedChanged += new EventHandler(backCheck);
			
			PropertyInfo[] names = typeof(System.Drawing.SystemColors).GetProperties(BindingFlags.Static | BindingFlags.Public);
			
			foreach(PropertyInfo info in names) {
				foreList.Items.Add(info.Name);
				backList.Items.Add(info.Name);
			}
			foreList.SelectedIndex = backList.SelectedIndex = 0;
			
			if (color.SysForeColor) {
				foreSys.Checked = true;
				for (int i = 0; i < foreList.Items.Count; ++i) {
					if ((string)foreList.Items[i] == color.SysForeColorName) foreList.SelectedIndex = i;
				}
			} else if (color.HasForeColor) {
				foreUser.Checked = true;
				foreBtn.CenterColor = color.ForeColor;
			} else {
				foreNo.Checked = true;
			}
			
			if (color.SysBackColor) {
				backSys.Checked = true;
				for (int i = 0; i < backList.Items.Count; ++i) {
					if ((string)backList.Items[i] == color.SysForeColorName) backList.SelectedIndex = i;
				}
			} else if (color.HasBackColor) {
				backUser.Checked = true;
				backBtn.CenterColor = color.BackColor;
			} else {
				backNo.Checked = true;
			}
			
			boldBox.Checked = color.Bold;
			italicBox.Checked = color.Italic;
		}