Class TNppPlugin

Unit

Declaration

type TNppPlugin = class(TObject)

Description

Default plugin implementation

Hierarchy

Overview

Fields

Protected PluginName: nppString;
Protected FuncArray: array of _TFuncItem;
Public NppData: TNppData;

Methods

Public constructor Create;
Public destructor Destroy; override;
Public function CmdIdFromDlgId(DlgId: Integer): Integer;
Public function DoOpen(filename: String): Boolean; overload;
Public function DoOpen(filename: String; Line: Sci_Position): Boolean; overload;
Public function GetCurrentBufferPath(const BufferID: NativeUInt = 0): nppString;
Public function GetCurrentFileExt(const BufferID: NativeUInt = 0): nppString;
Public function GetFuncsArray(var FuncsCount: Integer): Pointer;
Public function GetName: nppPChar;
Public function GetWord: nppString;
Public function IsDarkModeEnabled: Boolean;
Protected function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD): Integer; overload;
Protected function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD; ShortcutKey: PShortcutKey): Integer; overload;
Protected function GetApiLevel: TSciApiLevel;
Protected function GetNppVersion: Cardinal;
Protected function GetPluginsConfigDir: nppString;
Protected function HasFullRangeApis: Boolean;
Protected function HasMinimalReplacementApi: Boolean;
Protected function HasV5Apis: Boolean;
Protected function MakeShortcutKey(const Ctrl, Alt, Shift: Boolean; const AKey: UCHAR) : PShortcutKey;
Protected function SendNppMessage(Msg: Cardinal; _WParam: NativeUInt = 0; _LParam: NativeInt = 0): LRESULT; overload;
Protected function SendNppMessage(Msg: Cardinal; _WParam: NativeUInt; APParam: Pointer = nil): LRESULT; overload;
Protected function SupportsBigFiles: Boolean;
Protected function SupportsDarkMode: Boolean;
Protected function SupportsDarkModeSubclassing: Boolean;
Public procedure BeforeDestruction; override;
Public procedure BeNotified(sn: PSciNotification); virtual;
Public procedure DoModified(const hwnd: HWND; const modificationType: Integer); virtual;
Public procedure DoNppnBufferActivated(const BufferID: NativeUInt); virtual;
Public procedure DoNppnFileClosed(const BufferID: NativeUInt); virtual;
Public procedure DoNppnShutdown; virtual;
Public procedure DoNppnToolbarModification; virtual;
Public procedure DoUpdateUI(const hwnd: HWND; const updated: Integer); virtual;
Public procedure GetDarkModeColors(PColors: PDarkModeColors);
Public procedure GetFileLine(var filename: String; var Line: Sci_Position);
Public procedure MessageProc(var Msg: TMessage); virtual;
Public procedure SetInfo(NppData: TNppData); virtual;

Properties

Public property CanSubclass: Boolean read SupportsDarkModeSubclassing;
Public property CurrentScintilla: HWND read GetCurrentScintilla;

Description

Fields

Protected PluginName: nppString;

This item has no description.

Protected FuncArray: array of _TFuncItem;

Manager of _TFuncItem objects

Public NppData: TNppData;

This item has no description.

Methods

Public constructor Create;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public function CmdIdFromDlgId(DlgId: Integer): Integer;

This item has no description.

Public function DoOpen(filename: String): Boolean; overload;

This item has no description.

Public function DoOpen(filename: String; Line: Sci_Position): Boolean; overload;

This item has no description.

Public function GetCurrentBufferPath(const BufferID: NativeUInt = 0): nppString;

This item has no description.

Public function GetCurrentFileExt(const BufferID: NativeUInt = 0): nppString;

This item has no description.

Public function GetFuncsArray(var FuncsCount: Integer): Pointer;

Exposes the FuncArray member to DLLExports.getFuncsArray

Public function GetName: nppPChar;

Exposes the PluginName member to DLLExports.getName

Public function GetWord: nppString;

This item has no description.

Public function IsDarkModeEnabled: Boolean;

Returns true if the dark mode setting can be detected by sending the NPPM_ISDARKMODEENABLED message

Since 8.4.1

Protected function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD): Integer; overload;

Initializes a plugin command with no keyboard shortcut.

Returns the new size of this plugin's FuncArray.

Parameters
Name [in]
the command name that you want to see in the plugin menu
Func [in]
a pointer of type PFUNCPLUGINCMD
Protected function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD; ShortcutKey: PShortcutKey): Integer; overload;

