Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions NppPlugin/include/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,13 @@
#include <windows.h>

#include <commctrl.h>
#include <tchar.h>

#include <algorithm>
#include <locale>
#include <sstream>
#include <string>
#include <unordered_set>
#include <vector>

#if defined(_MSC_VER)
#pragma deprecated(PathFileExists) // Use doesFileExist, doesDirectoryExist or doesPathExist (for file or directory) instead.
#pragma deprecated(PathIsDirectory) // Use doesDirectoryExist instead.
#endif



std::wstring folderBrowser(HWND parent, const std::wstring & title = L"", int outputCtrlID = 0, const wchar_t *defaultStr = NULL);
std::wstring getFolderName(HWND parent, const wchar_t *defaultDir = NULL);
Expand Down Expand Up @@ -63,6 +55,7 @@ void writeFileContent(const wchar_t *file2write, const char *content2write);
bool matchInList(const wchar_t *fileName, const std::vector<std::wstring> & patterns);
bool matchInExcludeDirList(const wchar_t* dirName, const std::vector<std::wstring>& patterns, size_t level);
bool allPatternsAreExclusion(const std::vector<std::wstring>& patterns);
HRESULT openInExplorerAndSelect(const wchar_t* path);

class WcharMbcsConvertor final
{
Expand Down Expand Up @@ -162,8 +155,8 @@ std::wstring GetLastErrorAsString(DWORD errorCode = 0);
std::wstring intToString(int val);
std::wstring uintToString(unsigned int val);

HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PWSTR pszText, bool isRTL);
HWND CreateToolTipRect(int toolID, HWND hWnd, HINSTANCE hInst, const PWSTR pszText, const RECT rc);
HWND createToolTip(int toolID, HWND hDlg, HINSTANCE hInst, wchar_t* pszText, bool isRTL);
HWND createToolTipRect(int toolID, HWND hWnd, HINSTANCE hInst, wchar_t* pszText, const RECT rc);

bool isCertificateValidated(const std::wstring & fullFilePath, const std::wstring & subjectName2check);
bool isAssoCommandExisting(LPCWSTR FullPathName);
Expand Down Expand Up @@ -212,6 +205,8 @@ bool isWin32NamespacePrefixedFileName(const std::wstring& fileName);
bool isWin32NamespacePrefixedFileName(const wchar_t* szFileName);
bool isUnsupportedFileName(const std::wstring& fileName);
bool isUnsupportedFileName(const wchar_t* szFileName);
bool isUncPath(const std::wstring& path);
bool isUncFileUrl(const std::wstring& url);

class Version final
{
Expand Down Expand Up @@ -353,3 +348,6 @@ class ScopedCOMInit final // never use this in DllMain
ScopedCOMInit(const ScopedCOMInit&) = delete;
ScopedCOMInit& operator=(const ScopedCOMInit&) = delete;
};


bool needsElevation4Access(const std::wstring& path2check, bool bWriteAccess);
21 changes: 15 additions & 6 deletions NppPlugin/include/Docking.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define DWS_DF_FLOATING 0x80000000 // default state is floating


