Skip to content

Commit dcd1986

Browse files
authored
Merge branch 'notepad-plus-plus:master' into master
2 parents 7623208 + 50a163d commit dcd1986

19 files changed

Lines changed: 111 additions & 44 deletions

PowerEditor/installer/nativeLang/english.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ Translation note:
296296
<Item id="44024" name="Zoom &amp;Out (Ctrl+Mouse Wheel Down)"/>
297297
<Item id="44025" name="Show Space and Tab"/>
298298
<Item id="44026" name="Show End of Line"/>
299+
<Item id="44027" name="&amp;Synchronize Across Views"/>
299300
<Item id="44029" name="Unfold All"/>
300301
<Item id="44030" name="Fold Current Level"/>
301302
<Item id="44031" name="Unfold Current Level"/>

PowerEditor/installer/nativeLang/english_customizable.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ Translation note:
296296
<Item id="44024" name="Zoom &amp;Out (Ctrl+Mouse Wheel Down)"/>
297297
<Item id="44025" name="Show Space and Tab"/>
298298
<Item id="44026" name="Show End of Line"/>
299+
<Item id="44027" name="&amp;Synchronize Across Views"/>
299300
<Item id="44029" name="Unfold All"/>
300301
<Item id="44030" name="Fold Current Level"/>
301302
<Item id="44031" name="Unfold Current Level"/>

PowerEditor/installer/nativeLang/french.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Translation note:
55
2. All the comments are for explanation, they are not for translation.
66
-->
77
<NotepadPlus>
8-
<Native-Langue name="Français" filename="french.xml" version="8.9">
8+
<Native-Langue name="Français" filename="french.xml" version="8.9.3">
99
<Menu>
1010
<Main>
1111
<!-- Main Menu Entries -->
@@ -288,6 +288,7 @@ Translation note:
288288
<Item id="44024" name="Zoom a&amp;rrière (Ctrl+Molette vers le bas)"/>
289289
<Item id="44025" name="Afficher les blancs et les tabulations"/>
290290
<Item id="44026" name="Afficher les symboles de fin de ligne"/>
291+
<Item id="44027" name="Synchroniser entre les vues"/>
291292
<Item id="44029" name="Déplier tous les blocs"/>
292293
<Item id="44030" name="Replier le bloc de la ligne actuelle"/>
293294
<Item id="44031" name="Déplier le bloc de la ligne actuelle"/>

PowerEditor/installer/nativeLang/hebrew.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@
140140
<Item id="44025" name="הצג מרווחים וטאבים"/>
141141
<Item id="44026" name="הצג סוף שורה"/>
142142
<Item id="44019" name="הצג את כל הסימנים המוסתרים"/>
143-
<Item id="44027" name="שורת קצה אנכית"/>
144-
<Item id="44028" name="שורת קצה מצב רקע"/>
145143
<Item id="44020" name="הצג קווי עימוד"/>
146144
<Item id="44022" name="עטיפת מילים"/>
147145
<Item id="44023" name="התמקדות &amp;פנימה"/>

PowerEditor/installer/nativeLang/taiwaneseMandarin.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<NotepadPlus>
3-
<Native-Langue name="台灣繁體" filename="taiwaneseMandarin.xml" version="8.9">
3+
<Native-Langue name="台灣繁體" filename="taiwaneseMandarin.xml" version="8.9.3">
44
<Menu>
55
<Main>
66
<!-- Main Menu Entries -->
@@ -265,6 +265,7 @@
265265
<Item id="44024" name="縮小(&amp;O; Ctrl+滑鼠滾輪向下)"/>
266266
<Item id="44025" name="顯示空白及 TAB"/>
267267
<Item id="44026" name="顯示行尾"/>
268+
<Item id="44027" name="雙檢視同步"/>
268269
<Item id="44029" name="全部展開"/>
269270
<Item id="44030" name="收摺此層"/>
270271
<Item id="44031" name="展開此層"/>

PowerEditor/installer/nppSetup.nsi

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
!include "nsDialogs.nsh" ; allows creation of custom pages in the installer
2222
!include "Memento.nsh" ; remember user selections in the installer across runs
2323
!include "FileFunc.nsh"
24+
!include "WinVer.nsh"
2425

2526
Unicode true ; Generate a Unicode installer. It can only be used outside of sections and functions and before any data is compressed.
2627
SetCompressor /SOLID lzma ; This reduces installer size by approx 30~35%
@@ -373,13 +374,14 @@ ${MementoSection} "Context Menu Entry" explorerContextMenu
373374

