Improve code quality by using static code analysis tool (cppchecker)

pull/1678/head
Don HO 2016-07-18 02:08:29 +02:00
parent ddf81ecc02
commit 797765173d
66 changed files with 308 additions and 550 deletions

View File

@ -50,7 +50,7 @@ public:
EXCEPTION_POINTERS* info() const { return _info; } EXCEPTION_POINTERS* info() const { return _info; }
protected: protected:
Win32Exception(EXCEPTION_POINTERS * info); //Constructor only accessible by exception handler explicit Win32Exception(EXCEPTION_POINTERS * info); //Constructor only accessible by exception handler
static void translate(unsigned code, EXCEPTION_POINTERS * info); static void translate(unsigned code, EXCEPTION_POINTERS * info);
private: private:
@ -68,7 +68,7 @@ public:
bool isWrite() const { return _isWrite; } bool isWrite() const { return _isWrite; }
ExceptionAddress badAddress() const { return _badAddress; } ExceptionAddress badAddress() const { return _badAddress; }
private: private:
Win32AccessViolation(EXCEPTION_POINTERS * info); explicit Win32AccessViolation(EXCEPTION_POINTERS * info);
bool _isWrite; bool _isWrite;
ExceptionAddress _badAddress; ExceptionAddress _badAddress;

View File

@ -26,8 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef PROCESSUS_H #pragma once
#define PROCESSUS_H
#include <windows.h> #include <windows.h>
//#include <string> //#include <string>
@ -38,8 +37,6 @@ class Process
public: public:
Process() {} Process() {}
Process(const TCHAR *cmd, const TCHAR *cDir) Process(const TCHAR *cmd, const TCHAR *cDir)
: _stdoutStr(TEXT("")), _stderrStr(TEXT("")), _hPipeOutR(NULL),
_hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL)
{ {
lstrcpy(_command, cmd); lstrcpy(_command, cmd);
lstrcpy(_curDir, cDir); lstrcpy(_curDir, cDir);
@ -75,13 +72,13 @@ protected:
// LES SORTIES // LES SORTIES
generic_string _stdoutStr; generic_string _stdoutStr;
generic_string _stderrStr; generic_string _stderrStr;
int _exitCode; int _exitCode = 0;
// LES HANDLES // LES HANDLES
HANDLE _hPipeOutR; HANDLE _hPipeOutR = nullptr;
HANDLE _hPipeErrR; HANDLE _hPipeErrR = nullptr;
HANDLE _hProcess; HANDLE _hProcess = nullptr;
HANDLE _hProcessThread; HANDLE _hProcessThread = nullptr;
//UINT _pid; // process ID assigned by caller //UINT _pid; // process ID assigned by caller
@ -98,5 +95,4 @@ protected:
void error(const TCHAR *txt2display, BOOL & returnCode, int errCode); void error(const TCHAR *txt2display, BOOL & returnCode, int errCode);
}; };
#endif //PROCESSUS_H

View File

@ -88,11 +88,11 @@ void RegExtDlg::doDialog(bool isRTL)
{ {
DLGTEMPLATE *pMyDlgTemplate = nullptr; DLGTEMPLATE *pMyDlgTemplate = nullptr;
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_REGEXT_BOX, &pMyDlgTemplate); HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_REGEXT_BOX, &pMyDlgTemplate);
::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, (LPARAM)this); ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
::GlobalFree(hMyDlgTemplate); ::GlobalFree(hMyDlgTemplate);
} }
else else
::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_REGEXT_BOX), _hParent, dlgProc, (LPARAM)this); ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_REGEXT_BOX), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
} }

View File

@ -1120,11 +1120,9 @@ void Notepad_plus::wsTabConvert(spaceTab whichWay)
int count = 0; int count = 0;
int column = 0; int column = 0;
int counter = 0;
int newCurrentPos = 0; int newCurrentPos = 0;
int tabStop = static_cast<int32_t>(tabWidth - 1); // remember, counting from zero ! int tabStop = static_cast<int32_t>(tabWidth - 1); // remember, counting from zero !
bool onlyLeading = false; bool onlyLeading = false;
bool nonSpaceFound = false;
vector<int> bookmarks; vector<int> bookmarks;
vector<int> folding; vector<int> folding;
@ -1206,6 +1204,8 @@ void Notepad_plus::wsTabConvert(spaceTab whichWay)
case space2TabAll: case space2TabAll:
{ {
bool nextChar = false; bool nextChar = false;
int counter = 0;
bool nonSpaceFound = false;
for (int i=0; source[i] != '\0'; ++i) for (int i=0; source[i] != '\0'; ++i)
{ {
if (nonSpaceFound == false) if (nonSpaceFound == false)
@ -2855,7 +2855,7 @@ void Notepad_plus::activateDoc(size_t pos)
return; return;
} }
if (pos >= 0 && pos < nbDoc) if (pos < nbDoc)
{ {
BufferID id = _pDocTab->getBufferByIndex(pos); BufferID id = _pDocTab->getBufferByIndex(pos);
activateBuffer(id, currentView()); activateBuffer(id, currentView());
@ -6367,14 +6367,12 @@ bool Notepad_plus::undoStreamComment()
//-- Check, if selectionStart or selectionEnd is within a stream comment ----- //-- Check, if selectionStart or selectionEnd is within a stream comment -----
// or if the selection includes a complete stream-comment!! ---------------- // or if the selection includes a complete stream-comment!! ----------------
bool blnCommentFound = false;
//-- First, check if there is a stream-comment around the selectionStart position: //-- First, check if there is a stream-comment around the selectionStart position:
if ((blnStartCommentBefore[iSelStart] && blnEndCommentAfter[iSelStart]) if ((blnStartCommentBefore[iSelStart] && blnEndCommentAfter[iSelStart])
&& (!blnEndCommentBefore[iSelStart] || (posStartCommentBefore[iSelStart] >= posEndCommentBefore[iSelStart])) && (!blnEndCommentBefore[iSelStart] || (posStartCommentBefore[iSelStart] >= posEndCommentBefore[iSelStart]))
&& (!blnStartCommentAfter[iSelStart] || (posEndCommentAfter[iSelStart] <= posStartCommentAfter[iSelStart]))) && (!blnStartCommentAfter[iSelStart] || (posEndCommentAfter[iSelStart] <= posStartCommentAfter[iSelStart])))
{ {
blnCommentFound = true;
posStartComment = posStartCommentBefore[iSelStart]; posStartComment = posStartCommentBefore[iSelStart];
posEndComment = posEndCommentAfter[iSelStart]; posEndComment = posEndCommentAfter[iSelStart];
} }
@ -6396,7 +6394,6 @@ bool Notepad_plus::undoStreamComment()
&& (!blnEndCommentBefore[iSelEnd] || (posStartCommentBefore[iSelEnd] >= posEndCommentBefore[iSelEnd])) && (!blnEndCommentBefore[iSelEnd] || (posStartCommentBefore[iSelEnd] >= posEndCommentBefore[iSelEnd]))
&& (!blnStartCommentAfter[iSelEnd] || (posEndCommentAfter[iSelEnd] <= posStartCommentAfter[iSelEnd]))) && (!blnStartCommentAfter[iSelEnd] || (posEndCommentAfter[iSelEnd] <= posStartCommentAfter[iSelEnd])))
{ {
blnCommentFound = true;
posStartComment = posStartCommentBefore[iSelEnd]; posStartComment = posStartCommentBefore[iSelEnd];
posEndComment = posEndCommentAfter[iSelEnd]; posEndComment = posEndCommentAfter[iSelEnd];
} }
@ -6405,7 +6402,6 @@ bool Notepad_plus::undoStreamComment()
&& (blnEndCommentBefore[iSelEnd] && (posEndCommentBefore[iSelEnd] > selectionStart))) && (blnEndCommentBefore[iSelEnd] && (posEndCommentBefore[iSelEnd] > selectionStart)))
{ {
//-- If there are more than one stream-comment within the selection, take the first one after selectionStart!! //-- If there are more than one stream-comment within the selection, take the first one after selectionStart!!
blnCommentFound = true;
posStartComment = posStartCommentAfter[iSelStart]; posStartComment = posStartCommentAfter[iSelStart];
posEndComment = posEndCommentAfter[iSelStart]; posEndComment = posEndCommentAfter[iSelStart];
} }

View File

