diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index c9cdbd83..59670e39 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -166,7 +166,7 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi nppClass.cbWndExtra = 0; nppClass.hInstance = _hInst; nppClass.hIcon = ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)); - nppClass.hCursor = NULL; + nppClass.hCursor = ::LoadCursor(NULL, IDC_ARROW); nppClass.hbrBackground = ::CreateSolidBrush(::GetSysColor(COLOR_MENU)); nppClass.lpszMenuName = MAKEINTRESOURCE(IDR_M30_MENU); nppClass.lpszClassName = _className; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 78d8f85f..d4664aa4 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -340,11 +340,28 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty _asNotepadStyle = (PathFileExists(notepadStylePath) == TRUE); + ::AddFontResource(LINEDRAW_FONT); + //Load initial accelerator key definitions initMenuKeys(); initScintillaKeys(); } +NppParameters::~NppParameters() +{ + for (int i = 0 ; i < _nbLang ; i++) + delete _langList[i]; + for (int i = 0 ; i < _nbFile ; i++) + delete _LRFileList[i]; + for (int i = 0 ; i < _nbUserLang ; i++) + delete _userLangArray[i]; + if (_hUser32) + FreeLibrary(_hUser32); + if (_hUXTheme) + FreeLibrary(_hUXTheme); + + ::RemoveFontResource(LINEDRAW_FONT); +} void cutString(const char *str2cut, vector & patternVect) { char str2scan[MAX_PATH]; @@ -718,10 +735,12 @@ void NppParameters::setFontList(HWND hWnd) //---------------// LOGFONT lf; + _fontlist.clear(); _fontlist.push_back(""); lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0]='\0'; + lf.lfPitchAndFamily = 0; HDC hDC = ::GetDC(hWnd); ::EnumFontFamiliesEx(hDC, &lf, diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 87010bca..772cb4ab 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -917,7 +917,7 @@ public: return false; }; - const char * getLangNameFromExt(char *ext) { + const char * getUserDefinedLangNameFromExt(char *ext) { if ((!ext) || (!ext[0])) return NULL; @@ -1060,19 +1060,8 @@ public: } private: NppParameters(); - ~NppParameters() { - for (int i = 0 ; i < _nbLang ; i++) - delete _langList[i]; - for (int i = 0 ; i < _nbFile ; i++) - delete _LRFileList[i]; - for (int i = 0 ; i < _nbUserLang ; i++) - delete _userLangArray[i]; - if (_hUser32) - FreeLibrary(_hUser32); - if (_hUXTheme) - FreeLibrary(_hUXTheme); - //::RemoveFontResource(LINEDRAW_FONT); - }; + ~NppParameters(); + static NppParameters *_pSelf; TiXmlDocument *_pXmlDoc, *_pXmlUserDoc, *_pXmlUserStylerDoc, *_pXmlUserLangDoc, *_pXmlNativeLangDoc,\ @@ -1142,14 +1131,16 @@ private: static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam) { vector *pStrVect = (vector *)lParam; size_t vectSize = pStrVect->size(); - if (vectSize == 0) - pStrVect->push_back((char *)lpelfe->elfFullName); - else - { - const char *lastFontName = pStrVect->at(vectSize - 1).c_str(); - if (strcmp(lastFontName, (const char *)lpelfe->elfFullName)) - pStrVect->push_back((char *)lpelfe->elfFullName); - } + + //Search through all the fonts, EnumFontFamiliesEx never states anything about order + //Start at the end though, that's the most likely place to find a duplicate + for(int i = vectSize - 1 ; i >= 0 ; i--) { + if ( !strcmp((*pStrVect)[i].c_str(), (const char *)lpelfe->elfLogFont.lfFaceName) ) + return 1; //we already have seen this typeface, ignore it + } + //We can add the font + //Add the face name and not the full name, we do not care about any styles + pStrVect->push_back((char *)lpelfe->elfLogFont.lfFaceName); return 1; // I want to get all fonts }; diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 0173d1ee..2fc511fa 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -2,10 +2,11 @@ long Buffer::_recentTagCtr = 0; +// Set full path file name in buffer object, +// and determinate its language by its extension. +// If the ext is not in the list, the defaultLang passed as argument will be set. void Buffer::setFileName(const char *fn, LangType defaultLang) { - bool isExtSet = false; - NppParameters *pNppParamInst = NppParameters::getInstance(); strcpy(_fullPathName, fn); if (PathFileExists(_fullPathName)) @@ -16,11 +17,10 @@ void Buffer::setFileName(const char *fn, LangType defaultLang) // Define User Lang firstly const char *langName = NULL; - if ((langName = pNppParamInst->getLangNameFromExt(ext))) + if ((langName = pNppParamInst->getUserDefinedLangNameFromExt(ext))) { _lang = L_USER; strcpy(_userLangExt, langName); - isExtSet = true; } else // if it's not user lang, then check if it's supported lang { @@ -34,10 +34,9 @@ void Buffer::setFileName(const char *fn, LangType defaultLang) else if (!_stricmp(fileName, "CmakeLists.txt")) _lang = L_CMAKE; } - } - - if (!isExtSet) _userLangExt[0] = '\0'; + } + // for _timeStamp updatTimeStamp(); } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 29a06852..8727ee2f 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -115,8 +115,19 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) _codepage = ::GetACP(); _oemCodepage = ::GetOEMCP(); - ::SetWindowLong(_hSelf, GWL_USERDATA, reinterpret_cast(this)); - _scintillaDefaultProc = reinterpret_cast(::SetWindowLong(_hSelf, GWL_WNDPROC, reinterpret_cast(scintillaStatic_Proc))); + //Use either Unicode or ANSI setwindowlong, depending on environment + if (::IsWindowUnicode(_hSelf)) + { + ::SetWindowLongW(_hSelf, GWL_USERDATA, reinterpret_cast(this)); + _callWindowProc = CallWindowProcW; + _scintillaDefaultProc = reinterpret_cast(::SetWindowLongW(_hSelf, GWL_WNDPROC, reinterpret_cast(scintillaStatic_Proc))); + } + else + { + ::SetWindowLongA(_hSelf, GWL_USERDATA, reinterpret_cast(this)); + _callWindowProc = CallWindowProcA; + _scintillaDefaultProc = reinterpret_cast(::SetWindowLongA(_hSelf, GWL_WNDPROC, reinterpret_cast(scintillaStatic_Proc))); + } } LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) @@ -178,7 +189,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa break; } } - return ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam); + return _callWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam); } void ScintillaEditView::setSpecialStyle(int styleID, COLORREF fgColour, COLORREF bgColour, const char *fontName, int fontStyle, int fontSize) { diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 7330ece7..6dcef110 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -123,6 +123,8 @@ static int getNbChiffre(int aNum, int base) char * int2str(char *str, int strLen, int number, int base, int nbChiffre, bool isZeroLeading); +typedef LRESULT (WINAPI *CallWindowProcFunc) (WNDPROC,HWND,UINT,WPARAM,LPARAM); + class ScintillaEditView : public Window { friend class Notepad_plus; @@ -644,6 +646,7 @@ protected: // the current active buffer index of _buffers int _currentIndex; static WNDPROC _scintillaDefaultProc; + CallWindowProcFunc _callWindowProc; // the list of docs buf_vec_t _buffers; diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index f6dc7fcc..ca7cf6a6 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -83,7 +83,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin) clz.cbWndExtra = 0; clz.hInstance = _hInst; clz.hIcon = NULL; - clz.hCursor = NULL; + clz.hCursor = ::LoadCursor(NULL, IDC_ARROW); clz.hbrBackground = NULL; clz.lpszMenuName = NULL; clz.lpszClassName = DSPC_CLASS_NAME; diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index d0802680..51a1d7e3 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -127,7 +127,7 @@ void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes clz.cbWndExtra = 0; clz.hInstance = _hInst; clz.hIcon = NULL; - clz.hCursor = NULL; + clz.hCursor = ::LoadCursor(NULL, IDC_ARROW); clz.hbrBackground = NULL; clz.lpszMenuName = NULL; diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index fe93393b..757090a2 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -1328,7 +1328,7 @@ ATOM RegisterGridClass(HINSTANCE hInstance) wclass.cbWndExtra = 0; wclass.hInstance = hInstance; wclass.hIcon = NULL; - wclass.hCursor = NULL; + wclass.hCursor = ::LoadCursor(NULL, IDC_ARROW); wclass.hbrBackground = (HBRUSH)(GetStockObject(GRAY_BRUSH)); wclass.lpszClassName = "BABYGRID"; diff --git a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp index b251935e..0405de67 100644 --- a/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp +++ b/PowerEditor/src/WinControls/SplitterContainer/SplitterContainer.cpp @@ -46,7 +46,7 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize, splitterContainerClass.cbWndExtra = 0; splitterContainerClass.hInstance = _hInst; splitterContainerClass.hIcon = NULL; - splitterContainerClass.hCursor = NULL; + splitterContainerClass.hCursor = ::LoadCursor(NULL, IDC_ARROW); // hbrBackground must be NULL, // otherwise this window will hide some parts of 2 windows diff --git a/PowerEditor/visual.net/notepadPlus.7.0.vcproj b/PowerEditor/visual.net/notepadPlus.7.0.vcproj index 5bfdc966..084a5d62 100644 --- a/PowerEditor/visual.net/notepadPlus.7.0.vcproj +++ b/PowerEditor/visual.net/notepadPlus.7.0.vcproj @@ -20,7 +20,7 @@ +IF NOT EXIST ..\bin\contextMenu.xml COPY ..\src\contextMenu.xml ..\bin\contextMenu.xml +IF NOT EXIST ..\bin\shortcuts.xml COPY ..\src\shortcuts.xml ..\bin\shortcuts.xml +IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\userDefineLang.xml +"/> +IF NOT EXIST ..\bin\contextMenu.xml COPY ..\src\contextMenu.xml ..\bin\contextMenu.xml +IF NOT EXIST ..\bin\shortcuts.xml COPY ..\src\shortcuts.xml ..\bin\shortcuts.xml +IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\userDefineLang.xml +"/> + + @@ -347,6 +352,9 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use + + @@ -551,6 +559,9 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use + +