diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index a450789cd..26d3bc8c9 100644 Binary files a/Build/Notepad3.ini and b/Build/Notepad3.ini differ diff --git a/language/np3_af_za/dialogs_af_za.rc b/language/np3_af_za/dialogs_af_za.rc index 553d2e946..652a98141 100644 Binary files a/language/np3_af_za/dialogs_af_za.rc and b/language/np3_af_za/dialogs_af_za.rc differ diff --git a/language/np3_de_de/dialogs_de_de.rc b/language/np3_de_de/dialogs_de_de.rc index 880d99610..7b0f7d1e9 100644 Binary files a/language/np3_de_de/dialogs_de_de.rc and b/language/np3_de_de/dialogs_de_de.rc differ diff --git a/language/np3_en_gb/dialogs_en_gb.rc b/language/np3_en_gb/dialogs_en_gb.rc index 307cdc283..f87176792 100644 Binary files a/language/np3_en_gb/dialogs_en_gb.rc and b/language/np3_en_gb/dialogs_en_gb.rc differ diff --git a/language/np3_en_us/dialogs_en_us.rc b/language/np3_en_us/dialogs_en_us.rc index 53d0b2ce6..641a3ebc1 100644 Binary files a/language/np3_en_us/dialogs_en_us.rc and b/language/np3_en_us/dialogs_en_us.rc differ diff --git a/language/np3_es_es/dialogs_es_es.rc b/language/np3_es_es/dialogs_es_es.rc index a0cbb728f..43c15c784 100644 Binary files a/language/np3_es_es/dialogs_es_es.rc and b/language/np3_es_es/dialogs_es_es.rc differ diff --git a/language/np3_fr_fr/dialogs_fr_fr.rc b/language/np3_fr_fr/dialogs_fr_fr.rc index 442473cab..82bb37f34 100644 Binary files a/language/np3_fr_fr/dialogs_fr_fr.rc and b/language/np3_fr_fr/dialogs_fr_fr.rc differ diff --git a/language/np3_ja_jp/dialogs_ja_jp.rc b/language/np3_ja_jp/dialogs_ja_jp.rc index 60595dd9d..0616b0722 100644 Binary files a/language/np3_ja_jp/dialogs_ja_jp.rc and b/language/np3_ja_jp/dialogs_ja_jp.rc differ diff --git a/language/np3_nl_nl/dialogs_nl_nl.rc b/language/np3_nl_nl/dialogs_nl_nl.rc index 0988f0863..9c49c8572 100644 Binary files a/language/np3_nl_nl/dialogs_nl_nl.rc and b/language/np3_nl_nl/dialogs_nl_nl.rc differ diff --git a/language/np3_zh_cn/dialogs_zh_cn.rc b/language/np3_zh_cn/dialogs_zh_cn.rc index 4bbdd30c7..9e7941ab9 100644 Binary files a/language/np3_zh_cn/dialogs_zh_cn.rc and b/language/np3_zh_cn/dialogs_zh_cn.rc differ diff --git a/np3portableapp/Notepad3Portable/App/DefaultData/settings/Notepad3.ini b/np3portableapp/Notepad3Portable/App/DefaultData/settings/Notepad3.ini index a450789cd..26d3bc8c9 100644 Binary files a/np3portableapp/Notepad3Portable/App/DefaultData/settings/Notepad3.ini and b/np3portableapp/Notepad3Portable/App/DefaultData/settings/Notepad3.ini differ diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 19df909b8..240787e7b 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -688,6 +688,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_POPUP_TEXT 2 #define SCI_USEPOPUP 2371 #define SCI_SELECTIONISRECTANGLE 2372 +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> +#define SC_MIN_ZOOM_LEVEL 10 +#define SC_MAX_ZOOM_LEVEL 500 +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< #define SCI_SETZOOM 2373 #define SCI_GETZOOM 2374 #define SC_DOCUMENTOPTION_DEFAULT 0 diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index 3bc4ba1a7..f71460284 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -1774,6 +1774,12 @@ fun void UsePopUp=2371(int popUpMode,) # Is the selection rectangular? The alternative is the more common stream selection. get bool SelectionIsRectangle=2372(,) +# >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> +# 2018-09-06 change zoom level and print magnification to percent value +val SC_MIN_ZOOM_LEVEL=10 +val SC_MAX_ZOOM_LEVEL=500 +# <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< + # Set the zoom level. This number of points is added to the size of all fonts. # It may be positive to magnify or negative to reduce. set void SetZoom=2373(int zoomInPoints,) diff --git a/scintilla/patch_text.txt b/scintilla/patch_text.txt new file mode 100644 index 000000000..0ff89d399 --- /dev/null +++ b/scintilla/patch_text.txt @@ -0,0 +1,5 @@ + + +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index c81733258..15fd8878c 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -65,7 +65,9 @@ static constexpr bool IsControlCharacter(int ch) noexcept { } PrintParameters::PrintParameters() { - magnification = 0; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + magnification = 100; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< colourMode = SC_PRINT_NORMAL; wrapState = eWrapWord; } diff --git a/scintilla/src/EditView.h b/scintilla/src/EditView.h index 4fa7807d3..4bcc2836a 100644 --- a/scintilla/src/EditView.h +++ b/scintilla/src/EditView.h @@ -11,7 +11,7 @@ namespace Scintilla { struct PrintParameters { - int magnification; + int magnification; /// @ 2018-09-06 Changed to a percent value int colourMode; WrapMode wrapState; PrintParameters(); diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 80b7035d8..5d0dfba02 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -3826,15 +3826,17 @@ int Editor::KeyCommand(unsigned int iMessage) { AddChar('\f'); break; case SCI_ZOOMIN: - if (vs.zoomLevel < 20) { - vs.zoomLevel++; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + if (vs.ZoomIn()) { + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< InvalidateStyleRedraw(); NotifyZoom(); } break; case SCI_ZOOMOUT: - if (vs.zoomLevel > -10) { - vs.zoomLevel--; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + if (vs.ZoomOut()) { + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< InvalidateStyleRedraw(); NotifyZoom(); } @@ -6283,7 +6285,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_SETPRINTMAGNIFICATION: - view.printParameters.magnification = static_cast(wParam); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + view.printParameters.magnification = std::clamp(static_cast(wParam), SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< break; case SCI_GETPRINTMAGNIFICATION: @@ -7557,7 +7561,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_SETZOOM: - vs.zoomLevel = static_cast(wParam); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + vs.zoomLevel = std::clamp(static_cast(wParam), SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< InvalidateStyleRedraw(); NotifyZoom(); break; diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index 9706bf585..88a5bd3ac 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -68,10 +68,12 @@ FontRealised::~FontRealised() { void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs) { PLATFORM_ASSERT(fs.fontName); - sizeZoomed = fs.size + zoomLevel * SC_FONT_SIZE_MULTIPLIER; - if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 - sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; - + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + //sizeZoomed = fs.size + zoomLevel * SC_FONT_SIZE_MULTIPLIER; + //if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 + // sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; + sizeZoomed = GetFontSizeZoomed(fs.size, zoomLevel); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< const float deviceHeight = static_cast(surface.DeviceHeightFont(sizeZoomed)); const FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet); font.Create(fp); @@ -277,7 +279,7 @@ void ViewStyle::Init(size_t stylesSize_) { marginInside = true; CalculateMarginWidthAndMask(); textStart = marginInside ? fixedColumnWidth : leftMarginWidth; - zoomLevel = 0; + zoomLevel = 100; /// @ 20018-09-06 Changed to percent viewWhitespace = wsInvisible; tabDrawMode = tdLongArrow; whitespaceSize = 1; @@ -572,6 +574,46 @@ bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) { return changed; } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + +bool ViewStyle::ZoomIn() noexcept { + if (zoomLevel < SC_MAX_ZOOM_LEVEL) { + int level = zoomLevel; + if (level < 200) { + level += 10; + } else { + level += 25; + } + + level = std::min(level, SC_MAX_ZOOM_LEVEL); + if (level != zoomLevel) { + zoomLevel = level; + return true; + } + } + return false; +} + +bool ViewStyle::ZoomOut() noexcept { + if (zoomLevel > SC_MIN_ZOOM_LEVEL) { + int level = zoomLevel; + if (level <= 200) { + level -= 10; + } else { + level -= 25; + } + + level = std::max(level, SC_MIN_ZOOM_LEVEL); + if (level != zoomLevel) { + zoomLevel = level; + return true; + } + } + return false; +} + +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< + void ViewStyle::AllocStyles(size_t sizeNew) { size_t i=styles.size(); styles.resize(sizeNew); diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h index 800d8cb67..c6e424733 100644 --- a/scintilla/src/ViewStyle.h +++ b/scintilla/src/ViewStyle.h @@ -63,6 +63,14 @@ typedef std::map> FontMap; enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace }; +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> +constexpr int GetFontSizeZoomed(int size, int zoomLevel) noexcept { + size = (size * zoomLevel + 50) / 100; + // Hangs if sizeZoomed (in point) <= 1 + return std::max(size, 2 * SC_FONT_SIZE_MULTIPLIER); +} +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< + class ColourOptional : public ColourDesired { public: bool isSet; @@ -135,7 +143,7 @@ public: int fixedColumnWidth; ///< Total width of margins bool marginInside; ///< true: margin included in text view, false: separate views int textStart; ///< Starting x position of text within the view - int zoomLevel; + int zoomLevel; /// @ 2018-09-06 Changed to a percent value WhiteSpaceVisibility viewWhitespace; TabDrawMode tabDrawMode; int whitespaceSize; @@ -212,6 +220,11 @@ public: bool WhiteSpaceVisible(bool inIndent) const; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + bool ViewStyle::ZoomIn() noexcept; + bool ViewStyle::ZoomOut() noexcept; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< + private: void AllocStyles(size_t sizeNew); void CreateAndAddFont(const FontSpecification &fs); diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 51ca1248a..2600c7633 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -24,6 +24,13 @@ #include #include +#if !defined(NOMINMAX) +// Want to use std::min and std::max so don't want Windows.h version of min and max +#define NOMINMAX +#endif +#define VC_EXTRALEAN 1 +#define WIN32_LEAN_AND_MEAN 1 + #include #include #include @@ -2729,9 +2736,7 @@ void ScintillaWin::ImeStartComposition() { // The logfont for the IME is recreated here. const int styleHere = pdoc->StyleIndexAt(sel.MainCaret()); LOGFONTW lf = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"" }; - int sizeZoomed = vs.styles[styleHere].size + vs.zoomLevel * SC_FONT_SIZE_MULTIPLIER; - if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 - sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; + int sizeZoomed = GetFontSizeZoomed(vs.styles[styleHere].size, vs.zoomLevel); AutoSurface surface(this); int deviceHeight = sizeZoomed; if (surface) { @@ -3614,14 +3619,12 @@ sptr_t ScintillaWin::DirectFunction( return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); } - extern "C" sptr_t __stdcall Scintilla_DirectFunction( ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) { return sci->WndProc(iMessage, wParam, lParam); } - LRESULT PASCAL ScintillaWin::SWndProc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { //Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam); @@ -3668,7 +3671,7 @@ int Scintilla_RegisterClasses(void *hInstance) { namespace Scintilla { -int ResourcesRelease(bool fromDllMain) { +int ResourcesRelease(bool fromDllMain) noexcept { const bool result = ScintillaWin::Unregister(); Platform_Finalise(fromDllMain); return result; diff --git a/src/Edit.c b/src/Edit.c index b84a218be..0a728ce02 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -8314,12 +8314,10 @@ void EditShowZoomCallTip(HWND hwnd) { UNUSED(hwnd); - int const iZoomLevel = SciCall_GetZoom(); - float const fSize = Style_GetCurrentFontSize(); - int const iZoomPercent = float2int((100.0f * ((float)iZoomLevel + fSize)) / fSize); + int const iZoomLevelPercent = SciCall_GetZoom(); char chToolTip[32] = { '\0' }; - StringCchPrintfA(chToolTip, COUNTOF(chToolTip), "Zoom: %i%%", iZoomPercent); + StringCchPrintfA(chToolTip, COUNTOF(chToolTip), "Zoom: %i%%", iZoomLevelPercent); DocPos const iPos = SciCall_PositionFromLine(SciCall_GetFirstVisibleLine()); diff --git a/src/Notepad3.c b/src/Notepad3.c index 5d907856e..384bc6457 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -125,6 +125,7 @@ WCHAR g_wchIniFile[MAX_PATH] = { L'\0' }; WCHAR g_wchIniFile2[MAX_PATH] = { L'\0' }; static WCHAR g_szTmpFilePath[MAX_PATH] = { L'\0' }; +static int g_iSettingsVersion = CFG_VER_NONE; static bool g_bSaveSettings; static bool g_bEnableSaveSettings; bool g_bIniFileFromScratch = false; @@ -1009,7 +1010,7 @@ static void __fastcall _InitWindowPosition() { g_WinInfo.x = g_WinInfo.y = g_WinInfo.cx = g_WinInfo.cy = CW_USEDEFAULT; g_WinInfo.max = 0; - g_WinInfo.zoom = 0; + g_WinInfo.zoom = 100; } else if (g_flagDefaultPos >= 4) { @@ -1046,7 +1047,7 @@ static void __fastcall _InitWindowPosition() g_WinInfo.y += (g_flagDefaultPos & 32) ? 4 : 8; g_WinInfo.cy -= (g_flagDefaultPos & (16 | 32)) ? 12 : 16; g_WinInfo.max = 1; - g_WinInfo.zoom = 0; + g_WinInfo.zoom = 100; } } else if (g_flagDefaultPos == 2 || g_flagDefaultPos == 3) // NP3 default window position @@ -4861,7 +4862,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_VIEW_RESETZOOM: { - SciCall_SetZoom(0); + SciCall_SetZoom(100); UpdateLineNumberWidth(); EditShowZoomCallTip(g_hwndEdit); } @@ -6610,12 +6611,16 @@ void GetFindPatternMB(LPSTR chFindPattern, size_t bufferSize) void LoadSettings() { WCHAR *pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * INISECTIONBUFCNT * HUGE_BUFFER); - if (pIniSection) { - int cchIniSection = (int)LocalSize(pIniSection) / sizeof(WCHAR); + if (pIniSection) + { + int const cchIniSection = (int)LocalSize(pIniSection) / sizeof(WCHAR); + + g_iSettingsVersion = IniGetInt(L"Settings", L"SettingsVersion", CFG_VER_NONE); g_bEnableSaveSettings = true; // false: if settings-file is loaded in editor g_bSaveSettings = IniGetBool(L"Settings", L"SaveSettings", true); + // first load "hard coded" .ini-Settings // -------------------------------------------------------------------------- LoadIniSection(L"Settings2", pIniSection, cchIniSection); @@ -6831,8 +6836,9 @@ void LoadSettings() iPrintColor = IniSectionGetInt(pIniSection, L"PrintColorMode", 3); iPrintColor = clampi(iPrintColor, 0, 4); - iPrintZoom = IniSectionGetInt(pIniSection, L"PrintZoom", 10); - iPrintZoom = clampi(iPrintZoom - 10, -10, 20); + iPrintZoom = IniSectionGetInt(pIniSection, L"PrintZoom", (g_iSettingsVersion < CFG_VER_0001) ? 10 : 100); + if (g_iSettingsVersion < CFG_VER_0001) { iPrintZoom = 100 + (iPrintZoom-10) * 10; } + iPrintZoom = clampi(iPrintZoom, SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL); pagesetupMargin.left = IniSectionGetInt(pIniSection, L"PrintMarginLeft", -1); pagesetupMargin.left = max(pagesetupMargin.left, -1); @@ -6990,8 +6996,9 @@ void LoadSettings() g_WinInfo.cy = IniSectionGetInt(pIniSection, tchSizeY, (INT_MAX >> 1)); g_WinInfo.max = IniSectionGetInt(pIniSection, tchMaximized, 0); g_WinInfo.max = clampi(g_WinInfo.max, 0, 1); - g_WinInfo.zoom = IniSectionGetInt(pIniSection, tchZoom, 0); - g_WinInfo.zoom = clampi(g_WinInfo.zoom, -10, 20); + g_WinInfo.zoom = IniSectionGetInt(pIniSection, tchZoom, (g_iSettingsVersion < CFG_VER_0001) ? 0 : 100); + if (g_iSettingsVersion < CFG_VER_0001) { g_WinInfo.zoom = (g_WinInfo.zoom + 10) * 10; } + g_WinInfo.zoom = clampi(g_WinInfo.zoom, SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL); if (((g_WinInfo.x & ~CW_USEDEFAULT) == (INT_MAX >> 1)) || ((g_WinInfo.y & ~CW_USEDEFAULT) == (INT_MAX >> 1)) || @@ -7060,7 +7067,7 @@ void SaveSettings(bool bSaveSettingsNow) { CreateIniFile(); if (!g_bSaveSettings && !bSaveSettingsNow) { - IniSetInt(L"Settings", L"SaveSettings", g_bSaveSettings); + IniSetBool(L"Settings", L"SaveSettings", g_bSaveSettings); return; } @@ -7071,6 +7078,7 @@ void SaveSettings(bool bSaveSettingsNow) { pIniSection = LocalAlloc(LPTR, sizeof(WCHAR) * INISECTIONBUFCNT * HUGE_BUFFER); //int cchIniSection = (int)LocalSize(pIniSection) / sizeof(WCHAR); + IniSectionSetInt(pIniSection, L"SettingsVersion", CFG_VER_CURRENT); IniSectionSetBool(pIniSection, L"SaveSettings", g_bSaveSettings); IniSectionSetBool(pIniSection, L"SaveRecentFiles", g_bSaveRecentFiles); IniSectionSetBool(pIniSection, L"PreserveCaretPos", g_bPreserveCaretPos); @@ -7134,7 +7142,7 @@ void SaveSettings(bool bSaveSettingsNow) { IniSectionSetInt(pIniSection, L"PrintHeader", iPrintHeader); IniSectionSetInt(pIniSection, L"PrintFooter", iPrintFooter); IniSectionSetInt(pIniSection, L"PrintColorMode", iPrintColor); - IniSectionSetInt(pIniSection, L"PrintZoom", iPrintZoom + 10); + IniSectionSetInt(pIniSection, L"PrintZoom", iPrintZoom); IniSectionSetInt(pIniSection, L"PrintMarginLeft", pagesetupMargin.left); IniSectionSetInt(pIniSection, L"PrintMarginTop", pagesetupMargin.top); IniSectionSetInt(pIniSection, L"PrintMarginRight", pagesetupMargin.right); @@ -8742,7 +8750,7 @@ void UpdateSettingsCmds() CheckCmd(hmenu, IDM_VIEW_SAVESETTINGS, g_bSaveSettings && g_bEnableSaveSettings); EnableCmd(hmenu, IDM_VIEW_SAVESETTINGS, hasIniFile && g_bEnableSaveSettings); EnableCmd(hmenu, IDM_VIEW_SAVESETTINGSNOW, hasIniFile && g_bEnableSaveSettings); - if (SciCall_GetZoom() != 0) { EditShowZoomCallTip(g_hwndEdit); } + if (SciCall_GetZoom() != 100) { EditShowZoomCallTip(g_hwndEdit); } } diff --git a/src/Print.cpp b/src/Print.cpp index d824c8e19..63ed8f64e 100644 --- a/src/Print.cpp +++ b/src/Print.cpp @@ -484,8 +484,10 @@ extern "C" UINT_PTR CALLBACK PageSetupHook(HWND hwnd, UINT uiMsg, WPARAM wParam, SendDlgItemMessage(hwnd,30,EM_LIMITTEXT,32,0); - SendDlgItemMessage(hwnd,31,UDM_SETRANGE,0,MAKELONG((short)20,(short)-10)); - SendDlgItemMessage(hwnd,31,UDM_SETPOS,0,MAKELONG((short)iPrintZoom,0)); + UDACCEL const acc[1] = { { 0, 10 } }; + SendDlgItemMessage(hwnd,31,UDM_SETACCEL,1,(WPARAM)acc); + SendDlgItemMessage(hwnd,31,UDM_SETRANGE32,SC_MIN_ZOOM_LEVEL,SC_MAX_ZOOM_LEVEL); + SendDlgItemMessage(hwnd,31,UDM_SETPOS32,0,iPrintZoom); // Set header options GetLngString(IDS_MUI_PRINT_HEADER,tch,COUNTOF(tch)); @@ -527,7 +529,7 @@ extern "C" UINT_PTR CALLBACK PageSetupHook(HWND hwnd, UINT uiMsg, WPARAM wParam, p1 = p2; p2 = StrChr(p1, L'|'); // next } - SendDlgItemMessage(hwnd,34,CB_SETCURSEL,(WPARAM)iPrintColor,0); + SendDlgItemMessage(hwnd,34,CB_SETCURSEL,(LPARAM)iPrintColor,0); // Make combos handier SendDlgItemMessage(hwnd,32,CB_SETEXTENDEDUI,true,0); @@ -541,11 +543,9 @@ extern "C" UINT_PTR CALLBACK PageSetupHook(HWND hwnd, UINT uiMsg, WPARAM wParam, case WM_COMMAND: if (LOWORD(wParam) == IDOK) { - int iPos = (int)SendDlgItemMessage(hwnd,31,UDM_GETPOS,0,0); - if (HIWORD(iPos) == 0) - iPrintZoom = (int)(short)LOWORD(iPos); - else - iPrintZoom = 0; + BOOL bError = FALSE; + int const iPos = (int)SendDlgItemMessage(hwnd,31,UDM_GETPOS32,0,(LPARAM)&bError); + iPrintZoom = bError ? 100 : iPos; iPrintHeader = (int)SendDlgItemMessage(hwnd, 32, CB_GETCURSEL, 0, 0); iPrintFooter = (int)SendDlgItemMessage(hwnd, 33, CB_GETCURSEL, 0, 0); diff --git a/src/Styles.c b/src/Styles.c index d96797e93..00d69a0f3 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -4127,9 +4127,9 @@ void Style_SetFolding(HWND hwnd, bool bShowCodeFolding) float fSize = _GetBaseFontSize(); Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &fSize); // relative to LineNumber Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); - float const zoomPoints = (float)SciCall_GetZoom(); + float const zoomPercent = (float)SciCall_GetZoom(); - int const iSizeDPI = ScaleToCurrentDPI(fSize + zoomPoints); + int const iSizeDPI = ScaleToCurrentDPI((fSize * zoomPercent) / 100.0f); SciCall_SetMarginWidthN(MARGIN_SCI_FOLDING, (bShowCodeFolding) ? iSizeDPI : 0); } @@ -4144,9 +4144,9 @@ void Style_SetBookmark(HWND hwnd, bool bShowSelMargin) float fSize = _GetBaseFontSize(); Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &fSize); // relative to LineNumber Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); - float const zoomPoints = (float)SciCall_GetZoom(); + float const zoomPercent = (float)SciCall_GetZoom(); - int const iSizeDPI = ScaleToCurrentDPI(fSize + zoomPoints); + int const iSizeDPI = ScaleToCurrentDPI((fSize * zoomPercent) / 100.0f); SciCall_SetMarginWidthN(MARGIN_SCI_BOOKMRK, (bShowSelMargin) ? iSizeDPI : 0); // Depending on if the margin is visible or not, choose different bookmark indication diff --git a/src/TypeDefs.h b/src/TypeDefs.h index de6893cac..6c4ee37c4 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -70,11 +70,18 @@ inline RECT RectFromWinInfo(const WININFO* const pWinInfo) { // ---------------------------------------------------------------------------- +// keep backward compatible with older settings-file versions +typedef enum +{ + CFG_VER_NONE = 0, /// old version + CFG_VER_0001 = 1, /// ZoomLevel and PrintZoom changed from relative font size in point to absolute percentage. + CFG_VER_CURRENT = CFG_VER_0001 +} CFG_VERSION; // -------------------------------------------------------------------------- -typedef enum BufferSizes +typedef enum { MICRO_BUFFER = 32, MINI_BUFFER = 64,