jacobslusser / ScintillaNET

A Windows Forms control, wrapper, and bindings for the Scintilla text editor.
MIT License
967 stars 245 forks source link

How to customize Scintilla for Progress? #356

Closed Ravi-Shinde closed 6 years ago

Ravi-Shinde commented 7 years ago

I am trying to add features for Progress in ScintillaNET. I have made following changes in forked repository.

  1. File updated: $\src\ScintillaNET\Lexer.cs

Added new element in Lexer enum as

Progress = NativeMethods.SCLEX_PROGRESS

  1. File updated: $\src\ScintillaNET\NativeMethods.cs

Added following entries for Progress

// Progress public const int SCE_4GL_DEFAULT = 0; public const int SCE_4GL_COMMENT1 = 1; public const int SCE_4GL_WORD = 2; public const int SCE_4GL_NUMBER = 3; public const int SCE_4GL_STRING = 4; public const int SCE_4GL_OPERATOR = 5;

  1. File updated: $\src\ScintillaNET\Style.cs

Added a new class for Progress in Style.cs

public static class Progress { ///

/// Content style index. /// public const int Default = NativeMethods.SCE_4GL_DEFAULT;

/// <summary>
/// Number style index.
/// </summary>
public const int Number = NativeMethods.SCE_4GL_NUMBER;

/// <summary>
/// Keyword style index.
/// </summary>
public const int Word = NativeMethods.SCE_4GL_WORD;

/// <summary>
/// Single-quoted string style index.
/// </summary>
public const int SingleString = NativeMethods.SCE_4GL_STRING;

/// <summary>
/// Comment style index.
/// </summary>
public const int Comment = NativeMethods.SCE_4GL_COMMENT1;

/// <summary>
/// Operator style index.
/// </summary>
public const int Operator = NativeMethods.SCE_4GL_OPERATOR;

}

I am using the updated ScintillaNET's Progress class as following in my application

ScintillaNET.Scintilla TextArea = new ScintillaNET.Scintilla();

TextArea.Styles[Style.Progress.Comment].ForeColor = Color.DarkGreen; TextArea.Styles[Style.Progress.SingleString].ForeColor = Color.Red; TextArea.Styles[Style.Progress.Number].ForeColor = Color.Navy; TextArea.Styles[Style.Progress.Word].ForeColor = Color.Blue; TextArea.Styles[Style.Progress.Operator].ForeColor = Color.DarkCyan;

TextArea.Lexer = Lexer.Progress; TextArea.SetKeywords(0, "FOR EACH NO-LOCK WHERE IF ENDIF END THEN TRUE AND CREATE ELSE else elseif display BUFFER");

The color is applied for SingleString and Number only, Not for Word, operator, and Comment.

It seems previous version supports for own xml configuration files, does new version support that functionality? because i want to add code snippets to ScintillaNET editor from xml.

http://scintillanet.codeplex.com/wikipage?title=HowToCustomConfig&referringTitle=Documentation

Please let me know How can I customize Scintilla for Progress?

jacobslusser commented 7 years ago

The version history for Scintilla suggests that the Progress lexer was replaced with another one in v3.7.0. ScintillaNET is currently up to native v3.7.2.

Should you be using that new lexer instead?

http://www.scintilla.org/ScintillaHistory.html

Ravi-Shinde commented 7 years ago

I have updated code as per the suggestion

I) File updated: $\src\ScintillaNET\NativeMethods.cs Updated entries for Progress as follows // Progress public const int SCE_ABL_DEFAULT = 0; public const int SCE_ABL_NUMBER = 1; public const int SCE_ABL_WORD = 2; public const int SCE_ABL_STRING = 3; public const int SCE_ABL_CHARACTER = 4; public const int SCE_ABL_PREPROCESSOR = 5; public const int SCE_ABL_OPERATOR = 6; public const int SCE_ABL_IDENTIFIER = 7; public const int SCE_ABL_BLOCK = 8; public const int SCE_ABL_END = 9; public const int SCE_ABL_COMMENT = 10; public const int SCE_ABL_TASKMARKER = 11; public const int SCE_ABL_LINECOMMENT = 12;

II) File updated: $\src\ScintillaNET\Style.cs Added a new class for Progress in Style.cs public static class Progress { ///

/// Content style index. /// public const int Default = NativeMethods.SCE_ABL_DEFAULT;

 /// <summary>
 /// Number style index.
 /// </summary>
 public const int Number = NativeMethods.SCE_ABL_NUMBER;
 ........
 ........
 ........

}

III) File updated: $\src\ScintillaNET\Lexer.cs Tried with both(SCLEX_PROGRESS and SCLEX_ABL) element in Lexer enum as

Progress = NativeMethods.SCLEX_PROGRESS / Progress = NativeMethods.SCLEX_ABL

but still facing same issue i.e style not applied for Keywords. And also the fold is working for multiline comments only not for code blocks

I am setting foldSyntaxBased property to true.

is there any demo for progress?

jacobslusser commented 6 years ago

I'm closing this for now but we can reopen if necessary.