374375
; Register MSIX for Windows 11 modern context menu
375376
; Skip only for x86 Notepad++ installation on Windows 32 system
376-
!ifdef ARCH64
377+
!ifdef ARCH64 ; x64 installer
377378
Call RegisterMSIX
378-
!else ifdef ARCHARM64
379+
!else ifdef ARCHARM64 ; arm64 installer
379380
Call RegisterMSIX
380-
!else
381-
${If} ${RunningX64}
381+
!else ; 32 bits installer
382+
${If} ${RunningX64} ; running in Windows 64 bits
382383
Call RegisterMSIX
384+
SetRegView 32
383385
${EndIf}
384386
!endif
385387

@@ -389,17 +391,20 @@ ${MementoSectionDone}
389391

390392
; Helper function for registering MSIX (Include the ExternalLocation flag for Sparse Packages)
391393
Function RegisterMSIX
392-
nsExec::ExecToLog 'powershell -Command "Add-AppxPackage -Path \"$INSTDIR\contextMenu\NppShell.msix\" -ExternalLocation \"$INSTDIR\contextMenu\""'
394+
; Windows 11 (build 22000+) is required for modern context menu via MSIX
395+
${If} ${AtLeastWin11}
396+
nsExec::ExecToLog 'powershell -Command "Add-AppxPackage -Path \"$INSTDIR\contextMenu\NppShell.msix\" -ExternalLocation \"$INSTDIR\contextMenu\""'
393397

394-
; Wait 2 seconds for the AppX service to finish indexing the new identity
395-
Sleep 2000
396-
397-
; Notify the Shell (Association Change + Interrupt)
398-
System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, p 0, p 0)'
399-
System::Call 'shell32::SHChangeNotify(i 0x00008000, i 0, p 0, p 0)'
398+
; Wait 2 seconds for the AppX service to finish indexing the new identity
399+
Sleep 2000
400+
401+
; Notify the Shell (Association Change + Interrupt)
402+
System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, p 0, p 0)'
403+
System::Call 'shell32::SHChangeNotify(i 0x00008000, i 0, p 0, p 0)'
400404

401-
; Broadcast the change
402-
SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:ShellState" /TIMEOUT=2000
405+
; Broadcast the change
406+
SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:ShellState" /TIMEOUT=2000
407+
${EndIf}
403408
FunctionEnd
404409

405410

PowerEditor/src/Notepad_plus.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
348348

349349
_zoomOriginalValue = _pEditView->execute(SCI_GETZOOM);
350350
_mainEditView.execute(SCI_SETZOOM, svp._zoom);
351-
_subEditView.execute(SCI_SETZOOM, svp._zoom2);
351+
_subEditView.execute(SCI_SETZOOM, svp._zoomSync ? svp._zoom : svp._zoom2);
352352

353353
::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELECTION, 0, 0);
354354

@@ -2685,8 +2685,13 @@ void Notepad_plus::checkSyncState()
26852685
_toolBar.setCheck(IDM_VIEW_SYNSCROLLV, false);
26862686
_toolBar.setCheck(IDM_VIEW_SYNSCROLLH, false);
26872687
}
2688+
else
2689+
{
2690+
syncZoom();
2691+
}
26882692
enableCommand(IDM_VIEW_SYNSCROLLV, canDoSync, MENU | TOOLBAR);
26892693
enableCommand(IDM_VIEW_SYNSCROLLH, canDoSync, MENU | TOOLBAR);
2694+
enableCommand(IDM_VIEW_ZOOM_SYNC, canDoSync, MENU);
26902695
}
26912696

26922697
void Notepad_plus::setupColorSampleBitmapsOnMainMenuItems()
@@ -5184,6 +5189,9 @@ void Notepad_plus::staticCheckMenuAndTB() const
51845189
checkMenuItem(IDM_VIEW_WRAP, b);
51855190
_toolBar.setCheck(IDM_VIEW_WRAP, b);
51865191
checkMenuItem(IDM_VIEW_WRAP_SYMBOL, _pEditView->isWrapSymbolVisible());
5192+
5193+
// Zoom sync
5194+
checkMenuItem(IDM_VIEW_ZOOM_SYNC, NppParameters::getInstance().getSVP()._zoomSync);
51875195
}
51885196

