Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit cd0cea4

Browse files
committed
Merge branch 'basic-improvements-after-dogfooding_1'
2 parents 5485fff + a67cc94 commit cd0cea4

File tree

18 files changed

+171
-141
lines changed

18 files changed

+171
-141
lines changed

Demo Plugin/NppManagedPluginDemo/Demo.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
using System;
33
using System.IO;
44
using System.Text;
@@ -36,7 +36,7 @@ static internal void SetToolBarIcon()
3636

3737
public static void OnNotification(ScNotification notification)
3838
{
39-
if (notification.Header.code == (uint)SciMsg.SCN_CHARADDED)
39+
if (notification.Header.Code == (uint)SciMsg.SCN_CHARADDED)
4040
{
4141
Kbg.Demo.Namespace.Main.doInsertHtmlCloseTag((char)notification.Character);
4242
}
@@ -168,21 +168,21 @@ static void callbackHelloFX()
168168
{
169169
for ( ; i >= -10; i--)
170170
{
171-
editor.SetZoomLevel(i);
171+
editor.SetZoom(i);
172172
Thread.Sleep(30);
173173
}
174174
Thread.Sleep(100);
175175
for ( ; i <= 20 ; i++)
176176
{
177177
Thread.Sleep(30);
178-
editor.SetZoomLevel(i);
178+
editor.SetZoom(i);
179179
}
180180
Thread.Sleep(100);
181181
}
182182
for ( ; i >= currentZoomLevel ; i--)
183183
{
184184
Thread.Sleep(30);
185-
editor.SetZoomLevel(i);
185+
editor.SetZoom(i);
186186
}
187187
}
188188

Demo Plugin/NppManagedPluginDemo/NppManagedPluginDemo.VS2015.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<AssemblyName>Demo</AssemblyName>
1313
<StartupObject>
1414
</StartupObject>
15-
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
15+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1616
<FileUpgradeFlags>
1717
</FileUpgradeFlags>
1818
<OldToolsVersion>3.5</OldToolsVersion>

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
This is a fork of UFO's plugin package updated for VS2015
44

