コード例 #1
0
        public FormNotepad()
        {
            InitializeComponent();

            // initialization
            _defaultPath = Directory.GetCurrentDirectory();
            _openConfigFile = _defaultPath + @"\cfg\default_cfg.xml";
            _openLogFile = null;

            // start focus on tree so that open
            //IMPEMENT FOCUS IN TREE SO THAT FIRST BUTTON DONT LOOK GAY

            // Loads ToolTips
            InitializeTooltip();

            // Event Load Background Worker Initialization
            InitializeEventsLoadBackGroundWorker();

            // Initialize TextBox
            InitializeFastColoredTextBox();

            // Initialize TextBox SintaxHighLight
            InitializeSintraxHighlight();

            // store form header text
            _originalFormHeaderText = base.Text;

            // initialize find
            InitializeFindVariables();

            // set the default line = to a line that does not exists
            _selectedNode = null;

            // initialize bookmark color
            _bookmarkColor = Color.DarkRed;

            // set the object that contains tree nodes to null
            _siebelTreeView = null;
        }
コード例 #2
0
        /// <summary>
        /// Find Next Position
        /// </summary>
        private void FindNextInTree(SiebelTreeNode tns, int iPos, string value, Color clr)
        {
            while (true)
            {
                if (FindAuxiliarInTree(tns, iPos, value, clr)) return;

                // go to parent if nothing to do
                if (tns.Parent != null)
                {
                    tns = (SiebelTreeNode)tns.Parent;

                    // remove before going to parent
                    _findedSiebelNodePos.RemoveAt(_findedSiebelNodePos.Count - 1);

                    // add one position so that it will start in the next position
                    _findedSiebelNodePos[_findedSiebelNodePos.Count - 1] = _findedSiebelNodePos[_findedSiebelNodePos.Count - 1] + 1;

                    iPos = _findedSiebelNodePos[_findedSiebelNodePos.Count - 1];
                }
                else
                {
                    _findedSiebelTreeNode = null;

                    // move to first position
                    FindFirstInTree(value, clr);

                    return;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Sub method used used in MoveToFirstFind and FindFromPrevious
        /// </summary>
        private bool FindAuxiliarInTree(SiebelTreeNode tns, int iPos, string value, Color clr)
        {
            for (int i = iPos; i < tns.Nodes.Count; i++)
            {
                // move position
                if (_findedSiebelNodePos.Count > 0)
                    _findedSiebelNodePos[_findedSiebelNodePos.Count - 1] = i;

                SiebelTreeNode tn = (SiebelTreeNode)tns.Nodes[i];

                if (tn.Text.Contains(value))
                {
                    tn.EnsureVisible();
                    tn.BackColor = clr;

                    _findedSiebelNodePos[_findedSiebelNodePos.Count - 1] = i + 1; // move one caracter forward
                    _findedSiebelTreeNode = tns;

                    return true;
                }

                // if no nodes, just continue
                if (tn.Nodes.Count == 0) continue;

                // add current branch to list
                _findedSiebelNodePos.Add(i);

                // if this branch is the one leave
                if (FindAuxiliarInTree(tn, 0, value, clr)) return true;

                // if not the one remove the node position
                _findedSiebelNodePos.RemoveAt(_findedSiebelNodePos.Count - 1);
            }

            return false;
        }
コード例 #4
0
        /// <summary>
        ///  Travels tree branchs to add color to nodes that contains the search text
        /// </summary>
        private static void MarkTreeNode(SiebelTreeNode stn, string value, Color clr)
        {
            foreach (SiebelTreeNode tn in stn.Nodes)
            {
                // if the text properties match, color the item
                if (tn.Text.Contains(value)) tn.BackColor = clr;

                MarkTreeNode(tn, value, clr);
            }
        }
コード例 #5
0
        /// <summary>
        /// Initialize find variables
        /// </summary>
        public void InitializeFindVariables()
        {
            // find next in tree initialization
            _findedSiebelTreeNode = null;
            _findedSiebelNodePos = new List<int>();

            // find next in textbox initialization
            _findedInTextBox = new List<int>();
            _findedInTextBoxPos = 0;
            _findedInTextBoxValue = string.Empty;
        }
コード例 #6
0
        // node mouse click
        private void treeViewSiebelTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            SiebelTreeNode stn = (SiebelTreeNode)e.Node;

            if (stn == null || stn.EventData == null || stn.EventData.Line <= 0) return;

            _selectedNode = stn;
        }