Merge branch 'master' of https://github.com/chcg/notepad-plus-plus into GWLP_648

This commit is contained in:
Christian Grasser 2015-05-28 19:37:24 +02:00
commit e1d8e055c8
29 changed files with 158 additions and 137 deletions

View File

@ -129,16 +129,11 @@ BOOL Process::run()
void Process::listenerStdOut()
{
//BOOL Result = 0;
//DWORD size = 0;
DWORD bytesAvail = 0;
BOOL result = 0;
HANDLE hListenerEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, TEXT("listenerEvent"));
//FILE *fp = NULL;
int taille = 0;
TCHAR bufferOut[MAX_LINE_LENGTH + 1];
//TCHAR bufferErr[MAX_LINE_LENGTH + 1];
int nExitCode = STILL_ACTIVE;
@ -150,8 +145,7 @@ void Process::listenerStdOut()
while (goOn)
{ // got data
memset(bufferOut,0x00,MAX_LINE_LENGTH + 1);
//memset(bufferErr,0x00,MAX_LINE_LENGTH + 1);
taille = sizeof(bufferOut) - sizeof(TCHAR);
int taille = sizeof(bufferOut) - sizeof(TCHAR);
Sleep(50);
@ -171,7 +165,7 @@ void Process::listenerStdOut()
break;
}
}
//outbytesRead = strlen(bufferOut);
bufferOut[outbytesRead] = '\0';
generic_string s;
s.assign(bufferOut);
@ -198,20 +192,14 @@ void Process::listenerStdOut()
void Process::listenerStdErr()
{
//BOOL Result = 0;
//DWORD size = 0;
DWORD bytesAvail = 0;
BOOL result = 0;
HANDLE hListenerEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, TEXT("listenerStdErrEvent"));
int taille = 0;
//TCHAR bufferOut[MAX_LINE_LENGTH + 1];
TCHAR bufferErr[MAX_LINE_LENGTH + 1];
int nExitCode = STILL_ACTIVE;
DWORD errbytesRead;
::ResumeThread(_hProcessThread);
bool goOn = true;
@ -221,7 +209,7 @@ void Process::listenerStdErr()
taille = sizeof(bufferErr) - sizeof(TCHAR);
Sleep(50);
DWORD errbytesRead;
if (!::PeekNamedPipe(_hPipeErrR, bufferErr, taille, &errbytesRead, &bytesAvail, NULL))
{
bytesAvail = 0;
@ -238,7 +226,6 @@ void Process::listenerStdErr()
break;
}
}
//outbytesRead = strlen(bufferOut);
bufferErr[errbytesRead] = '\0';
generic_string s;
s.assign(bufferErr);

View File

