Code Monkey home page Code Monkey logo

plugindemo's Introduction

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]

plugindemo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plugindemo's Issues

[Feature request] Better dark mode support

Description of the Issue

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.

Steps to Reproduce the Issue

  1. Obtain and build v. 4.3 of the plugin demo
  2. Install the plugin demo DLL under Notepad++ 8.5.2 (set with Dark Mode enabled; Windows itself in non-dark mode)
  3. Run Notepad++ and activate the "Dockable Dialog Demo" feature of the plugin; observe all controls are "dark":
    image
  4. Change the code to add a groupbox control and then re-parent the edit box control for line number input to be the groupbox via these steps:
  • add GROUPBOX "",IDC_GROUPBOX,0,0,180,180 to goLine.rc
  • add #define IDC_GROUPBOX (IDD_PLUGINGOLINE_DEMO + 6) to resource.h
  • add this case into 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;
        }
  1. Build the new code and run it; observe the "Go To Line #" dockable panel's edit box control for line number input.

Expected Behavior

I expected the edit box for the line number input to be "dark".

Actual Behavior

The edit box for the line number input was "bright white":

image

Debug Information

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)

Incorrect menu Item getting checked and unchecked

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.