struct tTbData {
typedef struct DockedWidgetData { // DockedWidget data (old name: tTbData)
HWND hClient = nullptr; // client Window Handle
const wchar_t* pszName = nullptr; // name of plugin (shown in window)
int dlgID = 0; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
Expand All @@ -57,11 +57,20 @@ struct tTbData {
HICON hIconTab = nullptr; // icon for tabs
const wchar_t* pszAddInfo = nullptr; // for plugin to display additional information

// internal data, do not use !!!
RECT rcFloat = {}; // floating position
int iPrevCont = 0; // stores the privious container (toggling between float and dock)
const wchar_t* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin
};
// internal data, do not use !!! (rcFloat, iPrevCont only)
RECT rcFloat = {}; // floating position
int iPrevCont = 0; // stores the privious container (toggling between float and dock)

// REQUIRED: must be set by the plugin, NOT internal data.
// This must be the plugin's own DLL file name (e.g. L"NppPluginDemo.dll"),
// including the ".dll" extension - not the panel's display title, and not an arbitrary identifier string.
// Notepad++'s Docking Manager uses this file name to locate and reload the plugin's DLL, and to re-open/re-dock this panel on the next startup.
// The value is persisted verbatim as the "pluginName" attribute of the <PluginDlg> element in the user's config.xml, e.g.:
// <PluginDlg pluginName="NppPluginDemo.dll" id="16" curr="1" prev="-1" isVisible="yes" />
// If this is left null/empty or set incorrectly, the panel will fail to restore its docked position/visibility across restarts.
const wchar_t* pszModuleName = nullptr;

} DockedWidgetData, tTbData;


struct tDockMgr {
Expand Down
4 changes: 2 additions & 2 deletions NppPlugin/include/DockingDlgInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DockingDlgInterface : public StaticDialog
_moduleName = ::PathFindFileName(temp);
}

virtual void create(tTbData* data, bool isRTL = false) {
virtual void create(DockedWidgetData* data, bool isRTL = false) {
assert(data != nullptr);
StaticDialog::create(_dlgID, isRTL);
wchar_t temp[MAX_PATH];
Expand All @@ -62,7 +62,7 @@ class DockingDlgInterface : public StaticDialog
data->pszAddInfo = nullptr;
}

virtual void create(tTbData* data, std::array<int, 3> iconIDs, bool isRTL = false) {
virtual void create(DockedWidgetData* data, std::array<int, 3> iconIDs, bool isRTL = false) {
create(data, isRTL);
_iconIDs = iconIDs;
}
Expand Down
10 changes: 5 additions & 5 deletions NppPlugin/include/Notepad_plus_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_ASCII, L_USER,\
// Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead
L_ASP, L_SQL, L_VB, L_JS_EMBEDDED, L_CSS, L_PERL, L_PYTHON, L_LUA, \
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
Expand All @@ -38,8 +39,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_MMIXAL, L_NIM, L_NNCRONTAB, L_OSCRIPT, L_REBOL, \
L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG,\
L_TYPESCRIPT, L_JSON5, L_MSSQL, L_GDSCRIPT, L_HOLLYWOOD,\
L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, \
// Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead
L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, L_ESCSEQ,\
// The end of enumerated language type, so it should be always at the end
L_EXTERNAL};
enum class ExternalLexerAutoIndentMode { Standard, C_Like, Custom };
Expand Down Expand Up @@ -261,10 +261,10 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return TRUE

#define NPPM_DMMREGASDCKDLG (NPPMSG + 33)
// BOOL NPPM_DMMREGASDCKDLG(0, tTbData* pData)
// BOOL NPPM_DMMREGASDCKDLG(0, DockedWidgetData* pData)
// Pass the necessary dockingData to Notepad++ in order to make your dialog dockable.
// wParam: 0 (not used)
// lParam[in]: pData is the pointer of tTbData. Please check tTbData structure in "Docking.h"
// lParam[in]: pData is the pointer of DockedWidgetData (old name "tTbData"). Please check DockedWidgetData structure in "Docking.h"
// Minimum information which needs to be filled out are hClient, pszName, dlgID, uMask and pszModuleName.
// Notice that rcFloat and iPrevCont shouldn't be filled. They are used internally.
// Return TRUE
Expand All @@ -280,7 +280,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// BOOL WM_DMM_VIEWOTHERTAB(0, wchar_t* name)
// Show the plugin dialog (switch to plugin tab) with the given name.
// wParam: 0 (not used)
// lParam[in]: name should be the same value as previously used to register the dialog (pszName of tTbData)
// lParam[in]: name should be the same value as previously used to register the dialog (pszName of DockedWidgetData)
// Return TRUE

#define NPPM_RELOADFILE (NPPMSG + 36)
Expand Down
5 changes: 5 additions & 0 deletions NppPlugin/include/NppDarkMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ namespace NppDarkMode
HBRUSH getHotEdgeBrush();
HBRUSH getDisabledEdgeBrush();

HBRUSH getDarkerTextBrush();

HPEN getDarkerTextPen();
HPEN getEdgePen();
HPEN getHotEdgePen();
Expand Down Expand Up @@ -235,4 +237,7 @@ namespace NppDarkMode
LRESULT onCtlColorDlgStaticText(HDC hdc, bool isTextEnabled);
LRESULT onCtlColorDlgLinkText(HDC hdc, bool isTextEnabled = true);
LRESULT onCtlColorListbox(WPARAM wParam, LPARAM lParam);

int darkMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
BOOL darkChooseColorW(LPCHOOSECOLORW cc);
}
2 changes: 2 additions & 0 deletions NppPlugin/include/SciLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@
#define SCE_ASM_STRINGEOL 13
#define SCE_ASM_EXTINSTRUCTION 14
#define SCE_ASM_COMMENTDIRECTIVE 15
#define SCE_ASM_STRINGBACKQUOTE 16
#define SCE_F_DEFAULT 0
#define SCE_F_COMMENT 1
#define SCE_F_NUMBER 2
Expand Down Expand Up @@ -1522,6 +1523,7 @@
#define SCE_PAS_CHARACTER 12
#define SCE_PAS_OPERATOR 13
#define SCE_PAS_ASM 14
#define SCE_PAS_MULTILINESTRING 15
#define SCE_SORCUS_DEFAULT 0
#define SCE_SORCUS_COMMAND 1
#define SCE_SORCUS_PARAMETER 2
Expand Down
10 changes: 9 additions & 1 deletion NppPlugin/include/Scintilla.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_SETVIEWWS 2021
#define SCTD_LONGARROW 0
#define SCTD_STRIKEOUT 1
#define SCTD_CONTROLCHAR 2
#define SCI_GETTABDRAWMODE 2698
#define SCI_SETTABDRAWMODE 2699
#define SCI_POSITIONFROMPOINT 2022
Expand Down Expand Up @@ -871,6 +872,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_STATUS_OK 0
#define SC_STATUS_FAILURE 1
#define SC_STATUS_BADALLOC 2
#define SC_STATUS_OUTSIDE_DOCUMENT 3
#define SC_STATUS_WARN_START 1000
#define SC_STATUS_WARN_REGEX 1001
#define SCI_SETSTATUS 2382
Expand Down Expand Up @@ -1269,6 +1271,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_UPDATE_SELECTION 0x2
#define SC_UPDATE_V_SCROLL 0x4
#define SC_UPDATE_H_SCROLL 0x8
#define SC_UPDATE_TEXT 0x10
#define SC_UPDATE_LINE_COUNT 0x20
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
Expand Down Expand Up @@ -1340,6 +1344,10 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCN_MARGINRIGHTCLICK 2031
#define SCN_AUTOCSELECTIONCHANGE 2032
#ifndef SCI_DISABLE_PROVISIONAL
#define SCALE_TECHNIQUE_DEFAULT 0
#define SCALE_TECHNIQUE_PIXEL_ALIGNED 1
#define SCI_SETSCALETECHNIQUE 2820
#define SCI_GETSCALETECHNIQUE 2821
#define SC_BIDIRECTIONAL_DISABLED 0
#define SC_BIDIRECTIONAL_L2R 1
#define SC_BIDIRECTIONAL_R2L 2
Expand Down Expand Up @@ -1447,7 +1455,7 @@ struct SCNotification {
Sci_Position position;
/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
/* SCN_MARGINRIGHTCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, */
/* SCN_CALLTIPCLICK, */
/* SCN_UPDATEUI, SCN_CALLTIPCLICK, */
/* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
/* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
/* SCN_USERLISTSELECTION, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */
Expand Down
11 changes: 7 additions & 4 deletions NppPlugin/include/menuCmdID.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
#define IDM_FILE_CLOSEALL_UNCHANGED (IDM_FILE + 24)
#define IDM_FILE_CONTAININGFOLDERASWORKSPACE (IDM_FILE + 25)
#define IDM_FILE_CLOSEALL_BUT_PINNED (IDM_FILE + 26)
#define IDM_FILE_OPEN_POWERSHELL (IDM_FILE + 27)
// IMPORTANT: If list above is modified, you have to change the following values:

// To be updated if new menu item(s) is (are) added in menu "File"
#define IDM_FILEMENU_LASTONE IDM_FILE_CLOSEALL_BUT_PINNED
#define IDM_FILEMENU_LASTONE IDM_FILE_OPEN_POWERSHELL

// 0 based position of command "Exit" including the bars in the file menu
// and without counting "Recent files history" items
Expand Down Expand Up @@ -155,8 +156,8 @@
#define IDM_EDIT_SENTENCECASE_BLEND (IDM_EDIT + 70)
#define IDM_EDIT_INVERTCASE (IDM_EDIT + 71)
#define IDM_EDIT_RANDOMCASE (IDM_EDIT + 72)
#define IDM_EDIT_OPENASFILE (IDM_EDIT + 73)
#define IDM_EDIT_OPENINFOLDER (IDM_EDIT + 74)
#define IDM_EDIT_OPENSELECTEDFILETOEDIT (IDM_EDIT + 73)
#define IDM_EDIT_OPENSELECTEDFILEFOLDERINEXPLORER (IDM_EDIT + 74)
#define IDM_EDIT_SEARCHONINTERNET (IDM_EDIT + 75)
#define IDM_EDIT_CHANGESEARCHENGINE (IDM_EDIT + 76)
#define IDM_EDIT_REMOVE_CONSECUTIVE_DUP_LINES (IDM_EDIT + 77)
Expand Down Expand Up @@ -307,7 +308,7 @@
#define IDM_VIEW_ZOOMOUT (IDM_VIEW + 24)
#define IDM_VIEW_TAB_SPACE (IDM_VIEW + 25)
#define IDM_VIEW_EOL (IDM_VIEW + 26)
//#define IDM_VIEW_TOOLBAR_REDUCE_SET2 (IDM_VIEW + 27)
#define IDM_VIEW_ZOOM_SYNC (IDM_VIEW + 27)
//#define IDM_VIEW_TOOLBAR_ENLARGE_SET2 (IDM_VIEW + 28)
#define IDM_VIEW_UNFOLDALL (IDM_VIEW + 29)
#define IDM_VIEW_FOLD_CURRENT (IDM_VIEW + 30)
Expand Down Expand Up @@ -571,6 +572,7 @@
#define IDM_LANG_TOML (IDM_LANG + 91)
#define IDM_LANG_SAS (IDM_LANG + 92)
#define IDM_LANG_ERRORLIST (IDM_LANG + 93)
#define IDM_LANG_ESCSEQ (IDM_LANG + 94)

#define IDM_LANG_EXTERNAL (IDM_LANG + 165)
#define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 179)
Expand Down Expand Up @@ -630,6 +632,7 @@
#define IDM_TOOL_SHA512_GENERATEINTOCLIPBOARD (IDM_TOOL + 12)

#define IDM_EXECUTE (IDM + 9000)
#define IDM_EXECUTE_VALIDATE_SHORTCUTSXML (IDM_EXECUTE + 1)

#define IDM_SYSTRAYPOPUP (IDM + 3100)
#define IDM_SYSTRAYPOPUP_ACTIVATE (IDM_SYSTRAYPOPUP + 1)
Expand Down
13 changes: 13 additions & 0 deletions NppPlugin/src/NppDarkModeDummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,17 @@ namespace NppDarkMode
return reinterpret_cast<LRESULT>(NppDarkMode::getDarkerBackgroundBrush());
}



// code adapted from https://github.com/ozone10/win32-darkmodelib
int darkMessageBoxW(
HWND hWnd,
LPCWSTR lpText,
LPCWSTR lpCaption,
UINT uType
)
{
return ::MessageBoxW(hWnd, lpText, lpCaption, uType);
}

}
2 changes: 1 addition & 1 deletion NppPlugin/src/StaticDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent, WORD fon
{
std::wstring errMsg = L"CreateDialogParam() return NULL.\rGetLastError(): ";
errMsg += GetLastErrorAsString();
::MessageBox(NULL, errMsg.c_str(), L"In StaticDialog::create()", MB_OK);
NppDarkMode::darkMessageBoxW(nullptr, errMsg.c_str(), L"In StaticDialog::create()", MB_OK);
return;
}