@ -40,7 +40,7 @@ namespace // anonymous
struct PaintLocker final struct PaintLocker final
{ {
PaintLocker(HWND handle) explicit PaintLocker(HWND handle)
: handle(handle) : handle(handle)
{ {
// disallow drawing on the window // disallow drawing on the window

View File

@ -574,7 +574,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
if (HIWORD(wParam) == SCEN_SETFOCUS) if (HIWORD(wParam) == SCEN_SETFOCUS)
{ {
HWND hMain = _mainEditView.getHSelf(), hSec = _subEditView.getHSelf(); HWND hMain = _mainEditView.getHSelf(), hSec = _subEditView.getHSelf();
HWND hFocus = (HWND)lParam; HWND hFocus = reinterpret_cast<HWND>(lParam);
if (hMain == hFocus) if (hMain == hFocus)
switchEditViewTo(MAIN_VIEW); switchEditViewTo(MAIN_VIEW);
else if (hSec == hFocus) else if (hSec == hFocus)
@ -1142,12 +1142,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_CREATESCINTILLAHANDLE: case NPPM_CREATESCINTILLAHANDLE:
{ {
return (LRESULT)_scintillaCtrls4Plugins.createSintilla((lParam == NULL?hwnd:(HWND)lParam)); return (LRESULT)_scintillaCtrls4Plugins.createSintilla((lParam == NULL?hwnd:reinterpret_cast<HWND>(lParam)));
} }
case NPPM_INTERNAL_GETSCINTEDTVIEW: case NPPM_INTERNAL_GETSCINTEDTVIEW:
{ {
return (LRESULT)_scintillaCtrls4Plugins.getScintillaEditViewFrom((HWND)lParam); return (LRESULT)_scintillaCtrls4Plugins.getScintillaEditViewFrom(reinterpret_cast<HWND>(lParam));
} }
case NPPM_INTERNAL_ENABLESNAPSHOT: case NPPM_INTERNAL_ENABLESNAPSHOT:
@ -1158,7 +1158,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_DESTROYSCINTILLAHANDLE: case NPPM_DESTROYSCINTILLAHANDLE:
{ {
return _scintillaCtrls4Plugins.destroyScintilla((HWND)lParam); return _scintillaCtrls4Plugins.destroyScintilla(reinterpret_cast<HWND>(lParam));
} }
case NPPM_GETNBUSERLANG: case NPPM_GETNBUSERLANG:
@ -1328,11 +1328,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
for (size_t i = 0, len = _hModelessDlgs.size() ; i < len ; ++i) for (size_t i = 0, len = _hModelessDlgs.size() ; i < len ; ++i)
{ {
if (_hModelessDlgs[i] == (HWND)lParam) if (_hModelessDlgs[i] == reinterpret_cast<HWND>(lParam))
return NULL; return NULL;
} }
_hModelessDlgs.push_back((HWND)lParam); _hModelessDlgs.push_back(reinterpret_cast<HWND>(lParam));
return lParam; return lParam;
} }
else else
@ -1341,7 +1341,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
for (size_t i = 0, len = _hModelessDlgs.size(); i < len ; ++i) for (size_t i = 0, len = _hModelessDlgs.size(); i < len ; ++i)
{ {
if (_hModelessDlgs[i] == (HWND)lParam) if (_hModelessDlgs[i] == reinterpret_cast<HWND>(lParam))
{ {
vector<HWND>::iterator hDlg = _hModelessDlgs.begin() + i; vector<HWND>::iterator hDlg = _hModelessDlgs.begin() + i;
_hModelessDlgs.erase(hDlg); _hModelessDlgs.erase(hDlg);
@ -1791,20 +1791,20 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_DMMSHOW: case NPPM_DMMSHOW:
{ {
_dockingManager.showDockableDlg((HWND)lParam, SW_SHOW); _dockingManager.showDockableDlg(reinterpret_cast<HWND>(lParam), SW_SHOW);
return TRUE; return TRUE;
} }
case NPPM_DMMHIDE: case NPPM_DMMHIDE:
{ {
_dockingManager.showDockableDlg((HWND)lParam, SW_HIDE); _dockingManager.showDockableDlg(reinterpret_cast<HWND>(lParam), SW_HIDE);
return TRUE; return TRUE;
} }
case NPPM_DMMUPDATEDISPINFO: case NPPM_DMMUPDATEDISPINFO:
{ {
if (::IsWindowVisible((HWND)lParam)) if (::IsWindowVisible(reinterpret_cast<HWND>(lParam)))
_dockingManager.updateContainerInfo((HWND)lParam); _dockingManager.updateContainerInfo(reinterpret_cast<HWND>(lParam));
return TRUE; return TRUE;
} }
@ -2014,7 +2014,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_ISFOCUSEDTAB: case NPPM_INTERNAL_ISFOCUSEDTAB:
{ {
HWND hTabToTest = (currentView() == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf(); HWND hTabToTest = (currentView() == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
return (HWND)lParam == hTabToTest; return reinterpret_cast<HWND>(lParam) == hTabToTest;
} }
case NPPM_INTERNAL_GETMENU: case NPPM_INTERNAL_GETMENU:
@ -2043,7 +2043,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SWITCHVIEWFROMHWND: case NPPM_INTERNAL_SWITCHVIEWFROMHWND:
{ {
HWND handle = (HWND)lParam; HWND handle = reinterpret_cast<HWND>(lParam);
if (_mainEditView.getHSelf() == handle || _mainDocTab.getHSelf() == handle) if (_mainEditView.getHSelf() == handle || _mainDocTab.getHSelf() == handle)
{ {
switchEditViewTo(MAIN_VIEW); switchEditViewTo(MAIN_VIEW);

View File

@ -1467,12 +1467,11 @@ 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() ? 22 : 22);
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton()?22:22); 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); TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
}
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
break; break;
} }

View File

@ -879,7 +879,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
// This treatment would fail on some valid URLs where there's actually supposed to be a comma or parenthesis at the end. // This treatment would fail on some valid URLs where there's actually supposed to be a comma or parenthesis at the end.
size_t lastCharIndex = _tcsnlen(currentWord, MAX_PATH*2) - 1; size_t lastCharIndex = _tcsnlen(currentWord, MAX_PATH*2) - 1;
if(lastCharIndex >= 0 && (currentWord[lastCharIndex] == ',' || currentWord[lastCharIndex] == ')' || currentWord[lastCharIndex] == '(')) if ((currentWord[lastCharIndex] == ',' || currentWord[lastCharIndex] == ')' || currentWord[lastCharIndex] == '('))
currentWord[lastCharIndex] = '\0'; currentWord[lastCharIndex] = '\0';
::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), currentWord, NULL, NULL, SW_SHOW); ::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), currentWord, NULL, NULL, SW_SHOW);

View File

@ -5115,7 +5115,7 @@ bool NppParameters::writeGUIParams()
} }
else if (!lstrcmp(nm, TEXT("UserDefineDlg"))) else if (!lstrcmp(nm, TEXT("UserDefineDlg")))
{ {
const TCHAR *pStr = _nppGUI._userDefineDlgStatus & UDD_SHOW?TEXT("show"):TEXT("hide"); const TCHAR *pStr = (_nppGUI._userDefineDlgStatus & UDD_SHOW) ? TEXT("show") : TEXT("hide");
TiXmlNode *n = childNode->FirstChild(); TiXmlNode *n = childNode->FirstChild();
if (n) if (n)
n->SetValue(pStr); n->SetValue(pStr);
@ -5639,7 +5639,6 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("triggerFromNbChar"), int32_t(_nppGUI._autocFromLen)); GUIConfigElement->SetAttribute(TEXT("triggerFromNbChar"), int32_t(_nppGUI._autocFromLen));
const TCHAR * pStr = _nppGUI._funcParams?TEXT("yes"):TEXT("no"); const TCHAR * pStr = _nppGUI._funcParams?TEXT("yes"):TEXT("no");
GUIConfigElement->SetAttribute(TEXT("funcParams"), pStr); GUIConfigElement->SetAttribute(TEXT("funcParams"), pStr);
autocExist = true;
} }
if (!autocInsetExist) if (!autocInsetExist)
@ -5665,7 +5664,6 @@ bool NppParameters::writeGUIParams()
(hist_element.ToElement())->SetAttribute(TEXT("close"), close); (hist_element.ToElement())->SetAttribute(TEXT("close"), close);
GUIConfigElement->InsertEndChild(hist_element); GUIConfigElement->InsertEndChild(hist_element);
} }
autocInsetExist = true;
} }
if (dockingParamNode) if (dockingParamNode)

View File

@ -26,46 +26,16 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once #pragma once
#ifndef TINYXMLA_INCLUDED
#include "tinyxmlA.h" #include "tinyxmlA.h"
#endif //TINYXMLA_INCLUDED
#ifndef TINYXML_INCLUDED
#include "tinyxml.h" #include "tinyxml.h"
#endif //TINYXML_INCLUDED
#ifndef SCINTILLA_H
#include "Scintilla.h" #include "Scintilla.h"
#endif //SCINTILLA_H
#ifndef SCINTILLA_REF_H
#include "ScintillaRef.h" #include "ScintillaRef.h"
#endif //SCINTILLA_REF_H
#ifndef TOOL_BAR_H
#include "ToolBar.h" #include "ToolBar.h"
#endif //TOOL_BAR_H
#ifndef USER_DEFINE_LANG_REFERENCE_H
#include "UserDefineLangReference.h" #include "UserDefineLangReference.h"
#endif //USER_DEFINE_LANG_REFERENCE_H
#ifndef COLORS_H
#include "colors.h" #include "colors.h"
#endif //COLORS_H
#ifndef SHORTCUTS_H
#include "shortcut.h" #include "shortcut.h"
#endif //SHORTCUTS_H
#ifndef CONTEXTMENU_H
#include "ContextMenu.h" #include "ContextMenu.h"
#endif //CONTEXTMENU_H
#ifndef DPIMANAGER_H
#include "dpiManager.h" #include "dpiManager.h"
#endif //DPIMANAGER_H
#include <assert.h> #include <assert.h>
#include <tchar.h> #include <tchar.h>
@ -649,7 +619,7 @@ public:
!(month == 11 && day > 30)); !(month == 11 && day > 30));
} }
Date(const TCHAR *dateStr); explicit Date(const TCHAR *dateStr);
// The constructor which makes the date of number of days from now // The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past // nbDaysFromNow could be negative if user want to make a date in the past

View File

@ -26,16 +26,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef AUTOCOMPLETION_H #pragma once
#define AUTOCOMPLETION_H
#ifndef FUNCTIONCALLTIP_H
#include "FunctionCallTip.h" #include "FunctionCallTip.h"
#endif// FUNCTIONCALLTIP_H
#ifndef TINYXML_INCLUDED
#include "tinyxml.h" #include "tinyxml.h"
#endif// TINYXML_INCLUDED
const size_t tagMaxLen = 256; const size_t tagMaxLen = 256;
@ -64,9 +58,7 @@ class AutoCompletion {
public: public:
enum ActiveCompletion {CompletionNone = 0, CompletionAuto, CompletionWord, CompletionFunc, CompletionPath}; enum ActiveCompletion {CompletionNone = 0, CompletionAuto, CompletionWord, CompletionFunc, CompletionPath};
AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView), explicit AutoCompletion(ScintillaEditView * pEditView): _pEditView(pEditView), _funcCalltip(pEditView) {
_curLang(L_TEXT), _pXmlFile(NULL), _keyWordMaxLen(0),
_pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT("")) {
//Do not load any language yet //Do not load any language yet
_insertedMatchedChars.init(_pEditView); _insertedMatchedChars.init(_pEditView);
}; };
@ -95,24 +87,22 @@ public:
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, LangType language); void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, LangType language);
private: private:
bool _funcCompletionActive; bool _funcCompletionActive = false;
ScintillaEditView * _pEditView; ScintillaEditView * _pEditView = nullptr;
LangType _curLang; LangType _curLang = L_TEXT;
TiXmlDocument *_pXmlFile; TiXmlDocument *_pXmlFile = nullptr;
TiXmlElement *_pXmlKeyword; TiXmlElement *_pXmlKeyword = nullptr;
InsertedMatchedChars _insertedMatchedChars; InsertedMatchedChars _insertedMatchedChars;
bool _ignoreCase; bool _ignoreCase = true;
std::vector<generic_string> _keyWordArray; std::vector<generic_string> _keyWordArray;
generic_string _keyWords; generic_string _keyWords;
size_t _keyWordMaxLen; size_t _keyWordMaxLen = 0;
FunctionCallTip _funcCalltip; FunctionCallTip _funcCalltip;
const TCHAR * getApiFileName(); const TCHAR * getApiFileName();
void getWordArray(std::vector<generic_string> & wordArray, TCHAR *beginChars); void getWordArray(std::vector<generic_string> & wordArray, TCHAR *beginChars);
}; };
#endif //AUTOCOMPLETION_H

View File

@ -967,7 +967,7 @@ bool FileManager::backupCurrentBuffer()
class EventReset final class EventReset final
{ {
public: public:
EventReset(HANDLE h) explicit EventReset(HANDLE h)
{ {
_h = h; _h = h;
} }

View File

@ -705,7 +705,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case WM_HSCROLL : case WM_HSCROLL :
{ {
if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER)) if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER))
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory();
@ -2509,11 +2509,11 @@ void FindInFinderDlg::doDialog(Finder *launcher, bool isRTL)
{ {
DLGTEMPLATE *pMyDlgTemplate = NULL; DLGTEMPLATE *pMyDlgTemplate = NULL;
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_FINDINFINDER_DLG, &pMyDlgTemplate); HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_FINDINFINDER_DLG, &pMyDlgTemplate);
::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, (LPARAM)this); ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
::GlobalFree(hMyDlgTemplate); ::GlobalFree(hMyDlgTemplate);
} }
else else
::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_FINDINFINDER_DLG), _hParent, dlgProc, (LPARAM)this); ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_FINDINFINDER_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
} }
@ -3218,7 +3218,6 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
LRESULT lResult = SendMessage(hParent, WM_ERASEBKGND,(WPARAM)winDC, 0); LRESULT lResult = SendMessage(hParent, WM_ERASEBKGND,(WPARAM)winDC, 0);
::SetWindowOrgEx(winDC, ptOrig.x, ptOrig.y, NULL); ::SetWindowOrgEx(winDC, ptOrig.x, ptOrig.y, NULL);
return (BOOL)lResult; return (BOOL)lResult;
break;
} }
} }
return DefWindowProc(getHSelf(), message, wParam, lParam); return DefWindowProc(getHSelf(), message, wParam, lParam);

View File

