diff --git a/PowerEditor/bin/change.log b/PowerEditor/bin/change.log index 49cc6848..51925a8d 100644 --- a/PowerEditor/bin/change.log +++ b/PowerEditor/bin/change.log @@ -1,3 +1,9 @@ +Notepad++ v5.4.3 fixed bugs (from v5.4.2) : + +1. Fix clickable link styling bug. +2. Fix document tab click launching a new instance bug. + + Notepad++ v5.4.2 fixed bugs (from v5.4.1) : 1. Fix the localization switcher bug while w/o doLocalConf.xml. diff --git a/PowerEditor/bin/npp.pdb b/PowerEditor/bin/npp.pdb index 0fb25c16..5d6fe6af 100644 Binary files a/PowerEditor/bin/npp.pdb and b/PowerEditor/bin/npp.pdb differ diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index 0b54e7c7..965af0fb 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -17,18 +17,18 @@ ; Define the application name !define APPNAME "Notepad++" -!define APPVERSION "5.4.2" -!define APPNAMEANDVERSION "Notepad++ v5.4.2" +!define APPVERSION "5.4.3" +!define APPNAMEANDVERSION "Notepad++ v5.4.3" !define APPWEBSITE "http://notepad-plus.sourceforge.net/" !define VERSION_MAJOR 5 -!define VERSION_MINOR 42 +!define VERSION_MINOR 43 ; Main Install settings Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\Notepad++" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "..\bin\npp.5.4.2.Installer.exe" +OutFile "..\bin\npp.5.4.3.Installer.exe" ; GetWindowsVersion ; diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 13e7ad19..5effb7a7 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2752,7 +2752,17 @@ BOOL Notepad_plus::notify(SCNotification *notification) } //Else forward notification to window of rebarband REBARBANDINFO rbBand; - rbBand.cbSize = sizeof(rbBand); + winVer winVersion = (NppParameters::getInstance())->getWinVersion(); + if (winVersion <= WV_ME) + { + ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); + rbBand.cbSize = sizeof(REBARBANDINFO); + } + else + { + ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE); + rbBand.cbSize = REBARBANDINFO_V3_SIZE; + } rbBand.fMask = RBBIM_CHILD; ::SendMessage(notifRebar->getHSelf(), RB_GETBANDINFO, lpnm->uBand, (LPARAM)&rbBand); ::SendMessage(rbBand.hwndChild, WM_NOTIFY, 0, (LPARAM)lpnm); @@ -2864,7 +2874,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing) ch = (UCHAR)_pEditView->execute(SCI_GETCHARAT, posBegin2style--); } } - int style_hotspot = 30; + int startPos = 0; int endPos = _pEditView->execute(SCI_GETTEXTLENGTH); @@ -2875,7 +2885,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing) _pEditView->execute(SCI_SETTARGETEND, endPos); vector > hotspotStylers; - + int style_hotspot = 30; int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr); while (posFound != -1) @@ -2913,11 +2923,22 @@ void Notepad_plus::addHotSpot(bool docIsModifing) pair p(style_hotspot, idStyle); hotspotStylers.push_back(p); int activeFG = 0xFF0000; + char fontNameA[128]; Style hotspotStyle; hotspotStyle._styleID = style_hotspot; - _pEditView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)hotspotStyle._fontName); + _pEditView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)fontNameA); + TCHAR *generic_fontname = new TCHAR[128]; +#ifdef UNICODE + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangEncoding); + lstrcpy(generic_fontname, fontNameW); +#else + lstrcpy(generic_fontname, fontNameA); +#endif + hotspotStyle._fontName = generic_fontname; + hotspotStyle._fgColor = _pEditView->execute(SCI_STYLEGETFORE, idStyle); hotspotStyle._bgColor = _pEditView->execute(SCI_STYLEGETBACK, idStyle); hotspotStyle._fontSize = _pEditView->execute(SCI_STYLEGETSIZE, idStyle); @@ -2932,7 +2953,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing) if (urlAction == 2) hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE; - _pEditView->setStyle(hotspotStyle); + _pEditView->setHotspotStyle(hotspotStyle); _pEditView->execute(SCI_STYLESETHOTSPOT, style_hotspot, TRUE); _pEditView->execute(SCI_SETHOTSPOTACTIVEFORE, TRUE, activeFG); @@ -2947,11 +2968,9 @@ void Notepad_plus::addHotSpot(bool docIsModifing) _pEditView->execute(SCI_SETTARGETSTART, posFound + foundTextLen); _pEditView->execute(SCI_SETTARGETEND, endPos); - posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr); } - _pEditView->execute(SCI_STARTSTYLING, endStyle, 0xFF); _pEditView->execute(SCI_SETSTYLING, 0, 0); } @@ -9779,22 +9798,6 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) { setDisplayFormat(buffer->getFormat()); enableConvertMenuItems(buffer->getFormat()); } - - if (mask & (BufferChangeReadonly)) - { - checkDocState(); - - Buffer * curBuf = _pEditView->getCurrentBuffer(); - bool isSysReadOnly = curBuf->getFileReadOnly(); - bool isUserReadOnly = curBuf->getUserReadOnly(); - - // To notify plugins ro status is changed - SCNotification scnN; - scnN.nmhdr.code = NPPN_READONLYCHANGED; - scnN.nmhdr.hwndFrom = buffer; - scnN.nmhdr.idFrom = int(isSysReadOnly || isUserReadOnly); - _pluginsManager.notify(&scnN); - } } void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) { diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 7d2057ee..823c917e 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -381,6 +381,7 @@ private: } _scintillaCtrls4Plugins; vector > _hideLinesMarks; + StyleArray _hotspotStyles; static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index e42cef5b..dc3d2635 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -1972,7 +1972,8 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt) _pFRDlg->markAllInc(text2Find, opt); } -void FindIncrementDlg::addToRebar(ReBar * rebar) { +void FindIncrementDlg::addToRebar(ReBar * rebar) +{ if(_pRebar) return; HWND hRebar = rebar->getHSelf(); @@ -1980,8 +1981,18 @@ void FindIncrementDlg::addToRebar(ReBar * rebar) { RECT client; getClientRect(client); - ZeroMemory(&_rbBand, sizeof(REBARBANDINFO)); - _rbBand.cbSize = sizeof(REBARBANDINFO); + winVer winVersion = (NppParameters::getInstance())->getWinVersion(); + if (winVersion <= WV_ME) + { + ZeroMemory(&_rbBand, sizeof(REBARBANDINFO)); + _rbBand.cbSize = sizeof(REBARBANDINFO); + } + else + { + ZeroMemory(&_rbBand, REBARBANDINFO_V3_SIZE); + _rbBand.cbSize = REBARBANDINFO_V3_SIZE; + } + _rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_ID; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 6aed79ba..053084af 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -377,7 +377,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa } -void ScintillaEditView::setSpecialStyle(Style & styleToSet) +void ScintillaEditView::setSpecialStyle(const Style & styleToSet) { int styleID = styleToSet._styleID; if ( styleToSet._colorStyle & COLORSTYLE_FOREGROUND ) @@ -408,6 +408,19 @@ void ScintillaEditView::setSpecialStyle(Style & styleToSet) execute(SCI_STYLESETSIZE, styleID, styleToSet._fontSize); } +void ScintillaEditView::setHotspotStyle(Style& styleToSet) +{ + StyleMap* styleMap; + if( _hotspotStyles.find(_currentBuffer) == _hotspotStyles.end() ) + { + _hotspotStyles[_currentBuffer] = new StyleMap; + } + styleMap = _hotspotStyles[_currentBuffer]; + (*styleMap)[styleToSet._styleID] = styleToSet; + + setStyle(styleToSet); +} + void ScintillaEditView::setStyle(Style styleToSet) { GlobalOverride & go = _pParameter->getGlobalOverrideStyle(); @@ -1290,6 +1303,16 @@ void ScintillaEditView::defineDocType(LangType typeDoc) execute(SCI_SETUSETABS, !((NppParameters::getInstance())->getNppGUI())._tabReplacedBySpace); int bitsNeeded = execute(SCI_GETSTYLEBITSNEEDED); execute(SCI_SETSTYLEBITS, bitsNeeded); + + // Reapply the hotspot styles. + if (_hotspotStyles.find(_currentBuffer) != _hotspotStyles.end()) + { + StyleMap* currentStyleMap = _hotspotStyles[_currentBuffer]; + for (StyleMap::iterator it(currentStyleMap->begin()); it != currentStyleMap->end(); ++it) + { + setStyle(it->second); + } + } } BufferID ScintillaEditView::attachDefaultDoc() diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 1f740a17..5012abac 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -19,6 +19,8 @@ #define SCINTILLA_EDIT_VIEW_H #include +#include + #include "Window.h" #include "Scintilla.h" #include "ScintillaRef.h" @@ -161,6 +163,16 @@ public: if ((!_refCount)&&(_hLib)) { ::FreeLibrary(_hLib); + + for (BufferStyleMap::iterator it(_hotspotStyles.begin()); it != _hotspotStyles.end(); ++it ) + { + for (StyleMap::iterator it2(it->second->begin()) ; it2 != it->second->end() ; ++it2) + { + if (it2->second._fontName != NULL) + delete [] it2->second._fontName; + } + delete it->second; + } } }; virtual void destroy() @@ -581,27 +593,24 @@ protected: SCINTILLA_FUNC _pScintillaFunc; SCINTILLA_PTR _pScintillaPtr; - static WNDPROC _scintillaDefaultProc; CallWindowProcFunc _callWindowProc; - BufferID attachDefaultDoc(); //Store the current buffer so it can be retrieved later BufferID _currentBufferID; Buffer * _currentBuffer; - folderStyle _folderStyle; - NppParameters *_pParameter; - int _codepage; int _oemCodepage; - bool _lineNumbersShown; - bool _wrapRestoreNeeded; + typedef std::map StyleMap; + typedef std::map BufferStyleMap; + BufferStyleMap _hotspotStyles; + //Lexers and Styling void defineDocType(LangType typeDoc); //setup stylers for active document void restyleBuffer(); @@ -609,9 +618,10 @@ protected: void setKeywords(LangType langType, const char *keywords, int index); void setLexer(int lexerID, LangType langType, int whichList); inline void makeStyle(LangType langType, const TCHAR **keywordArray = NULL); + void setHotspotStyle(Style& styleToSet); void setStyle(Style styleToSet); //NOT by reference (style edited) - void setSpecialStyle(Style & styleToSet); //by reference - void setSpecialIndicator(Style & styleToSet) { + void setSpecialStyle(const Style & styleToSet); //by reference + void setSpecialIndicator(const Style & styleToSet) { execute(SCI_INDICSETFORE, styleToSet._styleID, styleToSet._bgColor); }; diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index 18bcf3f1..2c969c7a 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -18,6 +18,7 @@ //#include "..\..\resource.h" #include "ToolBar.h" #include "Shortcut.h" +#include "Parameters.h" const int WS_TOOLBARSTYLE = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS |TBSTYLE_FLAT | CCS_TOP | BTNS_AUTOSIZE | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER; @@ -259,8 +260,18 @@ void ToolBar::addToRebar(ReBar * rebar) { return; _pRebar = rebar; - ZeroMemory(&_rbBand, sizeof(REBARBANDINFO)); - _rbBand.cbSize = sizeof(REBARBANDINFO); + winVer winVersion = (NppParameters::getInstance())->getWinVersion(); + if (winVersion <= WV_ME) + { + ZeroMemory(&_rbBand, sizeof(REBARBANDINFO)); + _rbBand.cbSize = sizeof(REBARBANDINFO); + } + else + { + ZeroMemory(&_rbBand, REBARBANDINFO_V3_SIZE); + _rbBand.cbSize = REBARBANDINFO_V3_SIZE; + } + _rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_ID; @@ -296,7 +307,8 @@ void ReBar::init(HINSTANCE hInst, HWND hPere) ::SendMessage(_hSelf, RB_SETBARINFO, 0, (LPARAM)&rbi); } -bool ReBar::addBand(REBARBANDINFO * rBand, bool useID) { +bool ReBar::addBand(REBARBANDINFO * rBand, bool useID) +{ if (rBand->fMask & RBBIM_STYLE) rBand->fStyle |= RBBS_GRIPPERALWAYS; else @@ -313,24 +325,39 @@ bool ReBar::addBand(REBARBANDINFO * rBand, bool useID) { return true; } -void ReBar::reNew(int id, REBARBANDINFO * rBand) { +void ReBar::reNew(int id, REBARBANDINFO * rBand) +{ int index = (int)SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); ::SendMessage(_hSelf, RB_SETBANDINFO, (WPARAM)index, (LPARAM)rBand); }; -void ReBar::removeBand(int id) { +void ReBar::removeBand(int id) +{ int index = (int)SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); if (id >= REBAR_BAR_EXTERNAL) releaseID(id); ::SendMessage(_hSelf, RB_DELETEBAND, (WPARAM)index, (LPARAM)0); } -void ReBar::setIDVisible(int id, bool show) { +void ReBar::setIDVisible(int id, bool show) +{ int index = (int)SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); if (index == -1 ) return; //error + REBARBANDINFO rbBand; - rbBand.cbSize = sizeof(rbBand); + winVer winVersion = (NppParameters::getInstance())->getWinVersion(); + if (winVersion <= WV_ME) + { + ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); + rbBand.cbSize = sizeof(REBARBANDINFO); + } + else + { + ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE); + rbBand.cbSize = REBARBANDINFO_V3_SIZE; + } + rbBand.fMask = RBBIM_STYLE; ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); if (show) @@ -340,28 +367,46 @@ void ReBar::setIDVisible(int id, bool show) { ::SendMessage(_hSelf, RB_SETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); } -bool ReBar::getIDVisible(int id) { +bool ReBar::getIDVisible(int id) +{ int index = (int)SendMessage(_hSelf, RB_IDTOINDEX, (WPARAM)id, 0); if (index == -1 ) return false; //error REBARBANDINFO rbBand; - rbBand.cbSize = sizeof(rbBand); + winVer winVersion = (NppParameters::getInstance())->getWinVersion(); + if (winVersion <= WV_ME) + { + ZeroMemory(&rbBand, sizeof(REBARBANDINFO)); + rbBand.cbSize = sizeof(REBARBANDINFO); + } + else + { + ZeroMemory(&rbBand, REBARBANDINFO_V3_SIZE); + rbBand.cbSize = REBARBANDINFO_V3_SIZE; + } rbBand.fMask = RBBIM_STYLE; ::SendMessage(_hSelf, RB_GETBANDINFO, (WPARAM)index, (LPARAM)&rbBand); return ((rbBand.fStyle & RBBS_HIDDEN) == 0); } -int ReBar::getNewID() { +int ReBar::getNewID() +{ int idToUse = REBAR_BAR_EXTERNAL; int curVal = 0; 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); - if (curVal < idToUse) { + if (curVal < idToUse) + { continue; - } else if (curVal == idToUse) { + } + else if (curVal == idToUse) + { idToUse++; - } else { + } + else + { break; //found gap } } @@ -370,20 +415,26 @@ int ReBar::getNewID() { return idToUse; } -void ReBar::releaseID(int id) { +void ReBar::releaseID(int id) +{ size_t size = usedIDs.size(); - for(size_t i = 0; i < size; i++) { - if (usedIDs.at(i) == id) { + for(size_t i = 0; i < size; i++) + { + if (usedIDs.at(i) == id) + { usedIDs.erase(usedIDs.begin()+i); break; } } } -bool ReBar::isIDTaken(int id) { +bool ReBar::isIDTaken(int id) +{ size_t size = usedIDs.size(); - for(size_t i = 0; i < size; i++) { - if (usedIDs.at(i) == id) { + for(size_t i = 0; i < size; i++) + { + if (usedIDs.at(i) == id) + { return true; } } diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 1144396f..28163588 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -18,9 +18,9 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v5.4.2") -#define VERSION_VALUE TEXT("5.42\0") // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 -#define VERSION_DIGITALVALUE 5, 4, 2, 0 +#define NOTEPAD_PLUS_VERSION TEXT("Notepad++ v5.4.3") +#define VERSION_VALUE TEXT("5.43\0") // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 +#define VERSION_DIGITALVALUE 5, 4, 3, 0 #ifdef UNICODE #define UNICODE_ANSI_MODE TEXT("(UNICODE)")