From 8887ef132848f9ef1c284d5113fc2c6251739b45 Mon Sep 17 00:00:00 2001 From: donho Date: Wed, 18 Mar 2009 00:10:43 +0000 Subject: [PATCH] [BUG_FIXED] Fix the bug the Notepad++ is launched several instances but show nothing. Fix Find in files regression : Panel doesn't take Unicode. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@438 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 15 ++++++++++----- .../src/ScitillaComponent/FindReplaceDlg.cpp | 2 +- .../src/ScitillaComponent/ScintillaEditView.cpp | 2 +- .../src/ScitillaComponent/ScintillaEditView.h | 2 +- PowerEditor/src/winmain.cpp | 5 ++++- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 0d60a3b43..543d1fbc6 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -7719,11 +7719,16 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa return _pEditView->getCurrentColumnNumber(); } - case NPPM_GETCURRENTSCINTILLA : - { - *((int *)lParam) = (_pEditView == &_mainEditView)?0:1; - return TRUE; - } + case NPPM_GETCURRENTSCINTILLA : + { + if (_pEditView == &_mainEditView) + *((int *)lParam) = MAIN_VIEW; + else if (_pEditView == &_subEditView) + *((int *)lParam) = SUB_VIEW; + else + *((int *)lParam) = -1; + return TRUE; + } case NPPM_GETCURRENTLANGTYPE : { diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index bfa705a04..46a8d1a0e 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -1528,7 +1528,7 @@ void FindReplaceDlg::findAllIn(InWhat op) originalFinderProc = SetWindowLong( _pFinder->_scintView.getHSelf(), GWL_WNDPROC, (LONG) finderProc); _pFinder->setFinderReadOnly(true); - _pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_DBCS); + _pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8); _pFinder->_scintView.execute(SCI_USEPOPUP, FALSE); _pFinder->_scintView.execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information _pFinder->_scintView.execute(SCI_SETCARETLINEVISIBLE, 1); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index deb22e0be..f852ff534 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -955,7 +955,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc) setSpecialIndicator(*pStyle); defaultIndicatorStyle._styleID = SCE_UNIVERSAL_TAGMATCH; - defaultIndicatorStyle._bgColor = RGB(0x00, 0x80, 0xFF); + defaultIndicatorStyle._bgColor = RGB(0x80, 0x00, 0xFF); pStyle = &defaultIndicatorStyle; iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_TAGMATCH); if (iFind != -1) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 19cd108ec..c3613bb70 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -253,7 +253,7 @@ public: setLineNumberWidth(willBeShowed); else { - int width = 4; + int width = 3; if (whichMarge == _SC_MARGE_SYBOLE || whichMarge == _SC_MARGE_FOLDER) width = 14; execute(SCI_SETMARGINWIDTHN, whichMarge, willBeShowed?width:0); diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index b430f33f9..ea404c791 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -205,9 +205,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh if ((!isMultiInst) && (!TheFirstOne)) { HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL); - for (;!(hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL));) + for (int i = 0 ;!(hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL)) && i < 5 ; i++) Sleep(100); + if (hNotepad_plus) + { // First of all, destroy static object NppParameters pNppParameters->destroyInstance(); MainFileManager->destroyInstance(); @@ -242,6 +244,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh ::SendMessage(hNotepad_plus, WM_COPYDATA, (WPARAM)hInstance, (LPARAM)&fileNamesData); } return 0; + } } pNppParameters->load();