51895197

@@ -5732,7 +5740,21 @@ void Notepad_plus::saveScintillasZoom()
57325740
NppParameters& nppParam = NppParameters::getInstance();
57335741
ScintillaViewParams & svp = (ScintillaViewParams &)nppParam.getSVP();
57345742
svp._zoom = _mainEditView.execute(SCI_GETZOOM);
5735-
svp._zoom2 = _subEditView.execute(SCI_GETZOOM);
5743+
svp._zoom2 = svp._zoomSync ? svp._zoom : _subEditView.execute(SCI_GETZOOM);
5744+
}
5745+
5746+
void Notepad_plus::syncZoom()
5747+
{
5748+
const NppParameters& nppParam = NppParameters::getInstance();
5749+
const ScintillaViewParams& svp = nppParam.getSVP();
5750+
if (!svp._zoomSync) return;
5751+
if (!viewVisible(MAIN_VIEW) || !viewVisible(SUB_VIEW)) return;
5752+
5753+
_isSyncingZoom = true;
5754+
intptr_t zoom = _pEditView->execute(SCI_GETZOOM);
5755+
ScintillaEditView* otherView = (_pEditView == &_mainEditView) ? &_subEditView : &_mainEditView;
5756+
otherView->execute(SCI_SETZOOM, zoom);
5757+
_isSyncingZoom = false;
57365758
}
57375759

57385760
bool Notepad_plus::addCurrentMacro()

PowerEditor/src/Notepad_plus.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ friend class FileManager;
400400

401401
bool _isFileOpening = false;
402402
bool _isAdministrator = false;
403+
bool _isSyncingZoom = false;
403404

404405
bool _isNppSessionSavedAtExit = false; // guard flag, it prevents emptying of the Notepad++ session.xml in case of multiple WM_ENDSESSION or WM_CLOSE messages
405406

@@ -486,6 +487,7 @@ friend class FileManager;
486487
void checkUndoState();
487488
void checkMacroState();
488489
void checkSyncState();
490+
void syncZoom();
489491
void setupColorSampleBitmapsOnMainMenuItems();
490492
void dropFiles(HDROP hdrop);
491493
void checkModifiedDocument(bool bCheckOnlyCurrentBuffer);

PowerEditor/src/Notepad_plus.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,8 @@ BEGIN
774774
MENUITEM "Zoom &In (Ctrl+Mouse Wheel Up)", IDM_VIEW_ZOOMIN
775775
MENUITEM "Zoom &Out (Ctrl+Mouse Wheel Down)", IDM_VIEW_ZOOMOUT
776776
MENUITEM "&Restore Default Zoom", IDM_VIEW_ZOOMRESTORE
777+
MENUITEM SEPARATOR
778+
MENUITEM "&Synchronize Across Views", IDM_VIEW_ZOOM_SYNC
777779
END
778780
POPUP "&Move/Clone Current Document"
779781
BEGIN

PowerEditor/src/NppCommands.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,17 +2700,31 @@ void Notepad_plus::command(int id)
27002700
case IDM_VIEW_ZOOMIN:
27012701
{
27022702
_pEditView->execute(SCI_ZOOMIN);
2703+
syncZoom();
27032704
break;
27042705
}
27052706
case IDM_VIEW_ZOOMOUT:
27062707
_pEditView->execute(SCI_ZOOMOUT);
2708+
syncZoom();
27072709
break;
27082710

27092711
case IDM_VIEW_ZOOMRESTORE:
27102712
//Zoom factor of 0 points means default view
27112713
_pEditView->execute(SCI_SETZOOM, 0);//_zoomOriginalValue);
2714+
syncZoom();
27122715
break;
27132716

2717+
case IDM_VIEW_ZOOM_SYNC:
2718+
{
2719+
NppParameters& nppParam = NppParameters::getInstance();
2720+
ScintillaViewParams& svp = (ScintillaViewParams&)nppParam.getSVP();
2721+
svp._zoomSync = !svp._zoomSync;
2722+
checkMenuItem(IDM_VIEW_ZOOM_SYNC, svp._zoomSync);
2723+
if (svp._zoomSync)
2724+
syncZoom();
2725+
break;
2726+
}
2727+
27142728
case IDM_VIEW_SYNSCROLLV:
27152729
{
27162730
bool isSynScrollV = !_syncInfo._isSynScrollV;

0 commit comments

Comments
 (0)