@ -26,21 +26,11 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef FIND_REPLACE_DLG_H #pragma once
#define FIND_REPLACE_DLG_H
#ifndef FINDREPLACE_DLG_H
#include "FindReplaceDlg_rc.h" #include "FindReplaceDlg_rc.h"
#endif //FINDREPLACE_DLG_H
#ifndef SCINTILLA_EDIT_VIEW_H
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#endif //SCINTILLA_EDIT_VIEW_H
#ifndef DOCKINGDLGINTERFACE_H
#include "DockingDlgInterface.h" #include "DockingDlgInterface.h"
#endif //DOCKINGDLGINTERFACE_H
#include "BoostRegexSearch.h" #include "BoostRegexSearch.h"
#include "StatusBar.h" #include "StatusBar.h"
@ -119,7 +109,7 @@ private:
class Finder : public DockingDlgInterface { class Finder : public DockingDlgInterface {
friend class FindReplaceDlg; friend class FindReplaceDlg;
public: public:
Finder() : DockingDlgInterface(IDD_FINDRESULT), _pMainFoundInfos(&_foundInfos1), _pMainMarkings(&_markings1) { Finder() : DockingDlgInterface(IDD_FINDRESULT) {
_markingsStruct._length = 0; _markingsStruct._length = 0;
_markingsStruct._markings = NULL; _markingsStruct._markings = NULL;
}; };
@ -158,20 +148,20 @@ private:
enum { searchHeaderLevel = SC_FOLDLEVELBASE + 1, fileHeaderLevel, resultLevel }; enum { searchHeaderLevel = SC_FOLDLEVELBASE + 1, fileHeaderLevel, resultLevel };
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView = nullptr;
std::vector<FoundInfo> _foundInfos1; std::vector<FoundInfo> _foundInfos1;
std::vector<FoundInfo> _foundInfos2; std::vector<FoundInfo> _foundInfos2;
std::vector<FoundInfo>* _pMainFoundInfos; std::vector<FoundInfo>* _pMainFoundInfos = &_foundInfos1;
std::vector<SearchResultMarking> _markings1; std::vector<SearchResultMarking> _markings1;
std::vector<SearchResultMarking> _markings2; std::vector<SearchResultMarking> _markings2;
std::vector<SearchResultMarking>* _pMainMarkings; std::vector<SearchResultMarking>* _pMainMarkings = &_markings1;
SearchResultMarkings _markingsStruct; SearchResultMarkings _markingsStruct;
ScintillaEditView _scintView; ScintillaEditView _scintView;
unsigned int _nbFoundFiles = 0; unsigned int _nbFoundFiles = 0;
int _lastFileHeaderPos; int _lastFileHeaderPos = 0;
int _lastSearchHeaderPos; int _lastSearchHeaderPos = 0;
bool _canBeVolatiled = true; bool _canBeVolatiled = true;
@ -417,7 +407,7 @@ private :
class FindIncrementDlg : public StaticDialog class FindIncrementDlg : public StaticDialog
{ {
public : public :
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _findStatus(FSFound) {}; FindIncrementDlg() {};
void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false); void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false);
virtual void destroy(); virtual void destroy();
virtual void display(bool toShow = true) const; virtual void display(bool toShow = true) const;
@ -434,11 +424,11 @@ public :
void addToRebar(ReBar * rebar); void addToRebar(ReBar * rebar);
private : private :
bool _isRTL; bool _isRTL = false;
FindReplaceDlg *_pFRDlg; FindReplaceDlg *_pFRDlg = nullptr;
FindStatus _findStatus; FindStatus _findStatus = FSFound;
ReBar * _pRebar; ReBar * _pRebar = nullptr;
REBARBANDINFO _rbBand; REBARBANDINFO _rbBand;
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
@ -449,7 +439,7 @@ private :
class Progress class Progress
{ {
public: public:
Progress(HINSTANCE hInst); explicit Progress(HINSTANCE hInst);
~Progress(); ~Progress();
HWND open(HWND hCallerWnd = NULL, const TCHAR* header = NULL); HWND open(HWND hCallerWnd = NULL, const TCHAR* header = NULL);
@ -503,4 +493,3 @@ private:
HWND _hBtn; HWND _hBtn;
}; };
#endif //FIND_REPLACE_DLG_H

View File

@ -37,12 +37,7 @@ typedef std::vector<const TCHAR *> stringVec;
class FunctionCallTip { class FunctionCallTip {
friend class AutoCompletion; friend class AutoCompletion;
public: public:
FunctionCallTip(ScintillaEditView * pEditView) : _pEditView(pEditView), _pXmlKeyword(NULL), _curPos(0), _startPos(0), explicit FunctionCallTip(ScintillaEditView * pEditView) : _pEditView(pEditView) {};
_curFunction(NULL), _currentNrOverloads(0), _currentOverload(0),
_currentParam(0), _funcName(NULL),
_start('('), _stop(')'), _param(','), _terminal(';'), _ignoreCase(true),
_additionalWordChar(TEXT("")), _selfActivated(false)
{};
~FunctionCallTip() {/* cleanup(); */}; ~FunctionCallTip() {/* cleanup(); */};
void setLanguageXML(TiXmlElement * pXmlKeyword); //set calltip keyword node void setLanguageXML(TiXmlElement * pXmlKeyword); //set calltip keyword node
bool updateCalltip(int ch, bool needShown = false); //Ch is character typed, or 0 if another event occured. NeedShown is true if calltip should be attempted to displayed. Return true if calltip was made visible bool updateCalltip(int ch, bool needShown = false); //Ch is character typed, or 0 if another event occured. NeedShown is true if calltip should be attempted to displayed. Return true if calltip was made visible
@ -52,29 +47,29 @@ public:
void close(); //Close calltip if visible void close(); //Close calltip if visible
private: private:
ScintillaEditView * _pEditView; //Scintilla to display calltip in ScintillaEditView * _pEditView = nullptr; //Scintilla to display calltip in
TiXmlElement * _pXmlKeyword; //current keyword node (first one) TiXmlElement * _pXmlKeyword = nullptr; //current keyword node (first one)
int _curPos; //cursor position int _curPos = 0; //cursor position
int _startPos; //display start position int _startPos = 0; //display start position
TiXmlElement * _curFunction; //current function element TiXmlElement * _curFunction = nullptr; //current function element
//cache some XML values n stuff //cache some XML values n stuff
TCHAR * _funcName; //name of function TCHAR * _funcName = nullptr; //name of function
stringVec _retVals; //vector of overload return values/types stringVec _retVals; //vector of overload return values/types
std::vector<stringVec> _overloads; //vector of overload params (=vector) std::vector<stringVec> _overloads; //vector of overload params (=vector)
stringVec _descriptions; //vecotr of function descriptions stringVec _descriptions; //vecotr of function descriptions
int _currentNrOverloads; //current amount of overloads int _currentNrOverloads = 0; //current amount of overloads
int _currentOverload; //current chosen overload int _currentOverload = 0; //current chosen overload
int _currentParam; //current highlighted param int _currentParam = 0; //current highlighted param
TCHAR _start; TCHAR _start = '(';
TCHAR _stop; TCHAR _stop = ')';
TCHAR _param; TCHAR _param = ',';
TCHAR _terminal; TCHAR _terminal = ';';
generic_string _additionalWordChar; generic_string _additionalWordChar = TEXT("");
bool _ignoreCase; bool _ignoreCase = true;
bool _selfActivated; bool _selfActivated = false;
bool getCursorFunction(); //retrieve data about function at cursor. Returns true if a function was found. Calls loaddata if needed bool getCursorFunction(); //retrieve data about function at cursor. Returns true if a function was found. Calls loaddata if needed
bool loadFunction(); //returns true if the function can be found bool loadFunction(); //returns true if the function can be found

View File

@ -26,21 +26,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef GOTILINE_DLG_H #pragma once
#define GOTILINE_DLG_H
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#ifndef SCINTILLA_EDIT_VIEW_H
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#endif //SCINTILLA_EDIT_VIEW_H
class GoToLineDlg : public StaticDialog class GoToLineDlg : public StaticDialog
{ {
public : public :
GoToLineDlg() : StaticDialog(), _mode(go2line) {}; GoToLineDlg() : StaticDialog() {};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
Window::init(hInst, hPere); Window::init(hInst, hPere);
@ -67,12 +60,11 @@ public :
protected : protected :
enum mode {go2line, go2offsset}; enum mode {go2line, go2offsset};
mode _mode; mode _mode = go2line;
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private : private :
ScintillaEditView **_ppEditView = nullptr;
ScintillaEditView **_ppEditView;
void updateLinesNumbers() const; void updateLinesNumbers() const;
@ -88,4 +80,3 @@ private :
}; };
#endif //GOTILINE_DLG_H

View File

@ -57,10 +57,10 @@ public :
private : private :
PRINTDLG _pdlg; PRINTDLG _pdlg;
ScintillaEditView *_pSEView; ScintillaEditView *_pSEView = nullptr;
size_t _startPos; size_t _startPos = 0;
size_t _endPos; size_t _endPos = 0;
size_t _nbPageTotal; size_t _nbPageTotal =0;
}; };
#endif //PRINTER_H #endif //PRINTER_H

View File

@ -320,7 +320,6 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
//Have to perform the scroll first, because the first/last line do not get updated untill after the scroll has been parsed //Have to perform the scroll first, because the first/last line do not get updated untill after the scroll has been parsed
LRESULT scrollResult = ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam); LRESULT scrollResult = ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
return scrollResult; return scrollResult;
break;
} }
case WM_IME_REQUEST: case WM_IME_REQUEST:

View File

@ -26,41 +26,17 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SCINTILLA_EDIT_VIEW_H #pragma once
#define SCINTILLA_EDIT_VIEW_H
#ifndef SCINTILLA_H
#include "Scintilla.h" #include "Scintilla.h"
#endif //SCINTILLA_H
#ifndef SCINTILLA_REF_H
#include "ScintillaRef.h" #include "ScintillaRef.h"
#endif //SCINTILLA_REF_H
#ifndef SCILEXER_H
#include "SciLexer.h" #include "SciLexer.h"
#endif //SCILEXER_H
#ifndef BUFFER_H
#include "Buffer.h" #include "Buffer.h"
#endif //BUFFER_H
#ifndef COLORS_H
#include "colors.h" #include "colors.h"
#endif //COLORS_H
#ifndef USER_DEFINE_H
#include "UserDefineDialog.h" #include "UserDefineDialog.h"
#endif //USER_DEFINE_H
#ifndef XPM_ICON_H
#include "xpm_icons.h" #include "xpm_icons.h"
#endif //XPM_ICON_H
/*
#ifndef RESOURCE_H
#include "resource.h"
#endif //RESOURCE_H
*/
#ifndef WM_MOUSEWHEEL #ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A #define WM_MOUSEWHEEL 0x020A
@ -204,10 +180,7 @@ class ScintillaEditView : public Window
{ {
friend class Finder; friend class Finder;
public: public:
ScintillaEditView() ScintillaEditView(): Window() {
: Window(), _pScintillaFunc(NULL),_pScintillaPtr(NULL),
_lineNumbersShown(false), _wrapRestoreNeeded(false), _beginSelectPosition(-1)
{
++_refCount; ++_refCount;
}; };
@ -656,26 +629,26 @@ protected:
static LRESULT CALLBACK scintillaStatic_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK scintillaStatic_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
SCINTILLA_FUNC _pScintillaFunc; SCINTILLA_FUNC _pScintillaFunc = nullptr;
SCINTILLA_PTR _pScintillaPtr; SCINTILLA_PTR _pScintillaPtr = nullptr;
static WNDPROC _scintillaDefaultProc; static WNDPROC _scintillaDefaultProc;
CallWindowProcFunc _callWindowProc; CallWindowProcFunc _callWindowProc = nullptr;
BufferID attachDefaultDoc(); BufferID attachDefaultDoc();
//Store the current buffer so it can be retrieved later //Store the current buffer so it can be retrieved later
BufferID _currentBufferID; BufferID _currentBufferID = nullptr;
Buffer * _currentBuffer; Buffer * _currentBuffer = nullptr;
NppParameters *_pParameter; NppParameters *_pParameter = nullptr;
int _codepage; int _codepage = CP_ACP;
bool _lineNumbersShown; bool _lineNumbersShown = false;
bool _wrapRestoreNeeded; bool _wrapRestoreNeeded = false;
typedef std::unordered_map<int, Style> StyleMap; typedef std::unordered_map<int, Style> StyleMap;
typedef std::unordered_map<BufferID, StyleMap*> BufferStyleMap; typedef std::unordered_map<BufferID, StyleMap*> BufferStyleMap;
BufferStyleMap _hotspotStyles; BufferStyleMap _hotspotStyles;
int _beginSelectPosition; int _beginSelectPosition = -1;
//Lexers and Styling //Lexers and Styling
void restyleBuffer(); void restyleBuffer();
@ -925,4 +898,3 @@ protected:
bool expandWordSelection(); bool expandWordSelection();
}; };
#endif //SCINTILLA_EDIT_VIEW_H

View File

