[BUG_FIXED] Fix modif marker margin bug : the previous document is marked while open a file.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@430 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2009-02-21 14:13:52 +00:00
parent d16e9beb15
commit 342f226fa7
3 changed files with 20 additions and 15 deletions

View File

@ -72,7 +72,7 @@ Notepad_plus::Notepad_plus(): Window(), _mainWindowStatus(0), _pDocTab(NULL), _p
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _isRTL(false), _recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _isRTL(false),
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _sysMenuEntering(false), _linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _sysMenuEntering(false),
_autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg), _autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg),
_nativeLangEncoding(CP_ACP), _isNppReady(false) _nativeLangEncoding(CP_ACP), _isFileOpening(false)
{ {
ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange)); ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange));
@ -317,9 +317,6 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
scnN.nmhdr.hwndFrom = _hSelf; scnN.nmhdr.hwndFrom = _hSelf;
scnN.nmhdr.idFrom = 0; scnN.nmhdr.idFrom = 0;
_pluginsManager.notify(&scnN); _pluginsManager.notify(&scnN);
_isNppReady = true;
} }
@ -680,7 +677,8 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
if (::MessageBox(_hSelf, str2display, TEXT("Create new file"), MB_YESNO) == IDYES) if (::MessageBox(_hSelf, str2display, TEXT("Create new file"), MB_YESNO) == IDYES)
{ {
bool res = MainFileManager->createEmptyFile(longFileName); bool res = MainFileManager->createEmptyFile(longFileName);
if (!res) { if (!res)
{
wsprintf(str2display, TEXT("Cannot create the file \"%s\""), longFileName); wsprintf(str2display, TEXT("Cannot create the file \"%s\""), longFileName);
::MessageBox(_hSelf, str2display, TEXT("Create new file"), MB_OK); ::MessageBox(_hSelf, str2display, TEXT("Create new file"), MB_OK);
return BUFFER_INVALID; return BUFFER_INVALID;
@ -697,6 +695,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
} }
} }
_isFileOpening = true;
BufferID buffer = MainFileManager->loadFile(longFileName); BufferID buffer = MainFileManager->loadFile(longFileName);
if (buffer != BUFFER_INVALID) if (buffer != BUFFER_INVALID)
@ -713,6 +712,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
scnN.nmhdr.idFrom = (uptr_t)buffer; scnN.nmhdr.idFrom = (uptr_t)buffer;
_pluginsManager.notify(&scnN); _pluginsManager.notify(&scnN);
loadBufferIntoView(buffer, currentView()); loadBufferIntoView(buffer, currentView());
if (_pTrayIco) if (_pTrayIco)
@ -728,6 +728,8 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
_linkTriggered = true; _linkTriggered = true;
_isDocModifing = false; _isDocModifing = false;
_isFileOpening = false;
// Notify plugins that current file is just opened // Notify plugins that current file is just opened
scnN.nmhdr.code = NPPN_FILEOPENED; scnN.nmhdr.code = NPPN_FILEOPENED;
_pluginsManager.notify(&scnN); _pluginsManager.notify(&scnN);
@ -742,9 +744,12 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
lstrcat(msg, longFileName); lstrcat(msg, longFileName);
lstrcat(msg, TEXT("\".")); lstrcat(msg, TEXT("\"."));
::MessageBox(_hSelf, msg, TEXT("ERR"), MB_OK); ::MessageBox(_hSelf, msg, TEXT("ERR"), MB_OK);
_isFileOpening = false;
return BUFFER_INVALID; return BUFFER_INVALID;
} }
} }
bool Notepad_plus::doReload(BufferID id, bool alert) bool Notepad_plus::doReload(BufferID id, bool alert)
{ {
@ -1266,10 +1271,6 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
//first check amount of documents, we dont want the view to hide if we closed a secondary doc with primary being empty //first check amount of documents, we dont want the view to hide if we closed a secondary doc with primary being empty
//int nrDocs = _pDocTab->nbItem(); //int nrDocs = _pDocTab->nbItem();
doClose(bufferID, viewToClose); doClose(bufferID, viewToClose);
//if (nrDocs == 1 && canHideView(currentView())) { //close the view if both visible
// hideView(viewToClose);
//}
return true; return true;
} }
@ -2044,7 +2045,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
prevWasEdit = false; prevWasEdit = false;
} }
if (_isNppReady) if (!_isFileOpening)
{ {
bool isProcessed = false; bool isProcessed = false;

View File

@ -333,7 +333,7 @@ private:
bool _isRTL; bool _isRTL;
winVer _winVersion; winVer _winVersion;
bool _isNppReady; bool _isFileOpening;
class ScintillaCtrls { class ScintillaCtrls {
public : public :

View File

@ -1707,15 +1707,19 @@ BOOL CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
} }
void FindIncrementDlg::destroy() { void FindIncrementDlg::destroy()
if (_pRebar) { {
if (_pRebar)
{
_pRebar->removeBand(_rbBand.wID); _pRebar->removeBand(_rbBand.wID);
_pRebar = NULL; _pRebar = NULL;
} }
} }
void FindIncrementDlg::display(bool toShow) const { void FindIncrementDlg::display(bool toShow) const
if (!_pRebar) { {
if (!_pRebar)
{
Window::display(toShow); Window::display(toShow);
return; return;
} }