From 2417d3af695671df9fe6b6142ec2160bdd7b1cac Mon Sep 17 00:00:00 2001 From: donho Date: Sat, 12 Jan 2008 23:19:47 +0000 Subject: [PATCH] [BUG_FIXED] 1. Fix the bug regarding the scroll bar for folding issue. 2. Fix the full screen (F11) bug regarding multi-display issue 3. including nppcm64.dll in installer for ths x64 OS. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@102 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/bin/change.log | 2 +- PowerEditor/installer/nppSetup.nsi | 18 ++++++--- PowerEditor/src/Notepad_plus.cpp | 39 ++++++++++++++++--- .../ScitillaComponent/ScintillaEditView.cpp | 19 ++++----- PowerEditor/src/resource.h | 6 +-- 5 files changed, 56 insertions(+), 28 deletions(-) diff --git a/PowerEditor/bin/change.log b/PowerEditor/bin/change.log index bb2ce6215..a65f48a89 100644 --- a/PowerEditor/bin/change.log +++ b/PowerEditor/bin/change.log @@ -1,4 +1,4 @@ -Notepad++ v4.7.3 fixed bugs and added features (from v4.6) : +Notepad++ v4.7.4 fixed bugs and added features (from v4.7.3) : 1. Make the "recovery system" for 3 mandatory xml files (config.xml, langs.xml and stylers.xml) to prevent the fail loading due to the corrupted files. 2. Extend plugin capacity - add the Scintilla external lexer capacity. diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index 6911178d8..34c4a9c37 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -17,16 +17,16 @@ ; Define the application name !define APPNAME "Notepad++" -!define APPNAMEANDVERSION "Notepad++ v4.7.3" +!define APPNAMEANDVERSION "Notepad++ v4.7.4" !define VERSION_MAJOR 4 -!define VERSION_MINOR 73 +!define VERSION_MINOR 74 ; Main Install settings Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\Notepad++" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "..\bin\npp.4.7.3.Installer.exe" +OutFile "..\bin\npp.4.7.4.Installer.exe" @@ -128,6 +128,7 @@ OutFile "..\bin\npp.4.7.3.Installer.exe" ; Modern interface settings !include "MUI.nsh" +!include "x64.nsh" !define MUI_ICON ".\images\npp_inst.ico" @@ -271,7 +272,7 @@ Section -"Notepad++" mainSection ; Set Section properties SetOverwrite on - + StrCpy $UPDATE_PATH $INSTDIR ;SetOutPath "$TEMP\" @@ -484,9 +485,14 @@ GLOBAL_INST: SectionEnd Section "Context Menu Entry" explorerContextMenu - SetOverwrite off + SetOverwrite on SetOutPath "$INSTDIR\" - File "..\bin\nppcm.dll" + ${If} ${RunningX64} + File /oname=$INSTDIR\nppcm.dll "..\bin\nppcm64.dll" + ${Else} + File "..\bin\nppcm.dll" + ${EndIf} + Exec 'regsvr32 /s "$INSTDIR\nppcm.dll"' Exec 'regsvr32 /u /s "$INSTDIR\nppshellext.dll"' Delete "$INSTDIR\nppshellext.dll" diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 53a855180..638e74ccc 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3076,9 +3076,13 @@ void Notepad_plus::command(int id) case IDM_VIEW_WRAP: { - _pEditView->wrap(!_pEditView->isWrap()); - _toolBar.setCheck(IDM_VIEW_WRAP, _pEditView->isWrap()); - checkMenuItem(IDM_VIEW_WRAP, _pEditView->isWrap()); + bool isWraped = !_pEditView->isWrap(); + _pEditView->wrap(isWraped); + _toolBar.setCheck(IDM_VIEW_WRAP, isWraped); + checkMenuItem(IDM_VIEW_WRAP, isWraped); + //if (!isWraped){ + // _pEditView->recalcHorizontalScrollbar(); + //} break; } case IDM_VIEW_WRAP_SYMBOL: @@ -7289,14 +7293,37 @@ LRESULT CALLBACK Notepad_plus::Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM void Notepad_plus::fullScreenToggle() { - HWND wTaskBar = FindWindow("Shell_TrayWnd", ""); + HMONITOR currentMonitor; //Handle to monitor where fullscreen should go + MONITORINFO mi; //Info of that monitor + RECT fullscreenArea; //RECT used to calculate window fullscrene size + _isfullScreen = !_isfullScreen; if (_isfullScreen) { _winPlace.length = sizeof(_winPlace); ::GetWindowPlacement(_hSelf, &_winPlace); - //Hide menu + //Preset view area, in case something fails, primary monitor values + fullscreenArea.top = 0; + fullscreenArea.left = 0; + fullscreenArea.right = GetSystemMetrics(SM_CXSCREEN); + fullscreenArea.bottom = GetSystemMetrics(SM_CYSCREEN); + + //Caution, this will not work on windows 95, so probably add some checking of some sorts like Unicode checks, IF 95 were to be supported + //if (_isMultimonitorSupported) { + currentMonitor = MonitorFromWindow(_hSelf, MONITOR_DEFAULTTONEAREST); //should always be valid monitor handle + mi.cbSize = sizeof(MONITORINFO); + if (GetMonitorInfo(currentMonitor, &mi) != FALSE) { + fullscreenArea = mi.rcMonitor; + fullscreenArea.right -= fullscreenArea.left; + fullscreenArea.bottom -= fullscreenArea.top; + } + // else { + //Error!, original RECT should serve as fallback + //} + //} + + //Hide menu ::SetMenu(_hSelf, NULL); //Hide window so windows can properly update it @@ -7313,7 +7340,7 @@ void Notepad_plus::fullScreenToggle() } //Set topmost window, show the window and redraw it - ::SetWindowPos(_hSelf, HWND_TOPMOST,0,0,GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),0); + ::SetWindowPos(_hSelf, HWND_TOPMOST, fullscreenArea.left, fullscreenArea.top, fullscreenArea.right, fullscreenArea.bottom, 0); ::ShowWindow(_hSelf, SW_SHOW); ::SendMessage(_hSelf, WM_SIZE, 0, 0); } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 3fa64ae38..8304223a7 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -998,6 +998,7 @@ void ScintillaEditView::collapse(int level2Collapse, bool mode) execute(SCI_TOGGLEFOLD, line); } } + recalcHorizontalScrollbar(); //Update scrollbar after folding } void ScintillaEditView::foldCurrentPos(bool mode) @@ -1018,6 +1019,8 @@ void ScintillaEditView::foldCurrentPos(bool mode) } if ((execute(SCI_GETFOLDEXPANDED, headerLine) != 0) != mode) execute(SCI_TOGGLEFOLD, headerLine); + + recalcHorizontalScrollbar(); //Update scrollbar after folding } void ScintillaEditView::foldAll(bool mode) @@ -1032,6 +1035,7 @@ void ScintillaEditView::foldAll(bool mode) if ((execute(SCI_GETFOLDEXPANDED, line) != 0) != mode) execute(SCI_TOGGLEFOLD, line); } + recalcHorizontalScrollbar(); //Update scrollbar after folding } // return the index to close then (argument) the index to activate @@ -1215,6 +1219,7 @@ void ScintillaEditView::expand(int &line, bool doExpand, bool force, int visLeve line++; } } + recalcHorizontalScrollbar(); //Update scrollbar after folding } void ScintillaEditView::makeStyle(const char *lexerName, const char **keywordArray) @@ -1294,7 +1299,6 @@ void ScintillaEditView::performGlobalStyles() execute(SCI_SETFOLDMARGINCOLOUR, true, foldMarginColor); execute(SCI_SETFOLDMARGINHICOLOUR, true, foldMarginHiColor); - //StyleArray & stylers = _pParameter->getMiscStylerArray(); COLORREF foldfgColor = white; COLORREF foldbgColor = grey; i = stylers.getStylerIndexByName("Fold"); @@ -1309,17 +1313,13 @@ void ScintillaEditView::performGlobalStyles() defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[_folderStyle][j], foldfgColor, foldbgColor); COLORREF wsSymbolFgColor = black; - //COLORREF wsSymbolBgColor = white; i = stylers.getStylerIndexByName("White space symbol"); if (i != -1) { Style & style = stylers.getStyler(i); wsSymbolFgColor = style._fgColor; - //wsSymbolBgColor = style._bgColor; } execute(SCI_SETWHITESPACEFORE, true, wsSymbolFgColor); - //execute(SCI_SETWHITESPACEBACK, true, wsSymbolBgColor); - } void ScintillaEditView::setLineIndent(int line, int indent) const { @@ -1606,10 +1606,6 @@ void ScintillaEditView::columnReplace(ColumnModeInfo & cmi, const char *str) } - - - - void ScintillaEditView::columnReplace(ColumnModeInfo & cmi, int initial, int incr, unsigned char format) { // 0000 00 00 : Dec BASE_10 @@ -1677,7 +1673,8 @@ void ScintillaEditView::columnReplace(const ColumnModeInfo & cmi, const char ch) } //This method recalculates the horizontal scrollbar based //on the current visible text and styler. -void ScintillaEditView::recalcHorizontalScrollbar() { +void ScintillaEditView::recalcHorizontalScrollbar() +{ int curOffset = execute(SCI_GETXOFFSET); int maxPixel = 0, curLen; int numLines = int(execute(SCI_GETLINECOUNT)); @@ -1708,6 +1705,4 @@ void ScintillaEditView::recalcHorizontalScrollbar() { int currentLength = execute(SCI_GETSCROLLWIDTH); //Get current scrollbar size if (currentLength != maxPixel) //And if it is not the same execute(SCI_SETSCROLLWIDTH, maxPixel); //update it - - //::ShowScrollBar(_hSelf, SB_HORZ, TRUE); //Force scrollbar visible to prevent 'twitchy' behaviour } \ No newline at end of file diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 8b678f295..f1f7af3bc 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -18,9 +18,9 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define NOTEPAD_PLUS_VERSION "Notepad++ v4.7.3" -#define VERSION_VALUE "4.73\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 -#define VERSION_DIGITALVALUE 4, 7, 3, 0 +#define NOTEPAD_PLUS_VERSION "Notepad++ v4.7.4" +#define VERSION_VALUE "4.74\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 +#define VERSION_DIGITALVALUE 4, 7, 4, 0 #ifndef IDC_STATIC #define IDC_STATIC -1