diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index 900dec04..1d0c8ecf 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -17,13 +17,16 @@ ; Define the application name !define APPNAME "Notepad++" -!define APPNAMEANDVERSION "Notepad++ v4.2.2" +!define APPNAMEANDVERSION "Notepad++ v4.3" + +!define VERSION_MAJOR 4 +!define VERSION_MINOR 3 ; Main Install settings Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\Notepad++" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "..\bin\npp.4.2.2.Installer.exe" +OutFile "..\bin\npp.4.3.Installer.exe" diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 423d7745..4130c76e 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -60,7 +60,7 @@ bool PluginsManager::loadPlugins(const char *dir) pi->_hLib = ::LoadLibrary(dllNames[i].c_str()); if (!pi->_hLib) - throw string("Load Library is failed"); + throw string("Load Library is failed.\nMake \"Runtime Library\" setting of this project as \"Multi-threaded(/MT)\" may cure this problem."); pi->_pFuncSetInfo = (PFUNCSETINFO)GetProcAddress(pi->_hLib, "setInfo"); diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index b88c89c4..2cdbab37 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -180,7 +180,7 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine) } RECT workAreaRect; - ::SystemParametersInfo(SPI_GETWORKAREA,0,&workAreaRect,0); + ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0); const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); @@ -1832,13 +1832,13 @@ BOOL Notepad_plus::notify(SCNotification *notification) { int lineClick = int(_pEditView->execute(SCI_LINEFROMPOSITION, notification->position)); - bookmarkToggle(lineClick); + if (!showLines(lineClick)) + bookmarkToggle(lineClick); } break; } - case SCN_CHARADDED: charAdded(static_cast(notification->ch)); break; @@ -2553,7 +2553,7 @@ void Notepad_plus::command(int id) if (lt == L_TXT) _pEditView->defineDocType(L_CPP); _pEditView->defineDocType(lt); - _pEditView->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); + _pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); break; } @@ -2693,11 +2693,6 @@ void Notepad_plus::command(int id) case IDM_EDIT_DUP_LINE: _pEditView->execute(SCI_LINEDUPLICATE); break; -/* - case IDM_EDIT_TRANSPOSE_LINE: - _pEditView->execute(SCI_LINETRANSPOSE); - break; -*/ case IDM_EDIT_SPLIT_LINES: _pEditView->execute(SCI_TARGETFROMSELECTION); @@ -3030,10 +3025,27 @@ void Notepad_plus::command(int id) case IDM_VIEW_WRAP_SYMBOL: { _pEditView->showWrapSymbol(!_pEditView->isWrapSymbolVisible()); - //_toolBar.setCheck(IDM_VIEW_WRAP, _pEditView->isWrap()); checkMenuItem(IDM_VIEW_WRAP_SYMBOL, _pEditView->isWrapSymbolVisible()); break; } + + case IDM_VIEW_HIDELINES: + { + CharacterRange range = _pEditView->getSelection(); + int startLine = _pEditView->execute(SCI_LINEFROMPOSITION, range.cpMin); + int endLine = _pEditView->execute(SCI_LINEFROMPOSITION, range.cpMax); + + if (startLine == 0) + startLine = 1; + if (endLine == _pEditView->getNbLine()) + endLine -= 1; + _pEditView->execute(SCI_HIDELINES, startLine, endLine); + _pEditView->execute(SCI_MARKERADD, startLine-1, MARK_HIDELINESBEGIN); + _pEditView->execute(SCI_MARKERADD, endLine+1, MARK_HIDELINESEND); + + break; + } + case IDM_VIEW_ZOOMIN: { _pEditView->execute(SCI_ZOOMIN); @@ -3906,8 +3918,6 @@ void Notepad_plus::checkModifiedDocument() const NppGUI & nppGUI = pNppParam->getNppGUI(); bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate); - - for (int j = 0 ; j < NB_VIEW ; j++) { for (int i = (pScintillaArray[j]->getNbDoc()-1) ; i >= 0 ; i--) @@ -3923,10 +3933,8 @@ void Notepad_plus::checkModifiedDocument() if (::IsIconic(_hSelf)) ::ShowWindow(_hSelf, SW_SHOWNORMAL); - //int caretPos = int(_pEditView->execute(SCI_GETCURRENTPOS)); if (update || doReloadOrNot(docBuf.getFileName()) == IDYES) { - pDocTabArray[j]->activate(i); // if it's a non current view, make it as the current view if (j == 1) @@ -4353,9 +4361,9 @@ void Notepad_plus::bookmarkNext(bool forwardScan) lineRetry = int(_pEditView->execute(SCI_GETLINECOUNT)); //If not found, try from the end sci_marker = SCI_MARKERPREVIOUS; } - int nextLine = int(_pEditView->execute(sci_marker, lineStart, 1 << MARK_SYMBOLE)); + int nextLine = int(_pEditView->execute(sci_marker, lineStart, 1 << MARK_BOOKMARK)); if (nextLine < 0) - nextLine = int(_pEditView->execute(sci_marker, lineRetry, 1 << MARK_SYMBOLE)); + nextLine = int(_pEditView->execute(sci_marker, lineRetry, 1 << MARK_BOOKMARK)); if (nextLine < 0) return; @@ -5419,17 +5427,31 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa } case WM_CREATE: { + char * ac_xpm[] = { + "14 14 4 1", //0 + " c #FFFFFF", //1 + ". c #000000", //2 + "+ c #A400B7", //3 + "@ c #DE25F4", //4 + " .. ", + " .+. ", + " .@+. ", + " .@@+. ", + ".......@@@+. ", + ".+@@@@@@@@@+. ", + ".+@@@@@@@@@@+.", + ".+@@@@@@@@@@+.", + ".++++++@@@@+. ", + ".......@@@+. ", + " .@@+. ", + " .@+. ", + " .+. ", + " .. "}; + + pNppParam->setFontList(hwnd); NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); -/* - OSVERSIONINFO vInfo; - vInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - ::GetVersionEx(&vInfo); - if (vInfo.dwMajorVersion == 4) - nppGUI._doTaskList = false; - else if ((vInfo.dwMajorVersion == 5) && (vInfo.dwMinorVersion == 0)) - nppGUI._doTaskList = false; -*/ + // Menu string pluginsTrans, windowTrans; changeMenuLang(pluginsTrans, windowTrans); @@ -5456,6 +5478,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _mainEditView.display(); + _mainEditView.execute(SCI_MARKERDEFINEPIXMAP, MARK_HIDELINESEND, (LPARAM)ac_xpm); + _subEditView.execute(SCI_MARKERDEFINEPIXMAP, MARK_HIDELINESEND, (LPARAM)ac_xpm); + _invisibleEditView.init(_hInst, hwnd); _invisibleEditView.execute(SCI_SETUNDOCOLLECTION); _invisibleEditView.execute(SCI_EMPTYUNDOBUFFER); @@ -7125,7 +7150,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) int maxLine = _mainEditView.execute(SCI_GETLINECOUNT); for (int j = 0 ; j < maxLine ; j++) { - if ((_mainEditView.execute(SCI_MARKERGET, j)&(1 << MARK_SYMBOLE)) != 0) + if ((_mainEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0) { sfi.marks.push_back(j); } @@ -7148,7 +7173,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) int maxLine = _subEditView.execute(SCI_GETLINECOUNT); for (int j = 0 ; j < maxLine ; j++) { - if ((_subEditView.execute(SCI_MARKERGET, j)&(1 << MARK_SYMBOLE)) != 0) + if ((_subEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0) { sfi.marks.push_back(j); } diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index f046b533..4203b439 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -739,19 +739,19 @@ private: if (lineno == -1) lineno = _pEditView->getCurrentLineNumber(); if (!bookmarkPresent(lineno)) - _pEditView->execute(SCI_MARKERADD, lineno, MARK_SYMBOLE); + _pEditView->execute(SCI_MARKERADD, lineno, MARK_BOOKMARK); }; void bookmarkDelete(int lineno) const { if (lineno == -1) lineno = _pEditView->getCurrentLineNumber(); if ( bookmarkPresent(lineno)) - _pEditView->execute(SCI_MARKERDELETE, lineno, MARK_SYMBOLE); + _pEditView->execute(SCI_MARKERDELETE, lineno, MARK_BOOKMARK); }; bool bookmarkPresent(int lineno) const { if (lineno == -1) lineno = _pEditView->getCurrentLineNumber(); LRESULT state = _pEditView->execute(SCI_MARKERGET, lineno); - return ((state & (1 << MARK_SYMBOLE)) != 0); + return ((state & (1 << MARK_BOOKMARK)) != 0); }; void bookmarkToggle(int lineno) const { if (lineno == -1) @@ -764,7 +764,59 @@ private: }; void bookmarkNext(bool forwardScan); void bookmarkClearAll() const { - _pEditView->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); + _pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); + }; + + int hideLinesMarkPresent(int lineno) const { + LRESULT state = _pEditView->execute(SCI_MARKERGET, lineno); + if ((state & (1 << MARK_HIDELINESBEGIN)) != 0) + return MARK_HIDELINESBEGIN; + else if ((state & (1 << MARK_HIDELINESEND)) != 0) + return MARK_HIDELINESEND; + return 0; + }; + + void hideLinesMarkDelete(int lineno, int which) const { + _pEditView->execute(SCI_MARKERDELETE, lineno, which); + }; + + bool showLines(int lineno) const { + if (lineno == -1) + lineno = _pEditView->getCurrentLineNumber(); + int hideLinesMark = hideLinesMarkPresent(lineno); + if (!hideLinesMark) + return false; + + // + int start = 0; + int end = 0; + if (hideLinesMark == MARK_HIDELINESEND) + { + end = lineno; + int i = lineno - 1; + for ( ; i >= 0 ; i--) + { + if (_pEditView->execute(SCI_GETLINEVISIBLE, i)) + break; + } + start = i; + } + else if (hideLinesMark == MARK_HIDELINESBEGIN) + { + long nbLine = _pEditView->getNbLine(); + start = lineno; + int i = lineno + 1; + for ( ; i < nbLine ; i++) + { + if (_pEditView->execute(SCI_GETLINEVISIBLE, i)) + break; + } + end = i; + } + _pEditView->execute(SCI_SHOWLINES, start+1, end-1); + hideLinesMarkDelete(start, MARK_HIDELINESBEGIN); + hideLinesMarkDelete(end, MARK_HIDELINESEND); + return true; }; void findMatchingBracePos(int & braceAtCaret, int & braceOpposite); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 2adbbfae..6aead9a4 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -375,6 +375,7 @@ BEGIN MENUITEM "8\tAlt+Shift+8", IDM_VIEW_UNFOLD_8 END MENUITEM "Unfold all\tAlt+Shift+0", IDM_VIEW_TOGGLE_UNFOLDALL + MENUITEM "Hide lines", IDM_VIEW_HIDELINES MENUITEM SEPARATOR MENUITEM "Go to another view", IDM_VIEW_GOTO_ANOTHER_VIEW MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index b42efeac..036f47cc 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -232,7 +232,7 @@ bool Finder::notify(SCNotification *notification) // now we clean the previous mark if (markedLine != -1) - (*_ppEditView)->execute(SCI_MARKERDELETE, markedLine, MARK_SYMBOLE); + (*_ppEditView)->execute(SCI_MARKERDELETE, markedLine, MARK_BOOKMARK); // After cleaning the previous mark, we can swich to another document @@ -244,7 +244,7 @@ bool Finder::notify(SCNotification *notification) // we set the current mark here int nb = (*_ppEditView)->getCurrentLineNumber(); setCurrentMarkedLine(nb); - (*_ppEditView)->execute(SCI_MARKERADD, nb, MARK_SYMBOLE); + (*_ppEditView)->execute(SCI_MARKERADD, nb, MARK_BOOKMARK); // Then we colourise the double clicked line setFinderStyle(); @@ -487,7 +487,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP if (lt == L_TXT) (*_ppEditView)->defineDocType(L_CPP); (*_ppEditView)->defineDocType(lt); - (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); + (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); } } return TRUE; @@ -932,7 +932,7 @@ int FindReplaceDlg::processAll(int op, bool isEntire, const char *fileName, cons } if ((_doMarkLine) && (_doPurge)) { - (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_SYMBOLE); + (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); } } @@ -994,8 +994,8 @@ int FindReplaceDlg::processAll(int op, bool isEntire, const char *fileName, cons int lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, posFind); int state = (*_ppEditView)->execute(SCI_MARKERGET, lineNumber); - if (!(state & (1 << MARK_SYMBOLE))) - (*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_SYMBOLE); + if (!(state & (1 << MARK_BOOKMARK))) + (*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK); } startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen; } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 324c3043..65771293 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -47,11 +47,11 @@ FOLDERMIDTAIL | SC_MARK_EMPTY SC_MARK_EMPTY SC_MARK_TCORNERCURVE */ const int ScintillaEditView::_markersArray[][NB_FOLDER_STATE] = { - {SC_MARKNUM_FOLDEROPEN, SC_MARKNUM_FOLDER, SC_MARKNUM_FOLDERSUB, SC_MARKNUM_FOLDERTAIL, SC_MARKNUM_FOLDEREND, SC_MARKNUM_FOLDEROPENMID, SC_MARKNUM_FOLDERMIDTAIL}, - {SC_MARK_MINUS, SC_MARK_PLUS, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY}, - {SC_MARK_ARROWDOWN, SC_MARK_ARROW, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY}, - {SC_MARK_CIRCLEMINUS, SC_MARK_CIRCLEPLUS, SC_MARK_VLINE, SC_MARK_LCORNERCURVE, SC_MARK_CIRCLEPLUSCONNECTED, SC_MARK_CIRCLEMINUSCONNECTED, SC_MARK_TCORNERCURVE}, - {SC_MARK_BOXMINUS, SC_MARK_BOXPLUS, SC_MARK_VLINE, SC_MARK_LCORNER, SC_MARK_BOXPLUSCONNECTED, SC_MARK_BOXMINUSCONNECTED, SC_MARK_TCORNER} + {SC_MARKNUM_FOLDEROPEN, SC_MARKNUM_FOLDER, SC_MARKNUM_FOLDERSUB, SC_MARKNUM_FOLDERTAIL, SC_MARKNUM_FOLDEREND, SC_MARKNUM_FOLDEROPENMID, SC_MARKNUM_FOLDERMIDTAIL}, + {SC_MARK_MINUS, SC_MARK_PLUS, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY}, + {SC_MARK_ARROWDOWN, SC_MARK_ARROW, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY}, + {SC_MARK_CIRCLEMINUS, SC_MARK_CIRCLEPLUS,SC_MARK_VLINE, SC_MARK_LCORNERCURVE, SC_MARK_CIRCLEPLUSCONNECTED, SC_MARK_CIRCLEMINUSCONNECTED, SC_MARK_TCORNERCURVE}, + {SC_MARK_BOXMINUS, SC_MARK_BOXPLUS, SC_MARK_VLINE, SC_MARK_LCORNER, SC_MARK_BOXPLUSCONNECTED, SC_MARK_BOXMINUSCONNECTED, SC_MARK_TCORNER} }; //const int MASK_RED = 0xFF0000; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index ad2e33fb..3a7b4fc1 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -393,6 +393,11 @@ public: return long(execute(SCI_LINEFROMPOSITION, execute(SCI_GETCURRENTPOS))); }; + long getNbLine() const { + int endPos = execute(SCI_GETLENGTH); + return execute(SCI_LINEFROMPOSITION, endPos); + }; + long getCurrentXOffset()const{ return long(execute(SCI_GETXOFFSET)); }; diff --git a/PowerEditor/src/constant.h b/PowerEditor/src/constant.h index 5a8c11ec..68cc4297 100644 --- a/PowerEditor/src/constant.h +++ b/PowerEditor/src/constant.h @@ -1,6 +1,8 @@ #ifndef CONSTANT_H #define CONSTANT_H -const int MARK_SYMBOLE = 1; +const int MARK_BOOKMARK = 1; +const int MARK_HIDELINESBEGIN = 2; +const int MARK_HIDELINESEND = 3; #endif //CONSTANT_H diff --git a/PowerEditor/src/contextMenu.xml b/PowerEditor/src/contextMenu.xml index 2d42b4b6..25a09a63 100644 --- a/PowerEditor/src/contextMenu.xml +++ b/PowerEditor/src/contextMenu.xml @@ -13,5 +13,7 @@ + + \ No newline at end of file diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 7b629b77..5ac7b687 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -140,6 +140,7 @@ #define IDM_VIEW_DRAWTABBAR_DBCLK2CLOSE (IDM_VIEW + 39) #define IDM_VIEW_REFRESHTABAR (IDM_VIEW + 40) #define IDM_VIEW_WRAP_SYMBOL (IDM_VIEW + 41) + #define IDM_VIEW_HIDELINES (IDM_VIEW + 42) #define IDM_VIEW_FOLD (IDM_VIEW + 50) #define IDM_VIEW_FOLD_1 (IDM_VIEW_FOLD + 1) @@ -161,6 +162,7 @@ #define IDM_VIEW_UNFOLD_7 (IDM_VIEW_UNFOLD + 7) #define IDM_VIEW_UNFOLD_8 (IDM_VIEW_UNFOLD + 8) + #define IDM_VIEW_GOTO_ANOTHER_VIEW 10001 #define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002 diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 58ea56e5..b067ec4b 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -4094,12 +4094,11 @@ void Editor::LineTranspose() { int len1 = endPrev - startPrev; char *line2 = CopyRange(start, end); int len2 = end - start; - if (pdoc->DeleteChars(start, len2)) { - pdoc->DeleteChars(startPrev, len1); - pdoc->InsertString(startPrev, line2, len2); - pdoc->InsertString(start - len1 + len2, line1, len1); - MovePositionTo(start - len1 + len2); - } + pdoc->DeleteChars(start, len2); + pdoc->DeleteChars(startPrev, len1); + pdoc->InsertString(startPrev, line2, len2); + pdoc->InsertString(start - len1 + len2, line1, len1); + MovePositionTo(start - len1 + len2); delete []line1; delete []line2; pdoc->EndUndoAction();