@ -956,12 +956,12 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
if (posFound != -1 && posFound != -2)
{
const char *encodingBlockRegExpr = "encoding[ \\t]*=[ \\t]*\"[^\".]+\"";
posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingBlockRegExpr), (LPARAM)encodingBlockRegExpr);
_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingBlockRegExpr), (LPARAM)encodingBlockRegExpr);
const char *encodingRegExpr = "\".+\"";
posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingRegExpr), (LPARAM)encodingRegExpr);
_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingRegExpr), (LPARAM)encodingRegExpr);
posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingAliasRegExpr), (LPARAM)encodingAliasRegExpr);
_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingAliasRegExpr), (LPARAM)encodingAliasRegExpr);
startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART));
endPos = int(_invisibleEditView.execute(SCI_GETTARGETEND));
@ -998,9 +998,9 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
if (posFound == -1 || posFound == -2)
return -1;
}
posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(charsetBlock), (LPARAM)charsetBlock);
posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(intermediaire), (LPARAM)intermediaire);
posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingStrRE), (LPARAM)encodingStrRE);
_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(charsetBlock), (LPARAM)charsetBlock);
_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(intermediaire), (LPARAM)intermediaire);
_invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(encodingStrRE), (LPARAM)encodingStrRE);
startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART));
endPos = int(_invisibleEditView.execute(SCI_GETTARGETEND));
@ -6074,6 +6074,7 @@ void Notepad_plus::showQuote(const char *quote, const char *quoter, bool doTroll
void Notepad_plus::launchDocumentBackupTask()
{
HANDLE hThread = ::CreateThread(NULL, 0, backupDocument, NULL, 0, NULL);
if (hThread)
::CloseHandle(hThread);
}
@ -6150,7 +6151,6 @@ bool Notepad_plus::undoStreamComment()
generic_string white_space(TEXT(" "));
int start_comment_length = start_comment.length();
int end_comment_length = end_comment.length();
int startCommentLength, endCommentLength;
do { // do as long as stream-comments are within selection
@ -6166,7 +6166,7 @@ bool Notepad_plus::undoStreamComment()
//-- First, search all start_comment and end_comment before and after the selectionStart and selectionEnd position.
const int iSelStart=0, iSelEnd=1;
#define N_CMNT 2
const size_t N_CMNT = 2;
int posStartCommentBefore[N_CMNT], posEndCommentBefore[N_CMNT], posStartCommentAfter[N_CMNT], posEndCommentAfter[N_CMNT];
bool blnStartCommentBefore[N_CMNT], blnEndCommentBefore[N_CMNT], blnStartCommentAfter[N_CMNT], blnEndCommentAfter[N_CMNT];
int posStartComment, posEndComment;
@ -6238,8 +6238,8 @@ bool Notepad_plus::undoStreamComment()
//-- Ok, there are valid start-comment and valid end-comment around the caret-position.
// Now, un-comment stream-comment:
retVal = true;
startCommentLength = start_comment_length;
endCommentLength = end_comment_length;
int startCommentLength = start_comment_length;
int endCommentLength = end_comment_length;
//-- First delete end-comment, so that posStartCommentBefore does not change!
//-- Get character before end-comment to decide, if there is a white character before the end-comment, which will be removed too!
_pEditView->getGenericText(charbuf, charbufLen, posEndComment-1, posEndComment);

View File

@ -606,7 +606,7 @@ private:
int getLangFromMenuName(const TCHAR * langName);
generic_string getLangFromMenu(const Buffer * buf);
generic_string Notepad_plus::exts2Filters(generic_string exts) const;
generic_string exts2Filters(generic_string exts) const;
int setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType = -1);
void markSelectedTextInc(bool enable);
Style * getStyleFromName(const TCHAR *styleName);

View File

@ -61,7 +61,7 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNum
class Notepad_plus_Window : public Window {
public:
Notepad_plus_Window() {};
Notepad_plus_Window() : _isPrelaunch(false), _disablePluginsManager(false) {};
void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams);
bool isDlgsMsg(MSG *msg) const;
@ -86,7 +86,7 @@ public:
::DestroyWindow(_hSelf);
};
static const TCHAR * Notepad_plus_Window::getClassName() {
static const TCHAR * getClassName() {
return _className;
};
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant

View File

@ -306,7 +306,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isRecursive, bool isRe
if (isWow64Off)
{
pNppParam->safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false;
//isWow64Off = false;
}
return buffer;
}
@ -439,7 +439,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
if (isWow64Off)
{
pNppParam->safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false;
//isWow64Off = false;
}
}

View File

