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

This commit is contained in:
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; }
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);
private:
@ -68,7 +68,7 @@ public:
bool isWrite() const { return _isWrite; }
ExceptionAddress badAddress() const { return _badAddress; }
private:
Win32AccessViolation(EXCEPTION_POINTERS * info);
explicit Win32AccessViolation(EXCEPTION_POINTERS * info);
bool _isWrite;
ExceptionAddress _badAddress;

View File

@ -26,8 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef PROCESSUS_H
#define PROCESSUS_H
#pragma once
#include <windows.h>
//#include <string>
@ -38,8 +37,6 @@ class Process
public:
Process() {}
Process(const TCHAR *cmd, const TCHAR *cDir)
: _stdoutStr(TEXT("")), _stderrStr(TEXT("")), _hPipeOutR(NULL),
_hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL)
{
lstrcpy(_command, cmd);
lstrcpy(_curDir, cDir);
@ -75,13 +72,13 @@ protected:
// LES SORTIES
generic_string _stdoutStr;
generic_string _stderrStr;
int _exitCode;
int _exitCode = 0;
// LES HANDLES
HANDLE _hPipeOutR;
HANDLE _hPipeErrR;
HANDLE _hProcess;
HANDLE _hProcessThread;
HANDLE _hPipeOutR = nullptr;
HANDLE _hPipeErrR = nullptr;
HANDLE _hProcess = nullptr;
HANDLE _hProcessThread = nullptr;
//UINT _pid; // process ID assigned by caller
@ -98,5 +95,4 @@ protected:
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;
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);
}
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 column = 0;
int counter = 0;
int newCurrentPos = 0;
int tabStop = static_cast<int32_t>(tabWidth - 1); // remember, counting from zero !
bool onlyLeading = false;
bool nonSpaceFound = false;
vector<int> bookmarks;
vector<int> folding;
@ -1206,6 +1204,8 @@ void Notepad_plus::wsTabConvert(spaceTab whichWay)
case space2TabAll:
{
bool nextChar = false;
int counter = 0;
bool nonSpaceFound = false;
for (int i=0; source[i] != '\0'; ++i)
{
if (nonSpaceFound == false)
@ -2855,7 +2855,7 @@ void Notepad_plus::activateDoc(size_t pos)
return;
}
if (pos >= 0 && pos < nbDoc)
if (pos < nbDoc)
{
BufferID id = _pDocTab->getBufferByIndex(pos);
activateBuffer(id, currentView());
@ -6367,14 +6367,12 @@ bool Notepad_plus::undoStreamComment()
//-- Check, if selectionStart or selectionEnd is within a 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:
if ((blnStartCommentBefore[iSelStart] && blnEndCommentAfter[iSelStart])
&& (!blnEndCommentBefore[iSelStart] || (posStartCommentBefore[iSelStart] >= posEndCommentBefore[iSelStart]))
&& (!blnStartCommentAfter[iSelStart] || (posEndCommentAfter[iSelStart] <= posStartCommentAfter[iSelStart])))
{
blnCommentFound = true;
posStartComment = posStartCommentBefore[iSelStart];
posEndComment = posEndCommentAfter[iSelStart];
}
@ -6396,7 +6394,6 @@ bool Notepad_plus::undoStreamComment()
&& (!blnEndCommentBefore[iSelEnd] || (posStartCommentBefore[iSelEnd] >= posEndCommentBefore[iSelEnd]))
&& (!blnStartCommentAfter[iSelEnd] || (posEndCommentAfter[iSelEnd] <= posStartCommentAfter[iSelEnd])))
{
blnCommentFound = true;
posStartComment = posStartCommentBefore[iSelEnd];
posEndComment = posEndCommentAfter[iSelEnd];
}
@ -6405,7 +6402,6 @@ bool Notepad_plus::undoStreamComment()
&& (blnEndCommentBefore[iSelEnd] && (posEndCommentBefore[iSelEnd] > selectionStart)))
{
//-- If there are more than one stream-comment within the selection, take the first one after selectionStart!!
blnCommentFound = true;
posStartComment = posStartCommentAfter[iSelStart];
posEndComment = posEndCommentAfter[iSelStart];
}

View File

