Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/05/15 10:51:29 (10 years ago)
Author:
jkarder
Message:

#2211: merged r11450, r11466, r11483, r11514, r11515 and r11890 into stable
#2234: merged r11308, r11309, r11326, r11337, r11340, r11339, r11342, r11361, r11427, r11447, r11464, r11542, r11544, r11545, r11547, r11548 into stable
#2239: merged r11437, r11439 and r11472 into stable
#2262: merged r11436, r11440, r11471, r11474, r11477, r11479, r11480, r11605, r11657, r11721, r11734, r11735, r11787, r11788, r11789 and r11826 into stable

Location:
stable
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.CodeEditor/3.3/CodeEditor.Designer.cs

    r7967 r11907  
    4646      // textEditor
    4747      //
    48       this.textEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    49                   | System.Windows.Forms.AnchorStyles.Left)
    50                   | System.Windows.Forms.AnchorStyles.Right)));
     48      this.textEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     49            | System.Windows.Forms.AnchorStyles.Left)
     50            | System.Windows.Forms.AnchorStyles.Right)));
    5151      this.textEditor.ConvertTabsToSpaces = true;
    5252      this.textEditor.IndentStyle = ICSharpCode.TextEditor.Document.IndentStyle.Auto;
    5353      this.textEditor.IsIconBarVisible = true;
    5454      this.textEditor.IsReadOnly = false;
     55      this.textEditor.LineViewerStyle = ICSharpCode.TextEditor.Document.LineViewerStyle.FullRow;
    5556      this.textEditor.Location = new System.Drawing.Point(0, 0);
    5657      this.textEditor.Name = "textEditor";
     
    9798      this.sharpDevelopLabel.Text = "powered by #develop";
    9899      this.sharpDevelopLabel.ToolTipText = "Syntax highlighting and code completion facilities provided through #develop libr" +
    99           "aries";
     100    "aries";
    100101      this.sharpDevelopLabel.Click += new System.EventHandler(this.toolStripStatusLabel1_Click);
    101102      //
     
    108109      // CodeEditor
    109110      //
    110       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    111111      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    112112      this.Controls.Add(this.textEditor);
  • stable/HeuristicLab.CodeEditor/3.3/CodeEditor.cs

    r10891 r11907  
    4646
    4747    #region Fields & Properties
     48    private static Color WarningColor = Color.Blue;
     49    private static Color ErrorColor = Color.Red;
    4850
    4951    internal Dom.ProjectContentRegistry projectContentRegistry;
     
    127129      }
    128130      set {
     131        if (Doc.TextContent == value) return;
    129132        Doc.Replace(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length, value);
    130133        Doc.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
     
    133136    }
    134137
     138    public bool ReadOnly {
     139      get { return Doc.ReadOnly; }
     140      set { Doc.ReadOnly = value; }
     141    }
     142
    135143    #endregion
    136144
    137145    public event EventHandler TextEditorValidated;
    138 
    139146    protected void OnTextEditorValidated() {
    140147      if (TextEditorValidated != null)
     
    143150
    144151    public event EventHandler TextEditorTextChanged;
    145 
    146152    protected void OnTextEditorTextChanged() {
    147153      if (TextEditorTextChanged != null)
     
    154160      textEditor.ActiveTextAreaControl.TextEditorProperties.SupportReadOnlySegments = true;
    155161
    156       textEditor.SetHighlighting("C#");
    157       textEditor.ShowEOLMarkers = false;
    158       textEditor.ShowInvalidLines = false;
     162      LoadHighlightingStrategy();
    159163      HostCallbackImplementation.Register(this);
    160164      CodeCompletionKeyHandler.Attach(this, textEditor);
     
    187191        return;
    188192
    189       textEditor.ActiveTextAreaControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(TextArea_KeyEventHandler);
    190       textEditor.ActiveTextAreaControl.TextArea.DoProcessDialogKey += new DialogKeyProcessor(TextArea_DoProcessDialogKey);
    191 
    192       parserThread = new Thread(ParserThread);
    193       parserThread.IsBackground = true;
     193      textEditor.ActiveTextAreaControl.TextArea.KeyEventHandler += TextArea_KeyEventHandler;
     194      textEditor.ActiveTextAreaControl.TextArea.DoProcessDialogKey += TextArea_DoProcessDialogKey;
     195
     196      parserThread = new Thread(ParserThread) { IsBackground = true };
    194197      parserThread.Start();
    195198
    196       textEditor.Validated += (s, a) => { OnTextEditorValidated(); };
    197       textEditor.TextChanged += (s, a) => { OnTextEditorTextChanged(); };
     199      textEditor.Validated += (s, a) => OnTextEditorValidated();
     200      textEditor.TextChanged += (s, a) => {
     201        Doc.MarkerStrategy.RemoveAll(m => errorMarkers.Contains(m)); errorMarkers.Clear();
     202        Doc.BookmarkManager.RemoveMarks(m => errorBookmarks.Contains(m)); errorBookmarks.Clear();
     203        Doc.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
     204        Doc.CommitUpdate();
     205        OnTextEditorTextChanged();
     206      };
    198207      InitializeImageList();
     208    }
     209
     210    private void LoadHighlightingStrategy() {
     211      var strategy = (DefaultHighlightingStrategy)HighlightingManager.Manager.FindHighlighter("C#");
     212      strategy.SetColorFor("CaretMarker", new HighlightColor(Color.Beige, false, false));
     213      Doc.HighlightingStrategy = strategy;
    199214    }
    200215
     
    211226
    212227    #region keyboard handlers: filter input in read-only areas
    213 
    214228    bool TextArea_KeyEventHandler(char ch) {
    215229      int caret = textEditor.ActiveTextAreaControl.Caret.Offset;
     
    227241      return false;
    228242    }
    229 
    230243    #endregion
    231244
     
    235248    }
    236249
     250    public void ScrollToPosition(int line, int column) {
     251      var segment = GetSegmentAtOffset(line, column);
     252      var position = Doc.OffsetToPosition(segment.Offset + segment.Length);
     253      var caret = textEditor.ActiveTextAreaControl.Caret;
     254      caret.Position = position;
     255      textEditor.ActiveTextAreaControl.CenterViewOn(line, 0);
     256    }
     257
    237258    private List<TextMarker> errorMarkers = new List<TextMarker>();
    238259    private List<Bookmark> errorBookmarks = new List<Bookmark>();
    239260    public void ShowCompileErrors(CompilerErrorCollection compilerErrors, string filename) {
    240       Doc.MarkerStrategy.RemoveAll(m => errorMarkers.Contains(m));
    241       Doc.BookmarkManager.RemoveMarks(m => errorBookmarks.Contains(m));
    242       errorMarkers.Clear();
    243       errorBookmarks.Clear();
    244261      errorLabel.Text = "";
    245262      errorLabel.ToolTipText = null;
     
    268285    private void AddErrorMarker(CompilerError error) {
    269286      var segment = GetSegmentAtOffset(error.Line, error.Column);
    270       Color color = error.IsWarning ? Color.Blue : Color.Red;
     287      Color color = error.IsWarning ? WarningColor : ErrorColor;
    271288      var marker = new TextMarker(segment.Offset, segment.Length, TextMarkerType.WaveLine, color) {
    272289        ToolTip = error.ErrorText,
     
    277294
    278295    private void AddErrorBookmark(CompilerError error) {
    279       var bookmark = new ErrorBookmark(Doc, new TextLocation(error.Column, error.Line - 1));
     296      Color color = error.IsWarning ? WarningColor : ErrorColor;
     297      var bookmark = new ErrorBookmark(Doc, new TextLocation(error.Column, error.Line - 1), color);
    280298      errorBookmarks.Add(bookmark);
    281299      Doc.BookmarkManager.AddMark(bookmark);
     
    283301
    284302    private AbstractSegment GetSegmentAtOffset(int lineNr, int columnNr) {
    285       lineNr = Math.Max(Doc.OffsetToPosition(prefix.Length).Line, lineNr);
     303      lineNr = Math.Max(Doc.OffsetToPosition(prefix.Length).Line, lineNr - 1);
    286304      lineNr = Math.Min(Doc.OffsetToPosition(Doc.TextLength - suffix.Length).Line, lineNr);
    287       var line = Doc.GetLineSegment(lineNr - 1);
    288       columnNr = Math.Max(0, columnNr);
     305      var line = Doc.GetLineSegment(lineNr);
     306      columnNr = Math.Max(0, columnNr - 1);
    289307      columnNr = Math.Min(line.Length, columnNr);
    290308      var word = line.GetWord(columnNr);
     
    294312        segment.Length = word.Length;
    295313      } else {
    296         segment.Offset = line.Offset + columnNr - 1;
     314        segment.Offset = line.Offset + columnNr;
    297315        segment.Length = 1;
    298316      }
  • stable/HeuristicLab.CodeEditor/3.3/ErrorBookmark.cs

    r11170 r11907  
    2525namespace HeuristicLab.CodeEditor {
    2626  public class ErrorBookmark : Bookmark {
     27    private readonly Brush brush;
    2728
    2829    public override bool CanToggle { get { return false; } }
    2930
    3031    public ErrorBookmark(IDocument document, TextLocation location)
     32      : this(document, location, Color.Red) { }
     33
     34    public ErrorBookmark(IDocument document, TextLocation location, Color color)
    3135      : base(document, location) {
     36      brush = new SolidBrush(color);
    3237    }
    3338
    34     public override void Draw(IconBarMargin margin, System.Drawing.Graphics g, System.Drawing.Point p) {
     39    public override void Draw(IconBarMargin margin, Graphics g, Point p) {
    3540      int delta = margin.TextArea.TextView.FontHeight / 4;
    3641      Rectangle rect = new Rectangle(
     
    3944        margin.DrawingPosition.Width - 6,
    4045        margin.TextArea.TextView.FontHeight - delta * 2);
    41       g.FillRectangle(Brushes.Red, rect);
     46      g.FillRectangle(brush, rect);
    4247      g.DrawRectangle(Pens.White, rect);
    4348    }
  • stable/HeuristicLab.CodeEditor/3.3/HeuristicLab.CodeEditor-3.3.csproj

    r9203 r11907  
    145145  <ItemGroup>
    146146    <Compile Include="CodeCompletionData.cs" />
    147     <EmbeddedResource Include="CodeEditor.resx">
    148       <DependentUpon>CodeEditor.cs</DependentUpon>
    149     </EmbeddedResource>
    150147    <EmbeddedResource Include="CodeViewer.resx">
    151148      <DependentUpon>CodeViewer.cs</DependentUpon>
Note: See TracChangeset for help on using the changeset viewer.