<commit_before>using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Elsehemy;
using SolidEngine;
using System.Collections.Generic;

namespace SolidGui
{
    public partial class SfmEditorView : UserControl
    {

        class MarkerTip: SuperToolTip
        {
            private bool _showing = false;
            private Dictionary<int, string> _lineMessage = new Dictionary<int, string>();
            private Control _textBox;
            
            public MarkerTip(Control textBox, IContainer container):
                base(container)
            {
                _textBox = textBox;
                
                SuperToolTipInfoWrapper wrapper = new SuperToolTipInfoWrapper();
                wrapper.SuperToolTipInfo = CreateSuperInfo();
                wrapper.UseSuperToolTip = true;
                SetSuperStuff(_textBox, wrapper);
            }

            public bool Showing
            {
                get { return _showing; }
            }

            public void AddLineMessage(int line, string message)
            {
                _lineMessage[line] = message;
            }

            public void ShowMessage(string message)
            {

                Point point = MousePosition;
                point.Y += _textBox.Font.Height/2;
                point.X += 4;

                point = _textBox.PointToClient(point);

                GetSuperStuff(_textBox).SuperToolTipInfo.BodyText = message;
                GetSuperStuff(_textBox).SuperToolTipInfo.OffsetForWhereToDisplay = point;

                Show(_textBox);
                _showing = true;
                _textBox.Parent.Focus();
            }