@ -40,7 +40,7 @@ namespace // anonymous
struct PaintLocker final
{
PaintLocker(HWND handle)
explicit PaintLocker(HWND handle)
: handle(handle)
{
// 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)
{
HWND hMain = _mainEditView.getHSelf(), hSec = _subEditView.getHSelf();
HWND hFocus = (HWND)lParam;
HWND hFocus = reinterpret_cast<HWND>(lParam);
if (hMain == hFocus)
switchEditViewTo(MAIN_VIEW);
else if (hSec == hFocus)
@ -1142,12 +1142,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
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:
{
return (LRESULT)_scintillaCtrls4Plugins.getScintillaEditViewFrom((HWND)lParam);
return (LRESULT)_scintillaCtrls4Plugins.getScintillaEditViewFrom(reinterpret_cast<HWND>(lParam));
}
case NPPM_INTERNAL_ENABLESNAPSHOT:
@ -1158,7 +1158,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_DESTROYSCINTILLAHANDLE:
{
return _scintillaCtrls4Plugins.destroyScintilla((HWND)lParam);
return _scintillaCtrls4Plugins.destroyScintilla(reinterpret_cast<HWND>(lParam));
}
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)
{
if (_hModelessDlgs[i] == (HWND)lParam)
if (_hModelessDlgs[i] == reinterpret_cast<HWND>(lParam))
return NULL;
}
_hModelessDlgs.push_back((HWND)lParam);
_hModelessDlgs.push_back(reinterpret_cast<HWND>(lParam));
return lParam;
}
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)
{
if (_hModelessDlgs[i] == (HWND)lParam)
if (_hModelessDlgs[i] == reinterpret_cast<HWND>(lParam))
{
vector<HWND>::iterator hDlg = _hModelessDlgs.begin() + i;
_hModelessDlgs.erase(hDlg);
@ -1791,20 +1791,20 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_DMMSHOW:
{
_dockingManager.showDockableDlg((HWND)lParam, SW_SHOW);
_dockingManager.showDockableDlg(reinterpret_cast<HWND>(lParam), SW_SHOW);
return TRUE;
}
case NPPM_DMMHIDE:
{
_dockingManager.showDockableDlg((HWND)lParam, SW_HIDE);
_dockingManager.showDockableDlg(reinterpret_cast<HWND>(lParam), SW_HIDE);
return TRUE;
}
case NPPM_DMMUPDATEDISPINFO:
{
if (::IsWindowVisible((HWND)lParam))
_dockingManager.updateContainerInfo((HWND)lParam);
if (::IsWindowVisible(reinterpret_cast<HWND>(lParam)))
_dockingManager.updateContainerInfo(reinterpret_cast<HWND>(lParam));
return TRUE;
}
@ -2014,7 +2014,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_ISFOCUSEDTAB:
{
HWND hTabToTest = (currentView() == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
return (HWND)lParam == hTabToTest;
return reinterpret_cast<HWND>(lParam) == hTabToTest;
}
case NPPM_INTERNAL_GETMENU:
@ -2043,7 +2043,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SWITCHVIEWFROMHWND:
{
HWND handle = (HWND)lParam;
HWND handle = reinterpret_cast<HWND>(lParam);
if (_mainEditView.getHSelf() == handle || _mainDocTab.getHSelf() == handle)
{
switchEditViewTo(MAIN_VIEW);

View File

@ -1467,12 +1467,11 @@ void Notepad_plus::command(int id)
TabBarPlus::setDrawTabCloseButton(!TabBarPlus::drawTabCloseButton());
// This part is just for updating (redraw) the tabs
{
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(TabBarPlus::drawTabCloseButton() ? 22 : 22);
int tabDpiDynamicalWidth = NppParameters::getInstance()->_dpiManager.scaleX(TabBarPlus::drawTabCloseButton() ? 60 : 45);
TabCtrl_SetItemSize(_mainDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
TabCtrl_SetItemSize(_subDocTab.getHSelf(), tabDpiDynamicalWidth, tabDpiDynamicalHeight);
}
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
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.
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';
::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")))
{
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();
if (n)
n->SetValue(pStr);
@ -5639,7 +5639,6 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("triggerFromNbChar"), int32_t(_nppGUI._autocFromLen));
const TCHAR * pStr = _nppGUI._funcParams?TEXT("yes"):TEXT("no");
GUIConfigElement->SetAttribute(TEXT("funcParams"), pStr);
autocExist = true;
}
if (!autocInsetExist)
@ -5665,7 +5664,6 @@ bool NppParameters::writeGUIParams()
(hist_element.ToElement())->SetAttribute(TEXT("close"), close);
GUIConfigElement->InsertEndChild(hist_element);
}
autocInsetExist = true;
}
if (dockingParamNode)

View File

@ -26,46 +26,16 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
#ifndef TINYXMLA_INCLUDED
#include "tinyxmlA.h"
#endif //TINYXMLA_INCLUDED
#ifndef TINYXML_INCLUDED
#include "tinyxml.h"
#endif //TINYXML_INCLUDED
#ifndef SCINTILLA_H
#include "Scintilla.h"
#endif //SCINTILLA_H
#ifndef SCINTILLA_REF_H
#include "ScintillaRef.h"
#endif //SCINTILLA_REF_H
#ifndef TOOL_BAR_H
#include "ToolBar.h"
#endif //TOOL_BAR_H
#ifndef USER_DEFINE_LANG_REFERENCE_H
#include "UserDefineLangReference.h"
#endif //USER_DEFINE_LANG_REFERENCE_H
#ifndef COLORS_H
#include "colors.h"
#endif //COLORS_H
#ifndef SHORTCUTS_H
#include "shortcut.h"
#endif //SHORTCUTS_H
#ifndef CONTEXTMENU_H
#include "ContextMenu.h"
#endif //CONTEXTMENU_H
#ifndef DPIMANAGER_H
#include "dpiManager.h"
#endif //DPIMANAGER_H
#include <assert.h>
#include <tchar.h>
@ -649,7 +619,7 @@ public:
!(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
// 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.
#ifndef AUTOCOMPLETION_H
#define AUTOCOMPLETION_H
#pragma once
#ifndef FUNCTIONCALLTIP_H
#include "FunctionCallTip.h"
#endif// FUNCTIONCALLTIP_H
#ifndef TINYXML_INCLUDED
#include "tinyxml.h"
#endif// TINYXML_INCLUDED
const size_t tagMaxLen = 256;
@ -64,9 +58,7 @@ class AutoCompletion {
public:
enum ActiveCompletion {CompletionNone = 0, CompletionAuto, CompletionWord, CompletionFunc, CompletionPath};
AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView),
_curLang(L_TEXT), _pXmlFile(NULL), _keyWordMaxLen(0),
_pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT("")) {
explicit AutoCompletion(ScintillaEditView * pEditView): _pEditView(pEditView), _funcCalltip(pEditView) {
//Do not load any language yet
_insertedMatchedChars.init(_pEditView);
};
@ -95,24 +87,22 @@ public:
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, LangType language);
private:
bool _funcCompletionActive;
ScintillaEditView * _pEditView;
LangType _curLang;
TiXmlDocument *_pXmlFile;
TiXmlElement *_pXmlKeyword;
bool _funcCompletionActive = false;
ScintillaEditView * _pEditView = nullptr;
LangType _curLang = L_TEXT;
TiXmlDocument *_pXmlFile = nullptr;
TiXmlElement *_pXmlKeyword = nullptr;
InsertedMatchedChars _insertedMatchedChars;
bool _ignoreCase;
bool _ignoreCase = true;
std::vector<generic_string> _keyWordArray;
generic_string _keyWords;
size_t _keyWordMaxLen;
size_t _keyWordMaxLen = 0;
FunctionCallTip _funcCalltip;
const TCHAR * getApiFileName();
void getWordArray(std::vector<generic_string> & wordArray, TCHAR *beginChars);
};
#endif //AUTOCOMPLETION_H

View File

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

View File

@ -705,7 +705,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
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));
FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory();
@ -2509,11 +2509,11 @@ void FindInFinderDlg::doDialog(Finder *launcher, bool isRTL)
{
DLGTEMPLATE *pMyDlgTemplate = NULL;
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);
}
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);
::SetWindowOrgEx(winDC, ptOrig.x, ptOrig.y, NULL);
return (BOOL)lResult;
break;
}
}
return DefWindowProc(getHSelf(), message, wParam, lParam);