@ -860,15 +860,14 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (_rebarBottom.getHSelf() == lpnm->hdr.hwndFrom)
notifRebar = &_rebarBottom;
//If N++ ID, use proper object
switch(lpnm->wID) {
case REBAR_BAR_TOOLBAR: {
if (lpnm->wID == REBAR_BAR_TOOLBAR)
{
POINT pt;
pt.x = lpnm->rc.left;
pt.y = lpnm->rc.bottom;
ClientToScreen(notifRebar->getHSelf(), &pt);
_toolBar.doPopop(pt);
return TRUE;
break; }
}
//Else forward notification to window of rebarband
REBARBANDINFO rbBand;

View File

@ -207,7 +207,7 @@ struct CmdLineParams {
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false),_showLoadingTime(false),\
_isPreLaunch(false), _line2go(-1), _column2go(-1), _langType(L_EXTERNAL), _isPointXValid(false), _isPointYValid(false),\
_localizationPath(TEXT("")), _easterEggName(TEXT("")), _quoteType(0)
_alwaysOnTop(false), _localizationPath(TEXT("")), _easterEggName(TEXT("")), _quoteType(0)
{
_point.x = 0;
_point.y = 0;

View File

@ -222,7 +222,6 @@ static bool getPathsForPathCompletion(generic_string input, generic_string &rawP
}
else
{
locale loc;
size_t last_occurrence = rawPath.rfind(L"\\");
if(last_occurrence == std::string::npos) // No match.
return false;
@ -765,10 +764,10 @@ bool AutoCompletion::setLanguage(LangType language) {
//Cache the keywords
//Iterate through all keywords
TiXmlElement *funcNode = _pXmlKeyword;
const TCHAR * name = NULL;
for (; funcNode; funcNode = funcNode->NextSiblingElement(TEXT("KeyWord")) )
{
name = funcNode->Attribute(TEXT("name"));
const TCHAR *name = funcNode->Attribute(TEXT("name"));
if (name)
{
size_t len = lstrlen(name);

View File

@ -217,7 +217,7 @@ bool Buffer::checkFileState() { //returns true if the status has been changed (i
if (isWow64Off)
{
pNppParam->safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false;
//isWow64Off = false;
}
return isOK;
}
@ -1121,12 +1121,11 @@ BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool d
int FileManager::detectCodepage(char* buf, size_t len)
{
int codepage = -1;
uchardet_t ud = uchardet_new();
uchardet_handle_data(ud, buf, len);
uchardet_data_end(ud);
const char* cs = uchardet_get_charset(ud);
codepage = EncodingMapper::getInstance()->getEncodingFromString(cs);
int codepage = EncodingMapper::getInstance()->getEncodingFromString(cs);
uchardet_delete(ud);
return codepage;
}
@ -1203,7 +1202,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea
do {
lenFile = fread(data+incompleteMultibyteChar, 1, blockSize-incompleteMultibyteChar, fp) + incompleteMultibyteChar;
if (lenFile <= 0) break;
if (lenFile == 0) break;
// check if file contain any BOM
if (isFirstTime)

View File

@ -38,19 +38,22 @@ FindOption FindReplaceDlg::_options;
#define SHIFTED 0x8000
int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length) { //query may equal to result, since it always gets smaller
int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int length)
{ //query may equal to result, since it always gets smaller
int i = 0, j = 0;
int charLeft = length;
bool isGood = true;
TCHAR current;
while(i < length) { //because the backslash escape quences always reduce the size of the generic_string, no overflow checks have to be made for target, assuming parameters are correct
while (i < length)
{ //because the backslash escape quences always reduce the size of the generic_string, no overflow checks have to be made for target, assuming parameters are correct
current = query[i];
--charLeft;
if (current == '\\' && charLeft) { //possible escape sequence
if (current == '\\' && charLeft)
{ //possible escape sequence
++i;
--charLeft;
current = query[i];
switch(current) {
switch(current)
{
case 'r':
result[j] = '\r';
break;
@ -70,22 +73,35 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
case 'd':
case 'o':
case 'x':
case 'u': {
case 'u':
{
int size = 0, base = 0;
if (current == 'b') { //11111111
if (current == 'b')
{ //11111111
size = 8, base = 2;
} else if (current == 'o') { //377
}
else if (current == 'o')
{ //377
size = 3, base = 8;
} else if (current == 'd') { //255
}
else if (current == 'd')
{ //255
size = 3, base = 10;
} else if (current == 'x') { //0xFF
}
else if (current == 'x')
{ //0xFF
size = 2, base = 16;
} else if (current == 'u') { //0xCDCD
}
else if (current == 'u')
{ //0xCDCD
size = 4, base = 16;
}
if (charLeft >= size) {
if (charLeft >= size)
{
int res = 0;
if (Searching::readBase(query+(i+1), &res, base, size)) {
if (Searching::readBase(query+(i+1), &res, base, size))
{
result[j] = (TCHAR)res;
i += size;
break;
@ -93,15 +109,18 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
}
//not enough chars to make parameter, use default method as fallback
}
default: { //unknown sequence, treat as regular text
default:
{ //unknown sequence, treat as regular text
result[j] = '\\';
++j;
result[j] = current;
isGood = false;
break;
}
}
} else {
}
else
{
result[j] = query[i];
}
++i;

View File

@ -269,14 +269,17 @@ bool FunctionCallTip::getCursorFunction()
/*
Find function in XML structure and parse it
*/
bool FunctionCallTip::loadFunction() {
bool FunctionCallTip::loadFunction()
{
reset(); //set everything back to 0
//The functions should be ordered, but linear search because we cant access like array
_curFunction = NULL;
//Iterate through all keywords and find the correct function keyword
TiXmlElement *funcNode = _pXmlKeyword;
for (; funcNode; funcNode = funcNode->NextSiblingElement(TEXT("KeyWord")) )
{
const TCHAR * name = NULL;
for (; funcNode; funcNode = funcNode->NextSiblingElement(TEXT("KeyWord")) ) {
name = funcNode->Attribute(TEXT("name"));
if (!name) //malformed node
continue;
@ -356,9 +359,9 @@ void FunctionCallTip::showCalltip()
//Check if the current overload still holds. If the current param exceeds amounti n overload, see if another one fits better (enough params)
stringVec & params = _overloads.at(_currentOverload);
size_t psize = params.size()+1, osize;
size_t psize = params.size()+1;
if ((size_t)_currentParam >= psize) {
osize = _overloads.size();
size_t osize = _overloads.size();
for(size_t i = 0; i < osize; ++i) {
psize = _overloads.at(i).size()+1;
if ((size_t)_currentParam < psize) {

View File

@ -47,7 +47,7 @@ class Printer
public :
Printer(){};
void init(HINSTANCE hInst, HWND hwnd, ScintillaEditView *pSEView, bool showDialog, int startPos, int endPos);
size_t Printer::doPrint() {
size_t doPrint() {
if (!::PrintDlg(&_pdlg))
return 0;

View File

@ -1561,11 +1561,11 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam);
dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop"));
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->stylerIndex);
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->_stylerIndex);
// move dialog over UDL GUI (position 0,0 of UDL window) so it wouldn't cover the code
RECT wrc;
::GetWindowRect(dlg->parent, &wrc);
::GetWindowRect(dlg->_parent, &wrc);
wrc.left = wrc.left < 0 ? 200 : wrc.left; // if outside of visible area
wrc.top = wrc.top < 0 ? 200 : wrc.top;
::SetWindowPos(hwnd, HWND_TOP, wrc.left, wrc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
@ -1612,10 +1612,10 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (style._bgColor == COLORREF(-1))
style._bgColor = white;
dlg->pFgColour->init(dlg->hInst, hwnd);
dlg->pFgColour->setColour(style._fgColor);
dlg->pBgColour->init(dlg->hInst, hwnd);
dlg->pBgColour->setColour(style._bgColor);
dlg->_pFgColour->init(dlg->_hInst, hwnd);
dlg->_pFgColour->setColour(style._fgColor);
dlg->_pBgColour->init(dlg->_hInst, hwnd);
dlg->_pBgColour->setColour(style._bgColor);
POINT p1, p2;
RECT rc1, rc2;
@ -1635,24 +1635,24 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
p1.x += 10; p2.x += 10;
p1.y -= 6; p2.y -= 6;
::MoveWindow(dlg->pFgColour->getHSelf(), p1.x, p1.y, 30, 30, TRUE);
::MoveWindow(dlg->pBgColour->getHSelf(), p2.x, p2.y, 30, 30, TRUE);
::MoveWindow(dlg->_pFgColour->getHSelf(), p1.x, p1.y, 30, 30, TRUE);
::MoveWindow(dlg->_pBgColour->getHSelf(), p2.x, p2.y, 30, 30, TRUE);
dlg->pFgColour->display();
dlg->pBgColour->display();
dlg->_pFgColour->display();
dlg->_pBgColour->display();
map<int, int>::iterator iter = globalMappper().nestingMapper.begin();
for (; iter != globalMappper().nestingMapper.end(); ++iter)
{
::SendDlgItemMessage(hwnd, iter->first, BM_SETCHECK, style._nesting & iter->second, 0);
::EnableWindow(::GetDlgItem(hwnd, iter->first), dlg->enabledNesters & iter->second);
::EnableWindow(::GetDlgItem(hwnd, iter->first), dlg->_enabledNesters & iter->second);
}
return TRUE;
}
case WM_COMMAND :
{
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->stylerIndex);
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->_stylerIndex);
if (HIWORD(wParam) == CBN_SELCHANGE)
{
int i = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETCURSEL, 0, 0);
@ -1691,7 +1691,7 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
if (wParam == IDCANCEL)
{
style = dlg->initialStyle;
style = dlg->_initialStyle;
// show changes to user, re-color document
if (SharedParametersDialog::_pScintilla->getCurrentBuffer()->getLangType() == L_USER)
@ -1709,14 +1709,14 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
return TRUE;
}
style._fgColor = dlg->pFgColour->getColour();
style._bgColor = dlg->pBgColour->getColour();
style._fgColor = dlg->_pFgColour->getColour();
style._bgColor = dlg->_pBgColour->getColour();
if (dlg->pFgColour->isEnabled())
if (dlg->_pFgColour->isEnabled())
style._colorStyle |= COLORSTYLE_FOREGROUND;
else
style._colorStyle &= ~COLORSTYLE_FOREGROUND;
if (dlg->pBgColour->isEnabled())
if (dlg->_pBgColour->isEnabled())
style._colorStyle |= COLORSTYLE_BACKGROUND;
else
style._colorStyle &= ~COLORSTYLE_BACKGROUND;

View File

@ -279,6 +279,7 @@ protected :
bool setPropertyByCheck(HWND hwnd, WPARAM id, bool & bool2set);
virtual void setKeywords2List(int ctrlID) = 0;
};
class FolderStyleDialog : public SharedParametersDialog
{
public:
@ -292,6 +293,7 @@ private :
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const;
URLCtrl _pageLink;
};
class KeyWordsStyleDialog : public SharedParametersDialog
{
public:
@ -301,6 +303,7 @@ protected :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
void setKeywords2List(int id);
};
class CommentStyleDialog : public SharedParametersDialog
{
public :
@ -313,6 +316,7 @@ private :
void convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const;
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const;
};
class SymbolsStyleDialog : public SharedParametersDialog
{
public :
@ -325,6 +329,7 @@ private :
void convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const;
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const;
};
class UserDefineDialog : public SharedParametersDialog
{
friend class ScintillaEditView;
@ -411,6 +416,7 @@ protected :
void setKeywords2List(int){};
void updateDlg();
};
class StringDlg : public StaticDialog
{
public :
@ -434,34 +440,36 @@ private :
generic_string _static;
int _txtLen;
};
class StylerDlg
{
public:
StylerDlg( HINSTANCE hInst, HWND parent, int stylerIndex = 0, int enabledNesters = -1):
hInst(hInst), parent(parent), stylerIndex(stylerIndex), enabledNesters(enabledNesters)
{
pFgColour = new ColourPicker;
pBgColour = new ColourPicker;
initialStyle = SharedParametersDialog::_pUserLang->_styleArray.getStyler(stylerIndex);
_hInst(hInst), _parent(parent), _stylerIndex(stylerIndex), _enabledNesters(enabledNesters) {
_pFgColour = new ColourPicker;
_pBgColour = new ColourPicker;
_initialStyle = SharedParametersDialog::_pUserLang->_styleArray.getStyler(stylerIndex);
};
~StylerDlg()
{
pFgColour->destroy();
pBgColour->destroy();
delete pFgColour;
delete pBgColour;
}
~StylerDlg() {
_pFgColour->destroy();
_pBgColour->destroy();
delete _pFgColour;
delete _pBgColour;
};
long doDialog() {
return long (::DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_STYLER_POPUP_DLG), parent, (DLGPROC)dlgProc, (LPARAM)this));
return long (::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STYLER_POPUP_DLG), _parent, (DLGPROC)dlgProc, (LPARAM)this));
};
static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
public:
HINSTANCE hInst;
HWND parent;
int stylerIndex;
int enabledNesters;
ColourPicker * pFgColour;
ColourPicker * pBgColour;
Style initialStyle;
HINSTANCE _hInst;
HWND _parent;
int _stylerIndex;
int _enabledNesters;
ColourPicker * _pFgColour;
ColourPicker * _pBgColour;
Style _initialStyle;
};
#endif //USER_DEFINE_H

View File

@ -72,7 +72,7 @@ public:
};
protected:
virtual BOOL CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private:
ScintillaEditView **_ppEditView;

View File

@ -99,7 +99,7 @@ public:
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
protected:
virtual BOOL CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private:
ScintillaEditView **_ppEditView;

View File

@ -678,10 +678,9 @@ void DockingManager::setActiveTab(int iCont, int iItem)
void DockingManager::showDockableDlg(HWND hDlg, BOOL view)
{
tTbData *pTbData = NULL;
for (size_t i = 0, len = _vContainer.size(); i < len; ++i)
{
pTbData = _vContainer[i]->findToolbarByWnd(hDlg);
tTbData *pTbData = _vContainer[i]->findToolbarByWnd(hDlg);
if (pTbData != NULL)
{
_vContainer[i]->showToolbar(pTbData, view);

View File

@ -457,7 +457,7 @@ void Gripper::doTabReordering(POINT pt)
_iItem = iItem;
}
else if ((hTab != _hTab) || (_iItem == -1))
else if (_hTab && ((hTab != _hTab) || (_iItem == -1)))
{
/* test if cusor points after last tab */
int iLastItem = ::SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0) - 1;
@ -501,7 +501,7 @@ void Gripper::doTabReordering(POINT pt)
}
/* insert new entry when mouse doesn't point to current hovered tab */
if ((_hTab != hTabOld) || (_iItem != iItemOld))
if (_hTab && ((_hTab != hTabOld) || (_iItem != iItemOld)))
{
_tcItem.mask = TCIF_PARAM | (_hTab == _hTabSource ? TCIF_TEXT : 0);
::SendMessage(_hTab, TCM_INSERTITEM, _iItem, (LPARAM)&_tcItem);

View File

@ -37,7 +37,7 @@ struct foundInfo {
generic_string _data2;
int _pos;
int _pos2;
//foundInfo(): /*_data(TEXT("")), _data2(TEXT("")), _pos(-1) _pos2(-1) */{};
foundInfo(): _data(TEXT("")), _data2(TEXT("")), _pos(-1), _pos2(-1) {};
};
class FunctionParser {

View File

@ -257,7 +257,7 @@ bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *ne
return false;
const size_t lenMax = 256;
TCHAR oldName[lenMax];
TCHAR oldName[lenMax] = {0};
size_t txtLen = ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETTEXTLEN, i, 0);
if (txtLen >= lenMax)
return false;

View File

@ -134,7 +134,7 @@ protected:
void setWorkSpaceDirty(bool isDirty);
void popupMenuCmd(int cmdID);
POINT getMenuDisplyPoint(int iButton);
virtual BOOL CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
bool buildTreeFrom(TiXmlNode *projectRoot, HTREEITEM hParentItem);
void notified(LPNMHDR notification);
void showContextMenu(int x, int y);

View File

@ -49,7 +49,8 @@ void StaticDialog::display(bool toShow) const
if (toShow) {
// If the user has switched from a dual monitor to a single monitor since we last
// displayed the dialog, then ensure that it's still visible on the single monitor.
RECT workAreaRect, rc;
RECT workAreaRect = {0};
RECT rc = {0};
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0);
::GetWindowRect(_hSelf, &rc);
int newLeft = rc.left;
@ -77,8 +78,16 @@ HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplat
{
// Get Dlg Template resource
HRSRC hDialogRC = ::FindResource(_hInst, MAKEINTRESOURCE(dialogID), RT_DIALOG);
if (!hDialogRC)
return NULL;
HGLOBAL hDlgTemplate = ::LoadResource(_hInst, hDialogRC);
if (!hDlgTemplate)
return NULL;
DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
if (!pDlgTemplate)
return NULL;
// Duplicate Dlg Template resource
unsigned long sizeDlg = ::SizeofResource(_hInst, hDialogRC);

View File

@ -53,7 +53,7 @@ public :
_isVertical = isVertical;
TabBar::init(hInst, hwnd, false, isTraditional, isMultiLine);
};
void ControlsTab::createTabs(WindowVector & winVector);
void createTabs(WindowVector & winVector);
void destroy() {
TabBar::destroy();

View File

@ -104,7 +104,7 @@ public:
};
protected:
virtual BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private:
VerticalFileSwitcherListView _fileListView;

View File

@ -546,7 +546,7 @@ void Accelerator::updateShortcuts()
tmpAccelArray[i] = IFAcc[i];
}
_hIncFindAccTab = ::CreateAcceleratorTable(tmpAccelArray, nb);
delete tmpAccelArray;
delete [] tmpAccelArray;
return;
}

View File

@ -215,7 +215,7 @@ public:
};
KeyCombo getKeyComboByIndex(int index) const;
void ScintillaKeyMap::setKeyComboByIndex(int index, KeyCombo combo);
void setKeyComboByIndex(int index, KeyCombo combo);
void removeKeyComboByIndex(int index);
void clearDups() {
if (size > 1)

View File

@ -82,7 +82,6 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName)
if (!mainMenu) return TEXT("");
TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
if (!entriesRoot) return TEXT("");
const char *idName = NULL;
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
@ -92,7 +91,7 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName)
{
TiXmlElementA *element = childNode->ToElement();
idName = element->Attribute("idName");
const char *idName = element->Attribute("idName");
if (idName)
{
const char *name = element->Attribute("name");
@ -397,11 +396,12 @@ void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM)
{
const int POS_GO2VIEW = 0;
const int POS_CLONE2VIEW = 1;
const char *goToViewA = NULL;
const char *cloneToViewA = NULL;
if (_nativeLangA)
{
const char *goToViewA = NULL;
const char *cloneToViewA = NULL;
TiXmlNodeA *tabBarMenu = _nativeLangA->FirstChild("Menu");
if (tabBarMenu)
tabBarMenu = tabBarMenu->FirstChild("TabBar");

View File

@ -315,11 +315,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
generic_string quotFileName = TEXT("");
// tell the running instance the FULL path to the new files to load
size_t nrFilesToOpen = params.size();
const TCHAR * currentFile;
for(size_t i = 0; i < nrFilesToOpen; ++i)
{
currentFile = params.at(i);
const TCHAR * currentFile = params.at(i);
if (currentFile[0])
{
//check if relative or full path. Relative paths dont have a colon for driveletter
@ -496,7 +495,7 @@ DEVOMER*/
} catch (const Win32Exception & ex) {
TCHAR message[1024]; //TODO: sane number
wsprintf(message, TEXT("An exception occured. Notepad++ cannot recover and must be shut down.\r\nThe exception details are as follows:\r\n")
TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"), ex.code(), ex.what(), ex.where());
TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"), ex.code(), ex.what(), (long)ex.where());
::MessageBox(Notepad_plus_Window::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
mdump.writeDump(ex.info());
doException(notepad_plus_plus);