diff --git a/language/common_res.h b/language/common_res.h
index ecb015a05..7628fa0f4 100644
--- a/language/common_res.h
+++ b/language/common_res.h
@@ -312,7 +312,7 @@
#define CMD_JUMP2SELEND 20036
#define CMD_COPYPATHNAME 20037
#define CMD_COPYWINPOS 20038
-#define CMD_DEFAULTWINPOS 20039
+#define CMD_INITIALWINPOS 20039
#define CMD_OPENINIFILE 20040
#define CMD_CTRLENTER 20041
#define CMD_OPEN_HYPERLINK 20042
@@ -323,6 +323,8 @@
#define CMD_TAB 20047
#define CMD_BACKTAB 20048
#define CMD_VK_INSERT 20049
+#define CMD_FULLSCRWINPOS 20050
+#define CMD_DEFAULTWINPOS 20051
#define IDM_FILE_NEW 40000
#define IDM_FILE_OPEN 40001
@@ -346,6 +348,7 @@
#define IDM_FILE_MANAGEFAV 40019
#define IDM_FILE_RECENT 40020
#define IDM_FILE_EXIT 40021
+
#define IDM_ENCODING_ANSI 40100
#define IDM_ENCODING_UNICODE 40101
#define IDM_ENCODING_UNICODEREV 40102
@@ -366,6 +369,7 @@
#define BME_EDIT_BOOKMARKNEXT 40255
#define BME_EDIT_BOOKMARKCLEAR 40256
#define BME_EDIT_BOOKMARKPREV 40257
+
#define IDM_EDIT_UNDO 40300
#define IDM_EDIT_REDO 40301
#define IDM_EDIT_CUT 40302
@@ -444,6 +448,7 @@
#define IDM_EDIT_REMOVEDUPLICATELINES 40375
#define IDM_EDIT_REMOVEEMPTYLINES 40376
#define IDM_EDIT_MERGEEMPTYLINES 40377
+
#define IDM_VIEW_SCHEME 40400
#define IDM_VIEW_USE2NDDEFAULT 40401
#define IDM_VIEW_SCHEMECONFIG 40402
@@ -513,9 +518,11 @@
#define IDM_SET_BIDIRECTIONAL_NONE 40466
#define IDM_SET_BIDIRECTIONAL_L2R 40467
#define IDM_SET_BIDIRECTIONAL_R2L 40468
+
#define IDM_HELP_ABOUT 40500
#define IDM_HELP_CMD 40501
#define IDM_HELP_ONLINEDOCUMENTATION 40502
+
#define IDM_TRAY_RESTORE 40600
#define IDM_TRAY_EXIT 40601
#define IDM_SETPASS 40602
@@ -524,8 +531,6 @@
#define IDM_EDIT_INSERT_GUID 40605
-
-
#define IDS_ENC_ANSI 61000
#define IDS_ENC_OEM 61001
#define IDS_ENC_UTF16LEBOM 61002
diff --git a/language/np3_af_za/menu_af_za.rc b/language/np3_af_za/menu_af_za.rc
index 2930eb51f..8b37b4a46 100644
Binary files a/language/np3_af_za/menu_af_za.rc and b/language/np3_af_za/menu_af_za.rc differ
diff --git a/language/np3_de_de/menu_de_de.rc b/language/np3_de_de/menu_de_de.rc
index 4f57f1b88..8941cf2f8 100644
Binary files a/language/np3_de_de/menu_de_de.rc and b/language/np3_de_de/menu_de_de.rc differ
diff --git a/language/np3_en_gb/menu_en_gb.rc b/language/np3_en_gb/menu_en_gb.rc
index 19f07f88a..acc2a3822 100644
Binary files a/language/np3_en_gb/menu_en_gb.rc and b/language/np3_en_gb/menu_en_gb.rc differ
diff --git a/language/np3_en_us/menu_en_us.rc b/language/np3_en_us/menu_en_us.rc
index 09cdf5137..fe76a5d17 100644
Binary files a/language/np3_en_us/menu_en_us.rc and b/language/np3_en_us/menu_en_us.rc differ
diff --git a/language/np3_es_es/menu_es_es.rc b/language/np3_es_es/menu_es_es.rc
index 369dd7651..e2adfbda3 100644
Binary files a/language/np3_es_es/menu_es_es.rc and b/language/np3_es_es/menu_es_es.rc differ
diff --git a/language/np3_fr_fr/menu_fr_fr.rc b/language/np3_fr_fr/menu_fr_fr.rc
index 23e6b9777..fa84df95a 100644
Binary files a/language/np3_fr_fr/menu_fr_fr.rc and b/language/np3_fr_fr/menu_fr_fr.rc differ
diff --git a/language/np3_ja_jp/menu_ja_jp.rc b/language/np3_ja_jp/menu_ja_jp.rc
index 27de59cff..04841a1e3 100644
Binary files a/language/np3_ja_jp/menu_ja_jp.rc and b/language/np3_ja_jp/menu_ja_jp.rc differ
diff --git a/language/np3_nl_nl/menu_nl_nl.rc b/language/np3_nl_nl/menu_nl_nl.rc
index 13ea8b9bd..7dd0477c2 100644
Binary files a/language/np3_nl_nl/menu_nl_nl.rc and b/language/np3_nl_nl/menu_nl_nl.rc differ
diff --git a/language/np3_zh_cn/menu_zh_cn.rc b/language/np3_zh_cn/menu_zh_cn.rc
index 28179e986..fcce19b11 100644
Binary files a/language/np3_zh_cn/menu_zh_cn.rc and b/language/np3_zh_cn/menu_zh_cn.rc differ
diff --git a/minipath/language/common_res.h b/minipath/language/common_res.h
index 4abd6dfe9..94b2b127a 100644
--- a/minipath/language/common_res.h
+++ b/minipath/language/common_res.h
@@ -105,11 +105,13 @@
#define IDC_TRANSL_AUTH 114
#define IDR_MAINWND48 200
+
#define IDS_APPTITLE 10000
#define IDS_NUMFILES 10001
#define IDS_NUMFILES2 10002
#define IDS_SAVEFILE 10003
#define IDS_OPEN_FILE_WITH 10004
+
#define IDS_SEARCHEXE 11000
#define IDS_GETQUICKVIEWER 11001
#define IDS_GETTARGET 11002
@@ -122,6 +124,7 @@
#define IDS_COPYMOVE 11009
#define IDS_CREATELINK 11010
#define IDS_SAVESETTINGS 11011
+
#define IDM_FILE_OPEN 40001
#define IDM_FILE_OPENNEW 40002
#define IDM_FILE_RUN 40003
@@ -141,6 +144,7 @@
#define IDM_FILE_CHANGEDIR 40017
#define IDM_FILE_PROPERTIES 40018
#define IDM_FILE_DRIVEPROP 40019
+
#define IDM_VIEW_NEWWINDOW 40201
#define IDM_VIEW_FOLDERS 40202
#define IDM_VIEW_FILES 40203
@@ -157,14 +161,17 @@
#define IDM_VIEW_SAVESETTINGS 40214
#define IDM_VIEW_FINDTARGET 40215
#define IDM_VIEW_OPTIONS 40216
+
#define IDM_SORT_NAME 40301
#define IDM_SORT_SIZE 40302
#define IDM_SORT_TYPE 40303
#define IDM_SORT_DATE 40304
#define IDM_SORT_REVERSE 40305
+
#define IDM_POP_COPYNAME 40501
#define IDM_TRAY_RESTORE 40601
#define IDM_TRAY_EXIT 40602
+
#define ACC_ESCAPE 41001
#define ACC_NEXTCTL 41002
#define ACC_PREVCTL 41003
@@ -176,6 +183,7 @@
#define ACC_SNAPTOTARGET 41009
#define ACC_DEFAULTWINPOS 41010
#define ACC_SELECTINIFILE 41011
+
#define IDT_HISTORY_BACK 42001
#define IDT_HISTORY_FORWARD 42002
#define IDT_UPDIR 42003
@@ -190,6 +198,7 @@
#define IDT_FILE_DELETE 42012
#define IDT_FILE_DELETE2 42013
#define IDT_VIEW_FILTER 42014
+
#define IDS_ERR_CD 50000
#define IDS_ERR_FILE 50001
#define IDS_ERR_NEW 50002
diff --git a/minipath/minipath.vcxproj b/minipath/minipath.vcxproj
index e625fee38..0f2c18e5a 100644
--- a/minipath/minipath.vcxproj
+++ b/minipath/minipath.vcxproj
@@ -265,7 +265,7 @@
-
+
@@ -273,7 +273,7 @@
-
+
diff --git a/minipath/minipath.vcxproj.filters b/minipath/minipath.vcxproj.filters
index 0ef64d0a7..b7d5236ca 100644
--- a/minipath/minipath.vcxproj.filters
+++ b/minipath/minipath.vcxproj.filters
@@ -25,15 +25,15 @@
C/C++ Source Files
-
- C/C++ Source Files
-
C/C++ Source Files
C/C++ Source Files
+
+ C/C++ Source Files
+
@@ -42,9 +42,6 @@
H Source Files
-
- H Source Files
-
H Source Files
@@ -60,6 +57,9 @@
H Source Files
+
+ H Source Files
+
diff --git a/minipath/src/Dropsource.cpp b/minipath/src/DropSource.cpp
similarity index 75%
rename from minipath/src/Dropsource.cpp
rename to minipath/src/DropSource.cpp
index ffcc44ad5..f95af10b0 100644
--- a/minipath/src/Dropsource.cpp
+++ b/minipath/src/DropSource.cpp
@@ -15,88 +15,70 @@
#define _WIN32_WINNT 0x601
#include
//#include
-#include "helpers.h"
-#include "dropsource.h"
-
+#include "DropSource.h"
/******************************************************************************
*
* IUnknown Implementation
*
******************************************************************************/
-STDMETHODIMP CDropSource::QueryInterface(REFIID iid, void FAR* FAR* ppv)
-{
- if (iid == IID_IUnknown || iid == IID_IDropSource)
- {
+STDMETHODIMP CDropSource::QueryInterface(REFIID iid, PVOID *ppv) noexcept {
+ if (iid == IID_IUnknown || iid == IID_IDropSource) {
*ppv = this;
- ++m_refs;
+ AddRef();
return NOERROR;
}
- *ppv = NULL;
+ *ppv = nullptr;
return E_NOINTERFACE;
}
-
-STDMETHODIMP_(ULONG) CDropSource::AddRef()
-{
+STDMETHODIMP_(ULONG) CDropSource::AddRef() noexcept {
return ++m_refs;
}
-
-STDMETHODIMP_(ULONG) CDropSource::Release()
-{
- if(--m_refs == 0)
- {
+STDMETHODIMP_(ULONG) CDropSource::Release() noexcept {
+ const ULONG refs = --m_refs;
+ if (refs == 0) {
delete this;
- return 0;
}
- return m_refs;
+ return refs;
}
-
/******************************************************************************
*
* CDropSource Constructor
*
******************************************************************************/
-CDropSource::CDropSource()
-{
+CDropSource::CDropSource() noexcept {
m_refs = 1;
}
-
/******************************************************************************
*
* IDropSource Implementation
*
******************************************************************************/
-STDMETHODIMP CDropSource::QueryContinueDrag(BOOL fEscapePressed,
- DWORD grfKeyState)
-{
- if (fEscapePressed)
+STDMETHODIMP CDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) noexcept {
+ if (fEscapePressed) {
return DRAGDROP_S_CANCEL;
-
- else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
+ }
+ if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON)) {
return DRAGDROP_S_DROP;
-
- else
- return NOERROR;
+ }
+ return NOERROR;
}
-
-STDMETHODIMP CDropSource::GiveFeedback(DWORD dwEffect)
-{
- UNUSED(dwEffect);
+STDMETHODIMP CDropSource::GiveFeedback(DWORD dwEffect) noexcept {
+ (void)(dwEffect);
return DRAGDROP_S_USEDEFAULTCURSORS;
}
-
extern "C" {
-LPDROPSOURCE CreateDropSource()
-{
+
+LPDROPSOURCE CreateDropSource(void) {
return ((LPDROPSOURCE) new CDropSource);
}
+
}
-
-// End of Dropsource.cpp
+// End of DropSource.cpp
diff --git a/minipath/src/Dropsource.h b/minipath/src/DropSource.h
similarity index 67%
rename from minipath/src/Dropsource.h
rename to minipath/src/DropSource.h
index cfdc6e226..f1c03fbdf 100644
--- a/minipath/src/Dropsource.h
+++ b/minipath/src/DropSource.h
@@ -13,25 +13,28 @@
* *
*******************************************************************************/
-class FAR CDropSource : public IDropSource
-{
+#ifndef METAPATH_DROPSOURCE_H_
+#define METAPATH_DROPSOURCE_H_
+class CDropSource : public IDropSource {
public:
- CDropSource();
+ CDropSource() noexcept;
+ virtual ~CDropSource() = default;
- /* IUnknown methods */
- STDMETHOD(QueryInterface)(REFIID riid,void FAR* FAR* ppvObj);
- STDMETHOD_(ULONG,AddRef)();
- STDMETHOD_(ULONG,Release)();
+ /* IUnknown methods */
+ STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv) noexcept override;
+ STDMETHODIMP_(ULONG)AddRef() noexcept override;
+ STDMETHODIMP_(ULONG)Release() noexcept override;
- /* IDropSource methods */
- STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed,DWORD grfKeyState);
- STDMETHOD(GiveFeedback)(DWORD dwEffect);
+ /* IDropSource methods */
+ STDMETHODIMP QueryContinueDrag(BOOL fEsc, DWORD grfKeyState) noexcept override;
+ STDMETHODIMP GiveFeedback(DWORD) noexcept override;
private:
- ULONG m_refs;
-
+ ULONG m_refs;
};
+#endif // METAPATH_DROPSOURCE_H_
+
// End of Dropsource.h
diff --git a/minipath/src/minipath.c b/minipath/src/minipath.c
index d9dcc76d1..0ec2d15b6 100644
--- a/minipath/src/minipath.c
+++ b/minipath/src/minipath.c
@@ -881,7 +881,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
else if (iCmd == IDM_TRAY_EXIT) {
ShowNotifyIcon(hwnd,FALSE);
- SendMessage(hwnd,WM_CLOSE,0,0);
+ PostMessage(hwnd,WM_CLOSE,0,0);
}
}
return TRUE;
@@ -2194,7 +2194,7 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
else if (iEscFunction == 1)
SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0);
else if (iEscFunction == 2)
- SendMessage(hwnd,WM_CLOSE,0,0);
+ PostMessage(hwnd,WM_CLOSE,0,0);
break;
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx
index d9a02e327..6850a59d1 100644
--- a/scintilla/win32/PlatWin.cxx
+++ b/scintilla/win32/PlatWin.cxx
@@ -780,7 +780,7 @@ void SurfaceGDI::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesir
namespace {
// Plot a point into a DWORD buffer symmetrically to all 4 quadrants
-void AllFour(DWORD *pixels, int width, int height, int x, int y, DWORD val) {
+void __forceinline AllFour(DWORD *pixels, int width, int height, int x, int y, DWORD val) {
pixels[y*width+x] = val;
pixels[y*width+width-1-x] = val;
pixels[(height-1-y)*width+x] = val;
@@ -2274,7 +2274,7 @@ static RECT RectFromMonitor(HMONITOR hMonitor) {
return mi.rcWork;
}
RECT rc = {0, 0, 0, 0};
- if (::SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc, 0) == 0) {
+ if (::SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0) == 0) {
rc.left = 0;
rc.top = 0;
rc.right = 0;
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx
index b22c823f4..51ca1248a 100644
--- a/scintilla/win32/ScintillaWin.cxx
+++ b/scintilla/win32/ScintillaWin.cxx
@@ -1679,7 +1679,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
break;
case WM_IME_STARTCOMPOSITION: // dbcs
- if (KoreanIME() || imeInteraction == imeInline) {
+ if (imeInteraction == imeInline) {
return 0;
} else {
ImeStartComposition();
@@ -1691,7 +1691,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
case WM_IME_COMPOSITION:
- if (KoreanIME() || imeInteraction == imeInline) {
+ if (imeInteraction == imeInline) {
return HandleCompositionInline(wParam, lParam);
} else {
return HandleCompositionWindowed(wParam, lParam);
@@ -1730,7 +1730,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
return 0;
case WM_IME_SETCONTEXT:
- if (KoreanIME() || imeInteraction == imeInline) {
+ if (imeInteraction == imeInline) {
if (wParam) {
LPARAM NoImeWin = lParam;
NoImeWin = NoImeWin & (~ISC_SHOWUICOMPOSITIONWINDOW);
diff --git a/src/Dialogs.c b/src/Dialogs.c
index 886817f9c..7b5a73538 100644
--- a/src/Dialogs.c
+++ b/src/Dialogs.c
@@ -2619,12 +2619,47 @@ bool SelectDefLineEndingDlg(HWND hwnd,int *iOption)
}
+//=============================================================================
+//
+// GetMonitorInfoFromRect()
+//
+static void __fastcall GetMonitorInfoFromRect(const RECT* const rc, MONITORINFO* hMonitorInfo)
+{
+ if (hMonitorInfo) {
+ HMONITOR const hMonitor = MonitorFromRect(rc, MONITOR_DEFAULTTONEAREST);
+ ZeroMemory(hMonitorInfo, sizeof(MONITORINFO));
+ hMonitorInfo->cbSize = sizeof(MONITORINFO);
+ GetMonitorInfo(hMonitor, hMonitorInfo);
+ }
+}
+// ----------------------------------------------------------------------------
+
+
+
+//=============================================================================
+//
+// WinInfoToScreen()
+//
+void WinInfoToScreen(WININFO* pWinInfo)
+{
+ if (pWinInfo) {
+ MONITORINFO mi;
+ RECT rc = RectFromWinInfo(pWinInfo);
+ GetMonitorInfoFromRect(&rc, &mi);
+
+ WININFO winfo = *pWinInfo;
+ winfo.x += (mi.rcWork.left - mi.rcMonitor.left);
+ winfo.y += (mi.rcWork.top - mi.rcMonitor.top);
+
+ *pWinInfo = winfo;
+ }
+}
+
//=============================================================================
//
// GetMyWindowPlacement()
//
-//
WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO* hMonitorInfo)
{
WINDOWPLACEMENT wndpl;
@@ -2639,16 +2674,86 @@ WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO* hMonitorInfo)
wi.max = IsZoomed(hwnd) || (wndpl.flags & WPF_RESTORETOMAXIMIZED);
wi.zoom = SciCall_GetZoom();
- if (hMonitorInfo)
- {
- HMONITOR hMonitor = MonitorFromRect(&wndpl.rcNormalPosition, MONITOR_DEFAULTTONEAREST);
- hMonitorInfo->cbSize = sizeof(MONITORINFO);
- GetMonitorInfo(hMonitor, hMonitorInfo);
- }
+ GetMonitorInfoFromRect(&(wndpl.rcNormalPosition), hMonitorInfo);
+
return wi;
}
+// ----------------------------------------------------------------------------
+//=============================================================================
+//
+// FitIntoMonitorWorkArea()
+//
+//
+void FitIntoMonitorWorkArea(RECT* pRect, WININFO* pWinInfo, bool bFullWorkArea)
+{
+ MONITORINFO mi;
+ GetMonitorInfoFromRect(pRect, &mi);
+
+ if (bFullWorkArea) {
+ SetRect(pRect, mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom);
+ // monitor coord -> work area coord
+ pWinInfo->x = mi.rcWork.left - (mi.rcWork.left - mi.rcMonitor.left);
+ pWinInfo->y = mi.rcWork.top - (mi.rcWork.top - mi.rcMonitor.top);
+ pWinInfo->cx = (mi.rcWork.right - mi.rcWork.left);
+ pWinInfo->cy = (mi.rcWork.bottom - mi.rcWork.top);
+ }
+ else {
+ WININFO wi = *pWinInfo;
+ WinInfoToScreen(&wi);
+ // fit into area
+ if (wi.x < mi.rcWork.left) { wi.x = mi.rcWork.left; }
+ if (wi.y < mi.rcWork.top) { wi.y = mi.rcWork.top; }
+ if ((wi.x + wi.cx) > mi.rcWork.right) {
+ wi.x -= (wi.x + wi.cx - mi.rcWork.right);
+ if (wi.x < mi.rcWork.left) { wi.x = mi.rcWork.left; }
+ if ((wi.x + wi.cx) > mi.rcWork.right) { wi.cx = mi.rcWork.right - wi.x; }
+ }
+ if ((wi.y + wi.cy) > mi.rcWork.bottom) {
+ wi.y -= (wi.y + wi.cy - mi.rcWork.bottom);
+ if (wi.y < mi.rcWork.top) { wi.y = mi.rcWork.top; }
+ if ((wi.y + wi.cy) > mi.rcWork.bottom) { wi.cy = mi.rcWork.bottom - wi.y; }
+ }
+ SetRect(pRect, wi.x, wi.y, wi.x + wi.cx, wi.y + wi.cy);
+ // monitor coord -> work area coord
+ pWinInfo->x = wi.x - (mi.rcWork.left - mi.rcMonitor.left);
+ pWinInfo->y = wi.y - (mi.rcWork.top - mi.rcMonitor.top);
+ pWinInfo->cx = wi.cx;
+ pWinInfo->cy = wi.cy;
+ }
+}
+// ----------------------------------------------------------------------------
+
+
+//=============================================================================
+//
+// WindowPlacementFromInfo()
+//
+//
+WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* const pWinInfo)
+{
+ WINDOWPLACEMENT wndpl;
+ ZeroMemory(&wndpl, sizeof(WINDOWPLACEMENT));
+ wndpl.length = sizeof(WINDOWPLACEMENT);
+ wndpl.flags = WPF_ASYNCWINDOWPLACEMENT;
+ wndpl.showCmd = SW_RESTORE;
+ WININFO winfo = INIT_WININFO;
+ if (pWinInfo) {
+ RECT rc = RectFromWinInfo(pWinInfo);
+ winfo = *pWinInfo;
+ FitIntoMonitorWorkArea(&rc, &winfo, false);
+ if (pWinInfo->max) { wndpl.flags &= WPF_RESTORETOMAXIMIZED; }
+ }
+ else {
+ RECT rc; GetWindowRect(hwnd, &rc);
+ FitIntoMonitorWorkArea(&rc, &winfo, true);
+ // TODO: maximize ?
+ }
+ wndpl.rcNormalPosition = RectFromWinInfo(&winfo);
+ return wndpl;
+}
+
//=============================================================================
//
@@ -3051,41 +3156,6 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
SetWindowPos(hDlg, NULL, max(xMin, min(xMax, x)), max(yMin, min(yMax, y)), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
-/*
-
-... only if we are working with nonstandard dialog boxes ...
-
-//=============================================================================
-//
-// SnapToDefaultButton()
-//
-// Why doesn't the "Automatically move pointer to the default button in a dialog box"
-// work for nonstandard dialog boxes, and how do I add it to my own nonstandard dialog boxes?
-// https://blogs.msdn.microsoft.com/oldnewthing/20130826-00/?p=3413/
-//
-void SnapToDefaultButton(HWND hwndBox)
-{
-bool bSnapToDefButton = false;
-if (SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &bSnapToDefButton, 0) && bSnapToDefButton) {
-// get child window at the top of the Z order.
-// for all our MessageBoxs it's the OK or YES button or NULL.
-HWND btn = GetWindow(hwndBox, GW_CHILD);
-if (btn != NULL) {
-WCHAR className[32] = L"";
-GetClassName(btn, className, COUNTOF(className));
-if (lstrcmpi(className, L"Button") == 0) {
-RECT rect;
-int x, y;
-GetWindowRect(btn, &rect);
-x = rect.left + (rect.right - rect.left) / 2;
-y = rect.top + (rect.bottom - rect.top) / 2;
-SetCursorPos(x, y);
-}
-}
-}
-}
-*/
-
//=============================================================================
//
diff --git a/src/Dialogs.h b/src/Dialogs.h
index b7dbf1e50..643c848b4 100644
--- a/src/Dialogs.h
+++ b/src/Dialogs.h
@@ -37,7 +37,10 @@ bool SelectEncodingDlg(HWND,int *);
bool RecodeDlg(HWND,int *);
bool SelectDefLineEndingDlg(HWND,int *);
+void WinInfoToScreen(WININFO*);
WININFO GetMyWindowPlacement(HWND,MONITORINFO *);
+void FitIntoMonitorWorkArea(RECT*, WININFO*, bool);
+WINDOWPLACEMENT WindowPlacementFromInfo(HWND, const WININFO* const);
void DialogNewWindow(HWND,bool,bool);
void DialogFileBrowse(HWND);
diff --git a/src/Edit.c b/src/Edit.c
index 924e3b72d..41857e2f6 100644
--- a/src/Edit.c
+++ b/src/Edit.c
@@ -65,7 +65,6 @@ extern HMODULE g_hLngResContainer;
extern HWND g_hwndMain;
extern HWND g_hwndStatus;
extern HWND g_hwndDlgFindReplace;
-extern WININFO g_WinInfo;
extern HICON g_hDlgIcon;
//extern LPMALLOC g_lpMalloc;
@@ -6682,11 +6681,12 @@ void EditCompleteWord(HWND hwnd, bool autoInsert)
LocalFree(t);
}
SendMessage(hwnd, SCI_AUTOCSETIGNORECASE, 1, 0);
- //SendMessage(hwnd, SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE, 1, 0);
- SendMessage(hwnd, SCI_AUTOCSETSEPARATOR, ' ', 0);
- SendMessage(hwnd, SCI_AUTOCSETFILLUPS, 0, (LPARAM)"\t\n\r");
- SendMessage(hwnd, SCI_AUTOCSETCHOOSESINGLE, autoInsert, 0);
- SendMessage(hwnd, SCI_AUTOCSHOW, iRootLen, (LPARAM)(pList + 1));
+ SciCall_AutoCSetIgnoreCase(true);
+ //SendMessage(hwnd, SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, (WPARAM)SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE, 0);
+ SciCall_AutoCSetSeperator(' ');
+ SciCall_AutoCSetFillups("\t\n\r");
+ SciCall_AutoCSetChooseSingle(autoInsert);
+ SciCall_AutoCShow(iRootLen, (pList + 1));
LocalFree(pList);
}
}
diff --git a/src/Helpers.c b/src/Helpers.c
index b42078374..72e28dcb5 100644
--- a/src/Helpers.c
+++ b/src/Helpers.c
@@ -2156,8 +2156,7 @@ static VOID GetTrayWndRect(LPRECT lpTrayRect)
return;
}
- // OK. Haven't found a thing. Provide a default rect based on the current work
- // area
+ // OK. Haven't found a thing. Provide a default rect based on the current work area
SystemParametersInfo(SPI_GETWORKAREA,0,lpTrayRect,0);
lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH;
lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT;
diff --git a/src/Helpers.h b/src/Helpers.h
index cd84cb429..c394b2660 100644
--- a/src/Helpers.h
+++ b/src/Helpers.h
@@ -97,7 +97,6 @@ inline int float2int(float f) { return (int)lroundf(f); }
inline float Round10th(float f) { return (float)float2int(f * 10.0f) / 10; }
inline bool HasNonZeroFraction(float f) { return ((float2int(f * 10.0f) % 10) != 0); }
-
// direct heap allocation
inline LPVOID AllocMem(size_t numBytes, DWORD dwFlags) {
return HeapAlloc(GetProcessHeap(), (dwFlags | HEAP_GENERATE_EXCEPTIONS), numBytes);
@@ -186,6 +185,8 @@ bool SetClipboardTextW(HWND, LPCWSTR);
UINT GetCurrentDPI(HWND hwnd);
UINT GetCurrentPPI(HWND hwnd);
HBITMAP ResizeImageForCurrentDPI(HBITMAP hbmp);
+#define ScaleIntToCurrentDPI(val) MulDiv((val), g_uCurrentDPI, USER_DEFAULT_SCREEN_DPI)
+inline int ScaleToCurrentDPI(float fVal) { return float2int((fVal * g_uCurrentDPI) / (float)USER_DEFAULT_SCREEN_DPI); }
#define ScaleIntFontSize(val) MulDiv((val), g_uCurrentDPI, g_uCurrentPPI)
inline int ScaleFontSize(float fSize) { return float2int((fSize * g_uCurrentDPI) / (float)g_uCurrentPPI); }
inline int ScaleFractionalFontSize(float fSize) { return float2int((fSize * 10.0f * g_uCurrentDPI) / (float)g_uCurrentPPI) * 10; }
diff --git a/src/Notepad3.c b/src/Notepad3.c
index 1fb4769f1..f645adb26 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -274,7 +274,6 @@ const int FontQuality[4] = {
};
-
static WININFO g_WinInfo = INIT_WININFO;
static int g_WinCurrentWidth = 0;
@@ -989,18 +988,28 @@ void EndWaitCursor()
// _InitWindowPosition()
//
//
-static void __fastcall _InitWindowPosition(HWND hwnd)
+#define _BORDEROFFSET (IsWin10() ? 8 : 16)
+
+
+static void __fastcall _InitDefaultWndPos(WININFO* pWinInfo)
+{
+ RECT rcMon = RectFromWinInfo(pWinInfo);
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcMon, 0);
+
+ WININFO wiWorkArea = INIT_WININFO;
+ FitIntoMonitorWorkArea(&rcMon, &wiWorkArea, true); // get Monitor and Work Area
+ RECT const rc = RectFromWinInfo(&wiWorkArea); // use Work Area as RECT
+
+ pWinInfo->y = rc.top + _BORDEROFFSET;
+ pWinInfo->cy = rc.bottom - rc.top - (_BORDEROFFSET * 2);
+ pWinInfo->cx = (rc.right - rc.left) / 2; //min(rc.right - rc.left - 32, g_WinInfo.cy);
+ pWinInfo->x = (g_flagDefaultPos == 3) ? rc.left + _BORDEROFFSET : rc.right - g_WinInfo.cx - _BORDEROFFSET;
+}
+// ----------------------------------------------------------------------------
+
+
+static void __fastcall _InitWindowPosition()
{
- RECT rc;
- if (hwnd) {
- GetWindowRect(hwnd, &rc);
- }
- else {
- rc.left = g_WinInfo.x;
- rc.top = g_WinInfo.y;
- rc.right = g_WinInfo.x + g_WinInfo.cx;
- rc.bottom = g_WinInfo.y + g_WinInfo.cy;
- }
if (g_flagDefaultPos == 1)
{
@@ -1010,7 +1019,13 @@ static void __fastcall _InitWindowPosition(HWND hwnd)
}
else if (g_flagDefaultPos >= 4)
{
- SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
+ RECT rcMon = RectFromWinInfo(&g_WinInfo);
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcMon, 0);
+
+ WININFO wiWorkArea = INIT_WININFO;
+ FitIntoMonitorWorkArea(&rcMon, &wiWorkArea, true); // get Monitor and Work Area
+ RECT const rc = RectFromWinInfo(&wiWorkArea); // use Work Area as RECT
+
if (g_flagDefaultPos & 8)
g_WinInfo.x = (rc.right - rc.left) / 2;
else
@@ -1038,53 +1053,23 @@ static void __fastcall _InitWindowPosition(HWND hwnd)
g_WinInfo.cy -= (g_flagDefaultPos & (16 | 32)) ? 12 : 16;
g_WinInfo.max = 1;
g_WinInfo.zoom = 0;
-
}
}
else if (g_flagDefaultPos == 2 || g_flagDefaultPos == 3) // NP3 default window position
{
- SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
- g_WinInfo.y = rc.top + 16;
- g_WinInfo.cy = rc.bottom - rc.top - 32;
- g_WinInfo.cx = (rc.right - rc.left)/2; //min(rc.right - rc.left - 32, g_WinInfo.cy);
- g_WinInfo.x = (g_flagDefaultPos == 3) ? rc.left + 16 : rc.right - g_WinInfo.cx - 16;
+ _InitDefaultWndPos(&g_WinInfo);
}
- else { // fit window into working area of current monitor
+ else { // restore window, move upper left corner to Work Area
+
+ RECT rcMon = RectFromWinInfo(&g_WinInfo);
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcMon, 0);
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST);
- GetMonitorInfo(hMonitor, &mi);
-
- g_WinInfo.x += (mi.rcWork.left - mi.rcMonitor.left);
- g_WinInfo.y += (mi.rcWork.top - mi.rcMonitor.top);
- if (g_WinInfo.x < mi.rcWork.left)
- g_WinInfo.x = mi.rcWork.left;
- if (g_WinInfo.y < mi.rcWork.top)
- g_WinInfo.y = mi.rcWork.top;
- if (g_WinInfo.x + g_WinInfo.cx > mi.rcWork.right) {
- g_WinInfo.x -= (g_WinInfo.x + g_WinInfo.cx - mi.rcWork.right);
- if (g_WinInfo.x < mi.rcWork.left)
- g_WinInfo.x = mi.rcWork.left;
- if (g_WinInfo.x + g_WinInfo.cx > mi.rcWork.right)
- g_WinInfo.cx = mi.rcWork.right - g_WinInfo.x;
- }
- if (g_WinInfo.y + g_WinInfo.cy > mi.rcWork.bottom) {
- g_WinInfo.y -= (g_WinInfo.y + g_WinInfo.cy - mi.rcWork.bottom);
- if (g_WinInfo.y < mi.rcWork.top)
- g_WinInfo.y = mi.rcWork.top;
- if (g_WinInfo.y + g_WinInfo.cy > mi.rcWork.bottom)
- g_WinInfo.cy = mi.rcWork.bottom - g_WinInfo.y;
- }
- SetRect(&rc, g_WinInfo.x, g_WinInfo.y, g_WinInfo.x + g_WinInfo.cx, g_WinInfo.y + g_WinInfo.cy);
+ WININFO wiWin = g_WinInfo; wiWin.cx = wiWin.cy = _BORDEROFFSET * 2; // really small
+ FitIntoMonitorWorkArea(&rcMon, &wiWin, false);
+
+ g_WinInfo.x = wiWin.x;
+ g_WinInfo.y = wiWin.y;
- RECT rc2;
- if (!IntersectRect(&rc2, &rc, &mi.rcWork)) {
- g_WinInfo.y = mi.rcWork.top + 16;
- g_WinInfo.cy = mi.rcWork.bottom - mi.rcWork.top - 32;
- g_WinInfo.cx = min(mi.rcWork.right - mi.rcWork.left - 32, g_WinInfo.cy);
- g_WinInfo.x = mi.rcWork.right - g_WinInfo.cx - 16;
- }
}
g_WinCurrentWidth = g_WinInfo.cx;
@@ -1099,20 +1084,22 @@ static void __fastcall _InitWindowPosition(HWND hwnd)
HWND InitInstance(HINSTANCE hInstance,LPWSTR pszCmdLine,int nCmdShow)
{
UNUSED(pszCmdLine);
-
- g_hwndMain = NULL;
-
- _InitWindowPosition(g_hwndMain);
+
+ _InitWindowPosition();
+
+ // get monitor coordinates from g_WinInfo
+ WININFO srcninfo = g_WinInfo;
+ WinInfoToScreen(&srcninfo);
g_hwndMain = CreateWindowEx(
0,
wchWndClass,
- L"" APPNAME,
+ TEXT(APPNAME),
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- g_WinInfo.x,
- g_WinInfo.y,
- g_WinInfo.cx,
- g_WinInfo.cy,
+ srcninfo.x,
+ srcninfo.y,
+ srcninfo.cx,
+ srcninfo.cy,
NULL,
NULL,
hInstance,
@@ -1124,6 +1111,7 @@ HWND InitInstance(HINSTANCE hInstance,LPWSTR pszCmdLine,int nCmdShow)
if ((bAlwaysOnTop || g_flagAlwaysOnTop == 2) && g_flagAlwaysOnTop != 1) {
SetWindowPos(g_hwndMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
+
if (bTransparentMode) {
SetWindowTransparentMode(g_hwndMain, true);
}
@@ -2689,10 +2677,9 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam)
RestoreWndFromTray(hwnd);
ShowOwnedPopups(hwnd, true);
}
-
else if (iCmd == IDM_TRAY_EXIT) {
//ShowNotifyIcon(hwnd,false);
- SendMessage(hwnd, WM_CLOSE, 0, 0);
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
}
}
break;
@@ -2711,6 +2698,22 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam)
}
+static bool __fastcall _IsInlineIMEActive()
+{
+ bool result = false;
+ if (g_IMEInteraction) {
+ HIMC himc = ImmGetContext(g_hwndEdit);
+ if (himc) {
+ DWORD dwConversion = IME_CMODE_ALPHANUMERIC, dwSentence = 0;
+ if (ImmGetConversionStatus(himc, &dwConversion, &dwSentence)) {
+ result = !(dwConversion == IME_CMODE_ALPHANUMERIC);
+ }
+ ImmReleaseContext(g_hwndEdit, himc);
+ }
+ }
+ return result;
+}
+
//=============================================================================
//
@@ -3320,7 +3323,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_FILE_EXIT:
- SendMessage(hwnd,WM_CLOSE,0,0);
+ PostMessage(hwnd,WM_CLOSE,0,0);
break;
@@ -4733,8 +4736,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_AUTOCOMPLETEWORDS:
g_bAutoCompleteWords = (g_bAutoCompleteWords) ? false : true; // toggle
- if (!g_bAutoCompleteWords)
- SendMessage(g_hwndEdit, SCI_AUTOCCANCEL, 0, 0); // close the auto completion list
+ if (!g_bAutoCompleteWords) {
+ SciCall_AutoCCancel(); // close the auto completion list
+ }
break;
case IDM_VIEW_ACCELWORDNAV:
@@ -4897,15 +4901,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
case IDM_VIEW_TOOLBAR:
- if (bShowToolbar) {
- bShowToolbar = 0;
- ShowWindow(g_hwndReBar,SW_HIDE);
- }
- else {
- bShowToolbar = 1;
- UpdateToolbar();
- ShowWindow(g_hwndReBar,SW_SHOW);
- }
+ bShowToolbar = !bShowToolbar;
+ ShowWindow(g_hwndReBar, (bShowToolbar ? SW_SHOW : SW_HIDE));
+ UpdateToolbar();
SendWMSize(hwnd, NULL);
break;
@@ -4918,17 +4916,10 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
SendMessage(g_hwndToolbar,TB_CUSTOMIZE,0,0);
break;
-
case IDM_VIEW_STATUSBAR:
- if (bShowStatusbar) {
- bShowStatusbar = 0;
- ShowWindow(g_hwndStatus,SW_HIDE);
- }
- else {
- bShowStatusbar = 1;
- UpdateStatusbar(false);
- ShowWindow(g_hwndStatus,SW_SHOW);
- }
+ bShowStatusbar = !bShowStatusbar;
+ ShowWindow(g_hwndStatus, (bShowStatusbar ? SW_SHOW : SW_HIDE));
+ UpdateStatusbar(bShowStatusbar);
SendWMSize(hwnd, NULL);
break;
@@ -5143,18 +5134,21 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case CMD_ESCAPE:
//close the autocomplete box
- SendMessage(g_hwndEdit,SCI_AUTOCCANCEL,0, 0);
+ SciCall_AutoCCancel();
- if (iEscFunction == 1)
- SendMessage(hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0);
- else if (iEscFunction == 2)
- SendMessage(hwnd,WM_CLOSE,0,0);
+ if (iEscFunction == 1) {
+ SendMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ }
+ else if (iEscFunction == 2) {
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ }
break;
case CMD_SHIFTESC:
- if (FileSave(true,false,false,false))
- SendMessage(hwnd,WM_CLOSE,0,0);
+ if (FileSave(true, false, false, false)) {
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ }
break;
@@ -5334,20 +5328,20 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
- case CMD_LEXHTML:
- Style_SetHTMLLexer(g_hwndEdit);
- UpdateToolbar();
- UpdateStatusbar(false);
- UpdateLineNumberWidth();
- break;
+ //case CMD_LEXHTML:
+ // Style_SetHTMLLexer(g_hwndEdit);
+ // UpdateToolbar();
+ // UpdateStatusbar(false);
+ // UpdateLineNumberWidth();
+ // break;
- case CMD_LEXXML:
- Style_SetXMLLexer(g_hwndEdit);
- UpdateToolbar();
- UpdateStatusbar(false);
- UpdateLineNumberWidth();
- break;
+ //case CMD_LEXXML:
+ // Style_SetXMLLexer(g_hwndEdit);
+ // UpdateToolbar();
+ // UpdateStatusbar(false);
+ // UpdateLineNumberWidth();
+ // break;
case CMD_TIMESTAMPS:
@@ -5593,8 +5587,20 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
+ case CMD_INITIALWINPOS:
+ SnapToWinInfoPos(hwnd, &g_WinInfo, false);
+ break;
+
+ case CMD_FULLSCRWINPOS:
+ SnapToWinInfoPos(hwnd, &g_WinInfo, true);
+ break;
+
case CMD_DEFAULTWINPOS:
- SnapToDefaultPos(hwnd);
+ {
+ WININFO winfo = g_WinInfo;
+ _InitDefaultWndPos(&winfo);
+ SnapToWinInfoPos(hwnd, &winfo, false);
+ }
break;
@@ -5766,7 +5772,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDT_FILE_EXIT:
- SendMessage(hwnd,WM_CLOSE,0,0);
+ PostMessage(hwnd,WM_CLOSE,0,0);
break;
@@ -5973,7 +5979,7 @@ void OpenHotSpotURL(DocPos position, bool bForceBrowser)
//=============================================================================
//
-// _HandleAutoCloseTags()
+// _HandleAutoIndent()
//
static void __fastcall _HandleAutoIndent(int const charAdded) {
// in CRLF mode handle LF only...
@@ -6305,7 +6311,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
else if (scn->ch == '?') {
_HandleTinyExpr();
}
- else if (g_bAutoCompleteWords && !SendMessage(g_hwndEdit, SCI_AUTOCACTIVE, 0, 0)) {
+ else if (g_bAutoCompleteWords && !SciCall_AutoCActive() && !_IsInlineIMEActive()) {
EditCompleteWord(g_hwndEdit, false);
}
}
@@ -6967,20 +6973,20 @@ void LoadSettings()
StringCchPrintf(tchMaximized, COUNTOF(tchMaximized), L"%ix%i Maximized", ResX, ResY);
StringCchPrintf(tchZoom, COUNTOF(tchZoom), L"%ix%i Zoom", ResX, ResY);
- g_WinInfo.x = IniSectionGetInt(pIniSection, tchPosX, INT_MAX - 1);
- g_WinInfo.y = IniSectionGetInt(pIniSection, tchPosY, INT_MAX - 1);
- g_WinInfo.cx = IniSectionGetInt(pIniSection, tchSizeX, INT_MAX - 1);
- g_WinInfo.cy = IniSectionGetInt(pIniSection, tchSizeY, INT_MAX - 1);
+ g_WinInfo.x = IniSectionGetInt(pIniSection, tchPosX, (INT_MAX >> 1));
+ g_WinInfo.y = IniSectionGetInt(pIniSection, tchPosY, (INT_MAX >> 1));
+ g_WinInfo.cx = IniSectionGetInt(pIniSection, tchSizeX, (INT_MAX >> 1));
+ g_WinInfo.cy = IniSectionGetInt(pIniSection, tchSizeY, (INT_MAX >> 1));
g_WinInfo.max = IniSectionGetInt(pIniSection, tchMaximized, 0);
- if (g_WinInfo.max) g_WinInfo.max = 1;
+ 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);
-
- if (((g_WinInfo.x & ~CW_USEDEFAULT) == (INT_MAX - 1)) ||
- ((g_WinInfo.y & ~CW_USEDEFAULT) == (INT_MAX - 1)) ||
- ((g_WinInfo.cx & ~CW_USEDEFAULT) == (INT_MAX - 1)) ||
- ((g_WinInfo.cy & ~CW_USEDEFAULT) == (INT_MAX - 1))) {
- g_flagDefaultPos = 2;
+ if (((g_WinInfo.x & ~CW_USEDEFAULT) == (INT_MAX >> 1)) ||
+ ((g_WinInfo.y & ~CW_USEDEFAULT) == (INT_MAX >> 1)) ||
+ ((g_WinInfo.cx & ~CW_USEDEFAULT) == (INT_MAX >> 1)) ||
+ ((g_WinInfo.cy & ~CW_USEDEFAULT) == (INT_MAX >> 1))) {
+ g_flagDefaultPos = 2; // std. default position (CmdLn: /pd)
}
}
@@ -7400,7 +7406,6 @@ void ParseCommandLine()
if (itok == 4 || itok == 5) { // scan successful
g_flagPosParam = 1;
g_flagDefaultPos = 0;
-
if (g_WinInfo.cx < 1) g_WinInfo.cx = CW_USEDEFAULT;
if (g_WinInfo.cy < 1) g_WinInfo.cy = CW_USEDEFAULT;
if (g_WinInfo.max) g_WinInfo.max = 1;
@@ -10058,37 +10063,54 @@ bool RelaunchElevated(LPWSTR lpArgs) {
//=============================================================================
//
-// SnapToDefaultPos()
-//
+// SnapToWinInfoPos()
// Aligns Notepad3 to the default window position on the current screen
//
-//
-void SnapToDefaultPos(HWND hwnd)
-{
- RECT rcOld; GetWindowRect(hwnd, &rcOld);
-
- RECT rc; SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
-
- g_flagDefaultPos = 2;
- _InitWindowPosition(hwnd);
+void SnapToWinInfoPos(HWND hwnd, const WININFO* const pWinInfo, bool bFullWorkArea)
+{
+ static WINDOWPLACEMENT s_wndplPrev;
+ static bool s_bPrevFullWAFlag = false;
+ static bool s_bPrevShowToolbar = true;
+ static bool s_bPrevShowStatusbar = true;
WINDOWPLACEMENT wndpl;
- ZeroMemory(&wndpl, sizeof(WINDOWPLACEMENT));
- wndpl.length = sizeof(WINDOWPLACEMENT);
- wndpl.flags = WPF_ASYNCWINDOWPLACEMENT;
- wndpl.showCmd = SW_RESTORE;
+ RECT rcCurrent; GetWindowRect(hwnd, &rcCurrent);
- wndpl.rcNormalPosition.left = g_WinInfo.x - rc.left;
- wndpl.rcNormalPosition.top = g_WinInfo.y - rc.top;
- wndpl.rcNormalPosition.right = g_WinInfo.x - rc.left + g_WinInfo.cx;
- wndpl.rcNormalPosition.bottom = g_WinInfo.y - rc.top + g_WinInfo.cy;
+ if (bFullWorkArea) {
+ if (s_bPrevFullWAFlag) { // snap to previous rect
+ bShowToolbar = s_bPrevShowToolbar;
+ bShowStatusbar = s_bPrevShowStatusbar;
+ wndpl = s_wndplPrev;
+ }
+ else {
+ GetWindowPlacement(hwnd, &s_wndplPrev);
+ s_bPrevShowToolbar = bShowToolbar;
+ s_bPrevShowStatusbar = bShowStatusbar;
+ bShowToolbar = bShowStatusbar = false;
+ wndpl = WindowPlacementFromInfo(hwnd, NULL);
+ }
+ s_bPrevFullWAFlag = !s_bPrevFullWAFlag;
+ }
+ else {
+ wndpl = WindowPlacementFromInfo(hwnd, pWinInfo);
+ if (s_bPrevFullWAFlag) {
+ bShowToolbar = s_bPrevShowToolbar;
+ bShowStatusbar = s_bPrevShowStatusbar;
+ }
+ s_bPrevFullWAFlag = false;
+ }
if (GetDoAnimateMinimize()) {
- DrawAnimatedRects(hwnd,IDANI_CAPTION,&rcOld,&wndpl.rcNormalPosition);
+ DrawAnimatedRects(hwnd, IDANI_CAPTION, &rcCurrent, &wndpl.rcNormalPosition);
//OffsetRect(&wndpl.rcNormalPosition,mi.rcMonitor.left - mi.rcWork.left,mi.rcMonitor.top - mi.rcWork.top);
}
- SetWindowPlacement(hwnd,&wndpl);
- SciCall_SetZoom(g_WinInfo.zoom);
+
+ SetWindowPlacement(hwnd, &wndpl);
+ SciCall_SetZoom(pWinInfo->zoom);
+
+ UpdateToolbar();
+ UpdateStatusbar(true);
+ UpdateLineNumberWidth();
}
diff --git a/src/Notepad3.h b/src/Notepad3.h
index c72d78b66..9c0a43aad 100644
--- a/src/Notepad3.h
+++ b/src/Notepad3.h
@@ -116,7 +116,7 @@ void EndWaitCursor();
bool ActivatePrevInst();
bool RelaunchMultiInst();
bool RelaunchElevated(LPWSTR);
-void SnapToDefaultPos(HWND);
+void SnapToWinInfoPos(HWND, const WININFO* const, bool);
void ShowNotifyIcon(HWND,bool);
void SetNotifyIconTitle(HWND);
void InstallFileWatching(LPCWSTR);
diff --git a/src/Notepad3.rc b/src/Notepad3.rc
index 0dcfed460..58dc3ccc3 100644
--- a/src/Notepad3.rc
+++ b/src/Notepad3.rc
@@ -212,9 +212,10 @@ BEGIN
VK_ESCAPE, CMD_SHIFTESC, VIRTKEY, SHIFT, NOINVERT
VK_F1, IDM_HELP_ONLINEDOCUMENTATION, VIRTKEY, NOINVERT
VK_F1, IDM_HELP_ABOUT, VIRTKEY, SHIFT, NOINVERT
- VK_F11, CMD_LEXDEFAULT, VIRTKEY, NOINVERT
- VK_F11, CMD_LEXHTML, VIRTKEY, CONTROL, NOINVERT
- VK_F11, CMD_LEXXML, VIRTKEY, SHIFT, NOINVERT
+ VK_F11, CMD_FULLSCRWINPOS, VIRTKEY, NOINVERT
+ VK_F11, CMD_INITIALWINPOS, VIRTKEY, CONTROL, NOINVERT
+ //VK_F11, CMD_LEXHTML, VIRTKEY, CONTROL, NOINVERT
+ VK_F11, CMD_LEXDEFAULT, VIRTKEY, SHIFT, NOINVERT
VK_F12, IDM_VIEW_SCHEME, VIRTKEY, NOINVERT
VK_F12, IDM_VIEW_SCHEMECONFIG, VIRTKEY, CONTROL, NOINVERT
VK_F12, IDM_VIEW_FONT, VIRTKEY, ALT, NOINVERT
diff --git a/src/SciCall.h b/src/SciCall.h
index 05298b8db..6b4c4589f 100644
--- a/src/SciCall.h
+++ b/src/SciCall.h
@@ -246,6 +246,16 @@ DeclareSciCallR2(GetCurLine, GETCURLINE, DocPos, unsigned int, length, const cha
DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options)
+DeclareSciCallR0(AutoCActive, AUTOCACTIVE, bool)
+DeclareSciCallV0(AutoCComplete, AUTOCCOMPLETE)
+DeclareSciCallV0(AutoCCancel, AUTOCCANCEL)
+DeclareSciCallV1(AutoCSetIgnoreCase, AUTOCSETIGNORECASE, bool, flag)
+DeclareSciCallV1(AutoCSetSeperator, AUTOCSETSEPARATOR, char, seperator)
+DeclareSciCallV01(AutoCSetFillups, AUTOCSETFILLUPS, const char*, text)
+DeclareSciCallV1(AutoCSetChooseSingle, AUTOCSETCHOOSESINGLE, bool, flag)
+DeclareSciCallV2(AutoCShow, AUTOCSHOW, int, len, const char*, list)
+
+
//=============================================================================
//
// Commands
diff --git a/src/Styles.c b/src/Styles.c
index 70105840d..f1bc3924a 100644
--- a/src/Styles.c
+++ b/src/Styles.c
@@ -93,7 +93,7 @@ EDITLEXER lexStandard = { SCLEX_NULL, IDS_LEX_DEF_TXT, L"Default Text", L"txt; t
/* 9 */ { SCI_SETCARETFORE+SCI_SETCARETWIDTH, IDS_LEX_STD_CARET, L"Caret (Color, Size 1-3)", L"", L"" },
/* 10 */ { SCI_SETEDGECOLOUR, IDS_LEX_STD_LONG_LN, L"Long Line Marker (Colors)", L"fore:#FFC000", L"" },
/* 11 */ { SCI_SETEXTRAASCENT+SCI_SETEXTRADESCENT, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:2", L"" },
- /* 12 */ { SCI_FOLDALL+SCI_MARKERSETALPHA, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"size:+0; fore:#000000; back:#808080; alpha:80", L"" },
+ /* 12 */ { SCI_FOLDALL+SCI_MARKERSETALPHA, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"size:+2; fore:#000000; back:#808080; alpha:80", L"" },
/* 13 */ { SCI_MARKERSETBACK+SCI_MARKERSETALPHA, IDS_LEX_STR_63262, L"Mark Occurrences (Indicator)", L"alpha:100; alpha2:100; indic_roundbox", L"" },
/* 14 */ { SCI_SETHOTSPOTACTIVEFORE, IDS_LEX_STR_63264, L"Hyperlink Hotspots", L"italic; fore:#0000FF", L"" },
{ -1, 00000, L"", L"", L"" } } };
@@ -112,7 +112,7 @@ EDITLEXER lexStandard2nd = { SCLEX_NULL, IDS_LEX_STR_63266, L"2nd Default Text",
/* 9 */ { SCI_SETCARETFORE + SCI_SETCARETWIDTH, IDS_LEX_2ND_CARET, L"2nd Caret (Color, Size 1-3)", L"", L"" },
/* 10 */ { SCI_SETEDGECOLOUR, IDS_LEX_2ND_LONG_LN, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" },
/* 11 */ { SCI_SETEXTRAASCENT + SCI_SETEXTRADESCENT, IDS_LEX_2ND_X_SPC, L"2nd Extra Line Spacing (Size)", L"", L"" },
- /* 12 */ { SCI_FOLDALL + SCI_MARKERSETALPHA, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"size:+0; fore:#000000; back:#808080; alpha:80; charset:2; case:U", L"" },
+ /* 12 */ { SCI_FOLDALL + SCI_MARKERSETALPHA, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"size:+2; fore:#000000; back:#808080; alpha:80; charset:2; case:U", L"" },
/* 13 */ { SCI_MARKERSETBACK + SCI_MARKERSETALPHA, IDS_LEX_STR_63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0x000000; alpha:100; alpha2:220; indic_box", L"" },
/* 14 */ { SCI_SETHOTSPOTACTIVEFORE, IDS_LEX_STR_63265, L"2nd Hyperlink Hotspots", L"bold; fore:#FF0000", L"" },
{ -1, 00000, L"", L"", L"" } } };
@@ -4122,8 +4122,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();
- int const iSizeDPI = ScaleFontSize(fSize + 3.0f);
+ int const iSizeDPI = ScaleToCurrentDPI(fSize + zoomPoints);
SciCall_SetMarginWidthN(MARGIN_SCI_FOLDING, (bShowCodeFolding) ? iSizeDPI : 0);
}
@@ -4138,13 +4139,15 @@ 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();
- int const iSizeDPI = ScaleFontSize(fSize + 6.0f);
+ int const iSizeDPI = ScaleToCurrentDPI(fSize + zoomPoints);
SciCall_SetMarginWidthN(MARGIN_SCI_BOOKMRK, (bShowSelMargin) ? iSizeDPI : 0);
// Depending on if the margin is visible or not, choose different bookmark indication
if (bShowSelMargin) {
SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_BOOKMARK);
+ //SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_SHORTARROW);
}
else {
SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_BACKGROUND);
diff --git a/src/TypeDefs.h b/src/TypeDefs.h
index 2054a6356..078f9e5f0 100644
--- a/src/TypeDefs.h
+++ b/src/TypeDefs.h
@@ -63,6 +63,15 @@ typedef struct _wi
#define INIT_WININFO { CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 }
+
+inline RECT RectFromWinInfo(const WININFO* const pWinInfo) {
+ RECT rc; SetRect(&rc, pWinInfo->x, pWinInfo->y, pWinInfo->x + pWinInfo->cx, pWinInfo->y + pWinInfo->cy); return rc;
+}
+
+// ----------------------------------------------------------------------------
+
+
+
// --------------------------------------------------------------------------
typedef enum BufferSizes
diff --git a/src/Version.h b/src/Version.h
index fea965114..d6aeff012 100644
Binary files a/src/Version.h and b/src/Version.h differ