@ -33,7 +33,7 @@ class FindReplaceDlg;
class SmartHighlighter { class SmartHighlighter {
public: public:
SmartHighlighter(FindReplaceDlg * pFRDlg); explicit SmartHighlighter(FindReplaceDlg * pFRDlg);
void highlightView(ScintillaEditView * pHighlightView); void highlightView(ScintillaEditView * pHighlightView);
private: private:
FindReplaceDlg * _pFRDlg; FindReplaceDlg * _pFRDlg;

View File

@ -938,7 +938,7 @@ void SymbolsStyleDialog::setKeywords2List(int id)
} }
} }
UserDefineDialog::UserDefineDialog(): SharedParametersDialog(), _status(UNDOCK), _yScrollPos(0), _prevHightVal(0), _isDirty(false) UserDefineDialog::UserDefineDialog(): SharedParametersDialog()
{ {
_pCurrentUserLang = new UserLangContainer(); _pCurrentUserLang = new UserLangContainer();
@ -1148,7 +1148,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
case WM_HSCROLL: case WM_HSCROLL:
{ {
if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER)) if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER))
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
pNppParam->SetTransparent(_hSelf, percent); pNppParam->SetTransparent(_hSelf, percent);

View File

@ -24,23 +24,14 @@
// 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.
#ifndef USER_DEFINE_H
#define USER_DEFINE_H #pragma once
#ifndef USERDEFINE_RC_H
#include "UserDefineResource.h" #include "UserDefineResource.h"
#endif //USERDEFINE_RC_H
#ifndef CONTROLS_TAB_H
#include "ControlsTab.h" #include "ControlsTab.h"
#endif //CONTROLS_TAB_H
#ifndef COLOUR_PICKER_H
#include "ColourPicker.h" #include "ColourPicker.h"
#endif //COLOUR_PICKER_H
#ifndef PARAMETERS_H
#include "Parameters.h" #include "Parameters.h"
#endif //PARAMETERS_H
#ifndef URLCTRL_INCLUDED
#include "URLCtrl.h" #include "URLCtrl.h"
#endif// URLCTRL_INCLUDED
#include "tchar.h" #include "tchar.h"
#include "SciLexer.h" #include "SciLexer.h"
#include <unordered_map> #include <unordered_map>
@ -391,12 +382,12 @@ private :
KeyWordsStyleDialog _keyWordsStyleDlg; KeyWordsStyleDialog _keyWordsStyleDlg;
CommentStyleDialog _commentStyleDlg; CommentStyleDialog _commentStyleDlg;
SymbolsStyleDialog _symbolsStyleDlg; SymbolsStyleDialog _symbolsStyleDlg;
bool _status; bool _status = UNDOCK;
RECT _dlgPos; RECT _dlgPos;
int _currentHight; int _currentHight = 0;
int _yScrollPos; int _yScrollPos = 0;
int _prevHightVal; int _prevHightVal = 0;
bool _isDirty; bool _isDirty = false;
void getActualPosSize() { void getActualPosSize() {
::GetWindowRect(_hSelf, &_dlgPos); ::GetWindowRect(_hSelf, &_dlgPos);
_dlgPos.right -= _dlgPos.left; _dlgPos.right -= _dlgPos.left;
@ -420,17 +411,21 @@ public :
_textValue = text2Set; _textValue = text2Set;
_txtLen = txtLen; _txtLen = txtLen;
}; };
long doDialog() { long doDialog() {
return long(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STRING_DLG), _hParent, dlgProc, (LPARAM)this)); return long(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STRING_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
}; };
virtual void destroy() {}; virtual void destroy() {};
protected : protected :
INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM); INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM);
private : private :
generic_string _title; generic_string _title;
generic_string _textValue; generic_string _textValue;
generic_string _static; generic_string _static;
int _txtLen; int _txtLen = 0;
}; };
class StylerDlg class StylerDlg
@ -451,7 +446,7 @@ public:
}; };
long doDialog() { long doDialog() {
return long (::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STYLER_POPUP_DLG), _parent, dlgProc, (LPARAM)this)); return long(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STYLER_POPUP_DLG), _parent, dlgProc, reinterpret_cast<LPARAM>(this)));
}; };
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);
@ -464,4 +459,3 @@ public:
ColourPicker * _pBgColour; ColourPicker * _pBgColour;
Style _initialStyle; Style _initialStyle;
}; };
#endif //USER_DEFINE_H

View File

@ -70,7 +70,7 @@ protected :
private : private :
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView = nullptr;
}; };

View File

@ -37,7 +37,7 @@ class ScintillaEditView;
class XmlMatchedTagsHighlighter { class XmlMatchedTagsHighlighter {
public: public:
XmlMatchedTagsHighlighter(ScintillaEditView *pEditView):_pEditView(pEditView){}; explicit XmlMatchedTagsHighlighter(ScintillaEditView *pEditView):_pEditView(pEditView){};
void tagMatch(bool doHiliteAttr); void tagMatch(bool doHiliteAttr);
private: private:

View File

@ -47,7 +47,7 @@ public:
generic_string getAscii(unsigned char value); generic_string getAscii(unsigned char value);
protected: protected:
int _codepage; int _codepage = -1;
WNDPROC _defaultProc; WNDPROC _defaultProc;
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

View File

@ -77,7 +77,7 @@ protected:
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private: private:
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView = nullptr;
ListView _listView; ListView _listView;
}; };
#endif // ANSICHARPANEL_H #endif // ANSICHARPANEL_H

View File

@ -207,8 +207,8 @@ INT_PTR CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam,
} }
case WM_CHANGECBCHAIN: case WM_CHANGECBCHAIN:
if (_hwndNextCbViewer == (HWND)wParam) if (_hwndNextCbViewer == reinterpret_cast<HWND>(wParam))
_hwndNextCbViewer = (HWND)lParam; _hwndNextCbViewer = reinterpret_cast<HWND>(lParam);
else if (_hwndNextCbViewer) else if (_hwndNextCbViewer)
::SendMessage(_hwndNextCbViewer, message, wParam, lParam); ::SendMessage(_hwndNextCbViewer, message, wParam, lParam);
return TRUE; return TRUE;

View File