View File

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

View File

@ -37,12 +37,7 @@ typedef std::vector<const TCHAR *> stringVec;
class FunctionCallTip {
friend class AutoCompletion;
public:
FunctionCallTip(ScintillaEditView * pEditView) : _pEditView(pEditView), _pXmlKeyword(NULL), _curPos(0), _startPos(0),
_curFunction(NULL), _currentNrOverloads(0), _currentOverload(0),
_currentParam(0), _funcName(NULL),
_start('('), _stop(')'), _param(','), _terminal(';'), _ignoreCase(true),
_additionalWordChar(TEXT("")), _selfActivated(false)
{};
explicit FunctionCallTip(ScintillaEditView * pEditView) : _pEditView(pEditView) {};
~FunctionCallTip() {/* cleanup(); */};
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
@ -52,29 +47,29 @@ public:
void close(); //Close calltip if visible
private:
ScintillaEditView * _pEditView; //Scintilla to display calltip in
TiXmlElement * _pXmlKeyword; //current keyword node (first one)
ScintillaEditView * _pEditView = nullptr; //Scintilla to display calltip in
TiXmlElement * _pXmlKeyword = nullptr; //current keyword node (first one)
int _curPos; //cursor position
int _startPos; //display start position
int _curPos = 0; //cursor position
int _startPos = 0; //display start position
TiXmlElement * _curFunction; //current function element
TiXmlElement * _curFunction = nullptr; //current function element
//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
std::vector<stringVec> _overloads; //vector of overload params (=vector)
stringVec _descriptions; //vecotr of function descriptions
int _currentNrOverloads; //current amount of overloads
int _currentOverload; //current chosen overload
int _currentParam; //current highlighted param
int _currentNrOverloads = 0; //current amount of overloads
int _currentOverload = 0; //current chosen overload
int _currentParam = 0; //current highlighted param
TCHAR _start;
TCHAR _stop;
TCHAR _param;
TCHAR _terminal;
generic_string _additionalWordChar;
bool _ignoreCase;
bool _selfActivated;
TCHAR _start = '(';
TCHAR _stop = ')';
TCHAR _param = ',';
TCHAR _terminal = ';';
generic_string _additionalWordChar = TEXT("");
bool _ignoreCase = true;
bool _selfActivated = false;
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

View File

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

View File

@ -57,10 +57,10 @@ public :
private :
PRINTDLG _pdlg;
ScintillaEditView *_pSEView;
size_t _startPos;
size_t _endPos;
size_t _nbPageTotal;
ScintillaEditView *_pSEView = nullptr;
size_t _startPos = 0;
size_t _endPos = 0;
size_t _nbPageTotal =0;
};
#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
LRESULT scrollResult = ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
return scrollResult;
break;
}
case WM_IME_REQUEST:

