//更新预览标签.
        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);
        }
Exemple #2
0
        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;
        }
Exemple #3
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);
         }
     }
 }
 void chgEndClick(object sender, EventArgs e)
 {
     using (EditHighlightingColorDialog dlg = new EditHighlightingColorDialog(endColor)) {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             endColor = dlg.Color;
             PreviewUpdate(samEnd, endColor);
         }
     }
 }
        public override void LoadSettings()
        {
            DigitsNode node = (DigitsNode)parentNode;

            IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties()));

            sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString()));
            color            = node.HighlightColor;
            PreviewUpdate(sampleLabel, color);
        }
Exemple #6
0
        public override void LoadSettings()
        {
            MarkerNode node = (MarkerNode)parentNode;

            PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
            IProperties     properties      = ((IProperties)propertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties()));

            sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString()));

            color            = node.HighlightColor;
            nameBox.Text     = node.What;
            checkBox.Checked = node.MarkMarker;
            PreviewUpdate(sampleLabel, color);
        }
        public override void LoadSettings()
        {
            SpanNode node = (SpanNode)parentNode;

            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 {}

            IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties()));

            samBegin.Font = samEnd.Font = samCont.Font = FontContainer.DefaultFont;

            nameBox.Text       = node.Name;
            ruleBox.Text       = node.Rule;
            beginBox.Text      = node.Begin;
            endBox.Text        = node.End;
            stopEolBox.Checked = node.StopEOL;
            noEscBox.Checked   = node.NoEscapeSequences;

            color      = node.HighlightColor;
            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);
        }
            public EnvironmentItem(int index, string name, EditorHighlightColor color, Font listFont) : base(new string[] { name, "Sample" })
            {
                Name       = name;
                Color      = color;
                arrayIndex = index;

                this.UseItemStyleForSubItems = false;

                IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties()));

                basefont = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString()));
                listfont = listFont;

                ColorUpdate();
            }
Exemple #9
0
        public override void LoadSettings()
        {
            KeywordListNode node = (KeywordListNode)parentNode;

            listBox.Items.Clear();

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

            IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties()));

            sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString()));

            color        = node.HighlightColor;
            nameBox.Text = node.Name;
            PreviewUpdate(sampleLabel, color);
        }
Exemple #10
0
        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;
        }