[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
This commit is contained in:
donho 2008-06-15 17:52:08 +00:00
parent 01285fbfbc
commit 84b2a53819
9 changed files with 141 additions and 92 deletions

View File

@ -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. 1. Improve Notepad++ performance - on startup and on exit.
2. Add Calltip capacity. 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). 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. 17. Add the smart highlight file size limit - 1.5 MB in order to improve the performance.
18. Add exception handling (dumping filedata). 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 : Included plugins :

View File

@ -17,16 +17,16 @@
; Define the application name ; Define the application name
!define APPNAME "Notepad++" !define APPNAME "Notepad++"
!define APPNAMEANDVERSION "Notepad++ v4.9.2" !define APPNAMEANDVERSION "Notepad++ v5.0"
!define VERSION_MAJOR 4 !define VERSION_MAJOR 5
!define VERSION_MINOR 92 !define VERSION_MINOR 0
; Main Install settings ; Main Install settings
Name "${APPNAMEANDVERSION}" Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Notepad++" InstallDir "$PROGRAMFILES\Notepad++"
InstallDirRegKey HKLM "Software\${APPNAME}" "" InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "..\bin\npp.4.9.2.Installer.exe" OutFile "..\bin\npp.5.0.beta.Installer.exe"
; GetWindowsVersion ; GetWindowsVersion
; ;
@ -44,7 +44,7 @@ OutFile "..\bin\npp.4.9.2.Installer.exe"
; Pop $R0 ; Pop $R0
; ; at this point $R0 is "NT 4.0" or whatnot ; ; at this point $R0 is "NT 4.0" or whatnot
Function GetWindowsVersion Function GetWindowsVersion
Push $R0 Push $R0
Push $R1 Push $R1
@ -121,8 +121,11 @@ OutFile "..\bin\npp.4.9.2.Installer.exe"
Pop $R1 Pop $R1
Exch $R0 Exch $R0
FunctionEnd FunctionEnd
Function LaunchNpp
Exec '"$INSTDIR\notepad++.exe" "$INSTDIR\change.log" '
FunctionEnd
; Modern interface settings ; Modern interface settings
!include "MUI.nsh" !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_HEADERIMAGE_BITMAP ".\images\headerLeft.bmp" ; optional
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\notepad++.exe"
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
@ -147,6 +149,10 @@ OutFile "..\bin\npp.4.9.2.Installer.exe"
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES !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_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM !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." 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" 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 ; detect the right of
UserInfo::GetAccountType UserInfo::GetAccountType
Pop $1 Pop $1
@ -531,82 +541,82 @@ SubSection "Auto-completion Files" autoCompletionComponent
Section C Section C
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\c.api" File "..\bin\plugins\APIs\c.xml"
SectionEnd SectionEnd
Section C++ Section C++
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\cpp.api" File "..\bin\plugins\APIs\cpp.xml"
SectionEnd SectionEnd
Section Java Section Java
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\java.api" File "..\bin\plugins\APIs\java.xml"
SectionEnd SectionEnd
Section C# Section C#
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\cs.api" File "..\bin\plugins\APIs\cs.xml"
SectionEnd SectionEnd
Section PHP Section PHP
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\php.api" File "..\bin\plugins\APIs\php.xml"
SectionEnd SectionEnd
Section CSS Section CSS
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\css.api" File "..\bin\plugins\APIs\css.xml"
SectionEnd SectionEnd
Section VB Section VB
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\vb.api" File "..\bin\plugins\APIs\vb.xml"
SectionEnd SectionEnd
Section Perl Section Perl
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\perl.api" File "..\bin\plugins\APIs\perl.xml"
SectionEnd SectionEnd
Section JavaScript Section JavaScript
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\javascript.api" File "..\bin\plugins\APIs\javascript.xml"
SectionEnd SectionEnd
Section Python Section Python
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\python.api" File "..\bin\plugins\APIs\python.xml"
SectionEnd SectionEnd
Section ActionScript Section ActionScript
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\flash.api" File "..\bin\plugins\APIs\actionscript.xml"
SectionEnd SectionEnd
Section LISP Section LISP
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\lisp.api" File "..\bin\plugins\APIs\lisp.xml"
SectionEnd SectionEnd
Section VHDL Section VHDL
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\vhdl.api" File "..\bin\plugins\APIs\vhdl.xml"
SectionEnd SectionEnd
Section TeX Section TeX
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\tex.api" File "..\bin\plugins\APIs\tex.xml"
SectionEnd SectionEnd
Section DocBook Section DocBook
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\xml.api" File "..\bin\plugins\APIs\xml.xml"
SectionEnd SectionEnd
Section NSIS Section NSIS
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\nsis.api" File "..\bin\plugins\APIs\nsis.xml"
SectionEnd SectionEnd
SubSectionEnd SubSectionEnd
@ -785,82 +795,82 @@ SectionEnd
SubSection un.autoCompletionComponent SubSection un.autoCompletionComponent
Section un.PHP Section un.PHP
Delete "$INSTDIR\plugins\APIs\php.api" Delete "$INSTDIR\plugins\APIs\php.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.CSS Section un.CSS
Delete "$INSTDIR\plugins\APIs\css.api" Delete "$INSTDIR\plugins\APIs\css.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.VB Section un.VB
Delete "$INSTDIR\plugins\APIs\vb.api" Delete "$INSTDIR\plugins\APIs\vb.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.Perl Section un.Perl
Delete "$INSTDIR\plugins\APIs\perl.api" Delete "$INSTDIR\plugins\APIs\perl.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.C Section un.C
Delete "$INSTDIR\plugins\APIs\c.api" Delete "$INSTDIR\plugins\APIs\c.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.C++ Section un.C++
Delete "$INSTDIR\plugins\APIs\cpp.api" Delete "$INSTDIR\plugins\APIs\cpp.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.Java Section un.Java
Delete "$INSTDIR\plugins\APIs\java.api" Delete "$INSTDIR\plugins\APIs\java.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.C# Section un.C#
Delete "$INSTDIR\plugins\APIs\cs.api" Delete "$INSTDIR\plugins\APIs\cs.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.JavaScript Section un.JavaScript
Delete "$INSTDIR\plugins\APIs\javascript.api" Delete "$INSTDIR\plugins\APIs\javascript.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.Python Section un.Python
Delete "$INSTDIR\plugins\APIs\python.api" Delete "$INSTDIR\plugins\APIs\python.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.ActionScript Section un.ActionScript
Delete "$INSTDIR\plugins\APIs\flash.api" Delete "$INSTDIR\plugins\APIs\actionscript.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.LISP Section un.LISP
Delete "$INSTDIR\plugins\APIs\lisp.api" Delete "$INSTDIR\plugins\APIs\lisp.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.VHDL Section un.VHDL
Delete "$INSTDIR\plugins\APIs\vhdl.api" Delete "$INSTDIR\plugins\APIs\vhdl.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.TeX Section un.TeX
Delete "$INSTDIR\plugins\APIs\tex.api" Delete "$INSTDIR\plugins\APIs\tex.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.DocBook Section un.DocBook
Delete "$INSTDIR\plugins\APIs\xml.api" Delete "$INSTDIR\plugins\APIs\xml.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.NSIS Section un.NSIS
Delete "$INSTDIR\plugins\APIs\nsis.api" Delete "$INSTDIR\plugins\APIs\nsis.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
SubSectionEnd SubSectionEnd

