minor code cleanup for future refactoring

This commit is contained in:
Damien GERARD 2015-08-06 11:03:57 +02:00
parent ba5d36e2bf
commit 366a393f13
19 changed files with 2251 additions and 2152 deletions

View File

@ -29,6 +29,7 @@
#include <string> #include <string>
#include <windows.h> #include <windows.h>
#include <iso646.h> #include <iso646.h>
#include <cstdint>
const bool dirUp = true; const bool dirUp = true;

View File

@ -362,7 +362,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL); bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
_subSplitter.init(_pPublicInterface->getHinst(), hwnd); _subSplitter.init(_pPublicInterface->getHinst(), hwnd);
_subSplitter.create(&_mainDocTab, &_subDocTab, 8, DYNAMIC, 50, isVertical); _subSplitter.create(&_mainDocTab, &_subDocTab, 8, SplitterMode::DYNAMIC, 50, isVertical);
//--Status Bar Section--// //--Status Bar Section--//
bool willBeShown = nppGUI._statusBarShow; bool willBeShown = nppGUI._statusBarShow;
@ -3240,7 +3240,7 @@ void Notepad_plus::dockUserDlg()
else else
pWindow = _pDocTab; pWindow = _pDocTab;
_pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), 8, RIGHT_FIX, 45); _pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), 8, SplitterMode::RIGHT_FIX, 45);
} }
if (bothActive()) if (bothActive())

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,13 +24,11 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef NOTEPAD_PLUS_WINDOW_H
#define NOTEPAD_PLUS_WINDOW_H
#include "Notepad_plus.h" #include "Notepad_plus.h"
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\ const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
\r\ \r\
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qnEsterEggName | -qtText | -qfCntentFileName] [filePath]\r\ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qnEsterEggName | -qtText | -qfCntentFileName] [filePath]\r\
@ -59,47 +57,57 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNum
filePath : file or folder name to open (absolute or relative path name)\r\ filePath : file or folder name to open (absolute or relative path name)\r\
"); ");
class Notepad_plus_Window : public Window {
class Notepad_plus_Window : public Window
{
public: public:
Notepad_plus_Window() : _isPrelaunch(false), _disablePluginsManager(false) {};
void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams); void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams);
bool isDlgsMsg(MSG *msg) const; bool isDlgsMsg(MSG *msg) const;
HACCEL getAccTable() const { HACCEL getAccTable() const
{
return _notepad_plus_plus_core.getAccTable(); return _notepad_plus_plus_core.getAccTable();
}; }
bool emergency(generic_string emergencySavedDir) { bool emergency(generic_string emergencySavedDir)
{
return _notepad_plus_plus_core.emergency(emergencySavedDir); return _notepad_plus_plus_core.emergency(emergencySavedDir);
}; }
bool isPrelaunch() const { bool isPrelaunch() const
{
return _isPrelaunch; return _isPrelaunch;
}; }
void setIsPrelaunch(bool val) { void setIsPrelaunch(bool val)
{
_isPrelaunch = val; _isPrelaunch = val;
}; }
virtual void destroy(){ virtual void destroy()
::DestroyWindow(_hSelf); {
}; ::DestroyWindow(_hSelf);
}
static const TCHAR * getClassName() { static const TCHAR * getClassName()
{
return _className; return _className;
}; }
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
private: private:
Notepad_plus _notepad_plus_plus_core; Notepad_plus _notepad_plus_plus_core;
static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
static const TCHAR _className[32]; static const TCHAR _className[32];
bool _isPrelaunch; bool _isPrelaunch = false;
bool _disablePluginsManager; bool _disablePluginsManager = false;
std::string _userQuote; // keep the availability of this string for thread using std::string _userQuote; // keep the availability of this string for thread using
}; };
#endif //NOTEPAD_PLUS_WINDOW_H

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -55,7 +55,7 @@ void Notepad_plus::macroPlayback(Macro macro)
_pEditView->execute(SCI_ENDUNDOACTION); _pEditView->execute(SCI_ENDUNDOACTION);
} }
void Notepad_plus::command(int id) void Notepad_plus::command(int id)
{ {
switch (id) switch (id)
{ {
@ -127,7 +127,7 @@ void Notepad_plus::command(int id)
checkDocState(); checkDocState();
break; break;
} }
case IDM_FILE_CLOSEALL_BUT_CURRENT : case IDM_FILE_CLOSEALL_BUT_CURRENT :
fileCloseAllButCurrent(); fileCloseAllButCurrent();
checkDocState(); checkDocState();
@ -234,12 +234,12 @@ void Notepad_plus::command(int id)
unsigned char *lpucharCopy = (unsigned char *)GlobalLock(hglbCopy); unsigned char *lpucharCopy = (unsigned char *)GlobalLock(hglbCopy);
memcpy(lpucharCopy, pBinText, textLen * sizeof(unsigned char)); memcpy(lpucharCopy, pBinText, textLen * sizeof(unsigned char));
lpucharCopy[textLen] = 0; // null character lpucharCopy[textLen] = 0; // null character
GlobalUnlock(hglbCopy); GlobalUnlock(hglbCopy);
// Place the handle on the clipboard. // Place the handle on the clipboard.
SetClipboardData(CF_TEXT, hglbCopy); SetClipboardData(CF_TEXT, hglbCopy);
// Allocate a global memory object for the text length. // Allocate a global memory object for the text length.
HGLOBAL hglbLenCopy = GlobalAlloc(GMEM_MOVEABLE, sizeof(unsigned long)); HGLOBAL hglbLenCopy = GlobalAlloc(GMEM_MOVEABLE, sizeof(unsigned long));
@ -248,13 +248,13 @@ void Notepad_plus::command(int id)
CloseClipboard(); CloseClipboard();
return; return;
} }
// Lock the handle and copy the text to the buffer. // Lock the handle and copy the text to the buffer.
unsigned long *lpLenCopy = (unsigned long *)GlobalLock(hglbLenCopy); unsigned long *lpLenCopy = (unsigned long *)GlobalLock(hglbLenCopy);
*lpLenCopy = textLen; *lpLenCopy = textLen;
GlobalUnlock(hglbLenCopy); GlobalUnlock(hglbLenCopy);
// Place the handle on the clipboard. // Place the handle on the clipboard.
UINT f = RegisterClipboardFormat(CF_NPPTEXTLEN); UINT f = RegisterClipboardFormat(CF_NPPTEXTLEN);
SetClipboardData(f, hglbLenCopy); SetClipboardData(f, hglbLenCopy);
@ -276,33 +276,33 @@ void Notepad_plus::command(int id)
break; break;
case IDM_EDIT_PASTE_BINARY: case IDM_EDIT_PASTE_BINARY:
{ {
LongRunningOperation op; LongRunningOperation op;
if (!IsClipboardFormatAvailable(CF_TEXT)) if (!IsClipboardFormatAvailable(CF_TEXT))
return; return;
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
return; return;
HGLOBAL hglb = GetClipboardData(CF_TEXT); HGLOBAL hglb = GetClipboardData(CF_TEXT);
if (hglb != NULL) if (hglb != NULL)
{ {
char *lpchar = (char *)GlobalLock(hglb); char *lpchar = (char *)GlobalLock(hglb);
if (lpchar != NULL) if (lpchar != NULL)
{ {
UINT cf_nppTextLen = RegisterClipboardFormat(CF_NPPTEXTLEN); UINT cf_nppTextLen = RegisterClipboardFormat(CF_NPPTEXTLEN);
if (IsClipboardFormatAvailable(cf_nppTextLen)) if (IsClipboardFormatAvailable(cf_nppTextLen))
{ {
HGLOBAL hglbLen = GetClipboardData(cf_nppTextLen); HGLOBAL hglbLen = GetClipboardData(cf_nppTextLen);
if (hglbLen != NULL) if (hglbLen != NULL)
{ {
unsigned long *lpLen = (unsigned long *)GlobalLock(hglbLen); unsigned long *lpLen = (unsigned long *)GlobalLock(hglbLen);
if (lpLen != NULL) if (lpLen != NULL)
{ {
_pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)""); _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)"");
_pEditView->execute(SCI_ADDTEXT, *lpLen, (LPARAM)lpchar); _pEditView->execute(SCI_ADDTEXT, *lpLen, (LPARAM)lpchar);
GlobalUnlock(hglb); GlobalUnlock(hglb);
} }
} }
} }
@ -311,7 +311,7 @@ void Notepad_plus::command(int id)
_pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lpchar); _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lpchar);
} }
GlobalUnlock(hglb); GlobalUnlock(hglb);
} }
} }
CloseClipboard(); CloseClipboard();
@ -325,27 +325,27 @@ void Notepad_plus::command(int id)
LongRunningOperation op; LongRunningOperation op;
UINT f = RegisterClipboardFormat(id==IDM_EDIT_PASTE_AS_HTML?CF_HTML:CF_RTF); UINT f = RegisterClipboardFormat(id==IDM_EDIT_PASTE_AS_HTML?CF_HTML:CF_RTF);
if (!IsClipboardFormatAvailable(f)) if (!IsClipboardFormatAvailable(f))
return; return;
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
return; return;
HGLOBAL hglb = GetClipboardData(f); HGLOBAL hglb = GetClipboardData(f);
if (hglb != NULL) if (hglb != NULL)
{ {
LPSTR lptstr = (LPSTR)GlobalLock(hglb); LPSTR lptstr = (LPSTR)GlobalLock(hglb);
if (lptstr != NULL) if (lptstr != NULL)
{ {
// Call the application-defined ReplaceSelection // Call the application-defined ReplaceSelection
// function to insert the text and repaint the // function to insert the text and repaint the
// window. // window.
_pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lptstr); _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lptstr);
GlobalUnlock(hglb); GlobalUnlock(hglb);
} }
} }
CloseClipboard(); CloseClipboard();
} }
break; break;
@ -551,7 +551,7 @@ void Notepad_plus::command(int id)
} }
} }
break; break;
case IDM_VIEW_TAB1: case IDM_VIEW_TAB1:
case IDM_VIEW_TAB2: case IDM_VIEW_TAB2:
case IDM_VIEW_TAB3: case IDM_VIEW_TAB3:
@ -613,10 +613,10 @@ void Notepad_plus::command(int id)
// STOP !!! // STOP !!!
_mainEditView.execute(SCI_STOPRECORD); _mainEditView.execute(SCI_STOPRECORD);
_subEditView.execute(SCI_STOPRECORD); _subEditView.execute(SCI_STOPRECORD);
_mainEditView.execute(SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL); _mainEditView.execute(SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL);
_subEditView.execute(SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL); _subEditView.execute(SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL);
_recordingMacro = false; _recordingMacro = false;
_runMacroDlg.initMacroList(); _runMacroDlg.initMacroList();
} }
@ -646,13 +646,13 @@ void Notepad_plus::command(int id)
{ {
bool isFirstTime = !_runMacroDlg.isCreated(); bool isFirstTime = !_runMacroDlg.isCreated();
_runMacroDlg.doDialog(_nativeLangSpeaker.isRTL()); _runMacroDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime) if (isFirstTime)
{ {
_nativeLangSpeaker.changeDlgLang(_runMacroDlg.getHSelf(), "MultiMacro"); _nativeLangSpeaker.changeDlgLang(_runMacroDlg.getHSelf(), "MultiMacro");
} }
break; break;
} }
} }
break; break;
@ -693,7 +693,7 @@ void Notepad_plus::command(int id)
TCHAR str[strSize]; TCHAR str[strSize];
bool isFirstTime = !_findReplaceDlg.isCreated(); bool isFirstTime = !_findReplaceDlg.isCreated();
DIALOG_TYPE dlgID = FIND_DLG; DIALOG_TYPE dlgID = FIND_DLG;
if (id == IDM_SEARCH_REPLACE) if (id == IDM_SEARCH_REPLACE)
dlgID = REPLACE_DLG; dlgID = REPLACE_DLG;
@ -898,7 +898,7 @@ void Notepad_plus::command(int id)
break; break;
} }
case IDM_SEARCH_GOPREVMARKER1 : case IDM_SEARCH_GOPREVMARKER1 :
case IDM_SEARCH_GOPREVMARKER2 : case IDM_SEARCH_GOPREVMARKER2 :
case IDM_SEARCH_GOPREVMARKER3 : case IDM_SEARCH_GOPREVMARKER3 :
@ -1004,11 +1004,11 @@ void Notepad_plus::command(int id)
case IDM_SEARCH_CLEAR_BOOKMARKS: case IDM_SEARCH_CLEAR_BOOKMARKS:
bookmarkClearAll(); bookmarkClearAll();
break; break;
case IDM_LANG_USER_DLG : case IDM_LANG_USER_DLG :
{ {
bool isUDDlgVisible = false; bool isUDDlgVisible = false;
UserDefineDialog *udd = _pEditView->getUserDefineDlg(); UserDefineDialog *udd = _pEditView->getUserDefineDlg();
if (!udd->isCreated()) if (!udd->isCreated())
@ -1034,7 +1034,7 @@ void Notepad_plus::command(int id)
_pMainWindow = _pDocTab; _pMainWindow = _pDocTab;
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
udd->display(false); udd->display(false);
_mainWindowStatus &= ~WindowUserActive; _mainWindowStatus &= ~WindowUserActive;
} }
@ -1051,7 +1051,7 @@ void Notepad_plus::command(int id)
else else
pWindow = _pDocTab; pWindow = _pDocTab;
_pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), 8, RIGHT_FIX, 45); _pMainSplitter->create(pWindow, ScintillaEditView::getUserDefineDlg(), 8, SplitterMode::RIGHT_FIX, 45);
} }
_pMainWindow = _pMainSplitter; _pMainWindow = _pMainSplitter;
@ -1137,7 +1137,7 @@ void Notepad_plus::command(int id)
case IDM_EDIT_BLOCK_COMMENT: case IDM_EDIT_BLOCK_COMMENT:
doBlockComment(cm_toggle); doBlockComment(cm_toggle);
break; break;
case IDM_EDIT_BLOCK_COMMENT_SET: case IDM_EDIT_BLOCK_COMMENT_SET:
doBlockComment(cm_comment); doBlockComment(cm_comment);
break; break;
@ -1213,11 +1213,11 @@ void Notepad_plus::command(int id)
case IDM_EDIT_CLEARREADONLY: case IDM_EDIT_CLEARREADONLY:
{ {
Buffer * buf = _pEditView->getCurrentBuffer(); Buffer * buf = _pEditView->getCurrentBuffer();
DWORD dwFileAttribs = ::GetFileAttributes(buf->getFullPathName());
dwFileAttribs ^= FILE_ATTRIBUTE_READONLY;
::SetFileAttributes(buf->getFullPathName(), dwFileAttribs); DWORD dwFileAttribs = ::GetFileAttributes(buf->getFullPathName());
dwFileAttribs ^= FILE_ATTRIBUTE_READONLY;
::SetFileAttributes(buf->getFullPathName(), dwFileAttribs);
buf->setFileReadOnly(false); buf->setFileReadOnly(false);
} }
break; break;
@ -1367,7 +1367,7 @@ void Notepad_plus::command(int id)
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
break; break;
} }
case IDM_VIEW_REFRESHTABAR : case IDM_VIEW_REFRESHTABAR :
{ {
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
@ -1397,7 +1397,7 @@ void Notepad_plus::command(int id)
TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton()); TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton());
// This part is just for updating (redraw) the tabs // This part is just for updating (redraw) the tabs
{ {
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton()?21:20); int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton()?21:20);
int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60:45); int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60:45);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight); TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
@ -1412,18 +1412,18 @@ void Notepad_plus::command(int id)
TabBarPlus::setDbClk2Close(!TabBarPlus::isDbClk2Close()); TabBarPlus::setDbClk2Close(!TabBarPlus::isDbClk2Close());
break; break;
} }
case IDM_VIEW_DRAWTABBAR_VERTICAL : case IDM_VIEW_DRAWTABBAR_VERTICAL :
{ {
TabBarPlus::setVertical(!TabBarPlus::isVertical()); TabBarPlus::setVertical(!TabBarPlus::isVertical());
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
break; break;
} }
case IDM_VIEW_DRAWTABBAR_MULTILINE : case IDM_VIEW_DRAWTABBAR_MULTILINE :
{ {
TabBarPlus::setMultiLine(!TabBarPlus::isMultiLine()); TabBarPlus::setMultiLine(!TabBarPlus::isMultiLine());
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
break; break;
} }
@ -1555,7 +1555,7 @@ void Notepad_plus::command(int id)
case IDM_VIEW_SYNSCROLLV: case IDM_VIEW_SYNSCROLLV:
{ {
bool isSynScollV = !_syncInfo._isSynScollV; bool isSynScollV = !_syncInfo._isSynScollV;
checkMenuItem(IDM_VIEW_SYNSCROLLV, isSynScollV); checkMenuItem(IDM_VIEW_SYNSCROLLV, isSynScollV);
_toolBar.setCheck(IDM_VIEW_SYNSCROLLV, isSynScollV); _toolBar.setCheck(IDM_VIEW_SYNSCROLLV, isSynScollV);
@ -1566,7 +1566,7 @@ void Notepad_plus::command(int id)
int subCurrentLine = _subEditView.execute(SCI_GETFIRSTVISIBLELINE); int subCurrentLine = _subEditView.execute(SCI_GETFIRSTVISIBLELINE);
_syncInfo._line = mainCurrentLine - subCurrentLine; _syncInfo._line = mainCurrentLine - subCurrentLine;
} }
} }
break; break;
@ -1699,7 +1699,7 @@ void Notepad_plus::command(int id)
case IDM_FORMAT_TOMAC : case IDM_FORMAT_TOMAC :
{ {
Buffer * buf = _pEditView->getCurrentBuffer(); Buffer * buf = _pEditView->getCurrentBuffer();
int f = int((id == IDM_FORMAT_TODOS)?SC_EOL_CRLF:(id == IDM_FORMAT_TOUNIX)?SC_EOL_LF:SC_EOL_CR); int f = int((id == IDM_FORMAT_TODOS)?SC_EOL_CRLF:(id == IDM_FORMAT_TOUNIX)?SC_EOL_LF:SC_EOL_CR);
buf->setFormat((formatType)f); buf->setFormat((formatType)f);
@ -1708,7 +1708,7 @@ void Notepad_plus::command(int id)
} }
case IDM_FORMAT_ANSI : case IDM_FORMAT_ANSI :
case IDM_FORMAT_UTF_8 : case IDM_FORMAT_UTF_8 :
case IDM_FORMAT_UCS_2BE : case IDM_FORMAT_UCS_2BE :
case IDM_FORMAT_UCS_2LE : case IDM_FORMAT_UCS_2LE :
case IDM_FORMAT_AS_UTF_8 : case IDM_FORMAT_AS_UTF_8 :
@ -1723,7 +1723,7 @@ void Notepad_plus::command(int id)
shoulBeDirty = buf->getUnicodeMode() != uni8Bit; shoulBeDirty = buf->getUnicodeMode() != uni8Bit;
um = uniCookie; um = uniCookie;
break; break;
case IDM_FORMAT_UTF_8: case IDM_FORMAT_UTF_8:
um = uniUTF8; um = uniUTF8;
break; break;
@ -1842,7 +1842,7 @@ void Notepad_plus::command(int id)
case IDM_FORMAT_KOREAN_WIN : case IDM_FORMAT_KOREAN_WIN :
case IDM_FORMAT_EUC_KR : case IDM_FORMAT_EUC_KR :
case IDM_FORMAT_TIS_620 : case IDM_FORMAT_TIS_620 :
case IDM_FORMAT_MAC_CYRILLIC : case IDM_FORMAT_MAC_CYRILLIC :
case IDM_FORMAT_KOI8U_CYRILLIC : case IDM_FORMAT_KOI8U_CYRILLIC :
case IDM_FORMAT_KOI8R_CYRILLIC : case IDM_FORMAT_KOI8R_CYRILLIC :
{ {
@ -1883,7 +1883,7 @@ void Notepad_plus::command(int id)
TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"), TEXT("You should save the current modification.\rAll the saved modifications can not be undone.\r\rContinue?"),
TEXT("Lose Undo Ability Waning"), TEXT("Lose Undo Ability Waning"),
MB_YESNO); MB_YESNO);
if (answer == IDYES) if (answer == IDYES)
{ {
// Do nothing // Do nothing
@ -1906,7 +1906,7 @@ void Notepad_plus::command(int id)
case IDM_FORMAT_CONV2_ANSI: case IDM_FORMAT_CONV2_ANSI:
case IDM_FORMAT_CONV2_AS_UTF_8: case IDM_FORMAT_CONV2_AS_UTF_8:
case IDM_FORMAT_CONV2_UTF_8: case IDM_FORMAT_CONV2_UTF_8:
case IDM_FORMAT_CONV2_UCS_2BE: case IDM_FORMAT_CONV2_UCS_2BE:
case IDM_FORMAT_CONV2_UCS_2LE: case IDM_FORMAT_CONV2_UCS_2LE:
{ {
int idEncoding = -1; int idEncoding = -1;
@ -1927,7 +1927,7 @@ void Notepad_plus::command(int id)
{ {
if (um == uni8Bit) if (um == uni8Bit)
return; return;
// set scintilla to ANSI // set scintilla to ANSI
idEncoding = IDM_FORMAT_ANSI; idEncoding = IDM_FORMAT_ANSI;
} }
@ -1978,7 +1978,7 @@ void Notepad_plus::command(int id)
} }
break; break;
} }
case IDM_FORMAT_CONV2_UCS_2BE: case IDM_FORMAT_CONV2_UCS_2BE:
{ {
if (encoding != -1) if (encoding != -1)
@ -2001,7 +2001,7 @@ void Notepad_plus::command(int id)
} }
break; break;
} }
case IDM_FORMAT_CONV2_UCS_2LE: case IDM_FORMAT_CONV2_UCS_2LE:
{ {
if (encoding != -1) if (encoding != -1)
@ -2037,8 +2037,8 @@ void Notepad_plus::command(int id)
LPVOID clipboardData2 = ::GlobalLock(allocClipboardData); LPVOID clipboardData2 = ::GlobalLock(allocClipboardData);
::memcpy(clipboardData2, clipboardDataPtr, len); ::memcpy(clipboardData2, clipboardDataPtr, len);
::GlobalUnlock(clipboardData); ::GlobalUnlock(clipboardData);
::GlobalUnlock(allocClipboardData); ::GlobalUnlock(allocClipboardData);
::CloseClipboard(); ::CloseClipboard();
_pEditView->saveCurrentPos(); _pEditView->saveCurrentPos();
@ -2049,7 +2049,7 @@ void Notepad_plus::command(int id)
_pEditView->execute(SCI_CLEARALL); _pEditView->execute(SCI_CLEARALL);
// Change to the proper buffer, save buffer status // Change to the proper buffer, save buffer status
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, idEncoding, 0);
// Paste the texte, restore buffer status // Paste the texte, restore buffer status
@ -2058,7 +2058,7 @@ void Notepad_plus::command(int id)
// Restore the previous clipboard data // Restore the previous clipboard data
::OpenClipboard(_pPublicInterface->getHSelf()); ::OpenClipboard(_pPublicInterface->getHSelf());
::EmptyClipboard(); ::EmptyClipboard();
::SetClipboardData(CF_TEXT, clipboardData2); ::SetClipboardData(CF_TEXT, clipboardData2);
::CloseClipboard(); ::CloseClipboard();
@ -2106,7 +2106,7 @@ void Notepad_plus::command(int id)
for (size_t i = 0, len = copiedFiles.size(); i < len ; ++i) for (size_t i = 0, len = copiedFiles.size(); i < len ; ++i)
{ {
generic_string themeName(themeSwitcher.getThemeFromXmlFileName(copiedFiles[i].c_str())); generic_string themeName(themeSwitcher.getThemeFromXmlFileName(copiedFiles[i].c_str()));
if (!themeSwitcher.themeNameExists(themeName.c_str())) if (!themeSwitcher.themeNameExists(themeName.c_str()))
{ {
themeSwitcher.addThemeFromXml(copiedFiles[i].c_str()); themeSwitcher.addThemeFromXml(copiedFiles[i].c_str());
if (_configStyleDlg.isCreated()) if (_configStyleDlg.isCreated())
@ -2134,7 +2134,7 @@ void Notepad_plus::command(int id)
{ {
bool isFirstTime = !_preference.isCreated(); bool isFirstTime = !_preference.isCreated();
_preference.doDialog(_nativeLangSpeaker.isRTL()); _preference.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime) if (isFirstTime)
{ {
_nativeLangSpeaker.changePrefereceDlgLang(_preference); _nativeLangSpeaker.changePrefereceDlgLang(_preference);
@ -2209,7 +2209,7 @@ void Notepad_plus::command(int id)
char author[maxSelLen+1] = ""; char author[maxSelLen+1] = "";
_pEditView->getSelectedText(author, maxSelLen + 1); _pEditView->getSelectedText(author, maxSelLen + 1);
int iQuote = getQuoteIndexFrom(author); int iQuote = getQuoteIndexFrom(author);
if (iQuote == -1) if (iQuote == -1)
{ {
doAboutDlg = true; doAboutDlg = true;
@ -2229,7 +2229,7 @@ void Notepad_plus::command(int id)
if (!::PathFileExists(noEasterEggsPath.c_str())) if (!::PathFileExists(noEasterEggsPath.c_str()))
showQuoteFromIndex(iQuote); showQuoteFromIndex(iQuote);
return; return;
} }
} }
if (doAboutDlg) if (doAboutDlg)
{ {
@ -2444,7 +2444,7 @@ void Notepad_plus::command(int id)
{ {
int nbDoc = viewVisible(MAIN_VIEW)?_mainDocTab.nbItem():0; int nbDoc = viewVisible(MAIN_VIEW)?_mainDocTab.nbItem():0;
nbDoc += viewVisible(SUB_VIEW)?_subDocTab.nbItem():0; nbDoc += viewVisible(SUB_VIEW)?_subDocTab.nbItem():0;
bool doTaskList = ((NppParameters::getInstance())->getNppGUI())._doTaskList; bool doTaskList = ((NppParameters::getInstance())->getNppGUI())._doTaskList;
if (nbDoc > 1) if (nbDoc > 1)
{ {
@ -2455,7 +2455,7 @@ void Notepad_plus::command(int id)
activateNextDoc(direction); activateNextDoc(direction);
} }
else else
{ {
TaskListDlg tld; TaskListDlg tld;
HIMAGELIST hImgLst = _docTabIconList.getHandle(); HIMAGELIST hImgLst = _docTabIconList.getHandle();
tld.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst, direction); tld.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst, direction);
@ -2507,7 +2507,7 @@ void Notepad_plus::command(int id)
{ {
WindowsDlg _windowsDlg; WindowsDlg _windowsDlg;
_windowsDlg.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), _pDocTab); _windowsDlg.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), _pDocTab);
const TiXmlNodeA *nativeLangA = _nativeLangSpeaker.getNativeLangA(); const TiXmlNodeA *nativeLangA = _nativeLangSpeaker.getNativeLangA();
TiXmlNodeA *dlgNode = NULL; TiXmlNodeA *dlgNode = NULL;
if (nativeLangA) if (nativeLangA)
@ -2545,11 +2545,11 @@ void Notepad_plus::command(int id)
if (!buf->isUntitled() || buf->docLength() != 0) if (!buf->isUntitled() || buf->docLength() != 0)
{ {
fileNew(); fileNew();
} }
command(IDM_EDIT_PASTE); command(IDM_EDIT_PASTE);
} }
break; break;
case IDM_SYSTRAYPOPUP_OPENFILE: case IDM_SYSTRAYPOPUP_OPENFILE:
{ {
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI()); NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
@ -2687,7 +2687,7 @@ void Notepad_plus::command(int id)
{ {
int i = id - ID_MACRO; int i = id - ID_MACRO;
vector<MacroShortcut> & theMacros = (NppParameters::getInstance())->getMacroList(); vector<MacroShortcut> & theMacros = (NppParameters::getInstance())->getMacroList();
macroPlayback(theMacros[i].getMacro()); macroPlayback(theMacros[i].getMacro());
} }
else if ((id >= ID_USER_CMD) && (id < ID_USER_CMD_LIMIT)) else if ((id >= ID_USER_CMD) && (id < ID_USER_CMD_LIMIT))
{ {
@ -2707,7 +2707,7 @@ void Notepad_plus::command(int id)
{ {
_pluginsManager.relayNppMessages(WM_COMMAND, id, 0); _pluginsManager.relayNppMessages(WM_COMMAND, id, 0);
} }
/*UNLOAD /*UNLOAD
else if ((id >= ID_PLUGINS_REMOVING) && (id < ID_PLUGINS_REMOVING_END)) else if ((id >= ID_PLUGINS_REMOVING) && (id < ID_PLUGINS_REMOVING_END))
{ {
int i = id - ID_PLUGINS_REMOVING; int i = id - ID_PLUGINS_REMOVING;
@ -2716,11 +2716,11 @@ void Notepad_plus::command(int id)
*/ */
else if ((id >= IDM_WINDOW_MRU_FIRST) && (id <= IDM_WINDOW_MRU_LIMIT)) else if ((id >= IDM_WINDOW_MRU_FIRST) && (id <= IDM_WINDOW_MRU_LIMIT))
{ {
activateDoc(id-IDM_WINDOW_MRU_FIRST); activateDoc(id-IDM_WINDOW_MRU_FIRST);
} }
} }
if (_recordingMacro) if (_recordingMacro)
switch (id) switch (id)
{ {
case IDM_FILE_NEW : case IDM_FILE_NEW :
@ -2817,15 +2817,15 @@ void Notepad_plus::command(int id)
case IDM_VIEW_GOTO_ANOTHER_VIEW: case IDM_VIEW_GOTO_ANOTHER_VIEW:
case IDM_VIEW_SYNSCROLLV: case IDM_VIEW_SYNSCROLLV:
case IDM_VIEW_SYNSCROLLH: case IDM_VIEW_SYNSCROLLH:
case IDM_VIEW_TAB1: case IDM_VIEW_TAB1:
case IDM_VIEW_TAB2: case IDM_VIEW_TAB2:
case IDM_VIEW_TAB3: case IDM_VIEW_TAB3:
case IDM_VIEW_TAB4: case IDM_VIEW_TAB4:
case IDM_VIEW_TAB5: case IDM_VIEW_TAB5:
case IDM_VIEW_TAB6: case IDM_VIEW_TAB6:
case IDM_VIEW_TAB7: case IDM_VIEW_TAB7:
case IDM_VIEW_TAB8: case IDM_VIEW_TAB8:
case IDM_VIEW_TAB9: case IDM_VIEW_TAB9:
case IDM_VIEW_TAB_NEXT: case IDM_VIEW_TAB_NEXT:
case IDM_VIEW_TAB_PREV: case IDM_VIEW_TAB_PREV:
case IDC_PREV_DOC : case IDC_PREV_DOC :

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,74 +24,69 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <iostream> #include <iostream>
#include "ColourPicker.h" #include "ColourPicker.h"
#include "ColourPopup.h" #include "ColourPopup.h"
void ColourPicker::init(HINSTANCE hInst, HWND parent) void ColourPicker::init(HINSTANCE hInst, HWND parent)
{ {
Window::init(hInst, parent); Window::init(hInst, parent);
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
0, 0,
TEXT("Button"), TEXT("Button"),
TEXT("F"), TEXT("F"),
WS_CHILD | WS_VISIBLE, WS_CHILD | WS_VISIBLE,
0, 0, 25, 25, 0, 0, 25, 25,
_hParent, _hParent, NULL, _hInst, (LPVOID)0);
NULL,
_hInst,
(LPVOID)0);
if (!_hSelf) if (!_hSelf)
{
throw std::runtime_error("ColourPicker::init : CreateWindowEx() function return null"); throw std::runtime_error("ColourPicker::init : CreateWindowEx() function return null");
}
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
_buttonDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticWinProc));
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
_buttonDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticWinProc));
} }
void ColourPicker::destroy() void ColourPicker::destroy()
{ {
if (_pColourPopup) delete _pColourPopup;
{ _pColourPopup = NULL;
delete _pColourPopup;
_pColourPopup = NULL;
}
::DestroyWindow(_hSelf); ::DestroyWindow(_hSelf);
} }
void ColourPicker::drawBackground(HDC hDC) void ColourPicker::drawBackground(HDC hDC)
{ {
RECT rc; RECT rc;
HBRUSH hbrush; HBRUSH hbrush;
if(!hDC) if (!hDC)
return; return;
getClientRect(rc); getClientRect(rc);
hbrush = ::CreateSolidBrush(_currentColour); hbrush = ::CreateSolidBrush(_currentColour);
HGDIOBJ oldObj = ::SelectObject(hDC, hbrush); HGDIOBJ oldObj = ::SelectObject(hDC, hbrush);
::Rectangle(hDC, 0, 0, rc.right, rc.bottom); ::Rectangle(hDC, 0, 0, rc.right, rc.bottom);
::SelectObject(hDC, oldObj); ::SelectObject(hDC, oldObj);
//FillRect(hDC, &rc, hbrush); //FillRect(hDC, &rc, hbrush);
::DeleteObject(hbrush); ::DeleteObject(hbrush);
} }
void ColourPicker::drawForeground(HDC hDC) void ColourPicker::drawForeground(HDC hDC)
{ {
RECT rc; RECT rc;
HBRUSH hbrush = NULL; HBRUSH hbrush = NULL;
if(!hDC || _isEnabled) if (!hDC || _isEnabled)
return; return;
int oldMode = ::SetBkMode(hDC, TRANSPARENT); int oldMode = ::SetBkMode(hDC, TRANSPARENT);
getClientRect(rc); getClientRect(rc);
COLORREF strikeOut = RGB(0,0,0); COLORREF strikeOut = RGB(0,0,0);
if ((((_currentColour ) & 0xFF) + if ((((_currentColour ) & 0xFF) +
((_currentColour >> 8) & 0xFF) + ((_currentColour >> 8) & 0xFF) +
@ -103,17 +98,18 @@ void ColourPicker::drawForeground(HDC hDC)
::Rectangle(hDC, 0, 0, rc.right, rc.bottom); ::Rectangle(hDC, 0, 0, rc.right, rc.bottom);
::SelectObject(hDC, oldObj); ::SelectObject(hDC, oldObj);
//FillRect(hDC, &rc, hbrush); //FillRect(hDC, &rc, hbrush);
::DeleteObject(hbrush); ::DeleteObject(hbrush);
::SetBkMode(hDC, oldMode); ::SetBkMode(hDC, oldMode);
} }
LRESULT ColourPicker::runProc(UINT Message, WPARAM wParam, LPARAM lParam) LRESULT ColourPicker::runProc(UINT Message, WPARAM wParam, LPARAM lParam)
{ {
switch (Message) switch (Message)
{ {
case WM_LBUTTONDBLCLK : case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN : case WM_LBUTTONDOWN:
{ {
RECT rc; RECT rc;
POINT p; POINT p;
Window::getClientRect(rc); Window::getClientRect(rc);
@ -134,8 +130,9 @@ LRESULT ColourPicker::runProc(UINT Message, WPARAM wParam, LPARAM lParam)
_pColourPopup->doDialog(p); _pColourPopup->doDialog(p);
_pColourPopup->display(true); _pColourPopup->display(true);
} }
return TRUE; return TRUE;
} }
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
{ {
_isEnabled = !_isEnabled; _isEnabled = !_isEnabled;
@ -152,41 +149,44 @@ LRESULT ColourPicker::runProc(UINT Message, WPARAM wParam, LPARAM lParam)
break; break;
} }
case WM_PAINT : case WM_PAINT:
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC dc = ::BeginPaint(_hSelf, &ps); HDC dc = ::BeginPaint(_hSelf, &ps);
drawForeground(dc); drawForeground(dc);
::EndPaint(_hSelf, &ps); ::EndPaint(_hSelf, &ps);
return TRUE; return TRUE;
} }
case WM_PICKUP_COLOR : case WM_PICKUP_COLOR:
{ {
_currentColour = (COLORREF)wParam; _currentColour = (COLORREF)wParam;
redraw(); redraw();
_pColourPopup->display(false); _pColourPopup->display(false);
::SendMessage(_hParent, WM_COMMAND, MAKELONG(0, CPN_COLOURPICKED), (LPARAM)_hSelf); ::SendMessage(_hParent, WM_COMMAND, MAKELONG(0, CPN_COLOURPICKED), (LPARAM)_hSelf);
return TRUE; return TRUE;
} }
case WM_ENABLE : case WM_ENABLE:
{ {
if ((BOOL)wParam == FALSE) if ((BOOL)wParam == FALSE)
{ {
_currentColour = ::GetSysColor(COLOR_3DFACE); _currentColour = ::GetSysColor(COLOR_3DFACE);
redraw(); redraw();
} }
return TRUE; return TRUE;
} }
case WM_PICKUP_CANCEL : case WM_PICKUP_CANCEL:
{
_pColourPopup->display(false); _pColourPopup->display(false);
return TRUE; return TRUE;
}
default : default:
return ::CallWindowProc(_buttonDefaultProc, _hSelf, Message, wParam, lParam); return ::CallWindowProc(_buttonDefaultProc, _hSelf, Message, wParam, lParam);
} }
return FALSE; return FALSE;
} }

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,62 +24,54 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef COLOUR_POPUP_H
#define COLOUR_POPUP_H
#ifndef COLOUR_POPUP_RESOURCE_H
#include "ColourPopupResource.h" #include "ColourPopupResource.h"
#endif //COLOUR_POPUP_RESOURCE_H
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#include "Window.h" #include "Window.h"
#define WM_PICKUP_COLOR (COLOURPOPUP_USER + 1) #define WM_PICKUP_COLOR (COLOURPOPUP_USER + 1)
#define WM_PICKUP_CANCEL (COLOURPOPUP_USER + 2) #define WM_PICKUP_CANCEL (COLOURPOPUP_USER + 2)
class ColourPopup : public Window class ColourPopup : public Window
{ {
public : public :
ColourPopup() : Window()/*, isColourChooserLaunched(false)*/ {}; ColourPopup() = default;
ColourPopup(COLORREF defaultColor) : Window(), /* isColourChooserLaunched(false), */ _colour(defaultColor) {}; explicit ColourPopup(COLORREF defaultColor) : _colour(defaultColor) {}
~ColourPopup(){}; virtual ~ColourPopup() {}
bool isCreated() const { bool isCreated() const
{
return (_hSelf != NULL); return (_hSelf != NULL);
}; }
void create(int dialogID); void create(int dialogID);
void doDialog(POINT p) { void doDialog(POINT p)
if (!isCreated()) {
create(IDD_COLOUR_POPUP); if (!isCreated())
::SetWindowPos(_hSelf, HWND_TOP, p.x, p.y, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW); create(IDD_COLOUR_POPUP);
}; ::SetWindowPos(_hSelf, HWND_TOP, p.x, p.y, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW);
}
virtual void destroy() { virtual void destroy()
::DestroyWindow(_hSelf); {
}; ::DestroyWindow(_hSelf);
}
void setColour(COLORREF c) { void setColour(COLORREF c)
_colour = c; {
}; _colour = c;
}
COLORREF getSelColour(){return _colour;}; COLORREF getSelColour(){return _colour;};
private : private :
RECT _rc; RECT _rc;
COLORREF _colour; COLORREF _colour;
//bool isColourChooserLaunched; //bool isColourChooserLaunched = false;
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
}; };
#endif //COLOUR_POPUP_H

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,11 +24,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#define IDD_COLOUR_POPUP 2100
#ifndef COLOUR_POPUP_RESOURCE_H #define IDC_COLOUR_LIST (IDD_COLOUR_POPUP + 1)
#define IDD_COLOUR_POPUP 2100
#define IDC_COLOUR_LIST (IDD_COLOUR_POPUP + 1)
#endif //COLOUR_POPUP_RESOURCE_H

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -37,35 +37,35 @@ using namespace std;
LRESULT CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{ {
switch(Message) switch(Message)
{ {
case WM_PAINT: case WM_PAINT:
{ {
RECT rect; RECT rect;
::GetClientRect(hwnd, &rect); ::GetClientRect(hwnd, &rect);
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc = ::BeginPaint(hwnd, &ps); HDC hdc = ::BeginPaint(hwnd, &ps);
::SetTextColor(hdc, _colour);
// Get the default GUI font ::SetTextColor(hdc, _colour);
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
// Get the default GUI font
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
HANDLE hOld = SelectObject(hdc, hf); HANDLE hOld = SelectObject(hdc, hf);
// Draw the text! // Draw the text!
TCHAR text[MAX_PATH]; TCHAR text[MAX_PATH];
::GetWindowText(hwnd, text, MAX_PATH); ::GetWindowText(hwnd, text, MAX_PATH);
::DrawText(hdc, text, -1, &rect, DT_LEFT); ::DrawText(hdc, text, -1, &rect, DT_LEFT);
::SelectObject(hdc, hOld);
::EndPaint(hwnd, &ps); ::SelectObject(hdc, hOld);
return TRUE; ::EndPaint(hwnd, &ps);
}
} return TRUE;
return ::CallWindowProc(_oldProc, hwnd, Message, wParam, lParam); }
}
return ::CallWindowProc(_oldProc, hwnd, Message, wParam, lParam);
} }
void WordStyleDlg::updateGlobalOverrideCtrls() void WordStyleDlg::updateGlobalOverrideCtrls()
{ {
@ -87,8 +87,8 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters *nppParamInst = NppParameters::getInstance();
_hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK); _hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK);
_hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK); _hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK);
_hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK); _hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK);
_hFontNameCombo = ::GetDlgItem(_hSelf, IDC_FONT_COMBO); _hFontNameCombo = ::GetDlgItem(_hSelf, IDC_FONT_COMBO);
_hFontSizeCombo = ::GetDlgItem(_hSelf, IDC_FONTSIZE_COMBO); _hFontSizeCombo = ::GetDlgItem(_hSelf, IDC_FONTSIZE_COMBO);
@ -110,12 +110,12 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{ {
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i); pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i);
int j = ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str()); int j = ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str());
if (! themeInfo.second.compare( nppParamInst->getNppGUI()._themeName ) ) if (! themeInfo.second.compare( nppParamInst->getNppGUI()._themeName ) )
{ {
_currentThemeIndex = j; _currentThemeIndex = j;
_themeName.assign(themeInfo.second); _themeName.assign(themeInfo.second);
} }
if (! themeInfo.first.compare(TEXT("Default")) ) if (! themeInfo.first.compare(TEXT("Default")) )
{ {
defaultThemeIndex = j; defaultThemeIndex = j;
} }
@ -141,16 +141,15 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
_pFgColour->init(_hInst, _hSelf); _pFgColour->init(_hInst, _hSelf);
_pBgColour->init(_hInst, _hSelf); _pBgColour->init(_hInst, _hSelf);
POINT p1, p2; POINT p1, p2;
alignWith(_hFgColourStaticText, _pFgColour->getHSelf(), PosAlign::right, p1);
alignWith(_hBgColourStaticText, _pBgColour->getHSelf(), PosAlign::right, p2);
alignWith(_hFgColourStaticText, _pFgColour->getHSelf(), ALIGNPOS_RIGHT, p1); p1.x = p2.x = ((p1.x > p2.x)?p1.x:p2.x) + 10;
alignWith(_hBgColourStaticText, _pBgColour->getHSelf(), ALIGNPOS_RIGHT, p2); p1.y -= 4; p2.y -= 4;
p1.x = p2.x = ((p1.x > p2.x)?p1.x:p2.x) + 10; ::MoveWindow((HWND)_pFgColour->getHSelf(), p1.x, p1.y, 25, 25, TRUE);
p1.y -= 4; p2.y -= 4; ::MoveWindow((HWND)_pBgColour->getHSelf(), p2.x, p2.y, 25, 25, TRUE);
::MoveWindow((HWND)_pFgColour->getHSelf(), p1.x, p1.y, 25, 25, TRUE);
::MoveWindow((HWND)_pBgColour->getHSelf(), p2.x, p2.y, 25, 25, TRUE);
_pFgColour->display(); _pFgColour->display();
_pBgColour->display(); _pBgColour->display();
@ -170,7 +169,6 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
goToCenter(); goToCenter();
loadLangListFromNppParam(); loadLangListFromNppParam();
return TRUE; return TRUE;
} }
@ -193,10 +191,10 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
return TRUE; return TRUE;
} }
case WM_COMMAND : case WM_COMMAND :
{ {
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
{ {
int editID = LOWORD(wParam); int editID = LOWORD(wParam);
if (editID == IDC_USER_KEYWORDS_EDIT) if (editID == IDC_USER_KEYWORDS_EDIT)
{ {
@ -237,21 +235,21 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
if (_isDirty) if (_isDirty)
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters *nppParamInst = NppParameters::getInstance();
if (_restoreInvalid) if (_restoreInvalid)
{ {
generic_string str( nppParamInst->getNppGUI()._themeName ); generic_string str( nppParamInst->getNppGUI()._themeName );
nppParamInst->reloadStylers( &str[0] ); nppParamInst->reloadStylers( &str[0] );
} }
LexerStylerArray & lsArray = nppParamInst->getLStylerArray(); LexerStylerArray & lsArray = nppParamInst->getLStylerArray();
StyleArray & globalStyles = nppParamInst->getGlobalStylers(); StyleArray & globalStyles = nppParamInst->getGlobalStylers();
if (_restoreInvalid) if (_restoreInvalid)
{ {
_lsArray = _styles2restored = lsArray; _lsArray = _styles2restored = lsArray;
_globalStyles = _gstyles2restored = globalStyles; _globalStyles = _gstyles2restored = globalStyles;
} }
else else
{ {
globalStyles = _globalStyles = _gstyles2restored; globalStyles = _globalStyles = _gstyles2restored;
lsArray = _lsArray = _styles2restored; lsArray = _lsArray = _styles2restored;
@ -264,7 +262,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
_isThemeDirty = false; _isThemeDirty = false;
setVisualFromStyleList(); setVisualFromStyleList();
//(nppParamInst->getNppGUI())._themeName //(nppParamInst->getNppGUI())._themeName
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0); ::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
@ -297,7 +295,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
return TRUE; return TRUE;
} }
case IDC_SC_TRANSPARENT_CHECK : case IDC_SC_TRANSPARENT_CHECK :
{ {
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_SC_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_SC_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0));
@ -355,7 +353,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
apply(); apply();
return TRUE; return TRUE;
} }
case IDC_GLOBAL_ITALIC_CHECK : case IDC_GLOBAL_ITALIC_CHECK :
{ {
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
@ -416,7 +414,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
return TRUE; return TRUE;
} }
case CPN_COLOURPICKED: case CPN_COLOURPICKED:
{ {
if ((HWND)lParam == _pFgColour->getHSelf()) if ((HWND)lParam == _pFgColour->getHSelf())
{ {
@ -467,17 +465,17 @@ void WordStyleDlg::loadLangListFromNppParam()
{ {
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters *nppParamInst = NppParameters::getInstance();
_lsArray = nppParamInst->getLStylerArray(); _lsArray = nppParamInst->getLStylerArray();
_globalStyles = nppParamInst->getGlobalStylers(); _globalStyles = nppParamInst->getGlobalStylers();
// Clean up Language List // Clean up Language List
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles")); ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles"));
// All the lexers // All the lexers
for (int i = 0, nb = _lsArray.getNbLexer() ; i < nb ; ++i) for (int i = 0, nb = _lsArray.getNbLexer() ; i < nb ; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i)); ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i));
} }
const int index2Begin = 0; const int index2Begin = 0;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_SETCURSEL, 0, index2Begin); ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_SETCURSEL, 0, index2Begin);
@ -491,7 +489,7 @@ void WordStyleDlg::updateThemeName(generic_string themeName)
nppGUI._themeName.assign( themeName ); nppGUI._themeName.assign( themeName );
} }
int WordStyleDlg::whichTabColourIndex() int WordStyleDlg::whichTabColourIndex()
{ {
int i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); int i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
if (i == LB_ERR) if (i == LB_ERR)
@ -582,7 +580,7 @@ void WordStyleDlg::updateUserKeywords()
void WordStyleDlg::updateFontName() void WordStyleDlg::updateFontName()
{ {
Style & style = getCurrentStyler(); Style & style = getCurrentStyler();
int iFontSel = ::SendMessage(_hFontNameCombo, CB_GETCURSEL, 0, 0); int iFontSel = ::SendMessage(_hFontNameCombo, CB_GETCURSEL, 0, 0);
TCHAR *fnStr = (TCHAR *)::SendMessage(_hFontNameCombo, CB_GETITEMDATA, iFontSel, 0); TCHAR *fnStr = (TCHAR *)::SendMessage(_hFontNameCombo, CB_GETITEMDATA, iFontSel, 0);
style._fontName = fnStr; style._fontName = fnStr;
@ -590,7 +588,7 @@ void WordStyleDlg::updateFontName()
void WordStyleDlg::updateFontStyleStatus(fontStyleType whitchStyle) void WordStyleDlg::updateFontStyleStatus(fontStyleType whitchStyle)
{ {
Style & style = getCurrentStyler(); Style & style = getCurrentStyler();
if (style._fontStyle == STYLE_NOT_USED) if (style._fontStyle == STYLE_NOT_USED)
style._fontStyle = FONTSTYLE_NONE; style._fontStyle = FONTSTYLE_NONE;
@ -624,11 +622,11 @@ void WordStyleDlg::switchToTheme()
generic_string prevThemeName(_themeName); generic_string prevThemeName(_themeName);
_themeName.clear(); _themeName.clear();
NppParameters *nppParamInst = NppParameters::getInstance(); NppParameters *nppParamInst = NppParameters::getInstance();
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher();
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(iSel); pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(iSel);
_themeName = themeInfo.second; _themeName = themeInfo.second;
if (_isThemeDirty) if (_isThemeDirty)
{ {
@ -638,7 +636,7 @@ void WordStyleDlg::switchToTheme()
PathRemoveExtension(themeFileName); PathRemoveExtension(themeFileName);
int mb_response = int mb_response =
::MessageBox( _hSelf, ::MessageBox( _hSelf,
TEXT(" Unsaved changes are about to be discarded!\n") TEXT(" Unsaved changes are about to be discarded!\n")
TEXT(" Do you want to save your changes before switching themes?"), TEXT(" Do you want to save your changes before switching themes?"),
themeFileName, themeFileName,
MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND ); MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND );
@ -654,10 +652,10 @@ void WordStyleDlg::switchToTheme()
void WordStyleDlg::setStyleListFromLexer(int index) void WordStyleDlg::setStyleListFromLexer(int index)
{ {
_currentLexerIndex = index; _currentLexerIndex = index;
// Fill out Styles listbox // Fill out Styles listbox
// Before filling out, we clean it // Before filling out, we clean it
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_RESETCONTENT, 0, 0);
if (index) if (index)
@ -667,39 +665,39 @@ void WordStyleDlg::setStyleListFromLexer(int index)
const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt(); const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt();
::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(ext)); ::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(ext));
// WM_SETTEXT cause sending WM_COMMAND message with EN_CHANGE. // WM_SETTEXT cause sending WM_COMMAND message with EN_CHANGE.
// That makes status dirty, even it shouldn't in this case. // That makes status dirty, even it shouldn't in this case.
// The walk around solution is get the current status before sending WM_SETTEXT, // The walk around solution is get the current status before sending WM_SETTEXT,
// then restore the status after sending this message. // then restore the status after sending this message.
bool isDirty = _isDirty; bool isDirty = _isDirty;
bool isThemeDirty = _isThemeDirty; bool isThemeDirty = _isThemeDirty;
::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(userExt)); ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(userExt));
_isDirty = isDirty; _isDirty = isDirty;
_isThemeDirty = isThemeDirty; _isThemeDirty = isThemeDirty;
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), isDirty || isThemeDirty); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), isDirty || isThemeDirty);
} }
::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT), index?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_STATIC), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_STATIC), index?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_EXT_EDIT), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_EXT_EDIT), index?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_EXT_STATIC), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_EXT_STATIC), index?SW_SHOW:SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PLUSSYMBOL2_STATIC), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_PLUSSYMBOL2_STATIC), index?SW_SHOW:SW_HIDE);
StyleArray & lexerStyler = index?_lsArray.getLexerFromIndex(index-1):_globalStyles; StyleArray & lexerStyler = index?_lsArray.getLexerFromIndex(index-1):_globalStyles;
for (int i = 0, nb = lexerStyler.getNbStyler(); i < nb ; ++i) for (int i = 0, nb = lexerStyler.getNbStyler(); i < nb ; ++i)
{ {
Style & style = lexerStyler.getStyler(i); Style & style = lexerStyler.getStyler(i);
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc); ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc);
} }
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_SETCURSEL, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_SETCURSEL, 0, 0);
setVisualFromStyleList(); setVisualFromStyleList();
} }
void WordStyleDlg::setVisualFromStyleList() void WordStyleDlg::setVisualFromStyleList()
{ {
showGlobalOverrideCtrls(false); showGlobalOverrideCtrls(false);
Style & style = getCurrentStyler(); Style & style = getCurrentStyler();
// Global override style // Global override style
if (style._styleDesc && lstrcmp(style._styleDesc, TEXT("Global override")) == 0) if (style._styleDesc && lstrcmp(style._styleDesc, TEXT("Global override")) == 0)
@ -707,14 +705,14 @@ void WordStyleDlg::setVisualFromStyleList()
showGlobalOverrideCtrls(true); showGlobalOverrideCtrls(true);
} }
//--Warning text //--Warning text
//bool showWarning = ((_currentLexerIndex == 0) && (style._styleID == STYLE_DEFAULT));//?SW_SHOW:SW_HIDE; //bool showWarning = ((_currentLexerIndex == 0) && (style._styleID == STYLE_DEFAULT));//?SW_SHOW:SW_HIDE;
COLORREF c = RGB(0x00, 0x00, 0xFF); COLORREF c = RGB(0x00, 0x00, 0xFF);
TCHAR str[256]; TCHAR str[256];
str[0] = '\0'; str[0] = '\0';
int i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0); int i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0);
if (i == LB_ERR) if (i == LB_ERR)
return; return;
@ -802,7 +800,7 @@ void WordStyleDlg::setVisualFromStyleList()
::SendMessage(_hCheckUnderline, BM_SETCHECK, BST_UNCHECKED, 0); ::SendMessage(_hCheckUnderline, BM_SETCHECK, BST_UNCHECKED, 0);
} }
enableFontStyle(isEnable); enableFontStyle(isEnable);
//-- Default Keywords //-- Default Keywords
@ -827,6 +825,7 @@ void WordStyleDlg::setVisualFromStyleList()
const TCHAR *ckwStr = (style._keywords)?style._keywords->c_str():TEXT(""); const TCHAR *ckwStr = (style._keywords)?style._keywords->c_str():TEXT("");
::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_SETTEXT, 0, (LPARAM)(ckwStr)); ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_SETTEXT, 0, (LPARAM)(ckwStr));
} }
int showOption = shouldBeDisplayed?SW_SHOW:SW_HIDE; int showOption = shouldBeDisplayed?SW_SHOW:SW_HIDE;
::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_KEYWORDS_EDIT), showOption); ::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_KEYWORDS_EDIT), showOption);
::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_KEYWORDS_EDIT),showOption); ::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_KEYWORDS_EDIT),showOption);
@ -834,9 +833,10 @@ void WordStyleDlg::setVisualFromStyleList()
::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_KEYWORDS_STATIC),showOption); ::ShowWindow(::GetDlgItem(_hSelf, IDC_USER_KEYWORDS_STATIC),showOption);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PLUSSYMBOL_STATIC),showOption); ::ShowWindow(::GetDlgItem(_hSelf, IDC_PLUSSYMBOL_STATIC),showOption);
redraw(); redraw();
} }
void WordStyleDlg::create(int dialogID, bool isRTL) void WordStyleDlg::create(int dialogID, bool isRTL)
{ {
StaticDialog::create(dialogID, isRTL); StaticDialog::create(dialogID, isRTL);
@ -845,7 +845,7 @@ void WordStyleDlg::create(int dialogID, bool isRTL)
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_TRANSPARENT_CHECK), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_TRANSPARENT_CHECK), SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), SW_SHOW);
::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200)); ::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200));
::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, 150); ::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, 150);
if (!(BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, BM_GETCHECK, 0, 0))) if (!(BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, BM_GETCHECK, 0, 0)))
@ -853,6 +853,7 @@ void WordStyleDlg::create(int dialogID, bool isRTL)
} }
} }
void WordStyleDlg::apply() void WordStyleDlg::apply()
{ {
LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray(); LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray();

View File

@ -24,8 +24,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <iostream> #include <iostream>
#include <windows.h> #include <windows.h>
#include "Splitter.h" #include "Splitter.h"
@ -38,28 +36,24 @@ bool Splitter::_isVerticalFixedRegistered = false;
#define SPLITTER_SIZE 8 #define SPLITTER_SIZE 8
Splitter::Splitter() : Window()
Splitter::Splitter()
{ {
//hInstance = GetModuleHandle(NULL);
_rect.left = 0; // x axis _rect.left = 0; // x axis
_rect.top = 0; // y axis _rect.top = 0; // y axis
_rect.right = 0; // Width of the spliter. _rect.right = 0; // Width of the spliter.
_rect.bottom = 0; // Height of the spliter _rect.bottom = 0; // Height of the spliter
_isFixed = false;
} }
void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize, void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize, double iSplitRatio, DWORD dwFlags)
double iSplitRatio, DWORD dwFlags)
{ {
if (hPere == NULL) if (hPere == NULL)
{
throw std::runtime_error("Splitter::init : Parameter hPere is null"); throw std::runtime_error("Splitter::init : Parameter hPere is null");
}
if (iSplitRatio < 0) if (iSplitRatio < 0)
{
throw std::runtime_error("Splitter::init : Parameter iSplitRatio shoulds be 0 < ratio < 100"); throw std::runtime_error("Splitter::init : Parameter iSplitRatio shoulds be 0 < ratio < 100");
}
Window::init(hInst, hPere); Window::init(hInst, hPere);
_spiltterSize = splitterSize; _spiltterSize = splitterSize;
@ -183,61 +177,61 @@ void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize,
_isVerticalFixedRegistered = true; _isVerticalFixedRegistered = true;
} }
_hSelf = CreateWindowEx( _hSelf = CreateWindowEx(dwExStyle, wcex.lpszClassName,
dwExStyle, TEXT(""),
wcex.lpszClassName, dwStyle,
TEXT(""), _rect.left, _rect.top, _rect.right, _rect.bottom,
dwStyle, _hParent, NULL, _hInst, this);
_rect.left,
_rect.top,
_rect.right,
_rect.bottom,
_hParent,
NULL,
_hInst,
(LPVOID)this);
if (!_hSelf) if (!_hSelf)
{
throw std::runtime_error("Splitter::init : CreateWindowEx() function return null"); throw std::runtime_error("Splitter::init : CreateWindowEx() function return null");
}
RECT rc; RECT rc;
getClientRect(rc); getClientRect(rc);
//::GetClientRect(_hParent,&rc); //::GetClientRect(_hParent,&rc);
_clickZone2TL.left = rc.left; _clickZone2TL.left = rc.left;
_clickZone2TL.top = rc.top; _clickZone2TL.top = rc.top;
int clickZoneWidth = getClickZone(WIDTH); int clickZoneWidth = getClickZone(WH::width);
int clickZoneHeight = getClickZone(HEIGHT); int clickZoneHeight = getClickZone(WH::height);
_clickZone2TL.right = clickZoneWidth; _clickZone2TL.right = clickZoneWidth;
_clickZone2TL.bottom = clickZoneHeight; _clickZone2TL.bottom = clickZoneHeight;
_clickZone2BR.left = rc.right - clickZoneWidth; _clickZone2BR.left = rc.right - clickZoneWidth;
_clickZone2BR.top = rc.bottom - clickZoneHeight; _clickZone2BR.top = rc.bottom - clickZoneHeight;
_clickZone2BR.right = clickZoneWidth; _clickZone2BR.right = clickZoneWidth;
_clickZone2BR.bottom = clickZoneHeight; _clickZone2BR.bottom = clickZoneHeight;
display(); display();
::SendMessage(_hParent, WM_RESIZE_CONTAINER, _rect.left, _rect.top); ::SendMessage(_hParent, WM_RESIZE_CONTAINER, _rect.left, _rect.top);
} }
// determinated by (_dwFlags & SV_VERTICAL) && _splitterSize
void Splitter::destroy()
{
::DestroyWindow(_hSelf);
}
int Splitter::getClickZone(WH which) int Splitter::getClickZone(WH which)
{ {
// determinated by (_dwFlags & SV_VERTICAL) && _splitterSize
if (_spiltterSize <= 8) if (_spiltterSize <= 8)
{ {
return isVertical()?(which==WIDTH?_spiltterSize:HIEGHT_MINIMAL) return isVertical()
:(which==WIDTH?HIEGHT_MINIMAL:_spiltterSize); ? (which == WH::width ? _spiltterSize : HIEGHT_MINIMAL)
: (which == WH::width ? HIEGHT_MINIMAL : _spiltterSize);
} }
else // (_spiltterSize > 8) else // (_spiltterSize > 8)
{ {
return isVertical()?(which==WIDTH? 8:15) return isVertical()
:(which==WIDTH?15:8); ? ((which == WH::width) ? 8 : 15)
: ((which == WH::width) ? 15 : 8);
} }
} }
LRESULT CALLBACK Splitter::staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK Splitter::staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch(uMsg) switch(uMsg)
@ -260,24 +254,12 @@ LRESULT CALLBACK Splitter::staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
} }
} }
LRESULT CALLBACK Splitter::spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK Splitter::spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) switch (uMsg)
{ {
/* case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
{
::MessageBox(NULL, TEXT(""), TEXT(""), MB_OK);
}
return 0;
case WM_RBUTTONDBLCLK:
{
}
return 0;
*/
case WM_LBUTTONDOWN:
{ {
POINT p; POINT p;
p.x = LOWORD(lParam); p.x = LOWORD(lParam);
@ -300,14 +282,17 @@ LRESULT CALLBACK Splitter::spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lPara
::SetCapture(_hSelf); ::SetCapture(_hSelf);
_isDraged = true; _isDraged = true;
} }
return 0;
} }
return 0;
case WM_RBUTTONDOWN : case WM_RBUTTONDOWN:
::SendMessage(_hParent, WM_DOPOPUPMENU, wParam, lParam); {
return TRUE; ::SendMessage(_hParent, WM_DOPOPUPMENU, wParam, lParam);
return TRUE;
}
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
{ {
POINT p; POINT p;
p.x = LOWORD(lParam); p.x = LOWORD(lParam);
@ -378,7 +363,7 @@ LRESULT CALLBACK Splitter::spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lPara
return 0; return 0;
} }
case WM_LBUTTONUP: case WM_LBUTTONUP:
{ {
if (!_isFixed) if (!_isFixed)
{ {
@ -386,7 +371,8 @@ LRESULT CALLBACK Splitter::spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lPara
} }
return 0; return 0;
} }
case WM_CAPTURECHANGED:
case WM_CAPTURECHANGED:
{ {
if (_isDraged) if (_isDraged)
{ {
@ -397,17 +383,23 @@ LRESULT CALLBACK Splitter::spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lPara
return 0; return 0;
} }
case WM_PAINT : case WM_PAINT:
drawSplitter(); {
return 0; drawSplitter();
return 0;
}
case WM_CLOSE: case WM_CLOSE:
destroy(); {
return 0; destroy();
return 0;
}
} }
return ::DefWindowProc(_hSelf, uMsg, wParam, lParam); return ::DefWindowProc(_hSelf, uMsg, wParam, lParam);
} }
void Splitter::resizeSpliter(RECT *pRect) void Splitter::resizeSpliter(RECT *pRect)
{ {
RECT rect; RECT rect;
@ -437,10 +429,10 @@ void Splitter::resizeSpliter(RECT *pRect)
//if resizeing should be done proportionately. //if resizeing should be done proportionately.
if (_dwFlags & SV_RESIZEWTHPERCNT) if (_dwFlags & SV_RESIZEWTHPERCNT)
{ {
_rect.left = (LONG)((rect.right * _splitPercent)/100); _rect.left = (LONG)((rect.right * _splitPercent)/100);
} }
else // soit la fenetre gauche soit la fenetre droit qui est fixee else // soit la fenetre gauche soit la fenetre droit qui est fixee
_rect.left = getSplitterFixPosX(); _rect.left = getSplitterFixPosX();
} }
@ -449,8 +441,8 @@ void Splitter::resizeSpliter(RECT *pRect)
RECT rc; RECT rc;
getClientRect(rc); getClientRect(rc);
_clickZone2BR.right = getClickZone(WIDTH); _clickZone2BR.right = getClickZone(WH::width);
_clickZone2BR.bottom = getClickZone(HEIGHT); _clickZone2BR.bottom = getClickZone(WH::height);
_clickZone2BR.left = rc.right - _clickZone2BR.right; _clickZone2BR.left = rc.right - _clickZone2BR.right;
_clickZone2BR.top = rc.bottom - _clickZone2BR.bottom; _clickZone2BR.top = rc.bottom - _clickZone2BR.bottom;
@ -460,14 +452,16 @@ void Splitter::resizeSpliter(RECT *pRect)
redraw(); redraw();
} }
void Splitter::gotoTopLeft() void Splitter::gotoTopLeft()
{ {
if ((_dwFlags & SV_ENABLELDBLCLK) && (!_isFixed) && (_splitPercent > 1)) if ((_dwFlags & SV_ENABLELDBLCLK) && (!_isFixed) && (_splitPercent > 1))
{ {
if (_dwFlags & SV_HORIZONTAL) if (_dwFlags & SV_HORIZONTAL)
_rect.top = 1; _rect.top = 1;
else else
_rect.left = 1; _rect.left = 1;
_splitPercent = 1; _splitPercent = 1;
::SendMessage(_hParent, WM_RESIZE_CONTAINER, _rect.left, _rect.top); ::SendMessage(_hParent, WM_RESIZE_CONTAINER, _rect.left, _rect.top);
@ -476,6 +470,7 @@ void Splitter::gotoTopLeft()
} }
} }
void Splitter::gotoRightBouuom() void Splitter::gotoRightBouuom()
{ {
if ((_dwFlags & SV_ENABLERDBLCLK) && (!_isFixed) && (_splitPercent < 99)) if ((_dwFlags & SV_ENABLERDBLCLK) && (!_isFixed) && (_splitPercent < 99))
@ -496,6 +491,7 @@ void Splitter::gotoRightBouuom()
} }
} }
void Splitter::drawSplitter() void Splitter::drawSplitter()
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
@ -506,25 +502,25 @@ void Splitter::drawSplitter()
if ((_spiltterSize >= 4) && (_dwFlags & SV_RESIZEWTHPERCNT)) if ((_spiltterSize >= 4) && (_dwFlags & SV_RESIZEWTHPERCNT))
{ {
adjustZoneToDraw(TLrc, TOP_LEFT); adjustZoneToDraw(TLrc, ZONE_TYPE::topLeft);
adjustZoneToDraw(BRrc, BOTTOM_RIGHT); adjustZoneToDraw(BRrc, ZONE_TYPE::bottomRight);
paintArrow(hdc, TLrc, isVertical()?ARROW_LEFT:ARROW_UP); paintArrow(hdc, TLrc, isVertical() ? Arrow::left : Arrow::up);
} }
if (isVertical()) if (isVertical())
{ {
rcToDraw2.top = (_dwFlags & SV_RESIZEWTHPERCNT)?_clickZone2TL.bottom:0; rcToDraw2.top = (_dwFlags & SV_RESIZEWTHPERCNT) ? _clickZone2TL.bottom : 0;
rcToDraw2.bottom = rcToDraw2.top + 2; rcToDraw2.bottom = rcToDraw2.top + 2;
rcToDraw1.top = rcToDraw2.top + 1; rcToDraw1.top = rcToDraw2.top + 1;
rcToDraw1.bottom = rcToDraw1.top + 2; rcToDraw1.bottom = rcToDraw1.top + 2;
} }
else else
{ {
rcToDraw2.top = 1; rcToDraw2.top = 1;
rcToDraw2.bottom = 3; rcToDraw2.bottom = 3;
rcToDraw1.top = 2; rcToDraw1.top = 2;
rcToDraw1.bottom = 4; rcToDraw1.bottom = 4;
} }
@ -538,10 +534,10 @@ void Splitter::drawSplitter()
{ {
if (isVertical()) if (isVertical())
{ {
rcToDraw2.left = 1; rcToDraw2.left = 1;
rcToDraw2.right = 3; rcToDraw2.right = 3;
rcToDraw1.left = 2; rcToDraw1.left = 2;
rcToDraw1.right = 4; rcToDraw1.right = 4;
} }
else else
@ -563,6 +559,7 @@ void Splitter::drawSplitter()
rcToDraw1.left += 4; rcToDraw1.left += 4;
rcToDraw1.right += 4; rcToDraw1.right += 4;
} }
rcToDraw2.top += 4; rcToDraw2.top += 4;
rcToDraw2.bottom += 4; rcToDraw2.bottom += 4;
rcToDraw1.top += 4; rcToDraw1.top += 4;
@ -570,16 +567,18 @@ void Splitter::drawSplitter()
} }
if ((_spiltterSize >= 4) && (_dwFlags & SV_RESIZEWTHPERCNT)) if ((_spiltterSize >= 4) && (_dwFlags & SV_RESIZEWTHPERCNT))
paintArrow(hdc, BRrc, isVertical()?ARROW_RIGHT:ARROW_DOWN); paintArrow(hdc, BRrc, isVertical() ? Arrow::right : Arrow::down);
::EndPaint(_hSelf, &ps); ::EndPaint(_hSelf, &ps);
} }
void Splitter::rotate() void Splitter::rotate()
{ {
if (!_isFixed) if (!_isFixed)
{ {
destroy(); destroy();
if (_dwFlags & SV_HORIZONTAL) if (_dwFlags & SV_HORIZONTAL)
{ {
_dwFlags ^= SV_HORIZONTAL; _dwFlags ^= SV_HORIZONTAL;
@ -590,82 +589,101 @@ void Splitter::rotate()
_dwFlags ^= SV_VERTICAL; _dwFlags ^= SV_VERTICAL;
_dwFlags |= SV_HORIZONTAL; _dwFlags |= SV_HORIZONTAL;
} }
init(_hInst, _hParent, _spiltterSize, _splitPercent, _dwFlags); init(_hInst, _hParent, _spiltterSize, _splitPercent, _dwFlags);
} }
} }
void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir) void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
{ {
RECT rc; RECT rc;
rc.left = rect.left; rc.top = rect.top; rc.left = rect.left; rc.top = rect.top;
rc.right = rect.right; rc.bottom = rect.bottom; rc.right = rect.right; rc.bottom = rect.bottom;
if (arrowDir == ARROW_LEFT)
{
int x = rc.right;
int y = rc.top;
//::MoveToEx(hdc, x, y, NULL); switch (arrowDir)
for (; (x > rc.left) && (y != rc.bottom) ; x--) {
case Arrow::left:
{ {
::MoveToEx(hdc, x, y++, NULL); int x = rc.right;
::LineTo(hdc, x, rc.bottom--); int y = rc.top;
//::MoveToEx(hdc, x, y, NULL);
for (; (x > rc.left) && (y != rc.bottom) ; --x)
{
::MoveToEx(hdc, x, y++, NULL);
::LineTo(hdc, x, rc.bottom--);
}
break;
} }
}
else if (arrowDir == ARROW_RIGHT)
{
int x = rc.left;
int y = rc.top;
//::MoveToEx(hdc, x, y, NULL); case Arrow::right:
for (; (x < rc.right) && (y != rc.bottom) ; ++x)
{ {
::MoveToEx(hdc, x, y++, NULL); int x = rc.left;
::LineTo(hdc, x, rc.bottom--); int y = rc.top;
//::MoveToEx(hdc, x, y, NULL);
for (; (x < rc.right) && (y != rc.bottom) ; ++x)
{
::MoveToEx(hdc, x, y++, NULL);
::LineTo(hdc, x, rc.bottom--);
}
break;
} }
}
else if (arrowDir == ARROW_UP)
{
int x = rc.left;
int y = rc.bottom;
//::MoveToEx(hdc, x, y, NULL); case Arrow::up:
for (; (y > rc.top) && (x != rc.right) ; y--)
{ {
::MoveToEx(hdc, x++, y, NULL); int x = rc.left;
::LineTo(hdc, rc.right--, y); int y = rc.bottom;
//::MoveToEx(hdc, x, y, NULL);
for (; (y > rc.top) && (x != rc.right) ; --y)
{
::MoveToEx(hdc, x++, y, NULL);
::LineTo(hdc, rc.right--, y);
}
break;
} }
}
else if (arrowDir == ARROW_DOWN)
{
int x = rc.left;
int y = rc.top;
//::MoveToEx(hdc, x, y, NULL); case Arrow::down:
for (; (y < rc.bottom) && (x != rc.right) ; ++y)
{ {
::MoveToEx(hdc, x++, y, NULL); int x = rc.left;
::LineTo(hdc, rc.right--, y); int y = rc.top;
//::MoveToEx(hdc, x, y, NULL);
for (; (y < rc.bottom) && (x != rc.right) ; ++y)
{
::MoveToEx(hdc, x++, y, NULL);
::LineTo(hdc, rc.right--, y);
}
break;
} }
} }
} }
void Splitter::adjustZoneToDraw(RECT & rc2def, ZONE_TYPE whichZone)
void Splitter::adjustZoneToDraw(RECT& rc2def, ZONE_TYPE whichZone)
{ {
if (_spiltterSize < 4) return; if (_spiltterSize < 4)
return;
int x0, y0, x1, y1, w, h; int x0, y0, x1, y1, w, h;
if ((4 <= _spiltterSize) && (_spiltterSize <= 8)) if ((4 <= _spiltterSize) && (_spiltterSize <= 8))
{ {
w = (isVertical()?4:7); w = (isVertical() ? 4 : 7);
h = (isVertical()?7:4); h = (isVertical() ? 7 : 4);
} }
else // (_spiltterSize > 8) else // (_spiltterSize > 8)
{ {
w = (isVertical()?6:11); w = (isVertical() ? 6 : 11);
h = (isVertical()?11:6); h = (isVertical() ? 11 : 6);
} }
if (isVertical()) if (isVertical())
{//w=4 h=7 {
if (whichZone == TOP_LEFT) // w=4 h=7
if (whichZone == ZONE_TYPE::topLeft)
{ {
x0 = 0; x0 = 0;
y0 = (_clickZone2TL.bottom - h) / 2; y0 = (_clickZone2TL.bottom - h) / 2;
@ -675,12 +693,14 @@ void Splitter::adjustZoneToDraw(RECT & rc2def, ZONE_TYPE whichZone)
x0 = _clickZone2BR.left + _clickZone2BR.right - w; x0 = _clickZone2BR.left + _clickZone2BR.right - w;
y0 = (_clickZone2BR.bottom - h) / 2 + _clickZone2BR.top; y0 = (_clickZone2BR.bottom - h) / 2 + _clickZone2BR.top;
} }
x1 = x0 + w; x1 = x0 + w;
y1 = y0 + h; y1 = y0 + h;
} }
else // Horizontal else // Horizontal
{//w=7 h=4 {
if (whichZone == TOP_LEFT) //w=7 h=4
if (whichZone == ZONE_TYPE::topLeft)
{ {
x0 = (_clickZone2TL.right - w) / 2; x0 = (_clickZone2TL.right - w) / 2;
y0 = 0; y0 = 0;
@ -690,11 +710,14 @@ void Splitter::adjustZoneToDraw(RECT & rc2def, ZONE_TYPE whichZone)
x0 = ((_clickZone2BR.right - w) / 2) + _clickZone2BR.left; x0 = ((_clickZone2BR.right - w) / 2) + _clickZone2BR.left;
y0 = _clickZone2BR.top + _clickZone2BR.bottom - h; y0 = _clickZone2BR.top + _clickZone2BR.bottom - h;
} }
x1 = x0 + w; x1 = x0 + w;
y1 = y0 + h; y1 = y0 + h;
} }
rc2def.left = x0; rc2def.left = x0;
rc2def.top = y0; rc2def.top = y0;
rc2def.right = x1; rc2def.right = x1;
rc2def.bottom = y1; rc2def.bottom = y1;
} }

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,16 +24,11 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef SPLITTER_H
#define SPLITTER_H
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#include "Window.h" #include "Window.h"
#include "Common.h"
#define SV_HORIZONTAL 0x00000001 #define SV_HORIZONTAL 0x00000001
#define SV_VERTICAL 0x00000002 #define SV_VERTICAL 0x00000002
@ -50,81 +45,90 @@
const int HIEGHT_MINIMAL = 15; const int HIEGHT_MINIMAL = 15;
enum Arrow {ARROW_LEFT, ARROW_UP, ARROW_RIGHT, ARROW_DOWN};
typedef bool WH; enum class Arrow { left, up, right, down };
const bool WIDTH = true;
const bool HEIGHT = false;
typedef bool ZONE_TYPE; enum class WH { height, width };
const bool TOP_LEFT = true;
const bool BOTTOM_RIGHT = false;
enum SplitterMode { enum class ZONE_TYPE { bottomRight, topLeft };
enum class SplitterMode: std::uint8_t
{
DYNAMIC, LEFT_FIX, RIGHT_FIX DYNAMIC, LEFT_FIX, RIGHT_FIX
}; };
class Splitter : public Window class Splitter : public Window
{ {
public: public:
Splitter(); Splitter();
~Splitter(){}; virtual ~Splitter() = default;
void destroy() {
::DestroyWindow(_hSelf); virtual void destroy() override;
};
void resizeSpliter(RECT *pRect = NULL); void resizeSpliter(RECT *pRect = NULL);
void init(HINSTANCE hInst, HWND hPere, int splitterSize, void init(HINSTANCE hInst, HWND hPere, int splitterSize, double iSplitRatio, DWORD dwFlags);
double iSplitRatio, DWORD dwFlags);
void rotate(); void rotate();
int getPhisicalSize() const {
int getPhisicalSize() const
{
return _spiltterSize; return _spiltterSize;
}; }
private: private:
RECT _rect; RECT _rect;
double _splitPercent; double _splitPercent = 0.;
int _spiltterSize; int _spiltterSize = 0;
bool _isDraged; bool _isDraged = false;
DWORD _dwFlags; DWORD _dwFlags = 0;
bool _isFixed; bool _isFixed = false;
static bool _isHorizontalRegistered; static bool _isHorizontalRegistered;
static bool _isVerticalRegistered; static bool _isVerticalRegistered;
static bool _isHorizontalFixedRegistered; static bool _isHorizontalFixedRegistered;
static bool _isVerticalFixedRegistered; static bool _isVerticalFixedRegistered;
RECT _clickZone2TL, _clickZone2BR; RECT _clickZone2TL, _clickZone2BR;
static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK spliterWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
int getClickZone(WH which); int getClickZone(WH which);
void adjustZoneToDraw(RECT & rc2def, ZONE_TYPE whichZone); void adjustZoneToDraw(RECT & rc2def, ZONE_TYPE whichZone);
void drawSplitter(); void drawSplitter();
bool isVertical() const {return (_dwFlags & SV_VERTICAL) != 0;}; bool isVertical() const {return (_dwFlags & SV_VERTICAL) != 0;};
void paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir); void paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir);
void gotoTopLeft(); void gotoTopLeft();
void gotoRightBouuom(); void gotoRightBouuom();
bool isInLeftTopZone(const POINT &p) const { bool isInLeftTopZone(const POINT& p) const
return (((p.x >= _clickZone2TL.left) && (p.x <= _clickZone2TL.left + _clickZone2TL.right)) && {
(p.y >= _clickZone2TL.top) && (p.y <= _clickZone2TL.top + _clickZone2TL.bottom)); return ((p.x >= _clickZone2TL.left)
}; and (p.x <= _clickZone2TL.left + _clickZone2TL.right)
and (p.y >= _clickZone2TL.top)
and (p.y <= _clickZone2TL.top + _clickZone2TL.bottom));
}
bool isInRightBottomZone(const POINT &p) const { bool isInRightBottomZone(const POINT& p) const
return (((p.x >= _clickZone2BR.left) && {
(p.x <= _clickZone2BR.left + _clickZone2BR.right)) && return ((p.x >= _clickZone2BR.left)
(p.y >= _clickZone2BR.top) && and (p.x <= _clickZone2BR.left + _clickZone2BR.right)
(p.y <= _clickZone2BR.top + _clickZone2BR.bottom)); and (p.y >= _clickZone2BR.top)
}; and (p.y <= _clickZone2BR.top + _clickZone2BR.bottom));
}
int getSplitterFixPosX() {
int getSplitterFixPosX() const
{
long result = long(::SendMessage(_hParent, WM_GETSPLITTER_X, 0, 0)); long result = long(::SendMessage(_hParent, WM_GETSPLITTER_X, 0, 0));
return (LOWORD(result) - ((HIWORD(result) == RIGHT_FIX) ? _spiltterSize : 0)); return (LOWORD(result) - ((HIWORD(result) == static_cast<std::uint8_t>(SplitterMode::RIGHT_FIX)) ? _spiltterSize : 0));
}; }
int getSplitterFixPosY() { int getSplitterFixPosY() const
{
long result = long(::SendMessage(_hParent, WM_GETSPLITTER_Y, 0, 0)); long result = long(::SendMessage(_hParent, WM_GETSPLITTER_Y, 0, 0));
return (LOWORD(result) - ((HIWORD(result) == RIGHT_FIX) ? _spiltterSize : 0)); return (LOWORD(result) - ((HIWORD(result) == static_cast<std::uint8_t>(SplitterMode::RIGHT_FIX)) ? _spiltterSize : 0));
}; }
}; };
#endif //SPLITTER_H