View File

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

View File

@ -33,7 +33,7 @@ class FindReplaceDlg;
class SmartHighlighter {
public:
SmartHighlighter(FindReplaceDlg * pFRDlg);
explicit SmartHighlighter(FindReplaceDlg * pFRDlg);
void highlightView(ScintillaEditView * pHighlightView);
private:
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();
@ -1148,7 +1148,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
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));
pNppParam->SetTransparent(_hSelf, percent);

View File

@ -24,23 +24,14 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef USER_DEFINE_H
#define USER_DEFINE_H
#ifndef USERDEFINE_RC_H
#pragma once
#include "UserDefineResource.h"
#endif //USERDEFINE_RC_H
#ifndef CONTROLS_TAB_H
#include "ControlsTab.h"
#endif //CONTROLS_TAB_H
#ifndef COLOUR_PICKER_H
#include "ColourPicker.h"
#endif //COLOUR_PICKER_H
#ifndef PARAMETERS_H
#include "Parameters.h"
#endif //PARAMETERS_H
#ifndef URLCTRL_INCLUDED
#include "URLCtrl.h"
#endif// URLCTRL_INCLUDED
#include "tchar.h"
#include "SciLexer.h"
#include <unordered_map>
@ -391,12 +382,12 @@ private :
KeyWordsStyleDialog _keyWordsStyleDlg;
CommentStyleDialog _commentStyleDlg;
SymbolsStyleDialog _symbolsStyleDlg;
bool _status;
bool _status = UNDOCK;
RECT _dlgPos;
int _currentHight;
int _yScrollPos;
int _prevHightVal;
bool _isDirty;
int _currentHight = 0;
int _yScrollPos = 0;
int _prevHightVal = 0;
bool _isDirty = false;
void getActualPosSize() {
::GetWindowRect(_hSelf, &_dlgPos);
_dlgPos.right -= _dlgPos.left;
@ -420,17 +411,21 @@ public :
_textValue = text2Set;
_txtLen = txtLen;
};
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() {};
protected :
INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM);
private :
generic_string _title;
generic_string _textValue;
generic_string _static;
int _txtLen;
int _txtLen = 0;
};
class StylerDlg
@ -451,7 +446,7 @@ public:
};
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);
@ -464,4 +459,3 @@ public:
ColourPicker * _pBgColour;
Style _initialStyle;
};
#endif //USER_DEFINE_H