View File

@ -43,7 +43,7 @@
const char Notepad_plus::_className[32] = NOTEPAD_PP_CLASS_NAME; const char Notepad_plus::_className[32] = NOTEPAD_PP_CLASS_NAME;
const char *urlHttpRegExpr = "http://[a-z0-9_\\-\\+.:?&@=/%#]*"; 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}; int docTabIconIDs[] = {IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON};
enum tb_stat {tb_saved, tb_unsaved, tb_ro}; 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) void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLineParams *cmdLineParams)
{ {
Window::init(hInst, parent); Window::init(hInst, parent);
WNDCLASS nppClass; WNDCLASS nppClass;
nppClass.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS;//CS_HREDRAW | CS_VREDRAW; nppClass.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS;//CS_HREDRAW | CS_VREDRAW;
@ -1225,42 +1224,52 @@ bool Notepad_plus::fileCloseAllButCurrent()
bool Notepad_plus::replaceAllFiles() { bool Notepad_plus::replaceAllFiles() {
BufferID active = _mainEditView.getCurrentBufferID(); BufferID mainID = _mainEditView.getCurrentBufferID();
BufferID subID = _subEditView.getCurrentBufferID();
ScintillaEditView * pOldView = _pEditView; ScintillaEditView * pOldView = _pEditView;
_pEditView = &_mainEditView; Buffer * pBuf = NULL;
int nbTotal = 0; int nbTotal = 0;
const bool isEntireDoc = true; const bool isEntireDoc = true;
_pEditView = &_mainEditView;
if (_mainWindowStatus & WindowMainActive) if (_mainWindowStatus & WindowMainActive)
{ {
for (int i = 0 ; i < _mainDocTab.nbItem() ; i++) for (int i = 0 ; i < _mainDocTab.nbItem() ; i++)
{ {
_mainEditView.activateBuffer(_mainDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i));
if (!_mainEditView.getCurrentBuffer()->isReadOnly()) { if (pBuf->isReadOnly())
continue;
bool oldStyle = pBuf->getNeedsLexing();
pBuf->setNeedsLexing(false);
_mainEditView.activateBuffer(pBuf->getID());
_mainEditView.execute(SCI_BEGINUNDOACTION); _mainEditView.execute(SCI_BEGINUNDOACTION);
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL); nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL);
_mainEditView.execute(SCI_ENDUNDOACTION); _mainEditView.execute(SCI_ENDUNDOACTION);
pBuf->setNeedsLexing(oldStyle);
} }
}
} }
_mainEditView.activateBuffer(mainID);
_pEditView = &_subEditView;
if (_mainWindowStatus & WindowSubActive) if (_mainWindowStatus & WindowSubActive)
{ {
for (int i = 0 ; i < _subDocTab.nbItem() ; i++) for (int i = 0 ; i < _subDocTab.nbItem() ; i++)
{ {
_mainEditView.activateBuffer(_mainDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i));
if (!_mainEditView.getCurrentBuffer()->isReadOnly()) { if (pBuf->isReadOnly())
_mainEditView.execute(SCI_BEGINUNDOACTION); continue;
bool oldStyle = pBuf->getNeedsLexing();
pBuf->setNeedsLexing(false);
_subEditView.activateBuffer(pBuf->getID());
_subEditView.execute(SCI_BEGINUNDOACTION);
nbTotal += _findReplaceDlg.processAll(ProcessReplaceAll, NULL, NULL, isEntireDoc, NULL); 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; _pEditView = pOldView;
char result[64]; char result[64];
@ -1270,8 +1279,8 @@ bool Notepad_plus::replaceAllFiles() {
{ {
itoa(nbTotal, result, 10); itoa(nbTotal, result, 10);
strcat(result, " tokens are replaced."); strcat(result, " tokens are replaced.");
} }
::MessageBox(_hSelf, result, "", MB_OK); ::MessageBox(_hSelf, result, "", MB_OK);
return true; return true;
@ -5677,8 +5686,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_dockingManager.init(_hInst, hwnd, &_pMainWindow); _dockingManager.init(_hInst, hwnd, &_pMainWindow);
//dynamicCheckMenuAndTB();
if (nppGUI._isMinimizedToTray) if (nppGUI._isMinimizedToTray)
_pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), ""); _pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), "");
@ -5691,7 +5698,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
nppData._scintillaSecondHandle = _subEditView.getHSelf(); nppData._scintillaSecondHandle = _subEditView.getHSelf();
_scintillaCtrls4Plugins.init(_hInst, hwnd); _scintillaCtrls4Plugins.init(_hInst, hwnd);
_pluginsManager.init(nppData); _pluginsManager.init(nppData);
_pluginsManager.loadPlugins(); _pluginsManager.loadPlugins();
const char *appDataNpp = pNppParam->getAppDataNppDir(); 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); ::DeleteMenu(_mainMenuHandle, IDM_UPDATE_NPP, MF_BYCOMMAND);
::DrawMenuBar(hwnd); ::DrawMenuBar(hwnd);
} }
//Languages Menu //Languages Menu
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE); 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()); csc.setName(purgeMenuItemString(menuName, true).c_str());
} }
} }
//Translate non-menu shortcuts //Translate non-menu shortcuts
changeShortcutLang(); 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 MainFileManager->increaseDocNr(); //so next doc starts at 2
::SetFocus(_mainEditView.getHSelf()); ::SetFocus(_mainEditView.getHSelf());
result = TRUE; result = TRUE;
} }
break; break;
@ -7553,7 +7556,8 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_mainEditView)); 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); int maxLine = _mainEditView.execute(SCI_GETLINECOUNT);
for (int j = 0 ; j < maxLine ; j++) for (int j = 0 ; j < maxLine ; j++)
{ {
@ -7590,8 +7594,10 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
} }
} }
_mainEditView.activateBuffer(mainBuf->getID()); //restore buffer //_mainEditView.activateBuffer(mainBuf->getID()); //restore buffer
_subEditView.activateBuffer(subBuf->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) bool Notepad_plus::fileLoadSession(const char *fn)
@ -8004,11 +8010,17 @@ void Notepad_plus::loadCommandlineParams(const char * commandLine, CmdLineParams
lastOpened = bufID; 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 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 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); _pEditView->execute(SCI_GOTOLINE, ln-1);
switchEditViewTo(iView); //restore view switchEditViewTo(iView); //restore view
} }