View File

@ -24,16 +24,18 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <iostream> #include <iostream>
#include <windows.h> #include <windows.h>
#include "SplitterContainer.h" #include "SplitterContainer.h"
#include <cassert>
bool SplitterContainer::_isRegistered = false; bool SplitterContainer::_isRegistered = false;
void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize,
SplitterMode mode, int ratio, bool isVertical)
void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize, SplitterMode mode, int ratio, bool isVertical)
{ {
//Window::init(hInst, parent); //Window::init(hInst, parent);
_pWin0 = pWin0; _pWin0 = pWin0;
@ -42,9 +44,10 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize,
_splitterMode = mode; _splitterMode = mode;
_ratio = ratio; _ratio = ratio;
_dwSplitterStyle |= isVertical?SV_VERTICAL:SV_HORIZONTAL; _dwSplitterStyle |= isVertical?SV_VERTICAL:SV_HORIZONTAL;
if (_splitterMode != DYNAMIC)
if (_splitterMode != SplitterMode::DYNAMIC)
{ {
_dwSplitterStyle |= SV_FIXED; _dwSplitterStyle |= SV_FIXED;
_dwSplitterStyle &= ~SV_RESIZEWTHPERCNT; _dwSplitterStyle &= ~SV_RESIZEWTHPERCNT;
} }
if (!_isRegistered) if (!_isRegistered)
@ -66,30 +69,63 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize,
splitterContainerClass.lpszClassName = SPC_CLASS_NAME; splitterContainerClass.lpszClassName = SPC_CLASS_NAME;
if (!::RegisterClass(&splitterContainerClass)) if (!::RegisterClass(&splitterContainerClass))
{
throw std::runtime_error(" SplitterContainer::create : RegisterClass() function failed"); throw std::runtime_error(" SplitterContainer::create : RegisterClass() function failed");
}
_isRegistered = true; _isRegistered = true;
} }
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
0, 0, SPC_CLASS_NAME, TEXT("a koi sert?"),
SPC_CLASS_NAME, WS_CHILD | WS_CLIPCHILDREN,
TEXT("a koi sert?"), CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
WS_CHILD | WS_CLIPCHILDREN, _hParent, NULL, _hInst, this);
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
_hParent,
NULL,
_hInst,
(LPVOID)this);
if (!_hSelf) if (!_hSelf)
{
throw std::runtime_error(" SplitterContainer::create : CreateWindowEx() function return null"); throw std::runtime_error(" SplitterContainer::create : CreateWindowEx() function return null");
}
} }
void SplitterContainer::destroy()
{
if (_hPopupMenu)
::DestroyMenu(_hPopupMenu);
_splitter.destroy();
::DestroyWindow(_hSelf);
}
void SplitterContainer::reSizeTo(RECT & rc)
{
_x = rc.left;
_y = rc.top;
::MoveWindow(_hSelf, _x, _y, rc.right, rc.bottom, FALSE);
_splitter.resizeSpliter();
}
void SplitterContainer::display(bool toShow) const
{
Window::display(toShow);
assert(_pWin0 != nullptr);
assert(_pWin1 != nullptr);
_pWin0->display(toShow);
_pWin1->display(toShow);
_splitter.display(toShow);
}
void SplitterContainer::redraw() const
{
assert(_pWin0 != nullptr);
assert(_pWin1 != nullptr);
_pWin0->redraw(true);
_pWin1->redraw(true);
}
void SplitterContainer::rotateTo(DIRECTION direction) void SplitterContainer::rotateTo(DIRECTION direction)
{ {
bool doSwitchWindow = false; bool doSwitchWindow = false;
@ -97,13 +133,13 @@ void SplitterContainer::rotateTo(DIRECTION direction)
{ {
_dwSplitterStyle ^= SV_VERTICAL; _dwSplitterStyle ^= SV_VERTICAL;
_dwSplitterStyle |= SV_HORIZONTAL; _dwSplitterStyle |= SV_HORIZONTAL;
doSwitchWindow = (direction == LEFT); doSwitchWindow = (direction == DIRECTION::LEFT);
} }
else else
{ {
_dwSplitterStyle ^= SV_HORIZONTAL; _dwSplitterStyle ^= SV_HORIZONTAL;
_dwSplitterStyle |= SV_VERTICAL; _dwSplitterStyle |= SV_VERTICAL;
doSwitchWindow = (direction == RIGHT); doSwitchWindow = (direction == DIRECTION::RIGHT);
} }
if (doSwitchWindow) if (doSwitchWindow)
{ {
@ -120,42 +156,54 @@ LRESULT CALLBACK SplitterContainer::staticWinProc(HWND hwnd, UINT message, WPARA
SplitterContainer *pSplitterContainer = NULL; SplitterContainer *pSplitterContainer = NULL;
switch (message) switch (message)
{ {
case WM_NCCREATE : case WM_NCCREATE:
{
pSplitterContainer = (SplitterContainer *)(((LPCREATESTRUCT)lParam)->lpCreateParams); pSplitterContainer = (SplitterContainer *)(((LPCREATESTRUCT)lParam)->lpCreateParams);
pSplitterContainer->_hSelf = hwnd; pSplitterContainer->_hSelf = hwnd;
::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pSplitterContainer); ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pSplitterContainer);
return TRUE; return TRUE;
}
default : default:
{
pSplitterContainer = (SplitterContainer *)::GetWindowLongPtr(hwnd, GWLP_USERDATA); pSplitterContainer = (SplitterContainer *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (!pSplitterContainer) if (!pSplitterContainer)
return ::DefWindowProc(hwnd, message, wParam, lParam); return ::DefWindowProc(hwnd, message, wParam, lParam);
return pSplitterContainer->runProc(message, wParam, lParam); return pSplitterContainer->runProc(message, wParam, lParam);
}
} }
} }
LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam) LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) switch (message)
{ {
case WM_CREATE : case WM_CREATE:
{
_splitter.init(_hInst, _hSelf, _splitterSize, _ratio, _dwSplitterStyle); _splitter.init(_hInst, _hSelf, _splitterSize, _ratio, _dwSplitterStyle);
return TRUE; return TRUE;
}
case WM_COMMAND : case WM_COMMAND:
{ {
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case ROTATION_A_GAUCHE: case ROTATION_A_GAUCHE:
rotateTo(LEFT); {
return TRUE; rotateTo(DIRECTION::LEFT);
break;
}
case ROTATION_A_DROITE: case ROTATION_A_DROITE:
rotateTo(RIGHT); {
return TRUE; rotateTo(DIRECTION::RIGHT);
break;
}
} }
return TRUE; return TRUE;
} }
case WM_RESIZE_CONTAINER :
case WM_RESIZE_CONTAINER:
{ {
RECT rc0, rc1; RECT rc0, rc1;
getClientRect(rc0); getClientRect(rc0);
@ -192,9 +240,9 @@ LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
case WM_DOPOPUPMENU : case WM_DOPOPUPMENU:
{ {
if ((_splitterMode != LEFT_FIX) && (_splitterMode != RIGHT_FIX) ) if ((_splitterMode != SplitterMode::LEFT_FIX) && (_splitterMode != SplitterMode::RIGHT_FIX) )
{ {
POINT p; POINT p;
::GetCursorPos(&p); ::GetCursorPos(&p);
@ -213,36 +261,48 @@ LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
case WM_GETSPLITTER_X : case WM_GETSPLITTER_X:
{ {
if (_splitterMode == LEFT_FIX) switch (_splitterMode)
return MAKELONG(_pWin0->getWidth(), LEFT_FIX); {
else if (_splitterMode == RIGHT_FIX) case SplitterMode::LEFT_FIX:
{ {
int x = getWidth()-_pWin1->getWidth(); return MAKELONG(_pWin0->getWidth(), static_cast<std::uint8_t>(SplitterMode::LEFT_FIX));
if (x < 0) }
x = 0;
return MAKELONG(x, RIGHT_FIX);
}
else
return MAKELONG(0, DYNAMIC);
} case SplitterMode::RIGHT_FIX:
{
int x = getWidth()-_pWin1->getWidth();
if (x < 0)
x = 0;
return MAKELONG(x, static_cast<std::uint8_t>(SplitterMode::RIGHT_FIX));
}
default:
break;
}
return MAKELONG(0, static_cast<std::uint8_t>(SplitterMode::DYNAMIC));
}
case WM_GETSPLITTER_Y : case WM_GETSPLITTER_Y:
{ {
if (_splitterMode == LEFT_FIX) switch (_splitterMode)
return MAKELONG(_pWin0->getHeight(), LEFT_FIX); {
else if (_splitterMode == RIGHT_FIX) case SplitterMode::LEFT_FIX:
{ {
int y = getHeight()-_pWin1->getHeight(); return MAKELONG(_pWin0->getHeight(), static_cast<std::uint8_t>(SplitterMode::LEFT_FIX));
if (y < 0) }
y = 0; case SplitterMode::RIGHT_FIX:
return MAKELONG(y, RIGHT_FIX); {
} int y = getHeight()-_pWin1->getHeight();
else if (y < 0)
return MAKELONG(0, DYNAMIC); y = 0;
} return MAKELONG(y, static_cast<std::uint8_t>(SplitterMode::RIGHT_FIX));
}
default:
break;
}
return MAKELONG(0, static_cast<std::uint8_t>(SplitterMode::DYNAMIC));
}
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
{ {
@ -250,21 +310,18 @@ LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam)
::GetCursorPos(&pt); ::GetCursorPos(&pt);
::ScreenToClient(_splitter.getHSelf(), &pt); ::ScreenToClient(_splitter.getHSelf(), &pt);
Window* targetWindow;
if(this->isVertical())
targetWindow = pt.x < 0?_pWin0:_pWin1;
else
targetWindow = pt.y < 0?_pWin0:_pWin1;
HWND parent = ::GetParent(getHSelf()); HWND parent = ::GetParent(getHSelf());
Window* targetWindow = (this->isVertical())
? (pt.x < 0 ? _pWin0 : _pWin1)
: (pt.y < 0 ? _pWin0 : _pWin1);
::SendMessage(parent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)targetWindow->getHSelf()); ::SendMessage(parent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)targetWindow->getHSelf());
::SendMessage(parent, WM_COMMAND, IDM_FILE_NEW, 0); ::SendMessage(parent, WM_COMMAND, IDM_FILE_NEW, 0);
return TRUE; return TRUE;
} }
default : default:
return ::DefWindowProc(_hSelf, message, wParam, lParam); return ::DefWindowProc(_hSelf, message, wParam, lParam);
} }
} }

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,94 +24,74 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef SPLITTER_CONTAINER_H
#define SPLITTER_CONTAINER_H
#ifndef SPLITTER_H
#include "Splitter.h" #include "Splitter.h"
#endif //SPLITTER_H
#ifndef MENUCMDID_H
#include "menuCmdID.h" #include "menuCmdID.h"
#endif //MENUCMDID_H
#define SPC_CLASS_NAME TEXT("splitterContainer") #define SPC_CLASS_NAME TEXT("splitterContainer")
#define ROTATION_A_GAUCHE 2000 #define ROTATION_A_GAUCHE 2000
#define ROTATION_A_DROITE 2001 #define ROTATION_A_DROITE 2001
typedef bool DIRECTION;
const bool LEFT = true; enum class DIRECTION
const bool RIGHT = false; {
RIGHT,
LEFT
};
class SplitterContainer : public Window class SplitterContainer : public Window
{ {
public : public :
SplitterContainer(): Window(), _x(0), _y(0), _hPopupMenu(NULL), virtual ~SplitterContainer() = default;
_dwSplitterStyle(SV_ENABLERDBLCLK | SV_ENABLELDBLCLK | SV_RESIZEWTHPERCNT){
};
~SplitterContainer(){};
void create(Window *pWin0, Window *pWin1, int splitterSize = 4, void create(Window *pWin0, Window *pWin1, int splitterSize = 4,
SplitterMode mode = DYNAMIC, int ratio = 50, bool _isVertical = true); SplitterMode mode = SplitterMode::DYNAMIC, int ratio = 50, bool _isVertical = true);
void destroy() { void destroy();
if (_hPopupMenu)
::DestroyMenu(_hPopupMenu);
_splitter.destroy();
::DestroyWindow(_hSelf);
};
void reSizeTo(RECT & rc) {
_x = rc.left;
_y = rc.top;
::MoveWindow(_hSelf, _x, _y, rc.right, rc.bottom, FALSE);
_splitter.resizeSpliter();
};
virtual void display(bool toShow = true) const {
Window::display(toShow);
_pWin0->display(toShow);
_pWin1->display(toShow);
_splitter.display(toShow);
};
virtual void redraw() const {
_pWin0->redraw(true);
_pWin1->redraw(true);
};
void setWin0(Window *pWin) { void reSizeTo(RECT & rc);
_pWin0 = pWin;
}; virtual void display(bool toShow = true) const;
void setWin1(Window *pWin) { virtual void redraw() const;
_pWin1 = pWin;
};
bool isVertical() const { void setWin0(Window* pWin)
{
_pWin0 = pWin;
}
void setWin1(Window* pWin)
{
_pWin1 = pWin;
}
bool isVertical() const
{
return ((_dwSplitterStyle & SV_VERTICAL) != 0); return ((_dwSplitterStyle & SV_VERTICAL) != 0);
}; }
private : private :
Window *_pWin0; // left or top window Window* _pWin0 = nullptr; // left or top window
Window *_pWin1; // right or bottom window Window* _pWin1 = nullptr; // right or bottom window
Splitter _splitter; Splitter _splitter;
int _splitterSize; int _splitterSize = 0;
int _ratio; int _ratio = 0;
int _x, _y; int _x = 0;
HMENU _hPopupMenu; int _y = 0;
DWORD _dwSplitterStyle; HMENU _hPopupMenu = NULL;
DWORD _dwSplitterStyle = (SV_ENABLERDBLCLK | SV_ENABLELDBLCLK | SV_RESIZEWTHPERCNT);
SplitterMode _splitterMode; SplitterMode _splitterMode = SplitterMode::DYNAMIC;
static bool _isRegistered; static bool _isRegistered;
static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam);
void rotateTo(DIRECTION direction); void rotateTo(DIRECTION direction);
}; };
#endif //SPLITTER_CONTAINER_H