View File

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

View File

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

View File

@ -47,7 +47,7 @@ public:
generic_string getAscii(unsigned char value);
protected:
int _codepage;
int _codepage = -1;
WNDPROC _defaultProc;
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);
private:
ScintillaEditView **_ppEditView;
ScintillaEditView **_ppEditView = nullptr;
ListView _listView;
};
#endif // ANSICHARPANEL_H

View File

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

View File

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

View File

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

View File

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

View File

@ -183,7 +183,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
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));
(NppParameters::getInstance())->SetTransparent(_hSelf, percent);
@ -416,7 +416,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case CPN_COLOURPICKED:
{
if ((HWND)lParam == _pFgColour->getHSelf())
if (reinterpret_cast<HWND>(lParam) == _pFgColour->getHSelf())
{
updateColour(C_FOREGROUND);
notifyDataModified();
@ -428,7 +428,7 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
apply();
return TRUE;
}
else if ((HWND)lParam == _pBgColour->getHSelf())
else if (reinterpret_cast<HWND>(lParam) == _pBgColour->getHSelf())
{
updateColour(C_BACKGROUND);
notifyDataModified();

View File

@ -69,7 +69,7 @@ private :
class WordStyleDlg : public StaticDialog
{
public :
WordStyleDlg():_isDirty(false), _isThemeDirty(false), _restoreInvalid(false), /*_isSync(true),*/ _isShownGOCtrls(false){};
WordStyleDlg() {};
void init(HINSTANCE hInst, HWND parent) {
Window::init(hInst, parent);
@ -119,13 +119,12 @@ public :
};
private :
ColourPicker *_pFgColour;
ColourPicker *_pBgColour;
ColourPicker *_pFgColour = nullptr;
ColourPicker *_pBgColour = nullptr;
int _currentLexerIndex;
int _currentThemeIndex;
int _currentLexerIndex = -1;
int _currentThemeIndex = -1;
HWND _hCheckBold;
HWND _hCheckItalic;
@ -148,14 +147,13 @@ private :
LexerStylerArray _styles2restored;
StyleArray _gstyles2restored;
GlobalOverride _gOverride2restored;
bool _restoreInvalid;
bool _restoreInvalid = false;
ColourStaticTextHooker colourHooker;
bool _isDirty;
bool _isThemeDirty;
//bool _isSync;
bool _isShownGOCtrls;
bool _isDirty = false;
bool _isThemeDirty = false;
bool _isShownGOCtrls = false;
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.
#ifndef DOCKING_H
#define DOCKING_H
#pragma once
#include <windows.h>
@ -84,5 +83,3 @@ typedef struct {
#define HIT_TEST_THICKNESS 20
#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:
{
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();
return TRUE;
@ -1463,6 +1463,6 @@ void DockingCont::focusClient()
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.
#ifndef DOCKINGCONT
#define DOCKINGCONT
#ifndef RESOURCE_H
#pragma once
#include "resource.h"
#endif //RESOURCE_H
#ifndef DOCKING_H
#include "Docking.h"
#endif //DOCKING_H
#include <vector>
#include "StaticDialog.h"
#include "Common.h"
@ -243,6 +235,3 @@ private:
std::vector<tTbData *> _vTbData;
};
#endif // DOCKINGCONT

View File

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

View File

@ -75,8 +75,6 @@ LRESULT CALLBACK FocusWndProc(int nCode, WPARAM wParam, LPARAM lParam)
DockingManager::DockingManager()
{
_isInitialized = FALSE;
_hImageList = NULL;
memset(_iContMap, -1, CONT_MAP_MAX * sizeof(int));
_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)
{
if (_vSplitter[iCont]->getHSelf() == (HWND)lParam)
if (_vSplitter[iCont]->getHSelf() == reinterpret_cast<HWND>(lParam))
{
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)
{
if ((HWND)lParam == _vImageList[uImageCnt])
if (reinterpret_cast<HWND>(lParam) == _vImageList[uImageCnt])
{
return uImageCnt;
}

View File

@ -25,29 +25,19 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCKINGMANAGER_H
#define DOCKINGMANAGER_H
#pragma once
#include <vector>
#include <windows.h>
#include <commctrl.h>
#include "Window.h"
#ifndef DOCKINGCONT
#include "DockingCont.h"
#endif //DOCKINGCONT
class DockingSplitter;
#ifndef SPLITTER_CONTAINER_H
#include "SplitterContainer.h"
#endif //SPLITTER_CONTAINER_H
#define DSPC_CLASS_NAME TEXT("dockingManager")
#define CONT_MAP_MAX 50
class DockingSplitter;
class DockingManager : public Window
{
@ -122,18 +112,17 @@ private :
LRESULT SendNotify(HWND hWnd, UINT message);
private:
Window **_ppWindow;
Window **_ppWindow = nullptr;
RECT _rcWork;
RECT _rect;
Window **_ppMainWindow;
Window **_ppMainWindow = nullptr;
std::vector<HWND> _vImageList;
HIMAGELIST _hImageList;
HIMAGELIST _hImageList = nullptr;
std::vector<DockingCont*> _vContainer;
tDockMgr _dockData;
static BOOL _isRegistered;
BOOL _isInitialized;
BOOL _isInitialized = FALSE;
int _iContMap[CONT_MAP_MAX];
std::vector<DockingSplitter *> _vSplitter;
};
#endif //DOCKINGMANAGER_H

View File

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

View File

@ -26,13 +26,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef DOCUMENTMAP_H
#define DOCUMENTMAP_H
#pragma once
#ifndef DOCKINGDLGINTERFACE_H
#include "DockingDlgInterface.h"
#endif //DOCKINGDLGINTERFACE_H
#include "documentMap_rc.h"
#define DM_PANELTITLE TEXT("Document Map")
@ -94,9 +90,7 @@ private :
class DocumentMap : public DockingDlgInterface {
public:
DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP), _ppEditView(NULL),\
_pScintillaEditView(NULL), id4dockingCont(DM_NOFOCUSWHILECLICKINGCAPTION)
{};
DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP) {};
void create(tTbData * data, bool isRTL = false) {
DockingDlgInterface::create(data, isRTL);
@ -140,15 +134,12 @@ protected:
int getEditorTextZoneWidth();
private:
ScintillaEditView **_ppEditView;
ScintillaEditView *_pScintillaEditView;
ScintillaEditView **_ppEditView = nullptr;
ScintillaEditView *_pScintillaEditView = nullptr;
ViewZoneDlg _vzDlg;
// for needToRecomputeWith function
int _displayZoom;
int _displayWidth;
generic_string id4dockingCont;
int _displayZoom = -1;
int _displayWidth = 0;
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);
private :
ScintillaEditView **_ppEditView;
ScintillaEditView **_ppEditView = nullptr;
bool findCharInRange(unsigned char beginRange, unsigned char endRange, int startPos, bool direction, bool wrap);
bool getRangeFromUI(unsigned char & startRange, unsigned char & endRange);
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);
_ppEditView = ppEditView;
bool isOK = false;
bool doLocalConf = (NppParameters::getInstance())->isLocal();
if (!doLocalConf)
@ -329,12 +328,12 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
if (PathFileExists(funcListDefaultXmlPath.c_str()))
{
::CopyFile(funcListDefaultXmlPath.c_str(), funcListXmlPath.c_str(), TRUE);
isOK = _funcParserMgr.init(funcListXmlPath, ppEditView);
_funcParserMgr.init(funcListXmlPath, ppEditView);
}
}
else
{
isOK = _funcParserMgr.init(funcListXmlPath, ppEditView);
_funcParserMgr.init(funcListXmlPath, ppEditView);
}
}
else
@ -343,11 +342,9 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml"));
if (PathFileExists(funcListDefaultXmlPath.c_str()))
{
isOK = _funcParserMgr.init(funcListDefaultXmlPath, ppEditView);
_funcParserMgr.init(funcListDefaultXmlPath, ppEditView);
}
}
//return isOK;
}
bool FunctionListPanel::openSelection(const TreeView & treeView)