View File

@ -137,6 +137,7 @@ struct CmdLineParams {
int _line2go; int _line2go;
LangType _langType; LangType _langType;
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false), _line2go(-1), _langType(L_EXTERNAL){}
}; };
struct FloatingWindowInfo { struct FloatingWindowInfo {

View File

@ -356,7 +356,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
{ {
if (type == L_XML) if (type == L_XML)
{ {
execute(SCI_SETLEXER, SCLEX_HTML); execute(SCI_SETLEXER, SCLEX_XML);
for (int i = 0 ; i < 4 ; i++) for (int i = 0 ; i < 4 ; i++)
execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>("")); execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(""));
@ -364,7 +364,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
} }
else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP)) 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); const char *htmlKeyWords =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR);
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(htmlKeyWords?htmlKeyWords:"")); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(htmlKeyWords?htmlKeyWords:""));
@ -688,7 +688,6 @@ void ScintillaEditView::makeStyle(LangType language, const char **keywordArray)
void ScintillaEditView::defineDocType(LangType typeDoc) void ScintillaEditView::defineDocType(LangType typeDoc)
{ {
//setStyle(STYLE_DEFAULT, black, white, "Verdana", 0, 9); //setStyle(STYLE_DEFAULT, black, white, "Verdana", 0, 9);
StyleArray & stylers = _pParameter->getMiscStylerArray(); StyleArray & stylers = _pParameter->getMiscStylerArray();
int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT); int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT);
if (iStyleDefault != -1) if (iStyleDefault != -1)