@ -46,7 +46,7 @@ class ScintillaEditView;
class ByteArray { class ByteArray {
public: public:
ByteArray():_pBytes(NULL), _length(0) {}; ByteArray():_pBytes(NULL), _length(0) {};
ByteArray(ClipboardData cd); explicit ByteArray(ClipboardData cd);
~ByteArray() { ~ByteArray() {
if (_pBytes) if (_pBytes)

View File

@ -147,7 +147,6 @@ LRESULT ColourPicker::runProc(UINT Message, WPARAM wParam, LPARAM lParam)
HDC dc = (HDC)wParam; HDC dc = (HDC)wParam;
drawBackground(dc); drawBackground(dc);
return TRUE; return TRUE;
break;
} }
case WM_PAINT: case WM_PAINT:

View File

@ -43,7 +43,7 @@ DWORD colourItems[] = {
void ColourPopup::create(int dialogID) void ColourPopup::create(int dialogID)
{ {
_hSelf = ::CreateDialogParam(_hInst, MAKEINTRESOURCE(dialogID), _hParent, dlgProc, (LPARAM)this); _hSelf = ::CreateDialogParam(_hInst, MAKEINTRESOURCE(dialogID), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
if (!_hSelf) if (!_hSelf)
{ {
@ -60,7 +60,7 @@ INT_PTR CALLBACK ColourPopup::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LP
case WM_MEASUREITEM: case WM_MEASUREITEM:
{ {
RECT rc; RECT rc;
LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam; LPMEASUREITEMSTRUCT lpmis = reinterpret_cast<LPMEASUREITEMSTRUCT>(lParam);
::GetWindowRect(::GetDlgItem(hwnd, lpmis->CtlID), &rc); ::GetWindowRect(::GetDlgItem(hwnd, lpmis->CtlID), &rc);
lpmis->itemHeight = (rc.bottom-rc.top)/6; lpmis->itemHeight = (rc.bottom-rc.top)/6;
lpmis->itemWidth = (rc.right-rc.left)/8; lpmis->itemWidth = (rc.right-rc.left)/8;
@ -96,8 +96,8 @@ INT_PTR CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
int nColor; int nColor;
for (nColor = 0 ; nColor < int(sizeof(colourItems)/sizeof(DWORD)) ; ++nColor) for (nColor = 0 ; nColor < int(sizeof(colourItems)/sizeof(DWORD)) ; ++nColor)
{ {
::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_ADDSTRING, nColor, (LPARAM) ""); ::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_ADDSTRING, nColor, reinterpret_cast<LPARAM>(""));
::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_SETITEMDATA , nColor, (LPARAM) colourItems[nColor]); ::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_SETITEMDATA, nColor, static_cast<LPARAM>(colourItems[nColor]));
} }
return TRUE; return TRUE;
} }
@ -218,8 +218,8 @@ INT_PTR CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{ {
if (HIWORD(wParam) == LBN_SELCHANGE) if (HIWORD(wParam) == LBN_SELCHANGE)
{ {
auto i = ::SendMessage((HWND)lParam, LB_GETCURSEL, 0L, 0L); auto i = ::SendMessage(reinterpret_cast<HWND>(lParam), LB_GETCURSEL, 0L, 0L);
_colour = static_cast<COLORREF>(::SendMessage((HWND)lParam, LB_GETITEMDATA, i, 0L)); _colour = static_cast<COLORREF>(::SendMessage(reinterpret_cast<HWND>(lParam), LB_GETITEMDATA, i, 0L));
::SendMessage(_hParent, WM_PICKUP_COLOR, _colour, 0); ::SendMessage(_hParent, WM_PICKUP_COLOR, _colour, 0);
return TRUE; return TRUE;
@ -233,8 +233,7 @@ INT_PTR CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case WM_ACTIVATE : case WM_ACTIVATE :
{ {
if (LOWORD(wParam) == WA_INACTIVE) if (LOWORD(wParam) == WA_INACTIVE)
//if (!isColourChooserLaunched) ::SendMessage(_hParent, WM_PICKUP_CANCEL, 0, 0);
::SendMessage(_hParent, WM_PICKUP_CANCEL, 0, 0);
return TRUE; return TRUE;
} }

View File

@ -183,7 +183,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case WM_HSCROLL : case WM_HSCROLL :
{ {
if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER)) if (reinterpret_cast<HWND>(lParam) == ::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER))
{ {
int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0)); int percent = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0));
(NppParameters::getInstance())->SetTransparent(_hSelf, percent); (NppParameters::getInstance())->SetTransparent(_hSelf, percent);
@ -416,7 +416,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case CPN_COLOURPICKED: case CPN_COLOURPICKED:
{ {
if ((HWND)lParam == _pFgColour->getHSelf()) if (reinterpret_cast<HWND>(lParam) == _pFgColour->getHSelf())
{ {
updateColour(C_FOREGROUND); updateColour(C_FOREGROUND);
notifyDataModified(); notifyDataModified();
@ -428,7 +428,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
apply(); apply();
return TRUE; return TRUE;
} }
else if ((HWND)lParam == _pBgColour->getHSelf()) else if (reinterpret_cast<HWND>(lParam) == _pBgColour->getHSelf())
{ {
updateColour(C_BACKGROUND); updateColour(C_BACKGROUND);
notifyDataModified(); notifyDataModified();

View File

@ -69,7 +69,7 @@ private :
class WordStyleDlg : public StaticDialog class WordStyleDlg : public StaticDialog
{ {
public : public :
WordStyleDlg():_isDirty(false), _isThemeDirty(false), _restoreInvalid(false), /*_isSync(true),*/ _isShownGOCtrls(false){}; WordStyleDlg() {};
void init(HINSTANCE hInst, HWND parent) { void init(HINSTANCE hInst, HWND parent) {
Window::init(hInst, parent); Window::init(hInst, parent);
@ -119,13 +119,12 @@ public :
}; };
private : private :
ColourPicker *_pFgColour; ColourPicker *_pFgColour = nullptr;
ColourPicker *_pBgColour; ColourPicker *_pBgColour = nullptr;
int _currentLexerIndex; int _currentLexerIndex = -1;
int _currentThemeIndex; int _currentThemeIndex = -1;
HWND _hCheckBold; HWND _hCheckBold;
HWND _hCheckItalic; HWND _hCheckItalic;
@ -148,14 +147,13 @@ private :
LexerStylerArray _styles2restored; LexerStylerArray _styles2restored;
StyleArray _gstyles2restored; StyleArray _gstyles2restored;
GlobalOverride _gOverride2restored; GlobalOverride _gOverride2restored;
bool _restoreInvalid; bool _restoreInvalid = false;
ColourStaticTextHooker colourHooker; ColourStaticTextHooker colourHooker;
bool _isDirty; bool _isDirty = false;
bool _isThemeDirty; bool _isThemeDirty = false;
//bool _isSync; bool _isShownGOCtrls = false;
bool _isShownGOCtrls;
INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);

View File

@ -26,8 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCKING_H #pragma once
#define DOCKING_H
#include <windows.h> #include <windows.h>
@ -84,5 +83,3 @@ typedef struct {
#define HIT_TEST_THICKNESS 20 #define HIT_TEST_THICKNESS 20
#define SPLITTER_WIDTH 4 #define SPLITTER_WIDTH 4
#endif // DOCKING_H

View File

@ -339,7 +339,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
{ {
if (isInRect(hwnd, LOWORD(lParam), HIWORD(lParam)) == posCaption) if (isInRect(hwnd, LOWORD(lParam), HIWORD(lParam)) == posCaption)
::SendMessage(_hParent, DMM_FLOATALL, 0, (LPARAM)this); ::SendMessage(_hParent, DMM_FLOATALL, 0, reinterpret_cast<LPARAM>(this));
focusClient(); focusClient();
return TRUE; return TRUE;
@ -1463,6 +1463,6 @@ void DockingCont::focusClient()
LPARAM DockingCont::NotifyParent(UINT message) LPARAM DockingCont::NotifyParent(UINT message)
{ {
return ::SendMessage(_hParent, message, 0, (LPARAM)this); return ::SendMessage(_hParent, message, 0, reinterpret_cast<LPARAM>(this));
} }

View File

@ -26,17 +26,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCKINGCONT #pragma once
#define DOCKINGCONT
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#ifndef DOCKING_H
#include "Docking.h" #include "Docking.h"
#endif //DOCKING_H
#include <vector> #include <vector>
#include "StaticDialog.h" #include "StaticDialog.h"
#include "Common.h" #include "Common.h"
@ -243,6 +235,3 @@ private:
std::vector<tTbData *> _vTbData; std::vector<tTbData *> _vTbData;
}; };
#endif // DOCKINGCONT

View File

@ -25,16 +25,10 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
#ifndef DOCKINGDLGINTERFACE_H #pragma once
#define DOCKINGDLGINTERFACE_H
#ifndef DOCKING_RESOURCE_H
#include "dockingResource.h" #include "dockingResource.h"
#endif //DOCKING_RESOURCE_H
#ifndef DOCKING_H
#include "Docking.h" #include "Docking.h"
#endif //DOCKING_H
#include <assert.h> #include <assert.h>
#include <shlwapi.h> #include <shlwapi.h>
@ -47,17 +41,13 @@ class DockingDlgInterface : public StaticDialog
{ {
public: public:
DockingDlgInterface() = default; DockingDlgInterface() = default;
explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {}
explicit DockingDlgInterface(int dlgID)
: _dlgID(dlgID)
{}
virtual void init(HINSTANCE hInst, HWND parent) virtual void init(HINSTANCE hInst, HWND parent)
{ {
StaticDialog::init(hInst, parent); StaticDialog::init(hInst, parent);
TCHAR temp[MAX_PATH]; TCHAR temp[MAX_PATH];
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH); ::GetModuleFileName(reinterpret_cast<HMODULE>(hInst), temp, MAX_PATH);
_moduleName = ::PathFindFileName(temp); _moduleName = ::PathFindFileName(temp);
} }
@ -71,7 +61,7 @@ public:
// user information // user information
data->hClient = _hSelf; data->hClient = _hSelf;
data->pszName = (TCHAR *)_pluginName.c_str(); data->pszName = _pluginName.c_str();
// supported features by plugin // supported features by plugin
data->uMask = 0; data->uMask = 0;
@ -82,17 +72,16 @@ public:
virtual void updateDockingDlg() virtual void updateDockingDlg()
{ {
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, (LPARAM)_hSelf); ::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
} }
virtual void destroy() {} virtual void destroy() {}
virtual void setBackgroundColor(COLORREF) {} virtual void setBackgroundColor(COLORREF) {}
virtual void setForegroundColor(COLORREF) {} virtual void setForegroundColor(COLORREF) {}
virtual void display(bool toShow = true) const { virtual void display(bool toShow = true) const {
::SendMessage(_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0, (LPARAM)_hSelf); ::SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
} }
bool isClosed() const { bool isClosed() const {
@ -115,7 +104,7 @@ protected :
case WM_NOTIFY: case WM_NOTIFY:
{ {
LPNMHDR pnmh = (LPNMHDR)lParam; LPNMHDR pnmh = reinterpret_cast<LPNMHDR>(lParam);
if (pnmh->hwndFrom == _hParent) if (pnmh->hwndFrom == _hParent)
{ {
@ -157,5 +146,3 @@ protected :
generic_string _pluginName; generic_string _pluginName;
bool _isClosed = false; bool _isClosed = false;
}; };
#endif // DOCKINGDLGINTERFACE_H

View File

@ -75,8 +75,6 @@ LRESULT CALLBACK FocusWndProc(int nCode, WPARAM wParam, LPARAM lParam)
DockingManager::DockingManager() DockingManager::DockingManager()
{ {
_isInitialized = FALSE;
_hImageList = NULL;
memset(_iContMap, -1, CONT_MAP_MAX * sizeof(int)); memset(_iContMap, -1, CONT_MAP_MAX * sizeof(int));
_iContMap[0] = CONT_LEFT; _iContMap[0] = CONT_LEFT;
@ -297,7 +295,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
for (int iCont = 0; iCont < DOCKCONT_MAX; ++iCont) for (int iCont = 0; iCont < DOCKCONT_MAX; ++iCont)
{ {
if (_vSplitter[iCont]->getHSelf() == (HWND)lParam) if (_vSplitter[iCont]->getHSelf() == reinterpret_cast<HWND>(lParam))
{ {
switch (iCont) switch (iCont)
{ {
@ -384,7 +382,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
{ {
for (size_t uImageCnt = 0, len = _vImageList.size(); uImageCnt < len; ++uImageCnt) for (size_t uImageCnt = 0, len = _vImageList.size(); uImageCnt < len; ++uImageCnt)
{ {
if ((HWND)lParam == _vImageList[uImageCnt]) if (reinterpret_cast<HWND>(lParam) == _vImageList[uImageCnt])
{ {
return uImageCnt; return uImageCnt;
} }

View File

@ -25,29 +25,19 @@
// 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 DOCKINGMANAGER_H
#define DOCKINGMANAGER_H
#include <vector> #include <vector>
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include "Window.h" #include "Window.h"
#ifndef DOCKINGCONT
#include "DockingCont.h" #include "DockingCont.h"
#endif //DOCKINGCONT
class DockingSplitter;
#ifndef SPLITTER_CONTAINER_H
#include "SplitterContainer.h" #include "SplitterContainer.h"
#endif //SPLITTER_CONTAINER_H
#define DSPC_CLASS_NAME TEXT("dockingManager") #define DSPC_CLASS_NAME TEXT("dockingManager")
#define CONT_MAP_MAX 50 #define CONT_MAP_MAX 50
class DockingSplitter;
class DockingManager : public Window class DockingManager : public Window
{ {
@ -120,20 +110,19 @@ private :
BOOL ContExists(size_t iCont); BOOL ContExists(size_t iCont);
int FindEmptyContainer(); int FindEmptyContainer();
LRESULT SendNotify(HWND hWnd, UINT message); LRESULT SendNotify(HWND hWnd, UINT message);
private: private:
Window **_ppWindow; Window **_ppWindow = nullptr;
RECT _rcWork; RECT _rcWork;
RECT _rect; RECT _rect;
Window **_ppMainWindow; Window **_ppMainWindow = nullptr;
std::vector<HWND> _vImageList; std::vector<HWND> _vImageList;
HIMAGELIST _hImageList; HIMAGELIST _hImageList = nullptr;
std::vector<DockingCont*> _vContainer; std::vector<DockingCont*> _vContainer;
tDockMgr _dockData; tDockMgr _dockData;
static BOOL _isRegistered; static BOOL _isRegistered;
BOOL _isInitialized; BOOL _isInitialized = FALSE;
int _iContMap[CONT_MAP_MAX]; int _iContMap[CONT_MAP_MAX];
std::vector<DockingSplitter *> _vSplitter; std::vector<DockingSplitter *> _vSplitter;
}; };
#endif //DOCKINGMANAGER_H

View File

@ -327,7 +327,6 @@ void Gripper::onButtonUp()
POINT ptBuf = {0,0}; POINT ptBuf = {0,0};
RECT rc = {0}; RECT rc = {0};
RECT rcCorr = {0}; RECT rcCorr = {0};
DockingCont* pContMove = NULL;
::GetCursorPos(&pt); ::GetCursorPos(&pt);
getMousePoints(&pt, &ptBuf); getMousePoints(&pt, &ptBuf);
@ -363,6 +362,8 @@ void Gripper::onButtonUp()
/* correct rectangle position when mouse is not within */ /* correct rectangle position when mouse is not within */
DoCalcGripperRect(&rc, rcCorr, pt); DoCalcGripperRect(&rc, rcCorr, pt);
DockingCont* pContMove = NULL;
/* change location of toolbars */ /* change location of toolbars */
if (_startMovingFromTab == TRUE) if (_startMovingFromTab == TRUE)
{ {

View File

@ -26,13 +26,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCUMENTMAP_H #pragma once
#define DOCUMENTMAP_H
#ifndef DOCKINGDLGINTERFACE_H
#include "DockingDlgInterface.h" #include "DockingDlgInterface.h"
#endif //DOCKINGDLGINTERFACE_H
#include "documentMap_rc.h" #include "documentMap_rc.h"
#define DM_PANELTITLE TEXT("Document Map") #define DM_PANELTITLE TEXT("Document Map")
@ -94,9 +90,7 @@ private :
class DocumentMap : public DockingDlgInterface { class DocumentMap : public DockingDlgInterface {
public: public:
DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP), _ppEditView(NULL),\ DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP) {};
_pScintillaEditView(NULL), id4dockingCont(DM_NOFOCUSWHILECLICKINGCAPTION)
{};
void create(tTbData * data, bool isRTL = false) { void create(tTbData * data, bool isRTL = false) {
DockingDlgInterface::create(data, isRTL); DockingDlgInterface::create(data, isRTL);
@ -140,15 +134,12 @@ protected:
int getEditorTextZoneWidth(); int getEditorTextZoneWidth();
private: private:
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView = nullptr;
ScintillaEditView *_pScintillaEditView; ScintillaEditView *_pScintillaEditView = nullptr;
ViewZoneDlg _vzDlg; ViewZoneDlg _vzDlg;
// for needToRecomputeWith function // for needToRecomputeWith function
int _displayZoom; int _displayZoom = -1;
int _displayWidth; int _displayWidth = 0;
generic_string id4dockingCont; generic_string id4dockingCont = DM_NOFOCUSWHILECLICKINGCAPTION;
}; };
#endif // DOCUMENTMAP_H

View File

@ -67,7 +67,7 @@ protected :
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private : private :
ScintillaEditView **_ppEditView; ScintillaEditView **_ppEditView = nullptr;
bool findCharInRange(unsigned char beginRange, unsigned char endRange, int startPos, bool direction, bool wrap); bool findCharInRange(unsigned char beginRange, unsigned char endRange, int startPos, bool direction, bool wrap);
bool getRangeFromUI(unsigned char & startRange, unsigned char & endRange); bool getRangeFromUI(unsigned char & startRange, unsigned char & endRange);
void getDirectionFromUI(bool & whichDirection, bool & isWrap); void getDirectionFromUI(bool & whichDirection, bool & isWrap);

View File

@ -314,7 +314,6 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
{ {
DockingDlgInterface::init(hInst, hPere); DockingDlgInterface::init(hInst, hPere);
_ppEditView = ppEditView; _ppEditView = ppEditView;
bool isOK = false;
bool doLocalConf = (NppParameters::getInstance())->isLocal(); bool doLocalConf = (NppParameters::getInstance())->isLocal();
if (!doLocalConf) if (!doLocalConf)
@ -329,12 +328,12 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
if (PathFileExists(funcListDefaultXmlPath.c_str())) if (PathFileExists(funcListDefaultXmlPath.c_str()))
{ {
::CopyFile(funcListDefaultXmlPath.c_str(), funcListXmlPath.c_str(), TRUE); ::CopyFile(funcListDefaultXmlPath.c_str(), funcListXmlPath.c_str(), TRUE);
isOK = _funcParserMgr.init(funcListXmlPath, ppEditView); _funcParserMgr.init(funcListXmlPath, ppEditView);
} }
} }
else else
{ {
isOK = _funcParserMgr.init(funcListXmlPath, ppEditView); _funcParserMgr.init(funcListXmlPath, ppEditView);
} }
} }
else else
@ -343,11 +342,9 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml")); PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml"));
if (PathFileExists(funcListDefaultXmlPath.c_str())) if (PathFileExists(funcListDefaultXmlPath.c_str()))
{ {
isOK = _funcParserMgr.init(funcListDefaultXmlPath, ppEditView); _funcParserMgr.init(funcListDefaultXmlPath, ppEditView);
} }
} }
//return isOK;
} }
bool FunctionListPanel::openSelection(const TreeView & treeView) bool FunctionListPanel::openSelection(const TreeView & treeView)

View File

@ -24,13 +24,13 @@
// 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; #pragma once;
class ScintillaEditView; class ScintillaEditView;
class TiXmlDocument; class TiXmlDocument;
class TiXmlNode; class TiXmlNode;
struct foundInfo final struct foundInfo final
{ {
generic_string _data; generic_string _data;
@ -78,7 +78,6 @@ private:
generic_string _rangeExpr; generic_string _rangeExpr;
generic_string _openSymbole; generic_string _openSymbole;
generic_string _closeSymbole; generic_string _closeSymbole;
generic_string _functionExpr;
size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol, const std::vector< std::pair<int, int> > & commentZones, ScintillaEditView **ppEditView); size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol, const std::vector< std::pair<int, int> > & commentZones, ScintillaEditView **ppEditView);
}; };
@ -158,4 +157,4 @@ private:
bool getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector<generic_string> &classNameExprArray, generic_string &functionExprStr, std::vector<generic_string> &functionNameExprArray); bool getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector<generic_string> &classNameExprArray, generic_string &functionExprStr, std::vector<generic_string> &functionNameExprArray);
bool getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector<generic_string> &functionNameExprArray, std::vector<generic_string> &classNameExprArray); bool getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector<generic_string> &functionNameExprArray, std::vector<generic_string> &classNameExprArray);
FunctionParser * getParser(const AssociationInfo & assoInfo); FunctionParser * getParser(const AssociationInfo & assoInfo);
}; };

View File

@ -275,9 +275,9 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
//Get UserCommand corresponding to row //Get UserCommand corresponding to row
vector<UserCommand> & shortcuts = nppParam->getUserCommandList(); vector<UserCommand> & shortcuts = nppParam->getUserCommandList();
UserCommand ucmd = shortcuts[row - 1], prevucmd = shortcuts[row - 1]; UserCommand ucmd = shortcuts[row - 1];
ucmd.init(_hInst, _hSelf); ucmd.init(_hInst, _hSelf);
prevucmd = ucmd; UserCommand prevucmd = ucmd;
if (ucmd.doDialog() != -1 && prevucmd != ucmd) if (ucmd.doDialog() != -1 && prevucmd != ucmd)
{ {
//shortcut was altered //shortcut was altered
@ -296,9 +296,9 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
//Get PluginCmdShortcut corresponding to row //Get PluginCmdShortcut corresponding to row
vector<PluginCmdShortcut> & shortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & shortcuts = nppParam->getPluginCommandList();
PluginCmdShortcut pcsc = shortcuts[row - 1], prevpcsc = shortcuts[row - 1]; PluginCmdShortcut pcsc = shortcuts[row - 1];
pcsc.init(_hInst, _hSelf); pcsc.init(_hInst, _hSelf);
prevpcsc = pcsc; PluginCmdShortcut prevpcsc = pcsc;
if (pcsc.doDialog() != -1 && prevpcsc != pcsc) if (pcsc.doDialog() != -1 && prevpcsc != pcsc)
{ {
//shortcut was altered //shortcut was altered

View File

@ -26,24 +26,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SHORTCUTMAPPER #pragma once
#define SHORTCUTMAPPER
#ifndef BABYGRIDWRAPPER
#include "BabyGridWrapper.h" #include "BabyGridWrapper.h"
#endif// BABYGRIDWRAPPER
#ifndef SHORTCUTMAPPER_RC_H
#include "ShortcutMapper_rc.h" #include "ShortcutMapper_rc.h"
#endif //SHORTCUTMAPPER_RC_H
#ifndef SHORTCUTS_H
#include "shortcut.h" #include "shortcut.h"
#endif// SHORTCUTS_H
#ifndef CONTEXTMENU_H
#include "ContextMenu.h" #include "ContextMenu.h"
#endif// CONTEXTMENU_H
enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTILLA}; enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTILLA};
@ -69,11 +57,11 @@ public:
{ {
DLGTEMPLATE *pMyDlgTemplate = NULL; DLGTEMPLATE *pMyDlgTemplate = NULL;
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_SHORTCUTMAPPER_DLG, &pMyDlgTemplate); HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_SHORTCUTMAPPER_DLG, &pMyDlgTemplate);
::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, (LPARAM)this); ::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
::GlobalFree(hMyDlgTemplate); ::GlobalFree(hMyDlgTemplate);
} }
else else
::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTMAPPER_DLG), _hParent, dlgProc, (LPARAM)this); ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTMAPPER_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
}; };
void getClientRect(RECT & rc) const; void getClientRect(RECT & rc) const;
void translateTab(int index, const TCHAR * newname); void translateTab(int index, const TCHAR * newname);
@ -96,4 +84,3 @@ private:
void fillOutBabyGrid(); void fillOutBabyGrid();
}; };
#endif //SHORTCUTMAPPER

View File

@ -26,8 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef IMAGE_LIST_H #pragma once
#define IMAGE_LIST_H
#include <vector> #include <vector>
#include <windows.h> #include <windows.h>
@ -39,7 +38,7 @@ const int nbMax = 45;
class IconList class IconList
{ {
public : public :
IconList() : _hImglst(NULL) {}; IconList() {};
void create(HINSTANCE hInst, int iconSize); void create(HINSTANCE hInst, int iconSize);
void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize); void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize);
@ -52,11 +51,11 @@ public :
void setIconSize(int size) const; void setIconSize(int size) const;
private : private :
HIMAGELIST _hImglst; HIMAGELIST _hImglst = nullptr;
HINSTANCE _hInst; HINSTANCE _hInst = nullptr;
int *_pIconIDArray; int *_pIconIDArray = nullptr;
int _iconIDArraySize; int _iconIDArraySize = 0;
int _iconSize; int _iconSize = 0;
}; };
typedef struct typedef struct
@ -139,4 +138,3 @@ private :
unsigned int _nbCmd; unsigned int _nbCmd;
}; };
#endif //IMAGE_LIST_H

View File

@ -637,7 +637,7 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
{ {
HWND hCaretBlikRateSlider = ::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER); HWND hCaretBlikRateSlider = ::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER);
HWND hBorderWidthSlider = ::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER); HWND hBorderWidthSlider = ::GetDlgItem(_hSelf, IDC_BORDERWIDTH_SLIDER);
if ((HWND)lParam == hCaretBlikRateSlider) if (reinterpret_cast<HWND>(lParam) == hCaretBlikRateSlider)
{ {
int blinkRate = (int)::SendMessage(hCaretBlikRateSlider, TBM_GETPOS, 0, 0); int blinkRate = (int)::SendMessage(hCaretBlikRateSlider, TBM_GETPOS, 0, 0);
if (blinkRate == BLINKRATE_SLOWEST) if (blinkRate == BLINKRATE_SLOWEST)
@ -646,7 +646,7 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
} }
else if ((HWND)lParam == hBorderWidthSlider) else if (reinterpret_cast<HWND>(lParam) == hBorderWidthSlider)
{ {
int borderWidth = (int)::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0); int borderWidth = (int)::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
@ -2912,12 +2912,9 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LP
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
// Default settings: no cloud
bool withCloud = false;
generic_string message = TEXT(""); generic_string message = TEXT("");
withCloud = nppGUI._cloudPath != TEXT(""); bool withCloud = nppGUI._cloudPath != TEXT("");
if (withCloud) if (withCloud)
{ {
// detect validation of path // detect validation of path

View File

@ -1202,10 +1202,10 @@ int FileRelocalizerDlg::doDialog(const TCHAR *fn, bool isRTL)
{ {
DLGTEMPLATE *pMyDlgTemplate = NULL; DLGTEMPLATE *pMyDlgTemplate = NULL;
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_FILERELOCALIZER_DIALOG, &pMyDlgTemplate); HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_FILERELOCALIZER_DIALOG, &pMyDlgTemplate);
int result = static_cast<int32_t>(::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, (LPARAM)this)); int result = static_cast<int32_t>(::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
::GlobalFree(hMyDlgTemplate); ::GlobalFree(hMyDlgTemplate);
return result; return result;
} }
return static_cast<int32_t>(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_FILERELOCALIZER_DIALOG), _hParent, dlgProc, (LPARAM)this)); return static_cast<int32_t>(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_FILERELOCALIZER_DIALOG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
} }