5+
[![Build status](https://ci.appveyor.com/api/projects/status/5f0ui9y2ujugh6wt/branch/master?svg=true)](https://ci.appveyor.com/project/kbilsted/notepadpluspluspluginpack-net/branch/master)
6+
[![License](http://img.shields.io/badge/License-Apache_2-red.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
7+
[![Stats](https://img.shields.io/badge/Code_lines-5,0_K-ff69b4.svg)]()
8+
[![Stats](https://img.shields.io/badge/Doc_lines-3,1_K-ff69b4.svg)]()
9+
10+
511
## Getting started
612
1. Download a [release](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/releases/) and unzip it
713
2. Place the visual studio project template (the `Visual Studio Project Template C#\NppPlugin.zip`) in the visual studio path (typically `"My Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#\"` but see [instructions](https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/blob/master/Visual%20Studio%20Project%20Template%20C%23/HOW-TO-INSTALL-ME.txt) inside the release)
@@ -65,6 +71,11 @@ From v1.0 and onwards we will turn over to semantic versioning
6571
* Robert Giesecke: http://sites.google.com/site/robertgiesecke/Home/uploads/csharpprojecttemplateforunmanagedexports https://www.nuget.org/packages/UnmanagedExports
6672

6773

74+
## Requirements:
75+
* works with .NET Runtime 3.5 and above (can easily be reduced to .Net runtime 2.0 if needed)
76+
* UNICODE plugins only.
77+
78+
6879
## About me
6980

70-
I blog at http://firstclassthoughts.co.uk/ on code readability and quality
81+
I blog at http://firstclassthoughts.co.uk/ on code readability and quality

Visual Studio Project Template C#/Main.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class Main
2222

2323
public static void OnNotification(ScNotification notification)
2424
{
25+
// This method is invoked whenever something is happening in notepad++
26+
// use eg. as
27+
// if (notification.Header.Code == (uint)NppMsg.NPPN_xxx)
28+
// { ... }
29+
// or
30+
//
31+
// if (notification.Header.Code == (uint)SciMsg.SCNxxx)
32+
// { ... }
2533
}
2634

2735
internal static void CommandMenuInit()

Visual Studio Project Template C#/PluginInfrastructure/ClikeStringArray.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
using System;
33
using System.Collections.Generic;
44
using System.Runtime.InteropServices;

Visual Studio Project Template C#/PluginInfrastructure/DllExport/DllExportAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
using System;
33
using System.Runtime.InteropServices;
44

Visual Studio Project Template C#/PluginInfrastructure/Docking_h.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
//
33
// This file should stay in sync with the CPP project file
44
// "notepad-plus-plus/PowerEditor/src/WinControls/DockingWnd/Docking.h"

Visual Studio Project Template C#/PluginInfrastructure/GatewayDomain.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
using System;
33
using System.Runtime.InteropServices;
44
using System.Text;
@@ -88,15 +88,39 @@ public int Value
8888

8989
public static bool operator ==(Position a, Position b)
9090
{
91-
return a.pos == b.pos;
91+
return ReferenceEquals(a, b) || a.pos == b.pos;
9292
}
9393

9494
public static bool operator !=(Position a, Position b)
9595
{
9696
return !(a == b);
9797
}
9898

99-
public override string ToString()
99+
public static bool operator >(Position a, Position b)
100+
{
101+
return a.Value > b.Value;
102+
}
103+
104+
public static bool operator <(Position a, Position b)
105+
{
106+
return a.Value < b.Value;
107+
}
108+
109+
public static Position Min(Position a, Position b)
110+
{
111+
if (a < b)
112+
return a;
113+
return b;
114+
}
115+
116+
public static Position Max(Position a, Position b)
117+
{
118+
if (a > b)
119+
return a;
120+
return b;
121+
}
122+
123+
public override string ToString()
100124
{
101125
return "Postion: " + pos;
102126
}
@@ -238,7 +262,7 @@ public void Dispose()
238262
}
239263

240264

241-
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
242-
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
265+
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
266+
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
243267

244268
}

Visual Studio Project Template C#/PluginInfrastructure/IScintillaGateway.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
using System;
33
using Kbg.NppPluginNET.PluginInfrastructure;
44

@@ -9,20 +9,17 @@ public interface INotepadPPGateway
99
void FileNew();
1010
}
1111

12-
/// <summary>
13-
/// This it the plugin-writers primary interface to Notepad++/Scintilla.
14-
/// It takes away all the complexity with command numbers and Int-pointer casting.
15-
///
16-
/// See http://www.scintilla.org/ScintillaDoc.html for further details.
17-
/// </summary>
18-
public interface IScintillaGateway
12+
/// <summary>
13+
/// This it the plugin-writers primary interface to Notepad++/Scintilla.
14+
/// It takes away all the complexity with command numbers and Int-pointer casting.
15+
///
16+
/// See http://www.scintilla.org/ScintillaDoc.html for further details.
17+
/// </summary>
18+
public interface IScintillaGateway
1919
{
2020
int GetSelectionLength();
21-
void SetZoomLevel(int zoomLevel);
22-
unsafe string GetSelectedText();
23-
unsafe void ReplaceSelectedText(string newText);
24-
unsafe void AppendTextAndMoveCursor(string text);
25-
21+
void AppendTextAndMoveCursor(string text);
22+
void InsertTextAndMoveCursor(string text);
2623

2724

2825
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
@@ -2305,7 +2302,7 @@ public interface IScintillaGateway
23052302
/// <summary>Move the selected lines down one line, shifting the line below before the selection (Scintilla feature 2621)</summary>
23062303
void MoveSelectedLinesDown();
23072304

2308-
/// <summary>Set the identifier reported as idFrom in notification messages. (Scintilla feature 2622)</summary>
2305+
/// <summary>Set the identifier reported as IdFrom in notification messages. (Scintilla feature 2622)</summary>
23092306
void SetIdentifier(int identifier);
23102307

23112308
/// <summary>Get the identifier. (Scintilla feature 2623)</summary>

Visual Studio Project Template C#/PluginInfrastructure/MenuCmdID_h.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.90 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.91.52 by Kasper B. Graversen etc.
22
//
33
// This file should stay in sync with the CPP project file
44
// "notepad-plus-plus/PowerEditor/src/menuCmdID.h"

0 commit comments

Comments
 (0)