npp-plugins / plugindemo Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
Even your grandmom can do it! This template is done for making plugin development as easy and simple as possible. A simple plugin can be done through 4 steps, by editing only 2 files (PluginDefinition.h and PluginDefinition.cpp) : 1. Define your plugin name in "PluginDefinition.h" 2. Define your plugin commands number in "PluginDefinition.h" 3. Customize plugin commands names and associated function name (and the other stuff, optional) in "PluginDefinition.cpp". 4. Define the associated functions Just follow the 4 steps (commented) in both PluginDefinition.h and PluginDefinition.cpp files : //-------------------------------------// //-- STEP 1. DEFINE YOUR PLUGIN NAME --// //-------------------------------------// //-----------------------------------------------// //-- STEP 2. DEFINE YOUR PLUGIN COMMAND NUMBER --// //-----------------------------------------------// //--------------------------------------------// //-- STEP 3. CUSTOMIZE YOUR PLUGIN COMMANDS --// //--------------------------------------------// //----------------------------------------------// //-- STEP 4. DEFINE YOUR ASSOCIATED FUNCTIONS --// //----------------------------------------------// Any questions and suggestions please post here : https://community.notepad-plus-plus.org/category/5/notepad-plugin-development For more information about plugin development, please check here: https://npp-user-manual.org/docs/plugins/#how-to-develop-a-plugin https://npp-user-manual.org/docs/plugin-communication/ Don HO [email protected]
Dark mode is ignored (i.e., lack of any specific code for handling it) in the 4.3 version of the demo plugin template. Thus when doing some fairly simple UI development in a plugin using the template, not all UI elements appear "dark".
Ideally, a plugin developer should not be impacted (too much) to provide a fully dark-mode enabled plugin, certainly not for a simple UI case like provided below.
GROUPBOX "",IDC_GROUPBOX,0,0,180,180
to goLine.rc
#define IDC_GROUPBOX (IDD_PLUGINGOLINE_DEMO + 6)
to resource.h
GotoLineDlg.cpp
(at the obvious spot): case WM_INITDIALOG:
{
HWND gbHwnd = ::GetDlgItem(_hSelf, IDC_GROUPBOX);
RECT gbRect;
::GetWindowRect(gbHwnd, &gbRect);
HWND childHwnd = ::GetDlgItem(_hSelf, ID_GOLINE_EDIT);
RECT childRect;
::GetWindowRect(childHwnd, &childRect);
int x = childRect.left - gbRect.left;
int y = childRect.top - gbRect.top;
int w = childRect.right - childRect.left;
int h = childRect.bottom - childRect.top;
::SetParent(childHwnd, gbHwnd);
::MoveWindow(childHwnd, x, y, w, h, TRUE);
return TRUE;
}
I expected the edit box for the line number input to be "dark".
The edit box for the line number input was "bright white":
plugin demo v.4.3
Running under:
Notepad++ v8.5.2 (64-bit)
Build time : Apr 4 2023 - 19:55:32
Path : W:\npp.misc_NoBackup\Releases\npp.8.5.2\npp.8.5.2.portable.x64\notepad++.exe
Command Line : -titleAdd="8.5.2 64-bit" -multiInst
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 21H2
OS Build : 19044.2728
Current ANSI codepage : 1252
Plugins :
ColumnsPlusPlus (0.2.0.6)
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)
NppPluginDemo (4.3)
PythonScript (2)
When "Close HTML/XML tag automatically" item is clicked, the "Current File Name" menu item gets checked/unchecked.
But in the next session, after Notepad++ is opened and closed, the "Close HTML/XML tag automatically" item is displaying with the checked state.
This inconsistency is due to the mismatch in the referenced menu item numbers ('9' and '5') between these two lines:
setCommand(**9**, TEXT("Close HTML/XML tag automatically"), insertHtmlCloseTag, pShKey, doCloseTag);
[in PluginDefinition.cpp >> commandMenuInit()]
and
::CheckMenuItem(::GetMenu(nppData._nppHandle), funcItem[**5**]._cmdID, MF_BYCOMMAND | (doCloseTag?MF_CHECKED:MF_UNCHECKED));
[ in PluginDefinition.cpp >> insertHtmlCloseTag() ]
I know this is trivial. But may still confuse beginners. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.