View File

@ -29,14 +29,51 @@
#include <windows.h> #include <windows.h>
#include "StaticDialog.h" #include "StaticDialog.h"
StaticDialog::~StaticDialog()
{
if (isCreated())
{
// Prevent run_dlgProc from doing anything, since its virtual
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR) NULL);
destroy();
}
}
void StaticDialog::destroy()
{
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_hSelf);
::DestroyWindow(_hSelf);
}
POINT StaticDialog::getTopPoint(HWND hwnd, bool isLeft) const
{
RECT rc;
::GetWindowRect(hwnd, &rc);
POINT p;
if (isLeft)
p.x = rc.left;
else
p.x = rc.right;
p.y = rc.top;
::ScreenToClient(_hSelf, &p);
return p;
}
void StaticDialog::goToCenter() void StaticDialog::goToCenter()
{ {
RECT rc; RECT rc;
::GetClientRect(_hParent, &rc); ::GetClientRect(_hParent, &rc);
POINT center; POINT center;
center.x = rc.left + (rc.right - rc.left)/2; center.x = rc.left + (rc.right - rc.left)/2;
center.y = rc.top + (rc.bottom - rc.top)/2; center.y = rc.top + (rc.bottom - rc.top)/2;
::ClientToScreen(_hParent, &center); ::ClientToScreen(_hParent, &center);
int x = center.x - (_rc.right - _rc.left)/2; int x = center.x - (_rc.right - _rc.left)/2;
int y = center.y - (_rc.bottom - _rc.top)/2; int y = center.y - (_rc.bottom - _rc.top)/2;
@ -47,7 +84,8 @@ void StaticDialog::goToCenter()
void StaticDialog::display(bool toShow) const void StaticDialog::display(bool toShow) const
{ {
if (toShow) { if (toShow)
{
// If the user has switched from a dual monitor to a single monitor since we last // If the user has switched from a dual monitor to a single monitor since we last
// displayed the dialog, then ensure that it's still visible on the single monitor. // displayed the dialog, then ensure that it's still visible on the single monitor.
RECT workAreaRect = {0}; RECT workAreaRect = {0};
@ -57,6 +95,7 @@ void StaticDialog::display(bool toShow) const
int newLeft = rc.left; int newLeft = rc.left;
int newTop = rc.top; int newTop = rc.top;
int margin = ::GetSystemMetrics(SM_CYSMCAPTION); int margin = ::GetSystemMetrics(SM_CYSMCAPTION);
if (newLeft > ::GetSystemMetrics(SM_CXVIRTUALSCREEN)-margin) if (newLeft > ::GetSystemMetrics(SM_CXVIRTUALSCREEN)-margin)
newLeft -= rc.right - workAreaRect.right; newLeft -= rc.right - workAreaRect.right;
if (newLeft + (rc.right - rc.left) < ::GetSystemMetrics(SM_XVIRTUALSCREEN)+margin) if (newLeft + (rc.right - rc.left) < ::GetSystemMetrics(SM_XVIRTUALSCREEN)+margin)
@ -131,22 +170,23 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent)
::SendMessage(msgDestParent?_hParent:(::GetParent(_hParent)), NPPM_MODELESSDIALOG, MODELESSDIALOGADD, (WPARAM)_hSelf); ::SendMessage(msgDestParent?_hParent:(::GetParent(_hParent)), NPPM_MODELESSDIALOG, MODELESSDIALOGADD, (WPARAM)_hSelf);
} }
INT_PTR CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG:
{ {
StaticDialog *pStaticDlg = (StaticDialog *)(lParam); StaticDialog *pStaticDlg = (StaticDialog *)(lParam);
pStaticDlg->_hSelf = hwnd; pStaticDlg->_hSelf = hwnd;
::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)lParam); ::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)lParam);
::GetWindowRect(hwnd, &(pStaticDlg->_rc)); ::GetWindowRect(hwnd, &(pStaticDlg->_rc));
pStaticDlg->run_dlgProc(message, wParam, lParam); pStaticDlg->run_dlgProc(message, wParam, lParam);
return TRUE; return TRUE;
} }
default : default:
{ {
StaticDialog *pStaticDlg = reinterpret_cast<StaticDialog *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); StaticDialog *pStaticDlg = reinterpret_cast<StaticDialog *>(::GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (!pStaticDlg) if (!pStaticDlg)
@ -158,34 +198,39 @@ INT_PTR CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, L
void StaticDialog::alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT & point) void StaticDialog::alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT & point)
{ {
RECT rc, rc2; RECT rc, rc2;
::GetWindowRect(handle, &rc); ::GetWindowRect(handle, &rc);
point.x = rc.left; point.x = rc.left;
point.y = rc.top; point.y = rc.top;
switch (pos) switch (pos)
{ {
case ALIGNPOS_LEFT : case PosAlign::left:
::GetWindowRect(handle2Align, &rc2); {
point.x -= rc2.right - rc2.left; ::GetWindowRect(handle2Align, &rc2);
break; point.x -= rc2.right - rc2.left;
break;
}
case PosAlign::right:
{
::GetWindowRect(handle, &rc2);
point.x += rc2.right - rc2.left;
break;
}
case PosAlign::top:
{
::GetWindowRect(handle2Align, &rc2);
point.y -= rc2.bottom - rc2.top;
break;
}
case PosAlign::bottom:
{
::GetWindowRect(handle, &rc2);
point.y += rc2.bottom - rc2.top;
break;
}
}
case ALIGNPOS_RIGHT : ::ScreenToClient(_hSelf, &point);
::GetWindowRect(handle, &rc2);
point.x += rc2.right - rc2.left;
break;
case ALIGNPOS_TOP :
::GetWindowRect(handle2Align, &rc2);
point.y -= rc2.bottom - rc2.top;
break;
default : //ALIGNPOS_BOTTOM
::GetWindowRect(handle, &rc2);
point.y += rc2.bottom - rc2.top;
break;
}
::ScreenToClient(_hSelf, &point);
} }

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,81 +24,64 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef STATIC_DIALOG_H
#define STATIC_DIALOG_H
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
#include "Window.h" #include "Window.h"
typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD); typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD);
enum PosAlign{ALIGNPOS_LEFT, ALIGNPOS_RIGHT, ALIGNPOS_TOP, ALIGNPOS_BOTTOM}; enum class PosAlign { left, right, top, bottom };
struct DLGTEMPLATEEX {
struct DLGTEMPLATEEX
{
WORD dlgVer; WORD dlgVer;
WORD signature; WORD signature;
DWORD helpID; DWORD helpID;
DWORD exStyle; DWORD exStyle;
DWORD style; DWORD style;
WORD cDlgItems; WORD cDlgItems;
short x; short x;
short y; short y;
short cx; short cx;
short cy; short cy;
// The structure has more fields but are variable length // The structure has more fields but are variable length
} ; };
class StaticDialog : public Window class StaticDialog : public Window
{ {
public : public :
StaticDialog() : Window() {}; virtual ~StaticDialog();
~StaticDialog(){
if (isCreated()) {
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)NULL); //Prevent run_dlgProc from doing anything, since its virtual
destroy();
}
};
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true); virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true);
virtual bool isCreated() const { virtual bool isCreated() const
{
return (_hSelf != NULL); return (_hSelf != NULL);
}; }
void goToCenter(); void goToCenter();
void display(bool toShow = true) const; void display(bool toShow = true) const;
POINT getTopPoint(HWND hwnd, bool isLeft = true) const { POINT getTopPoint(HWND hwnd, bool isLeft = true) const;
RECT rc;
::GetWindowRect(hwnd, &rc);
POINT p;
if (isLeft)
p.x = rc.left;
else
p.x = rc.right;
p.y = rc.top;
::ScreenToClient(_hSelf, &p);
return p;
};
bool isCheckedOrNot(int checkControlID) const { bool isCheckedOrNot(int checkControlID) const
{
return (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, checkControlID), BM_GETCHECK, 0, 0)); return (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, checkControlID), BM_GETCHECK, 0, 0));
}; }
void destroy() { virtual void destroy() override;
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_hSelf);
::DestroyWindow(_hSelf);
};
protected :
protected:
RECT _rc; RECT _rc;
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0; virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0;
void alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT & point); void alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT & point);
HGLOBAL makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate); HGLOBAL makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate);
}; };
#endif //STATIC_DIALOG_H