            public SuperToolTipInfo CreateSuperInfo()
            {
                SuperToolTipInfo superToolTipInfo = new SuperToolTipInfo();

                superToolTipInfo.BackgroundGradientBegin = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
                superToolTipInfo.BackgroundGradientEnd = Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(218)))), ((int)(((byte)(239)))));
                superToolTipInfo.BackgroundGradientMiddle = Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(246)))), ((int)(((byte)(251)))));
                superToolTipInfo.BodyFont = new Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                superToolTipInfo.BodyText = "";
                superToolTipInfo.HeaderFont = new Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
                superToolTipInfo.HeaderText = "Problem Description";
                superToolTipInfo.OffsetForWhereToDisplay = new Point(0, 0);

                return superToolTipInfo;
            }

            public void ClearLineMessages()
            {
                _lineMessage.Clear();
            }

            public void ShowMessageForLine(int line)
            {
                if(_lineMessage.ContainsKey(line))
                    ShowMessage(_lineMessage[line]);
                else 
                    Hide();
            }

            public void Hide()
            {
                if (_showing)
                {
                    _showing = false;
                    Close();
                }
            }

            protected override void MouseEntered(object sender, EventArgs e)
            {
                
            }

            protected override void MouseLeft(object sender, EventArgs e)
            {
                
            }
        }

        class KeyScanner
        {
            enum State
            {
                ScanBackslash,
                ScanWhite
            }
            State _state;

            public KeyScanner()
            {
                Reset();
            }

            public void Reset()
            {
                _state = State.ScanBackslash;
            }

            public bool ProcessKey(int c)
            {
                bool retval = false;
                switch (_state)
                {
                    case State.ScanBackslash:
                        if (c == '\\' || c == 220)
                        {
                            _state = State.ScanWhite;
                        }
                        break;
                    case State.ScanWhite:
                        if (c == ' ' || c == 0x09)
                        {
                            retval = true;
                        }
                        break;
                }
                return retval;
            }
        }

        private SfmEditorPM _model;
        private Record _currentRecord;

        private int _spacesInIndentation = 4;
        private int _leftMarigin = 20;
        private Color _inferredTextColor = Color.Blue;
        private Color _errorTextColor = Color.Red;
        private Color _defaultTextColor = Color.Black;
        private int _indent = 130;
        private Font _defaultFont = new Font("Arial", 13);

        private KeyScanner _keyScanner = new KeyScanner();
        //private const string _processingMark = "\x01";
        
        private MarkerTip _markerTip;
        private int _lineNumber = -1;
        private int _markerTipDisplayDelay = 10;

        private bool _isDirty = false;

        public event EventHandler RecordTextChanged;
        
        public int Indent
        {
            get { return _indent; }
            set { _indent = value; }
        }	

        public SfmEditorView()
        {
            _currentRecord = null;
            InitializeComponent();
            _contentsBox.TextChanged -= _contentsBox_TextChanged;
            _contentsBox.SelectionIndent = _leftMarigin;
            _markerTip = new MarkerTip(_contentsBox, components);<commit_msg>Fixed #124 Default font constructor.<commit_after>using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Elsehemy;
using SolidEngine;
using System.Collections.Generic;

namespace SolidGui
{
    public partial class SfmEditorView : UserControl
    {

        class MarkerTip: SuperToolTip
        {
            private bool _showing = false;
            private Dictionary<int, string> _lineMessage = new Dictionary<int, string>();
            private Control _textBox;
            
            public MarkerTip(Control textBox, IContainer container):
                base(container)
            {
                _textBox = textBox;
                
                SuperToolTipInfoWrapper wrapper = new SuperToolTipInfoWrapper();
                wrapper.SuperToolTipInfo = CreateSuperInfo();
                wrapper.UseSuperToolTip = true;
                SetSuperStuff(_textBox, wrapper);
            }

            public bool Showing
            {
                get { return _showing; }
            }

            public void AddLineMessage(int line, string message)
            {
                _lineMessage[line] = message;
            }

            public void ShowMessage(string message)
            {

                Point point = MousePosition;
                point.Y += _textBox.Font.Height/2;
                point.X += 4;

                point = _textBox.PointToClient(point);

                GetSuperStuff(_textBox).SuperToolTipInfo.BodyText = message;
                GetSuperStuff(_textBox).SuperToolTipInfo.OffsetForWhereToDisplay = point;

                Show(_textBox);
                _showing = true;
                _textBox.Parent.Focus();
            }

            public SuperToolTipInfo CreateSuperInfo()
            {
                SuperToolTipInfo superToolTipInfo = new SuperToolTipInfo();

                superToolTipInfo.BackgroundGradientBegin = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
                superToolTipInfo.BackgroundGradientEnd = Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(218)))), ((int)(((byte)(239)))));
                superToolTipInfo.BackgroundGradientMiddle = Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(246)))), ((int)(((byte)(251)))));
                superToolTipInfo.BodyFont = new Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                superToolTipInfo.BodyText = "";
                superToolTipInfo.HeaderFont = new Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold);
                superToolTipInfo.HeaderText = "Problem Description";
                superToolTipInfo.OffsetForWhereToDisplay = new Point(0, 0);

                return superToolTipInfo;
            }

            public void ClearLineMessages()
            {
                _lineMessage.Clear();
            }

            public void ShowMessageForLine(int line)
            {
                if(_lineMessage.ContainsKey(line))
                    ShowMessage(_lineMessage[line]);
                else 
                    Hide();
            }

            public void Hide()
            {
                if (_showing)
                {
                    _showing = false;
                    Close();
                }
            }

            protected override void MouseEntered(object sender, EventArgs e)
            {
                
            }

            protected override void MouseLeft(object sender, EventArgs e)
            {
                
            }
        }

        class KeyScanner
        {
            enum State
            {
                ScanBackslash,
                ScanWhite
            }
            State _state;

            public KeyScanner()
            {
                Reset();
            }

            public void Reset()
            {
                _state = State.ScanBackslash;
            }

            public bool ProcessKey(int c)
            {
                bool retval = false;
                switch (_state)
                {
                    case State.ScanBackslash:
                        if (c == '\\' || c == 220)
                        {
                            _state = State.ScanWhite;
                        }
                        break;
                    case State.ScanWhite:
                        if (c == ' ' || c == 0x09)
                        {
                            retval = true;
                        }
                        break;
                }
                return retval;
            }
        }

        private SfmEditorPM _model;
        private Record _currentRecord;

        private int _spacesInIndentation = 4;
        private int _leftMarigin = 20;
        private Color _inferredTextColor = Color.Blue;
        private Color _errorTextColor = Color.Red;
        private Color _defaultTextColor = Color.Black;
        private int _indent = 130;
        private Font _defaultFont = new Font(FontFamily.GenericSansSerif, 13);

        private KeyScanner _keyScanner = new KeyScanner();
        //private const string _processingMark = "\x01";
        
        private MarkerTip _markerTip;
        private int _lineNumber = -1;
        private int _markerTipDisplayDelay = 10;

        private bool _isDirty = false;

        public event EventHandler RecordTextChanged;
        
        public int Indent
        {
            get { return _indent; }
            set { _indent = value; }
        }	

        public SfmEditorView()
        {
            _currentRecord = null;
            InitializeComponent();
            _contentsBox.TextChanged -= _contentsBox_TextChanged;
            _contentsBox.SelectionIndent = _leftMarigin;
            _markerTip = new MarkerTip(_contentsBox, components);
{'fraction_non_alphanumeric': 0.0856704458272952, 'fraction_numerical': 0.00997357429034183, 'mean_word_length': 1.3629405840886204, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4713355', 'n_tokens_mistral': 2990, 'n_tokens_neox': 2717, 'n_words': 607}