View File

@ -33,6 +33,36 @@ void StaticDialog::goToCenter()
::SetWindowPos(_hSelf, HWND_TOP, x, y, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW); ::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) HGLOBAL StaticDialog::makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate)
{ {
// Get Dlg Template resource // Get Dlg Template resource

View File

@ -58,6 +58,8 @@ public :
void goToCenter(); void goToCenter();
void display(bool toShow = true) const;
POINT getLeftTopPoint(HWND hwnd/*, POINT & p*/) const { POINT getLeftTopPoint(HWND hwnd/*, POINT & p*/) const {
RECT rc; RECT rc;
::GetWindowRect(hwnd, &rc); ::GetWindowRect(hwnd, &rc);

View File

@ -69,28 +69,33 @@ bool isInList(const char *token2Find, ParamVector & params) {
return false; return false;
}; };
string getParamVal(char c, ParamVector & params) { bool getParamVal(char c, ParamVector & params, string & value) {
value = "";
int nrItems = params.size(); int nrItems = params.size();
for (int i = 0; i < nrItems; i++) for (int i = 0; i < nrItems; i++)
{ {
const char * token = params.at(i); const char * token = params.at(i);
if (token[0] == '-' && strlen(token) >= 2 && token[1] == c) { //dash, and enough chars 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); params.erase(params.begin() + i);
return retval; return true;
} }
} }
return string(""); return false;
} }
LangType getLangTypeFromParam(ParamVector & params) { 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()); return NppParameters::getLangIDFromStr(langStr.c_str());
}; };
int getLn2GoFromParam(ParamVector & params) { int getLn2GoFromParam(ParamVector & params) {
string lineNumStr = getParamVal('n', params); string lineNumStr;
if (!getParamVal('n', params, lineNumStr))
return -1;
return atoi(lineNumStr.c_str()); 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) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdShow)
{ {
bool TheFirstOne = true; bool TheFirstOne = true;
::SetLastError(NO_ERROR); ::SetLastError(NO_ERROR);
::CreateMutex(NULL, false, "nppInstance"); ::CreateMutex(NULL, false, "nppInstance");
if (::GetLastError() == ERROR_ALREADY_EXISTS) if (::GetLastError() == ERROR_ALREADY_EXISTS)
@ -124,7 +128,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh
cmdLineParams._line2go = getLn2GoFromParam(params); cmdLineParams._line2go = getLn2GoFromParam(params);
NppParameters *pNppParameters = NppParameters::getInstance(); NppParameters *pNppParameters = NppParameters::getInstance();
// override the settings if notepad style is present // override the settings if notepad style is present
if (pNppParameters->asNotepadStyle()) if (pNppParameters->asNotepadStyle())
{ {
@ -152,7 +155,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh
} }
quotFileName += "\""; quotFileName += "\"";
} }
if ((!isMultiInst) && (!TheFirstOne)) if ((!isMultiInst) && (!TheFirstOne))
{ {
HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL); HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL);
@ -232,7 +234,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh
Win32Exception::installHandler(); Win32Exception::installHandler();
try { try {
notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams); notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams);
bool unicodeSupported = notepad_plus_plus.getWinVersion() >= WV_NT; bool unicodeSupported = notepad_plus_plus.getWinVersion() >= WV_NT;
bool going = true; bool going = true;
while (going) while (going)

View File

@ -602,18 +602,10 @@
RelativePath="..\src\MISC\RegExt\regExtDlgRc.h" RelativePath="..\src\MISC\RegExt\regExtDlgRc.h"
> >
</File> </File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File <File
RelativePath="..\src\resource.h" RelativePath="..\src\resource.h"
> >
</File> </File>
<File
RelativePath="..\src\MISC\RegExt\resource.h"
>
</File>
<File <File
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h" RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
> >