The Ynote API can be used for Scripting and for writing Plugins. For more information on these see Ynote Plugins and Ynote Scripts. All .NET 3.5 classes are supported for scripting / plugins.

More Information -

The IYnote Object.

The IYnote object represents ynote when the script is called / plugin is loaded. It has the following members / methods -

  • OpenFile (string name) : void -> Open's a file
  • SaveEditor (Editor edit) : void -> Saves a typeof Editor
  • CreateNewDoc() : void - Creates a New Document
  • Menu : The MainMenu of the Application.
  • Panel : DockPanel - The DockPanel Control of Ynote

Important Classes

  • Editor - The Form which contains the edit control. Has the following members - 
    • Tb - The TextBox (FastColoredTextBox) control on the Editor
    • Highlighter - Inbuilt Syntax Highlighter(class SyntaxHighlighter.cs) for Inbuilt Languages.
      • HighlightSyntax(Language, e*) : Highlights the Syntax for specified language.
      • HighlightSyntax(SyntaxBase, e*) : Highlights the Syntax for the Base.
      • LoadedSyntaxes : gets the list of syntaxbases loaded from files (Syntaxes\ directory)
    • IsSaved - Tells whether the document has been saved or not

 

  • SyntaxBase - The Syntax Base.
    • IsBase - Whether the document's syntax is loaded from file
    • Language - The Language if IsBase is false / Editor.Tb.Language
    • SyntaxBase - The Syntax Base of the File if IsBase is True. Syntax Base is loaded from a file
  • Commander - The Ynote Commander.

* e is TextChangedEventArgs. Use as new TextChangedEventArgs(Editor.Tb.Range);

Example code

1. Show a Editor

var edit = new Editor();

edit.Show(ynote.Panel, DockState.Document);

2. Get the Active Document

if ( ynote.Panel.ActiveDocument is Editor)

{

     return ynote.Panel.ActiveDocument as Editor;

}

3. Main Menu Items. See HelloPlugin in ynotesamples.

public enum YnoteMenu
    {
        FileMenu = 0,
        EditMenu = 1,
        ViewMenu = 2,
        ToolsMenu = 3,
        MacrosMenu = 4
    }
You can add items to these at runtime using ynote.Panel.Menu.MenuItems[YnoteMenu.FileMenu].MenuItems.Add
 

Last edited Apr 21, 2014 at 1:18 PM by samarjeet27, version 1

Comments

No comments yet.