View File

@ -104,7 +104,7 @@ protected:
class CReadChangesServer class CReadChangesServer
{ {
public: public:
CReadChangesServer(CReadDirectoryChanges* pParent) explicit CReadChangesServer(CReadDirectoryChanges* pParent)
{ {
m_bTerminate=false; m_nOutstandingRequests=0;m_pBase=pParent; m_bTerminate=false; m_nOutstandingRequests=0;m_pBase=pParent;
} }

View File

@ -43,8 +43,8 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str
class Command { class Command {
public : public :
Command(){}; Command(){};
Command(TCHAR *cmd) : _cmdLine(cmd){}; explicit Command(TCHAR *cmd) : _cmdLine(cmd){};
Command(generic_string cmd) : _cmdLine(cmd){}; explicit Command(generic_string cmd) : _cmdLine(cmd){};
HINSTANCE run(HWND hWnd); HINSTANCE run(HWND hWnd);
protected : protected :

View File

@ -26,14 +26,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef CONTROLS_TAB_H #pragma once
#define CONTROLS_TAB_H
#ifndef TAB_BAR_H
#include "TabBar.h" #include "TabBar.h"
#endif //TAB_BAR_H
#include "Window.h" #include "Window.h"
#include "Common.h" #include "Common.h"
@ -82,9 +77,5 @@ public :
private: private:
WindowVector *_pWinVector = nullptr; WindowVector *_pWinVector = nullptr;
int _current = 0; int _current = 0;
bool _isVertical = false;
}; };
#endif //CONTROLS_TAB_H

View File

@ -26,21 +26,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef TAB_BAR_H #pragma once
#define TAB_BAR_H
#ifndef _WIN32_IE #ifndef _WIN32_IE
#define _WIN32_IE 0x0600 #define _WIN32_IE 0x0600
#endif //_WIN32_IE #endif //_WIN32_IE
#ifndef MENUCMDID_H
#include "menuCmdID.h" #include "menuCmdID.h"
#endif //MENUCMDID_H
#ifndef RESOURCE_H
#include "resource.h" #include "resource.h"
#endif //RESOURCE_H
#include <stdint.h> #include <stdint.h>
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
@ -72,7 +65,7 @@ struct TBHDR
class TabBar : public Window class TabBar : public Window
{ {
public: public:
TabBar() : Window(), _nbItem(0), _hasImgLst(false), _hFont(NULL), _hLargeFont(NULL), _hVerticalFont(NULL), _hVerticalLargeFont(NULL){}; TabBar() : Window() {};
virtual ~TabBar() {}; virtual ~TabBar() {};
virtual void destroy(); virtual void destroy();
virtual void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isTraditional = false, bool isMultiLine = false); virtual void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isTraditional = false, bool isMultiLine = false);
@ -114,18 +107,18 @@ public:
protected: protected:
size_t _nbItem; size_t _nbItem = 0;
bool _hasImgLst; bool _hasImgLst = false;
HFONT _hFont; HFONT _hFont = nullptr;
HFONT _hLargeFont; HFONT _hLargeFont = nullptr;
HFONT _hVerticalFont; HFONT _hVerticalFont = nullptr;
HFONT _hVerticalLargeFont; HFONT _hVerticalLargeFont = nullptr;
int _ctrlID; int _ctrlID = 0;
bool _isTraditional; bool _isTraditional = false;
bool _isVertical; bool _isVertical = false;
bool _isMultiLine; bool _isMultiLine = false;
long getRowCount() const { long getRowCount() const {
return long(::SendMessage(_hSelf, TCM_GETROWCOUNT, 0, 0)); return long(::SendMessage(_hSelf, TCM_GETROWCOUNT, 0, 0));
@ -148,8 +141,7 @@ struct CloseButtonZone
class TabBarPlus : public TabBar class TabBarPlus : public TabBar
{ {
public : public :
TabBarPlus() : TabBar(), _isDragging(false), _tabBarDefaultProc(NULL), _currentHoverTabItem(-1),\ TabBarPlus() : TabBar() {};
_isCloseHover(false), _whichCloseClickDown(-1), _lmbdHit(false), _tooltips(NULL) {};
enum tabColourIndex { enum tabColourIndex {
activeText, activeFocusedTop, activeUnfocusedTop, inactiveText, inactiveBg activeText, activeFocusedTop, activeUnfocusedTop, inactiveText, inactiveBg
}; };
@ -229,21 +221,21 @@ protected:
// it's the boss to decide if we do the drag N drop // it's the boss to decide if we do the drag N drop
static bool _doDragNDrop; static bool _doDragNDrop;
// drag N drop members // drag N drop members
bool _isDragging; bool _isDragging = false;
bool _isDraggingInside; bool _isDraggingInside = false;
int _nSrcTab; int _nSrcTab = -1;
int _nTabDragged; int _nTabDragged = -1;
POINT _draggingPoint; // coordinate of Screen POINT _draggingPoint; // coordinate of Screen
WNDPROC _tabBarDefaultProc; WNDPROC _tabBarDefaultProc = nullptr;
RECT _currentHoverTabRect; RECT _currentHoverTabRect;
int _currentHoverTabItem; int _currentHoverTabItem = -1;
CloseButtonZone _closeButtonZone; CloseButtonZone _closeButtonZone;
bool _isCloseHover; bool _isCloseHover = false;
int _whichCloseClickDown; int _whichCloseClickDown = -1;
bool _lmbdHit; // Left Mouse Button Down Hit bool _lmbdHit = false; // Left Mouse Button Down Hit
HWND _tooltips; HWND _tooltips = nullptr;
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
@ -294,5 +286,3 @@ protected:
(screenPoint.y >= parentZone.top) && (screenPoint.y <= parentZone.bottom)); (screenPoint.y >= parentZone.top) && (screenPoint.y <= parentZone.bottom));
} }
}; };
#endif // TAB_BAR_H