Expand Down
1 change: 1 addition & 0 deletions NppPlugin/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <shlwapi.h>
#include <WinUser.h>
#include <commctrl.h>
#include <commdlg.h>

#include <string>
typedef std::basic_string<TCHAR> tstring;
Expand Down
1 change: 1 addition & 0 deletions PythonScript/src/CreateWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
'Element' : 'int',
'ChangeHistoryOption' : 'int',
'UndoSelectionHistoryOption' : 'int',
'ScaleTechnique' : 'int',
}

castsL = {
Expand Down
16 changes: 14 additions & 2 deletions PythonScript/src/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ enum WhiteSpace
enum TabDrawMode
{
PYSCR_SCTD_LONGARROW = SCTD_LONGARROW,
PYSCR_SCTD_STRIKEOUT = SCTD_STRIKEOUT
PYSCR_SCTD_STRIKEOUT = SCTD_STRIKEOUT,
PYSCR_SCTD_CONTROLCHAR = SCTD_CONTROLCHAR
};

enum EndOfLine
Expand Down Expand Up @@ -673,6 +674,7 @@ enum Status
PYSCR_SC_STATUS_OK = SC_STATUS_OK,
PYSCR_SC_STATUS_FAILURE = SC_STATUS_FAILURE,
PYSCR_SC_STATUS_BADALLOC = SC_STATUS_BADALLOC,
PYSCR_SC_STATUS_OUTSIDE_DOCUMENT = SC_STATUS_OUTSIDE_DOCUMENT,
PYSCR_SC_STATUS_WARN_START = SC_STATUS_WARN_START,
PYSCR_SC_STATUS_WARN_REGEX = SC_STATUS_WARN_REGEX
};
Expand Down Expand Up @@ -862,7 +864,9 @@ enum Update
PYSCR_SC_UPDATE_CONTENT = SC_UPDATE_CONTENT,
PYSCR_SC_UPDATE_SELECTION = SC_UPDATE_SELECTION,
PYSCR_SC_UPDATE_V_SCROLL = SC_UPDATE_V_SCROLL,
PYSCR_SC_UPDATE_H_SCROLL = SC_UPDATE_H_SCROLL
PYSCR_SC_UPDATE_H_SCROLL = SC_UPDATE_H_SCROLL,
PYSCR_SC_UPDATE_TEXT = SC_UPDATE_TEXT,
PYSCR_SC_UPDATE_LINE_COUNT = SC_UPDATE_LINE_COUNT
};

