Merge pull request #638 from RaiKoHoff/Dev_0829

Notepad3 window positioning
This commit is contained in:
Rainer Kottenhoff 2018-09-01 16:16:11 +02:00 committed by GitHub
commit f2afbc732a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 390 additions and 273 deletions

View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -265,7 +265,7 @@
<ItemGroup>
<ClCompile Include="src\Dialogs.c" />
<ClCompile Include="src\Dlapi.c" />
<ClCompile Include="src\Dropsource.cpp" />
<ClCompile Include="src\DropSource.cpp" />
<ClCompile Include="src\Helpers.c" />
<ClCompile Include="src\minipath.c" />
</ItemGroup>
@ -273,7 +273,7 @@
<ClInclude Include="language\common_res.h" />
<ClInclude Include="src\Dialogs.h" />
<ClInclude Include="src\Dlapi.h" />
<ClInclude Include="src\Dropsource.h" />
<ClInclude Include="src\DropSource.h" />
<ClInclude Include="src\Helpers.h" />
<ClInclude Include="src\minipath.h" />
<ClInclude Include="src\resource.h" />

View File

@ -25,15 +25,15 @@
<ClCompile Include="src\Dlapi.c">
<Filter>C/C++ Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Dropsource.cpp">
<Filter>C/C++ Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Helpers.c">
<Filter>C/C++ Source Files</Filter>
</ClCompile>
<ClCompile Include="src\minipath.c">
<Filter>C/C++ Source Files</Filter>
</ClCompile>
<ClCompile Include="src\DropSource.cpp">
<Filter>C/C++ Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Dialogs.h">
@ -42,9 +42,6 @@
<ClInclude Include="src\Dlapi.h">
<Filter>H Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Dropsource.h">
<Filter>H Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Helpers.h">
<Filter>H Source Files</Filter>
</ClInclude>
@ -60,6 +57,9 @@
<ClInclude Include="language\common_res.h">
<Filter>H Source Files</Filter>
</ClInclude>
<ClInclude Include="src\DropSource.h">
<Filter>H Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\Hover.cur">

View File

@ -15,88 +15,70 @@
#define _WIN32_WINNT 0x601
#include <windows.h>
//#include <strsafe.h>
#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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);
}
}
}
}
*/
//=============================================================================
//

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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; }

View File

@ -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();
}

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

Binary file not shown.