View File

@ -40,7 +40,7 @@
class TaskList : public Window class TaskList : public Window
{ {
public: public:
TaskList() : Window(), _currentIndex(0), _hFont(NULL), _hFontSelected(NULL) { TaskList() : Window() {
_rc.left = 0; _rc.left = 0;
_rc.top = 0; _rc.top = 0;
_rc.right = 150; _rc.right = 150;
@ -70,10 +70,10 @@ protected:
return (((TaskList *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(hwnd, Message, wParam, lParam)); return (((TaskList *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(hwnd, Message, wParam, lParam));
}; };
HFONT _hFont; HFONT _hFont = nullptr;
HFONT _hFontSelected; HFONT _hFontSelected = nullptr;
int _nbItem; int _nbItem = 0;
int _currentIndex; int _currentIndex = 0;
RECT _rc; RECT _rc;
}; };

View File

@ -47,11 +47,11 @@ LRESULT CALLBACK hookProc(UINT nCode, WPARAM wParam, LPARAM lParam)
{ {
DLGTEMPLATE *pMyDlgTemplate = NULL; DLGTEMPLATE *pMyDlgTemplate = NULL;
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate); HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate);
int result = static_cast<int32_t>(::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, (LPARAM)this)); int result = static_cast<int32_t>(::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
::GlobalFree(hMyDlgTemplate); ::GlobalFree(hMyDlgTemplate);
return result; return result;
} }
return static_cast<int32_t>(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_TASKLIST_DLG), _hParent, dlgProc, (LPARAM)this)); return static_cast<int32_t>(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_TASKLIST_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
} }
INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)

View File