enum FocusChange
Expand Down Expand Up @@ -923,6 +927,12 @@ enum CharacterSource
PYSCR_SC_CHARACTERSOURCE_IME_RESULT = SC_CHARACTERSOURCE_IME_RESULT
};

enum ScaleTechnique
{
PYSCR_SCALE_TECHNIQUE_DEFAULT = SCALE_TECHNIQUE_DEFAULT,
PYSCR_SCALE_TECHNIQUE_PIXEL_ALIGNED = SCALE_TECHNIQUE_PIXEL_ALIGNED
};

enum Bidirectional
{
PYSCR_SC_BIDIRECTIONAL_DISABLED = SC_BIDIRECTIONAL_DISABLED,
Expand Down Expand Up @@ -1899,6 +1909,8 @@ enum ScintillaMessage
PYSCR_SCI_TAGSOFSTYLE = SCI_TAGSOFSTYLE,
PYSCR_SCI_DESCRIPTIONOFSTYLE = SCI_DESCRIPTIONOFSTYLE,
PYSCR_SCI_SETILEXER = SCI_SETILEXER,
PYSCR_SCI_SETSCALETECHNIQUE = SCI_SETSCALETECHNIQUE,
PYSCR_SCI_GETSCALETECHNIQUE = SCI_GETSCALETECHNIQUE,
PYSCR_SCI_GETBIDIRECTIONAL = SCI_GETBIDIRECTIONAL,
PYSCR_SCI_SETBIDIRECTIONAL = SCI_SETBIDIRECTIONAL
};
Expand Down
Loading