public static void BookmarkChangeNeeded(string feature, FastColoredTextBox fctbCurrentFirmware, FastColoredTextBox fctbNewFirmware)
        {
            // Get the last occurance for the feature in current firmware
            int    currentrow   = GetFirmwareFeatureRow(fctbCurrentFirmware, feature);
            string currentValue = GetFirmwareFeatureValue(fctbCurrentFirmware, feature);
            string currentLine  = fctbCurrentFirmware.GetLineText(currentrow).Trim();

            // Get the last occurance for the feature in new firmware
            int    newrow   = GetFirmwareFeatureRow(fctbNewFirmware, feature);
            string newValue = GetFirmwareFeatureValue(fctbNewFirmware, feature);
            string newLine  = fctbNewFirmware.GetLineText(newrow).Trim();


            if ((newrow == 0) | currentValue != newValue)
            {
                fctbCurrentFirmware.BookmarkLine(currentrow);
                return;
            }

            //if (currentLine.StartsWith("//") && !newLine.StartsWith("//"))
            //{
            //    fctbCurrentFirmware.BookmarkLine(currentrow);
            //    return;
            //}
            //if (!currentLine.StartsWith("//") && newLine.StartsWith("//"))
            //{
            //    fctbCurrentFirmware.BookmarkLine(currentrow);
            //    return;
            //}


            fctbCurrentFirmware.UnbookmarkLine(currentrow);
        }
Exemple #2
0
        /// <summary>
        /// Добавление новой вкладки для редактора запросов.
        /// </summary>
        /// <param name="indexError"></param>
        public void TabControlPageAdd(int indexError)
        {
            string fileName  = Errors[indexError, 1];
            int    indexPage = GetTabIndexByTagValue(fileName);

            if (indexPage > 0)
            {
                return;
            }

            string Code;
            int    LinesCount;
            string FileNameFull = Errors[indexError, 4];

            if (FileNameFull == null)
            {
                return;
            }
            if (!FBAFile.FileReadText(FileNameFull, true, out Code, out LinesCount))
            {
                return;
            }
            tabControl1.TabPages.Add(fileName);
            indexPage = tabControl1.TabPages.Count - 1;
            System.Windows.Forms.TabPage tb = tabControl1.TabPages[indexPage];
            tb.Tag = fileName;
            var fctb1 = new FastColoredTextBox();

            tb.Controls.Add(fctb1);
            fctb1.Text = Code;
            fctb1.Dock = TextBoxCode.Dock;
            fctb1.AutoCompleteBrackets      = TextBoxCode.AutoCompleteBrackets;
            fctb1.AutoScrollMinSize         = TextBoxCode.AutoScrollMinSize;
            fctb1.BookmarkColor             = TextBoxCode.BookmarkColor;
            fctb1.BracketsHighlightStrategy = TextBoxCode.BracketsHighlightStrategy;
            fctb1.Cursor        = TextBoxCode.Cursor;
            fctb1.DisabledColor = TextBoxCode.DisabledColor;
            fctb1.FindEndOfFoldingBlockStrategy = TextBoxCode.FindEndOfFoldingBlockStrategy;
            fctb1.Font         = TextBoxCode.Font;
            fctb1.Language     = TextBoxCode.Language;
            fctb1.LeftBracket  = TextBoxCode.LeftBracket;
            fctb1.RightBracket = TextBoxCode.RightBracket;
            //fctb1.Padding                       = TextBoxCode.Padding;
            fctb1.SelectionColor   = Color.Red;             //TextBoxCode.SelectionColor;
            fctb1.VirtualSpace     = TextBoxCode.VirtualSpace;
            fctb1.Name             = "textCode" + indexPage;
            fctb1.BackColor        = TextBoxCode.BackColor;
            fctb1.CurrentLineColor = TextBoxCode.CurrentLineColor;
            fctb1.VirtualSpace     = TextBoxCode.VirtualSpace;
            fctb1.BorderStyle      = TextBoxCode.BorderStyle;
            fctb1.ReadOnly         = true;

            int firstbookmark = 0;
            int countError    = 0;

            for (int i = 0; i < countPage; i++)
            {
                if (Errors[i, 1] != fileName)
                {
                    continue;
                }
                countError++;
                int N = Errors[i, 2].ToInt(false);
                if (firstbookmark == 0)
                {
                    firstbookmark = N;
                }
                fctb1.BookmarkLine(N - 1);
                fctb1.Navigate(N - 1);
                fctb1.CurrentLineColor = Color.Red;
                tb.Text = fileName + " (" + countError + ")";
            }
            SetCurrentBookmarkForFileName(fileName, firstbookmark);
            fctb1.Navigate(firstbookmark);
        }