@ -26,37 +26,23 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef TASKLISTDLG_H #pragma once
#define TASKLISTDLG_H
#include "Common.h" #include "Common.h"
#include "StaticDialog.h" #include "StaticDialog.h"
#ifndef TASKLISTDLGRC_H
#include "TaskListDlg_rc.h" #include "TaskListDlg_rc.h"
#endif //TASKLISTDLGRC_H
#ifndef TASKLIST_H
#include "TaskList.h" #include "TaskList.h"
#endif //TASKLIST_H
/*
#ifndef IMAGE_LIST_H
#include "ImageListSet.h"
#endif //IMAGE_LIST_H
*/
#ifndef NOTEPAD_PLUS_MSGS_H
#include "Notepad_plus_msgs.h" #include "Notepad_plus_msgs.h"
#endif //NOTEPAD_PLUS_MSGS_H
#define TASKLIST_USER (WM_USER + 8000) #define TASKLIST_USER (WM_USER + 8000)
#define WM_GETTASKLISTINFO (TASKLIST_USER + 01) #define WM_GETTASKLISTINFO (TASKLIST_USER + 01)
struct TaskLstFnStatus { struct TaskLstFnStatus {
int _iView; int _iView = -1;
int _docIndex; int _docIndex = 0;
generic_string _fn; generic_string _fn;
int _status; int _status = 0;
void *_bufID; void *_bufID = nullptr;
TaskLstFnStatus(generic_string str, int status) : _fn(str), _status(status){}; TaskLstFnStatus(generic_string str, int status) : _fn(str), _status(status){};
TaskLstFnStatus(int iView, int docIndex, generic_string str, int status, void *bufID) : TaskLstFnStatus(int iView, int docIndex, generic_string str, int status, void *bufID) :
_iView(iView), _docIndex(docIndex), _fn(str), _status(status), _bufID(bufID) {}; _iView(iView), _docIndex(docIndex), _fn(str), _status(status), _bufID(bufID) {};
@ -64,7 +50,7 @@ struct TaskLstFnStatus {
struct TaskListInfo { struct TaskListInfo {
std::vector<TaskLstFnStatus> _tlfsLst; std::vector<TaskLstFnStatus> _tlfsLst;
int _currentIndex; int _currentIndex = -1;
}; };
static HWND hWndServer = NULL; static HWND hWndServer = NULL;
@ -91,11 +77,9 @@ private :
TaskList _taskList; TaskList _taskList;
TaskListInfo _taskListInfo; TaskListInfo _taskListInfo;
HIMAGELIST _hImalist; HIMAGELIST _hImalist;
bool _initDir; bool _initDir = false;
HHOOK _hHooker; HHOOK _hHooker = nullptr;
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
}; };
#endif // TASKLISTDLG_H

View File

@ -350,33 +350,38 @@ void ToolBar::registerDynBtn(UINT messageID, toolbarIcons* tIcon)
} }
} }
void ToolBar::doPopop(POINT chevPoint) { void ToolBar::doPopop(POINT chevPoint)
{
//first find hidden buttons //first find hidden buttons
int width = Window::getWidth(); int width = Window::getWidth();
size_t start = 0; size_t start = 0;
RECT btnRect = {0,0,0,0}; RECT btnRect = {0,0,0,0};
while(start < _nrCurrentButtons) { while(start < _nrCurrentButtons)
{
::SendMessage(_hSelf, TB_GETITEMRECT, start, (LPARAM)&btnRect); ::SendMessage(_hSelf, TB_GETITEMRECT, start, (LPARAM)&btnRect);
if(btnRect.right > width) if(btnRect.right > width)
break; break;
++start; ++start;
} }
if (start < _nrCurrentButtons) { //some buttons are hidden if (start < _nrCurrentButtons)
{ //some buttons are hidden
HMENU menu = ::CreatePopupMenu(); HMENU menu = ::CreatePopupMenu();
int cmd;
generic_string text; generic_string text;
while (start < _nrCurrentButtons) { while (start < _nrCurrentButtons)
cmd = _pTBB[start].idCommand; {
int cmd = _pTBB[start].idCommand;
getNameStrFromCmd(cmd, text); getNameStrFromCmd(cmd, text);
if (_pTBB[start].idCommand != 0) { if (_pTBB[start].idCommand != 0)
{
if (::SendMessage(_hSelf, TB_ISBUTTONENABLED, cmd, 0) != 0) if (::SendMessage(_hSelf, TB_ISBUTTONENABLED, cmd, 0) != 0)
AppendMenu(menu, MF_ENABLED, cmd, text.c_str()); AppendMenu(menu, MF_ENABLED, cmd, text.c_str());
else else
AppendMenu(menu, MF_DISABLED|MF_GRAYED, cmd, text.c_str()); AppendMenu(menu, MF_DISABLED|MF_GRAYED, cmd, text.c_str());
} else } else
AppendMenu(menu, MF_SEPARATOR, 0, TEXT("")); AppendMenu(menu, MF_SEPARATOR, 0, TEXT(""));
++start; ++start;
} }
TrackPopupMenu(menu, 0, chevPoint.x, chevPoint.y, 0, _hSelf, NULL); TrackPopupMenu(menu, 0, chevPoint.x, chevPoint.y, 0, _hSelf, NULL);
@ -513,11 +518,10 @@ void ReBar::setGrayBackground(int id)
int ReBar::getNewID() int ReBar::getNewID()
{ {
int idToUse = REBAR_BAR_EXTERNAL; int idToUse = REBAR_BAR_EXTERNAL;
int curVal = 0;
size_t size = usedIDs.size(); size_t size = usedIDs.size();
for(size_t i = 0; i < size; ++i) for(size_t i = 0; i < size; ++i)
{ {
curVal = usedIDs.at(i); int curVal = usedIDs.at(i);
if (curVal < idToUse) if (curVal < idToUse)
{ {
continue; continue;

View File

@ -42,7 +42,7 @@
#define _WIN32_IE 0x0600 #define _WIN32_IE 0x0600
#endif //_WIN32_IE #endif //_WIN32_IE
enum toolBarStatusType {/*TB_HIDE, */TB_SMALL, TB_LARGE, TB_STANDARD}; enum toolBarStatusType {TB_SMALL, TB_LARGE, TB_STANDARD};
typedef struct { typedef struct {
@ -67,7 +67,7 @@ class TiXmlNode;
class ToolBar : public Window class ToolBar : public Window
{ {
public : public :
ToolBar():Window(), _pTBB(NULL), _nrButtons(0), _nrDynButtons(0), _nrTotalButtons(0), _nrCurrentButtons(0), _pRebar(NULL) {}; ToolBar():Window() {};
virtual ~ToolBar(){}; virtual ~ToolBar(){};
void initTheme(TiXmlDocument *toolIconsDocRoot); void initTheme(TiXmlDocument *toolIconsDocRoot);
@ -117,19 +117,18 @@ public :
void addToRebar(ReBar * rebar); void addToRebar(ReBar * rebar);
private : private :
TBBUTTON *_pTBB; TBBUTTON *_pTBB = nullptr;
ToolBarIcons _toolBarIcons; ToolBarIcons _toolBarIcons;
toolBarStatusType _state; toolBarStatusType _state = TB_SMALL;
std::vector<tDynamicList> _vDynBtnReg; std::vector<tDynamicList> _vDynBtnReg;
size_t _nrButtons; size_t _nrButtons = 0;
size_t _nrDynButtons; size_t _nrDynButtons = 0;
size_t _nrTotalButtons; size_t _nrTotalButtons = 0;
size_t _nrCurrentButtons; size_t _nrCurrentButtons = 0;
ReBar * _pRebar; ReBar * _pRebar = nullptr;
REBARBANDINFO _rbBand; REBARBANDINFO _rbBand;
std::vector<iconLocator> _customIconVect; std::vector<iconLocator> _customIconVect;
TiXmlNode *_toolIcons; TiXmlNode *_toolIcons = nullptr;
void setDefaultImageList() { void setDefaultImageList() {
::SendMessage(_hSelf, TB_SETIMAGELIST , (WPARAM)0, (LPARAM)_toolBarIcons.getDefaultLst()); ::SendMessage(_hSelf, TB_SETIMAGELIST , (WPARAM)0, (LPARAM)_toolBarIcons.getDefaultLst());

View File

@ -42,7 +42,7 @@
class SizeableDlg : public StaticDialog { class SizeableDlg : public StaticDialog {
typedef StaticDialog MyBaseClass; typedef StaticDialog MyBaseClass;
public: public:
SizeableDlg(WINRECT* pWinMap); explicit SizeableDlg(WINRECT* pWinMap);
protected: protected:
CWinMgr _winMgr; // window manager CWinMgr _winMgr; // window manager

View File

@ -225,7 +225,7 @@ struct NMWINMGR : public NMHDR {
// //
class CWinMgr /*: public CObject*/ { class CWinMgr /*: public CObject*/ {
public: public:
CWinMgr(WINRECT* map); explicit CWinMgr(WINRECT* map);
virtual ~CWinMgr(); virtual ~CWinMgr();
virtual void GetWindowPositions(HWND hWnd); // load map from window posns virtual void GetWindowPositions(HWND hWnd); // load map from window posns

View File

@ -199,7 +199,7 @@ END_WINDOW_MAP()
RECT WindowsDlg::_lastKnownLocation; RECT WindowsDlg::_lastKnownLocation;
WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap), _isSorted(false) WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap)
{ {
_szMinButton = SIZEZERO; _szMinButton = SIZEZERO;
_szMinListCtrl = SIZEZERO; _szMinListCtrl = SIZEZERO;
@ -429,7 +429,7 @@ void WindowsDlg::updateButtonState()
int WindowsDlg::doDialog(TiXmlNodeA *dlgNode) int WindowsDlg::doDialog(TiXmlNodeA *dlgNode)
{ {
_dlgNode = dlgNode; _dlgNode = dlgNode;
return (int)::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_WINDOWS), _hParent, dlgProc, (LPARAM)this); return (int)::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_WINDOWS), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
}; };
bool WindowsDlg::changeDlgLang() bool WindowsDlg::changeDlgLang()

View File

@ -26,8 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef WINDOWS_DLG_H #pragma once
#define WINDOWS_DLG_H
#include "SizeableDlg.h" #include "SizeableDlg.h"
#include "Common.h" #include "Common.h"
@ -91,15 +90,15 @@ protected :
void updateButtonState(); void updateButtonState();
void activateCurrent(); void activateCurrent();
HWND _hList; HWND _hList = nullptr;
static RECT _lastKnownLocation; static RECT _lastKnownLocation;
SIZE _szMinButton; SIZE _szMinButton;
SIZE _szMinListCtrl; SIZE _szMinListCtrl;
DocTabView *_pTab; DocTabView *_pTab = nullptr;
std::vector<int> _idxMap; std::vector<int> _idxMap;
int _lastSort; int _lastSort = -1;
bool _isSorted; bool _isSorted = false;
TiXmlNodeA *_dlgNode; TiXmlNodeA *_dlgNode = nullptr;
private: private:
virtual void init(HINSTANCE hInst, HWND parent); virtual void init(HINSTANCE hInst, HWND parent);
@ -111,12 +110,9 @@ public:
WindowsMenu(); WindowsMenu();
~WindowsMenu(); ~WindowsMenu();
void init(HINSTANCE hInst, HMENU hMainMenu, const TCHAR *translation); void init(HINSTANCE hInst, HMENU hMainMenu, const TCHAR *translation);
//void initMenu(HMENU hMenu, ScintillaEditView *pView);
void initPopupMenu(HMENU hMenu, DocTabView *pTab); void initPopupMenu(HMENU hMenu, DocTabView *pTab);
//void uninitPopupMenu(HMENU hMenu, ScintillaEditView *pView);
private: private:
HMENU _hMenu; HMENU _hMenu;
}; };
#endif //WINDOWS_DLG_H

View File

@ -27,13 +27,9 @@
// created by Daniel Volk mordorpost@volkarts.com // created by Daniel Volk mordorpost@volkarts.com
#ifndef RUN_MACRO_DLG_H #pragma once
#define RUN_MACRO_DLG_H
#ifndef RUN_MACRO_DLG_RC_H
#include "RunMacroDlg_rc.h" #include "RunMacroDlg_rc.h"
#endif //RUN_MACRO_DLG_RC_H
#include "StaticDialog.h" #include "StaticDialog.h"
#define RM_CANCEL -1 #define RM_CANCEL -1
@ -43,7 +39,7 @@
class RunMacroDlg : public StaticDialog class RunMacroDlg : public StaticDialog
{ {
public : public :
RunMacroDlg() : StaticDialog(), _mode(RM_RUN_MULTI), _times(1) {}; RunMacroDlg() : StaticDialog() {};
~RunMacroDlg() { ~RunMacroDlg() {
}; };
@ -68,9 +64,7 @@ private :
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
void check(int); void check(int);
int _mode; int _mode = RM_RUN_MULTI;
int _times; int _times = 1;
int _macroIndex; int _macroIndex = 0;
}; };
#endif //RUN_MACRO_DLG_H

View File

@ -589,7 +589,7 @@ void Accelerator::updateMenuItemByCommand(CommandShortcut csc)
// Ensure that the menu item checks set prior to this update remain in affect. // Ensure that the menu item checks set prior to this update remain in affect.
UINT cmdFlags = GetMenuState(_hAccelMenu, cmdID, MF_BYCOMMAND ); UINT cmdFlags = GetMenuState(_hAccelMenu, cmdID, MF_BYCOMMAND );
cmdFlags = MF_BYCOMMAND | (cmdFlags&MF_CHECKED) ? ( MF_CHECKED ) : ( MF_UNCHECKED ); cmdFlags = MF_BYCOMMAND | ((cmdFlags&MF_CHECKED) ? MF_CHECKED : MF_UNCHECKED);
::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str()); ::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str());
} }

View File

@ -26,17 +26,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SHORTCUTS_H #pragma once
#define SHORTCUTS_H
#ifndef IDD_SHORTCUT_DLG
#include "shortcutRc.h" #include "shortcutRc.h"
#endif //IDD_SHORTCUT_DLG
#ifndef SCINTILLA_H
#include "Scintilla.h" #include "Scintilla.h"
#endif //SCINTILLA_H
#include "StaticDialog.h" #include "StaticDialog.h"
#include "Common.h" #include "Common.h"
@ -139,7 +132,7 @@ public:
virtual INT_PTR doDialog() virtual INT_PTR doDialog()
{ {
return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUT_DLG), _hParent, dlgProc, (LPARAM)this); return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUT_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
}; };
virtual bool isValid() const { //valid should only be used in cases where the shortcut isEnabled(). virtual bool isValid() const { //valid should only be used in cases where the shortcut isEnabled().
@ -233,7 +226,7 @@ public:
INT_PTR doDialog() INT_PTR doDialog()
{ {
return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTSCINT_DLG), _hParent, dlgProc, (LPARAM)this); return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTSCINT_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
}; };
//only compares the internal KeyCombos, nothing else //only compares the internal KeyCombos, nothing else
@ -277,15 +270,15 @@ class ScintillaEditView;
struct recordedMacroStep { struct recordedMacroStep {
enum MacroTypeIndex {mtUseLParameter, mtUseSParameter, mtMenuCommand, mtSavedSnR}; enum MacroTypeIndex {mtUseLParameter, mtUseSParameter, mtMenuCommand, mtSavedSnR};
int _message; int _message = 0;
long _wParameter; long _wParameter = 0;
long _lParameter; long _lParameter = 0;
generic_string _sParameter; generic_string _sParameter;
MacroTypeIndex _macroType; MacroTypeIndex _macroType = mtMenuCommand;
recordedMacroStep(int iMessage, long wParam, long lParam, int codepage); recordedMacroStep(int iMessage, long wParam, long lParam, int codepage);
recordedMacroStep(int iCommandID) : _message(0), _wParameter(iCommandID), _lParameter(0), _macroType(mtMenuCommand) {}; explicit recordedMacroStep(int iCommandID): _wParameter(iCommandID) {};
recordedMacroStep(int iMessage, long wParam, long lParam, const TCHAR *sParam, int type) recordedMacroStep(int iMessage, long wParam, long lParam, const TCHAR *sParam, int type)
: _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(MacroTypeIndex(type)){ : _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(MacroTypeIndex(type)){
@ -391,5 +384,3 @@ private:
void updateMenuItemByID(ScintillaKeyMap skm, int id); void updateMenuItemByID(ScintillaKeyMap skm, int id);
}; };
#endif //SHORTCUTS_H

View File

@ -26,19 +26,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef LASTRECENTFILELIST_H #pragma once
#define LASTRECENTFILELIST_H
#ifndef PARAMETERS_H
#include "Parameters.h" #include "Parameters.h"
#endif //PARAMETERS_H
#include <deque> #include <deque>
struct RecentItem { struct RecentItem {
int _id = 0; int _id = 0;
generic_string _name; generic_string _name;
RecentItem(const TCHAR * name) : _name(name) {}; explicit RecentItem(const TCHAR * name) : _name(name) {};
}; };
typedef std::deque<RecentItem> recentList; typedef std::deque<RecentItem> recentList;
@ -46,7 +42,7 @@ typedef std::deque<RecentItem> recentList;
class LastRecentFileList class LastRecentFileList
{ {
public: public:
LastRecentFileList() : _hasSeparators(false), _size(0), _locked(false) { LastRecentFileList() {
_userMax = (NppParameters::getInstance())->getNbMaxRecentFile(); _userMax = (NppParameters::getInstance())->getNbMaxRecentFile();
}; };
@ -99,19 +95,19 @@ public:
private: private:
recentList _lrfl; recentList _lrfl;
Accelerator *_pAccelerator; Accelerator *_pAccelerator = nullptr;
int _userMax; int _userMax = 0;
int _size; int _size = 0;
int _nativeLangEncoding; int _nativeLangEncoding = -1;
// For the menu // For the menu
HMENU _hParentMenu; HMENU _hParentMenu = nullptr;
HMENU _hMenu; HMENU _hMenu = nullptr;
int _posBase; int _posBase = -1;
int _idBase; int _idBase = -1;
bool _idFreeArray[NB_MAX_LRF_FILE]; bool _idFreeArray[NB_MAX_LRF_FILE];
bool _hasSeparators; bool _hasSeparators = false;
bool _locked; bool _locked = false;
int find(const TCHAR *fn); int find(const TCHAR *fn);
@ -119,4 +115,3 @@ private:
void setAvailable(int id); void setAvailable(int id);
}; };
#endif //LASTRECENTFILELIST_H

View File

@ -45,11 +45,11 @@ int ValueDlg::doDialog(POINT p, bool isRTL)
{ {
DLGTEMPLATE *pMyDlgTemplate = NULL; DLGTEMPLATE *pMyDlgTemplate = NULL;
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate); HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_VALUE_DLG, &pMyDlgTemplate);
int result = static_cast<int32_t>(::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, (LPARAM)this)); int result = static_cast<int32_t>(::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
::GlobalFree(hMyDlgTemplate); ::GlobalFree(hMyDlgTemplate);
return result; return result;
} }
return static_cast<int32_t>(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_VALUE_DLG), _hParent, dlgProc, (LPARAM)this)); return static_cast<int32_t>(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_VALUE_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
} }