Пример #1
0
 protected internal FindReplace(Scintilla scintilla)
     : base(scintilla)
 {
     _marker = scintilla.Markers[10];
     _marker.SetSymbolInternal(MarkerSymbol.Arrows);
     _indicator = scintilla.Indicators[16];
     _indicator.Color = Color.Purple;
     _indicator.Style = IndicatorStyle.RoundBox;
 }
Пример #2
0
 public Line FindNextMarker(Marker marker)
 {
     return FindNextMarker(NextLine(), (uint)marker.Number);
 }
Пример #3
0
 public void DeleteInstance(int line, Marker marker)
 {
     DeleteInstance(line, marker.Number);
 }
Пример #4
0
 public void DeleteAll(Marker marker)
 {
     NativeScintilla.MarkerDeleteAll(marker.Number);
 }
Пример #5
0
 public Line FindPreviousMarker(int line, Marker marker)
 {
     return FindPreviousMarker(line, (uint)marker.Number);
 }
Пример #6
0
 public Line FindPreviousMarker(Marker marker)
 {
     return FindPreviousMarker(PrevLine(), (uint)marker.Number);
 }
Пример #7
0
 public Line FindNextMarker(int line, Marker marker)
 {
     return FindNextMarker(line, (uint)marker.Number);
 }
Пример #8
0
        private void schemaTreeView1_OnSelectItem(string ObjectFullName)
        {
            txtNewObject.IsReadOnly = false;
            txtOldObject.IsReadOnly = false;
            txtNewObject.Text = "";
            txtOldObject.Text = "";

            Database database = (Database) schemaTreeView1.DatabaseSource;
            if (database.Find(ObjectFullName) != null)
            {
                if (database.Find(ObjectFullName).Status != Enums.ObjectStatusType.DropStatus)
                {
                    txtNewObject.Text = database.Find(ObjectFullName).ToSql();
                    if (database.Find(ObjectFullName).Status == Enums.ObjectStatusType.OriginalStatus)
                    {
                        btnUpdate.Enabled = false;
                    }
                    else {
                        btnUpdate.Enabled = true;
                    }
                    if (database.Find(ObjectFullName).ObjectType == Enums.ObjectType.Table)
                    {
                        btnCompareTableData.Enabled = true;
                    }
                    else {
                        btnCompareTableData.Enabled = false;
                    }
                }
            }

            database = (Database) schemaTreeView1.DatabaseDestination;
            if (database.Find(ObjectFullName) != null)
            {
                if (database.Find(ObjectFullName).Status != Enums.ObjectStatusType.CreateStatus)
                    txtOldObject.Text = database.Find(ObjectFullName).ToSql();
            }
            txtNewObject.IsReadOnly = true;
            txtOldObject.IsReadOnly = true;

            var diff = (new SideBySideDiffBuilder(new Differ())).BuildDiffModel(txtOldObject.Text, txtNewObject.Text);

            var sb = new StringBuilder();
            DiffPiece newLine, oldLine;
            var markers = new Marker[] { txtDiff.Markers[0], txtDiff.Markers[1], txtDiff.Markers[2], txtDiff.Markers[3] };
            foreach(var marker in markers) marker.Symbol = MarkerSymbol.Background;
            markers[0].BackColor = Color.LightGreen;
            markers[1].BackColor = Color.LightCyan;
            markers[2].BackColor = Color.LightSalmon;
            markers[3].BackColor = Color.PeachPuff;

            var indexes = new List<int>[] { new List<int>(), new List<int>(), new List<int>(), new List<int>() };
            var index = 0;
            for (var i = 0; i < Math.Max(diff.NewText.Lines.Count, diff.OldText.Lines.Count); i++)
            {
                newLine = i < diff.NewText.Lines.Count ? diff.NewText.Lines[i] : null;
                oldLine = i < diff.OldText.Lines.Count ? diff.OldText.Lines[i] : null;
                if (oldLine.Type == ChangeType.Inserted)
                {
                    sb.AppendLine(" " + oldLine.Text);
                }
                else if (oldLine.Type == ChangeType.Deleted)
                {
                    sb.AppendLine("- " + oldLine.Text);
                    indexes[2].Add(index);
                }
                else if (oldLine.Type == ChangeType.Modified)
                {
                    sb.AppendLine("* " + newLine.Text);
                    indexes[1].Add(index++);
                    sb.AppendLine("* " + oldLine.Text);
                    indexes[3].Add(index);
                }
                else if (oldLine.Type == ChangeType.Imaginary)
                {
                    sb.AppendLine("+ " + newLine.Text);
                    indexes[0].Add(index);
                }
                else if (oldLine.Type == ChangeType.Unchanged)
                {
                    sb.AppendLine("  " + oldLine.Text);
                }
                index++;
            }
            txtDiff.Text = sb.ToString();
            for (var i = 0; i < 4;i++ )
            {
                foreach(var ind in indexes[i])
                {
                    txtDiff.Lines[ind].AddMarker(markers[i]);
                }
            }
        }
Пример #9
0
 public Line DeleteMarker(Marker marker)
 {
     NativeScintilla.MarkerDelete(_number, marker.Number);
     return this;
 }
Пример #10
0
 public MarkerInstance AddMarker(Marker marker)
 {
     return new MarkerInstance(Scintilla, marker, NativeScintilla.MarkerAdd(_number, marker.Number));
 }
Пример #11
0
 public Line FindPreviousMarker(Marker marker)
 {
     return FindPreviousMarker(marker.Mask);
 }
Пример #12
0
 public Line FindNextMarker(Marker marker)
 {
     return FindNextMarker(marker.Mask);
 }
Пример #13
0
        internal FindReplace(Scintilla scintilla) : base(scintilla) 
        {
            _marker = scintilla.Markers[10];
            _marker.SetSymbolInternal(MarkerSymbol.Arrows);
            _indicator = scintilla.Indicators[16];
            _indicator.Color = Color.Purple;
            _indicator.Style = IndicatorStyle.RoundBox;

            _window = new FindReplaceDialog();
            _window.Scintilla = scintilla;

            _incrementalSearcher = new IncrementalSearcher();
            _incrementalSearcher.Scintilla = scintilla;
            _incrementalSearcher.Visible = false;
            scintilla.Controls.Add(_incrementalSearcher);
        }
Пример #14
0
 internal MarkerInstance(Scintilla scintilla, Marker marker, int handle) : base(scintilla)
 {
     _marker = marker;
     _handle = handle;
 }