View File

@ -33,7 +33,13 @@
class Window class Window
{ {
public: public:
//! \name Constructors & Destructor
//@{
Window() = default;
Window(const Window&) = delete;
virtual ~Window() = default; virtual ~Window() = default;
//@}
virtual void init(HINSTANCE hInst, HWND parent) virtual void init(HINSTANCE hInst, HWND parent)
{ {
@ -123,6 +129,9 @@ public:
} }
Window& operator = (const Window&) = delete;
protected: protected:
HINSTANCE _hInst = NULL; HINSTANCE _hInst = NULL;
HWND _hParent = NULL; HWND _hParent = NULL;

View File

@ -7,10 +7,10 @@
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// Note that the GPL places important restrictions on "derived works", yet // Note that the GPL places important restrictions on "derived works", yet
// it does not provide a detailed definition of that term. To avoid // it does not provide a detailed definition of that term. To avoid
// misunderstandings, we consider an application to constitute a // misunderstandings, we consider an application to constitute a
// "derivative work" for the purpose of this license if it does any of the // "derivative work" for the purpose of this license if it does any of the
// following: // following:
// 1. Integrates source code from Notepad++. // 1. Integrates source code from Notepad++.
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
// installer, such as those produced by InstallShield. // installer, such as those produced by InstallShield.
@ -24,178 +24,176 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef RESOURCE_H
#define RESOURCE_H
#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v6.8.1") #define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v6.8.1")
// should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
// should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
// ex : #define VERSION_VALUE TEXT("5.63\0") // ex : #define VERSION_VALUE TEXT("5.63\0")
#define VERSION_VALUE TEXT("6.8.1\0") #define VERSION_VALUE TEXT("6.8.1\0")
#define VERSION_DIGITALVALUE 6, 8, 1, 0 #define VERSION_DIGITALVALUE 6, 8, 1, 0
#ifndef IDC_STATIC #ifndef IDC_STATIC
#define IDC_STATIC -1 #define IDC_STATIC -1
#endif #endif
#define IDI_M30ICON 100 #define IDI_M30ICON 100
#define IDI_CHAMELEON 101 #define IDI_CHAMELEON 101
//#define IDI_JESUISCHARLIE 102 //#define IDI_JESUISCHARLIE 102
#define IDR_RT_MANIFEST 103 #define IDR_RT_MANIFEST 103
#define IDI_NEW_OFF_ICON 201 #define IDI_NEW_OFF_ICON 201
#define IDI_OPEN_OFF_ICON 202 #define IDI_OPEN_OFF_ICON 202
#define IDI_CLOSE_OFF_ICON 203 #define IDI_CLOSE_OFF_ICON 203
#define IDI_CLOSEALL_OFF_ICON 204 #define IDI_CLOSEALL_OFF_ICON 204
#define IDI_SAVE_OFF_ICON 205 #define IDI_SAVE_OFF_ICON 205
#define IDI_SAVEALL_OFF_ICON 206 #define IDI_SAVEALL_OFF_ICON 206
#define IDI_CUT_OFF_ICON 207 #define IDI_CUT_OFF_ICON 207
#define IDI_COPY_OFF_ICON 208 #define IDI_COPY_OFF_ICON 208
#define IDI_PASTE_OFF_ICON 209 #define IDI_PASTE_OFF_ICON 209
#define IDI_UNDO_OFF_ICON 210 #define IDI_UNDO_OFF_ICON 210
#define IDI_REDO_OFF_ICON 211 #define IDI_REDO_OFF_ICON 211
#define IDI_FIND_OFF_ICON 212 #define IDI_FIND_OFF_ICON 212
#define IDI_REPLACE_OFF_ICON 213 #define IDI_REPLACE_OFF_ICON 213
#define IDI_ZOOMIN_OFF_ICON 214 #define IDI_ZOOMIN_OFF_ICON 214
#define IDI_ZOOMOUT_OFF_ICON 215 #define IDI_ZOOMOUT_OFF_ICON 215
#define IDI_VIEW_UD_DLG_OFF_ICON 216 #define IDI_VIEW_UD_DLG_OFF_ICON 216
#define IDI_PRINT_OFF_ICON 217 #define IDI_PRINT_OFF_ICON 217
#define IDI_VIEW_ALL_CHAR_ON_ICON 218 #define IDI_VIEW_ALL_CHAR_ON_ICON 218
#define IDI_VIEW_INDENT_ON_ICON 219 #define IDI_VIEW_INDENT_ON_ICON 219
#define IDI_VIEW_WRAP_ON_ICON 220 #define IDI_VIEW_WRAP_ON_ICON 220
#define IDI_STARTRECORD_OFF_ICON 221 #define IDI_STARTRECORD_OFF_ICON 221
#define IDI_STARTRECORD_ON_ICON 222 #define IDI_STARTRECORD_ON_ICON 222
#define IDI_STARTRECORD_DISABLE_ICON 223 #define IDI_STARTRECORD_DISABLE_ICON 223
#define IDI_STOPRECORD_OFF_ICON 224 #define IDI_STOPRECORD_OFF_ICON 224
#define IDI_STOPRECORD_ON_ICON 225 #define IDI_STOPRECORD_ON_ICON 225
#define IDI_STOPRECORD_DISABLE_ICON 226 #define IDI_STOPRECORD_DISABLE_ICON 226
#define IDI_PLAYRECORD_OFF_ICON 227 #define IDI_PLAYRECORD_OFF_ICON 227
#define IDI_PLAYRECORD_ON_ICON 228 #define IDI_PLAYRECORD_ON_ICON 228
#define IDI_PLAYRECORD_DISABLE_ICON 229 #define IDI_PLAYRECORD_DISABLE_ICON 229
#define IDI_SAVERECORD_OFF_ICON 230 #define IDI_SAVERECORD_OFF_ICON 230
#define IDI_SAVERECORD_ON_ICON 231 #define IDI_SAVERECORD_ON_ICON 231
#define IDI_SAVERECORD_DISABLE_ICON 232 #define IDI_SAVERECORD_DISABLE_ICON 232
// multi run macro // multi run macro
#define IDI_MMPLAY_DIS_ICON 233 #define IDI_MMPLAY_DIS_ICON 233
#define IDI_MMPLAY_OFF_ICON 234 #define IDI_MMPLAY_OFF_ICON 234
#define IDI_MMPLAY_ON_ICON 235 #define IDI_MMPLAY_ON_ICON 235
#define IDI_NEW_ON_ICON 301 #define IDI_NEW_ON_ICON 301
#define IDI_OPEN_ON_ICON 302 #define IDI_OPEN_ON_ICON 302
#define IDI_CLOSE_ON_ICON 303 #define IDI_CLOSE_ON_ICON 303
#define IDI_CLOSEALL_ON_ICON 304 #define IDI_CLOSEALL_ON_ICON 304
#define IDI_SAVE_ON_ICON 305 #define IDI_SAVE_ON_ICON 305
#define IDI_SAVEALL_ON_ICON 306 #define IDI_SAVEALL_ON_ICON 306
#define IDI_CUT_ON_ICON 307 #define IDI_CUT_ON_ICON 307
#define IDI_COPY_ON_ICON 308 #define IDI_COPY_ON_ICON 308
#define IDI_PASTE_ON_ICON 309 #define IDI_PASTE_ON_ICON 309
#define IDI_UNDO_ON_ICON 310 #define IDI_UNDO_ON_ICON 310
#define IDI_REDO_ON_ICON 311 #define IDI_REDO_ON_ICON 311
#define IDI_FIND_ON_ICON 312 #define IDI_FIND_ON_ICON 312
#define IDI_REPLACE_ON_ICON 313 #define IDI_REPLACE_ON_ICON 313
#define IDI_ZOOMIN_ON_ICON 314 #define IDI_ZOOMIN_ON_ICON 314
#define IDI_ZOOMOUT_ON_ICON 315 #define IDI_ZOOMOUT_ON_ICON 315
#define IDI_VIEW_UD_DLG_ON_ICON 316 #define IDI_VIEW_UD_DLG_ON_ICON 316
#define IDI_PRINT_ON_ICON 317 #define IDI_PRINT_ON_ICON 317
#define IDI_VIEW_ALL_CHAR_OFF_ICON 318 #define IDI_VIEW_ALL_CHAR_OFF_ICON 318
#define IDI_VIEW_INDENT_OFF_ICON 319 #define IDI_VIEW_INDENT_OFF_ICON 319
#define IDI_VIEW_WRAP_OFF_ICON 320 #define IDI_VIEW_WRAP_OFF_ICON 320
//#define IDI_NEW_DISABLE_ICON 401 //#define IDI_NEW_DISABLE_ICON 401
//#define IDI_OPEN_ON_ICON 402 //#define IDI_OPEN_ON_ICON 402
#define IDI_SAVE_DISABLE_ICON 403 #define IDI_SAVE_DISABLE_ICON 403
#define IDI_SAVEALL_DISABLE_ICON 404 #define IDI_SAVEALL_DISABLE_ICON 404
//#define IDI_CLOSE_ON_ICON 405 //#define IDI_CLOSE_ON_ICON 405
//#define IDI_CLOSEALL_ON_ICON 406 //#define IDI_CLOSEALL_ON_ICON 406
#define IDI_CUT_DISABLE_ICON 407 #define IDI_CUT_DISABLE_ICON 407
#define IDI_COPY_DISABLE_ICON 408 #define IDI_COPY_DISABLE_ICON 408
#define IDI_PASTE_DISABLE_ICON 409 #define IDI_PASTE_DISABLE_ICON 409
#define IDI_UNDO_DISABLE_ICON 410 #define IDI_UNDO_DISABLE_ICON 410
#define IDI_REDO_DISABLE_ICON 411 #define IDI_REDO_DISABLE_ICON 411
#define IDI_DELETE_ICON 412 #define IDI_DELETE_ICON 412
#define IDI_SYNCV_OFF_ICON 413 #define IDI_SYNCV_OFF_ICON 413
#define IDI_SYNCV_ON_ICON 414 #define IDI_SYNCV_ON_ICON 414
#define IDI_SYNCV_DISABLE_ICON 415 #define IDI_SYNCV_DISABLE_ICON 415
#define IDI_SYNCH_OFF_ICON 416 #define IDI_SYNCH_OFF_ICON 416
#define IDI_SYNCH_ON_ICON 417 #define IDI_SYNCH_ON_ICON 417
#define IDI_SYNCH_DISABLE_ICON 418 #define IDI_SYNCH_DISABLE_ICON 418
#define IDI_SAVED_ICON 501 #define IDI_SAVED_ICON 501
#define IDI_UNSAVED_ICON 502 #define IDI_UNSAVED_ICON 502
#define IDI_READONLY_ICON 503 #define IDI_READONLY_ICON 503
#define IDI_FIND_RESULT_ICON 504 #define IDI_FIND_RESULT_ICON 504
#define IDI_PROJECT_WORKSPACE 601 #define IDI_PROJECT_WORKSPACE 601
#define IDI_PROJECT_WORKSPACEDIRTY 602 #define IDI_PROJECT_WORKSPACEDIRTY 602
#define IDI_PROJECT_PROJECT 603 #define IDI_PROJECT_PROJECT 603
#define IDI_PROJECT_FOLDEROPEN 604 #define IDI_PROJECT_FOLDEROPEN 604
#define IDI_PROJECT_FOLDERCLOSE 605 #define IDI_PROJECT_FOLDERCLOSE 605
#define IDI_PROJECT_FILE 606 #define IDI_PROJECT_FILE 606
#define IDI_PROJECT_FILEINVALID 607 #define IDI_PROJECT_FILEINVALID 607
#define IDI_FUNCLIST_ROOT 620 #define IDI_FUNCLIST_ROOT 620
#define IDI_FUNCLIST_NODE 621 #define IDI_FUNCLIST_NODE 621
#define IDI_FUNCLIST_LEAF 622 #define IDI_FUNCLIST_LEAF 622
#define IDI_FUNCLIST_SORTBUTTON 631 #define IDI_FUNCLIST_SORTBUTTON 631
#define IDI_FUNCLIST_RELOADBUTTON 632 #define IDI_FUNCLIST_RELOADBUTTON 632
#define IDC_MY_CUR 1402 #define IDC_MY_CUR 1402
#define IDC_UP_ARROW 1403 #define IDC_UP_ARROW 1403
#define IDC_DRAG_TAB 1404 #define IDC_DRAG_TAB 1404
#define IDC_DRAG_INTERDIT_TAB 1405 #define IDC_DRAG_INTERDIT_TAB 1405
#define IDC_DRAG_PLUS_TAB 1406 #define IDC_DRAG_PLUS_TAB 1406
#define IDC_DRAG_OUT_TAB 1407 #define IDC_DRAG_OUT_TAB 1407
#define IDC_MACRO_RECORDING 1408 #define IDC_MACRO_RECORDING 1408
#define IDR_SAVEALL 1500 #define IDR_SAVEALL 1500
#define IDR_CLOSEFILE 1501 #define IDR_CLOSEFILE 1501
#define IDR_CLOSEALL 1502 #define IDR_CLOSEALL 1502
#define IDR_FIND 1503 #define IDR_FIND 1503
#define IDR_REPLACE 1504 #define IDR_REPLACE 1504
#define IDR_ZOOMIN 1505 #define IDR_ZOOMIN 1505
#define IDR_ZOOMOUT 1506 #define IDR_ZOOMOUT 1506
#define IDR_WRAP 1507 #define IDR_WRAP 1507
#define IDR_INVISIBLECHAR 1508 #define IDR_INVISIBLECHAR 1508
#define IDR_INDENTGUIDE 1509 #define IDR_INDENTGUIDE 1509
#define IDR_SHOWPANNEL 1510 #define IDR_SHOWPANNEL 1510
#define IDR_STARTRECORD 1511 #define IDR_STARTRECORD 1511
#define IDR_STOPRECORD 1512 #define IDR_STOPRECORD 1512
#define IDR_PLAYRECORD 1513 #define IDR_PLAYRECORD 1513
#define IDR_SAVERECORD 1514 #define IDR_SAVERECORD 1514
#define IDR_SYNCV 1515 #define IDR_SYNCV 1515
#define IDR_SYNCH 1516 #define IDR_SYNCH 1516
#define IDR_FILENEW 1517 #define IDR_FILENEW 1517
#define IDR_FILEOPEN 1518 #define IDR_FILEOPEN 1518
#define IDR_FILESAVE 1519 #define IDR_FILESAVE 1519
#define IDR_PRINT 1520 #define IDR_PRINT 1520
#define IDR_CUT 1521 #define IDR_CUT 1521
#define IDR_COPY 1522 #define IDR_COPY 1522
#define IDR_PASTE 1523 #define IDR_PASTE 1523
#define IDR_UNDO 1524 #define IDR_UNDO 1524
#define IDR_REDO 1525 #define IDR_REDO 1525
#define IDR_M_PLAYRECORD 1526 #define IDR_M_PLAYRECORD 1526
#define IDR_DOCMAP 1527 #define IDR_DOCMAP 1527
#define IDR_FUNC_LIST 1528 #define IDR_FUNC_LIST 1528
#define IDR_CLOSETAB 1530 #define IDR_CLOSETAB 1530
#define IDR_CLOSETAB_INACT 1531 #define IDR_CLOSETAB_INACT 1531
#define IDR_CLOSETAB_HOVER 1532 #define IDR_CLOSETAB_HOVER 1532
#define IDR_CLOSETAB_PUSH 1533 #define IDR_CLOSETAB_PUSH 1533
#define IDR_FUNC_LIST_ICO 1534 #define IDR_FUNC_LIST_ICO 1534
#define IDR_DOCMAP_ICO 1535 #define IDR_DOCMAP_ICO 1535
#define IDR_PROJECTPANEL_ICO 1536 #define IDR_PROJECTPANEL_ICO 1536
#define IDR_CLIPBOARDPANEL_ICO 1537 #define IDR_CLIPBOARDPANEL_ICO 1537
#define IDR_ASCIIPANEL_ICO 1538 #define IDR_ASCIIPANEL_ICO 1538
#define IDR_DOCSWITCHER_ICO 1539 #define IDR_DOCSWITCHER_ICO 1539
#define ID_MACRO 20000 #define ID_MACRO 20000
#define ID_MACRO_LIMIT 20200 #define ID_MACRO_LIMIT 20200
@ -207,7 +205,7 @@
#define ID_PLUGINS_CMD_LIMIT 22500 #define ID_PLUGINS_CMD_LIMIT 22500
#define ID_PLUGINS_CMD_DYNAMIC 23000 #define ID_PLUGINS_CMD_DYNAMIC 23000
#define ID_PLUGINS_CMD_DYNAMIC_LIMIT 24999 #define ID_PLUGINS_CMD_DYNAMIC_LIMIT 24999
#define MARKER_PLUGINS 3 #define MARKER_PLUGINS 3
#define MARKER_PLUGINS_LIMIT 19 #define MARKER_PLUGINS_LIMIT 19
@ -220,136 +218,136 @@
//#define IDM 40000 //#define IDM 40000
#define IDCMD 50000 #define IDCMD 50000
//#define IDM_EDIT_AUTOCOMPLETE (IDCMD+0) //#define IDM_EDIT_AUTOCOMPLETE (IDCMD+0)
//#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (IDCMD+1) //#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (IDCMD+1)
#define IDC_PREV_DOC (IDCMD+3)
#define IDC_NEXT_DOC (IDCMD+4)
#define IDC_EDIT_TOGGLEMACRORECORDING (IDCMD+5)
//#define IDC_KEY_HOME (IDCMD+6)
//#define IDC_KEY_END (IDCMD+7)
//#define IDC_KEY_SELECT_2_HOME (IDCMD+8)
//#define IDC_KEY_SELECT_2_END (IDCMD+9)
#define IDCMD_LIMIT (IDCMD+20)
#define IDSCINTILLA 60000 #define IDC_PREV_DOC (IDCMD+3)
#define IDSCINTILLA_KEY_HOME (IDSCINTILLA+0) #define IDC_NEXT_DOC (IDCMD+4)
#define IDSCINTILLA_KEY_HOME_WRAP (IDSCINTILLA+1) #define IDC_EDIT_TOGGLEMACRORECORDING (IDCMD+5)
#define IDSCINTILLA_KEY_END (IDSCINTILLA+2) //#define IDC_KEY_HOME (IDCMD+6)
#define IDSCINTILLA_KEY_END_WRAP (IDSCINTILLA+3) //#define IDC_KEY_END (IDCMD+7)
#define IDSCINTILLA_KEY_LINE_DUP (IDSCINTILLA+4) //#define IDC_KEY_SELECT_2_HOME (IDCMD+8)
#define IDSCINTILLA_KEY_LINE_CUT (IDSCINTILLA+5) //#define IDC_KEY_SELECT_2_END (IDCMD+9)
#define IDSCINTILLA_KEY_LINE_DEL (IDSCINTILLA+6)
#define IDSCINTILLA_KEY_LINE_TRANS (IDSCINTILLA+7)
#define IDSCINTILLA_KEY_LINE_COPY (IDSCINTILLA+8)
#define IDSCINTILLA_KEY_CUT (IDSCINTILLA+9)
#define IDSCINTILLA_KEY_COPY (IDSCINTILLA+10)
#define IDSCINTILLA_KEY_PASTE (IDSCINTILLA+11)
#define IDSCINTILLA_KEY_DEL (IDSCINTILLA+12)
#define IDSCINTILLA_KEY_SELECTALL (IDSCINTILLA+13)
#define IDSCINTILLA_KEY_OUTDENT (IDSCINTILLA+14)
#define IDSCINTILLA_KEY_UNDO (IDSCINTILLA+15)
#define IDSCINTILLA_KEY_REDO (IDSCINTILLA+16)
#define IDSCINTILLA_LIMIT (IDSCINTILLA+30)
#define IDD_FILEVIEW_DIALOG 1000 #define IDCMD_LIMIT (IDCMD+20)
#define IDC_MINIMIZED_TRAY 67001 #define IDSCINTILLA 60000
#define IDSCINTILLA_KEY_HOME (IDSCINTILLA+0)
#define IDSCINTILLA_KEY_HOME_WRAP (IDSCINTILLA+1)
#define IDSCINTILLA_KEY_END (IDSCINTILLA+2)
#define IDSCINTILLA_KEY_END_WRAP (IDSCINTILLA+3)
#define IDSCINTILLA_KEY_LINE_DUP (IDSCINTILLA+4)
#define IDSCINTILLA_KEY_LINE_CUT (IDSCINTILLA+5)
#define IDSCINTILLA_KEY_LINE_DEL (IDSCINTILLA+6)
#define IDSCINTILLA_KEY_LINE_TRANS (IDSCINTILLA+7)
#define IDSCINTILLA_KEY_LINE_COPY (IDSCINTILLA+8)
#define IDSCINTILLA_KEY_CUT (IDSCINTILLA+9)
#define IDSCINTILLA_KEY_COPY (IDSCINTILLA+10)
#define IDSCINTILLA_KEY_PASTE (IDSCINTILLA+11)
#define IDSCINTILLA_KEY_DEL (IDSCINTILLA+12)
#define IDSCINTILLA_KEY_SELECTALL (IDSCINTILLA+13)
#define IDSCINTILLA_KEY_OUTDENT (IDSCINTILLA+14)
#define IDSCINTILLA_KEY_UNDO (IDSCINTILLA+15)
#define IDSCINTILLA_KEY_REDO (IDSCINTILLA+16)
#define IDSCINTILLA_LIMIT (IDSCINTILLA+30)
#define IDD_CREATE_DIRECTORY 1100 #define IDD_FILEVIEW_DIALOG 1000
#define IDC_MINIMIZED_TRAY 67001
#define IDD_CREATE_DIRECTORY 1100
#define IDC_STATIC_CURRENT_FOLDER 1101 #define IDC_STATIC_CURRENT_FOLDER 1101
#define IDC_EDIT_NEW_FOLDER 1102 #define IDC_EDIT_NEW_FOLDER 1102
#define IDD_INSERT_INPUT_TEXT 1200 #define IDD_INSERT_INPUT_TEXT 1200
#define IDC_EDIT_INPUT_VALUE 1201 #define IDC_EDIT_INPUT_VALUE 1201
#define IDC_STATIC_INPUT_TITLE 1202 #define IDC_STATIC_INPUT_TITLE 1202
#define IDC_ICON_INPUT_ICON 1203 #define IDC_ICON_INPUT_ICON 1203
#define IDR_M30_MENU 1500 #define IDR_M30_MENU 1500
#define IDR_SYSTRAYPOPUP_MENU 1501 #define IDR_SYSTRAYPOPUP_MENU 1501
// #define IDD_FIND_REPLACE_DLG 1600 // #define IDD_FIND_REPLACE_DLG 1600
#define IDD_ABOUTBOX 1700 #define IDD_ABOUTBOX 1700
#define IDC_LICENCE_EDIT 1701 #define IDC_LICENCE_EDIT 1701
#define IDC_HOME_ADDR 1702 #define IDC_HOME_ADDR 1702
#define IDC_EMAIL_ADDR 1703 #define IDC_EMAIL_ADDR 1703
#define IDC_ONLINEHELP_ADDR 1704 #define IDC_ONLINEHELP_ADDR 1704
#define IDC_AUTHOR_NAME 1705 #define IDC_AUTHOR_NAME 1705
#define IDC_BUILD_DATETIME 1706 //LS: CompileDateInAboutDialog: Automatically insert compile date as additional version info in About-dialog! #define IDC_BUILD_DATETIME 1706 //LS: CompileDateInAboutDialog: Automatically insert compile date as additional version info in About-dialog!
//#define IDD_USER_DEFINE_BOX 1800 //#define IDD_USER_DEFINE_BOX 1800
//#define IDD_RUN_DLG 1900 //#define IDD_RUN_DLG 1900
#define IDD_GOLINE 2000 #define IDD_GOLINE 2000
#define ID_GOLINE_EDIT (IDD_GOLINE + 1) #define ID_GOLINE_EDIT (IDD_GOLINE + 1)
#define ID_CURRLINE (IDD_GOLINE + 2) #define ID_CURRLINE (IDD_GOLINE + 2)
#define ID_LASTLINE (IDD_GOLINE + 3) #define ID_LASTLINE (IDD_GOLINE + 3)
#define ID_URHERE_STATIC (IDD_GOLINE + 4) #define ID_URHERE_STATIC (IDD_GOLINE + 4)
#define ID_UGO_STATIC (IDD_GOLINE + 5) #define ID_UGO_STATIC (IDD_GOLINE + 5)
#define ID_NOMORETHAN_STATIC (IDD_GOLINE + 6) #define ID_NOMORETHAN_STATIC (IDD_GOLINE + 6)
#define IDC_RADIO_GOTOLINE (IDD_GOLINE + 7) #define IDC_RADIO_GOTOLINE (IDD_GOLINE + 7)
#define IDC_RADIO_GOTOOFFSET (IDD_GOLINE + 8) #define IDC_RADIO_GOTOOFFSET (IDD_GOLINE + 8)
// voir columnEditor_rc.h // voir columnEditor_rc.h
//#define IDD_COLUMNEDIT 2020 //#define IDD_COLUMNEDIT 2020
//#define IDD_COLOUR_POPUP 2100 //#define IDD_COLOUR_POPUP 2100
// See WordStyleDlgRes.h // See WordStyleDlgRes.h
//#define IDD_STYLER_DLG 2200 //#define IDD_STYLER_DLG 2200
//#define IDD_GLOBAL_STYLER_DLG 2300 //#define IDD_GLOBAL_STYLER_DLG 2300
#define IDD_VALUE_DLG 2400 #define IDD_VALUE_DLG 2400
#define IDC_VALUE_STATIC 2401 #define IDC_VALUE_STATIC 2401
#define IDC_VALUE_EDIT 2402 #define IDC_VALUE_EDIT 2402
#define IDD_BUTTON_DLG 2410 #define IDD_BUTTON_DLG 2410
#define IDC_RESTORE_BUTTON 2411 #define IDC_RESTORE_BUTTON 2411
// see TaskListDlg_rc.h // see TaskListDlg_rc.h
//#define IDD_TASKLIST_DLG 2450 //#define IDD_TASKLIST_DLG 2450
#define IDD_SETTING_DLG 2500 #define IDD_SETTING_DLG 2500
//See ShortcutMapper_rc.h //See ShortcutMapper_rc.h
//#define IDD_SHORTCUTMAPPER_DLG 2600 //#define IDD_SHORTCUTMAPPER_DLG 2600
//See ansiCharPanel_rc.h //See ansiCharPanel_rc.h
//#define IDD_ANSIASCII_PANEL 2700 //#define IDD_ANSIASCII_PANEL 2700
//See clipboardHistoryPanel_rc.h //See clipboardHistoryPanel_rc.h
//#define IDD_CLIPBOARDHISTORY_PANEL 2800 //#define IDD_CLIPBOARDHISTORY_PANEL 2800
//See findCharsInRange_rc.h //See findCharsInRange_rc.h
//#define IDD_FINDCHARACTERS 2900 //#define IDD_FINDCHARACTERS 2900
//See VerticalFileSwitcher_rc.h //See VerticalFileSwitcher_rc.h
//#define IDD_FILESWITCHER_PANEL 3000 //#define IDD_FILESWITCHER_PANEL 3000
//See ProjectPanel_rc.h //See ProjectPanel_rc.h
//#define IDD_PROJECTPANEL 3100 //#define IDD_PROJECTPANEL 3100
//#define IDD_FILERELOCALIZER_DIALOG 3200 //#define IDD_FILERELOCALIZER_DIALOG 3200
//See documentMap_rc.h //See documentMap_rc.h
//#define IDD_DOCUMENTMAP 3300 //#define IDD_DOCUMENTMAP 3300
//See functionListPanel_rc.h //See functionListPanel_rc.h
//#define IDD_FUNCLIST_PANEL 3400 //#define IDD_FUNCLIST_PANEL 3400
// See regExtDlg.h // See regExtDlg.h
//#define IDD_REGEXT 4000 //#define IDD_REGEXT 4000
// See shortcutRc.h // See shortcutRc.h
//#define IDD_SHORTCUT_DLG 5000 //#define IDD_SHORTCUT_DLG 5000
// See preference.rc // See preference.rc
//#define IDD_PREFERENCE_BOX 6000 //#define IDD_PREFERENCE_BOX 6000
#define NOTEPADPLUS_USER_INTERNAL (WM_USER + 0000) #define NOTEPADPLUS_USER_INTERNAL (WM_USER + 0000)
#define NPPM_INTERNAL_USERCMDLIST_MODIFIED (NOTEPADPLUS_USER_INTERNAL + 1) #define NPPM_INTERNAL_USERCMDLIST_MODIFIED (NOTEPADPLUS_USER_INTERNAL + 1)
@ -357,94 +355,94 @@
#define NPPM_INTERNAL_MACROLIST_MODIFIED (NOTEPADPLUS_USER_INTERNAL + 3) #define NPPM_INTERNAL_MACROLIST_MODIFIED (NOTEPADPLUS_USER_INTERNAL + 3)
#define NPPM_INTERNAL_PLUGINCMDLIST_MODIFIED (NOTEPADPLUS_USER_INTERNAL + 4) #define NPPM_INTERNAL_PLUGINCMDLIST_MODIFIED (NOTEPADPLUS_USER_INTERNAL + 4)
#define NPPM_INTERNAL_CLEARSCINTILLAKEY (NOTEPADPLUS_USER_INTERNAL + 5) #define NPPM_INTERNAL_CLEARSCINTILLAKEY (NOTEPADPLUS_USER_INTERNAL + 5)
#define NPPM_INTERNAL_BINDSCINTILLAKEY (NOTEPADPLUS_USER_INTERNAL + 6) #define NPPM_INTERNAL_BINDSCINTILLAKEY (NOTEPADPLUS_USER_INTERNAL + 6)
#define NPPM_INTERNAL_SCINTILLAKEYMODIFIED (NOTEPADPLUS_USER_INTERNAL + 7) #define NPPM_INTERNAL_SCINTILLAKEYMODIFIED (NOTEPADPLUS_USER_INTERNAL + 7)
#define NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE (NOTEPADPLUS_USER_INTERNAL + 8) #define NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE (NOTEPADPLUS_USER_INTERNAL + 8)
#define NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE (NOTEPADPLUS_USER_INTERNAL + 9) #define NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE (NOTEPADPLUS_USER_INTERNAL + 9)
#define NPPM_INTERNAL_DISABLEAUTOUPDATE (NOTEPADPLUS_USER_INTERNAL + 10) #define NPPM_INTERNAL_DISABLEAUTOUPDATE (NOTEPADPLUS_USER_INTERNAL + 10)
#define NPPM_INTERNAL_SETTING_HISTORY_SIZE (NOTEPADPLUS_USER_INTERNAL + 11) #define NPPM_INTERNAL_SETTING_HISTORY_SIZE (NOTEPADPLUS_USER_INTERNAL + 11)
#define NPPM_INTERNAL_ISTABBARREDUCED (NOTEPADPLUS_USER_INTERNAL + 12) #define NPPM_INTERNAL_ISTABBARREDUCED (NOTEPADPLUS_USER_INTERNAL + 12)
#define NPPM_INTERNAL_ISFOCUSEDTAB (NOTEPADPLUS_USER_INTERNAL + 13) #define NPPM_INTERNAL_ISFOCUSEDTAB (NOTEPADPLUS_USER_INTERNAL + 13)
#define NPPM_INTERNAL_GETMENU (NOTEPADPLUS_USER_INTERNAL + 14) #define NPPM_INTERNAL_GETMENU (NOTEPADPLUS_USER_INTERNAL + 14)
#define NPPM_INTERNAL_CLEARINDICATOR (NOTEPADPLUS_USER_INTERNAL + 15) #define NPPM_INTERNAL_CLEARINDICATOR (NOTEPADPLUS_USER_INTERNAL + 15)
#define NPPM_INTERNAL_SCINTILLAFINFERCOPY (NOTEPADPLUS_USER_INTERNAL + 16) #define NPPM_INTERNAL_SCINTILLAFINFERCOPY (NOTEPADPLUS_USER_INTERNAL + 16)
#define NPPM_INTERNAL_SCINTILLAFINFERSELECTALL (NOTEPADPLUS_USER_INTERNAL + 17) #define NPPM_INTERNAL_SCINTILLAFINFERSELECTALL (NOTEPADPLUS_USER_INTERNAL + 17)
#define NPPM_INTERNAL_SETCARETWIDTH (NOTEPADPLUS_USER_INTERNAL + 18) #define NPPM_INTERNAL_SETCARETWIDTH (NOTEPADPLUS_USER_INTERNAL + 18)
#define NPPM_INTERNAL_SETCARETBLINKRATE (NOTEPADPLUS_USER_INTERNAL + 19) #define NPPM_INTERNAL_SETCARETBLINKRATE (NOTEPADPLUS_USER_INTERNAL + 19)
#define NPPM_INTERNAL_CLEARINDICATORTAGMATCH (NOTEPADPLUS_USER_INTERNAL + 20) #define NPPM_INTERNAL_CLEARINDICATORTAGMATCH (NOTEPADPLUS_USER_INTERNAL + 20)
#define NPPM_INTERNAL_CLEARINDICATORTAGATTR (NOTEPADPLUS_USER_INTERNAL + 21) #define NPPM_INTERNAL_CLEARINDICATORTAGATTR (NOTEPADPLUS_USER_INTERNAL + 21)
#define NPPM_INTERNAL_SWITCHVIEWFROMHWND (NOTEPADPLUS_USER_INTERNAL + 22) #define NPPM_INTERNAL_SWITCHVIEWFROMHWND (NOTEPADPLUS_USER_INTERNAL + 22)
#define NPPM_INTERNAL_UPDATETITLEBAR (NOTEPADPLUS_USER_INTERNAL + 23) #define NPPM_INTERNAL_UPDATETITLEBAR (NOTEPADPLUS_USER_INTERNAL + 23)
#define NPPM_INTERNAL_CANCEL_FIND_IN_FILES (NOTEPADPLUS_USER_INTERNAL + 24) #define NPPM_INTERNAL_CANCEL_FIND_IN_FILES (NOTEPADPLUS_USER_INTERNAL + 24)
#define NPPM_INTERNAL_RELOADNATIVELANG (NOTEPADPLUS_USER_INTERNAL + 25) #define NPPM_INTERNAL_RELOADNATIVELANG (NOTEPADPLUS_USER_INTERNAL + 25)
#define NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED (NOTEPADPLUS_USER_INTERNAL + 26) #define NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED (NOTEPADPLUS_USER_INTERNAL + 26)
#define NPPM_INTERNAL_SCINTILLAFINFERCLEARALL (NOTEPADPLUS_USER_INTERNAL + 27) #define NPPM_INTERNAL_SCINTILLAFINFERCLEARALL (NOTEPADPLUS_USER_INTERNAL + 27)
#define NPPM_INTERNAL_SETTING_EDGE_SIZE (NOTEPADPLUS_USER_INTERNAL + 28) #define NPPM_INTERNAL_SETTING_EDGE_SIZE (NOTEPADPLUS_USER_INTERNAL + 28)
#define NPPM_INTERNAL_SETTING_TAB_REPLCESPACE (NOTEPADPLUS_USER_INTERNAL + 29) #define NPPM_INTERNAL_SETTING_TAB_REPLCESPACE (NOTEPADPLUS_USER_INTERNAL + 29)
#define NPPM_INTERNAL_SETTING_TAB_SIZE (NOTEPADPLUS_USER_INTERNAL + 30) #define NPPM_INTERNAL_SETTING_TAB_SIZE (NOTEPADPLUS_USER_INTERNAL + 30)
#define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31) #define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31)
#define NPPM_INTERNAL_DOCORDERCHANGED (NOTEPADPLUS_USER_INTERNAL + 32) #define NPPM_INTERNAL_DOCORDERCHANGED (NOTEPADPLUS_USER_INTERNAL + 32)
#define NPPM_INTERNAL_SETMULTISELCTION (NOTEPADPLUS_USER_INTERNAL + 33) #define NPPM_INTERNAL_SETMULTISELCTION (NOTEPADPLUS_USER_INTERNAL + 33)
#define NPPM_INTERNAL_SCINTILLAFINFEROPENALL (NOTEPADPLUS_USER_INTERNAL + 34) #define NPPM_INTERNAL_SCINTILLAFINFEROPENALL (NOTEPADPLUS_USER_INTERNAL + 34)
#define NPPM_INTERNAL_RECENTFILELIST_UPDATE (NOTEPADPLUS_USER_INTERNAL + 35) #define NPPM_INTERNAL_RECENTFILELIST_UPDATE (NOTEPADPLUS_USER_INTERNAL + 35)
#define NPPM_INTERNAL_RECENTFILELIST_SWITCH (NOTEPADPLUS_USER_INTERNAL + 36) #define NPPM_INTERNAL_RECENTFILELIST_SWITCH (NOTEPADPLUS_USER_INTERNAL + 36)
#define NPPM_INTERNAL_GETSCINTEDTVIEW (NOTEPADPLUS_USER_INTERNAL + 37) #define NPPM_INTERNAL_GETSCINTEDTVIEW (NOTEPADPLUS_USER_INTERNAL + 37)
#define NPPM_INTERNAL_ENABLESNAPSHOT (NOTEPADPLUS_USER_INTERNAL + 38) #define NPPM_INTERNAL_ENABLESNAPSHOT (NOTEPADPLUS_USER_INTERNAL + 38)
#define NPPM_INTERNAL_SAVECURRENTSESSION (NOTEPADPLUS_USER_INTERNAL + 39) #define NPPM_INTERNAL_SAVECURRENTSESSION (NOTEPADPLUS_USER_INTERNAL + 39)
//wParam: 0 //wParam: 0
//lParam: document new index //lParam: document new index
// See Notepad_plus_msgs.h // See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000) //#define NOTEPADPLUS_USER (WM_USER + 1000)
// //
// Used by Doc Monitor plugin // Used by Doc Monitor plugin
// //
#define NPPM_INTERNAL_CHECKDOCSTATUS (NPPMSG + 53) #define NPPM_INTERNAL_CHECKDOCSTATUS (NPPMSG + 53)
// VOID NPPM_CHECKDOCSTATUS(BOOL, 0) // VOID NPPM_CHECKDOCSTATUS(BOOL, 0)
// check all opened documents status. // check all opened documents status.
// If files are modified, then reloaod (with or without prompt, it depends on settings). // If files are modified, then reloaod (with or without prompt, it depends on settings).
// if files are deleted, then prompt user to close the documents // if files are deleted, then prompt user to close the documents
#define NPPM_INTERNAL_ENABLECHECKDOCOPT (NPPMSG + 54) #define NPPM_INTERNAL_ENABLECHECKDOCOPT (NPPMSG + 54)
// VOID NPPM_ENABLECHECKDOCOPT(OPT, 0) // VOID NPPM_ENABLECHECKDOCOPT(OPT, 0)
// where OPT is : // where OPT is :
#define CHECKDOCOPT_NONE 0 #define CHECKDOCOPT_NONE 0
#define CHECKDOCOPT_UPDATESILENTLY 1 #define CHECKDOCOPT_UPDATESILENTLY 1
#define CHECKDOCOPT_UPDATEGO2END 2 #define CHECKDOCOPT_UPDATEGO2END 2
#define NPPM_INTERNAL_GETCHECKDOCOPT (NPPMSG + 55) #define NPPM_INTERNAL_GETCHECKDOCOPT (NPPMSG + 55)
// INT NPPM_GETCHECKDOCOPT(0, 0) // INT NPPM_GETCHECKDOCOPT(0, 0)
#define NPPM_INTERNAL_SETCHECKDOCOPT (NPPMSG + 56) #define NPPM_INTERNAL_SETCHECKDOCOPT (NPPMSG + 56)
// INT NPPM_SETCHECKDOCOPT(OPT, 0) // INT NPPM_SETCHECKDOCOPT(OPT, 0)
// //
// Used by netnote plugin // Used by netnote plugin
// //
#define NPPM_INTERNAL_SETFILENAME (NPPMSG + 63) #define NPPM_INTERNAL_SETFILENAME (NPPMSG + 63)
//wParam: BufferID to rename //wParam: BufferID to rename
//lParam: name to set (TCHAR*) //lParam: name to set (TCHAR*)
//Buffer must have been previously unnamed (eg "new 1" document types) //Buffer must have been previously unnamed (eg "new 1" document types)
#define SCINTILLA_USER (WM_USER + 2000) #define SCINTILLA_USER (WM_USER + 2000)
#define MACRO_USER (WM_USER + 4000) #define MACRO_USER (WM_USER + 4000)
#define WM_GETCURRENTMACROSTATUS (MACRO_USER + 01) #define WM_GETCURRENTMACROSTATUS (MACRO_USER + 01)
#define WM_MACRODLGRUNMACRO (MACRO_USER + 02) #define WM_MACRODLGRUNMACRO (MACRO_USER + 02)
// See Notepad_plus_msgs.h // See Notepad_plus_msgs.h
//#define RUNCOMMAND_USER (WM_USER + 3000) //#define RUNCOMMAND_USER (WM_USER + 3000)
#define SPLITTER_USER (WM_USER + 4000) #define SPLITTER_USER (WM_USER + 4000)
#define WORDSTYLE_USER (WM_USER + 5000) #define WORDSTYLE_USER (WM_USER + 5000)
#define COLOURPOPUP_USER (WM_USER + 6000) #define COLOURPOPUP_USER (WM_USER + 6000)
#define BABYGRID_USER (WM_USER + 7000) #define BABYGRID_USER (WM_USER + 7000)
//#define IDD_DOCKING_MNG (IDM + 7000) //#define IDD_DOCKING_MNG (IDM + 7000)
#define MENUINDEX_FILE 0 #define MENUINDEX_FILE 0
#define MENUINDEX_EDIT 1 #define MENUINDEX_EDIT 1
@ -455,8 +453,4 @@
#define MENUINDEX_SETTINGS 6 #define MENUINDEX_SETTINGS 6
#define MENUINDEX_MACRO 7 #define MENUINDEX_MACRO 7
#define MENUINDEX_RUN 8 #define MENUINDEX_RUN 8
#define MENUINDEX_PLUGINS 9 #define MENUINDEX_PLUGINS 9
#endif // RESOURCE_H