[ENHANCEMENT] Speed up the loading time for the large file.

[NEW] Doc Map: wrapping (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@875 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-03-07 02:17:16 +00:00
parent da8fdbb86a
commit f3fbd97687
7 changed files with 46 additions and 17 deletions

View File

@ -1468,7 +1468,7 @@ void Notepad_plus::enableCommand(int cmdID, bool doEnable, int which) const
void Notepad_plus::checkClipboard() void Notepad_plus::checkClipboard()
{ {
bool hasSelection = (_pEditView->execute(SCI_GETSELECTIONSTART) != _pEditView->execute(SCI_GETSELECTIONEND)) || (_pEditView->execute(SCI_GETSELECTIONS) > 0); bool hasSelection = (_pEditView->execute(SCI_GETSELECTIONSTART) != _pEditView->execute(SCI_GETSELECTIONEND));
bool canPaste = (_pEditView->execute(SCI_CANPASTE) != 0); bool canPaste = (_pEditView->execute(SCI_CANPASTE) != 0);
enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR);
enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR);

View File

@ -435,7 +435,9 @@ BEGIN
MENUITEM "Project Panel 2", IDM_VIEW_PROJECT_PANEL_2 MENUITEM "Project Panel 2", IDM_VIEW_PROJECT_PANEL_2
MENUITEM "Project Panel 3", IDM_VIEW_PROJECT_PANEL_3 MENUITEM "Project Panel 3", IDM_VIEW_PROJECT_PANEL_3
END END
#ifdef UNICODE
MENUITEM "Document Map", IDM_VIEW_DOC_MAP MENUITEM "Document Map", IDM_VIEW_DOC_MAP
#endif
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV
MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH

View File

@ -1259,11 +1259,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case WM_NOTIFY: case WM_NOTIFY:
{ {
checkClipboard(); SCNotification *notification = reinterpret_cast<SCNotification *>(lParam);
checkUndoState();
checkMacroState(); if (notification->nmhdr.code == SCN_UPDATEUI)
_pluginsManager.notify(reinterpret_cast<SCNotification *>(lParam)); {
return notify(reinterpret_cast<SCNotification *>(lParam)); checkClipboard(); //6
checkUndoState(); //4
}
_pluginsManager.notify(notification);
return notify(notification);
} }
case NPPM_INTERNAL_CHECKDOCSTATUS : case NPPM_INTERNAL_CHECKDOCSTATUS :

View File

@ -1148,16 +1148,18 @@ void Notepad_plus::command(int id)
case IDM_VIEW_WRAP: case IDM_VIEW_WRAP:
{ {
//if (_pDocMap && !_pDocMap->isVisible()) bool isWraped = !_pEditView->isWrap();
{ _mainEditView.wrap(isWraped);
bool isWraped = !_pEditView->isWrap(); _subEditView.wrap(isWraped);
_mainEditView.wrap(isWraped); _toolBar.setCheck(IDM_VIEW_WRAP, isWraped);
_subEditView.wrap(isWraped); checkMenuItem(IDM_VIEW_WRAP, isWraped);
_toolBar.setCheck(IDM_VIEW_WRAP, isWraped);
checkMenuItem(IDM_VIEW_WRAP, isWraped);
ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP(); ScintillaViewParams & svp1 = (ScintillaViewParams &)(NppParameters::getInstance())->getSVP();
svp1._doWrap = isWraped; svp1._doWrap = isWraped;
if (_pDocMap)
{
_pDocMap->wrapActionDone();
} }
break; break;
} }

View File

@ -442,7 +442,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (_pDocMap) if (_pDocMap)
{ {
_pDocMap->scrollMap(); _pDocMap->guiUpdate();
} }
break; break;
} }

View File

@ -39,7 +39,8 @@ void DocumentMap::reloadMap()
_pScintillaEditView->syncFoldStateWith((*_ppEditView)->getCurrentFoldStates()); _pScintillaEditView->syncFoldStateWith((*_ppEditView)->getCurrentFoldStates());
// Wrapping // Wrapping
//wrapMap(); initWrapMap();
wrapMap();
scrollMap(); scrollMap();
@ -58,6 +59,17 @@ void DocumentMap::initWrapMap()
} }
} }
void DocumentMap::guiUpdate()
{
if (_wrapUnwrapTriggered)
{
initWrapMap();
wrapMap();
}
scrollMap();
_wrapUnwrapTriggered = false;
}
void DocumentMap::wrapMap() void DocumentMap::wrapMap()
{ {
RECT rect; RECT rect;

View File

@ -115,6 +115,12 @@ public:
return _isMainEditorWrap; return _isMainEditorWrap;
}; };
void wrapActionDone() {
_wrapUnwrapTriggered = true;
};
void guiUpdate();
protected: protected:
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
@ -124,6 +130,7 @@ private:
//HWND _glassHandle; //HWND _glassHandle;
ViewZoneDlg _vzDlg; ViewZoneDlg _vzDlg;
bool _isMainEditorWrap; bool _isMainEditorWrap;
bool _wrapUnwrapTriggered;
}; };