Initializes a plugin command with a keyboard shortcut.

Parameters
Name [in]
same as AddFuncItem(nppString, PFUNCPLUGINCMD)
Func [in]
...
ShortcutKey [in]
a pointer to a TShortcutKey
Protected function GetApiLevel: TSciApiLevel;

This item has no description.

Protected function GetNppVersion: Cardinal;

This item has no description.

Protected function GetPluginsConfigDir: nppString;

This item has no description.

Protected function HasFullRangeApis: Boolean;

Returns true if the 64-bit APIs added in Scintilla 5.2.3 are available

Since 8.4.3

Protected function HasMinimalReplacementApi: Boolean;

Returns true if the SCI_REPLACETARGETMINIMAL and SCI_GETSTYLEDTEXTFULL APIs added in Scintilla 5.3.2 are available

Since 8.4.8

Protected function HasV5Apis: Boolean;

Returns true if the current Notepad++ version is >= 8.4 (the first to use a v5 Scintilla library)

Note
See https://www.scintilla.org/ScintillaHistory.html ยง 5.1.5

 {
   When calling SCI_GETTEXT, SCI_GETSELTEXT, and SCI_GETCURLINE with a NULL
   buffer argument to discover the length that should be allocated, do not
   include the terminating NUL in the returned value. The value returned is 1
   less than previous versions of Scintilla. Applications should allocate a
   buffer 1 more than this to accommodate the NUL. The wParam (length)
   argument to SCI_GETTEXT and SCI_GETCURLINE also omits the NUL
 }

Since 8.4

Protected function MakeShortcutKey(const Ctrl, Alt, Shift: Boolean; const AKey: UCHAR) : PShortcutKey;

This item has no description.

Protected function SendNppMessage(Msg: Cardinal; _WParam: NativeUInt = 0; _LParam: NativeInt = 0): LRESULT; overload;

Sends a plugin API message to the Notepad++ window

Protected function SendNppMessage(Msg: Cardinal; _WParam: NativeUInt; APParam: Pointer = nil): LRESULT; overload;

Sends a plugin API message to the Notepad++ window when the LPARAM is a pointer

Protected function SupportsBigFiles: Boolean;

Returns true if x64 editors return 64-bit character and line positions, i.e., sizeof(Sci_Position) == sizeof(NativeInt), and sizeof(Sci_PositionU) == sizeof(NativeUInt)

Since 8.3

Protected function SupportsDarkMode: Boolean;

Returns true if the NPPM_ADDTOOLBARICON_FORDARKMODE message is defined

Since 8.0

Protected function SupportsDarkModeSubclassing: Boolean;

Returns true if the NPPM_DARKMODESUBCLASSANDTHEME API is available

Since 8.5.4

Public procedure BeforeDestruction; override;

This item has no description.

Public procedure BeNotified(sn: PSciNotification); virtual;

Performs plugin-specific logic when DLLExports.beNotified executes

Public procedure DoModified(const hwnd: HWND; const modificationType: Integer); virtual;

Empty, customizable handler for the SCN_MODIFIED notification

Public procedure DoNppnBufferActivated(const BufferID: NativeUInt); virtual;

Empty, customizable handler for the NPPN_BUFFERACTIVATED notification

Public procedure DoNppnFileClosed(const BufferID: NativeUInt); virtual;

Empty, customizable handler for the NPPN_FILECLOSED notification

Public procedure DoNppnShutdown; virtual;

Empty, customizable handler for the NPPN_SHUTDOWN notification

Public procedure DoNppnToolbarModification; virtual;

Empty, customizable handler for the NPPN_TBMODIFICATION notification

Public procedure DoUpdateUI(const hwnd: HWND; const updated: Integer); virtual;

Empty, customizable handler for the SCN_UPDATEUI notification

Public procedure GetDarkModeColors(PColors: PDarkModeColors);

Initializes a TDarkModeColors instance with the editor's active dark mode styles

Since 8.4.1

Public procedure GetFileLine(var filename: String; var Line: Sci_Position);

This item has no description.

Public procedure MessageProc(var Msg: TMessage); virtual;

Performs plugin-specific logic when DLLExports.messageProc executes

Public procedure SetInfo(NppData: TNppData); virtual;

Performs plugin-specific logic when DLLExports.setInfo executes

Properties

Public property CanSubclass: Boolean read SupportsDarkModeSubclassing;

This item has no description.

Public property CurrentScintilla: HWND read GetCurrentScintilla;

This item has no description.