From 84b2a538192776c96b4958140f7cfdaeaa79e199 Mon Sep 17 00:00:00 2001 From: donho Date: Sun, 15 Jun 2008 17:52:08 +0000 Subject: [PATCH] [BUG_FIXED] Fix the crash issue under Chinese/Korean/Japanese Windoz in v5.0 alpha. Fix go to line command line bug. Enhance Find in files and Find in all opened files features' performance. Fix dialog off screen problem under multi-monitor environment. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@234 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/bin/change.log | 6 +- PowerEditor/installer/nppSetup.nsi | 88 +++++++++++-------- PowerEditor/src/Notepad_plus.cpp | 70 +++++++++------ PowerEditor/src/Parameters.h | 1 + .../ScitillaComponent/ScintillaEditView.cpp | 7 +- .../WinControls/StaticDialog/StaticDialog.cpp | 30 +++++++ .../WinControls/StaticDialog/StaticDialog.h | 2 + PowerEditor/src/winmain.cpp | 21 ++--- PowerEditor/visual.net/notepadPlus.vcproj | 8 -- 9 files changed, 141 insertions(+), 92 deletions(-) diff --git a/PowerEditor/bin/change.log b/PowerEditor/bin/change.log index 5277e9210..a920904d7 100644 --- a/PowerEditor/bin/change.log +++ b/PowerEditor/bin/change.log @@ -1,4 +1,4 @@ -Notepad++ v5 fixed bugs and added features (from v4.9.2) : +Notepad++ v5 Beta fixed bugs and added features (from v4.9.2) : 1. Improve Notepad++ performance - on startup and on exit. 2. Add Calltip capacity. @@ -18,7 +18,9 @@ Notepad++ v5 fixed bugs and added features (from v4.9.2) : 16. Tabbar's coulours is configurable via Stylers Configurator(Active tab Text, Inactive tab text, Inactive tab background, Active tab focused indicator and Active tab unfocused indicator). 17. Add the smart highlight file size limit - 1.5 MB in order to improve the performance. 18. Add exception handling (dumping filedata). - +19. Fix go to line command line bug. +20. Enhance Find in files and Find in all opened files features' performance. +21. Fix dialog off screen problem under multi-monitor environment. Included plugins : diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index af9f94f65..977e6ffb0 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -17,16 +17,16 @@ ; Define the application name !define APPNAME "Notepad++" -!define APPNAMEANDVERSION "Notepad++ v4.9.2" +!define APPNAMEANDVERSION "Notepad++ v5.0" -!define VERSION_MAJOR 4 -!define VERSION_MINOR 92 +!define VERSION_MAJOR 5 +!define VERSION_MINOR 0 ; Main Install settings Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\Notepad++" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "..\bin\npp.4.9.2.Installer.exe" +OutFile "..\bin\npp.5.0.beta.Installer.exe" ; GetWindowsVersion ; @@ -44,7 +44,7 @@ OutFile "..\bin\npp.4.9.2.Installer.exe" ; Pop $R0 ; ; at this point $R0 is "NT 4.0" or whatnot - Function GetWindowsVersion +Function GetWindowsVersion Push $R0 Push $R1 @@ -121,8 +121,11 @@ OutFile "..\bin\npp.4.9.2.Installer.exe" Pop $R1 Exch $R0 - FunctionEnd +FunctionEnd +Function LaunchNpp + Exec '"$INSTDIR\notepad++.exe" "$INSTDIR\change.log" ' +FunctionEnd ; Modern interface settings !include "MUI.nsh" @@ -139,7 +142,6 @@ OutFile "..\bin\npp.4.9.2.Installer.exe" !define MUI_HEADERIMAGE_BITMAP ".\images\headerLeft.bmp" ; optional !define MUI_ABORTWARNING -!define MUI_FINISHPAGE_RUN "$INSTDIR\notepad++.exe" !insertmacro MUI_PAGE_WELCOME @@ -147,6 +149,10 @@ OutFile "..\bin\npp.4.9.2.Installer.exe" !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES + +!define MUI_FINISHPAGE_RUN +;!define MUI_FINISHPAGE_RUN_TEXT "Run Npp" +!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchNpp" !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM @@ -497,6 +503,10 @@ GLOBAL_INST: MessageBox MB_OK "Due to the problem of compability with this version,$\nMultiClipboard.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it." Delete "$INSTDIR\plugins\MultiClipboard.dll" + IfFileExists "$INSTDIR\plugins\Explorer.dll" 0 +3 + MessageBox MB_OK "Due to the problem of compability with this version,$\Explorer.dll is about to be deleted." + Delete "$INSTDIR\plugins\Explorer.dll" + ; detect the right of UserInfo::GetAccountType Pop $1 @@ -531,82 +541,82 @@ SubSection "Auto-completion Files" autoCompletionComponent Section C SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\c.api" + File "..\bin\plugins\APIs\c.xml" SectionEnd Section C++ SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\cpp.api" + File "..\bin\plugins\APIs\cpp.xml" SectionEnd Section Java SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\java.api" + File "..\bin\plugins\APIs\java.xml" SectionEnd Section C# SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\cs.api" + File "..\bin\plugins\APIs\cs.xml" SectionEnd Section PHP SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\php.api" + File "..\bin\plugins\APIs\php.xml" SectionEnd Section CSS SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\css.api" + File "..\bin\plugins\APIs\css.xml" SectionEnd Section VB SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\vb.api" + File "..\bin\plugins\APIs\vb.xml" SectionEnd Section Perl SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\perl.api" + File "..\bin\plugins\APIs\perl.xml" SectionEnd Section JavaScript SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\javascript.api" + File "..\bin\plugins\APIs\javascript.xml" SectionEnd Section Python SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\python.api" + File "..\bin\plugins\APIs\python.xml" SectionEnd Section ActionScript SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\flash.api" + File "..\bin\plugins\APIs\actionscript.xml" SectionEnd Section LISP SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\lisp.api" + File "..\bin\plugins\APIs\lisp.xml" SectionEnd Section VHDL SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\vhdl.api" + File "..\bin\plugins\APIs\vhdl.xml" SectionEnd Section TeX SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\tex.api" + File "..\bin\plugins\APIs\tex.xml" SectionEnd Section DocBook SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\xml.api" + File "..\bin\plugins\APIs\xml.xml" SectionEnd Section NSIS SetOutPath "$INSTDIR\plugins\APIs" - File "..\bin\plugins\APIs\nsis.api" + File "..\bin\plugins\APIs\nsis.xml" SectionEnd SubSectionEnd @@ -785,82 +795,82 @@ SectionEnd SubSection un.autoCompletionComponent Section un.PHP - Delete "$INSTDIR\plugins\APIs\php.api" + Delete "$INSTDIR\plugins\APIs\php.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.CSS - Delete "$INSTDIR\plugins\APIs\css.api" + Delete "$INSTDIR\plugins\APIs\css.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.VB - Delete "$INSTDIR\plugins\APIs\vb.api" + Delete "$INSTDIR\plugins\APIs\vb.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.Perl - Delete "$INSTDIR\plugins\APIs\perl.api" + Delete "$INSTDIR\plugins\APIs\perl.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.C - Delete "$INSTDIR\plugins\APIs\c.api" + Delete "$INSTDIR\plugins\APIs\c.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.C++ - Delete "$INSTDIR\plugins\APIs\cpp.api" + Delete "$INSTDIR\plugins\APIs\cpp.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.Java - Delete "$INSTDIR\plugins\APIs\java.api" + Delete "$INSTDIR\plugins\APIs\java.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.C# - Delete "$INSTDIR\plugins\APIs\cs.api" + Delete "$INSTDIR\plugins\APIs\cs.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.JavaScript - Delete "$INSTDIR\plugins\APIs\javascript.api" + Delete "$INSTDIR\plugins\APIs\javascript.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.Python - Delete "$INSTDIR\plugins\APIs\python.api" + Delete "$INSTDIR\plugins\APIs\python.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.ActionScript - Delete "$INSTDIR\plugins\APIs\flash.api" + Delete "$INSTDIR\plugins\APIs\actionscript.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.LISP - Delete "$INSTDIR\plugins\APIs\lisp.api" + Delete "$INSTDIR\plugins\APIs\lisp.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.VHDL - Delete "$INSTDIR\plugins\APIs\vhdl.api" + Delete "$INSTDIR\plugins\APIs\vhdl.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.TeX - Delete "$INSTDIR\plugins\APIs\tex.api" + Delete "$INSTDIR\plugins\APIs\tex.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.DocBook - Delete "$INSTDIR\plugins\APIs\xml.api" + Delete "$INSTDIR\plugins\APIs\xml.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd Section un.NSIS - Delete "$INSTDIR\plugins\APIs\nsis.api" + Delete "$INSTDIR\plugins\APIs\nsis.xml" RMDir "$INSTDIR\plugins\APIs\" SectionEnd SubSectionEnd diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3318df878..6af15bac9 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -43,7 +43,7 @@ const char Notepad_plus::_className[32] = NOTEPAD_PP_CLASS_NAME; const char *urlHttpRegExpr = "http://[a-z0-9_\\-\\+.:?&@=/%#]*"; -const int smartHighlightFileSizeLimit = 1024 * 1024 + 512 * 1024; // 1,5 MB +const int smartHighlightFileSizeLimit = 1024 * 1024 * 3; // 3 MB int docTabIconIDs[] = {IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON}; enum tb_stat {tb_saved, tb_unsaved, tb_ro}; @@ -183,7 +183,6 @@ Notepad_plus::~Notepad_plus() void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLineParams *cmdLineParams) { Window::init(hInst, parent); - WNDCLASS nppClass; nppClass.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS;//CS_HREDRAW | CS_VREDRAW; @@ -1225,42 +1224,52 @@ bool Notepad_plus::fileCloseAllButCurrent() bool Notepad_plus::replaceAllFiles() { - BufferID active = _mainEditView.getCurrentBufferID(); + BufferID mainID = _mainEditView.getCurrentBufferID(); + BufferID subID = _subEditView.getCurrentBufferID(); ScintillaEditView * pOldView = _pEditView; - _pEditView = &_mainEditView; + Buffer * pBuf = NULL; int nbTotal = 0; const bool isEntireDoc = true; + _pEditView = &_mainEditView; if (_mainWindowStatus & WindowMainActive) { for (int i = 0 ; i < _mainDocTab.nbItem() ; i++) { - _mainEditView.activateBuffer(_mainDocTab.getBufferByIndex(i)); - if (!_mainEditView.getCurrentBuffer()->isReadOnly()) { + pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); + if (pBuf->isReadOnly()) + continue; + bool oldStyle = pBuf->getNeedsLexing(); + pBuf->setNeedsLexing(false); + _mainEditView.activateBuffer(pBuf->getID()); _mainEditView.execute(SCI_BEGINUNDOACTION); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL); _mainEditView.execute(SCI_ENDUNDOACTION); + pBuf->setNeedsLexing(oldStyle); } - - } } - + _mainEditView.activateBuffer(mainID); + + _pEditView = &_subEditView; if (_mainWindowStatus & WindowSubActive) { for (int i = 0 ; i < _subDocTab.nbItem() ; i++) { - _mainEditView.activateBuffer(_mainDocTab.getBufferByIndex(i)); - if (!_mainEditView.getCurrentBuffer()->isReadOnly()) { - _mainEditView.execute(SCI_BEGINUNDOACTION); + pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); + if (pBuf->isReadOnly()) + continue; + bool oldStyle = pBuf->getNeedsLexing(); + pBuf->setNeedsLexing(false); + _subEditView.activateBuffer(pBuf->getID()); + _subEditView.execute(SCI_BEGINUNDOACTION); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL); - _mainEditView.execute(SCI_ENDUNDOACTION); + _subEditView.execute(SCI_ENDUNDOACTION); + pBuf->setNeedsLexing(oldStyle); } - } - } + _subEditView.activateBuffer(subID); - _mainEditView.activateBuffer(active); _pEditView = pOldView; char result[64]; @@ -1270,8 +1279,8 @@ bool Notepad_plus::replaceAllFiles() { { itoa(nbTotal, result, 10); strcat(result, " tokens are replaced."); - } + ::MessageBox(_hSelf, result, "", MB_OK); return true; @@ -5677,13 +5686,11 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _dockingManager.init(_hInst, hwnd, &_pMainWindow); - //dynamicCheckMenuAndTB(); - if (nppGUI._isMinimizedToTray) _pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), ""); checkSyncState(); - + // Plugin Manager NppData nppData; nppData._nppHandle = _hSelf; @@ -5691,7 +5698,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa nppData._scintillaSecondHandle = _subEditView.getHSelf(); _scintillaCtrls4Plugins.init(_hInst, hwnd); - _pluginsManager.init(nppData); _pluginsManager.loadPlugins(); const char *appDataNpp = pNppParam->getAppDataNppDir(); @@ -5732,7 +5738,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa ::DeleteMenu(_mainMenuHandle, IDM_UPDATE_NPP, MF_BYCOMMAND); ::DrawMenuBar(hwnd); } - //Languages Menu HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE); @@ -5848,7 +5853,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa csc.setName(purgeMenuItemString(menuName, true).c_str()); } } - //Translate non-menu shortcuts changeShortcutLang(); @@ -5959,7 +5963,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa MainFileManager->increaseDocNr(); //so next doc starts at 2 ::SetFocus(_mainEditView.getHSelf()); - result = TRUE; } break; @@ -7553,7 +7556,8 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_mainEditView)); - _mainEditView.activateBuffer(buf->getID()); + //_mainEditView.activateBuffer(buf->getID()); + _mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); int maxLine = _mainEditView.execute(SCI_GETLINECOUNT); for (int j = 0 ; j < maxLine ; j++) { @@ -7590,8 +7594,10 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) } } - _mainEditView.activateBuffer(mainBuf->getID()); //restore buffer - _subEditView.activateBuffer(subBuf->getID()); //restore buffer + //_mainEditView.activateBuffer(mainBuf->getID()); //restore buffer + //_subEditView.activateBuffer(subBuf->getID()); //restore buffer + _mainEditView.execute(SCI_SETDOCPOINTER, 0, mainBuf->getDocument()); + _subEditView.execute(SCI_SETDOCPOINTER, 0, subBuf->getDocument()); } bool Notepad_plus::fileLoadSession(const char *fn) @@ -8004,11 +8010,17 @@ void Notepad_plus::loadCommandlineParams(const char * commandLine, CmdLineParams lastOpened = bufID; - if (ln != 0 || exists) { //we have to move the cursor manually + if (lt != L_EXTERNAL) + { + Buffer * pBuf = MainFileManager->getBufferByID(bufID); + pBuf->setLangType(lt); + } + + if (ln != -1) + { //we have to move the cursor manually int iView = currentView(); //store view since fileswitch can cause it to change switchToFile(bufID); //switch to the file. No deferred loading, but this way we can easily move the cursor to the right position - _pEditView->getCurrentBuffer()->setLangType(lt); _pEditView->execute(SCI_GOTOLINE, ln-1); switchEditViewTo(iView); //restore view } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 7208a2ee0..2273db8ed 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -137,6 +137,7 @@ struct CmdLineParams { int _line2go; LangType _langType; + CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false), _line2go(-1), _langType(L_EXTERNAL){} }; struct FloatingWindowInfo { diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index a999cb17a..03c180fa6 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -356,7 +356,7 @@ void ScintillaEditView::setXmlLexer(LangType type) { if (type == L_XML) { - execute(SCI_SETLEXER, SCLEX_HTML); + execute(SCI_SETLEXER, SCLEX_XML); for (int i = 0 ; i < 4 ; i++) execute(SCI_SETKEYWORDS, i, reinterpret_cast("")); @@ -364,7 +364,7 @@ void ScintillaEditView::setXmlLexer(LangType type) } else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP)) { - execute(SCI_SETLEXER, SCLEX_XML); + execute(SCI_SETLEXER, SCLEX_HTML); const char *htmlKeyWords =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(htmlKeyWords?htmlKeyWords:"")); @@ -688,7 +688,6 @@ void ScintillaEditView::makeStyle(LangType language, const char **keywordArray) void ScintillaEditView::defineDocType(LangType typeDoc) { //setStyle(STYLE_DEFAULT, black, white, "Verdana", 0, 9); - StyleArray & stylers = _pParameter->getMiscStylerArray(); int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT); if (iStyleDefault != -1) @@ -729,7 +728,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc) Style & styleFind = stylers.getStyler(iFind); setSpecialStyle(styleFind); } - + int caretWidth = 1; diff --git a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp index 6d1775502..645a6ad4d 100644 --- a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.cpp @@ -33,6 +33,36 @@ void StaticDialog::goToCenter() ::SetWindowPos(_hSelf, HWND_TOP, x, y, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW); } + +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; + ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0); + ::GetWindowRect(_hSelf, &rc); + int newLeft = rc.left; + int newTop = rc.top; + int margin = ::GetSystemMetrics(SM_CYSMCAPTION); + if (newLeft > ::GetSystemMetrics(SM_CXVIRTUALSCREEN)-margin) + newLeft -= rc.right - workAreaRect.right; + if (newLeft + (rc.right - rc.left) < ::GetSystemMetrics(SM_XVIRTUALSCREEN)+margin) + newLeft = workAreaRect.left; + if (newTop > ::GetSystemMetrics(SM_CYVIRTUALSCREEN)-margin) + newTop -= rc.bottom - workAreaRect.bottom; + if (newTop + (rc.bottom - rc.top) < ::GetSystemMetrics(SM_YVIRTUALSCREEN)+margin) + newTop = workAreaRect.top; + + if ((newLeft != rc.left) || (newTop != rc.top)) // then the virtual screen size has shrunk + // Remember that MoveWindow wants width/height. + ::MoveWindow(_hSelf, newLeft, newTop, rc.right - rc.left, rc.bottom - rc.top, TRUE); + } + + Window::display(toShow); +} + + HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate) { // Get Dlg Template resource diff --git a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h index 3c094b2b3..72670c684 100644 --- a/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h +++ b/PowerEditor/src/WinControls/StaticDialog/StaticDialog.h @@ -58,6 +58,8 @@ public : void goToCenter(); + void display(bool toShow = true) const; + POINT getLeftTopPoint(HWND hwnd/*, POINT & p*/) const { RECT rc; ::GetWindowRect(hwnd, &rc); diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 8fd68d388..b3f0396c6 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -69,28 +69,33 @@ bool isInList(const char *token2Find, ParamVector & params) { return false; }; -string getParamVal(char c, ParamVector & params) { +bool getParamVal(char c, ParamVector & params, string & value) { + value = ""; int nrItems = params.size(); for (int i = 0; i < nrItems; i++) { const char * token = params.at(i); if (token[0] == '-' && strlen(token) >= 2 && token[1] == c) { //dash, and enough chars - string retval(token+2); + value = (token+2); params.erase(params.begin() + i); - return retval; + return true; } } - return string(""); + return false; } LangType getLangTypeFromParam(ParamVector & params) { - string langStr = getParamVal('l', params); + string langStr; + if (!getParamVal('l', params, langStr)) + return L_EXTERNAL; return NppParameters::getLangIDFromStr(langStr.c_str()); }; int getLn2GoFromParam(ParamVector & params) { - string lineNumStr = getParamVal('n', params); + string lineNumStr; + if (!getParamVal('n', params, lineNumStr)) + return -1; return atoi(lineNumStr.c_str()); }; @@ -105,7 +110,6 @@ void doException(Notepad_plus & notepad_plus_plus); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdShow) { bool TheFirstOne = true; - ::SetLastError(NO_ERROR); ::CreateMutex(NULL, false, "nppInstance"); if (::GetLastError() == ERROR_ALREADY_EXISTS) @@ -124,7 +128,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh cmdLineParams._line2go = getLn2GoFromParam(params); NppParameters *pNppParameters = NppParameters::getInstance(); - // override the settings if notepad style is present if (pNppParameters->asNotepadStyle()) { @@ -152,7 +155,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh } quotFileName += "\""; } - if ((!isMultiInst) && (!TheFirstOne)) { HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL); @@ -232,7 +234,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh Win32Exception::installHandler(); try { notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams); - bool unicodeSupported = notepad_plus_plus.getWinVersion() >= WV_NT; bool going = true; while (going) diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index 26b066ab9..879abe924 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -602,18 +602,10 @@ RelativePath="..\src\MISC\RegExt\regExtDlgRc.h" > - - - -