View File

@ -24,13 +24,13 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once;
class ScintillaEditView;
class TiXmlDocument;
class TiXmlNode;
struct foundInfo final
{
generic_string _data;
@ -78,7 +78,6 @@ private:
generic_string _rangeExpr;
generic_string _openSymbole;
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);
};

View File

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

View File

@ -26,24 +26,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SHORTCUTMAPPER
#define SHORTCUTMAPPER
#pragma once
#ifndef BABYGRIDWRAPPER
#include "BabyGridWrapper.h"
#endif// BABYGRIDWRAPPER
#ifndef SHORTCUTMAPPER_RC_H
#include "ShortcutMapper_rc.h"
#endif //SHORTCUTMAPPER_RC_H
#ifndef SHORTCUTS_H
#include "shortcut.h"
#endif// SHORTCUTS_H
#ifndef CONTEXTMENU_H
#include "ContextMenu.h"
#endif// CONTEXTMENU_H
enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTILLA};
@ -69,11 +57,11 @@ public:
{
DLGTEMPLATE *pMyDlgTemplate = NULL;
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);
}
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 translateTab(int index, const TCHAR * newname);
@ -96,4 +84,3 @@ private:
void fillOutBabyGrid();
};
#endif //SHORTCUTMAPPER

View File

@ -26,8 +26,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef IMAGE_LIST_H
#define IMAGE_LIST_H
#pragma once
#include <vector>
#include <windows.h>
@ -39,7 +38,7 @@ const int nbMax = 45;
class IconList
{
public :
IconList() : _hImglst(NULL) {};
IconList() {};
void create(HINSTANCE hInst, int iconSize);
void create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize);
@ -52,11 +51,11 @@ public :
void setIconSize(int size) const;
private :
HIMAGELIST _hImglst;
HINSTANCE _hInst;
int *_pIconIDArray;
int _iconIDArraySize;
int _iconSize;
HIMAGELIST _hImglst = nullptr;
HINSTANCE _hInst = nullptr;
int *_pIconIDArray = nullptr;
int _iconIDArraySize = 0;
int _iconSize = 0;
};
typedef struct
@ -139,4 +138,3 @@ private :
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 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);
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);
}
else if ((HWND)lParam == hBorderWidthSlider)
else if (reinterpret_cast<HWND>(lParam) == hBorderWidthSlider)
{
int borderWidth = (int)::SendMessage(hBorderWidthSlider, TBM_GETPOS, 0, 0);
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
@ -2912,12 +2912,9 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LP
{
case WM_INITDIALOG:
{
// Default settings: no cloud
bool withCloud = false;
generic_string message = TEXT("");
withCloud = nppGUI._cloudPath != TEXT("");
bool withCloud = nppGUI._cloudPath != TEXT("");
if (withCloud)
{
// detect validation of path

View File

@ -1202,10 +1202,10 @@ int FileRelocalizerDlg::doDialog(const TCHAR *fn, bool isRTL)
{
DLGTEMPLATE *pMyDlgTemplate = NULL;
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);
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
{
public:
CReadChangesServer(CReadDirectoryChanges* pParent)
explicit CReadChangesServer(CReadDirectoryChanges* 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 {
public :
Command(){};
Command(TCHAR *cmd) : _cmdLine(cmd){};
Command(generic_string cmd) : _cmdLine(cmd){};
explicit Command(TCHAR *cmd) : _cmdLine(cmd){};
explicit Command(generic_string cmd) : _cmdLine(cmd){};
HINSTANCE run(HWND hWnd);
protected :

View File

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

View File

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

View File

@ -47,11 +47,11 @@ LRESULT CALLBACK hookProc(UINT nCode, WPARAM wParam, LPARAM lParam)
{
DLGTEMPLATE *pMyDlgTemplate = NULL;
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);
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)

View File

@ -26,37 +26,23 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef TASKLISTDLG_H
#define TASKLISTDLG_H
#pragma once
#include "Common.h"
#include "StaticDialog.h"
#ifndef TASKLISTDLGRC_H
#include "TaskListDlg_rc.h"
#endif //TASKLISTDLGRC_H
#ifndef 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"
#endif //NOTEPAD_PLUS_MSGS_H
#define TASKLIST_USER (WM_USER + 8000)
#define WM_GETTASKLISTINFO (TASKLIST_USER + 01)
struct TaskLstFnStatus {
int _iView;
int _docIndex;
int _iView = -1;
int _docIndex = 0;
generic_string _fn;
int _status;
void *_bufID;
int _status = 0;
void *_bufID = nullptr;
TaskLstFnStatus(generic_string str, int status) : _fn(str), _status(status){};
TaskLstFnStatus(int iView, int docIndex, generic_string str, int status, void *bufID) :
_iView(iView), _docIndex(docIndex), _fn(str), _status(status), _bufID(bufID) {};
@ -64,7 +50,7 @@ struct TaskLstFnStatus {
struct TaskListInfo {
std::vector<TaskLstFnStatus> _tlfsLst;
int _currentIndex;
int _currentIndex = -1;
};
static HWND hWndServer = NULL;
@ -91,11 +77,9 @@ private :
TaskList _taskList;
TaskListInfo _taskListInfo;
HIMAGELIST _hImalist;
bool _initDir;
HHOOK _hHooker;
bool _initDir = false;
HHOOK _hHooker = nullptr;
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
int width = Window::getWidth();
size_t start = 0;
RECT btnRect = {0,0,0,0};
while(start < _nrCurrentButtons) {
while(start < _nrCurrentButtons)
{
::SendMessage(_hSelf, TB_GETITEMRECT, start, (LPARAM)&btnRect);
if(btnRect.right > width)
break;
++start;
}
if (start < _nrCurrentButtons) { //some buttons are hidden
if (start < _nrCurrentButtons)
{ //some buttons are hidden
HMENU menu = ::CreatePopupMenu();
int cmd;
generic_string text;
while (start < _nrCurrentButtons) {
cmd = _pTBB[start].idCommand;
while (start < _nrCurrentButtons)
{
int cmd = _pTBB[start].idCommand;
getNameStrFromCmd(cmd, text);
if (_pTBB[start].idCommand != 0) {
if (_pTBB[start].idCommand != 0)
{
if (::SendMessage(_hSelf, TB_ISBUTTONENABLED, cmd, 0) != 0)
AppendMenu(menu, MF_ENABLED, cmd, text.c_str());
else
AppendMenu(menu, MF_DISABLED|MF_GRAYED, cmd, text.c_str());
} else
AppendMenu(menu, MF_SEPARATOR, 0, TEXT(""));
++start;
}
TrackPopupMenu(menu, 0, chevPoint.x, chevPoint.y, 0, _hSelf, NULL);
@ -513,11 +518,10 @@ void ReBar::setGrayBackground(int id)
int ReBar::getNewID()
{
int idToUse = REBAR_BAR_EXTERNAL;
int curVal = 0;
size_t size = usedIDs.size();
for(size_t i = 0; i < size; ++i)
{
curVal = usedIDs.at(i);
int curVal = usedIDs.at(i);
if (curVal < idToUse)
{
continue;

View File

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

View File

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

View File

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

View File

@ -199,7 +199,7 @@ END_WINDOW_MAP()
RECT WindowsDlg::_lastKnownLocation;
WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap), _isSorted(false)
WindowsDlg::WindowsDlg() : MyBaseClass(WindowsDlgMap)
{
_szMinButton = SIZEZERO;
_szMinListCtrl = SIZEZERO;
@ -429,7 +429,7 @@ void WindowsDlg::updateButtonState()
int WindowsDlg::doDialog(TiXmlNodeA *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()

View File

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

View File

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

View File

@ -26,17 +26,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef SHORTCUTS_H
#define SHORTCUTS_H
#pragma once
#ifndef IDD_SHORTCUT_DLG
#include "shortcutRc.h"
#endif //IDD_SHORTCUT_DLG
#ifndef SCINTILLA_H
#include "Scintilla.h"
#endif //SCINTILLA_H
#include "StaticDialog.h"
#include "Common.h"
@ -139,7 +132,7 @@ public:
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().
@ -233,7 +226,7 @@ public:
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
@ -278,14 +271,14 @@ class ScintillaEditView;
struct recordedMacroStep {
enum MacroTypeIndex {mtUseLParameter, mtUseSParameter, mtMenuCommand, mtSavedSnR};
int _message;
long _wParameter;
long _lParameter;
int _message = 0;
long _wParameter = 0;
long _lParameter = 0;
generic_string _sParameter;
MacroTypeIndex _macroType;
MacroTypeIndex _macroType = mtMenuCommand;
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)
: _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(MacroTypeIndex(type)){
@ -391,5 +384,3 @@ private:
void updateMenuItemByID(ScintillaKeyMap skm, int id);
};
#endif //SHORTCUTS_H

View File

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

View File

@ -45,11 +45,11 @@ int ValueDlg::doDialog(POINT p, bool isRTL)
{
DLGTEMPLATE *pMyDlgTemplate = NULL;
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);
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)));
}