Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
666 changes: 105 additions & 561 deletions Readme.md

Large diffs are not rendered by default.

485 changes: 485 additions & 0 deletions doc/Configuration.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions scintilla/include/Scintilla.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,6 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_POPUP_TEXT 2
#define SCI_USEPOPUP 2371
#define SCI_SELECTIONISRECTANGLE 2372
#define SC_MIN_ZOOM_LEVEL 10
#define SC_MAX_ZOOM_LEVEL 1000
#define SCI_SETZOOM 2373
#define SCI_GETZOOM 2374
#define SC_DOCUMENTOPTION_DEFAULT 0
Expand Down
6 changes: 0 additions & 6 deletions scintilla/include/Scintilla.iface
Original file line number Diff line number Diff line change
Expand Up @@ -2265,12 +2265,6 @@ fun void UsePopUp=2371(PopUp 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=1000
# <<<<<<<<<<<<<<< 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,)
Expand Down
4 changes: 1 addition & 3 deletions scintilla/src/EditView.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ using namespace Scintilla;
using namespace Scintilla::Internal;

PrintParameters::PrintParameters() noexcept {
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
magnification = 100;
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
magnification = 0;
colourMode = PrintOption::Normal;
wrapState = Wrap::Word;
}
Expand Down
50 changes: 3 additions & 47 deletions scintilla/src/ViewStyle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ bool MarginStyle::ShowsFolding() const noexcept {

void FontRealised::Realise(Surface &surface, int zoomLevel, Technology technology, const FontSpecification &fs, const char *localeName) {
PLATFORM_ASSERT(fs.fontName);
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
//~measurements.sizeZoomed = fs.size + zoomLevel * FontSizeMultiplier;
//~if (measurements.sizeZoomed <= FontSizeMultiplier) // May fail if sizeZoomed < 1
//~ measurements.sizeZoomed = FontSizeMultiplier;
measurements.sizeZoomed = GetFontSizeZoomed(fs.size, zoomLevel);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
// If negative zoomLevel, ensure sizeZoomed at least minimum positive size
measurements.sizeZoomed = std::max(fs.size + (zoomLevel * FontSizeMultiplier), FontSizeMultiplier);

const float deviceHeight = static_cast<float>(surface.DeviceHeightFont(measurements.sizeZoomed));
const FontParameters fp(fs.fontName, deviceHeight / FontSizeMultiplier, fs.weight,
Expand Down Expand Up @@ -234,9 +230,7 @@ ViewStyle::ViewStyle(size_t stylesSize_) :
marginInside = true;
CalculateMarginWidthAndMask();
textStart = marginInside ? fixedColumnWidth : leftMarginWidth;
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
zoomLevel = 100; /// @ 20018-09-06 Changed to percent
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
zoomLevel = 0;
viewWhitespace = WhiteSpace::Invisible;
tabDrawMode = TabDrawMode::LongArrow;
whitespaceSize = 1;
Expand Down Expand Up @@ -771,44 +765,6 @@ ViewStyle::CaretShape ViewStyle::CaretShapeForMode(bool inOverstrike, bool isMai
return (caretStyle <= CaretStyle::Block) ? static_cast<CaretShape>(caretStyle) : CaretShape::line;
}

// >>>>>>>>>>>>>>> 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);
Expand Down
16 changes: 1 addition & 15 deletions scintilla/src/ViewStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ struct CaretLineAppearance {
int frame = 0;
};

// >>>>>>>>>>>>>>> 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 * FontSizeMultiplier);
}
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

struct CaretAppearance {
// Line, block, over-strike bar ...
Scintilla::CaretStyle style = CaretStyle::Line;
Expand Down Expand Up @@ -160,9 +152,7 @@ class ViewStyle {
int fixedColumnWidth = 0; ///< 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
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
int zoomLevel; /// @ 2018-09-06 Changed to a percent value
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
int zoomLevel;
Scintilla::WhiteSpace viewWhitespace;
Scintilla::TabDrawMode tabDrawMode;
int whitespaceSize;
Expand Down Expand Up @@ -259,10 +249,6 @@ class ViewStyle {
bool IsCaretVisible(bool isMainSelection) const noexcept;
bool DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept;
CaretShape CaretShapeForMode(bool inOverstrike, bool isMainSelection) const noexcept;
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
bool ZoomIn() noexcept;
bool ZoomOut() noexcept;
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

private:
void AllocStyles(size_t sizeNew);
Expand Down
19 changes: 4 additions & 15 deletions scintilla/win32/ScintillaWin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,9 @@ class IMContext {

void SetCompositionFont(const ViewStyle &vs, int style, UINT dpi) const {
LOGFONTW lf{};
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
//int sizeZoomed = vs.styles[style].size + (vs.zoomLevel * FontSizeMultiplier);
//if (sizeZoomed <= 2 * FontSizeMultiplier) // Hangs if sizeZoomed <= 1
// sizeZoomed = 2 * FontSizeMultiplier;
int const sizeZoomed = GetFontSizeZoomed(vs.styles[style].size, vs.zoomLevel);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
int sizeZoomed = vs.styles[style].size + (vs.zoomLevel * FontSizeMultiplier);
if (sizeZoomed <= 2 * FontSizeMultiplier) // Hangs if sizeZoomed <= 1
sizeZoomed = 2 * FontSizeMultiplier;
// The negative is to allow for leading
lf.lfHeight = -::MulDiv(sizeZoomed, dpi, pointsPerInch * FontSizeMultiplier);
lf.lfWeight = static_cast<LONG>(vs.styles[style].weight);
Expand Down Expand Up @@ -1959,15 +1956,7 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l

// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
if (wParam & (MK_CONTROL | MK_RBUTTON)) {
if (wParam & (MK_CONTROL)) {
// Zoom! We play with the font sizes in the styles.
// Number of steps/line is ignored, we just care if sizing up or down
if (linesToScroll < 0)
KeyCommand(Message::ZoomIn);
else
KeyCommand(Message::ZoomOut);
}
// send to main window (trigger zoom callTip or undo/redo history) !
// Forward to parent (NP3 handles zoom steps and undo/redo history)
::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
} else {
// Scroll
Expand Down
6 changes: 3 additions & 3 deletions src/Config/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,11 +1713,11 @@ void LoadSettings()
int const prtFontSize = 10;
int const zoomScale = MulDiv(baseZoom, prtFontSize, f2int(GLOBAL_INITIAL_FONTSIZE));
Defaults.PrintZoom = (Globals.iCfgVersionRead < CFG_VER_0001) ? (zoomScale / 10) : zoomScale;
int iPrintZoom = clampi(IniSectionGetInt(IniSecSettings, L"PrintZoom", Defaults.PrintZoom), 0, SC_MAX_ZOOM_LEVEL);
int iPrintZoom = clampi(IniSectionGetInt(IniSecSettings, L"PrintZoom", Defaults.PrintZoom), 0, NP3_MAX_ZOOM_PERCENT);
if (Globals.iCfgVersionRead < CFG_VER_0001) {
iPrintZoom = 100 + (iPrintZoom - 10) * 10;
}
Settings.PrintZoom = clampi(iPrintZoom, SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL);
Settings.PrintZoom = clampi(iPrintZoom, NP3_MIN_ZOOM_PERCENT, NP3_MAX_ZOOM_PERCENT);

GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_IMEASURE, tchKeyName, COUNTOF(tchKeyName));
LONG const _margin = (tchKeyName[0] == L'0') ? 2000L : 1000L; // Metric system. L'1' is US System
Expand Down Expand Up @@ -1886,7 +1886,7 @@ void LoadSettings()
if (Globals.iCfgVersionRead < CFG_VER_0001) {
winInfo.zoom = (winInfo.zoom + 10) * 10;
}
winInfo.zoom = clampi(winInfo.zoom, SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL);
winInfo.zoom = clampi(winInfo.zoom, NP3_MIN_ZOOM_PERCENT, NP3_MAX_ZOOM_PERCENT);
winInfo.dpi = IniSectionGetInt(IniSecWindow, tchDPI, USER_DEFAULT_SCREEN_DPI);

int const offset = Settings2.LaunchInstanceWndPosOffset;
Expand Down
4 changes: 2 additions & 2 deletions src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Rendering-Technology -> '%s'", Settings.RenderingTechnology ? L"DIRECT-WRITE" : L"GDI");
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);

StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Zoom -> %i%%.", SciCall_GetZoom());
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Zoom -> %i%%.", NP3_GetZoomPercent());
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);

Style_GetLexerDisplayName(Style_GetCurrentLexerPtr(), wchBuf, COUNTOF(wchBuf));
Expand Down Expand Up @@ -4698,7 +4698,7 @@ WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO *hMonitorInfo, const int off
wi.cx = wndpl.rcNormalPosition.right - wndpl.rcNormalPosition.left;
wi.cy = wndpl.rcNormalPosition.bottom - wndpl.rcNormalPosition.top;
wi.max = (hwnd ? IsZoomed(hwnd) : false) || (wndpl.flags & WPF_RESTORETOMAXIMIZED);
wi.zoom = hwnd ? SciCall_GetZoom() : 100;
wi.zoom = hwnd ? NP3_GetZoomPercent() : NP3_DEFAULT_ZOOM;
wi.dpi = Scintilla_GetWindowDPI(hwnd);

if (bFullVisible) {
Expand Down
Loading